/* ==========================================================
   Computer World Modern Inc. — interface system
   Direction: on-prem hardware. Enamel housings, rack rails,
   patch-panel lamps. Nothing floats; everything is mounted.
   ========================================================== */

:root {
  /* Enamel + steel */
  --shell:   #D9DAD3;   /* equipment housing, page ground */
  --shell-2: #C8CAC2;
  --card:    #FCFCFA;
  --rail:    #1E262B;   /* rack rail, dark chrome */
  --rail-2:  #2C363D;
  --ink:     #14181B;
  --ink-2:   #5A6169;
  --line:    #B4B7AE;

  /* Signal lamps */
  --signal:  #E8930C;   /* amber — attention, in flight */
  --oxide:   #0E6E68;   /* oxide teal — primary action, done */
  --alert:   #B32922;   /* indicator red — blocked, failed */
  --lamp-off:#8E938B;

  --f-display: "Oswald", "Archivo Narrow", "Arial Narrow", Impact, sans-serif;
  --f-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --f-data: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --u: 8px;              /* rack unit — all vertical rhythm is a multiple */
  --radius: 3px;         /* machined, not soft */
  --shadow: 0 1px 0 rgba(0,0,0,.16), 0 2px 10px rgba(20,24,27,.07);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--shell);
  background-image:
    linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--oxide); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 500;
  letter-spacing: .04em;
  margin: 0;
  line-height: 1.12;
}

.eyebrow {
  font-family: var(--f-data);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------- Rack rail: the fixed left mount ---------- */
.rack {
  position: fixed;
  inset: 0 auto 0 0;
  width: 216px;
  background: var(--rail);
  color: #C9CFD3;
  display: flex;
  flex-direction: column;
  z-index: 40;
  /* screw holes down both edges of the rail */
  background-image:
    radial-gradient(circle at 9px 0, rgba(0,0,0,.55) 2.5px, transparent 3px),
    radial-gradient(circle at calc(100% - 9px) 0, rgba(0,0,0,.55) 2.5px, transparent 3px);
  background-size: 100% 48px;
  background-repeat: repeat-y;
}

.rack__brand {
  padding: calc(var(--u) * 2.5) calc(var(--u) * 2.5) calc(var(--u) * 2);
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.rack__brand b {
  display: block;
  font-family: var(--f-display);
  font-size: 19px;
  letter-spacing: .06em;
  color: #fff;
  text-transform: uppercase;
}
.rack__brand span {
  font-family: var(--f-data);
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--signal);
  text-transform: uppercase;
}

.rack__nav { flex: 1; overflow-y: auto; padding: var(--u) 0 calc(var(--u) * 3); }
.rack__group {
  font-family: var(--f-data);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #6C7780;
  padding: calc(var(--u) * 2) calc(var(--u) * 2.5) var(--u);
}
.rack__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px calc(var(--u) * 2.5);
  color: #C9CFD3;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.rack__link:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.rack__link[aria-current="page"] {
  background: rgba(232,147,12,.12);
  border-left-color: var(--signal);
  color: #fff;
}
.rack__link .n {
  margin-left: auto;
  font-family: var(--f-data);
  font-size: 11px;
  background: rgba(255,255,255,.12);
  padding: 1px 6px;
  border-radius: 2px;
}
.rack__foot {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: calc(var(--u) * 1.5) calc(var(--u) * 2.5);
  font-size: 12px;
  color: #939CA3;
}
.rack__foot a { color: var(--signal); }

/* ---------- Main mount ---------- */
.mount { margin-left: 216px; min-height: 100vh; }

/* ---------- SIGNATURE: the patch panel ----------
   A 1U strip of labelled ports across the top. Each port is a live
   channel of the business; the lamp tells you if it needs a hand. */
.panel {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: stretch;
  background: linear-gradient(180deg, var(--rail-2), var(--rail));
  border-bottom: 3px solid #11171A;
  box-shadow: 0 2px 12px rgba(0,0,0,.22);
  overflow-x: auto;
  scrollbar-width: none;
}
.panel::-webkit-scrollbar { display: none; }

.port {
  flex: 1 0 auto;
  min-width: 108px;
  padding: 10px 14px 9px;
  border-right: 1px solid rgba(0,0,0,.35);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.05);
  color: #C9CFD3;
  display: block;
}
.port:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.port__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-data);
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #8794A0;
}
.port__val {
  font-family: var(--f-display);
  font-size: 22px;
  line-height: 1.1;
  color: #fff;
  letter-spacing: .02em;
}
.port__val small {
  font-family: var(--f-body);
  font-size: 11px;
  letter-spacing: 0;
  color: #8794A0;
  margin-left: 4px;
}

.lamp {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--lamp-off);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4);
  flex: none;
}
.lamp--live  { background: var(--signal); box-shadow: 0 0 7px rgba(232,147,12,.85); animation: pulse 2.2s ease-in-out infinite; }
.lamp--work  { background: var(--signal); box-shadow: 0 0 5px rgba(232,147,12,.55); }
.lamp--ready { background: #37C0A6; box-shadow: 0 0 7px rgba(55,192,166,.8); }
.lamp--done  { background: var(--oxide); }
.lamp--alert { background: var(--alert); box-shadow: 0 0 7px rgba(179,41,34,.8); animation: pulse 1.4s ease-in-out infinite; }
.lamp--hold  { background: #7E8790; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .lamp--live, .lamp--alert, .lamp--ready { animation: none; }
  * { transition: none !important; }
}

/* ---------- Page body ---------- */
.page { padding: calc(var(--u) * 3) calc(var(--u) * 4) calc(var(--u) * 8); max-width: 1400px; }

.page__head {
  display: flex;
  align-items: flex-end;
  gap: calc(var(--u) * 2);
  flex-wrap: wrap;
  margin-bottom: calc(var(--u) * 3);
}
.page__head h1 { font-size: 30px; text-transform: uppercase; }
.page__head .sub { color: var(--ink-2); font-size: 14px; }
.page__head .spacer { flex: 1; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: calc(var(--u) * 3);
}
.card__head {
  display: flex;
  align-items: center;
  gap: var(--u);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #F1F1EC);
}
.card__head h2 {
  font-size: 15px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.card__head .spacer { flex: 1; }
.card__body { padding: 16px; }
.card__body--flush { padding: 0; }

.grid { display: grid; gap: calc(var(--u) * 2); }
.grid--2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid--sidebar { grid-template-columns: minmax(0,2fr) minmax(0,1fr); }

/* ---------- Data tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left;
  font-family: var(--f-data);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 10px 14px;
  border-bottom: 2px solid var(--line);
  background: #F1F1EC;
  white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid #E4E4DE; vertical-align: middle; }
.tbl tbody tr:hover { background: #F7F7F3; }
.tbl .num, .tbl .mono { font-family: var(--f-data); font-size: 13px; }
.tbl .num { text-align: right; }
.tbl .tight { width: 1%; white-space: nowrap; }

.empty {
  padding: calc(var(--u) * 5) calc(var(--u) * 3);
  text-align: center;
  color: var(--ink-2);
}
.empty b { display: block; font-family: var(--f-display); font-size: 17px; color: var(--ink); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  font-family: var(--f-data);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 2px;
  border: 1px solid;
  white-space: nowrap;
}
.badge--live    { color: #8A5600; border-color: #E3B96A; background: #FCF1DC; }
.badge--work    { color: #8A5600; border-color: #E3B96A; background: #FCF1DC; }
.badge--ready   { color: #0A5F52; border-color: #6DC7B5; background: #DFF4EF; }
.badge--done    { color: #0B534E; border-color: #86BDB9; background: #E5F0EF; }
.badge--dead    { color: #8C201A; border-color: #DE9A95; background: #FBE9E8; }
.badge--hold    { color: #4A5158; border-color: #B7BCC1; background: #EDEEEF; }
.badge--neutral { color: #4A5158; border-color: #C3C6C0; background: #F2F2ED; }

/* ---------- Metrics ---------- */
.metric { padding: 14px 16px; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric__k { font-family: var(--f-data); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); }
.metric__v { font-family: var(--f-display); font-size: 32px; line-height: 1.1; margin-top: 4px; }
.metric__n { font-size: 12px; color: var(--ink-2); }

/* ---------- Forms ---------- */
label.fld { display: block; margin-bottom: 14px; }
label.fld > span {
  display: block;
  font-family: var(--f-data);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 5px;
}
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%;
  font-family: var(--f-body);
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid #9EA29A;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--oxide); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
.row > .narrow { flex: 0 0 140px; }

/* ---------- Buttons: machined keys ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--f-display);
  font-size: 13px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid #0A5450;
  background: linear-gradient(180deg, #17847D, var(--oxide));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 0 #08403D;
  transition: transform .06s ease, box-shadow .06s ease;
}
.btn:hover { text-decoration: none; color: #fff; }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 #08403D; }
.btn--ghost {
  background: linear-gradient(180deg, #fff, #EDEDE7);
  color: var(--ink);
  border-color: #A0A49C;
  box-shadow: 0 2px 0 #BDBFB8;
}
.btn--ghost:hover { color: var(--ink); }
.btn--ghost:active { box-shadow: 0 0 0 #BDBFB8; }
.btn--signal {
  background: linear-gradient(180deg, #F2A521, #D8850A);
  border-color: #9C6106;
  box-shadow: 0 2px 0 #7A4C05;
  color: #22160A;
}
.btn--signal:hover { color: #22160A; }
.btn--danger { background: linear-gradient(180deg, #C93A32, #A5211B); border-color: #7C1813; box-shadow: 0 2px 0 #5E120E; }
.btn--sm { font-size: 11px; padding: 6px 11px; }
.btn--wide { width: 100%; justify-content: center; }

/* ---------- Flash ---------- */
.flash {
  padding: 11px 16px;
  border-left: 4px solid var(--oxide);
  background: #E5F0EF;
  margin-bottom: calc(var(--u) * 2);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px;
}
.flash--warn { border-color: var(--signal); background: #FCF1DC; }
.flash--err  { border-color: var(--alert); background: #FBE9E8; }

/* ---------- Prep board (kitchen / bench display) ---------- */
.board { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); }
.chit {
  background: #FFFDF5;
  border: 1px solid #C6C3B2;
  border-top: 6px solid var(--signal);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.chit--ready { border-top-color: #37C0A6; }
.chit--late  { border-top-color: var(--alert); }
.chit__head {
  padding: 10px 13px;
  border-bottom: 1px dashed #C6C3B2;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
}
/* The order number is read across a room — it must never break in half. */
.chit__no {
  font-family: var(--f-display);
  font-size: 17px;
  letter-spacing: .02em;
  white-space: nowrap;
}
.chit__clock { margin-left: auto; font-family: var(--f-data); font-size: 13px; }
.chit__items { list-style: none; margin: 0; padding: 10px 13px; flex: 1; }
.chit__items li { display: flex; gap: 8px; padding: 4px 0; font-size: 14px; }
.chit__items b { font-family: var(--f-data); }
.chit__foot { padding: 10px 13px; border-top: 1px dashed #C6C3B2; display: flex; gap: 8px; }

/* ---------- Login ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate__card { width: 100%; max-width: 380px; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .grid--sidebar, .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .rack {
    position: static;
    width: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    background-image: none;
  }
  .rack__brand { border-bottom: 0; border-right: 1px solid rgba(255,255,255,.1); white-space: nowrap; padding: 12px 16px; }
  .rack__nav { display: flex; padding: 0; flex: 1; }
  .rack__group { display: none; }
  .rack__link { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
  .rack__link[aria-current="page"] { border-left: 0; border-bottom-color: var(--signal); }
  .rack__foot { display: none; }
  .mount { margin-left: 0; }
  .page { padding: 16px; }
  .grid--2, .grid--3, .grid--4, .grid--sidebar { grid-template-columns: 1fr; }
  .tbl-scroll { overflow-x: auto; }
}

/* ---------- Print (sign-off sheets, prep tickets) ---------- */
@media print {
  .rack, .panel, .btn, .card__head .spacer { display: none !important; }
  .mount { margin: 0; }
  body { background: #fff; }
  .card { border-color: #999; box-shadow: none; }
}
