/* ASD Group Master CRM — follows the asdgroup.com.my design system:
   navy ink + ASD maroon accent + gold detail, Lexend headings, Source Sans 3 body, 14px cards. */
:root {
  --ink: #0B1220;
  --ink-2: #111B2E;
  --navy: #1E293B;
  --slate: #475569;
  --line: #E2E8F0;
  --line-2: #CBD5E1;
  --mist: #F5F7FA;
  --maroon: #8B1A1A;
  --maroon-dark: #6B1212;
  --maroon-soft: #FBF3F3;
  --gold: #C9A24A;
  --gold-soft: #FBF5E6;
  --success: #15803D;
  --success-soft: #ECFDF3;
  --info: #1D4ED8;
  --info-soft: #EEF4FF;
  --warn: #92400E;
  --warn-soft: #FEF3C7;
  --danger: #B91C1C;
  --danger-soft: #FEF2F2;
  --font-head: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(11, 18, 32, .06), 0 8px 24px rgba(11, 18, 32, .06);
  --shadow-lg: 0 20px 48px rgba(11, 18, 32, .14);
  --sidebar-w: 256px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-body); font-size: 15.5px; line-height: 1.55; color: var(--ink); background: var(--mist); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; letter-spacing: -.01em; }
a { color: var(--maroon); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.hidden { display: none !important; }
.muted { color: var(--slate); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

/* ---------- Layout: dark ink sidebar (like the site's top bar / page hero) ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40; background: var(--ink); color: #CBD5E1;
  display: flex; flex-direction: column; transition: transform .2s; }
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand img { width: 44px; height: 44px; background: #fff; border-radius: 10px; padding: 3px; object-fit: contain; }
.sidebar .brand strong { display: block; font-family: var(--font-head); font-weight: 700; color: #fff; font-size: 16px; letter-spacing: .02em; }
.sidebar .brand small { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.sidebar nav { flex: 1; overflow-y: auto; padding: 8px 10px 20px; }
.sidebar .grp { font-family: var(--font-head); font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #64748B; padding: 16px 10px 6px; display: flex; align-items: center; gap: 8px; }
.sidebar .grp::before { content: ""; width: 14px; height: 2px; background: var(--maroon); }
.sidebar nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 10px; color: #CBD5E1;
  font-family: var(--font-head); font-size: 14px; font-weight: 500; text-decoration: none; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: rgba(139,26,26,.35); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.sidebar nav a .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.sidebar nav a .ic { width: 20px; text-align: center; flex: none; }
.sidebar nav a .tag { margin-left: auto; font-size: 10px; font-family: var(--font-body); font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(201,162,74,.18); color: #F3E3BA; letter-spacing: .04em; }
.sidebar .me { padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.sidebar .me b { display: block; color: #fff; font-family: var(--font-head); font-weight: 500; }
.sidebar .me button, .sidebar .me a { background: none; border: 0; color: #94A3B8; cursor: pointer; padding: 0; margin-right: 12px; font-size: 12.5px; }
.sidebar .me button:hover, .sidebar .me a:hover { color: #fff; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 28px; min-height: 64px; }
.topbar h1 { font-size: 18px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-size: 20px; }
.content { padding: 24px 28px 64px; flex: 1; width: 100%; max-width: 1480px; }
.backdrop { display: none; }
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(11,18,32,.45); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px 16px 64px; }
}

/* ---------- Hero band (dashboard / unit pages), like the site's page-hero ---------- */
.hero { position: relative; overflow: hidden; background: var(--ink); color: #fff; border-radius: 20px; padding: 28px 30px; margin-bottom: 20px; }
.hero::after { content: ""; position: absolute; right: -110px; bottom: -150px; width: 380px; height: 380px; border-radius: 50%; border: 56px solid rgba(139,26,26,.32); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { color: var(--gold); }
.hero h2 { font-size: clamp(22px, 3vw, 30px); margin: 8px 0 4px; }
.hero p { color: #94A3B8; max-width: 70ch; }
.hero .row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.hero .row .grow { flex: 1; min-width: 240px; }
.hero-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 22px; border-top: 1px solid rgba(255,255,255,.08); }
.hero-stats > div { padding: 14px 16px 0; border-left: 1px solid rgba(255,255,255,.08); }
.hero-stats > div:first-child { border-left: 0; padding-left: 0; }
.hero-stats strong { display: block; font-family: var(--font-head); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-stats span { font-size: 13px; color: #94A3B8; }
.hero-stats .gold { color: var(--gold); }
.hero-stats strong { white-space: nowrap; }
@media (max-width: 1000px) { .hero-stats { grid-template-columns: repeat(2, 1fr); } .hero-stats > div { border-left: 0; padding-left: 0; } }
@media (max-width: 520px) { .hero { padding: 22px 18px; border-radius: 16px; } .hero-stats strong { font-size: 20px; } .hero-stats { gap: 0 12px; } }
.hero select { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.2); width: auto; }
.hero select option { color: var(--ink); }
.target { margin-top: 18px; }
.target .bar { height: 8px; background: rgba(255,255,255,.1); border-radius: 99px; overflow: hidden; }
.target .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #E8C877); border-radius: 99px; }
.target .lbl { display: flex; justify-content: space-between; font-size: 13px; color: #94A3B8; margin-bottom: 6px; }

.eyebrow { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--font-head); font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--maroon); }
.eyebrow::before { content: ""; width: 24px; height: 2px; background: currentColor; }

/* ---------- Cards ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h3 { font-size: 15px; font-weight: 600; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 18px 20px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split, .detail-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 18px; }

/* Unit cards (like the site's service cards) */
.units { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 20px; }
@media (max-width: 1200px) { .units { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .units { grid-template-columns: 1fr; } }
.unit { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; display: flex; flex-direction: column; gap: 12px;
  transition: border-color .2s, box-shadow .2s; color: inherit; text-decoration: none !important; position: relative; overflow: hidden; }
.unit::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--uc, var(--maroon)); }
.unit:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.unit-h { display: flex; gap: 12px; align-items: center; }
.unit-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; flex: none; background: color-mix(in srgb, var(--uc) 10%, #fff); }
.unit-h h3 { font-size: 16px; }
.unit-h .src { font-size: 12px; color: var(--slate); display: flex; align-items: center; gap: 6px; }
.live { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--success); background: var(--success-soft); padding: 1px 8px; border-radius: 99px; }
.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .live::before { animation: none; } }
.unit-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.unit-stats div { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 10px; min-width: 0; }
.unit-stats strong { display: block; font-family: var(--font-head); font-size: 17px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-stats span { font-size: 12px; color: var(--slate); }
.unit-foot { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--slate); margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.unit-foot b { color: var(--ink); }
.unit-foot .warn { color: var(--danger); font-weight: 600; }

/* KPI tiles (like the site's admin KPIs) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: block; color: inherit; text-decoration: none !important; }
a.kpi:hover { border-color: var(--ink); }
.kpi strong { display: block; font-family: var(--font-head); font-size: 22px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--slate); }
.kpi.alert strong { color: var(--danger); }
.kpi.good strong { color: var(--success); }

/* ---------- Buttons (pill, like the site) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 40px; padding: 0 1.1rem; border-radius: 999px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; font-family: var(--font-head); font-weight: 500; font-size: 14px;
  white-space: nowrap; text-decoration: none !important; transition: background .2s, border-color .2s, box-shadow .2s; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--maroon); border-color: var(--maroon); color: #fff; }
.btn.primary:hover { background: var(--maroon-dark); box-shadow: 0 8px 20px rgba(139, 26, 26, .25); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.light { background: #fff; border-color: #fff; color: var(--ink); }
.btn.outline-light { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }
.btn.outline-light:hover { border-color: #fff; background: rgba(255,255,255,.08); }
.btn.danger { color: var(--danger); border-color: #FECACA; }
.btn.sm { min-height: 32px; padding: 0 .8rem; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Filter chips (like the site's news filters) */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: .45rem; align-items: center; min-height: 36px; padding: 0 .9rem; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  font-family: var(--font-head); font-size: 13px; color: var(--navy); cursor: pointer; text-decoration: none !important; }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Status pills */
.st { display: inline-block; font-size: 12px; font-weight: 700; padding: .12rem .6rem; border-radius: 999px; background: #E2E8F0; color: #334155; white-space: nowrap; }
.st-new, .st-identified, .st-prospect, .st-draft, .st-planning { background: var(--warn-soft); color: var(--warn); }
.st-contacting, .st-proposal, .st-preparing, .st-issued, .st-procurement { background: #DBEAFE; color: #1E40AF; }
.st-qualified, .st-negotiation, .st-submitted, .st-execution, .st-testing, .st-handover, .st-partially_paid { background: #EDE9FE; color: #5B21B6; }
.st-converted, .st-won, .st-completed, .st-paid, .st-on_track, .st-done { background: #DCFCE7; color: #166534; }
.st-lost, .st-junk, .st-cancelled, .st-void, .st-on_hold { background: #F1F5F9; color: #475569; }
.st-watch { background: var(--warn-soft); color: var(--warn); }
.st-at_risk, .st-hot { background: #FEE2E2; color: #991B1B; }
.st-warm { background: var(--gold-soft); color: #7A5600; }
.st-cold { background: var(--info-soft); color: var(--info); }
.ubadge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--navy); white-space: nowrap; }
.ubadge i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- Forms ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search] { flex: 1; min-width: 220px; max-width: 380px; }
.toolbar select { width: auto; }
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=datetime-local],
input[type=password], input[type=color], select, textarea {
  border: 1px solid var(--line-2); border-radius: 10px; min-height: 42px; padding: 0 .8rem; background: #fff; width: 100%; min-width: 0; }
textarea { padding: .6rem .8rem; resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(201,162,74,.35); border-color: var(--gold); }
label.f { display: block; font-size: 12.5px; font-weight: 600; color: var(--slate); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.fgrid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .fgrid { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--maroon); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #F8FAFC; white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14.5px; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #FBFCFE; }
table.t td .sub { display: block; font-size: 12.5px; color: var(--slate); }
table.t tfoot td { font-weight: 700; background: #F8FAFC; border-top: 1px solid var(--line); }
.empty { padding: 40px 16px; text-align: center; color: var(--slate); }
@media (max-width: 760px) {
  table.t.cards thead { display: none; }
  table.t.cards, table.t.cards tbody, table.t.cards tr, table.t.cards td { display: block; width: 100%; }
  table.t.cards tr { border-bottom: 1px solid var(--line); padding: 10px 4px; }
  table.t.cards td { border: 0; padding: 2px 12px; text-align: left; }
  table.t.cards td[data-l]::before { content: attr(data-l) ': '; color: var(--slate); font-size: 12.5px; }
}

dl.info { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; }
dl.info dt { color: var(--slate); font-size: 13.5px; }
dl.info dd { font-weight: 600; word-break: break-word; }
dl.info dd.pre { white-space: pre-wrap; font-weight: 400; }
@media (max-width: 520px) { dl.info { grid-template-columns: 1fr; } dl.info dd { margin-bottom: 6px; } }

/* ---------- Activity feed / timeline ---------- */
.feed { list-style: none; }
.feed li { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .av { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; background: color-mix(in srgb, var(--uc, #64748B) 12%, #fff); }
.feed .meta { font-size: 12.5px; color: var(--slate); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.feed .what { font-weight: 600; }
.feed .what a { color: var(--ink); }
.feed .what a:hover { color: var(--maroon); }
.feed .body { color: var(--navy); font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }
.tl { list-style: none; }
.tl li { position: relative; padding: 0 0 16px 22px; }
.tl li::before { content: ''; position: absolute; left: 4px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--maroon); }
.tl li::after { content: ''; position: absolute; left: 8.5px; top: 19px; bottom: 0; width: 1px; background: var(--line); }
.tl li:last-child::after { display: none; }
.tl li.t-status::before, .tl li.t-system::before { background: #94A3B8; }
.tl li.t-call::before, .tl li.t-meeting::before { background: var(--gold); }
.tl .meta { font-size: 12.5px; color: var(--slate); }
.tl .body { white-space: pre-wrap; word-break: break-word; }

/* ---------- Pipeline board ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(230px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: #EEF1F5; border-radius: var(--radius); padding: 10px; min-height: 220px; }
.col.drop { outline: 2px dashed var(--maroon); }
.col-h { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 10px; font-family: var(--font-head); font-weight: 600; font-size: 13.5px; }
.col-h .sum { font-size: 12px; color: var(--slate); font-weight: 500; }
.col[data-stage=won] { background: #E6F4EA; }
.col[data-stage=lost] { background: #F6EDED; }
.dcard { background: #fff; border-radius: 10px; padding: 11px 12px; margin-bottom: 8px; border: 1px solid var(--line); border-left: 4px solid var(--uc, var(--maroon)); cursor: grab; }
.dcard:hover { box-shadow: var(--shadow); }
.dcard b { display: block; font-size: 13.5px; line-height: 1.3; }
.dcard .v { font-family: var(--font-head); font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.dcard .m { font-size: 12.5px; color: var(--slate); }

/* Bars & trend chart */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 110px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar { height: 10px; background: #EEF1F5; border-radius: 99px; overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; }
.trend { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; align-items: end; height: 190px; padding-top: 10px; }
.trend .m { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.trend .stackbar { width: 100%; max-width: 54px; display: flex; flex-direction: column-reverse; border-radius: 8px 8px 2px 2px; overflow: hidden; background: #EEF1F5; min-height: 2px; }
.trend .stackbar span { display: block; width: 100%; }
.trend .lbl { font-size: 12px; color: var(--slate); }
.trend .val { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--slate); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Progress */
.prog { height: 6px; background: #EEF1F5; border-radius: 99px; overflow: hidden; min-width: 70px; }
.prog span { display: block; height: 100%; background: var(--success); }
.prog.watch span { background: #D97706; }
.prog.at_risk span { background: var(--danger); }

/* Stage stepper */
.stepper { display: flex; gap: 4px; flex-wrap: wrap; }
.stepper button { flex: 1; min-width: 96px; border: 1px solid var(--line); background: #fff; min-height: 38px; padding: 0 8px; font-family: var(--font-head); font-size: 12.5px; font-weight: 500; cursor: pointer; border-radius: 8px; color: var(--slate); }
.stepper button:hover { border-color: var(--ink); }
.stepper button.done { background: var(--success-soft); color: var(--success); border-color: #BBE5C8; }
.stepper button.cur { background: var(--ink); color: #fff; border-color: var(--ink); }
.stepper button.cur.bad { background: #64748B; border-color: #64748B; }

.page-h { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-h h2 { font-size: 22px; margin-top: 6px; }
.page-h .sub { color: var(--slate); font-size: 14px; margin-top: 4px; }
.page-h .btns { margin-left: auto; }
.back { display: inline-block; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.note-box { background: var(--gold-soft); border: 1px solid #EBD9A6; padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.err { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 18px; background: var(--mist); padding: 10px 14px; border-radius: 10px; letter-spacing: 1px; user-select: all; }
.loading { padding: 48px; text-align: center; color: var(--slate); }

/* ---------- Modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(11, 18, 32, .5); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 680px; box-shadow: var(--shadow-lg); }
.modal.sm { max-width: 440px; }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-h h3 { font-size: 17px; }
.modal-h button { background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--slate); line-height: 1; width: 36px; height: 36px; }
.modal-b { padding: 20px 22px; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; }
#toast div { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; }
#toast div.bad { background: var(--danger); }
@media (max-width: 640px) {
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { border-radius: 18px 18px 0 0; max-height: 94vh; display: flex; flex-direction: column; }
  .modal-b { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .modal-f { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; }
  input, select, textarea { font-size: 16px; }
}
@media (pointer: coarse) { .btn { min-height: 44px; } .btn.sm { min-height: 38px; } }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; position: relative; overflow: hidden;
  background: linear-gradient(100deg, rgba(11,18,32,.96) 0%, rgba(11,18,32,.88) 60%, rgba(11,18,32,.75) 100%), var(--ink); }
.login-wrap::after { content: ""; position: absolute; right: -140px; bottom: -180px; width: 480px; height: 480px; border-radius: 50%; border: 70px solid rgba(139,26,26,.3); }
.login { position: relative; z-index: 1; background: #fff; border-radius: 20px; width: 100%; max-width: 400px; padding: 32px; box-shadow: var(--shadow-lg); border-top: 4px solid var(--gold); }
.login img { width: 76px; display: block; margin: 0 auto 10px; }
.login h1 { text-align: center; font-size: 21px; }
.login .sub { text-align: center; color: var(--slate); margin: 4px 0 20px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.login .btn { width: 100%; min-height: 46px; }
