/* airprem facility preview: 2.5D synth hardware. Raised slabs, pressable keys, recessed wells, small dark screens.
   Ported from airprem-kit/web facility.module.css. Loaded after styles.css (tokens, base, .mono, .wordmark). */

:root {
  /* Facility-only tokens (literals from facility.module.css, named here). */
  --slab-top: #efeeeb;
  --slab-bottom: #e4e3df;
  --slab-edge: #bdbbb5;
  --well: #e1e0db;
  --key-top: #ffffff;
  --key-bottom: #f3f2ee;
  --key-edge: #c9c6bf;
  --btn-bottom: #eeede9;
  --empty-edge: #a9a59d;
  --empty-fill: rgba(255, 255, 255, 0.25);
  --screen: #141414;
  --screen-bezel: #2a2a2a;
  --screen-text: #c9c5bd;
  --screen-dim: #9a968e;
  --screen-head: #a9a59d;
  --accent-app-deep: #7e2a07;
  --dot-off: #cfccc5;
  --grille-dot: #bfbcb4;
  --warn-text: #8a5a12;
  --alert-text: #a8241d;
  --approved-bg: #e3efe6;
  --approved-text: #1f5c3c;
  --footer-text: #5e5b57;
  --tone-ok: #3fb57a;
  --tone-info: #7fa4f0;
  --tone-warn: #f0a23a;
  --tone-neutral: #edebe6;
  --live: #f0763a;
  --gpu-1: #4f7fe0;
  --gpu-2: #3fb57a;
  --gpu-3: #f0763a;
  --gpu-4: #edebe6;
  --knob-blue-hi: #6e9bf0;
  --knob-blue: #2f5fc9;
  --knob-green-hi: #63c996;
  --knob-green: #228a57;
  --knob-white: #d8d6d0;
  --knob-gray-hi: #8a8883;
  --knob-gray: #4e4c48;
  --fac-shadow: rgba(40, 36, 30, 0.16);
  --fac-shadow-soft: rgba(40, 36, 30, 0.1);
  --fac-shadow-knob: rgba(40, 36, 30, 0.18);
  --accent-shadow: rgba(126, 42, 7, 0.25);
  --inset: rgba(0, 0, 0, 0.1);
  --inset-soft: rgba(0, 0, 0, 0.05);
  --inset-deep: rgba(0, 0, 0, 0.6);
  --rim: rgba(255, 255, 255, 0.7);
  --rim-strong: rgba(255, 255, 255, 0.9);
  --white-35: rgba(255, 255, 255, 0.35);
}

body.facility {
  background: var(--chassis);
}

.chassis {
  min-height: 100vh;
  background: var(--chassis);
  color: var(--ink);
  font-size: 14px;
}
.fac-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Materials */
.slab {
  background: linear-gradient(180deg, var(--slab-top) 0%, var(--slab-bottom) 100%);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 var(--white), inset 0 -1px 0 var(--inset-soft), 0 6px 0 var(--slab-edge),
    0 18px 30px var(--fac-shadow);
}
.well {
  background: var(--well);
  border-radius: 14px;
  box-shadow: inset 0 2px 4px var(--inset), inset 0 -1px 0 var(--rim);
}
.fkey,
.fkey-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
}
.fkey {
  background: linear-gradient(180deg, var(--key-top) 0%, var(--key-bottom) 100%);
  box-shadow: inset 0 1px 0 var(--white), 0 4px 0 var(--key-edge), 0 8px 14px var(--fac-shadow-soft);
}
.fkey-empty {
  border: 1.5px dashed var(--empty-edge);
  background: var(--empty-fill);
}
.screen {
  background: var(--screen);
  color: var(--tone-neutral);
  border-radius: 14px;
  padding: 18px;
  box-shadow: inset 0 3px 8px var(--inset-deep), 0 0 0 6px var(--screen-bezel), 0 0 0 7px var(--slab-edge);
  margin: 7px;
}

/* Buttons */
.fbtn {
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--white), var(--btn-bottom));
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--white), 0 4px 0 var(--slab-edge), 0 8px 14px var(--fac-shadow-soft);
  transition: transform 0.08s, box-shadow 0.08s;
}
.fbtn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--slab-edge);
}
.fbtn-accent {
  background: var(--accent-app);
  color: var(--white);
  font-weight: 800;
  box-shadow: inset 0 1px 0 var(--white-35), 0 4px 0 var(--accent-app-deep), 0 8px 14px var(--accent-shadow);
}
.fbtn-accent:active {
  box-shadow: 0 1px 0 var(--accent-app-deep);
}
.facility :focus-visible {
  outline-color: var(--accent-app);
}

/* Dots and knobs */
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  display: inline-block;
  box-shadow: inset 0 -1px 1px rgba(0, 0, 0, 0.25), 0 0 0 2px var(--rim);
}
.dot.dot-ok {
  background: var(--ok);
}
.dot.dot-warn {
  background: var(--warn);
}
.dot.dot-alert {
  background: var(--alert);
}
.dot.dot-off {
  background: var(--dot-off);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}
.knob {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  position: relative;
  box-shadow: inset 0 2px 1px rgba(255, 255, 255, 0.55), inset 0 -3px 3px rgba(0, 0, 0, 0.22), 0 4px 0 rgba(0, 0, 0, 0.18),
    0 7px 10px var(--fac-shadow-knob);
}
.knob::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 5px;
  width: 3px;
  height: 9px;
  margin-left: -1.5px;
  background: var(--rim-strong);
  border-radius: 2px;
}
.k-blue {
  background: radial-gradient(circle at 40% 30%, var(--knob-blue-hi), var(--knob-blue));
}
.k-green {
  background: radial-gradient(circle at 40% 30%, var(--knob-green-hi), var(--knob-green));
}
.k-white {
  background: radial-gradient(circle at 40% 30%, var(--white), var(--knob-white));
}
.k-white::after {
  background: var(--ink);
}
.k-gray {
  background: radial-gradient(circle at 40% 30%, var(--knob-gray-hi), var(--knob-gray));
}

/* Header */
.fac-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
}
.fac-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  text-decoration: none;
}
.fac-brand .logo {
  height: 31px;
}
.fac-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
}
.fac-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 700;
}
.fac-nav .nav-on {
  background: linear-gradient(180deg, var(--white), var(--btn-bottom));
  color: var(--ink);
  box-shadow: inset 0 1px 0 var(--white), 0 3px 0 var(--slab-edge);
}
.fac-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 12px;
}
.preview-note {
  margin: -12px 4px 0;
  font-size: 12px;
  color: var(--footer-text);
}
.preview-note a {
  color: var(--ink);
  font-weight: 500;
}

/* Ask */
.ask {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ask-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ask-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.ask-input {
  flex: 999 1 420px;
  min-width: 0;
  height: 54px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  background: var(--well);
  box-shadow: inset 0 2px 4px var(--inset), inset 0 -1px 0 var(--rim);
  font-size: 16px;
  color: var(--ink);
}
.ask-input::placeholder {
  color: var(--text-muted);
}
.ask-row .fbtn {
  flex: 1 1 140px;
  height: 54px;
  font-size: 15px;
}
.hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.screen-code {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--tone-info);
}
.screen-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--screen-text);
}

/* Layout */
.split {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: flex-start;
}
.floor {
  flex: 999 1 640px;
  min-width: 0;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.floor-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.fac-h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.label {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.grille {
  border-radius: 16px;
  padding: 18px;
  background-color: var(--well);
  background-image: radial-gradient(circle, var(--grille-dot) 1.2px, transparent 1.5px);
  background-size: 12px 12px;
  box-shadow: inset 0 2px 6px var(--inset);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.room-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
  width: 100%;
}
.room-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
}
.room-head span {
  font-size: 12px;
  color: var(--text-muted);
}
.room {
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 16px;
}
.unit {
  font-size: 11px;
  color: var(--text-muted);
}
.key-text {
  flex: 1;
  min-width: 0;
}
.key-name {
  margin: 0;
  font-weight: 800;
}
.key-detail {
  margin: 0;
  font-size: 12px;
  color: var(--text-subtle);
}
.key-warn {
  margin: 0;
  font-size: 12px;
  color: var(--warn-text);
}

/* Inference room */
.gpu-screen {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  height: 96px;
  padding: 14px;
}
.gpu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
}
.gpu .bar {
  width: 60%;
  border-radius: 4px;
}
.bar.g1 {
  height: 70%;
  background: var(--gpu-1);
}
.bar.g2 {
  height: 55%;
  background: var(--gpu-2);
}
.bar.g3 {
  height: 82%;
  background: var(--gpu-3);
}
.bar.g4 {
  height: 40%;
  background: var(--gpu-4);
}
.gpu span {
  font-size: 10px;
  color: var(--screen-dim);
}
.readout {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.big {
  font-size: 28px;
  font-weight: 800;
}
.big small {
  font-size: 16px;
}
.small {
  font-size: 12px;
  color: var(--text-subtle);
  margin: 0;
}
.mode-switch {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 5px;
  border: none;
  border-radius: 999px;
  min-width: 0;
}
.mode-switch label {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 44px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}
.mode-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.mode-switch label:has(input:checked) {
  background: linear-gradient(180deg, var(--white), var(--btn-bottom));
  color: var(--ink);
  font-weight: 800;
  box-shadow: inset 0 1px 0 var(--white), 0 3px 0 var(--slab-edge);
}
.mode-switch label:has(input:focus-visible) {
  outline: 2px solid var(--accent-app);
  outline-offset: 2px;
}

/* Network closet */
.mcp-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mcp-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
}

/* Vault */
.vault {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  gap: 3px;
  padding: 6px;
  border-radius: 10px;
}
.vault span {
  height: 16px;
  border-radius: 3px;
}
.cell-full {
  background: var(--screen-bezel);
}
.cell-new {
  background: var(--accent-app);
}
.cell-empty {
  background: var(--ivory);
}

/* Side column */
.side {
  flex: 1 1 340px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.coverage {
  display: flex;
  align-items: center;
  gap: 20px;
}
.coverage svg {
  flex: none;
}
#dial-arc {
  transition: stroke-dasharray 0.6s ease;
}
.coverage-num {
  margin: 0 0 6px;
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
}
.coverage-num small {
  font-size: 18px;
}
.alert-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
}
.alert-label {
  color: var(--alert-text);
}
.alert-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}
.alert-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}
.alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}
.alert-actions .fbtn {
  flex: 1 1 140px;
  min-height: 50px;
  font-size: 14px;
}
.approved {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--approved-bg);
  color: var(--approved-text);
  font-weight: 700;
}
.log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.log-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--screen-head);
}
.log-head span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--live);
}
.live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  display: inline-block;
}
.log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.log p {
  margin: 0;
  font-size: 13px;
  color: var(--screen-text);
}
.log p:first-child {
  font-size: 12px;
}
.log .tone-ok {
  color: var(--tone-ok);
}
.log .tone-info {
  color: var(--tone-info);
}
.log .tone-warn {
  color: var(--tone-warn);
}
.log .tone-neutral {
  color: var(--tone-neutral);
}

.fac-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--footer-text);
  padding-bottom: 12px;
}
.fac-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  font-weight: 800;
}

/* Small screens (360px) */
@media (max-width: 520px) {
  .fac-main {
    padding: 16px 12px;
    gap: 22px;
  }
  .fac-header,
  .ask,
  .floor,
  .panel {
    padding-left: 14px;
    padding-right: 14px;
  }
  .grille {
    padding: 10px;
    grid-template-columns: minmax(0, 1fr);
  }
  .fac-nav {
    width: 100%;
  }
  .fac-nav a {
    flex: 1;
    justify-content: center;
    padding: 0 8px;
  }
  .floor,
  .side {
    flex-basis: 100%;
  }
  .preview-note {
    margin-top: -8px;
  }
}
