/* 00-tokens.css — ASBUILT design tokens.
 * Identity: the laminated TURNOVER PACKET — steel-white sheet, black ink linework,
 * fiber-jacket colors reserved for cable types, redline red reserved for exceptions,
 * blueline print blue for anything interactive, green stamp ink for completed gates.
 * Cable IDs render as self-laminating label strips (.cid) — the universal click target.
 */
:root[data-theme="light"] {
  --sheet:   #EEF1F2;   /* cool steel-white page */
  --card:    #FFFFFF;   /* lamination */
  --card2:   #F7F9FA;   /* recessed panel */
  --ink:     #171B1E;
  --steel:   #5A6670;   /* secondary text, steel linework */
  --ghost:   #C3CCD1;   /* planned/unbuilt linework */
  --hair:    #DCE2E6;   /* hairline rules */
  --blueline:#2457C5;   /* interactive: links, focus, primary actions */
  --blueline-soft: #E3EBFA;
  --redline: #D93A2B;   /* exceptions only: blockers, fails, damage */
  --redline-soft: #FBE7E4;
  --stamp:   #1E8E4D;   /* green stamp ink: gate complete */
  --stamp-soft: #E1F3E8;
  --amber:   #B97A10;   /* in-progress */
  --amber-soft: #FAF0DC;
  --shadow:  0 1px 2px rgba(23,27,30,.08), 0 6px 24px rgba(23,27,30,.07);
  --shadow-lg: 0 4px 12px rgba(23,27,30,.14), 0 24px 64px rgba(23,27,30,.18);
  --rackface:#22272B;   /* hardware faceplates stay dark in both themes */
  --rackface2:#31383D;
  --scrim: rgba(23,27,30,.42);
}
:root[data-theme="dark"] {
  --sheet:   #14181B;
  --card:    #1D2327;
  --card2:   #171C20;
  --ink:     #E8EDF0;
  --steel:   #93A0AA;
  --ghost:   #3A444C;
  --hair:    #2A3238;
  --blueline:#6FA2FF;
  --blueline-soft: #1D2B45;
  --redline: #FF6B5A;
  --redline-soft: #40201C;
  --stamp:   #45C87E;
  --stamp-soft: #1A3326;
  --amber:   #E5A43C;
  --amber-soft: #38290F;
  --shadow:  0 1px 2px rgba(0,0,0,.4), 0 6px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.5), 0 24px 64px rgba(0,0,0,.55);
  --rackface:#22272B;
  --rackface2:#31383D;
  --scrim: rgba(0,0,0,.55);
}
:root {
  --font-ui: "Archivo", system-ui, sans-serif;
  --font-draw: "Archivo Narrow", "Archivo", sans-serif; /* drawing lettering: uppercase, tracked */
  --font-mono: "Fragment Mono", ui-monospace, monospace; /* IDs, ports, U numbers */
  --r-sm: 3px; --r-md: 6px; --r-lg: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--blueline); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---- drawing lettering (view titles, rack ids on drawings) ---- */
.draw-title {
  font-family: var(--font-draw);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ---- the label strip: EVERY cable id in the app, and the click target ---- */
.cid {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .02em;
  color: var(--ink);
  background: linear-gradient(180deg, var(--card) 0%, var(--card) 62%, rgba(127,148,160,.16) 100%);
  border: 1px solid var(--hair);
  border-radius: 2px;
  padding: 2px 8px 2px 6px;
  box-shadow: 0 1px 1px rgba(23,27,30,.10);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  position: relative;
}
.cid::before { /* jacket swatch — set --jacket inline per cable type */
  content: ""; width: 5px; height: 12px; border-radius: 1px;
  background: var(--jacket, var(--steel));
}
.cid:hover { border-color: var(--blueline); box-shadow: 0 1px 4px rgba(36,87,197,.35); }
.cid.cid-flagged::after {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--redline); margin-left: 2px;
}

/* ---- commissioning stamps: gate chips ---- */
.stamp {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-draw); font-weight: 700; text-transform: uppercase;
  font-size: 11px; letter-spacing: .09em;
  border: 1.5px solid var(--ghost); color: var(--ghost);
  border-radius: 2px; padding: 2px 7px;
  background: transparent;
  cursor: default; user-select: none;
}
.stamp.on { border-color: var(--stamp); color: var(--stamp); background: var(--stamp-soft);
  transform: rotate(-1.2deg); }
.stamp.blocked { border-color: var(--redline); color: var(--redline); background: var(--redline-soft); }
.stamp.tappable { cursor: pointer; }
.stamp.tappable:not(.on):hover { border-color: var(--steel); color: var(--steel); }
@keyframes stamp-thunk {
  0% { transform: scale(1.7) rotate(-6deg); opacity: 0; }
  60% { transform: scale(.94) rotate(-1.2deg); opacity: 1; }
  100% { transform: scale(1) rotate(-1.2deg); }
}
.stamp.just-stamped { animation: stamp-thunk .28s cubic-bezier(.2,.8,.3,1.1); }

/* ---- punch flag: numbered exception marker ---- */
.punch {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--redline);
  border: 1.5px solid var(--redline); border-radius: 2px;
  background: var(--redline-soft);
  padding: 1px 7px;
  cursor: pointer;
}
.punch.resolved { color: var(--steel); border-color: var(--hair); background: transparent; text-decoration: line-through; }

/* ---- shared primitives ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-draw); font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; font-size: 12.5px;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--steel); border-radius: var(--r-sm);
  padding: 7px 14px; cursor: pointer;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--card); border-color: var(--ink); }
:root[data-theme="dark"] .btn.primary { background: var(--ink); color: #14181B; }
.btn.primary:hover { background: var(--blueline); border-color: var(--blueline); }
.btn.danger { color: var(--redline); border-color: var(--redline); background: transparent; }
.btn.ghosted { border-style: dashed; color: var(--steel); }
.btn:disabled { opacity: .45; cursor: default; }

.input, select.input, textarea.input {
  font-family: var(--font-ui); font-size: 14px;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--hair); border-radius: var(--r-sm);
  padding: 7px 10px;
}
.input:focus { border-color: var(--blueline); outline: none; }

.card {
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-md);
  box-shadow: var(--shadow);
}
.hint { color: var(--steel); font-size: 13px; }
.mono { font-family: var(--font-mono); }

/* percent meter: a thin fill bar, steel -> ink; complete turns stamp green */
.meter { height: 5px; background: var(--hair); border-radius: 2px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--steel); border-radius: 2px; }
.meter.done > i { background: var(--stamp); }
