/* PERP Portal: glass tiles over a deep indigo-to-teal backdrop. No hover zoom by design. */
:root {
  color-scheme: dark;
  --ink: #eef3fb;
  --ink-dim: #a9b8d0;
  --ink-faint: #6f819f;
  --glass: rgba(255, 255, 255, 0.075);
  --glass-strong: rgba(255, 255, 255, 0.13);
  --edge: rgba(255, 255, 255, 0.2);
  --edge-soft: rgba(255, 255, 255, 0.1);
  --accent: #7fc8ff;
  --green: #4cf29a;
  --amber: #ffb43a;
  --red: #ff5a5f;
  --off: #3a4a62;
  --radius: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: #101a33;
  font-variant-numeric: tabular-nums;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60rem 40rem at 12% 8%, rgba(46, 196, 182, 0.30), transparent 60%),
    radial-gradient(50rem 36rem at 88% 18%, rgba(123, 92, 255, 0.32), transparent 62%),
    radial-gradient(46rem 34rem at 60% 100%, rgba(255, 122, 89, 0.16), transparent 60%),
    linear-gradient(160deg, #14213d 0%, #172c4a 45%, #26204a 100%);
}

h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

/* ---- Glass surface ---- */
.glass {
  background: var(--glass);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: 0 10px 34px rgba(4, 8, 24, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
}

/* ---- Auth screens ---- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth__card { width: min(420px, 100%); padding: 32px 28px; display: grid; gap: 18px; }
.auth__card h1 { font-size: 1.45rem; font-weight: 650; letter-spacing: -0.01em; }
.auth__hint { color: var(--ink-dim); font-size: 0.92rem; }
.field { display: grid; gap: 6px; }
.field label { font-size: 0.85rem; color: var(--ink-dim); }
.field input {
  width: 100%;
  padding: 11px 13px;
  background: rgba(8, 14, 30, 0.45);
  border: 1px solid var(--edge-soft);
  border-radius: 12px;
}
.field input:focus-visible { border-color: var(--accent); outline-offset: 1px; }
.code-input { font-size: 1.5rem; letter-spacing: 0.4em; text-align: center; }

.btn {
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: var(--glass-strong);
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { background: rgba(255, 255, 255, 0.2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary { background: rgba(127, 200, 255, 0.28); border-color: rgba(127, 200, 255, 0.6); }
.btn--quiet { background: transparent; border-color: var(--edge-soft); font-weight: 500; }
.error { color: #ffb3b6; font-size: 0.9rem; }
.qr { width: 190px; height: 190px; margin: 0 auto; background: #fff; border-radius: 12px; padding: 8px; }
.secret { font-family: ui-monospace, "SF Mono", Menlo, monospace; word-break: break-all; color: var(--ink-dim); font-size: 0.85rem; text-align: center; }
.codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  padding: 14px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9rem;
  background: rgba(8, 14, 30, 0.45);
  border-radius: 12px;
}
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; }

/* ---- Dashboard ---- */
.shell { max-width: 1180px; margin: 0 auto; padding: 20px 20px 48px; display: grid; gap: 22px; }
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
}
.topbar__brand { font-weight: 700; letter-spacing: -0.01em; font-size: 1.05rem; }
.topbar__user { display: flex; align-items: center; gap: 12px; color: var(--ink-dim); font-size: 0.9rem; }
.tabs { display: flex; gap: 6px; }
.tab {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--glass-strong); border-color: var(--edge); color: var(--ink); }
.pool { color: var(--ink-dim); font-size: 0.92rem; }
.empty { padding: 36px 24px; text-align: center; color: var(--ink-dim); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }

/* ---- Tile (no transform on hover: the tile never moves or scales) ---- */
.tile { padding: 16px 16px 14px; display: grid; gap: 12px; transition: border-color 0.2s; }
.tile:hover { border-color: rgba(255, 255, 255, 0.38); }
.tile__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tile__head h3 { font-size: 1.05rem; font-weight: 650; overflow-wrap: anywhere; }
.pill {
  flex: none;
  padding: 1px 10px;
  border-radius: 999px;
  border: 1px solid var(--edge-soft);
  font-size: 0.78rem;
  color: var(--ink-dim);
}
.tile__sub { color: var(--ink-dim); font-size: 0.85rem; overflow-wrap: anywhere; }
.tile__state { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.tile__meta { color: var(--ink-faint); font-size: 0.8rem; }

.dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.dot--green { color: var(--green); }
.dot--amber { color: var(--amber); }
.dot--red { color: var(--red); }
.dot--off { color: var(--off); box-shadow: none; }

.meters { display: grid; gap: 7px; }
.meter { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; font-size: 0.8rem; color: var(--ink-dim); }
.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent); }
.bar > span.is-hot { background: var(--amber); }
.bar > span.is-crit { background: var(--red); }

/* ---- Schematics ---- */
.schematic { width: 100%; height: auto; display: block; }
.chassis { fill: url(#g-chassis); stroke: rgba(255, 255, 255, 0.34); stroke-width: 1.2; }
.bay { fill: url(#g-bay); stroke: rgba(255, 255, 255, 0.22); stroke-width: 1; }
.bay-handle { stroke: rgba(255, 255, 255, 0.38); stroke-width: 1.4; stroke-linecap: round; }
.vent { stroke: rgba(255, 255, 255, 0.16); stroke-width: 1.4; stroke-linecap: round; }
.silk { fill: var(--ink-faint); font-size: 7.5px; letter-spacing: 0.04em; text-anchor: middle; font-family: var(--font); }
.platter { fill: rgba(255, 255, 255, 0.07); stroke: rgba(255, 255, 255, 0.3); stroke-width: 1.2; }
.platter-ring { fill: none; stroke: rgba(255, 255, 255, 0.12); stroke-width: 5; }
.usage-ring { fill: none; stroke-width: 5; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 62px 48px; }
.usage-ring--green { stroke: var(--green); }
.usage-ring--amber { stroke: var(--amber); }
.usage-ring--red { stroke: var(--red); }
.usage-ring--off { stroke: var(--off); }
.spindle { fill: rgba(255, 255, 255, 0.5); }
.arm { stroke: rgba(255, 255, 255, 0.45); stroke-width: 2; stroke-linecap: round; fill: none; }

/* LED: glass lens with glow. Color comes from the `color` property. */
.led { color: var(--off); }
.led__body { fill: currentColor; stroke: rgba(0, 0, 0, 0.35); stroke-width: 0.8; }
.led__shine { fill: rgba(255, 255, 255, 0.55); }
.led--green { color: var(--green); }
.led--amber { color: var(--amber); }
.led--red { color: var(--red); }
.led--green .led__body, .led--amber .led__body, .led--red .led__body { filter: drop-shadow(0 0 3.5px currentColor); }
.led--off .led__shine { opacity: 0.2; }

/* Disk-activity flicker: irregular, like a real drive LED. */
@keyframes led-flicker {
  0%, 100% { opacity: 1; }
  12% { opacity: 0.22; }
  24% { opacity: 1; }
  38% { opacity: 0.3; }
  52% { opacity: 1; }
  66% { opacity: 0.18; }
  80% { opacity: 0.9; }
}
.led--blink { animation: led-flicker 1.1s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .led--blink { animation: none; }
  /* Without motion, activity is shown as a dashed ring plus the text label. */
  .led--blink .led__body { stroke: #fff; stroke-width: 1.6; stroke-dasharray: 2.4 2; }
  .tile { transition: none; }
}

@media (max-width: 560px) {
  .shell { padding: 12px 12px 40px; }
  .auth__card { padding: 24px 20px; }
  .grid { grid-template-columns: 1fr; }
}
