@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;450;500;600;700&display=swap');

/* ── Tokens ── */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --ink-2: #4b4b4b;
  --muted: #8a8780;
  --line: #ebe8e1;
  --line-2: #f0ede6;
  --accent: #5b4dff;
  --accent-soft: #efedff;
  --warm: #f3ede1;
  --green: #2d7a4f;
  --green-soft: #e6f1ea;
  --amber: #b07b1a;
  --amber-soft: #faf1de;
  --red: #b53b3b;
  --red-soft: #fbeaea;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; font-feature-settings: "ss01","cv11"; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Typography ── */
.serif { font-family: 'Instrument Serif', serif; font-weight: 400; letter-spacing: -0.01em; }

/* ── Shell ── */
.shell { width: 1440px; margin: 0 auto; display: flex; min-height: 100vh; background: var(--bg); }
.shell.no-sidebar { display: block; }
.shell.no-sidebar .main { margin-left: 0; }

/* ── Sidebar ── */
.sidebar { width: 248px; background: var(--bg); border-right: 1px solid var(--line); position: fixed; top: 0; bottom: 0; left: 50%; transform: translateX(-720px); display: flex; flex-direction: column; padding: 20px 14px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: white; display: flex; align-items: center; justify-content: center; font-family: 'Instrument Serif', serif; font-size: 18px; font-style: italic; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.brand-name span { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }

.workspace { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 16px; cursor: pointer; }
.ws-avatar { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #5b4dff, #b39dff); }
.ws-info { flex: 1; }
.ws-name { font-size: 13px; font-weight: 500; }
.ws-plan { font-size: 11px; color: var(--muted); }

.nav-section { font-size: 10.5px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; padding: 14px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2); cursor: pointer; font-weight: 450; margin-bottom: 1px; font-size: 13.5px; transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
.nav-item:hover { background: rgba(0,0,0,0.03); color: var(--ink); }
.nav-item.active { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 0 rgba(0,0,0,0.02), 0 0 0 1px var(--line); }
.nav-item svg { width: 16px; height: 16px; opacity: 0.75; }
.nav-item.active svg { opacity: 1; color: var(--accent); }
.nav-pill { margin-left: auto; font-size: 10.5px; font-weight: 500; padding: 1px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }

.side-bottom { margin-top: auto; }
.help-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.help-card .label { font-size: 11px; color: var(--muted); }
.help-card .title { font-size: 13.5px; font-weight: 500; margin: 4px 0 10px; line-height: 1.35; }
.help-card .actions { display: flex; gap: 6px; }
.btn-mini { font-size: 12px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: white; cursor: pointer; font-family: inherit; color: var(--ink); transition: background var(--duration-fast), opacity var(--duration-fast); }
.btn-mini:hover { background: var(--bg); }
.btn-mini.primary { background: var(--ink); color: white; border-color: var(--ink); }
.btn-mini.primary:hover { opacity: 0.9; }

/* Sidebar logout */
.sidebar-logout { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--muted); cursor: pointer; font-weight: 450; font-size: 13.5px; border: none; background: none; width: 100%; margin-top: 12px; transition: background var(--duration-fast), color var(--duration-fast); }
.sidebar-logout:hover { background: rgba(0,0,0,0.03); color: var(--red); }
.sidebar-logout svg { width: 16px; height: 16px; opacity: 0.75; }

/* ── Main ── */
.main { margin-left: 248px; flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* ── Header ── */
.header { padding: 18px 36px; display: flex; align-items: center; gap: 18px; position: sticky; top: 0; z-index: 10; background: var(--bg); }
.header::after { content: ''; position: absolute; left: 36px; right: 36px; bottom: 0; height: 1px; background: var(--line); }
.search { flex: 1; max-width: 460px; position: relative; }
.search input { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 10px 14px 10px 40px; font-size: 13.5px; font-family: inherit; color: var(--ink); outline: none; transition: border-color var(--duration-fast); }
.search input:focus { border-color: var(--accent); }
.search input::placeholder { color: var(--muted); }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-family: inherit; cursor: pointer; }

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.h-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.h-pill .dot-pulse { width: 7px; height: 7px; background: #2d7a4f; border-radius: 50%; box-shadow: 0 0 0 3px rgba(45,122,79,0.15); }
.icon-btn { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; color: var(--ink-2); transition: background var(--duration-fast); }
.icon-btn:hover { background: var(--bg); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; background: var(--accent); border-radius: 50%; border: 2px solid var(--surface); }
.user-block { display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); cursor: pointer; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #1a1a1a, #5b4dff); color: white; display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: 12px; flex-shrink: 0; }
.user-block .name { font-size: 13px; font-weight: 500; }
.user-block .meta { font-size: 11px; color: var(--muted); }

/* ── Page ── */
.page { padding: 28px 36px 48px; flex: 1; }

/* ── Greeting ── */
.greet { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 28px; }
.greet .eyebrow { font-size: 12px; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 8px; }
.greet h1 { font-size: 44px; line-height: 1.05; letter-spacing: -0.02em; font-weight: 400; }
.greet h1 em { font-style: italic; color: var(--accent); font-family: 'Instrument Serif', serif; }
.greet .sub { font-size: 14.5px; color: var(--ink-2); margin-top: 10px; max-width: 460px; }
.greet-actions { display: flex; gap: 8px; }

/* ── Buttons ── */
.btn { background: var(--ink); color: white; border: none; padding: 11px 18px; border-radius: 11px; font-size: 13.5px; font-weight: 500; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 8px; transition: opacity var(--duration-fast), transform var(--duration-fast); }
.btn:hover { opacity: 0.92; }
.btn:active { transform: scale(0.97); }
.btn svg { width: 14px; height: 14px; }
.btn-soft { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-soft:hover { background: var(--line-2); opacity: 1; }
.btn-accent { background: white; color: var(--ink); border: none; padding: 11px 18px; border-radius: 11px; font-size: 13.5px; font-weight: 500; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 8px; transition: opacity var(--duration-fast), transform var(--duration-fast); }
.btn-accent:hover { opacity: 0.9; }
.btn-accent:active { transform: scale(0.97); }
.btn-ghost { background: rgba(255,255,255,0.08); color: white; border: 1px solid rgba(255,255,255,0.14); padding: 11px 16px; border-radius: 11px; font-size: 13.5px; cursor: pointer; font-family: inherit; backdrop-filter: blur(10px); transition: background var(--duration-fast); }
.btn-ghost:hover { background: rgba(255,255,255,0.15); }
.btn-danger { background: var(--red); color: white; border: none; }

/* ── Hero ── */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-bottom: 22px; }
.hero-quiz { background: linear-gradient(160deg, #1a1a1a 0%, #2c2454 100%); border-radius: 22px; padding: 28px; color: white; position: relative; overflow: hidden; min-height: 260px; }
.hero-quiz::before { content: ''; position: absolute; right: -80px; top: -80px; width: 300px; height: 300px; background: radial-gradient(circle, rgba(91,77,255,0.6), transparent 65%); }
.hero-quiz::after { content: ''; position: absolute; right: 40px; bottom: -40px; width: 160px; height: 160px; background: radial-gradient(circle, rgba(255,200,120,0.18), transparent 70%); }
.hero-tag { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.08); backdrop-filter: blur(10px); padding: 5px 11px; border-radius: 99px; font-size: 11.5px; color: #e6e3ff; border: 1px solid rgba(255,255,255,0.1); margin-bottom: 18px; }
.hero-quiz h2 { position: relative; z-index: 1; font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 400; margin-bottom: 12px; max-width: 460px; font-family: 'Instrument Serif', serif; }
.hero-quiz h2 em { font-style: italic; color: #c9c1ff; }
.hero-quiz .lede { position: relative; z-index: 1; color: rgba(255,255,255,0.65); font-size: 13.5px; max-width: 440px; margin-bottom: 22px; }
.hero-meta { position: relative; z-index: 1; display: flex; gap: 18px; font-size: 12px; color: rgba(255,255,255,0.7); margin-bottom: 22px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-actions { position: relative; z-index: 1; display: flex; gap: 8px; }

/* ── Profile Card ── */
.profile-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 24px; display: flex; flex-direction: column; }
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.pc-label { font-size: 11.5px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.pc-title { font-size: 18px; margin-top: 4px; letter-spacing: -0.01em; font-weight: 500; }
.ring-wrap { position: relative; width: 70px; height: 70px; flex-shrink: 0; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; }
.pc-steps { margin-top: 6px; flex: 1; }
.pc-step { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line-2); font-size: 13px; }
.pc-step:last-child { border-bottom: none; }
.pc-check { width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pc-check.done { background: var(--green); color: white; }
.pc-check.pending { border: 1.5px dashed var(--muted); color: var(--muted); font-size: 10px; }
.pc-step span.muted { color: var(--muted); margin-left: auto; font-size: 11.5px; }
.pc-cta { margin-top: 14px; width: 100%; justify-content: center; }

/* ── KPI ── */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; position: relative; transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast); }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 32px; letter-spacing: -0.02em; margin-top: 10px; font-weight: 400; }
.kpi-value sub { font-size: 14px; color: var(--muted); margin-left: 4px; vertical-align: baseline; }
.kpi-trend { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; }
.trend-chip { font-size: 11.5px; font-weight: 500; padding: 3px 8px; border-radius: 99px; }
.trend-chip.up { background: #e6f1ea; color: var(--green); }
.trend-chip.down { background: #fbeaea; color: var(--red); }
.trend-chip.flat { background: #f0ede6; color: var(--ink-2); }
.spark { height: 28px; width: 80px; }

/* ── Two column layout ── */
.two-col { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; }

/* ── Section card ── */
.section { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.section-head h3 { font-size: 16px; font-weight: 500; letter-spacing: -0.01em; }
.section-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Segmented Control ── */
.seg { display: inline-flex; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.seg .opt { font-size: 12px; padding: 5px 11px; border-radius: 7px; color: var(--muted); cursor: pointer; transition: all var(--duration-fast); border: none; background: none; font-family: inherit; }
.seg .opt.active { background: white; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.seg .opt:hover:not(.active) { color: var(--ink); }

/* ── Activity Rows ── */
.act-row { display: grid; grid-template-columns: 2.4fr 1.2fr 0.9fr 0.9fr; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-2); transition: background var(--duration-fast); }
.act-row:last-child { border-bottom: none; padding-bottom: 0; }
.act-row:hover { background: var(--line-2); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 10px; }
.act-name { display: flex; align-items: center; gap: 12px; }
.act-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--warm); display: flex; align-items: center; justify-content: center; font-family: 'Instrument Serif', serif; font-style: italic; font-size: 17px; color: var(--ink); flex-shrink: 0; }
.act-icon.v2 { background: #e8e3ff; color: var(--accent); }
.act-icon.v3 { background: #ffe7d4; color: #b07b1a; }
.act-icon.v4 { background: #d8ecdf; color: var(--green); }
.act-icon.v5 { background: #f4dada; color: var(--red); }
.act-title { font-size: 13.5px; font-weight: 500; }
.act-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.act-score { display: flex; align-items: center; gap: 10px; }
.score-num { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; min-width: 40px; }
.mini-bar { flex: 1; height: 5px; background: var(--line-2); border-radius: 99px; overflow: hidden; max-width: 110px; }
.mini-bar div { height: 100%; border-radius: 99px; }
.s-good { background: var(--green); }
.s-mid { background: var(--amber); }
.s-low { background: var(--red); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; padding: 4px 10px; border-radius: 99px; font-weight: 500; }
.status-pill.pass { background: #e6f1ea; color: var(--green); }
.status-pill.review { background: #faf1de; color: var(--amber); }
.status-pill.fail { background: #fbeaea; color: var(--red); }
.status-pill.active { background: #e6f1ea; color: var(--green); }
.status-pill.inactive { background: var(--line-2); color: var(--muted); }
.status-pill.connected { background: #e6f1ea; color: var(--green); }
.status-pill.disconnected { background: #fbeaea; color: var(--red); }
.status-pill.error { background: #faf1de; color: var(--amber); }
.act-date { font-size: 12px; color: var(--muted); text-align: right; }

/* ── Streak ── */
.streak { background: linear-gradient(170deg, #fff8eb 0%, var(--surface) 60%); border: 1px solid var(--line); border-radius: 22px; padding: 22px; }
.streak-eyebrow { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.streak-num { font-size: 56px; letter-spacing: -0.03em; font-weight: 400; margin-top: 4px; line-height: 1; font-family: 'Instrument Serif', serif; }
.streak-num em { color: var(--accent); font-style: italic; }
.streak-num sub { font-size: 16px; color: var(--muted); margin-left: 6px; vertical-align: baseline; font-family: 'Inter', sans-serif; }
.streak-cap { font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.week-dots { display: flex; gap: 8px; margin-top: 18px; }
.wd { flex: 1; text-align: center; }
.wd-day { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.wd-pill { height: 36px; border-radius: 10px; background: var(--line-2); display: flex; align-items: center; justify-content: center; }
.wd-pill.done { background: var(--ink); }
.wd-pill.done svg { color: white; }
.wd-pill.today { background: white; border: 1.5px dashed var(--accent); color: var(--accent); font-size: 11px; font-weight: 500; }

/* ── Right column ── */
.right-col { display: flex; flex-direction: column; gap: 18px; }

/* ── Recommendations ── */
.rec-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-2); cursor: pointer; transition: background var(--duration-fast); }
.rec-item:last-child { border-bottom: none; padding-bottom: 0; }
.rec-item:first-child { padding-top: 0; }
.rec-item:hover { background: var(--line-2); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 10px; }
.rec-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: 'Instrument Serif', serif; font-size: 18px; font-style: italic; }
.rec-content { flex: 1; }
.rec-title-row { display: flex; justify-content: space-between; align-items: flex-start; }
.rec-title { font-size: 13.5px; font-weight: 500; }
.rec-priority { font-size: 10.5px; font-weight: 500; padding: 2px 7px; border-radius: 99px; }
.rec-priority.high { background: #fbeaea; color: var(--red); }
.rec-priority.med, .rec-priority.medium { background: #faf1de; color: var(--amber); }
.rec-priority.low { background: var(--line-2); color: var(--muted); }
.rec-meta { font-size: 11.5px; color: var(--muted); margin: 3px 0 6px; }
.rec-arrow { font-size: 12px; color: var(--accent); font-weight: 500; }

.section-footer { padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; }
.section-footer a { color: var(--accent); font-weight: 500; text-decoration: none; }
.section-footer a:hover { text-decoration: underline; }

/* ── Footer ── */
.footer { padding: 24px 36px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: auto; }
.footer a { color: var(--muted); text-decoration: none; margin-left: 18px; }
.footer a:hover { color: var(--ink); }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column-reverse; gap: 8px; }
.toast { padding: 14px 20px; border-radius: 12px; font-size: 13.5px; font-weight: 500; color: white; display: flex; align-items: center; gap: 10px; animation: slideUp var(--duration-normal) var(--ease-out); box-shadow: 0 8px 24px rgba(0,0,0,0.15); min-width: 280px; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--ink); }
.toast.exiting { animation: slideDown var(--duration-fast) var(--ease-out) forwards; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000; display: flex; align-items: center; justify-content: center; animation: fadeIn var(--duration-fast); }
.modal { background: var(--surface); border-radius: 18px; padding: 28px; max-width: 520px; width: 90%; box-shadow: 0 24px 48px rgba(0,0,0,0.15); animation: scaleIn var(--duration-normal) var(--ease-out); }
.modal h3 { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.modal p { font-size: 14px; color: var(--ink-2); line-height: 1.6; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── Dropdown ── */
.dropdown-panel { position: absolute; top: calc(100% + 4px); left: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,0.1); z-index: 100; display: none; min-width: 180px; }
.dropdown-panel.open { display: block; animation: fadeIn var(--duration-fast); }
.dropdown-option { padding: 8px 12px; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--ink-2); transition: background var(--duration-fast); }
.dropdown-option:hover { background: var(--bg); color: var(--ink); }
.dropdown-option.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.dropdown-trigger { position: relative; }

/* ── Form elements ── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-input { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 10px 14px; font-size: 13.5px; font-family: inherit; color: var(--ink); outline: none; transition: border-color var(--duration-fast); }
.form-input:focus { border-color: var(--accent); }
.form-input.error { border-color: var(--red); }
.form-error { font-size: 11.5px; color: var(--red); margin-top: 4px; }
.form-input:disabled { background: var(--line-2); color: var(--muted); cursor: not-allowed; }
textarea.form-input { min-height: 120px; resize: vertical; }

/* ── Form Select ── */
.form-select-wrap { position: relative; }
.form-select-trigger { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 10px 36px 10px 14px; font-size: 13.5px; font-family: inherit; color: var(--ink); outline: none; cursor: pointer; text-align: left; transition: border-color var(--duration-fast); display: flex; align-items: center; }
.form-select-trigger:focus { border-color: var(--accent); }
.form-select-trigger.error { border-color: var(--red); }
.form-select-trigger.placeholder { color: var(--muted); }
.form-select-trigger.disabled { background: var(--line-2); color: var(--muted); cursor: not-allowed; pointer-events: none; }
.form-select-trigger::after { content: ''; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--muted); }
.form-select-panel { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,0.1); z-index: 100; display: none; max-height: 220px; overflow-y: auto; }
.form-select-panel.open { display: block; animation: fadeIn var(--duration-fast); }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { font-size: 11.5px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th .sort-icon { display: inline-block; margin-left: 4px; font-size: 10px; }
td { padding: 12px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
tr:hover td { background: var(--line-2); }
tr:last-child td { border-bottom: none; }

/* ── Pagination ── */
.pagination { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--line-2); }
.pagination-info { font-size: 12px; color: var(--muted); }
.pagination-btns { display: flex; gap: 4px; }
.pagination-btns button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 500; color: var(--ink-2); display: flex; align-items: center; justify-content: center; transition: background var(--duration-fast); }
.pagination-btns button:hover { background: var(--bg); }
.pagination-btns button.active { background: var(--ink); color: white; border-color: var(--ink); }
.pagination-btns button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab { padding: 12px 20px; font-size: 13.5px; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; transition: color var(--duration-fast), border-color var(--duration-fast); background: none; border-top: none; border-left: none; border-right: none; font-family: inherit; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* ── Toggle switch ── */
.toggle { width: 40px; height: 22px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; border: none; transition: background var(--duration-fast); }
.toggle::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.1); transition: transform var(--duration-fast); }
.toggle.on { background: var(--green); }
.toggle.on::after { transform: translateX(18px); }

/* ── Empty state ── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; text-align: center; }
.empty-state-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--line-2); display: flex; align-items: center; justify-content: center; margin-bottom: 18px; color: var(--muted); }
.empty-state h4 { font-size: 16px; font-weight: 500; margin-bottom: 8px; }
.empty-state p { font-size: 13.5px; color: var(--muted); max-width: 360px; margin-bottom: 18px; }

/* ── Loading / Spinner ── */
.spinner { width: 20px; height: 20px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; display: inline-block; }
.spinner.white { border-color: rgba(255,255,255,0.3); border-top-color: white; }
.loading-overlay { position: absolute; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 5; border-radius: 22px; }
.loading-overlay .spinner { width: 40px; height: 40px; border-width: 3px; margin-bottom: 18px; }
.loading-overlay p { font-size: 14px; color: var(--muted); }

/* ── Login ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 40px; }
.login-container { width: 100%; max-width: 560px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 36px; justify-content: center; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 36px; }
.login-card h2 { font-size: 24px; font-weight: 500; margin-bottom: 8px; letter-spacing: -0.01em; }
.login-card .sub { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.user-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 28px; }
.user-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; transition: all var(--duration-fast) var(--ease-out); }
.user-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.user-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.user-card .uc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.user-card .uc-name { font-size: 13.5px; font-weight: 500; }
.user-card .uc-role { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: var(--line-2); color: var(--muted); font-weight: 500; text-transform: capitalize; }
.user-card .uc-role.admin { background: var(--amber-soft); color: var(--amber); }
.user-card .uc-detail { font-size: 11.5px; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* ── Profile Setup ── */
.setup-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 40px; }
.setup-container { width: 100%; max-width: 520px; }

/* ── Quiz Taking ── */
.quiz-page { position: relative; }
.quiz-progress-bar { height: 4px; background: var(--line-2); border-radius: 99px; margin-bottom: 24px; overflow: hidden; }
.quiz-progress-bar .fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width var(--duration-normal) var(--ease-out); }
.quiz-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.quiz-counter { font-size: 13px; color: var(--muted); font-weight: 500; }
.quiz-timer { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.quiz-question { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; margin-bottom: 24px; line-height: 1.4; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 32px; }
.quiz-option { border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; cursor: pointer; font-size: 14px; transition: all var(--duration-fast) var(--ease-out); display: flex; align-items: center; gap: 14px; }
.quiz-option:hover { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); }
.quiz-option.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.quiz-option.correct { border-color: var(--green); background: var(--green-soft); }
.quiz-option.incorrect { border-color: var(--red); background: var(--red-soft); }
.quiz-option .opt-letter { width: 28px; height: 28px; border-radius: 8px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.quiz-option.selected .opt-letter { background: var(--accent); color: white; }
.quiz-option.correct .opt-letter { background: var(--green); color: white; }
.quiz-option.incorrect .opt-letter { background: var(--red); color: white; }
.quiz-nav { display: flex; justify-content: space-between; }

/* Quiz results */
.result-score { text-align: center; padding: 36px 0; }
.result-score .big-score { font-size: 72px; font-weight: 400; letter-spacing: -0.03em; font-family: 'Instrument Serif', serif; }
.result-score .big-score em { color: var(--accent); font-style: italic; }
.result-breakdown { margin-top: 24px; }
.result-item { display: flex; align-items: flex-start; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.result-item:last-child { border-bottom: none; }
.result-indicator { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.result-indicator.correct { background: var(--green-soft); color: var(--green); }
.result-indicator.incorrect { background: var(--red-soft); color: var(--red); }
.result-q-text { font-size: 13.5px; font-weight: 500; margin-bottom: 4px; }
.result-answer { font-size: 12px; color: var(--muted); }
.result-answer .right { color: var(--green); font-weight: 500; }

/* ── Progress Dashboard ── */
.chart-container { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 24px; margin-bottom: 18px; }
.topic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.topic-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast); }
.topic-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.topic-card .tc-name { font-size: 13.5px; font-weight: 500; margin-bottom: 8px; }
.topic-card .tc-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.mastered-badge { font-size: 10.5px; font-weight: 500; padding: 2px 7px; border-radius: 99px; background: var(--green-soft); color: var(--green); }
.score-dist { display: flex; align-items: flex-end; gap: 12px; height: 120px; padding: 0 20px; }
.score-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.score-bar { width: 100%; border-radius: 6px 6px 0 0; transition: height var(--duration-slow) var(--ease-out); }
.score-bar-label { font-size: 11px; color: var(--muted); }
.score-bar-value { font-size: 12px; font-weight: 500; }

/* ── Admin ── */
.admin-page .section { margin-bottom: 18px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-header h2 { font-size: 24px; font-weight: 500; letter-spacing: -0.01em; }
.service-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.service-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 24px; }
.service-card h4 { font-size: 16px; font-weight: 500; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.metric-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.metric-card { background: var(--bg); border-radius: 12px; padding: 14px; }
.metric-card .mc-label { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.metric-card .mc-value { font-size: 22px; font-weight: 500; margin-top: 4px; letter-spacing: -0.01em; }

/* ── Filter toolbar ── */
.filter-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: 12.5px; color: var(--ink-2); cursor: pointer; position: relative; font-family: inherit; transition: border-color var(--duration-fast); }
.filter-btn:hover { border-color: var(--accent); }
.filter-btn svg { width: 14px; height: 14px; }

/* ── Checkbox ── */
.checkbox-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.checkbox { width: 18px; height: 18px; border: 1.5px solid var(--line); border-radius: 5px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all var(--duration-fast); }
.checkbox.checked { background: var(--accent); border-color: var(--accent); }
.checkbox.checked svg { color: white; }

/* ── Inline warning ── */
.inline-warning { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; background: var(--amber-soft); border-radius: 10px; border: 1px solid rgba(176,123,26,0.2); font-size: 13px; color: var(--amber); margin-bottom: 16px; }
.inline-warning svg { flex-shrink: 0; margin-top: 2px; }

/* ── Password field ── */
.password-field { position: relative; }
.password-field input { padding-right: 42px; }
.password-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; display: flex; align-items: center; }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(12px); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

.fade-in { animation: fadeIn var(--duration-normal) var(--ease-out) both; }
.slide-up { animation: slideUp var(--duration-normal) var(--ease-out) both; }
.scale-in { animation: scaleIn var(--duration-normal) var(--ease-out) both; }

.stagger-1 { animation-delay: 50ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; }
.stagger-5 { animation-delay: 250ms; }

/* ── Notification cards ── */
.notification-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 12px; color: var(--muted); }
.notification-item:last-child { border-bottom: none; }
.notification-item svg { flex-shrink: 0; }

/* ── Rec full cards ── */
.rec-full-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-bottom: 12px; transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast); }
.rec-full-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.rec-full-card.acted { opacity: 0.6; }
.rec-full-card.expired { opacity: 0.5; border-style: dashed; }
.rec-full-card .rfc-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.rec-full-card .rfc-title { font-size: 15px; font-weight: 500; }
.rec-full-card .rfc-desc { font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.rec-full-card .rfc-meta { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.rec-full-card .rfc-meta span { display: flex; align-items: center; gap: 4px; }
.rec-full-card .rfc-action { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--accent); cursor: pointer; }
.rec-full-card .rfc-action:hover { text-decoration: underline; }

/* Ensure body doesn't scroll when modal is open */
body.modal-open { overflow: hidden; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
