/* Chem2Cure learner portal + sign-in.
   Palette: navy ink, Chem2Cure blue, reaction teal on a cool mist canvas.
   One typeface (Inter), tabular figures for money, dates and references. */

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #0b1b3f;
  --ink-2: #33415c;
  --muted: #5d6a82;
  --line: #e2e8f1;
  --line-2: #cfd8e6;
  --canvas: #f4f7fb;
  --surface: #ffffff;
  --brand: #1a4dd8;
  --brand-ink: #123aa8;
  --brand-tint: #ebf0fd;
  --teal: #0e9fa2;
  --teal-tint: #e3f6f6;
  --success: #12805a;
  --success-tint: #e4f5ee;
  --warn: #a2610a;
  --warn-tint: #fdf2e1;
  --danger: #b9391f;
  --danger-tint: #fdece8;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --focus: 0 0 0 3px rgba(26, 77, 216, 0.28);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  font-feature-settings: "cv11", "ss01";
}
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; line-height: 1.2; }
h1 { font-size: 1.75rem; font-weight: 720; }
h2 { font-size: 1.08rem; font-weight: 680; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex: none; }
.num, .price, .price-lg, .price-sm, .key-figures dd, .totals dd, .date-stub strong { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.lede { color: var(--muted); margin-top: 4px; }
.hint { color: var(--muted); font-size: 0.84rem; }
.error-text { color: var(--danger); font-size: 0.88rem; margin-top: 4px; }
.warn-text { color: var(--warn); }
.text-link { color: var(--brand); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.text-link:hover { text-decoration: underline; }
.text-button { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.text-button:hover { color: var(--danger); }
.link-quiet { color: var(--muted); text-decoration: none; font-weight: 550; font-size: 0.9rem; }
.link-quiet:hover { color: var(--ink); }

/* ---------- logo ---------- */
.logo-mark {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 0.78rem; letter-spacing: 0.02em;
  box-shadow: inset 0 -3px 0 rgba(14, 159, 162, 0.9);
}
.portal-logo img { width: 34px; height: auto; flex: none; }
.portal-logo, .auth-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 720; letter-spacing: -0.01em; }
.portal-logo small { display: block; font-weight: 500; font-size: 0.76rem; color: var(--muted); letter-spacing: 0; }

/* ---------- buttons ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: var(--r); border: 1px solid transparent;
  font: inherit; font-weight: 620; font-size: 0.94rem; text-decoration: none; cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.button svg.lucide { width: 17px; height: 17px; }
.button-primary { background: var(--brand); color: #fff; }
.button-primary:hover { background: var(--brand-ink); }
.button-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.button-secondary:hover { border-color: var(--ink-2); }
.button-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.button-ghost:hover { background: var(--surface); border-color: var(--line-2); }
.button-light { background: #fff; color: var(--ink); }
.button-light:hover { background: var(--brand-tint); }
.button-outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.button-outline-light:hover { border-color: #fff; }
.button-small { min-height: 34px; padding: 0 12px; font-size: 0.86rem; border-radius: 8px; }
.button-block { width: 100%; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-button {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; position: relative; text-decoration: none;
}
.icon-button:hover { border-color: var(--line-2); color: var(--ink); }

/* ---------- notices & status ---------- */
.notice { padding: 12px 16px; border-radius: var(--r); font-weight: 520; border: 1px solid; margin-bottom: 16px; }
.notice ul { margin: 6px 0 0; padding-left: 18px; font-weight: 450; }
.notice-success { background: var(--success-tint); border-color: #bfe6d5; color: #0b5c40; }
.notice-error { background: var(--danger-tint); border-color: #f5c9bf; color: #8c2914; }
.notice-info { background: var(--brand-tint); border-color: #cdd9fa; color: var(--brand-ink); }
.notice-action { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.notice-action form { margin: 0; }
.notice-action .button { background: #fff; border-color: #cdd9fa; color: var(--brand-ink); }
.status {
  display: inline-flex; align-items: center; gap: 6px; width: fit-content;
  padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 620; text-decoration: none; white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-success { background: var(--success-tint); color: var(--success); }
.status-warn { background: var(--warn-tint); color: var(--warn); }
.status-info { background: var(--brand-tint); color: var(--brand); }
.status-danger { background: var(--danger-tint); color: var(--danger); }
.status-muted { background: #eef1f6; color: var(--muted); }
.status-lg { font-size: 0.9rem; padding: 6px 14px; }
.status-block { margin-bottom: 4px; }
.badge {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--teal); color: #fff; font-size: 0.72rem; font-weight: 700; font-style: normal;
}

/* ---------- form fields ---------- */
.form-stack { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > span:first-child { font-weight: 600; font-size: 0.9rem; color: var(--ink-2); }
.field em { font-style: normal; font-weight: 450; color: var(--muted); }
.field-row { display: flex; justify-content: space-between; align-items: baseline; }
.field-row a { font-weight: 550; color: var(--brand); text-decoration: none; font-size: 0.86rem; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
input:not([type=checkbox]):not([type=file]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 13px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: #b6c2d6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input:disabled { background: #f1f4f8; color: var(--muted); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; color: var(--ink-2); }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 64px; }
.reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--brand); font: inherit; font-weight: 600; font-size: 0.84rem; padding: 6px 8px; cursor: pointer; }
.strength { display: block; height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.strength i { display: block; height: 100%; width: 0; background: var(--danger); transition: width 200ms ease; }
.strength[data-level="1"] i { width: 35%; background: var(--warn); }
.strength[data-level="2"] i { width: 60%; background: var(--teal); }
.strength[data-level="3"] i, .strength[data-level="4"] i { width: 100%; background: var(--success); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* =====================================================================
   Sign in / Start here
   ===================================================================== */
.auth-body { background: var(--surface); }
.auth-shell { display: grid; grid-template-columns: minmax(420px, 50%) 1fr; min-height: 100vh; }
.auth-panel {
  position: relative; overflow: hidden; color: #dbe5ff;
  background:
    radial-gradient(55% 40% at 72% 30%, rgba(14, 159, 162, 0.25), transparent 70%),
    radial-gradient(50% 40% at 10% 95%, rgba(26, 77, 216, 0.38), transparent 70%),
    var(--ink);
  padding: 30px 48px 34px; display: flex; flex-direction: column; gap: 22px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 720; font-size: 1.05rem; }
.auth-brand img { width: 34px; height: auto; background: #fff; border-radius: 9px; padding: 4px; }
.auth-panel-copy { position: relative; z-index: 1; max-width: 34rem; }
.auth-panel-copy h2 { font-size: clamp(1.8rem, 2.6vw, 2.4rem); font-weight: 760; letter-spacing: -0.03em; line-height: 1.06; color: #fff; }
.auth-panel-copy p { margin-top: 10px; color: #b9c6e4; max-width: 30rem; }
.perks { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.perks li { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); font-size: 0.84rem; color: #dbe5ff; }
.perks svg.lucide { width: 15px; height: 15px; color: #8fe3e4; }

.auth-main { display: flex; flex-direction: column; padding: 24px 40px; }
.auth-top { display: flex; justify-content: space-between; align-items: center; }
.auth-top .link-quiet { display: inline-flex; align-items: center; gap: 6px; }
.auth-top svg.lucide { width: 16px; height: 16px; }
.auth-form-wrap { width: 100%; max-width: 430px; margin: auto; padding: 24px 0; }
.auth-logo-full { display: block; width: fit-content; margin: 0 auto 22px; }
.auth-logo-full img { width: 132px; height: auto; }
.auth-form-wrap h1 { font-size: 1.9rem; font-weight: 740; letter-spacing: -0.025em; margin-top: 24px; }
.auth-form-wrap .lede { margin: 6px 0 22px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--canvas); border: 1px solid var(--line); border-radius: 12px; }
.auth-tabs a { text-align: center; padding: 9px; border-radius: 9px; text-decoration: none; font-weight: 600; color: var(--muted); font-size: 0.92rem; }
.auth-tabs a.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(11, 27, 63, 0.08), 0 0 0 1px var(--line); }
.auth-switch { text-align: center; margin-top: 18px; color: var(--muted); font-size: 0.92rem; }
.auth-switch a { color: var(--brand); font-weight: 600; text-decoration: none; }
.auth-legal { text-align: center; color: var(--muted); font-size: 0.8rem; }
.caps-warning { display: inline-flex; align-items: center; gap: 5px; color: var(--warn); font-size: 0.82rem; font-weight: 600; }
.caps-warning[hidden] { display: none; }
.caps-warning svg.lucide { width: 15px; height: 15px; }
.button.is-loading { pointer-events: none; opacity: 0.85; }
.button.is-loading::before { content: ""; width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; animation: spin 0.7s linear infinite; }
.button.is-loading svg.lucide { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.trust-row { list-style: none; padding: 16px 0 0; margin: 24px 0 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; gap: 8px; }
.trust-row li { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 0.76rem; font-weight: 550; white-space: nowrap; }
.trust-row svg.lucide { width: 15px; height: 15px; color: var(--teal); }

/* ---------- iMac desktop scene ---------- */
.imac { position: relative; width: 100%; max-width: 640px; margin: 0 auto; flex: none; }
.imac-screen {
  position: relative; border-radius: 14px 14px 0 0; overflow: hidden; border: 9px solid #e9edf3; border-bottom: 0;
  aspect-ratio: 16 / 10.4;
  background: radial-gradient(90% 70% at 15% 10%, #3a6be8, transparent 60%), radial-gradient(80% 80% at 95% 90%, #0e9fa2, transparent 55%), linear-gradient(135deg, #1a3a9c, #0a1f5c 60%, #063a52);
  display: grid; grid-template-rows: auto 1fr auto; box-shadow: 0 40px 70px rgba(0, 0, 0, 0.45);
}
.imac-chin { height: 30px; background: linear-gradient(#e9edf3, #d3dae5); border-radius: 0 0 12px 12px; position: relative; }
.imac-chin::after { content: ""; position: absolute; left: 50%; top: 10px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #b9c3d3; }
.imac-stand { width: 22%; height: 46px; margin: 0 auto; background: linear-gradient(90deg, #b9c3d3, #e6ebf2 45%, #c7cfdb); clip-path: polygon(14% 0, 86% 0, 100% 100%, 0 100%); }
.menubar { display: flex; align-items: center; gap: 12px; padding: 4px 12px; background: rgba(9, 18, 48, 0.42); backdrop-filter: blur(12px); color: #eef3ff; font-size: 0.66rem; }
.menubar img { width: 13px; height: auto; background: #fff; border-radius: 3px; padding: 1px; }
.menubar b { font-weight: 700; }
.menubar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.menubar svg.lucide { width: 12px; height: 12px; }
.desk { display: grid; grid-template-columns: minmax(0, 1fr) 31%; gap: 10px; padding: 12px 12px 6px; min-height: 0; }

.win { display: grid; grid-template-rows: auto auto 1fr; border-radius: 10px; overflow: hidden; background: #fbfcfe; box-shadow: 0 18px 40px rgba(3, 10, 30, 0.45); min-height: 0; }
.win-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #eef2f7; border-bottom: 1px solid #dfe5ee; }
.lights { display: flex; gap: 5px; }
.lights i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; }
.lights i:nth-child(2) { background: #febc2e; } .lights i:nth-child(3) { background: #28c840; }
.win-title { font-size: 0.68rem; font-weight: 650; color: var(--ink-2); }
.win-tabs { margin-left: auto; display: flex; padding: 2px; background: #dfe5ee; border-radius: 7px; }
.win-tabs button { border: 0; background: none; font: inherit; font-size: 0.64rem; font-weight: 600; color: var(--muted); padding: 2px 8px; border-radius: 5px; cursor: pointer; }
.win-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(11, 27, 63, 0.12); }
.win-tools { display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-bottom: 1px solid #edf1f6; }
.win-tools button { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--ink-2); cursor: pointer; }
.win-tools button:hover { background: #eef2f7; border-color: #dfe5ee; }
.win-tools svg.lucide { width: 13px; height: 13px; }
.tool-sep { width: 1px; height: 14px; background: #dfe5ee; margin: 0 4px; }
.tool-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 0.6rem; font-weight: 600; color: #0a6c6e; background: var(--teal-tint); padding: 2px 7px; border-radius: 999px; }
.tool-chip svg.lucide { width: 11px; height: 11px; }
.win-canvas { position: relative; overflow: hidden; background: radial-gradient(circle at 50% 45%, #ffffff, #eef3f8 75%); cursor: grab; min-height: 0; }
.win-canvas:active { cursor: grabbing; }
.view { position: absolute; inset: 0; display: none; place-items: center; }
.view.active { display: grid; }
.model-wrap { position: absolute; inset: 4%; transition: transform 120ms ease-out; will-change: transform; }
.model-wrap img { width: 100%; height: 100%; object-fit: contain; user-select: none; pointer-events: none; }
.view-motion { background: #021133; }
.view-motion video { width: 100%; height: 100%; object-fit: cover; }
.hotspot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; background: #f2a73b; cursor: help; padding: 0; box-shadow: 0 0 0 0 rgba(242, 167, 59, 0.6); animation: pulse 2.2s ease-out infinite; }
.hotspot span { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: 150px; padding: 6px 8px; border-radius: 7px; background: var(--ink); color: #fff; font-size: 0.62rem; line-height: 1.35; font-weight: 550; opacity: 0; pointer-events: none; transition: opacity 150ms ease; }
.hotspot:hover span, .hotspot:focus span { opacity: 1; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(242, 167, 59, 0.6); } 70% { box-shadow: 0 0 0 12px rgba(242, 167, 59, 0); } 100% { box-shadow: 0 0 0 0 rgba(242, 167, 59, 0); } }
.canvas-hint { position: absolute; left: 8px; bottom: 6px; display: inline-flex; align-items: center; gap: 4px; font-size: 0.58rem; color: var(--muted); background: rgba(255, 255, 255, 0.85); padding: 2px 7px; border-radius: 999px; }
.canvas-hint svg.lucide { width: 10px; height: 10px; }
.view-motion.active ~ .canvas-hint { display: none; }

.widgets { display: grid; gap: 10px; align-content: start; }
.widget { border-radius: 14px; padding: 10px; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(14px); color: var(--ink); box-shadow: 0 12px 30px rgba(3, 10, 30, 0.35); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cal-head strong { font-size: 0.74rem; color: #d63c2f; font-weight: 700; }
.cal-head button { border: 0; background: none; font-size: 0.9rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.cal-head button:hover { color: var(--ink); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 0.56rem; font-variant-numeric: tabular-nums; }
.cal-week span { color: var(--muted); font-weight: 650; }
.cal-grid span { position: relative; display: grid; place-items: center; height: 15px; border-radius: 50%; color: var(--ink-2); font-weight: 550; }
.cal-grid span.is-today { background: #d63c2f; color: #fff; font-weight: 700; aspect-ratio: 1; justify-self: center; height: 15px; }
.cal-grid span.has-event { color: var(--brand); font-weight: 800; }
.cal-grid span.has-event::after { content: ""; position: absolute; bottom: -1px; width: 3px; height: 3px; border-radius: 50%; background: var(--teal); }
.widget-label { display: flex; align-items: center; gap: 5px; font-size: 0.58rem; font-weight: 650; color: var(--muted); margin-bottom: 4px; }
.widget-label svg.lucide { width: 11px; height: 11px; color: var(--teal); }
.next-widget strong { display: block; font-size: 0.7rem; line-height: 1.25; }
.widget-sub { font-size: 0.6rem; color: var(--muted); margin-top: 2px; }
.countdown { margin-top: 6px; font-size: 0.82rem; font-weight: 760; color: var(--brand); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.dock { justify-self: center; display: flex; gap: 6px; margin-bottom: 7px; padding: 5px 7px; border-radius: 13px; background: rgba(255, 255, 255, 0.22); border: 1px solid rgba(255, 255, 255, 0.28); backdrop-filter: blur(14px); }
.dock span { position: relative; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(160deg, #ffffff, #dfe7f5); color: var(--brand); transition: transform 140ms ease; }
.dock span:hover { transform: translateY(-3px) scale(1.08); }
.dock span:nth-child(2) { color: var(--teal); } .dock span:nth-child(4) { color: #d63c2f; } .dock span:nth-child(5) { color: var(--warn); }
.dock .dock-active { background: linear-gradient(160deg, #1a4dd8, #0e9fa2); color: #fff; }
.dock .dock-active::after { content: ""; position: absolute; bottom: -4px; width: 3px; height: 3px; border-radius: 50%; background: #fff; }
.dock svg.lucide { width: 14px; height: 14px; }
@media (max-width: 1250px) { .hide-sm { display: none; } }
@media (max-height: 800px) { .auth-panel-copy p { display: none; } .imac { max-width: 560px; } }
@media (prefers-reduced-motion: reduce) { .hotspot { animation: none; } .model-wrap { transition: none; } }

/* =====================================================================
   Portal shell
   ===================================================================== */
.portal-shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.portal-nav {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 2px;
}
.portal-nav .portal-logo { padding: 4px 8px 18px; }
.nav-group { margin: 16px 10px 6px; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px;
  text-decoration: none; color: var(--ink-2); font-weight: 550; font-size: 0.93rem;
}
.nav-item svg.lucide { color: #7d8aa3; }
.nav-item:hover { background: var(--canvas); color: var(--ink); }
.nav-item.active { background: var(--brand-tint); color: var(--brand-ink); font-weight: 640; }
.nav-item.active svg.lucide { color: var(--brand); }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav-item .badge { margin-left: auto; }
.nav-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 2px; }

.portal-main { min-width: 0; display: flex; flex-direction: column; }
.portal-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 32px; background: rgba(244, 247, 251, 0.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-toggle { display: none; }
.top-search { position: relative; flex: 1; max-width: 420px; margin-right: auto; }
.top-search svg.lucide { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; }
.top-search input[type=search] { min-height: 40px; padding-left: 40px; background: var(--surface); }
.cart-button .badge { position: absolute; top: -6px; right: -6px; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 3px 8px 3px 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary svg.lucide { width: 15px; height: 15px; color: var(--muted); }
.user-menu-name { font-weight: 600; font-size: 0.9rem; }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 260px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(11, 27, 63, 0.14);
}
.user-menu-head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-menu-head strong { display: block; font-size: 0.92rem; }
.user-menu-head span { display: block; font-size: 0.8rem; color: var(--muted); word-break: break-all; }
.user-menu-panel a, .user-menu-panel button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px; border-radius: 8px; font: inherit; font-size: 0.92rem; color: var(--ink-2); text-decoration: none; background: none; border: 0; cursor: pointer; }
.user-menu-panel a:hover, .user-menu-panel button:hover { background: var(--canvas); color: var(--ink); }
.user-menu-panel form { margin: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-sm { width: 30px; height: 30px; }
.avatar-initials { display: inline-grid; place-items: center; background: var(--teal-tint); color: #0a6c6e; font-weight: 700; font-size: 0.82rem; border-radius: 50%; }
.avatar-sm.avatar-initials { font-size: 0.72rem; }

.portal-content { padding: 28px 32px 64px; width: 100%; max-width: 1180px; display: grid; gap: 20px; align-content: start; }
.portal-content > .notice { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 550; font-size: 0.9rem; width: fit-content; }
.back:hover { color: var(--ink); }
.back svg.lucide { width: 16px; height: 16px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px; }
.panel > h2 { margin-bottom: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.stack { display: grid; gap: 20px; align-content: start; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.empty { color: var(--muted); }
.empty-state { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 48px 24px; }
.empty-state > svg.lucide { width: 34px; height: 34px; color: var(--teal); }
.empty-state p { color: var(--muted); max-width: 26rem; }
.empty-state .button { margin-top: 6px; }

/* ---------- overview ---------- */
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 20px; }
.next-session {
  position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 28px 30px;
  background: var(--ink); color: #fff; display: grid; gap: 8px; align-content: start;
}
.next-hex { position: absolute; right: -36px; bottom: -48px; width: 230px; color: var(--teal); opacity: 0.6; pointer-events: none; }
.next-label { color: #8fe3e4; font-weight: 600; font-size: 0.9rem; }
.next-session h2 { font-size: 1.55rem; font-weight: 720; letter-spacing: -0.02em; max-width: 30ch; }
.next-when { color: #c5d1ee; }
.next-when span { color: #8796b8; }
.next-actions { display: flex; gap: 10px; margin-top: 12px; position: relative; z-index: 1; flex-wrap: wrap; }
.profile-meter { display: flex; gap: 18px; align-items: center; }
.profile-meter h2 { margin-bottom: 6px; }
.profile-meter p { color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }
.ring {
  --p: 0; flex: none; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--teal) calc(var(--p) * 1%), var(--line) 0);
}
.ring span { display: grid; place-items: center; width: 66px; height: 66px; border-radius: 50%; background: var(--surface); font-weight: 720; font-variant-numeric: tabular-nums; }
.key-figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.key-figures div { padding: 16px 22px; border-left: 1px solid var(--line); }
.key-figures div:first-child { border-left: 0; }
.key-figures dt { color: var(--muted); font-size: 0.86rem; }
.key-figures dd { margin: 2px 0 0; font-size: 1.6rem; font-weight: 720; letter-spacing: -0.02em; }
.task-list, .mini-list { list-style: none; margin: 0; padding: 0; }
.task-list li { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.task-list li:first-child { border-top: 0; padding-top: 0; }
.task-list li > span:nth-child(2) { flex: 1; }
.mini-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.mini-list li:first-child { border-top: 0; padding-top: 2px; }
.mini-list a { text-decoration: none; min-width: 0; }
.mini-list a strong { display: block; font-weight: 600; font-size: 0.94rem; }
.mini-list a:hover strong { color: var(--brand); }
.mini-list a span { color: var(--muted); font-size: 0.84rem; }
.price-sm { font-weight: 650; font-size: 0.9rem; white-space: nowrap; }

/* ---------- catalog ---------- */
.filter-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.segmented, .tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.segmented a { padding: 7px 14px; border-radius: 999px; text-decoration: none; font-weight: 580; font-size: 0.9rem; color: var(--ink-2); border: 1px solid var(--line); background: var(--surface); }
.segmented a.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.course-list { display: grid; gap: 12px; }
.course-row {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 20px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 20px 16px 16px;
}
.course-row:hover { border-color: var(--line-2); }
.date-stub {
  --stub: var(--brand); display: grid; justify-items: center; align-content: center; height: 72px; border-radius: 12px;
  background: var(--brand-tint); color: var(--stub); border-top: 4px solid var(--stub);
}
.cat-workshop .date-stub { --stub: var(--teal); background: var(--teal-tint); }
.cat-webinar .date-stub, .cat-seminar .date-stub { --stub: #6a3fd4; background: #f0ebfd; }
.cat-conference .date-stub { --stub: var(--warn); background: var(--warn-tint); }
.date-stub span { font-size: 0.78rem; font-weight: 650; }
.date-stub strong { font-size: 1.55rem; font-weight: 760; line-height: 1; letter-spacing: -0.02em; }
.date-stub strong.tba { font-size: 1.05rem; }
.course-kind { color: var(--muted); font-size: 0.84rem; font-weight: 550; margin-bottom: 2px; }
.course-row h3 { font-size: 1.04rem; }
.course-row h3 a { text-decoration: none; }
.course-row h3 a:hover { color: var(--brand); }
.course-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: 0.86rem; }
.course-meta span { display: inline-flex; gap: 6px; align-items: center; }
.course-meta svg.lucide { width: 15px; height: 15px; }
.course-row-side { display: grid; justify-items: end; gap: 8px; text-align: right; }
.course-row-side form { margin: 0; }
.price { font-weight: 700; font-size: 1.02rem; white-space: nowrap; }

/* ---------- course detail ---------- */
.course-detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.course-detail article { max-width: 70ch; }
.course-detail h1 { font-size: 2.1rem; letter-spacing: -0.025em; margin: 4px 0 10px; }
.course-detail article h2 { margin: 28px 0 10px; font-size: 1.15rem; }
.course-detail .lede { font-size: 1.06rem; margin-bottom: 18px; }
.prose { color: var(--ink-2); line-height: 1.7; }
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ticks li { position: relative; padding-left: 28px; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: 5px; width: 14px; height: 8px; border-left: 2.5px solid var(--teal); border-bottom: 2.5px solid var(--teal); transform: rotate(-45deg); }
.buy-box { position: sticky; top: 84px; display: grid; gap: 16px; }
.price-lg { font-size: 1.7rem; font-weight: 740; letter-spacing: -0.02em; }
.facts { display: grid; gap: 10px; margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.facts div:last-child { border-bottom: 0; padding-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.facts div.stacked { display: grid; gap: 2px; }
.facts div.stacked dd { text-align: left; font-weight: 500; }
.facts-wide { margin-bottom: 14px; }

/* ---------- cart & checkout ---------- */
.checkout-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.cart-list { padding: 8px 24px; }
.cart-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 18px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.cart-item h3 a { text-decoration: none; }
.cart-item form { margin: 0; }
.add-more { padding: 16px 0 10px; }
.summary { position: sticky; top: 84px; display: grid; gap: 14px; }
.summary > h2 { margin: 0; }
.summary-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.summary-items li { display: flex; justify-content: space-between; gap: 14px; font-size: 0.92rem; }
.summary-items li a { text-decoration: none; font-weight: 600; }
.summary-items li a:hover { color: var(--brand); }
.summary-items small { display: block; color: var(--muted); }
.summary-items b { white-space: nowrap; font-weight: 650; font-variant-numeric: tabular-nums; }
.totals { margin: 0; display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.totals div { display: flex; justify-content: space-between; color: var(--muted); }
.totals dd { margin: 0; }
.totals .total { color: var(--ink); font-weight: 720; font-size: 1.12rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-top: 14px; color: var(--muted); font-size: 0.86rem; font-weight: 580; border-top: 3px solid var(--line); margin-right: 6px; }
.steps li::before { content: counter(step) ". "; }
.steps li.done { border-color: var(--teal); color: var(--ink-2); }
.steps li.current { border-color: var(--brand); color: var(--brand-ink); }
.pay-methods { display: grid; gap: 14px; margin-bottom: 14px; }
.pay-method { display: grid; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); }
.pay-method:hover { border-color: var(--line-2); }
.pay-method-head { display: flex; align-items: center; gap: 10px; }
.pay-method-head svg.lucide { color: var(--brand); }
.pay-method p { color: var(--muted); font-size: 0.92rem; }
.pay-method .button { justify-self: start; }
.tag { margin-left: auto; font-size: 0.78rem; font-weight: 620; padding: 2px 9px; border-radius: 999px; background: var(--success-tint); color: var(--success); }
.tag-muted { background: #eef1f6; color: var(--muted); }
.instructions { background: var(--canvas); border-radius: var(--r); padding: 14px 16px; line-height: 1.7; font-size: 0.93rem; }
.confirmed-panel { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; background: var(--success-tint); border-color: #bfe6d5; }
.confirmed-panel > svg.lucide { width: 34px; height: 34px; color: var(--success); }
.confirmed-panel > div { flex: 1; min-width: 220px; }
.confirmed-panel h2 { margin-bottom: 4px; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.84rem; padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td a { color: var(--brand); text-decoration: none; font-weight: 600; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.panel:has(> .table) { overflow-x: auto; }

/* ---------- my courses ---------- */
.tabs { border-bottom: 1px solid var(--line); gap: 22px; }
.tabs a { padding: 8px 0 12px; text-decoration: none; color: var(--muted); font-weight: 580; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; }
.tabs a span { background: #e9edf4; color: var(--ink-2); border-radius: 999px; font-size: 0.76rem; padding: 0 7px; font-variant-numeric: tabular-nums; }
.tabs a.active { color: var(--ink); border-color: var(--brand); }
.enrolled-list { display: grid; gap: 12px; }
.enrolled { display: flex; justify-content: space-between; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 22px; flex-wrap: wrap; }
.enrolled h3 { margin: 8px 0 2px; font-size: 1.04rem; }
.enrolled h3 a { text-decoration: none; }
.enrolled h3 a:hover { color: var(--brand); }
.enrolled-actions { display: flex; gap: 8px; }

/* ---------- profile ---------- */
.profile-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.profile-card { position: sticky; top: 84px; display: grid; justify-items: center; text-align: center; gap: 10px; }
.photo-form { margin: 0; }
.photo-drop { position: relative; display: block; width: 116px; height: 116px; border-radius: 50%; cursor: pointer; }
.photo-drop img, .avatar-xl { width: 116px; height: 116px; border-radius: 50%; object-fit: cover; font-size: 2rem; }
.photo-edit { position: absolute; right: 2px; bottom: 2px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; border: 3px solid var(--surface); }
.photo-edit svg.lucide { width: 15px; height: 15px; }
.photo-drop:focus-within { box-shadow: var(--focus); }
.meter { width: 100%; height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin-top: 6px; }
.meter span { display: block; height: 100%; background: var(--teal); }

/* ---------- documents ---------- */
.doc-list { display: grid; }
.doc-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.doc-row strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row .muted { font-size: 0.84rem; }
.doc-row form { margin: 0; }
.doc-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--teal-tint); color: #0a6c6e; }
.upload-inline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.upload-block { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line-2); }
.file-pick { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; min-height: 38px; border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--canvas); cursor: pointer; font-weight: 580; font-size: 0.9rem; max-width: 100%; }
.file-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.file-pick:hover { border-color: var(--brand); color: var(--brand-ink); }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- receipt ---------- */
.receipt-body { background: var(--canvas); padding: 32px 16px; }
.receipt { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 36px; display: grid; gap: 24px; }
.receipt header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.receipt header h1 { font-size: 1.5rem; }
.receipt-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; font-size: 0.92rem; color: var(--ink-2); }
.receipt-meta span { display: block; color: var(--muted); font-size: 0.82rem; }
.receipt-meta strong { display: block; color: var(--ink); }
.receipt tfoot th { padding-top: 14px; font-size: 1rem; color: var(--ink); border-top: 2px solid var(--ink); }
.receipt .no-print { justify-self: start; }
@media print { .receipt-body { background: #fff; padding: 0; } .receipt { border: 0; } .no-print { display: none !important; } }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1080px) {
  .overview-grid, .course-detail, .checkout-grid, .profile-layout { grid-template-columns: 1fr; }
  .buy-box, .summary, .profile-card { position: static; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-panel { display: none; }
}
@media (max-width: 860px) {
  .portal-shell { grid-template-columns: 1fr; }
  .portal-nav { position: fixed; left: 0; top: 0; z-index: 40; width: 272px; transform: translateX(-100%); transition: transform 200ms ease; }
  .nav-open .portal-nav { transform: none; box-shadow: 0 0 40px rgba(11, 27, 63, 0.2); }
  .nav-scrim { display: none; }
  .nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(11, 27, 63, 0.35); }
  .nav-toggle { display: inline-grid; }
  .portal-top { padding: 10px 16px; }
  .portal-content { padding: 20px 16px 48px; }
  .user-menu-name { display: none; }
  .two-col, .field-grid, .field-grid.three { grid-template-columns: 1fr; }
  .key-figures { grid-template-columns: repeat(2, 1fr); }
  .key-figures div:nth-child(3) { border-left: 0; }
  .key-figures div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .course-row { grid-template-columns: 60px minmax(0, 1fr); padding: 14px; }
  .date-stub { height: 60px; }
  .course-row-side { grid-column: 1 / -1; grid-template-columns: auto auto; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
  .auth-main { padding: 20px; }
  .auth-form-wrap h1 { font-size: 1.7rem; }
  .steps li { font-size: 0.78rem; }
  .doc-row { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .doc-row > a { display: none; }
  .receipt { padding: 22px; }
  .receipt-meta { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
  .course-detail h1 { font-size: 1.7rem; }
}
.panel.form-stack > h2, .form-stack > h2 { margin-bottom: -6px; }
.field-grid { align-items: start; } .field { align-content: start; }
@media (min-width: 1081px) { .auth-panel { position: sticky; top: 0; height: 100vh; justify-content: space-between; } }
