/* OTP operations console
   Palette follows the appliance itself: equipment enclosure greys with
   functional status colours. Colour carries state, never decoration. */

:root {
  --case:     #BFC5B8;
  --case-dk:  #A7AE9F;
  --panel:    #F6F7F3;
  --ink:      #171C17;
  --muted:    #656C62;
  --line:     #D3D8CC;
  --live:     #2C6A4A;
  --warn:     #8A6100;
  --fault:    #9E2B22;
  --action:   #14524B;

  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--case);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--action); }

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

.signin-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.signin {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--case-dk);
  border-radius: 3px;
  padding: 28px;
}

.signin h1 { font-size: 19px; margin-bottom: 4px; }

.signin .sub {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 22px;
}

.field { margin-bottom: 15px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 5px;
}

input[type="email"],
input[type="password"] {
  width: 100%;
  background: #fff;
  border: 1px solid var(--case-dk);
  border-radius: 2px;
  padding: 9px 11px;
}

input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: -1px;
}

button:focus-visible { outline-offset: 2px; }

.btn {
  background: var(--action);
  color: #fff;
  border: 1px solid var(--action);
  border-radius: 2px;
  padding: 9px 18px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
}

.btn:hover:not(:disabled) { background: #0F3F3A; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.wide { width: 100%; }

.btn.quiet {
  background: transparent;
  color: var(--action);
  border-color: var(--case-dk);
}

.btn.quiet:hover:not(:disabled) { background: #E6EBE6; }
.btn.sm { padding: 6px 12px; font-size: 13px; }

.notice {
  border-left: 3px solid var(--fault);
  background: #fff;
  padding: 10px 12px;
  font-size: 13.5px;
  margin-bottom: 18px;
}

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

.top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--case-dk);
  background: var(--panel);
  flex-wrap: wrap;
}

.top h1 { font-size: 16px; }
.top .spacer { flex: 1; }

.who {
  font-size: 13px;
  color: var(--muted);
}

.shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 22px 56px;
  align-items: start;
}

@media (max-width: 860px) {
  /* minmax(0, 1fr), not 1fr: a plain 1fr track refuses to shrink below its
     content, so the wide table pushed the whole page sideways on phones. */
  .shell { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- readiness rail ---------- */

.rail {
  background: var(--panel);
  border: 1px solid var(--case-dk);
  border-radius: 3px;
  overflow: hidden;
}

/* The readiness banner is the loudest element in the interface, because an
   operator must never have to click to learn the appliance cannot send. */
.ready {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--muted);
}

.ready.is-ready    { border-left-color: var(--live); }
.ready.is-degraded { border-left-color: var(--warn); }
.ready.is-blocked  { border-left-color: var(--fault); }

.ready .state {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 3px;
}

.ready.is-ready .state    { color: var(--live); }
.ready.is-degraded .state { color: var(--warn); }
.ready.is-blocked .state  { color: var(--fault); }

.ready .reason {
  font-size: 13.5px;
  color: var(--muted);
}

.tel {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 13px;
}

.tel dt { color: var(--muted); }

.tel dd {
  margin: 0;
  font: 400 13px/1.5 var(--mono);
  text-align: right;
  word-break: break-word;
}

/* Signal is a bar cluster plus its numeric value; keep them on one line so
   the rail reads as a single instrument row. */
.tel dd.signal {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  white-space: nowrap;
}

.tel dd.bad { color: var(--fault); }

/* Discrete segments read like equipment, not a progress bar. */
.sig {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 22px;
  justify-content: flex-end;
}

.seg { width: 8px; background: var(--line); border-radius: 1px; }
.seg.on { background: var(--live); }
.seg.on.weak { background: var(--warn); }
.sig .seg:nth-child(1) { height: 34%; }
.sig .seg:nth-child(2) { height: 50%; }
.sig .seg:nth-child(3) { height: 66%; }
.sig .seg:nth-child(4) { height: 82%; }
.sig .seg:nth-child(5) { height: 100%; }

.rail-foot {
  padding: 11px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stamp { font: 400 11.5px/1 var(--mono); color: var(--muted); }

/* ---------- tabs and sheets ---------- */

.tabs { display: flex; gap: 2px; margin-bottom: -1px; flex-wrap: wrap; }

.tab {
  background: var(--case-dk);
  color: #343A32;
  border: 1px solid var(--case-dk);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13.5px;
}

.tab[aria-selected="true"] {
  background: var(--panel);
  color: var(--ink);
}

.sheet {
  background: var(--panel);
  border: 1px solid var(--case-dk);
  border-radius: 0 3px 3px 3px;
  padding: 18px;
}

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.bar h2 { font-size: 15px; }
.bar .spacer { flex: 1; }

select {
  background: #fff;
  border: 1px solid var(--case-dk);
  border-radius: 2px;
  padding: 6px 9px;
  font-size: 13px;
}

/* ---------- tables ---------- */

.scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  border-bottom-color: var(--case-dk);
  white-space: nowrap;
}

td.num, td.when { font-family: var(--mono); font-size: 12px; white-space: nowrap; }

.result { font-weight: 500; }
.result.ok   { color: var(--live); }
.result.bad  { color: var(--fault); }

.tag {
  display: inline-block;
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1px 5px;
  color: var(--muted);
}

/* Empty states name the next action rather than reporting nothing. */
.empty {
  padding: 30px 12px;
  color: var(--muted);
  font-size: 13.5px;
  max-width: 62ch;
}

.alert {
  border-left: 3px solid var(--fault);
  background: #fff;
  padding: 11px 13px;
  font-size: 13.5px;
  margin-bottom: 14px;
}

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
