/* =========================================================================
   StudyMetrics v2.0 — Student Operating System
   Premium app-shell design system (Light + Dark via :root[data-theme])
   Scoped to body.sm2 so calculator pages remain untouched.
   ========================================================================= */

body.sm2{
  /* ---- Light theme tokens ---- */
  --app-bg:#f6f5f2;
  --app-bg-2:#efede8;
  --panel:#ffffff;
  --panel-2:#fbfaf7;
  --card:#ffffff;
  --card-2:#faf9f5;
  --glass:rgba(255,255,255,.88);
  --glass-brd:rgba(20,18,14,.08);
  --border:rgba(23,20,16,.09);
  --border-2:rgba(23,20,16,.06);
  --ink:#1a1815;
  --ink-2:#5d5952;
  --ink-3:#8f8a80;
  --gold:#c39324;
  --gold-strong:#a97c14;
  --gold-soft:rgba(197,150,44,.13);
  --gold-line:rgba(197,150,44,.30);
  --ok:#2f9e5b; --ok-soft:rgba(47,158,91,.12);
  --info:#2f6fe0; --info-soft:rgba(47,111,224,.12);
  --violet:#7b61c9; --violet-soft:rgba(123,97,201,.12);
  --cta-bg:#1a1815; --cta-fg:#ffffff;
  --shadow-sm:0 1px 2px rgba(30,25,15,.04),0 2px 6px rgba(30,25,15,.05);
  --shadow:0 2px 8px rgba(30,25,15,.05),0 14px 34px rgba(30,25,15,.08);
  --shadow-lg:0 8px 24px rgba(30,25,15,.08),0 30px 60px rgba(30,25,15,.12);
  --hero-blob:radial-gradient(120% 120% at 70% 20%, rgba(210,170,70,.20), rgba(210,170,70,0) 60%);
  --spark-up:#2f9e5b; --spark-gold:#c8991f;

  --side-w:256px;
  --rx:14px; --rlg:18px; --rxl:22px; --rpill:999px;
  --ease:cubic-bezier(.22,1,.36,1);

  background:var(--app-bg);
  color:var(--ink);
  font-family:"Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif;
  -webkit-font-smoothing:antialiased;
  margin:0;
  letter-spacing:-.006em;
}
:root[data-theme="dark"] body.sm2{
  --app-bg:#08080a;
  --app-bg-2:#0d0d10;
  --panel:#0d0d11;
  --panel-2:#101014;
  --card:#141419;
  --card-2:#17171d;
  --glass:rgba(20,20,26,.82);
  --glass-brd:rgba(255,255,255,.09);
  --border:rgba(255,255,255,.08);
  --border-2:rgba(255,255,255,.05);
  --ink:#f4f3ef;
  --ink-2:#a5a29b;
  --ink-3:#6c6a64;
  --gold:#e6bd63;
  --gold-strong:#f0cd7d;
  --gold-soft:rgba(230,189,99,.12);
  --gold-line:rgba(230,189,99,.28);
  --ok:#4bc07f; --ok-soft:rgba(75,192,127,.14);
  --info:#5b95f5; --info-soft:rgba(91,149,245,.14);
  --violet:#a88ef0; --violet-soft:rgba(168,142,240,.15);
  --cta-bg:linear-gradient(180deg,#eec778,#e0b356); --cta-fg:#1a1509;
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  --shadow:0 2px 10px rgba(0,0,0,.5),0 18px 44px rgba(0,0,0,.5);
  --shadow-lg:0 10px 30px rgba(0,0,0,.55),0 40px 80px rgba(0,0,0,.6);
  --hero-blob:radial-gradient(120% 120% at 70% 15%, rgba(230,189,99,.16), rgba(230,189,99,0) 58%);
  --spark-up:#4bc07f; --spark-gold:#e6bd63;
}

body.sm2 *{box-sizing:border-box}
body.sm2 h1,body.sm2 h2,body.sm2 h3,body.sm2 h4{font-family:"Bricolage Grotesque","Inter",system-ui,sans-serif;letter-spacing:-.02em;margin:0}
body.sm2 a{color:inherit;text-decoration:none}
body.sm2 .skip-link{position:absolute;left:-999px}
body.sm2 ::selection{background:var(--gold-soft)}
body.sm2 svg{display:block}

/* ============================ APP SHELL ============================ */
.sm2-app{display:grid;grid-template-columns:var(--side-w) 1fr;min-height:100vh}

/* ---------------- SIDEBAR ---------------- */
.sm2-side{
  position:sticky;top:0;height:100vh;
  background:var(--panel);
  border-right:1px solid var(--border);
  display:flex;flex-direction:column;
  padding:18px 14px 14px;
  z-index:40;
}
.sm2-brand{display:flex;align-items:center;gap:10px;padding:6px 8px 18px;font-family:"Bricolage Grotesque",sans-serif;font-weight:700;font-size:19px;color:var(--ink)}
.sm2-logo{width:34px;height:34px;flex:none;border-radius:10px;display:grid;place-items:center;
  background:linear-gradient(150deg,#2a2a33,#0f0f14);box-shadow:0 2px 6px rgba(0,0,0,.25),inset 0 0 0 1px rgba(255,255,255,.06)}
:root[data-theme="dark"] .sm2-logo{background:linear-gradient(150deg,#20202a,#0a0a0e)}
.sm2-logo svg{width:20px;height:20px}
.sm2-nav{display:flex;flex-direction:column;gap:2px;overflow-y:auto;flex:1;margin:0 -4px;padding:0 4px}
.sm2-nav::-webkit-scrollbar{width:0}
.sm2-nav a{display:flex;align-items:center;gap:12px;padding:9px 11px;border-radius:11px;color:var(--ink-2);
  font-size:14px;font-weight:500;transition:background .15s,color .15s;position:relative}
.sm2-nav a svg{width:18px;height:18px;flex:none;stroke-width:1.9;opacity:.85}
.sm2-nav a:hover{background:var(--card-2);color:var(--ink)}
.sm2-nav a.active{background:var(--gold-soft);color:var(--ink);font-weight:600}
.sm2-nav a.active svg{color:var(--gold-strong);opacity:1}
.sm2-nav a.active::before{content:"";position:absolute;left:-14px;top:50%;transform:translateY(-50%);width:3px;height:18px;border-radius:3px;background:var(--gold)}
.sm2-badge{margin-left:auto;font-size:9px;font-weight:700;letter-spacing:.06em;color:var(--gold-strong);background:var(--gold-soft);border:1px solid var(--gold-line);padding:2px 6px;border-radius:6px}
.sm2-nav-sep{height:1px;background:var(--border-2);margin:8px 8px}

/* AI card in sidebar */
.sm2-side-ai{margin:12px 4px;padding:14px;border-radius:var(--rlg);background:linear-gradient(180deg,var(--card-2),var(--card));border:1px solid var(--border)}
.sm2-side-ai h4{font-size:13px;font-weight:700;display:flex;align-items:center;gap:6px;color:var(--ink)}
.sm2-side-ai p{font-size:11.5px;color:var(--ink-3);margin:6px 0 10px;line-height:1.45}
.sm2-side-ai .sm2-btn{width:100%;justify-content:center;font-size:12.5px;padding:8px}

/* sidebar footer profile */
.sm2-side-foot{margin-top:8px;padding-top:12px;border-top:1px solid var(--border-2);display:flex;align-items:center;gap:10px}
.sm2-side-foot img{width:30px;height:30px;border-radius:9px;object-fit:cover}
.sm2-side-foot .nm{font-size:13px;font-weight:600;color:var(--ink);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sm2-icon-btn{width:30px;height:30px;border-radius:9px;border:1px solid transparent;background:transparent;color:var(--ink-3);display:grid;place-items:center;cursor:pointer;transition:.15s}
.sm2-icon-btn:hover{background:var(--card-2);color:var(--ink);border-color:var(--border)}
.sm2-icon-btn svg{width:17px;height:17px}

/* ---------------- MAIN ---------------- */
.sm2-main{min-width:0;display:flex;flex-direction:column}

/* topbar */
.sm2-top{position:sticky;top:0;z-index:30;display:flex;align-items:center;gap:16px;
  padding:14px 26px;background:var(--glass);backdrop-filter:saturate(160%) blur(16px);-webkit-backdrop-filter:saturate(160%) blur(16px);
  border-bottom:1px solid var(--border)}
.sm2-search{flex:1;max-width:440px;position:relative}
.sm2-search svg.s{position:absolute;left:13px;top:50%;transform:translateY(-50%);width:17px;height:17px;color:var(--ink-3)}
.sm2-search input{width:100%;height:40px;border-radius:12px;border:1px solid var(--border);background:var(--card-2);
  padding:0 44px 0 38px;font-size:13.5px;color:var(--ink);font-family:inherit;transition:.15s}
.sm2-search input::placeholder{color:var(--ink-3)}
.sm2-search input:focus{outline:none;border-color:var(--gold-line);background:var(--panel);box-shadow:0 0 0 4px var(--gold-soft)}
.sm2-kbd{position:absolute;right:10px;top:50%;transform:translateY(-50%);font-size:11px;color:var(--ink-3);border:1px solid var(--border);border-radius:6px;padding:2px 6px;background:var(--panel)}
.sm2-top-nav{display:flex;align-items:center;gap:4px;margin-left:auto}
.sm2-top-nav a{padding:8px 12px;border-radius:9px;font-size:13.5px;font-weight:500;color:var(--ink-2);transition:.15s}
.sm2-top-nav a:hover{background:var(--card-2);color:var(--ink)}
.sm2-top-tools{display:flex;align-items:center;gap:8px}
.sm2-avatar{width:34px;height:34px;border-radius:10px;object-fit:cover;border:1px solid var(--border)}
.sm2-dot{position:absolute;top:6px;right:6px;width:7px;height:7px;border-radius:50%;background:var(--gold);border:2px solid var(--panel)}

/* content wrapper */
.sm2-content{padding:24px 26px 120px;max-width:1320px;width:100%;margin:0 auto}
@media(min-width:1500px){.sm2-content{padding-left:40px;padding-right:40px}}

/* ============================ BUTTONS ============================ */
.sm2-btn{display:inline-flex;align-items:center;gap:8px;font-family:inherit;font-size:13.5px;font-weight:600;
  padding:10px 16px;border-radius:11px;border:1px solid transparent;cursor:pointer;transition:transform .12s var(--ease),box-shadow .15s,background .15s;white-space:nowrap}
.sm2-btn:active{transform:translateY(1px)}
.sm2-btn svg{width:16px;height:16px}
.sm2-btn-primary{background:var(--cta-bg);color:var(--cta-fg);box-shadow:var(--shadow-sm)}
.sm2-btn-primary:hover{box-shadow:var(--shadow)}
.sm2-btn-gold{background:linear-gradient(180deg,var(--gold),var(--gold-strong));color:#1a1509;box-shadow:0 4px 14px rgba(197,150,44,.3)}
.sm2-btn-gold:hover{filter:brightness(1.04)}
.sm2-btn-ghost{background:var(--card);color:var(--ink);border-color:var(--border)}
.sm2-btn-ghost:hover{background:var(--card-2);border-color:var(--gold-line)}
/* override body.sm2 a{color:inherit} specificity for buttons */
body.sm2 a.sm2-btn-primary,body.sm2 .sm2-btn-primary{color:var(--cta-fg)}
body.sm2 a.sm2-btn-gold,body.sm2 .sm2-btn-gold{color:#1a1509}
body.sm2 a.sm2-btn-ghost,body.sm2 .sm2-btn-ghost{color:var(--ink)}
body.sm2 #db-welcome{display:none}

/* ============================ CARDS / SECTIONS ============================ */
.sm2-card{background:var(--card);border:1px solid var(--border);border-radius:var(--rxl);box-shadow:var(--shadow-sm)}
.sm2-sec-head{display:flex;align-items:center;justify-content:space-between;margin:34px 2px 16px}
.sm2-sec-head h2{font-size:20px;font-weight:700;color:var(--ink)}
.sm2-link{font-size:13px;font-weight:600;color:var(--gold-strong);display:inline-flex;align-items:center;gap:5px}
.sm2-link svg{width:14px;height:14px}
.sm2-link:hover{gap:8px}

/* ============================ HERO ============================ */
.sm2-hero{position:relative;display:grid;grid-template-columns:1.05fr 1fr;gap:24px;align-items:center;
  padding:30px 34px;border-radius:26px;overflow:hidden;background:var(--panel);border:1px solid var(--border);box-shadow:var(--shadow)}
.sm2-hero::before{content:"";position:absolute;inset:0;background:var(--hero-blob);pointer-events:none}
.sm2-hero-l{position:relative;z-index:2;max-width:440px}
.sm2-hero h1{font-size:clamp(30px,3.4vw,46px);line-height:1.02;font-weight:700;color:var(--ink)}
.sm2-hero h1 .g{color:var(--gold-strong)}
.sm2-hero p{color:var(--ink-2);font-size:14.5px;line-height:1.55;margin:14px 0 22px;max-width:370px}
.sm2-hero-cta{display:flex;gap:10px;flex-wrap:wrap}
.sm2-pop{margin-top:22px}
.sm2-pop-lbl{font-size:12px;font-weight:600;color:var(--ink-3);margin-bottom:9px}
.sm2-chips{display:flex;flex-wrap:wrap;gap:8px}
.sm2-chip{font-size:12.5px;font-weight:500;color:var(--ink-2);padding:6px 13px;border-radius:var(--rpill);background:var(--card-2);border:1px solid var(--border);transition:.15s}
.sm2-chip:hover{border-color:var(--gold-line);color:var(--gold-strong);background:var(--gold-soft)}
.sm2-hero-r{position:relative;z-index:2;min-height:250px}

/* floating stat cards in hero */
.sm2-statcards{position:relative;height:100%;min-height:250px}
.sm2-statcard{position:absolute;background:var(--glass);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);
  border:1px solid var(--glass-brd);border-radius:var(--rlg);padding:14px 16px;box-shadow:var(--shadow-lg)}
.sm2-statcard.big{top:0;right:0;width:min(58%,260px);z-index:3}
.sm2-statcard.mid{bottom:0;left:0;width:min(44%,150px);z-index:4}
.sm2-statcard.mid2{bottom:0;right:0;width:min(44%,150px);z-index:4}
.sm2-sc-top{display:flex;align-items:center;justify-content:space-between;font-size:11px;font-weight:600;color:var(--ink-3);text-transform:uppercase;letter-spacing:.05em}
.sm2-sc-val{font-family:"Bricolage Grotesque",sans-serif;font-weight:700;color:var(--ink);line-height:1}
.sm2-statcard.big .sm2-sc-val{font-size:44px;margin:6px 0 2px}
.sm2-statcard.mid .sm2-sc-val,.sm2-statcard.mid2 .sm2-sc-val{font-size:26px;margin:4px 0 2px}
.sm2-sc-label{font-size:12px;color:var(--ink-2);font-weight:500}
.sm2-sc-delta{font-size:11.5px;font-weight:600;color:var(--ok);display:inline-flex;align-items:center;gap:3px;margin-top:4px}
.sm2-hero-illu{position:absolute;bottom:-22px;left:52%;transform:translateX(-50%);width:66%;max-width:300px;z-index:1;pointer-events:none;filter:drop-shadow(0 20px 24px rgba(20,16,8,.20))}

/* ============================ TOOLS GRID ============================ */
.sm2-tools{display:grid;grid-template-columns:repeat(5,1fr);gap:14px}
.sm2-tool{display:flex;flex-direction:column;gap:0;padding:18px;border-radius:var(--rlg);background:var(--card);
  border:1px solid var(--border);box-shadow:var(--shadow-sm);transition:transform .18s var(--ease),box-shadow .18s,border-color .18s}
.sm2-tool:hover{transform:translateY(-3px);box-shadow:var(--shadow);border-color:var(--gold-line)}
.sm2-tool-ico{width:44px;height:44px;border-radius:13px;display:grid;place-items:center;margin-bottom:14px}
.sm2-tool-ico svg{width:22px;height:22px;stroke-width:1.9}
.ico-gold{background:var(--gold-soft);color:var(--gold-strong)}
.ico-info{background:var(--info-soft);color:var(--info)}
.ico-violet{background:var(--violet-soft);color:var(--violet)}
.ico-ok{background:var(--ok-soft);color:var(--ok)}
.ico-ink{background:var(--card-2);color:var(--ink)}
.sm2-tool h3{font-size:14.5px;font-weight:600;color:var(--ink);margin-bottom:5px}
.sm2-tool p{font-size:12px;color:var(--ink-3);line-height:1.45}

/* ============================ STATS BAR ============================ */
.sm2-stats{display:grid;grid-template-columns:repeat(5,1fr);gap:0;padding:22px 8px;margin-top:16px;
  background:var(--card);border:1px solid var(--border);border-radius:var(--rxl);box-shadow:var(--shadow-sm)}
.sm2-stat{text-align:center;padding:0 12px;position:relative}
.sm2-stat+.sm2-stat::before{content:"";position:absolute;left:0;top:50%;transform:translateY(-50%);height:36px;width:1px;background:var(--border)}
.sm2-stat .n{font-family:"Bricolage Grotesque",sans-serif;font-size:24px;font-weight:700;color:var(--ink);display:flex;align-items:center;justify-content:center;gap:6px}
.sm2-stat .n svg{width:16px;height:16px;color:var(--gold-strong)}
.sm2-stat .l{font-size:12px;color:var(--ink-3);margin-top:3px;line-height:1.3}

/* ============================ BOTTOM PANELS ============================ */
.sm2-panels{display:grid;grid-template-columns:1fr 1fr 1fr;gap:14px;margin-top:16px}
.sm2-panel{padding:18px 18px;border-radius:var(--rxl)}
.sm2-panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
.sm2-panel-head h3{font-size:15px;font-weight:700;color:var(--ink)}
.sm2-pill-badge{font-size:9.5px;font-weight:700;letter-spacing:.06em;color:var(--info);background:var(--info-soft);padding:2px 7px;border-radius:6px}

/* recently used list */
.sm2-rec{display:flex;flex-direction:column;gap:2px}
.sm2-rec a{display:flex;align-items:center;gap:11px;padding:9px 8px;border-radius:11px;transition:background .14s}
.sm2-rec a:hover{background:var(--card-2)}
.sm2-rec-ico{width:26px;height:26px;border-radius:8px;display:grid;place-items:center;flex:none}
.sm2-rec-ico svg{width:15px;height:15px}
.sm2-rec .nm{font-size:13px;font-weight:500;color:var(--ink);flex:1}
.sm2-rec .tm{font-size:11.5px;color:var(--ink-3)}
.sm2-rec-foot{margin-top:12px;font-size:12.5px;font-weight:600;color:var(--gold-strong);display:inline-flex;align-items:center;gap:5px}

/* study streak */
.sm2-streak-num{display:flex;align-items:baseline;gap:8px}
.sm2-streak-num .d{font-family:"Bricolage Grotesque",sans-serif;font-size:52px;font-weight:700;color:var(--ink);line-height:1}
.sm2-streak-num .u{font-size:15px;color:var(--ink-2);font-weight:500}
.sm2-flame{width:40px;height:40px;margin-left:auto}
.sm2-streak-copy{font-size:12.5px;color:var(--ink-2);line-height:1.45;margin:10px 0 14px}
.sm2-week{display:flex;justify-content:space-between;gap:6px}
.sm2-day{flex:1;text-align:center}
.sm2-day .dl{font-size:10px;color:var(--ink-3);margin-bottom:6px;font-weight:600}
.sm2-day .dc{width:26px;height:26px;border-radius:50%;margin:0 auto;display:grid;place-items:center;background:var(--card-2);color:var(--ink-3)}
.sm2-day .dc svg{width:14px;height:14px}
.sm2-day.on .dc{background:var(--gold);color:#1a1509}
.sm2-day.off .dc{opacity:.5}

/* ai tutor panel */
.sm2-ai-copy{font-size:13px;color:var(--ink-2);line-height:1.5;margin-bottom:14px}
.sm2-ai-input{position:relative;margin-bottom:12px}
.sm2-ai-input input{width:100%;height:42px;border-radius:12px;border:1px solid var(--border);background:var(--card-2);padding:0 44px 0 14px;font-size:13px;color:var(--ink);font-family:inherit}
.sm2-ai-input input:focus{outline:none;border-color:var(--gold-line);box-shadow:0 0 0 4px var(--gold-soft)}
.sm2-ai-send{position:absolute;right:6px;top:50%;transform:translateY(-50%);width:32px;height:32px;border-radius:9px;border:none;background:var(--gold);color:#1a1509;display:grid;place-items:center;cursor:pointer}
.sm2-ai-send svg{width:16px;height:16px}
.sm2-ai-pop{font-size:12px;color:var(--ink-3)}
.sm2-ai-pop a{color:var(--gold-strong);font-weight:600}

/* ============================ PREMIUM BANNER ============================ */
.sm2-premium{margin-top:16px;display:flex;align-items:center;gap:18px;padding:22px 26px;border-radius:var(--rxl);position:relative;overflow:hidden;
  background:linear-gradient(100deg,#141210 0%,#20190d 55%,#3a2c12 100%);border:1px solid rgba(230,189,99,.25)}
.sm2-premium::after{content:"";position:absolute;right:0;top:0;bottom:0;width:55%;
  background:repeating-linear-gradient(115deg,transparent,transparent 22px,rgba(230,189,99,.05) 22px,rgba(230,189,99,.05) 23px);pointer-events:none}
.sm2-premium-ico{width:46px;height:46px;border-radius:13px;display:grid;place-items:center;background:rgba(230,189,99,.14);color:var(--gold);flex:none}
.sm2-premium-ico svg{width:24px;height:24px}
.sm2-premium-txt{flex:1;position:relative;z-index:2}
.sm2-premium-txt h3{font-size:17px;font-weight:700;color:#f2d99a}
.sm2-premium-txt p{font-size:13px;color:rgba(242,231,210,.7);margin-top:3px}
.sm2-premium .sm2-btn{position:relative;z-index:2}

/* ============================ EMPTY STATE ============================ */
.sm2-empty{text-align:center;padding:26px 16px;color:var(--ink-3)}
.sm2-empty svg{width:38px;height:38px;margin:0 auto 10px;color:var(--ink-3);opacity:.6}
.sm2-empty p{font-size:12.5px}

/* ============================ REVEAL ANIM ============================ */
/* Safety: sm2-rev elements are ALWAYS pointer-interactive regardless of animation state */
.sm2-rev{pointer-events:auto}
@media (prefers-reduced-motion:no-preference){
  .sm2-rev{opacity:0;transform:translateY(14px);animation:sm2up .6s var(--ease) both}
  @keyframes sm2up{to{opacity:1;transform:none}}
  .sm2-rev.d1{animation-delay:.05s}.sm2-rev.d2{animation-delay:.12s}.sm2-rev.d3{animation-delay:.19s}
  .sm2-rev.d4{animation-delay:.26s}.sm2-rev.d5{animation-delay:.33s}
}

/* ============================ MOBILE BOTTOM NAV ============================ */
.sm2-bottomnav{display:none}
.sm2-hamburger{display:none}

/* ============================ RESPONSIVE ============================ */
@media(max-width:1180px){
  .sm2-tools{grid-template-columns:repeat(3,1fr)}
  .sm2-top-nav{display:none}
  .sm2-top-tools{margin-left:auto}
}
@media(max-width:980px){
  .sm2-app{grid-template-columns:1fr}
  .sm2-side{position:fixed;left:0;top:0;width:280px;transform:translateX(-100%);transition:transform .28s var(--ease);box-shadow:var(--shadow-lg)}
  body.sm2.nav-open .sm2-side{transform:none}
  .sm2-scrim{position:fixed;inset:0;background:rgba(0,0,0,.4);opacity:0;visibility:hidden;transition:.25s;z-index:39}
  body.sm2.nav-open .sm2-scrim{opacity:1;visibility:visible}
  .sm2-hamburger{display:grid}
  .sm2-hero{grid-template-columns:1fr}
  .sm2-hero-r{min-height:230px;margin-top:8px}
  .sm2-panels{grid-template-columns:1fr}
  .sm2-stats{grid-template-columns:repeat(3,1fr);gap:18px 0;padding:20px 8px}
  .sm2-stat:nth-child(1)::before,.sm2-stat:nth-child(4)::before{display:none}
}
@media(max-width:640px){
  .sm2-content{padding:16px 14px 96px}
  .sm2-top{padding:12px 14px;gap:10px}
  .sm2-top-tools .sm2-avatar{display:none}
  .sm2-search{max-width:none}
  .sm2-kbd{display:none}
  .sm2-tools{grid-template-columns:1fr 1fr}
  .sm2-tool{padding:13px 12px}
  .sm2-tool h3{font-size:13px}
  .sm2-tool p{font-size:11px}
  .sm2-tool-ico{width:36px;height:36px;margin-bottom:10px}
  .sm2-stats{grid-template-columns:1fr 1fr}
  .sm2-stat::before{display:none!important}
  .sm2-hero{padding:22px 18px}
  .sm2-hero h1{font-size:clamp(24px,7vw,38px)}
  .sm2-premium{flex-wrap:wrap}
  .sm2-premium .sm2-btn{width:100%;justify-content:center}
  .sm2-bottomnav{display:flex;position:fixed;bottom:0;left:0;right:0;z-index:50;
    background:var(--glass);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);border-top:1px solid var(--border);
    padding:8px 6px calc(8px + env(safe-area-inset-bottom))}
  .sm2-bottomnav a{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;font-size:10.5px;font-weight:600;color:var(--ink-3);padding:4px}
  .sm2-bottomnav a svg{width:21px;height:21px;stroke-width:2}
  .sm2-bottomnav a.active{color:var(--gold-strong)}
  .sm2-bottomnav a.ai .b{width:40px;height:40px;border-radius:13px;background:linear-gradient(180deg,var(--gold),var(--gold-strong));display:grid;place-items:center;margin-top:-18px;box-shadow:0 6px 16px rgba(197,150,44,.4)}
  .sm2-bottomnav a.ai .b svg{color:#1a1509}
}

/* ============================ DASHBOARD ============================ */
.sm2-page-head{margin-bottom:20px}
.sm2-page-head h1{font-size:26px;font-weight:700;color:var(--ink)}
.sm2-page-head p{color:var(--ink-2);font-size:14px;margin-top:4px}
.sm2-grid{display:grid;gap:14px}
.sm2-g4{grid-template-columns:repeat(4,1fr)}
.sm2-g3{grid-template-columns:repeat(3,1fr)}
.sm2-g2{grid-template-columns:repeat(2,1fr)}
.sm2-metric{padding:18px;border-radius:var(--rxl)}
.sm2-metric .top{display:flex;align-items:center;justify-content:space-between;color:var(--ink-3);font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.04em}
.sm2-metric .top .mi{width:32px;height:32px;border-radius:10px;display:grid;place-items:center}
.sm2-metric .mv{font-family:"Bricolage Grotesque",sans-serif;font-size:38px;font-weight:700;color:var(--ink);line-height:1;margin:12px 0 4px}
.sm2-metric .ms{font-size:12.5px;color:var(--ink-2)}
.sm2-metric .md{font-size:12px;font-weight:600;margin-top:8px;display:inline-flex;align-items:center;gap:4px}
.sm2-progress{height:7px;border-radius:6px;background:var(--card-2);overflow:hidden;margin-top:12px}
.sm2-progress i{display:block;height:100%;border-radius:6px;background:linear-gradient(90deg,var(--gold),var(--gold-strong))}
@media(max-width:980px){.sm2-g4{grid-template-columns:1fr 1fr}.sm2-g3{grid-template-columns:1fr}.sm2-g2{grid-template-columns:1fr}.sm2-trend-grid{grid-template-columns:1fr!important}}
@media(max-width:640px){.sm2-g4{grid-template-columns:1fr}}

/* calendar mini */
.sm2-cal{display:grid;grid-template-columns:repeat(7,1fr);gap:5px;margin-top:6px}
.sm2-cal .cd{aspect-ratio:1;border-radius:9px;display:grid;place-items:center;font-size:12px;color:var(--ink-2);background:var(--card-2)}
.sm2-cal .cd.hd{background:var(--gold-soft);color:var(--gold-strong);font-weight:700;position:relative}
.sm2-cal .cd.hd::after{content:"";position:absolute;bottom:4px;width:4px;height:4px;border-radius:50%;background:var(--gold)}
.sm2-cal .cd.mut{color:var(--ink-3);opacity:.5;background:transparent}
.sm2-cal-head{display:grid;grid-template-columns:repeat(7,1fr);gap:5px;font-size:10px;color:var(--ink-3);text-align:center;font-weight:600;margin-bottom:6px}

/* list rows (deadlines / activity) */
.sm2-list{display:flex;flex-direction:column;gap:2px}
.sm2-list-row{display:flex;align-items:center;gap:12px;padding:10px 8px;border-radius:11px;transition:background .14s}
.sm2-list-row:hover{background:var(--card-2)}
.sm2-list-ico{width:32px;height:32px;border-radius:10px;display:grid;place-items:center;flex:none}
.sm2-list-ico svg{width:16px;height:16px}
.sm2-list-body{flex:1;min-width:0}
.sm2-list-body .t{font-size:13px;font-weight:600;color:var(--ink)}
.sm2-list-body .s{font-size:11.5px;color:var(--ink-3);margin-top:1px}
.sm2-tag{font-size:10.5px;font-weight:700;padding:3px 9px;border-radius:var(--rpill)}
.tag-red{background:rgba(224,80,60,.12);color:#d1503c}
.tag-gold{background:var(--gold-soft);color:var(--gold-strong)}
.tag-ok{background:var(--ok-soft);color:var(--ok)}

/* achievements */
.sm2-ach{display:flex;gap:10px;flex-wrap:wrap}
.sm2-ach .a{width:52px;height:52px;border-radius:15px;display:grid;place-items:center;background:var(--card-2);border:1px solid var(--border);font-size:22px}
.sm2-ach .a.on{background:var(--gold-soft);border-color:var(--gold-line)}
.sm2-ach .a.off{opacity:.4;filter:grayscale(1)}

/* insight bars */
.sm2-bars{display:flex;align-items:flex-end;gap:10px;height:120px;padding-top:8px}
.sm2-bars .bar{flex:1;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:6px;height:100%}
.sm2-bars .bar i{width:100%;max-width:26px;border-radius:7px 7px 3px 3px;background:linear-gradient(180deg,var(--gold),var(--gold-strong));display:block}
.sm2-bars .bar span{font-size:10px;color:var(--ink-3);font-weight:600}

/* ai suggestion cards */
.sm2-sug{display:flex;gap:11px;padding:13px;border-radius:14px;background:var(--card-2);border:1px solid var(--border-2);margin-bottom:8px}
.sm2-sug .si{width:30px;height:30px;border-radius:9px;flex:none;display:grid;place-items:center;background:var(--gold-soft);color:var(--gold-strong)}
.sm2-sug .si svg{width:16px;height:16px}
.sm2-sug .st{font-size:12.5px;color:var(--ink-2);line-height:1.5}
.sm2-sug .st b{color:var(--ink);font-weight:600}

/* ---- dashboard extras ---- */
.sm2-trend{margin:4px 0 6px}
.sm2-goal{margin-bottom:14px}
.sm2-goal-row{display:flex;justify-content:space-between;font-size:12.5px;color:var(--ink-2);margin-bottom:7px}
.sm2-goal-row b{color:var(--ink);font-weight:700}
.sm2-streak-mini{display:flex;align-items:center;justify-content:space-between;margin-top:18px;padding-top:16px;border-top:1px solid var(--border-2)}
.sm2-streak-mini .sm2-streak-num .d{font-size:38px}
.sm2-streak-mini .sm2-flame{width:34px;height:34px}

/* svg sizing safeguards */
.sm2-metric .mi svg{width:17px;height:17px}
.sm2-metric .md svg{width:13px;height:13px}
.sm2-goal-row svg{width:13px;height:13px}
body.sm2 .sm2-card .top svg,body.sm2 .sm2-metric svg{max-height:34px}

/* prevent inherited gradient-text (transparent fill) on display numbers */
body.sm2 .sm2-sc-val,body.sm2 .sm2-metric .mv,body.sm2 .sm2-stat .n,
body.sm2 .sm2-streak-num .d,body.sm2 .sm2-hero h1{-webkit-text-fill-color:currentColor;background:none}
/* hide dashboard.js empty states inside the trend card (keep real data tables) */
body.sm2 #db-gpa-history .db-empty,body.sm2 #db-cgpa-history .db-empty{display:none}
body.sm2 #db-gpa-history,body.sm2 #db-cgpa-history{margin-top:6px}
/* let the trend/goals row size to content */
body.sm2 .sm2-grid{align-items:start}

/* GPA trend summary */
.sm2-trend-sum{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:16px;padding-top:16px;border-top:1px solid var(--border-2)}
.sm2-trend-sum .ts{display:flex;flex-direction:column;gap:3px}
.sm2-trend-sum .l{font-size:11px;color:var(--ink-3);font-weight:600;text-transform:uppercase;letter-spacing:.03em}
.sm2-trend-sum .v{font-family:"Bricolage Grotesque",sans-serif;font-size:19px;font-weight:700;color:var(--ink)}
@media(max-width:640px){.sm2-trend-sum{grid-template-columns:repeat(2,1fr)}}

/* robust: neutralize any inherited gradient/transparent text-fill inside the app */
body.sm2 .sm2-app *,body.sm2 .sm2-bottomnav *{-webkit-text-fill-color:currentColor}
/* mobile hero: stack stat cards instead of absolute overlap */
@media(max-width:640px){
  .sm2-hero-r{min-height:0;margin-top:16px}
  .sm2-statcards{position:static;height:auto;min-height:0;display:grid;grid-template-columns:1fr 1fr;gap:10px}
  .sm2-statcard{position:static !important;width:auto !important;inset:auto !important}
  .sm2-statcard.big{grid-column:1 / -1}
  .sm2-statcard.big .sm2-sc-val{font-size:38px}
  .sm2-hero-illu{display:none}
}


/* =========================================================================
   GLOBAL DESIGN SYSTEM ROLLOUT  (applies the homepage look to every page)
   Overrides the site's shared CSS variables → one unified gold premium theme.
   ========================================================================= */

/* ---- LIGHT tokens (override style.css :root) ---- */
:root{
  --bg:#f6f5f2;
  --surface:#ffffff;
  --surface-2:#faf9f5;
  --border:rgba(23,20,16,.10);
  --border-soft:rgba(23,20,16,.06);
  --ink:#1a1815;
  --ink-2:#5d5952;
  --ink-3:#8f8a80;
  --accent:#a97c14;
  --accent-strong:#8a6410;
  --accent-dim:rgba(197,150,44,.13);
  --accent-fg:#1a1509;
  --gold:#c39324;
  --ok:#2f9e5b;      --ok-dim:rgba(47,158,91,.12);
  --info:#2f6fe0;    --info-dim:rgba(47,111,224,.12);
  --warn:#c98a12;    --warn-dim:rgba(201,138,18,.14);
  --danger:#d1503c;  --danger-dim:rgba(209,80,60,.12);
  --r-sm:10px; --r-md:16px; --r-lg:20px; --r-xl:26px;
  --shadow:0 2px 8px rgba(30,25,15,.05),0 14px 34px rgba(30,25,15,.08);
}
/* ---- DARK tokens (override personalization.css) ---- */
:root[data-theme="dark"]{
  --bg:#08080a;
  --surface:#141419;
  --surface-2:#17171d;
  --border:rgba(255,255,255,.08);
  --border-soft:rgba(255,255,255,.05);
  --ink:#f4f3ef;
  --ink-2:#a5a29b;
  --ink-3:#6c6a64;
  --accent:#e6bd63;
  --accent-strong:#f0cd7d;
  --accent-dim:rgba(230,189,99,.14);
  --accent-fg:#1a1509;
  --gold:#e6bd63;
  --ok:#4bc07f;      --ok-dim:rgba(75,192,127,.14);
  --info:#5b95f5;    --info-dim:rgba(91,149,245,.14);
  --warn:#e6bd63;    --warn-dim:rgba(230,189,99,.16);
  --danger:#f0776a;  --danger-dim:rgba(240,119,106,.16);
  --shadow:0 2px 10px rgba(0,0,0,.5),0 18px 44px rgba(0,0,0,.5);
}

/* ---- NEUTRALIZE the old "premium" purple skin → gold, theme-aware ---- */
body.premium{
  --p-bg:#f6f5f2; --p-surface:#ffffff; --p-surface-2:#faf9f5;
  --p-border:rgba(23,20,16,.10); --p-border-2:rgba(23,20,16,.14);
  --p-ink:#1a1815; --p-ink-2:#5d5952; --p-ink-3:#8f8a80;
  --p-accent:#a97c14; --g1:#e6bd63; --g2:#c39324; --g3:#a97c14;
  --accent:#a97c14; --accent-strong:#8a6410; --accent-dim:rgba(197,150,44,.13); --accent-fg:#1a1509;
  --sh-glow:0 8px 30px rgba(30,25,15,.10);
  background:#f6f5f2 !important; color:#1a1815 !important;
}
:root[data-theme="dark"] body.premium{
  --p-bg:#08080a; --p-surface:#141419; --p-surface-2:#17171d;
  --p-border:rgba(255,255,255,.08); --p-border-2:rgba(255,255,255,.12);
  --p-ink:#f4f3ef; --p-ink-2:#a5a29b; --p-ink-3:#6c6a64;
  --p-accent:#e6bd63; --g1:#f0cd7d; --g2:#e6bd63; --g3:#c39324;
  --accent:#e6bd63; --accent-strong:#f0cd7d; --accent-dim:rgba(230,189,99,.14); --accent-fg:#1a1509;
  --sh-glow:0 10px 40px rgba(0,0,0,.5);
  background:#08080a !important; color:#f4f3ef !important;
}
/* stray hardcoded purples */
body.premium .bd-qp,body.premium .calc-kicker{color:var(--accent-strong)!important}
body.premium #gpaOut{background:linear-gradient(135deg,var(--gold),var(--accent-strong))!important;-webkit-background-clip:text;background-clip:text}
/* ---- Fix: override purple select arrow with neutral grey ---- */
body.premium .select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")}
:root[data-theme="dark"] body.premium .select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")}
/* Fix: remove hardcoded light background from body.premium in dark mode */
body.premium{background:var(--bg,#f6f5f2);color:var(--ink,#1a1815)}
:root[data-theme="dark"] body.premium{background:var(--bg)!important;color:var(--ink)!important}
/* Fix: crow focus ring should use gold not purple */
body.premium .crow.crow-focus{background:rgba(197,150,44,.06);border-color:rgba(197,150,44,.22);box-shadow:0 0 0 3px rgba(197,150,44,.07)}
body.premium .input:focus,body.premium .select:focus{border-color:var(--accent-strong)!important;box-shadow:0 0 0 3px var(--accent-dim)!important;background:var(--accent-dim)!important}
body.premium .panel:focus-within{border-color:rgba(197,150,44,.28)!important;box-shadow:0 0 0 3px rgba(197,150,44,.07)!important}
/* Fix: tabs active should be gold not purple */
body.premium .tabs button.on{background:var(--accent-dim)!important;color:var(--ink)!important;box-shadow:none!important;border:1px solid var(--gold)!important}

/* =========================================================================
   FIXED APP SHELL for injected pages (body.sm2-shell)
   ========================================================================= */
body.sm2-shell{padding-left:var(--side-w);padding-top:66px;background:var(--app-bg)}
body.sm2-shell .site-head{display:none!important}
body.sm2-shell .sm2-side{position:fixed;top:0;left:0;height:100vh;width:var(--side-w);z-index:40}
body.sm2-shell .sm2-top{position:fixed;top:0;left:var(--side-w);right:0;z-index:35}
body.sm2-shell > main,body.sm2-shell #main-content{min-height:calc(100vh - 66px)}
/* let existing content breathe inside the shell */
body.sm2-shell #main-content > section > .wrap,
body.sm2-shell #main-content .wrap{max-width:1120px}
body.sm2-shell footer .wrap{max-width:1120px}
/* soften the old decorative grid background on tool heads */
body.sm2-shell .grid-bg{opacity:.35}

@media(max-width:980px){
  body.sm2-shell{padding-left:0;padding-top:60px}
  body.sm2-shell .sm2-top{left:0}
}
@media(max-width:640px){
  body.sm2-shell{padding-bottom:78px}
}

/* =========================================================================
   PREMIUM COMPONENT POLISH (buttons, inputs, cards) — reuses existing classes
   ========================================================================= */
.btn{border-radius:12px;font-weight:600;transition:transform .12s var(--ease),box-shadow .16s,background .16s,border-color .16s}
.btn:active{transform:translateY(1px)}
.btn-primary,.btn.btn-primary{background:linear-gradient(180deg,var(--gold),var(--accent-strong));color:#1a1509;border:1px solid transparent;box-shadow:0 4px 14px rgba(197,150,44,.28)}
.btn-primary:hover,.btn.btn-primary:hover{filter:brightness(1.04)}
.btn-ghost,.btn.btn-ghost{background:var(--surface);color:var(--ink);border:1px solid var(--border)}
.btn-ghost:hover,.btn.btn-ghost:hover{background:var(--surface-2);border-color:var(--accent);color:var(--accent-strong)}
input,select,textarea{border-radius:12px!important}
input:focus,select:focus,textarea:focus{outline:none!important;border-color:var(--accent)!important;box-shadow:0 0 0 4px var(--accent-dim)!important}
/* footer refinement */
body.sm2-shell footer{border-top:1px solid var(--border);background:var(--surface);margin-top:40px}

/* kill purple/heavy glows from premium page-transition */
body.premium{opacity:1!important}

/* remove legacy premium purple animated background + noise (perf + purple removal) */
.prem-bg,.noise-overlay{display:none!important}

/* ====================================================
   StudyMetrics PWA — Install Button & Offline Banner
   v2.1
   ==================================================== */

/* Desktop install button in topbar */
.sm2-top-tools .sm-install-btn {
  color: var(--gold, #e6bd63);
  position: relative;
}
.sm2-top-tools .sm-install-btn:hover {
  background: var(--surface-2, rgba(255,255,255,.06));
}



/* Offline banner (injected by pwa.js) */
#sm-offline-banner {
  font-weight: 500;
}

/* Pomodoro notification button active state */
#pomNotifBtn.notif-on {
  color: var(--ok, #22c55e) !important;
  cursor: default;
}
