/*
 * Dock Control — components.
 *
 * The design prototype used inline styles on every element because it was
 * generated; here the same geometry lives in classes, so a row is one class
 * rather than forty declarations repeated per row.
 *
 * Three typefaces, three jobs, and they never trade places:
 *   Archivo        money and headlines. Variable width, always tabular figures.
 *   Space Grotesk  anything a human wrote — job names, notes, sentences.
 *   JetBrains Mono the machine voice. ALL CAPS, wide tracking, small.
 */

/* ------------------------------------------------------------------ base */

* { box-sizing: border-box; }

html, body, #root {
  height: 100%;
  margin: 0;
}
/* #root matters as much as the other two: .app is height:100%, and a
   percentage height against an auto-height parent resolves to auto — so
   without this a short screen leaves the sidebar and rail stopping halfway
   down the window. */

body {
  background: var(--bg-page);
  color: var(--ink);
  font: 400 14px/1.5 "Space Grotesk", system-ui, sans-serif;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}

/* The one animation in the design. Status lamps breathe; blocking ones
   breathe faster, which is the only motion cue the console has. */
@keyframes lamp { 0%, 100% { opacity: 1 } 50% { opacity: .45 } }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; color: inherit; }

::placeholder { color: var(--ink-fainter); }

/* ------------------------------------------------------- type primitives */

.mono {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 10px;
}
.mono-sm { font-size: 9px; letter-spacing: .1em; }
.mono-xs { font-size: 8.5px; letter-spacing: .16em; }

.num {
  font-family: "Archivo", system-ui, sans-serif;
  font-variation-settings: "wdth" 112;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

.title {
  font-family: "Archivo", system-ui, sans-serif;
  font-variation-settings: "wdth" 108;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.01em;
}

.label   { color: var(--ink-label); }
.meta    { color: var(--ink-meta); }
.faint   { color: var(--ink-faint); }
.fainter { color: var(--ink-fainter); }
.good    { color: var(--good); }
.bad     { color: var(--bad); }
.amber   { color: var(--accent); }
.bronze  { color: var(--bronze); }

/* ---------------------------------------------------------------- shell */

.app {
  display: grid;
  grid-template-columns: 212px 1fr;
  height: 100%;
  background: var(--bg-page);
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--bg-rail);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 17px 17px 15px;
  border-bottom: 1px solid var(--line);
}

.mark {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 3px;
  background: linear-gradient(140deg, var(--accent), var(--accent-deep));
  box-shadow: 0 0 12px var(--accent-35);
}

.brand-name { font-size: 11px; font-weight: 700; letter-spacing: .14em; }
.brand-sub  { font-size: 9px; letter-spacing: .16em; color: var(--ink-meta); }

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 10px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border-left: 2px solid transparent;
  border-radius: 5px;
  color: var(--ink-label);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-decoration: none;
}
.nav a:hover { background: var(--sheen); color: var(--ink-2); }
.nav a.on {
  background: var(--accent-13);
  border-left-color: var(--accent);
  color: var(--accent);
}
.nav .count {
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--accent);
  color: var(--bg-page);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
}

/* The sidebar footer changes per tab: who is signed in on Approvals, what
   effective dating means on Catalog. Same slot, different sentence. */
.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: auto;
  padding: 15px 16px;
  border-top: 1px solid var(--line);
}
.sidebar-foot .who { font-size: 13.5px; font-weight: 600; }

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 15px;
  height: 60px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--bg-bulk), var(--bg-topbar-b));
}
.topbar h1 {
  margin: 0;
  font-family: "Archivo", system-ui, sans-serif;
  font-variation-settings: "wdth" 112;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -.01em;
}
.topbar .spacer { flex: 1; }

.body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.col {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 20px;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 13px;
  flex-shrink: 0;
  width: var(--rail-w, 306px);
  overflow: auto;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: var(--bg-rail);
}
/* The rail is a different width per screen — rules need more room than the
   gate does, the stores pane more again — so the width is a variable the
   responsive rules below can override for all of them at once. */
.rail.wide   { --rail-w: 340px; }
.rail.stores { --rail-w: 470px; }

/* ---------------------------------------------------------------- buttons */

.btn {
  padding: 10px 12px;
  border: 1px solid var(--line-muted);
  border-radius: 4px;
  background: transparent;
  color: var(--ink-label);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  white-space: nowrap;
  transition: border-color 110ms, color 110ms, background 110ms;
}
.btn:hover:not(:disabled) { border-color: var(--line-strong); color: var(--ink-2); }
.btn:disabled { opacity: .45; cursor: default; }

.btn.sm  { padding: 7px 9px; font-size: 9px; }
.btn.lg  { padding: 11px 14px; font-size: 10px; letter-spacing: .12em; }

.btn.ghost-amber {
  border-color: var(--accent-40);
  background: var(--accent-08);
  color: var(--accent);
}
.btn.ghost-amber:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

.btn.ok {
  border-color: var(--good-45);
  background: var(--good-10);
  color: var(--good);
}
.btn.no    { border-color: var(--line-card); color: var(--bad-soft); }
.btn.dashed { border-style: dashed; }

.btn.primary {
  border: none;
  padding: 12px 20px;
  border-radius: 5px;
  background: var(--accent);
  color: var(--bg-page);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
}
.btn.primary:disabled {
  background: var(--line);
  color: var(--ink-fainter);
  opacity: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--line-card);
  border-radius: 5px;
  background: var(--bg-panel);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.pill .badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: var(--accent-deep);
  color: var(--bg-page);
  font-size: 9px;
  font-weight: 700;
}

.lamp {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 10px var(--good);
  animation: lamp 2.6s ease-in-out infinite;
}
.lamp.sm  { width: 9px; height: 9px; box-shadow: none; animation: none; }
.lamp.off { background: var(--bad); box-shadow: 0 0 10px var(--bad); animation-duration: 1.6s; }
.lamp.idle { background: var(--ink-disabled); box-shadow: none; animation: none; }

/* ---------------------------------------------------------------- cards */

.card {
  padding: 15px;
  border: 1px solid var(--line-card);
  border-radius: 6px;
  background: var(--bg-panel);
}
.card.dashed {
  border: 1px dashed var(--line-muted);
  background: transparent;
}
.card.amber-dashed {
  border: 1px dashed var(--accent-35);
  background: var(--accent-04);
}
.card.warn {
  border-color: var(--bad-40);
  background: var(--bad-06);
}
.card-head {
  display: flex;
  align-items: baseline;
  gap: 11px;
  margin-bottom: 12px;
}
.card-head .mono { letter-spacing: .18em; font-size: 9.5px; color: var(--ink-label); }

/* The section rule above every group of catalog rows / queue days. */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-row);
  border-radius: 6px;
  background: var(--bg-panel);
}
.row:hover { border-color: var(--line-muted); }
.row.retired { opacity: .45; }
.row.on {
  border-color: var(--accent-55);
  background: var(--bg-selected);
}
.row .grow { flex: 1; min-width: 0; }
.row .name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row .sub { display: block; margin-top: 3px; font-size: 9px; letter-spacing: .1em; color: var(--ink-meta); }

.stack { display: flex; flex-direction: column; gap: 7px; }
.stack.lg { gap: 17px; }
.stack.sm { gap: 4px; }
.rowline { display: flex; align-items: center; gap: 10px; }
.wrapline { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------- queue rows */

.qrow { padding: 13px 15px; gap: 14px; }
.qrow .name { font-size: 15px; white-space: normal; }

.tick {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: transparent;
}
.tick.on { border-color: var(--accent); background: var(--accent); }
.tick i {
  width: 9px;
  height: 9px;
  border-radius: 1px;
  background: var(--bg-page);
  opacity: 0;
}
.tick.on i { opacity: 1; }

.flag {
  align-self: flex-start;
  margin-top: 4px;
  padding: 4px 8px;
  border: 1px solid var(--line-muted);
  border-radius: 3px;
  font-size: 9px;
  letter-spacing: .1em;
  color: var(--ink-meta);
}
.flag.warn { border-color: var(--accent-40); color: var(--accent); }
.flag.stop { border-color: var(--bad-line); color: var(--bad); }

.note {
  margin-top: 4px;
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-body);
}

.amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  width: 186px;
  flex-shrink: 0;
  text-align: right;
}
.amount .n { font-size: 19px; }

.actions { display: flex; gap: 7px; flex-shrink: 0; }

.bulk {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-bulk);
}
/* The summary column is the only thing allowed to compress; the three buttons
   keep their labels at every width. */
.bulk .summary { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.bulk .summary .n { font-size: 16px; white-space: nowrap; }
.bulk .btn { flex-shrink: 0; }

/* ------------------------------------------------------------ meters */

.meter {
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--bg-track);
}
.meter > i { display: block; height: 100%; background: var(--accent); }

/* Eight cells with a gap where the price doubles. The 6px column IS the
   divider — it marks the tier boundary without a separate element. */
.blocks {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 6px repeat(4, 1fr);
  gap: 5px;
}
.blocks i {
  height: 22px;
  border: 1px solid var(--line-muted);
  border-radius: 3px;
  background: var(--bg-track);
}
.blocks i.used { border-color: var(--accent); background: var(--accent); }
.blocks i.used.hard { border-color: var(--accent-deep); background: var(--accent-deep); }
.blocks i.hard:not(.used) {
  background: repeating-linear-gradient(-45deg,
    var(--accent-20) 0 4px, transparent 4px 9px);
}
.blocks .gap { border: none; background: var(--ink-disabled); border-radius: 0; }

/* ------------------------------------------------------------- fields */

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-label);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-card);
  border-radius: 4px;
  background: var(--bg-field);
  font-size: 13.5px;
  font-weight: 500;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent-55);
}
.field.mono-value input,
.field.mono-value select {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.field.num-value input { text-align: center; font-variant-numeric: tabular-nums; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.editor {
  margin-top: 7px;
  padding: 16px;
  border: 1px solid var(--accent-35);
  border-radius: 6px;
  background: var(--bg-selected);
}
.editor-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid var(--line-divider);
}
.editor-foot .why {
  flex: 1;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  line-height: 1.7;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-faint);
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
  padding: 2px;
  border: none;
  border-radius: 9px;
  background: var(--bg-track);
}
.toggle i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink-disabled);
  transition: transform 110ms;
}
.toggle.on { background: var(--good-45); }
.toggle.on i { background: var(--good); transform: translateX(14px); }
.toggle.sm { width: 30px; height: 17px; }
.toggle.sm i { width: 13px; height: 13px; }
.toggle.sm.on i { transform: translateX(13px); }

.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-muted);
  border-radius: 4px;
  background: transparent;
  color: var(--ink-label);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
}
.stepper .v { flex: 1; text-align: center; font-size: 22px; }

/* ---------------------------------------------------------- award table */

.awards-grid {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) 104px 116px 66px 72px 40px 46px;
  gap: 6px;
  align-items: center;
}
.awards-head {
  padding: 0 12px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 8.5px;
  letter-spacing: .16em;
  color: var(--ink-faint);
}
.awards-row {
  padding: 11px 12px;
  border: 1px solid var(--line-row);
  border-radius: 6px;
  background: var(--bg-panel);
}
.awards-row .cell {
  display: block;
  overflow: hidden;
  padding: 6px 7px;
  border: 1px solid var(--line-muted);
  border-radius: 4px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-body);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.awards-row .cell.value {
  border-color: var(--line-card);
  background: var(--bg-field);
  color: var(--ink);
  font-size: 9px;
  letter-spacing: .04em;
  text-align: center;
}

/* ---------------------------------------------------------------- toast */

.toast {
  flex-shrink: 0;
  margin: 12px 20px -4px;
  padding: 11px 14px;
  border: 1px solid var(--line-muted);
  border-radius: 5px;
  background: var(--bg-bar);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-label);
}
.toast.ok  { border-color: var(--good-45); color: var(--good); }
.toast.err { border-color: var(--bad-40);  color: var(--bad-bright); }

.banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--bad-line);
  border-radius: 6px;
  background: var(--bad-10);
}

.empty {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 26px;
  border: 1px dashed var(--line-muted);
  border-radius: 6px;
  background: var(--good-04);
}

/* ------------------------------------------------------------- loading */

.skel {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-panel), var(--bg-inner), var(--bg-panel));
  background-size: 200% 100%;
  animation: skel 1.4s linear infinite;
}
@keyframes skel { to { background-position: -200% 0 } }

/* ------------------------------------------------------------- sign in */

.signin {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--bg-shell);
}
/* The card. It is a plain div rather than the form it used to be, because the
   primary control is now a navigation to Apple and the dev bypass below it is
   a form nested inside — two forms, or a form wrapping a link, would both be
   worse than one box that happens to contain a form. */
.signin-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 380px;
  padding: 26px;
  border: 1px solid var(--line-window);
  border-radius: 11px;
  background: var(--bg-panel);
  box-shadow: 0 30px 70px var(--shadow);
}
.signin-card .devform {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------- responsive */

/* The design is drawn at 1240×860. It degrades by narrowing the rail first,
   then dropping it under the main column, then collapsing the sidebar to
   icons-width. Landscape iPad and phone cuts are separate designs. */
@media (max-width: 1240px) {
  .rail, .rail.wide, .rail.stores { --rail-w: 300px; }
}
@media (max-width: 1080px) {
  .body { flex-direction: column; overflow: auto; }
  .col { min-height: 0; }
  .scroll { overflow: visible; flex: none; }
  .rail, .rail.wide, .rail.stores {
    --rail-w: auto;
    overflow: visible;
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .bulk { position: sticky; bottom: 0; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .amount { width: auto; }
  .qrow { flex-wrap: wrap; }
}

/* ------------------------------------------------------- planning columns */

/*
 * Sample weeks. The job and store rows grow a cell per scenario, and a header
 * above them uses the same template so the columns line up. `--cols` is set on
 * the list container from the number of scenarios, which is why the template
 * can live in one rule instead of being rebuilt in JS per row.
 */
.plan-list { --cols: 2; }

.plan-row {
  display: grid;
  grid-template-columns:
    minmax(150px, 1fr) 74px repeat(var(--cols), minmax(64px, 84px)) 52px;
  gap: 12px;
  align-items: center;
}
.plan-row .grow { min-width: 0; }
.plan-row .tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.plan-row .tags .flag { margin-top: 0; }

.plan-head {
  padding: 0 14px 7px;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  margin-bottom: 8px;
}
.plan-head:hover { border-color: var(--line); }
.plan-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The count box in a scenario column. Small, centred, tabular. */
.count {
  width: 100%;
  padding: 7px 4px;
  border: 1px solid var(--line-card);
  border-radius: 4px;
  background: var(--bg-field);
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.count:focus { outline: none; border-color: var(--accent-55); }
.count.zero { color: var(--ink-fainter); }

/* A read-only derived cell in the same column — "3 wks", "×2.4". */
.derived {
  display: block;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--ink-body);
}
.derived.none { color: var(--ink-fainter); }

/* The scenario summary cards in the rail. */
.week-card { display: flex; flex-direction: column; gap: 9px; }
.week-card .line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.week-card .line .k {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-label);
}
.week-card .line .v {
  flex-shrink: 0;
  font-family: "Archivo", system-ui, sans-serif;
  font-variation-settings: "wdth" 110;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  /* The label beside it wraps; the number must not — "152 cr" broken across
     two lines reads as two numbers. */
  white-space: nowrap;
}
.week-card .rule {
  height: 1px;
  background: var(--line);
  margin: 2px 0;
}

/* The little bar that shows a scenario against the others. */
.compare { display: flex; align-items: center; gap: 8px; }
.compare .track {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-track);
  overflow: hidden;
}
.compare .track > i { display: block; height: 100%; background: var(--accent); }

@media (max-width: 1160px) {
  /* Below this the columns stop fitting beside the catalog. Let the list
     scroll sideways rather than crushing the job names to nothing. */
  .plan-list { overflow-x: auto; }
  .plan-row { min-width: 620px; }
}

/*
 * A three-column table sized for the rail. The catalog's .plan-row is built
 * for a full-width column and its minimum widths alone are wider than the rail
 * is, so anything tabular in there needs its own grid.
 */
.mini {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px 62px;
  gap: 8px;
  align-items: baseline;
  padding: 5px 0;
}
.mini > :nth-child(2),
.mini > :nth-child(3) { text-align: right; }
.mini.head {
  padding: 0 0 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
