:root {
  --bg: #0b0f17;
  --bg-soft: #121826;
  --card: #151c2b;
  --card-2: #1b2436;
  --border: #263149;
  --text: #e8edf6;
  --muted: #97a3b8;
  --accent: #4c8dff;
  --accent-2: #7c5cff;
  --ok: #2fbf71;
  --warn: #f5a524;
  --bad: #f4506a;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --radius: 14px;
  --maxw: 1180px;
}

[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --card-2: #f7f9fd;
  --border: #dfe5f0;
  --text: #131a26;
  --muted: #5d6a80;
  --accent: #2563eb;
  --accent-2: #6d3df5;
  --shadow: 0 4px 18px rgba(20, 35, 70, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.micro { color: var(--muted); font-size: .82rem; margin: .35rem 0; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .74rem; margin: 0 0 .5rem; }
.hide-xs { display: inline; }

/* ---------- top bar ---------- */
.topbar {
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.topbar.sticky { position: sticky; top: 0; z-index: 30; }
.topbar-inner { display: flex; align-items: center; gap: 12px; min-height: 58px; }
.brand { font-weight: 700; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 8px; }
.brand-mark { color: var(--accent); }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 38px;
  height: 38px;
  font-size: 1rem;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }

.pill {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  padding: .3rem .7rem;
  font-size: .78rem;
  white-space: nowrap;
}
.pill.ok { border-color: var(--ok); color: var(--ok); }
.pill.bad { border-color: var(--bad); color: var(--bad); }
.pill.warn { border-color: var(--warn); color: var(--warn); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: .62rem 1.05rem;
  font-weight: 600;
  font-size: .92rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn-primary:hover { text-decoration: none; filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); text-decoration: none; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* ---------- landing ---------- */
.hero { padding: 56px 0 28px; max-width: 760px; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); line-height: 1.15; margin: .2rem 0 1rem; letter-spacing: -.02em; }
.lede { color: var(--muted); font-size: 1.05rem; max-width: 62ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.6rem 0 .8rem; }

.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1rem; margin: 0 0 .6rem; letter-spacing: -.01em; }
.card ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: .92rem; }
.card li { margin-bottom: .35rem; }
.disclaimer { border-left: 3px solid var(--warn); }
.disclaimer p { margin: 0; color: var(--muted); font-size: .92rem; }

.footer { padding: 28px 0 40px; color: var(--muted); font-size: .85rem; }

/* ---------- login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { font-size: 1.3rem; margin: 0 0 .3rem; }
label { display: block; font-size: .82rem; color: var(--muted); margin: .9rem 0 .3rem; }
input {
  width: 100%;
  padding: .68rem .75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 1rem;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
#login-form .btn { margin-top: 1.1rem; }
.error {
  margin-top: .9rem;
  padding: .6rem .7rem;
  border-radius: 10px;
  border: 1px solid var(--bad);
  color: var(--bad);
  font-size: .88rem;
  background: color-mix(in srgb, var(--bad) 12%, transparent);
}

/* ---------- app layout ---------- */
.app-layout { display: grid; grid-template-columns: 210px 1fr; gap: 20px; padding-top: 20px; padding-bottom: 40px; }
.sidenav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 78px; align-self: start; }
.sidenav a {
  padding: .55rem .7rem;
  border-radius: 10px;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 500;
}
.sidenav a:hover { background: var(--card); color: var(--text); text-decoration: none; }
.sidenav a.active { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.sidenav-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.content { min-width: 0; }

.loading, .empty { color: var(--muted); padding: 28px 0; }
.error-banner {
  border: 1px solid var(--bad);
  color: var(--bad);
  border-radius: 10px;
  padding: .7rem .8rem;
  margin-bottom: 14px;
  font-size: .9rem;
  background: color-mix(in srgb, var(--bad) 10%, transparent);
}

/* Customer access window: read-only notice, never an action. */
.access-note {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .55rem .8rem;
  margin-bottom: 14px;
  font-size: .85rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--border) 12%, transparent);
}
.access-note strong { color: var(--text); font-weight: 600; }
.access-note.expired {
  border-color: var(--bad);
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 10%, transparent);
}
.access-expired-panel {
  border: 1px solid var(--bad);
  border-radius: 10px;
  padding: 1.6rem 1.4rem;
  margin: 1rem 0;
  background: color-mix(in srgb, var(--bad) 8%, transparent);
}
.access-expired-panel h2 { margin: 0 0 .5rem; font-size: 1.1rem; }
.access-expired-panel p { margin: .35rem 0; }

.page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { font-size: 1.25rem; margin: 0; letter-spacing: -.01em; }
.page-head .stamp { color: var(--muted); font-size: .8rem; margin-left: auto; }

/* ---------- stats & cards ---------- */
.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.stat .label { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; }
.stat .value { font-size: 1.4rem; font-weight: 700; margin-top: .2rem; letter-spacing: -.02em; }
.stat .sub { color: var(--muted); font-size: .78rem; margin-top: .15rem; }
.value.pos { color: var(--ok); }
.value.neg { color: var(--bad); }
.value.unavailable { color: var(--warn); font-size: .95rem; }

.badge {
  display: inline-block;
  padding: .18rem .5rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  border: 1px solid var(--border);
}
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.bad { color: var(--bad); border-color: var(--bad); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.neutral { color: var(--muted); }
.badge.buy { color: var(--ok); border-color: var(--ok); }
.badge.sell { color: var(--bad); border-color: var(--bad); }

.banner {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--muted);
  font-size: .88rem;
  margin-bottom: 14px;
  background: var(--card-2);
}

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: .3rem .75rem;
  font-size: .82rem;
  cursor: pointer;
}
.tabs button.active { color: var(--text); border-color: var(--accent); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }

.two-col { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.section { margin-bottom: 18px; }
.section > h2 { font-size: .95rem; margin: 0 0 .6rem; }

/* ---------- responsive ---------- */
.only-mobile { display: none; }

@media (max-width: 860px) {
  .app-layout { grid-template-columns: 1fr; }
  .only-mobile { display: inline-flex; }
  .hide-xs { display: none; }
  .sidenav {
    position: fixed;
    inset: 58px 0 auto 0;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    padding: 10px 16px 14px;
    display: none;
    z-index: 25;
    box-shadow: var(--shadow);
  }
  .sidenav.open { display: flex; }
  .hero { padding-top: 34px; }
  .page-head .stamp { margin-left: 0; width: 100%; }
  th, td { padding: .55rem .6rem; }
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) {
    --bg: #f4f6fb; --bg-soft: #ffffff; --card: #ffffff; --card-2: #f7f9fd;
    --border: #dfe5f0; --text: #131a26; --muted: #5d6a80;
    --accent: #2563eb; --accent-2: #6d3df5; --shadow: 0 4px 18px rgba(20, 35, 70, .08);
  }
}

/* ---------- landing sections ---------- */
.section { margin-bottom: 18px; }
.section-title { font-size: 1.35rem; margin: 0 0 .4rem; letter-spacing: -.02em; }
.section > .eyebrow { margin-bottom: .2rem; }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 16px; }
.card h3 { font-size: .95rem; margin: 0 0 .5rem; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--muted); font-size: .9rem; }
.check-list { list-style: none; margin: 0 0 .8rem; padding: 0; }
.check-list li { padding: .35rem 0 .35rem 1.6rem; position: relative; color: var(--text); font-size: .92rem; }
.check-list li::before { content: "\2713"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.safety-card { border-left: 3px solid var(--ok); }
.cta-panel {
  text-align: center;
  padding: 34px 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--card)), var(--card));
}
.cta-panel h2 { font-size: 1.4rem; margin: 0 0 .5rem; }
.cta-panel .hero-actions { justify-content: center; }
.btn-sm { padding: .4rem .8rem; font-size: .85rem; }
.topnav .btn { text-decoration: none; }

/* ---------- dashboard cards ---------- */
.decision-card { border-left: 3px solid var(--accent); margin-bottom: 16px; }
.decision-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.decision-head h2 { font-size: .95rem; margin: 0; }
.decision-value { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; margin: .4rem 0 .8rem; }
.market-cards { margin-bottom: 16px; }
.market-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.market-card-head h3 { margin: 0; }
.market-price { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin: .5rem 0 .7rem; font-variant-numeric: tabular-nums; }
.topbar-stamp { white-space: nowrap; }

/* ---------- ux quality ---------- */
html, body { overflow-x: clip; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn { transition: filter .15s ease, border-color .15s ease; }
.btn:focus-visible { text-decoration: none; }
.sidenav a { transition: background .15s ease, color .15s ease; }
.tabs button { transition: border-color .15s ease, color .15s ease; }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .btn, .sidenav a, .tabs button { transition: none; }
}
