/* GM OTE — Design System */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --ink: #16243a;
  --ink-soft: #5a6b85;
  --ink-faint: #91a0b8;
  --brand: #0f3d6e;
  --brand-2: #1769b8;
  --accent: #0ea5a4;
  --gold: #c9962e;
  --danger: #d4453a;
  --ok: #1d9e58;
  --warn: #d98b1f;
  --line: #e3e9f2;
  --sidebar: #0c1c33;
  --sidebar-ink: #b9c7dc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,36,58,.05), 0 8px 24px -12px rgba(16,36,58,.12);
  font-size: 15px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: .92rem; }

/* ---------------- layout ---------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--sidebar);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.logo {
  padding: 22px 20px 18px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07);
}
.logo .mark { font-weight: 800; font-size: 1.18rem; letter-spacing: .3px; }
.logo .mark span { color: var(--gold); }
.logo .sub { font-size: .7rem; color: var(--sidebar-ink); margin-top: 3px; text-transform: uppercase; letter-spacing: 1.2px; }
.nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.nav .group { font-size: .66rem; text-transform: uppercase; letter-spacing: 1.4px; color: #5c719223; color: #64789c; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: var(--sidebar-ink); text-decoration: none; font-size: .9rem; font-weight: 500; margin-bottom: 2px;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: linear-gradient(90deg, var(--brand-2), #1e7fd4); color: #fff; box-shadow: 0 4px 14px -4px rgba(23,105,184,.55); }
.nav a .ic { width: 18px; text-align: center; opacity: .9; }
.userbox {
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 10px;
}
.userbox .avatar {
  width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), #e2b955);
  color: #2a2208; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem;
}
.userbox .meta { flex: 1; min-width: 0; }
.userbox .meta .n { color: #fff; font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox .meta .r { color: var(--sidebar-ink); font-size: .68rem; text-transform: capitalize; }
.userbox .out { background: none; border: none; color: var(--sidebar-ink); font-size: 1rem; padding: 6px; border-radius: 6px; }
.userbox .out:hover { color: #fff; background: rgba(255,255,255,.08); }

.main { flex: 1; min-width: 0; padding: 26px 32px 60px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.pagehead h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.3px; }
.pagehead .crumb { font-size: .78rem; color: var(--ink-faint); margin-bottom: 4px; }
.pagehead .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------------- components ---------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .card-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card .card-h h3 { font-size: .98rem; font-weight: 700; }
.card .card-b { padding: 20px; }
.grid { display: grid; gap: 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content:''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand-2); border-radius: 4px 0 0 4px; }
.kpi.gold::before { background: var(--gold); }
.kpi.teal::before { background: var(--accent); }
.kpi.green::before { background: var(--ok); }
.kpi .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-faint); font-weight: 600; }
.kpi .val { font-size: 1.5rem; font-weight: 800; margin-top: 6px; letter-spacing: -.5px; }
.kpi .sub { font-size: .75rem; color: var(--ink-soft); margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; border: none; border-radius: 9px;
  padding: 9px 16px; font-size: .88rem; font-weight: 600; transition: .15s;
  background: var(--brand-2); color: #fff;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; transform: none; pointer-events: none; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--brand-2); color: var(--brand-2); }
.btn.ghost.disabled { pointer-events: auto; opacity: .45; cursor: not-allowed; border-color: var(--line); color: var(--ink-faint); }
.btn.ghost.disabled:hover { border-color: var(--line); color: var(--ink-faint); }
.btn.danger { background: var(--danger); }
.btn.ok { background: var(--ok); }
.btn.sm { padding: 6px 11px; font-size: .78rem; border-radius: 7px; }

.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); outline: none; transition: .15s;
}
.input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(23,105,184,.13); }
.input.sm { padding: 6px 9px; font-size: .82rem; border-radius: 7px; }
label.fld { display: block; margin-bottom: 14px; }
label.fld > span { display: block; font-size: .76rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tbl th {
  text-align: left; padding: 10px 14px; font-size: .68rem; text-transform: uppercase;
  letter-spacing: 1px; color: var(--ink-faint); border-bottom: 1px solid var(--line);
  background: #fafbfd; font-weight: 700; white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.row-click { cursor: pointer; }
.tbl tr.row-click:hover { background: #f6f9fd; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 700; background: #fafbfd; }

.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: .68rem; font-weight: 700; letter-spacing: .3px; }
.badge.sp { background: #e8f0fb; color: var(--brand); }
.badge.head { background: #fdf3e3; color: #9a6b10; }
.badge.cl { background: #e6f6f1; color: #0c7a4d; }
.badge.gray { background: #eef1f6; color: var(--ink-soft); }
.badge.red { background: #fcebe9; color: var(--danger); }
.badge.green { background: #e6f6ec; color: var(--ok); }
.badge.warn { background: #fdf3e3; color: var(--warn); }
.badge.blue { background: #e8f0fb; color: var(--brand-2); }

.pill-mult { font-weight: 700; font-variant-numeric: tabular-nums; padding: 2px 8px; border-radius: 6px; font-size: .82rem; }
.pill-mult.lo { background: #fcebe9; color: var(--danger); }
.pill-mult.mid { background: #eef1f6; color: var(--ink); }
.pill-mult.hi { background: #e6f6ec; color: var(--ok); }
.auto-mult { margin-top: 6px; color: var(--ink-faint); font-size: .78rem; white-space: nowrap; }
.auto-mult .pill-mult { margin-left: 4px; }

/* ---------------- modal & toast ---------------- */
#modal-root .overlay {
  position: fixed; inset: 0; background: rgba(10,20,38,.45); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 18px; z-index: 100;
  animation: fadeIn .15s ease;
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 86vh;
  overflow-y: auto; box-shadow: 0 24px 70px -20px rgba(10,20,38,.45); animation: pop .18s ease;
}
.modal.wide { max-width: 860px; }
.modal .m-h { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal .m-h h3 { font-size: 1.02rem; font-weight: 800; }
.modal .m-h button { background: none; border: none; font-size: 1.25rem; color: var(--ink-faint); }
.modal .m-b { padding: 22px; }
.modal .m-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }

#toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 11px; font-size: .86rem;
  box-shadow: 0 10px 30px -8px rgba(0,0,0,.4); animation: slideUp .25s ease; max-width: 380px;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } }

/* ---------------- login ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1100px 600px at 75% -10%, #16447c 0%, var(--sidebar) 55%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 42px 40px; width: 100%; max-width: 420px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.5);
}
.login-card .mark { font-size: 1.5rem; font-weight: 800; color: var(--brand); }
.login-card .mark span { color: var(--gold); }
.login-card .sub { color: var(--ink-soft); font-size: .85rem; margin: 6px 0 28px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: .95rem; margin-top: 6px; }
.login-err { background: #fcebe9; color: var(--danger); padding: 10px 14px; border-radius: 9px; font-size: .82rem; margin-bottom: 14px; }
.login-demo { margin-top: 22px; font-size: .72rem; color: var(--ink-faint); line-height: 1.7; border-top: 1px dashed var(--line); padding-top: 14px; }

/* ---------------- statement ---------------- */
.stmt-flow { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; }
.stmt-step { flex: 1; min-width: 150px; background: #fafbfd; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-align: center; }
.stmt-step .t { font-size: .68rem; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-faint); font-weight: 700; }
.stmt-step .v { font-size: 1.18rem; font-weight: 800; margin-top: 5px; }
.stmt-step.final { background: linear-gradient(135deg, #0f3d6e, #1769b8); border: none; }
.stmt-step.final .t { color: #b9d4ef; }
.stmt-step.final .v { color: #fff; }
.stmt-arrow { display: flex; align-items: center; color: var(--ink-faint); font-size: 1.1rem; }

.issue-list { margin-top: 14px; }
.issue-list .it { display: flex; gap: 8px; font-size: .8rem; color: var(--warn); padding: 4px 0; }

.muted { color: var(--ink-faint); font-size: .8rem; }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.mt { margin-top: 18px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.help-box { background: #f0f6fd; border: 1px solid #d4e5f7; color: #20507e; border-radius: 11px; padding: 13px 16px; font-size: .81rem; line-height: 1.6; }
pre.code { background: #0c1c33; color: #cfe1f5; border-radius: 10px; padding: 14px; font-size: .76rem; overflow-x: auto; line-height: 1.55; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { padding: 18px; }
  .mobilebar { display: flex !important; }
}
.mobilebar { display: none; position: sticky; top: 0; z-index: 50; background: var(--sidebar); color: #fff; padding: 12px 16px; align-items: center; justify-content: space-between; }
