:root {
  --navy-950: #061428;
  --navy-900: #0b1f3a;
  --navy-800: #123056;
  --navy-700: #1a3d6d;
  --gold-500: #c9a227;
  --gold-400: #e0b83a;
  --gold-100: #f7efd6;
  --ink: #0f172a;
  --muted: #5b6b7c;
  --line: #d7dde5;
  --surface: #f4f6f9;
  --white: #ffffff;
  --ok: #1f7a4d;
  --err: #a11d2c;
  --warn: #9a4b00;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "DM Sans", "Segoe UI", sans-serif;
  --side-w: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(201,162,39,.12), transparent 55%),
    linear-gradient(180deg, #eef2f7 0%, var(--surface) 40%, #e8edf4 100%);
  min-height: 100vh;
}

a { color: var(--navy-800); text-decoration: none; }
a:hover { color: var(--gold-500); }

.topbar, .desk-topbar {
  background: linear-gradient(90deg, var(--navy-950), var(--navy-800));
  color: var(--white);
  border-bottom: 3px solid var(--gold-500);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-inner, .desk-topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: .75rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.3rem;
  letter-spacing: .02em;
  color: var(--white);
}
.brand span { color: var(--gold-400); }
.nav a {
  color: #dce6f2;
  margin-left: 1rem;
  font-size: .9rem;
  font-weight: 500;
}
.nav a:hover { color: var(--gold-400); }

.desk-top-meta { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.desk-user { color: #c9d6e8; font-size: .88rem; }
.desk-role-pill {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: .22rem .5rem;
  border-radius: 2px;
  background: rgba(201,162,39,.2);
  color: var(--gold-400);
  border: 1px solid rgba(201,162,39,.35);
}
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  padding: .3rem .55rem;
  border-radius: 3px;
  cursor: pointer;
}

.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4.5rem 1.25rem 3rem;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 2rem;
  align-items: end;
  min-height: calc(100vh - 64px);
}
.hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.05;
  margin: 0 0 .75rem;
  color: var(--navy-900);
}
.hero-copy .tag {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 36rem;
}
.hero-panel {
  background: linear-gradient(160deg, var(--navy-900), var(--navy-700));
  color: #eef3fa;
  padding: 1.75rem;
  border-radius: 4px;
  box-shadow: 0 20px 50px rgba(6,20,40,.25);
  border-top: 4px solid var(--gold-500);
  min-height: 280px;
}
.hero-panel h2 {
  font-family: var(--font-display);
  margin: 0 0 .5rem;
  font-size: 1.4rem;
}
.cta-row { display: flex; gap: .75rem; margin-top: 1.5rem; flex-wrap: wrap; }

.btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  padding: .6rem 1rem;
  border-radius: 3px;
  font-weight: 600;
  font-family: var(--font-body);
  font-size: .9rem;
}
.btn-primary { background: var(--gold-500); color: var(--navy-950); }
.btn-primary:hover { background: var(--gold-400); color: var(--navy-950); }
.btn-ghost {
  background: transparent;
  color: var(--navy-900);
  border: 1px solid var(--navy-700);
}
.btn-ghost.light { color: #eef3fa; border-color: rgba(255,255,255,.35); }
.btn-danger { background: var(--err); color: #fff; }
.btn-sm { padding: .35rem .65rem; font-size: .8rem; }

/* Legacy shell + denser desk shell */
.shell, .desk-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.15rem 2rem;
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  gap: 1rem;
  align-items: start;
}
.side, .desk-side {
  background: linear-gradient(180deg, var(--navy-950), var(--navy-900));
  color: #dce6f2;
  padding: .85rem .65rem;
  border-radius: 4px;
  min-height: calc(100vh - 110px);
  border-top: 3px solid var(--gold-500);
  position: sticky;
  top: 68px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.side .who, .desk-side .who {
  font-size: .72rem;
  color: #9bb0c7;
  margin-bottom: .65rem;
  padding: 0 .45rem;
  letter-spacing: .08em;
  font-weight: 700;
}
.side a, .desk-side a {
  display: block;
  color: #e8eef6;
  padding: .48rem .6rem;
  border-radius: 3px;
  margin-bottom: .15rem;
  font-size: .86rem;
  border-left: 3px solid transparent;
}
.side a:hover, .desk-side a:hover {
  background: rgba(201,162,39,.14);
  color: var(--gold-400);
}
.side a.active, .desk-side a.active {
  background: rgba(201,162,39,.2);
  color: var(--gold-400);
  border-left-color: var(--gold-500);
  font-weight: 600;
}
.desk-main { min-width: 0; }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .95rem 1.05rem;
  margin-bottom: .85rem;
  box-shadow: 0 1px 0 rgba(6,20,40,.03);
}
.panel h1, .panel h2, .panel h3 {
  font-family: var(--font-display);
  margin: 0 0 .65rem;
  color: var(--navy-900);
}
.panel h1 { font-size: 1.4rem; }
.panel h2 { font-size: 1.1rem; }
.panel .panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .5rem;
}
.panel .panel-head h1, .panel .panel-head h2 { margin: 0; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-bottom: .85rem;
}
.kpi {
  background: linear-gradient(145deg, #fff, #f7f9fc);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold-500);
  border-radius: 4px;
  padding: .85rem 1rem;
}
.kpi .label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 700;
}
.kpi .value {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--navy-900);
  margin-top: .2rem;
  font-variant-numeric: tabular-nums;
}
.kpi .sub { font-size: .78rem; color: var(--muted); margin-top: .15rem; }

.search-bar {
  display: flex;
  gap: .5rem;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.search-bar input { margin-bottom: 0; flex: 1; min-width: 180px; }
.search-bar label { width: 100%; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 .85rem;
}
.form-grid .full { grid-column: 1 / -1; }

label { display: block; font-size: .76rem; color: var(--muted); margin-bottom: .2rem; font-weight: 600; }
input, select, textarea {
  width: 100%;
  padding: .5rem .6rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  font: inherit;
  margin-bottom: .65rem;
  background: #fbfcfe;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(201,162,39,.35);
  border-color: var(--gold-500);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}
th, td {
  text-align: left;
  padding: .48rem .4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: #f3f6fa;
  position: sticky;
  top: 0;
}
tbody tr:hover { background: #fafbfd; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, Consolas, monospace; }

.badge, .status-pill {
  display: inline-block;
  padding: .12rem .45rem;
  border-radius: 2px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--gold-100);
  color: #7a5d10;
}
.badge.active, .status-pill.active { background: #e5f6ec; color: var(--ok); }
.badge.warn, .status-pill.warn { background: #fff1e6; color: var(--warn); }
.badge.frozen, .status-pill.frozen { background: #e8eef8; color: var(--navy-700); }
.badge.err, .status-pill.err { background: #fde8eb; color: var(--err); }

.flash-ok { background: #e5f6ec; color: var(--ok); padding: .6rem .75rem; border-radius: 3px; margin-bottom: .75rem; border-left: 3px solid var(--ok); }
.flash-err { background: #fde8eb; color: var(--err); padding: .6rem .75rem; border-radius: 3px; margin-bottom: .75rem; border-left: 3px solid var(--err); }

.auth-key-banner {
  background: linear-gradient(135deg, #061428, #123056);
  color: #fff;
  border-top: 4px solid var(--gold);
  border-radius: 4px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}
.auth-key-banner .label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #d7c27a;
  margin-bottom: .35rem;
}
.auth-key-banner .auth-key-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--gold);
}
.auth-key-banner .sub { margin-top: .45rem; color: #c5d0de; font-size: .9rem; }
.auth-key-banner .hint { margin: .55rem 0 0; color: #9eb0c5; font-size: .85rem; }
.demo-banner {
  background: var(--gold-100);
  color: #5c4710;
  text-align: center;
  padding: .35rem;
  font-size: .8rem;
  border-bottom: 1px solid #e6d7a4;
}

.auth-wrap {
  max-width: 420px;
  margin: 3rem auto;
  padding: 0 1rem;
}
.auth-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--gold-500);
  padding: 1.5rem;
  border-radius: 4px;
  box-shadow: 0 12px 30px rgba(6,20,40,.08);
}
.auth-card h1 {
  font-family: var(--font-display);
  margin: 0 0 .25rem;
  color: var(--navy-900);
}
.hint { color: var(--muted); font-size: .85rem; margin-bottom: 1rem; }
.demo-list { font-size: .8rem; color: var(--muted); background: #f7f9fc; padding: .75rem; border-radius: 3px; }

.atm-shell {
  max-width: 480px;
  margin: 2rem auto;
  background: linear-gradient(180deg, #0a1628, #122744);
  color: #e8eef6;
  border-radius: 8px;
  padding: 1.5rem;
  border: 2px solid #2a4568;
  box-shadow: 0 25px 60px rgba(0,0,0,.35);
}
.atm-shell h1 { font-family: var(--font-display); color: var(--gold-400); margin: 0 0 1rem; font-size: 1.35rem; }
.atm-screen {
  background: #0e243f;
  border: 1px inset #3a5a80;
  min-height: 180px;
  padding: 1rem;
  margin-bottom: 1rem;
  font-family: ui-monospace, Consolas, monospace;
}
.atm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }

.pg-wrap {
  max-width: 520px;
  margin: 2.5rem auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--navy-800);
  padding: 1.5rem;
  border-radius: 4px;
  box-shadow: 0 10px 28px rgba(6,20,40,.08);
}
.pg-brand { font-family: var(--font-display); color: var(--navy-900); }

.tabs {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
}
.tabs a {
  padding: .4rem .7rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: .82rem;
  background: #fff;
  color: var(--navy-800);
}
.tabs a.active {
  background: var(--navy-900);
  color: var(--gold-400);
  border-color: var(--navy-900);
}

.section-title {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 700;
  margin: 1rem 0 .4rem;
}

.footer {
  max-width: 1280px;
  margin: 2rem auto 1rem;
  padding: 0 1.25rem 2rem;
  color: var(--muted);
  font-size: .8rem;
}

@media (max-width: 900px) {
  .hero, .shell, .desk-shell, .grid-2, .grid-3, .kpi-row, .form-grid { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-block; }
  .desk-side, .side {
    position: fixed;
    left: 0;
    top: 56px;
    bottom: 0;
    width: min(280px, 86vw);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .2s ease;
    border-radius: 0;
    max-height: none;
    min-height: auto;
  }
  body.nav-open .desk-side,
  body.nav-open .side { transform: translateX(0); box-shadow: 12px 0 30px rgba(0,0,0,.25); }
  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(6,20,40,.35);
    z-index: 45;
  }
  .nav a { margin-left: .55rem; font-size: .8rem; }
}
