:root {
  --navy: #07346f;
  --blue: #1666c5;
  --green: #178b52;
  --bg: #f3f6fa;
  --text: #172033;
  --muted: #5f6b7a;
  --line: #dbe2ea;
  --white: #fff;
  --danger: #b42318;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: "Segoe UI", "Yu Gothic UI", Meiryo, sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; }
.page-shell { width: 100%; min-height: 100vh; display: flex; flex-direction: column; background: var(--white); }
.app-header { min-height: 86px; display: flex; align-items: center; gap: 14px; padding: 18px 20px; color: #fff; background: linear-gradient(135deg, #062a5c, #0a438f); box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.app-header.compact { min-height: 72px; justify-content: space-between; padding: 12px 18px; }
.brand-mark { font-size: 34px; }
.brand-title { font-size: 21px; font-weight: 700; line-height: 1.2; }
.brand-title.small { font-size: 17px; text-align: center; }
.brand-subtitle { margin-top: 3px; font-size: 13px; opacity: .95; }
.header-center { text-align: center; }
.back-link { width: 32px; text-decoration: none; font-size: 36px; line-height: 1; }
.header-spacer { width: 32px; }
.content { flex: 1; width: min(100%, 760px); margin: 0 auto; padding: 24px 18px 36px; }
.top-content { width: min(100%, 620px); }
.hero-card { text-align: center; padding: 18px 8px 26px; }
.hero-card h1 { margin: 0 0 12px; font-size: 34px; }
.hero-card h1 span { display: block; margin-top: 4px; font-size: 23px; }
.hero-card p { margin: 0; line-height: 1.8; color: var(--muted); }
.menu-list { display: grid; gap: 14px; }
.menu-card { display: grid; grid-template-columns: 64px 1fr 22px; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; background: #fff; box-shadow: 0 4px 14px rgba(19,48,85,.08); }
.menu-card:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(19,48,85,.13); }
.menu-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; font-size: 31px; }
.menu-copy h2 { margin: 0 0 6px; font-size: 18px; }
.menu-copy h2 span { display: block; margin-top: 3px; font-size: 16px; }
.menu-copy p { margin: 0; font-size: 13px; line-height: 1.65; color: var(--muted); }
.menu-arrow { font-size: 34px; color: var(--navy); }
.info-box { margin-top: 20px; padding: 16px 18px; border-left: 4px solid var(--blue); border-radius: 10px; background: #eef5ff; font-size: 13px; line-height: 1.65; }
.info-box p { margin: 5px 0 0; color: var(--muted); }
.compact-box strong:not(:first-child) { display: block; margin-top: 12px; }
.app-footer { padding: 15px; text-align: center; font-size: 12px; color: #fff; background: var(--navy); }
.equipment-card, .search-card { padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 6px 20px rgba(19,48,85,.08); }
.field-label { font-size: 13px; color: var(--muted); }
.equipment-id { margin-top: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); color: #144fa3; font-size: 25px; font-weight: 750; letter-spacing: .01em; word-break: break-all; }
.message-box { margin-top: 18px; padding: 16px; border-radius: 10px; background: #f7f9fc; color: var(--muted); text-align: center; }
.message-box.error { background: #fff1f0; color: var(--danger); }
.equipment-main { display: grid; grid-template-columns: 150px 1fr; gap: 20px; margin-top: 22px; }
.equipment-image-placeholder { min-height: 220px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(145deg, #f9fbfd, #e8edf3); color: #6b7785; font-size: 28px; font-weight: 800; }
.equipment-summary h1 { margin: 0 0 14px; font-size: 24px; }
dl { margin: 0; }
dl div { margin-bottom: 11px; }
dt { font-size: 12px; color: var(--muted); }
dd { margin: 3px 0 0; font-weight: 600; word-break: break-word; }
.status-badge { display: inline-block; padding: 5px 10px; border-radius: 999px; background: #dff3cf; color: #236b22; font-size: 13px; }
.action-list { display: grid; gap: 11px; margin-top: 24px; }
.action-button { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-radius: 8px; color: #fff; text-decoration: none; font-weight: 700; }
.action-button.primary { background: var(--blue); }
.action-button.success { background: var(--green); }
.action-button small { font-size: 13px; }
.action-button b { font-size: 28px; font-weight: 400; }
.search-card { max-width: 520px; margin: 0 auto; }
.search-card h2 { margin-top: 0; }
.search-card p { color: var(--muted); line-height: 1.7; }
.search-card label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.search-card input { width: 100%; padding: 13px 14px; border: 1px solid #bfc9d5; border-radius: 8px; font-size: 16px; text-transform: uppercase; }
.search-card button { width: 100%; margin-top: 12px; padding: 13px 16px; border: 0; border-radius: 8px; background: var(--blue); color: #fff; font-size: 16px; font-weight: 700; cursor: pointer; }
@media (max-width: 560px) {
  .content { padding: 18px 12px 26px; }
  .equipment-card { padding: 17px 15px; }
  .equipment-main { grid-template-columns: 105px 1fr; gap: 14px; }
  .equipment-image-placeholder { min-height: 180px; font-size: 22px; }
  .equipment-summary h1 { font-size: 20px; }
  .equipment-id { font-size: 22px; }
}
@media (min-width: 800px) {
  body { padding: 28px; }
  .page-shell { max-width: 920px; margin: 0 auto; min-height: calc(100vh - 56px); border-radius: 18px; overflow: hidden; box-shadow: 0 18px 48px rgba(16,37,63,.16); }
}

.brand-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.82;
  margin-bottom: 0.08rem;
}

.compact-kicker {
  font-size: 0.58rem;
  margin-bottom: 0.02rem;
}

/* Rev003: Equipment and inspection status */
.status-panel { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #f8fafc; }
.status-panel-title { margin-bottom: 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.status-grid > div { padding: 11px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.status-grid > div > span:first-child { display: block; margin-bottom: 8px; font-size: 11px; color: var(--muted); }
.status-badge { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.15; }
.status-badge strong { font-size: inherit; }
.status-badge span { font-size: .9em; font-weight: 600; }
.status-large { padding: 11px 16px; border-radius: 12px; }
.status-large strong { font-size: 18px; }
.status-large span { font-size: 13px; }
.status-in-use, .inspection-valid, .overall-ok { background: #dff3cf; color: #236b22; }
.status-out-of-service, .status-expired, .inspection-overdue, .overall-stop { background: #fde3e1; color: #9d1c13; }
.status-lost, .status-disposed, .inspection-na { background: #e6e8eb; color: #3f4752; }
.status-not-set, .inspection-not-set, .inspection-due-soon { background: #fff1bf; color: #7a5800; }
.equipment-media { min-width: 0; }
.equipment-photo { width: 100%; height: 220px; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.detail-grid > div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.detail-grid span { display: block; margin-bottom: 5px; font-size: 11px; color: var(--muted); }
.detail-grid strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.action-button.disabled { background: #8b949e; cursor: not-allowed; opacity: .76; pointer-events: none; }
@media (max-width: 560px) {
  .status-grid, .detail-grid { grid-template-columns: 1fr; }
  .equipment-photo { height: 180px; }
}

/* Version 1.0.2: live Kintone data and inspection result emphasis */
.result-text { display: inline-block; padding: 4px 8px; border-radius: 7px; }
.result-pass { color: #236b22; background: #dff3cf; }
.result-caution, .overall-caution { color: #7a5800; background: #fff1bf; }
.result-fail { color: #9d1c13; background: #fde3e1; }

/* Version 1.1.0: customer-facing details page */
.detail-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 18px;
  border-bottom: 1px solid #d8e0eb;
}
.detail-tab {
  appearance: none;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  padding: 12px 8px 10px;
  color: #536174;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.detail-tab small { font-size: .78em; font-weight: 600; }
.detail-tab.active { color: #0b4c9c; border-bottom-color: #176dcc; }
.detail-tab-panel { animation: detailsFade .18s ease-out; }
@keyframes detailsFade { from { opacity: .35; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.details-hero {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 18px;
}
.details-photo-wrap {
  min-height: 140px;
  display: grid;
  place-items: center;
  border: 1px solid #dce3ec;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f8fc;
}
.details-photo-wrap .equipment-image-placeholder { width: 100%; min-height: 140px; border: 0; border-radius: 0; }
.details-photo { display: block; width: 100%; height: 170px; object-fit: contain; background: #fff; }
.details-title { margin: 0 0 6px; color: #12213a; font-size: 1.55rem; }
.details-subtitle { margin: 0; color: #5d6a7b; font-weight: 600; }
.information-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.information-list > div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #dce3ec;
  border-radius: 9px;
  background: #f7f9fc;
}
.information-list dt { margin: 0 0 5px; color: #69778a; font-size: .78rem; }
.information-list dd { margin: 0; color: #16243a; font-weight: 700; overflow-wrap: anywhere; }
.section-heading { margin-bottom: 14px; }
.section-heading h2 { margin: 0 0 5px; font-size: 1.15rem; color: #12213a; }
.section-heading p { margin: 0; color: #6b7789; font-size: .85rem; }
.empty-state { padding: 28px 14px; border: 1px dashed #c9d3df; border-radius: 10px; color: #69778a; text-align: center; background: #fafbfd; }
.details-actions { margin-top: 18px; }
.details-actions .action-button b { order: -1; }

@media (max-width: 620px) {
  .details-hero { grid-template-columns: 105px minmax(0, 1fr); gap: 14px; }
  .details-photo-wrap, .details-photo-wrap .equipment-image-placeholder { min-height: 110px; }
  .details-photo { height: 130px; }
  .details-title { font-size: 1.25rem; }
  .information-list { grid-template-columns: 1fr; }
}

/* Version 1.1.1: reliable hidden state and constrained detail images */
[hidden] { display: none !important; }
.details-photo-wrap { width: 100%; height: 170px; min-height: 0; }
.details-photo-wrap .equipment-image-placeholder { width: 100%; height: 100%; min-height: 0; }
.details-photo { width: 100%; height: 100%; max-width: 100%; max-height: 170px; object-fit: contain; object-position: center; }
@media (max-width: 620px) {
  .details-photo-wrap { height: 130px; }
  .details-photo { max-height: 130px; }
}


/* Version 1.1.2: absolute asset loading and strict detail image containment */
.details-photo-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  min-width: 140px;
  min-height: 140px;
  max-width: 140px;
  max-height: 140px;
  overflow: hidden;
}
.details-photo-wrap .details-photo {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}
.details-photo-wrap .equipment-image-placeholder {
  width: 100%;
  height: 100%;
  min-height: 0;
}
@media (max-width: 620px) {
  .details-photo-wrap {
    width: 105px;
    height: 105px;
    min-width: 105px;
    min-height: 105px;
    max-width: 105px;
    max-height: 105px;
  }
}
