@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/plex-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/plex-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b1016;
  --bg-2: #101820;
  --elev: #151d27;
  --elev-2: #1b2531;
  --line: rgba(236, 226, 214, 0.1);
  --line-strong: rgba(236, 226, 214, 0.18);
  --text: #f0e7dc;
  --muted: #a39688;
  --faint: #6f655b;
  --accent: #c44536;
  --accent-2: #e07a6c;
  --accent-soft: rgba(196, 69, 54, 0.16);
  --ok: #8aa37a;
  --warn: #c9a44a;
  --idle: #7a8494;
  --radius: 22px;
  --radius-sm: 14px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --font: "Manrope", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --nav: 70;
  --modal: 80;
  --grain: 90;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

button,
input,
label {
  font-family: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: var(--grain);
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.orb {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  opacity: 0.34;
}

.orb-a {
  width: 42vw;
  height: 42vw;
  max-width: 520px;
  max-height: 520px;
  left: -12vw;
  top: -10vw;
  background: radial-gradient(circle, #3a1b18 0%, transparent 70%);
}

.orb-b {
  width: 38vw;
  height: 38vw;
  max-width: 460px;
  max-height: 460px;
  right: -10vw;
  bottom: -12vw;
  background: radial-gradient(circle, #1a2a3c 0%, transparent 70%);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(160deg, #d45a4a, #8f2c24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px 7px 8px 11px;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 3px;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-sub {
  display: block;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.node-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  background: rgba(196, 69, 54, 0.12);
  border: 1px solid rgba(196, 69, 54, 0.28);
  color: #f0b4ac;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.node-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(196, 69, 54, 0.18);
}

.ghost-btn,
.icon-btn {
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 0 14px;
  font-size: 13px;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease), border-color 0.35s var(--ease);
}

.ghost-btn:hover,
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line-strong);
}

.ghost-btn:active,
.icon-btn:active,
.primary:active,
.tile:active,
.choice:active {
  transform: scale(0.98);
}

.ghost-btn:focus-visible,
.icon-btn:focus-visible,
.primary:focus-visible,
.tile:focus-visible,
.choice:focus-visible,
input:focus-visible,
.drop:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

/* LOGIN */
.login {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.login-visual {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 48px 56px 56px;
  position: relative;
  overflow: hidden;
}

.login-kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}

.login-title {
  font-size: clamp(48px, 7vw, 92px);
  line-height: 1.05;
  letter-spacing: -0.05em;
  font-weight: 800;
  margin: 0 0 16px;
  max-width: 8ch;
}

.login-copy {
  margin: 0;
  max-width: 34ch;
  color: var(--muted);
  font-size: 16px;
}

.red-plate {
  position: absolute;
  right: 8%;
  top: 16%;
  width: min(280px, 38vw);
  aspect-ratio: 1.58 / 1;
  border-radius: 18px;
  background: linear-gradient(145deg, #d85a4c 0%, #9b2e26 62%, #6d1c18 100%);
  transform: rotate(-18deg);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.red-plate::before {
  content: "RC";
  position: absolute;
  left: 22px;
  bottom: 18px;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
}

.red-plate::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
}

.login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.bezel {
  padding: 6px;
  border-radius: calc(var(--radius) + 6px);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  width: min(440px, 100%);
}

.bezel-inner {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 28%), var(--elev);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 32px 28px 28px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.form-title {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.form-help {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  color: var(--text);
}

.field input {
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #0e141c;
  color: var(--text);
  padding: 0 14px;
  font-size: 15px;
}

.field input::placeholder {
  color: var(--faint);
}

.pass-row {
  position: relative;
}

.pass-row input {
  width: 100%;
  padding-right: 92px;
}

.toggle-pass {
  position: absolute;
  right: 8px;
  top: 8px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 0 8px;
}

.form-error {
  min-height: 22px;
  margin: 0 0 14px;
  color: var(--accent-2);
  font-size: 13px;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  height: 52px;
  padding: 0 8px 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.35s var(--ease), filter 0.35s var(--ease);
}

.primary:hover {
  filter: brightness(1.08);
}

.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

.primary-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.18);
  transition: transform 0.4s var(--ease);
  line-height: 1;
  font-size: 16px;
}

.primary:hover .primary-icon {
  transform: translateX(2px);
}

.primary.narrow {
  width: auto;
  min-width: 180px;
}

/* HERO + HUB */
.page {
  padding-bottom: 48px;
}

.hero {
  padding: 28px 0 8px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(36px, 5vw, 58px);
  letter-spacing: -0.05em;
  line-height: 1.05;
}

.hero p {
  margin: 0 0 22px;
  color: var(--muted);
  max-width: 42ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hub-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 14px;
  margin-top: 20px;
}

.tile {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--elev);
  color: var(--text);
  border-radius: var(--radius);
  padding: 28px 26px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease), background 0.4s var(--ease);
}

.tile:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.tile-r {
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(196, 69, 54, 0.22), transparent 50%),
    var(--elev);
}

.tile-dash {
  background:
    radial-gradient(120% 80% at 0% 100%, rgba(90, 120, 150, 0.16), transparent 46%),
    var(--elev);
}

.tile-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.tile h2 {
  margin: 18px 0 0;
  font-size: 42px;
  letter-spacing: -0.05em;
}

.tile-r h2 {
  font-size: 56px;
}

.tile p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  color: var(--muted);
  font-size: 13px;
}

.arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  line-height: 1;
  font-size: 16px;
}

/* WIZARD */
.steps {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 22px;
}

.step-pill {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  background: transparent;
}

.step-pill.done {
  color: var(--text);
  border-color: rgba(138, 163, 122, 0.35);
}

.step-pill.current {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line-strong);
}

.panel {
  padding: 8px;
  border-radius: calc(var(--radius) + 8px);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.panel-inner {
  background: var(--elev);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 28px;
  min-height: 320px;
}

.panel h2 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.panel .lede {
  margin: 0 0 22px;
  color: var(--muted);
}

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.choice {
  min-height: 92px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #101820;
  color: var(--text);
  padding: 16px;
  text-align: left;
  transition: border-color 0.35s var(--ease), background 0.35s var(--ease), transform 0.35s var(--ease);
}

.choice strong {
  display: block;
  font-size: 18px;
  letter-spacing: -0.03em;
  text-transform: lowercase;
}

.choice span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.choice.selected,
.choice:hover {
  border-color: rgba(196, 69, 54, 0.55);
  background: var(--accent-soft);
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice.tall {
  min-height: 140px;
}

.drop {
  display: grid;
  place-items: center;
  min-height: 220px;
  border-radius: 18px;
  border: 1px dashed var(--line-strong);
  background: #101820;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.drop.filled {
  border-style: solid;
  border-color: rgba(138, 163, 122, 0.4);
  color: var(--text);
}

.drop input {
  display: none;
}

.file-name {
  font-size: 18px;
  color: var(--text);
  margin: 0 0 4px;
}

.file-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.summary {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.summary div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.summary span {
  color: var(--muted);
}

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
}

/* DASHBOARD */
.stats {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 14px;
}

.stat-card {
  padding: 6px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.stat-inner {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 22px 18px;
  min-height: 100%;
}

.stat-inner h2 {
  margin: 0 0 18px;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 0;
}

.metric + .metric {
  border-top: 1px solid var(--line);
}

.metric b {
  font-size: 34px;
  letter-spacing: -0.05em;
  font-weight: 700;
}

.metric span {
  color: var(--muted);
  font-size: 14px;
}

.metric.zero b {
  color: var(--idle);
}

.metric.down b {
  color: var(--warn);
}

.metric.miss b {
  color: var(--accent-2);
}

.banner {
  margin-top: 14px;
  border-radius: 18px;
  border: 1px solid rgba(196, 69, 54, 0.28);
  background: rgba(196, 69, 54, 0.1);
  padding: 16px 18px;
  color: #f3c7c1;
  font-size: 14px;
}

/* ERROR MODAL */
.overlay {
  position: fixed;
  inset: 0;
  z-index: var(--modal);
  background: rgba(6, 8, 12, 0.78);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(460px, 100%);
  padding: 6px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
}

.modal-inner {
  background: var(--elev-2);
  border-radius: 20px;
  padding: 28px 26px 22px;
  border: 1px solid var(--line);
}

.modal h2 {
  margin: 12px 0 8px;
  font-size: 26px;
  letter-spacing: -0.04em;
}

.modal p {
  margin: 0 0 22px;
  color: var(--muted);
}

.warn-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 700;
}

.busy .primary-icon {
  animation: spin 0.9s var(--ease) infinite;
}

@keyframes spin {
  to {
    transform: rotate(220deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 980px) {
  .login {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 34vh;
    padding: 28px 24px 12px;
  }

  .red-plate {
    width: 160px;
    top: 18px;
    right: 18px;
  }

  .hub-grid,
  .stats,
  .choices,
  .choice-row {
    grid-template-columns: 1fr 1fr;
  }

  .tile-r h2 {
    font-size: 48px;
  }
}

@media (max-width: 720px) {
  .shell {
    width: calc(100% - 24px);
  }

  .hub-grid,
  .stats,
  .choices,
  .choice-row {
    grid-template-columns: 1fr;
  }

  .login-title {
    max-width: none;
  }

  .nav-row {
    flex-direction: column-reverse;
  }

  .nav-row .ghost-btn,
  .nav-row .primary {
    width: 100%;
  }
}
