/* Smartec Take-off — design system.
   Every value here is a decision. Nothing is a framework default. */

:root {
  /* chrome */
  --navy:        #171B3C;
  --navy-hover:  #23274D;
  --navy-active: #2C3160;
  --navy-rule:   #2A2F55;
  --navy-text:   #A9AEC9;
  --navy-dim:    #7E84A8;
  --navy-icon:   #8E93B4;
  --navy-bright: #D6D8E6;
  --navy-faint:  #6E7499;

  /* accent */
  --lilac:       #5B4FB0;
  --lilac-hover: #3D3480;
  --lilac-bright:#8B7FD4;
  --lilac-icon:  #C6BCF5;
  --lilac-wash:  #F6F4FF;

  /* ground */
  --ground:      #FAF9F7;
  --panel:       #FFFFFF;
  --subtle:      #FCFBF9;
  --drawing-bg:  #F1EFEA;

  /* ink */
  --ink:         #1A1A24;
  --ink-muted:   #5C5F72;
  --ink-dim:     #8A8D9C;

  /* rules */
  --rule:        #E4E2DC;
  --rule-soft:   #EFEDE8;
  --rule-faint:  #F4F2ED;
  --rule-strong: #C9C6BE;
  --rule-mid:    #D8D5CE;

  /* states */
  --pass:        #2E7D52;
  --pass-deep:   #1E5638;
  --pass-wash:   #EDF7F1;
  --pass-rule:   #BFE0CE;
  --query:       #9A4A12;
  --query-mid:   #8A6A20;
  --query-wash:  #FBF0E6;
  --query-rule:  #EDD3B6;
  --query-dot:   #C77B2E;
  /* a count that does not reconcile. Not the query brown: a query is the
     drawing asking a question, a failure is the count being wrong. */
  --fail:        #B42318;
  --fail-deep:   #8A1B12;
  --fail-wash:   #FDF1EF;
  --fail-rule:   #F2C4BD;

  --ink-soft:    #3A3D52;

  --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  --r-sm: 6px; --r: 7px; --r-md: 8px; --r-lg: 10px;

  /* the drawing's share of a narrow screen, where it sits above the count */
  --viewer-h: 46vh;
}
/* svh does not change as a phone's address bar slides in and out, so the
   pinned drawing does not jump while the count scrolls beneath it */
@supports (height: 1svh) { :root { --viewer-h: 46svh; } }

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  font-family: var(--sans);
  background: var(--ground);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--lilac); }
a:hover { color: var(--lilac-hover); }

.mono { font-family: var(--mono); }
.num  { font-family: var(--mono); font-weight: 600; letter-spacing: -0.03em; }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

.side {
  width: 226px; flex-shrink: 0; background: var(--navy);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.side__brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 20px; }
.side__mark {
  width: 26px; height: 26px; border-radius: var(--r-sm); background: var(--lilac-bright);
  display: flex; align-items: center; justify-content: center;
}
.side__name { color: var(--ground); font-size: 14px; font-weight: 600; letter-spacing: -0.015em; display: block; }
.side__sub  { color: var(--navy-dim); font-size: 11px; letter-spacing: 0.02em; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  border-radius: var(--r); text-decoration: none;
  color: var(--navy-text); font-size: 13.5px; font-weight: 400;
  transition: background .12s ease, color .12s ease;
}
.nav a:hover { background: var(--navy-hover); color: var(--navy-bright); }
.nav a.is-on { background: var(--navy-active); color: var(--ground); font-weight: 500; }
.nav a svg { stroke: var(--navy-icon); flex-shrink: 0; }
.nav a.is-on svg { stroke: var(--lilac-icon); }
.nav span:first-of-type { flex-grow: 1; }
.pill {
  font-size: 11px; font-family: var(--mono); color: var(--navy-icon);
  background: var(--navy-hover); border-radius: 9px; padding: 1px 7px;
}
.nav a.is-on .pill { color: var(--navy); background: var(--lilac-bright); font-weight: 600; }
.nav__rule { height: 1px; background: var(--navy-rule); margin: 9px 12px; }

.side__user {
  border-top: 1px solid var(--navy-rule); padding: 14px 0 0 6px;
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 27px; height: 27px; border-radius: 50%; background: #3A4070;
  display: flex; align-items: center; justify-content: center;
  color: var(--lilac-icon); font-size: 11px; font-weight: 600;
}
.side__user span { display: block; }
.side__user .u1 { color: var(--navy-bright); font-size: 12.5px; }
.side__user .u2 { color: var(--navy-faint); font-size: 11px; }

/* List pages scroll inside the shell. The review screen does not: its
   drawing and count panel scroll on their own (main--review). */
.main { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0;
        overflow-y: auto; }
.main--review { overflow: hidden; }

/* ----------------------------------------------------------------- bar */
.bar {
  flex-shrink: 0; background: var(--panel); border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; padding: 0 26px; gap: 16px;
}
.bar--tall { height: 84px; }
.bar--short { height: 66px; }
.crumbs { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.crumbs a { color: var(--ink-muted); text-decoration: none; }
.crumbs a:hover { color: var(--lilac); }
.crumbs .sep { color: var(--rule-strong); }
.crumbs .here { color: var(--ink-dim); }
.bar h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.bar h1.sheet { font-size: 17px; font-family: var(--mono); }
.bar h1.sheet .rev { font-family: var(--sans); font-weight: 400; color: var(--ink-muted); font-size: 14px; }
.bar__meta { font-size: 11.5px; color: var(--ink-muted); }
.bar__stack { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.grow { flex-grow: 1; }

.badge {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  border-radius: var(--r); font-size: 12px; font-weight: 500;
}
.badge--pass  { background: var(--pass-wash);  border: 1px solid var(--pass-rule);  color: var(--pass-deep); }
.badge--query { background: var(--query-wash); border: 1px solid var(--query-rule); color: var(--query); }
.badge--fail  { background: var(--fail-wash);  border: 1px solid var(--fail-rule);  color: var(--fail-deep); font-weight: 600; }
.badge svg { flex-shrink: 0; }
.badge__scope { font-weight: 400; opacity: .8; }

.btn {
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--ink);
  background: var(--panel); border: 1px solid var(--rule-strong);
  border-radius: var(--r); padding: 9px 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: border-color .12s ease, background .12s ease;
}
.btn:hover { background: var(--subtle); border-color: var(--ink-dim); }
a.btn { text-decoration: none; }
a.btn:hover { color: var(--ink); }
.btn:disabled { color: var(--ink-dim); cursor: default; }
.btn:disabled:hover { background: var(--panel); border-color: var(--rule-strong); }
.btn--primary {
  color: var(--ground); background: var(--lilac); border: none;
  font-weight: 600; padding: 10px 16px;
}
.btn--primary:hover { background: var(--lilac-hover); }
.btn--bare { border: none; background: transparent; padding: 6px 9px; font-size: 12px; color: var(--ink-soft); }
.btn--bare:hover { background: var(--rule-faint); }

/* A strip under the bar that says what is holding a sheet back. */
.notice {
  flex-shrink: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  padding: 10px 26px; font-size: 12.5px; line-height: 1.45; border-bottom: 1px solid;
}
.notice strong { font-weight: 600; }
.notice .btn { margin-left: auto; padding: 6px 12px; font-size: 12.5px; }
.notice--query { background: var(--query-wash); border-color: var(--query-rule); color: var(--query); }
.notice--fail  { background: var(--fail-wash);  border-color: var(--fail-rule);  color: var(--fail-deep); }

/* --------------------------------------------------------------- pages */
.page { flex: 1 0 auto; padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; }

.stats { display: flex; gap: 13px; }
.stat {
  flex-grow: 1; background: var(--panel); border: 1px solid var(--rule);
  border-radius: var(--r-lg); padding: 15px 17px;
  display: flex; flex-direction: column; gap: 5px;
}
.label {
  font-size: 10.5px; color: var(--ink-muted); text-transform: uppercase;
  letter-spacing: 0.07em; font-weight: 600;
}
.stat__n { font-size: 25px; }
.stat__note { font-size: 11.5px; color: var(--ink-muted); }

.card {
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-lg);
  display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0;
}
.grid-row {
  display: grid; grid-template-columns: 2.6fr 1.6fr .9fr .9fr 1.5fr; gap: 16px;
  padding: 15px 22px; border-bottom: 1px solid var(--rule-faint);
  text-decoration: none; color: inherit;
}
.grid-row--head { padding: 12px 22px; border-bottom: 1px solid var(--rule); background: var(--subtle); }
a.grid-row:hover { background: var(--lilac-wash); }
.grid-row--sheets  { grid-template-columns: 2.8fr 1.1fr .9fr .9fr 1.6fr; }
.grid-row--offices { grid-template-columns: 2.4fr 1.2fr .9fr .9fr 1.4fr; }
.grid-row--symbols { grid-template-columns: 62px 3.2fr .8fr .8fr .8fr 1.8fr; align-items: center; }
.r { text-align: right; }
.stack { display: flex; flex-direction: column; gap: 3px; }
.t1 { font-size: 13.5px; font-weight: 600; }
.t2 { font-size: 11.5px; color: var(--ink-muted); }
.mid { align-self: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; }

/* -------------------------------------------------------------- review */
.split { flex-grow: 1; display: flex; min-height: 0; }

.viewer {
  flex-grow: 1; position: relative; background: var(--drawing-bg);
  overflow: hidden; min-width: 0; cursor: grab; touch-action: none;
}
.viewer.is-dragging { cursor: grabbing; }
.viewer__stage { position: absolute; transform-origin: 0 0; will-change: transform; }
.viewer__stage img { display: block; width: 100%; height: 100%; }
.viewer__stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
[hidden] { display: none !important; }
.marker { fill: none; stroke-width: 2.2; opacity: .9; transition: opacity .15s ease; }
.viewer.is-filtered .marker { opacity: .07; }
.viewer.is-filtered .marker.is-on { opacity: 1; }

.float {
  position: absolute; background: var(--panel); border: 1px solid var(--rule-mid);
  border-radius: var(--r-md); box-shadow: 0 1px 2px rgba(23,27,60,.06);
}
.float--zoom { left: 16px; bottom: 16px; display: flex; align-items: center; gap: 5px; padding: 5px; }
.float--note { left: 16px; top: 16px; padding: 9px 12px; display: flex; align-items: center; gap: 13px; font-size: 12px; color: var(--ink-soft); }
.float--show { right: 16px; top: 16px; padding: 11px 13px; display: flex; flex-direction: column; gap: 8px; }
.iconbtn {
  width: 30px; height: 30px; border: none; background: transparent; border-radius: 5px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.iconbtn:hover { background: var(--rule-faint); }
.zoomval { font-size: 12px; font-family: var(--mono); color: var(--ink-soft); min-width: 46px; text-align: center; }
.vrule { width: 1px; height: 18px; background: var(--rule); margin: 0 2px; }
.linkbtn {
  font-family: inherit; font-size: 12px; color: var(--lilac); border: none;
  background: transparent; cursor: pointer; padding: 0; text-decoration: underline;
}
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; }
.check input { width: 14px; height: 14px; accent-color: var(--lilac); cursor: pointer; }

.panel {
  width: 430px; flex-shrink: 0; background: var(--panel);
  border-left: 1px solid var(--rule); display: flex; flex-direction: column;
}
.panel__head {
  padding: 15px 20px 12px; border-bottom: 1px solid var(--rule-soft);
  display: flex; align-items: baseline; gap: 9px; flex-shrink: 0;
}
.panel__n { font-size: 28px; }
.panel__of { font-size: 13px; color: var(--ink-muted); }
.chip {
  font-size: 12px; color: var(--query); text-decoration: none; font-weight: 500;
  background: var(--query-wash); border: 1px solid var(--query-rule);
  border-radius: var(--r-sm); padding: 5px 10px;
}
.panel__scroll { overflow-y: auto; flex-grow: 1; }
.group {
  padding: 10px 20px 8px; display: flex; align-items: center;
  border-top: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft);
  background: var(--subtle); position: sticky; top: 0; z-index: 1;
}
.group .label { flex-grow: 1; }
.group .n { font-size: 11.5px; color: var(--ink-dim); font-family: var(--mono); }

.row {
  width: 100%; text-align: left; font: inherit; color: inherit;
  padding: 12px 20px; display: flex; gap: 12px; align-items: flex-start;
  border: none; border-bottom: 1px solid var(--rule-faint);
  border-left: 3px solid transparent; background: transparent; cursor: pointer;
  transition: background .12s ease;
}
.row:hover { background: var(--subtle); }
.row.is-on { background: var(--lilac-wash); border-left-color: var(--lilac); }
.swatch {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: var(--r);
  border: 1px solid #E4E1DA; background: var(--panel);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.swatch img { width: 100%; height: 100%; object-fit: contain; }
.row__body { flex-grow: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row__name { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.row__meta { font-size: 11.5px; color: var(--ink-muted); }
.row__meta .mono { color: var(--ink); }
.row__prov { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 11.5px; }
.row__prov--pass  { color: var(--pass); }
.row__prov--query { color: var(--query-mid); }
.row__n { font-size: 20px; }
.code {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  padding: 1px 4px; border-radius: 3px; color: var(--panel);
}

.failed { padding: 12px 20px; border-bottom: 1px solid var(--fail-rule); background: var(--fail-wash); }
.failed .row__name { color: var(--fail-deep); }
.failed .row__meta { color: var(--ink); }

.foot {
  flex-shrink: 0; border-top: 1px solid var(--rule); padding: 11px 20px;
  display: flex; align-items: center; gap: 10px; background: var(--subtle);
  font-size: 11.5px; color: var(--ink-muted); line-height: 1.45;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: #DCD9D2; border-radius: 5px; border: 3px solid var(--panel); }
::-webkit-scrollbar-thumb:hover { background: #C9C6BE; }

/* ------------------------------------------------------------- job screen */
.empty { padding: 56px 24px; text-align: center; color: var(--ink-muted); }
.empty p { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--ink); }
.empty p.t2 { font-weight: 400; }

.drop.is-over { border-color: var(--lilac); background: var(--lilac-wash); }

.spin {
  width: 13px; height: 13px; border-radius: 50%; display: inline-block;
  border: 2px solid var(--rule); border-top-color: var(--lilac);
  animation: spin .7s linear infinite;
}
.spin--lg { width: 30px; height: 30px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------- modal */
.modal {
  border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 0;
  background: var(--panel); box-shadow: 0 18px 48px rgba(23,27,60,.18);
  width: 420px; max-width: calc(100vw - 32px); color: var(--ink);
}
.modal::backdrop { background: rgba(23,27,60,.34); }
.modal form { padding: 22px 24px 18px; display: flex; flex-direction: column; gap: 14px; }
.modal h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.modal label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  font-weight: 600; color: var(--ink-muted);
}
.modal input {
  font: 400 13.5px var(--sans); color: var(--ink); padding: 9px 11px;
  border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--ground);
}
.modal input:focus { outline: 2px solid var(--lilac); outline-offset: -1px; border-color: var(--lilac); }
.modal__foot { display: flex; gap: 9px; justify-content: flex-end; margin-top: 4px; }

.note {
  margin: 0; padding: 14px 18px; font-size: 12px; line-height: 1.6;
  color: var(--ink-muted); background: var(--panel);
  border: 1px solid var(--rule); border-radius: var(--r-lg); max-width: 96ch;
}
.note strong { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------- responsive
   Estimators review on a large monitor, a laptop, a tablet and a phone, and on
   a phone they must be able to do a full review, sign-off included (decided
   23 Sep 2026). Desktop is the base; each step below rethinks the layout for
   the space it has rather than shrinking it. */

@media (max-width: 1180px) {
  .panel { width: 360px; }
}

/* Tablet and narrow laptop: the sidebar becomes a top bar, so the drawing
   keeps the width. */
@media (max-width: 1024px) {
  .shell { flex-direction: column; }
  .side { width: auto; flex-direction: row; align-items: center; gap: 14px; padding: 8px 16px; }
  .side__brand { padding: 0; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { padding: 8px 10px; }
  .nav__rule { width: 1px; height: 20px; margin: 0 4px; }
  .side > .grow { display: none; }
  .side__user { border-top: 0; padding: 0; margin-left: auto; }
  .side__user > div:last-child { display: none; }
  .bar { padding: 0 20px; }
  .page { padding: 20px; }
}

/* Too narrow for drawing and count side by side. The page scrolls; the
   drawing stays pinned above the count, so tapping a row still shows its
   devices; the header, with Sign off, sits at the top of the scroll. */
@media (max-width: 900px) {
  .bar--tall, .bar--short {
    height: auto; min-height: 66px; flex-wrap: wrap; row-gap: 10px; padding: 12px 16px;
  }
  .bar__stack { flex-basis: 100%; }
  .bar > .grow { display: none; }
  .bar h1.sheet { overflow-wrap: anywhere; }

  .main--review { overflow-y: auto; }
  .split { flex-direction: column; flex: 0 0 auto; }
  .viewer {
    position: sticky; top: 0; z-index: 2; flex: 0 0 auto;
    height: var(--viewer-h); min-height: 280px; border-bottom: 1px solid var(--rule);
  }
  .panel { width: auto; border-left: 0; }
  .panel__scroll { overflow: visible; }
  .group { top: max(var(--viewer-h), 280px); }
}

/* Phone. */
@media (max-width: 640px) {
  .side { gap: 8px; padding: 6px 10px; }
  .side__brand > div:last-child { display: none; }
  .nav a { flex-direction: column; gap: 3px; padding: 6px 8px; font-size: 11px; }
  .nav__rule { display: none; }

  .page { padding: 14px; gap: 14px; }
  .stats { flex-wrap: wrap; gap: 10px; }
  .stat { flex: 1 1 calc(50% - 5px); min-width: 0; }

  /* table rows become stacked entries: the first cell on its own line, the
     rest wrapped beneath it, each saying what it is */
  .grid-row--head { display: none; }
  .grid-row { display: flex; flex-wrap: wrap; column-gap: 14px; row-gap: 6px; padding: 13px 16px; }
  .grid-row > :first-child { flex-basis: 100%; }
  .grid-row .r { text-align: left; }
  .grid-row--symbols > :first-child { flex-basis: auto; }
  .grid-row--symbols > :nth-child(2) { flex: 1 1 0; min-width: 0; }
  .grid-row [data-label]::before {
    content: attr(data-label) "\00a0"; font: 400 11.5px var(--sans); color: var(--ink-muted);
  }

  .panel__head, .group, .row, .foot, .failed { padding-left: 16px; padding-right: 16px; }
  /* the drawing is small here: the Show toggles take as little of it as
     they can, top right, clear of the zoom controls */
  .float--show { gap: 2px; padding: 6px 10px; }
  .float--show .label { display: none; }
}

/* Touch: controls get a finger-sized target without growing their marks. */
@media (pointer: coarse) {
  .iconbtn { width: 40px; height: 40px; }
  .btn--bare { min-height: 40px; padding: 8px 12px; }
  .check { min-height: 36px; }
  .check input { width: 18px; height: 18px; }
  .row { padding-top: 14px; padding-bottom: 14px; }
  .crumbs a { padding: 10px 0; }
}

/* ------------------------------------------------------ legend confirmation */
.grid-row--legend { grid-template-columns: 62px 3fr .9fr 2.2fr; align-items: center; }
.grid-row--legend.is-settled { background: var(--subtle); }
.grid-row--legend.is-settled .t1 { color: var(--ink-muted); }
.swatch--lg { width: 54px; height: 54px; }
.flags { display: flex; flex-wrap: wrap; gap: 5px; }
.flag {
  font-size: 11.5px; color: var(--ink-muted); background: var(--subtle);
  border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 1px 7px;
}
.flag--query { color: var(--query); background: var(--query-wash); border-color: var(--query-rule); }
.flag--pass  { color: var(--pass-deep); background: var(--pass-wash); border-color: var(--pass-rule); }
.device, .field input {
  font: 400 13.5px var(--sans); color: var(--ink); padding: 8px 10px; width: 100%;
  border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--panel);
}
.device:focus, .field input:focus { outline: 2px solid var(--lilac); outline-offset: -1px; border-color: var(--lilac); }
.device:disabled { color: var(--ink-muted); background: var(--subtle); }
.legend-office { padding: 16px 20px; gap: 8px; }
.legend-office .t2 { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; max-width: 420px; }
.field input[readonly] { background: var(--subtle); }
.legend-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.legend-foot .t2 { flex: 1 1 320px; }

@media (max-width: 640px) {
  .grid-row--legend > :first-child { flex-basis: auto; }
  .grid-row--legend > :nth-child(2) { flex: 1 1 0; min-width: 0; }
  .grid-row--legend .device { flex-basis: 100%; }
  .notice { padding: 10px 16px; }
}
