@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #e3e9f0;
  --border: #c9d3de;
  --ink: #16233a;
  --ink-soft: #4b5a71;
  --ink-faint: #7c8aa0;
  --accent: #2b5f8a;
  --accent-ink: #ffffff;
  --highlight: #d9722a;
  --highlight-soft: #fbe6d3;
  --req: #b3401f;
  --readonly-bg: #e7ebf0;
  --readonly-ink: #5a6a80;
  --code-bg: #e3e9f0;
  --shadow: 0 1px 2px rgba(22,35,58,0.06), 0 4px 14px rgba(22,35,58,0.05);
}

:root:not([data-theme="light"]) {
  @media (prefers-color-scheme: dark) {
    --bg: #0e2a47;
    --surface: #123256;
    --surface-2: #163a63;
    --border: #2a5580;
    --ink: #dcecf7;
    --ink-soft: #a9c3db;
    --ink-faint: #7f9cb8;
    --accent: #6fb6e8;
    --accent-ink: #08233c;
    --highlight: #f0a860;
    --highlight-soft: #2e3f2c;
    --req: #ff9a72;
    --readonly-bg: #16385c;
    --readonly-ink: #93add1;
    --code-bg: #0c2440;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 14px rgba(0,0,0,0.25);
  }
}

:root[data-theme="dark"] {
  --bg: #0e2a47;
  --surface: #123256;
  --surface-2: #163a63;
  --border: #2a5580;
  --ink: #dcecf7;
  --ink-soft: #a9c3db;
  --ink-faint: #7f9cb8;
  --accent: #6fb6e8;
  --accent-ink: #08233c;
  --highlight: #f0a860;
  --highlight-soft: #2e3f2c;
  --req: #ff9a72;
  --readonly-bg: #16385c;
  --readonly-ink: #93add1;
  --code-bg: #0c2440;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 14px rgba(0,0,0,0.25);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans', -apple-system, Segoe UI, sans-serif;
  line-height: 1.5;
}
code, .mono { font-family: 'IBM Plex Mono', ui-monospace, Consolas, monospace; }

.shell {
  display: block;
  max-width: 1200px;
  margin: 0 auto;
}

header.page {
  padding: 2.25rem 2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
header.page .eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
header.page h1 {
  margin: 0.35rem 0 0.4rem;
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  font-weight: 700;
  text-wrap: balance;
}
header.page p.sub {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  max-width: 62ch;
}
.stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.stat {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.stat b { color: var(--ink); font-size: 1rem; font-variant-numeric: tabular-nums; }

.search-row {
  margin-top: 1.1rem;
  display: flex;
  gap: 0.6rem;
  max-width: 480px;
}
p.hint {
  margin: 0.55rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-faint);
}
.chevron-inline {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
}
#search {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
}
#search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn {
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Syncfusion-style horizontal tab strip - a wrapping row of pill/underline tabs instead of a
   fixed-width left sidebar, matching CM's own SfTab (Overflow="Wrap") look and behavior. Each
   <a> still jumps to its section via the URL fragment exactly as before (and the browser's
   native behavior auto-opens the target <details> even when it's inside a closed one) - only
   the layout/appearance changed, not the navigation mechanism. */
nav.toc { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.2rem; padding: 0.6rem 2rem; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
nav.toc a { display: inline-flex; align-items: center; padding: 0.4rem 0.75rem; border-radius: 8px 8px 0 0; color: var(--ink-soft); text-decoration: none; font-size: 0.85rem; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease; }
nav.toc a:hover { background: var(--surface-2); color: var(--ink); }
nav.toc a.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--surface-2); font-weight: 600; }
nav.toc a.entity-link { font-weight: 700; color: var(--accent); }
nav.toc .tab-links { display: contents; }

main {
  padding: 1.5rem 2rem 4rem;
  min-width: 0;
}

.entity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
}
.entity-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}
.entity-card p { margin: 0; color: var(--ink-soft); }
.entity-card p.order-note {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border);
  font-size: 0.85rem;
}
.entity-card p.order-note strong { color: var(--highlight); }

details.tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.8rem;
  box-shadow: var(--shadow);
  scroll-margin-top: 1rem;
}
details.tab[open] { border-color: var(--accent); }
details.tab summary {
  list-style: none;
  cursor: pointer;
  padding: 0.95rem 1.2rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  justify-content: space-between;
}
details.tab summary:hover { background: var(--surface-2); }
details.tab:not([open]) summary { border-radius: 10px; }
details.tab summary::-webkit-details-marker { display: none; }
/* Title sits on its own row; the description wraps as its own block directly beneath it,
   starting at the exact same left edge as the title itself - not beside it on one line. */
.tab-title-group { display: grid; grid-template-columns: auto 1fr; column-gap: 0.65rem; min-width: 0; }
.tab-num { display: none; }
.tab-title { grid-column: 2; grid-row: 1; font-weight: 600; font-size: 1.02rem; white-space: nowrap; }
.tab-desc { grid-column: 2; grid-row: 2; display: block; color: var(--ink-soft); font-size: 0.88rem; margin-top: 0.2rem; }
/* A visible always-on-accent-color chevron (not just faint gray) is a stronger, more obvious
   "this section expands" cue than relying on cursor:pointer + hover alone. */
.chevron {
  color: var(--accent);
  font-size: 1.35rem;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
details.tab[open] .chevron { transform: rotate(90deg); }

.tab-body { padding: 0 1.2rem 1.1rem; border-top: 1px solid var(--border); }

.panel { margin-top: 1rem; }
.panel-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}
.panel-desc { color: var(--ink-soft); font-size: 0.85rem; margin: -0.25rem 0 0.6rem; }

.table-scroll {
  overflow-x: auto;
}
/* table-layout: fixed + explicit widths on columns 1 and 3 means every table.fields on the
   page (each tab has its own separate table) lines up its Description column at the same
   left edge, instead of each table auto-sizing column 1 to its own widest row. */
table.fields {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: fixed;
}
table.fields th:first-child, table.fields td:first-child { width: 30%; }
table.fields th:last-child, table.fields td:last-child { width: 20%; }
table.fields th {
  text-align: left;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
table.fields td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.fields tr:last-child td { border-bottom: none; }
table.fields tr:hover td { background: var(--surface-2); }
.fname { font-family: 'IBM Plex Mono', monospace; font-size: 0.83rem; white-space: nowrap; }
.fname .req { color: var(--req); margin-left: 0.15rem; }
/* A "/"-joined field-name cell (e.g. "Bar Code / Model No / Serial No") is stacked as a
   bullet list instead of one long nowrap string, so the column doesn't force the
   description column narrower than it needs to be. */
.fname-list { list-style: disc; margin: 0; padding-left: 1.1em; }
.fname-list li { white-space: normal; word-break: break-word; }
.fdesc { color: var(--ink-soft); }
.badge {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  white-space: nowrap;
}
.badge.ro { background: var(--readonly-bg); color: var(--readonly-ink); }
.badge.edit { background: var(--highlight-soft); color: var(--highlight); }

mark {
  background: var(--highlight);
  color: var(--accent-ink);
  border-radius: 3px;
  padding: 0 0.1em;
}

.no-match { color: var(--ink-faint); font-size: 0.85rem; padding: 0.5rem 0; display: none; }

footer.page {
  padding: 1.5rem 2rem 2.5rem;
  color: var(--ink-faint);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  header.page { padding: 1.5rem 1rem 1rem; }
  nav.toc { padding: 0.5rem 0.75rem; gap: 0.2rem 0.15rem; }
  nav.toc a { padding: 0.35rem 0.6rem; font-size: 0.8rem; }
  main { padding: 1rem 1rem 3rem; }
  footer.page { padding: 1rem; }
}
/* PHONES: stack each row so the name sits above its description. The two-column shape needs
   about 560px - below that td.fname's nowrap keeps its column wide and the description is
   squeezed into a 55px ribbon two words wide. Measured at 375px before changing it. */
@media (max-width: 560px) {
  table.fields, table.fields tbody, table.fields tr, table.fields td { display: block; width: auto; }
  table.fields td { border-top: none; padding: 0 0 0.35rem; }
  td.fname { white-space: normal; width: auto; padding-bottom: 0.1rem; }
  table.fields tr + tr { border-top: 1px solid var(--border); padding-top: 0.55rem; margin-top: 0.2rem; }
}
