/* Einstein — minimalist, education-forward. Flat panels, thin lines, one accent.
   Lora (serif headings) + Inter (body). Inspired by Sovereign's restraint. */
:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1b1f28;
  --line: #262b36;
  --line-soft: #20242e;
  --text: #e8ebf1;
  --muted: #8b93a3;
  --faint: #626a79;
  --accent: #d9ab5c;          /* academic gold */
  --accent-ink: #1a1408;
  --good: #4ade80;
  --phys: #e28a4e;
  --chem: #45cf92;
  --math: #6089e6;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  padding-bottom: 64px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 500; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  max-width: 1000px; margin: 0 auto; padding: 30px 24px 10px;
}
.brand h1 {
  margin: 0; font-family: "Bungee", var(--serif); font-weight: 400;
  font-size: 30px; letter-spacing: .5px; display: flex; align-items: center; gap: 10px;
  color: var(--text);
}
.brand .bolt { font-size: 26px; filter: drop-shadow(0 0 10px rgba(217,171,92,.4)); }
.countdown { text-align: right; }
.countdown .big { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.countdown .small { color: var(--muted); font-size: 12px; }
.phasepill {
  display: inline-block; margin-top: 6px; font-size: 10.5px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; letter-spacing: .4px;
  border: 1px solid var(--line); color: var(--muted); background: transparent;
}
.phasepill.learning { color: var(--accent); border-color: #4a3c22; }
.phasepill.revision { color: var(--good); border-color: #1f4a33; }
.phasepill.tiny { font-size: 9.5px; padding: 1px 7px; margin: 0 6px; text-transform: uppercase; letter-spacing: .6px; }

/* ---- tabs (underline, sovereign-style) ---- */
.tabs {
  display: flex; gap: 4px; max-width: 1000px; margin: 0 auto;
  padding: 12px 24px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.tab {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 9px 14px; font-size: 13.5px; font-family: var(--sans);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---- layout ---- */
main { max-width: 1000px; margin: 0 auto; padding: 22px 24px; }

/* ---- layout with right-side assistant ---- */
.layout { max-width: 1380px; margin: 0 auto; display: flex; gap: 24px; align-items: flex-start; padding: 0 24px; }
.main-col { flex: 1; min-width: 0; }
.main-col .tabs, .main-col main { max-width: none; margin: 0; padding-left: 0; padding-right: 0; }
.chat {
  width: 330px; flex-shrink: 0;
  position: sticky; top: 16px;
  height: min(640px, calc(100vh - 32px));
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  margin-top: 10px;
}
.chat-head {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  font-family: var(--serif); font-weight: 600; font-size: 14px;
  text-transform: uppercase; letter-spacing: 1.6px; color: var(--muted);
}
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { padding: 9px 12px; border-radius: 10px; font-size: 13px; line-height: 1.45; max-width: 92%; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.msg.ai { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line-soft); }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: 13px; font-family: var(--sans); }
.chat-form input:focus { outline: none; border-color: var(--accent); }
.chat-form button { background: var(--accent); color: var(--accent-ink); border: none; border-radius: 8px; padding: 0 14px; font-weight: 700; cursor: pointer; }
@media (max-width: 1080px) { .layout { flex-direction: column; } .chat { position: static; width: 100%; height: 420px; } }
.view.hidden, .hidden { display: none !important; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 3px; font-size: 17px; font-weight: 500; }
.card .sub, .sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

.grid { display: grid; gap: 12px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 720px) { .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }

/* ---- stat tiles ---- */
.stat { border: 1px solid var(--line); border-radius: 10px; padding: 15px 16px; }
.stat .n { font-family: var(--serif); font-size: 27px; font-weight: 600; }
.stat .l { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .8px; margin-top: 2px; }

/* ---- banner ---- */
.banner {
  border: 1px solid var(--line); border-left: 2px solid var(--accent);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 16px;
  font-size: 13.5px; color: var(--text); background: var(--panel);
}
.banner.revision { border-left-color: var(--good); }

/* ---- day head ---- */
.dayhead { display: flex; align-items: baseline; justify-content: space-between; }
.totmin { color: var(--faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; }

/* ---- slots ---- */
.slot {
  display: flex; align-items: center; gap: 13px; padding: 13px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.slot:last-child { border-bottom: none; }
.slot .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.slot .body { flex: 1; min-width: 0; }
.slot .t { font-weight: 500; font-size: 14.5px; }
.slot .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.slot .meta i { color: var(--faint); font-style: italic; }
.slot .mins { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kind {
  font-size: 10px; text-transform: uppercase; letter-spacing: .7px; font-weight: 600;
  padding: 1px 7px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted);
  margin-left: 4px; vertical-align: 1px;
}
.kind.learn, .kind.learned { color: var(--accent); border-color: #4a3c22; }
.kind.revise, .kind.revised { color: var(--good); border-color: #1f4a33; }
.kind.browse { color: var(--muted); }

/* ---- week blocks ---- */
.dayblock { margin-bottom: 20px; }
.dayblock h3 { margin: 0 0 4px; font-size: 13px; color: var(--muted); font-weight: 500; font-family: var(--sans);
  padding-bottom: 6px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.dayblock h3 b { color: var(--text); font-weight: 600; margin-right: 4px; }
.dayblock h3 .totmin { margin-left: auto; }
.dayblock.today h3 b { color: var(--accent); }

/* ---- confidence ---- */
.confbar { display: inline-flex; gap: 2px; vertical-align: middle; }
.confbar i { width: 13px; height: 4px; border-radius: 2px; background: var(--line); display: inline-block; }
.confbar i.on { background: var(--muted); }

/* ---- subject head + progress ---- */
.subject-head { display: flex; align-items: center; gap: 10px; padding: 2px 0 8px; }
.subject-head .swatch { width: 9px; height: 9px; border-radius: 50%; }
.subject-head h2 { margin: 0; font-size: 17px; }
.subject-head .pct { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.progress-track { height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; margin: 0 0 12px; }
.progress-fill { height: 100%; }
.legendmini { color: var(--faint); font-size: 11.5px; margin-bottom: 10px; }
.mini-item { padding: 6px 2px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; color: var(--text); }
.mini-item:last-child { border-bottom: none; }
.mini-item .paper { margin-left: 6px; }

/* ---- dashboard (hero) ---- */
.dash {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 28px; margin-bottom: 18px;
}
.dash-grid {
  display: flex; gap: 40px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding-bottom: 22px; border-bottom: 1px solid var(--line);
}
.dash-days { flex: 0 0 auto; }
.dnum { font-family: var(--serif); font-size: 64px; font-weight: 600; line-height: .95; }
.dlbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; margin-top: 8px; }
.ddate { color: var(--faint); font-size: 12.5px; margin-top: 3px; }
.dash-tiles { display: flex; gap: 14px; flex-wrap: wrap; }
.dtile { border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; min-width: 132px; }
.dt-n { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1; }
.dt-n span { color: var(--faint); font-size: 18px; }
.dt-l { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; margin-top: 6px; }
.dash-status { margin-top: 18px; padding: 10px 14px; border-radius: 8px; font-size: 13px; border: 1px solid var(--line); color: var(--muted); }
.dash-status.ahead { color: var(--good); border-color: #1f4a33; background: rgba(74,222,128,.06); }
.dash-status.ontrack { color: var(--muted); }
.dash-status.behind { color: #eab466; border-color: #56471f; background: rgba(234,180,102,.07); }
.dash-subjects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding-top: 20px; }
.dsub-top { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 9px; }
.dsub-top .swatch { width: 9px; height: 9px; border-radius: 50%; }
.dsub-n { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }
@media (max-width: 720px) {
  .dash-grid { gap: 22px; }
  .dash-tiles { width: 100%; }
  .dtile { flex: 1; }
  .dash-subjects { grid-template-columns: 1fr; gap: 14px; }
  .dnum { font-size: 54px; }
}

/* ---- get-ahead ---- */
.getahead { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.ga-lbl { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .7px; margin-right: 2px; }

/* ---- today boxes ---- */
.tbox {
  position: relative;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 16px;
}
.grid.cols-2 .tbox { margin-bottom: 0; height: 100%; }
.tbox.done { border-color: #26543c; background: rgba(74,222,128,.03); }
.tbox-body { padding: 18px 20px; padding-right: 92px; }
.tbox.main .tbox-body { padding-right: 118px; }
.tbox-head { margin-bottom: 12px; }
.tbox-kind { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .9px; }
.tbox-kind .dot { width: 7px; height: 7px; border-radius: 50%; }
.tbox-title { font-family: var(--serif); font-size: 20px; font-weight: 600; margin-bottom: 5px; }
.tbox.main .tbox-title { font-size: 27px; }
.tbox.done .tbox-title { color: var(--muted); }
.tbox-meta { color: var(--muted); font-size: 12.5px; }
.tbox-meta i { color: var(--faint); font-style: italic; }

/* square control — scales to box height, even margin on top/right/bottom */
.tbox-square {
  position: absolute; top: 14px; right: 14px; bottom: 14px; height: auto;
  aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 9px;
  background: transparent; cursor: pointer;
  display: grid; place-items: center; color: #08130c; font-size: 1.3rem; font-weight: 700;
  transition: background .15s, border-color .15s;
}
.tbox.main .tbox-square { top: 18px; right: 18px; bottom: 18px; font-size: 2rem; }
.tbox-square:hover { border-color: var(--muted); }
.tbox-square.done { background: var(--good); border-color: var(--good); }
.tbox-square.done:hover { border-color: var(--good); }
.tbox-square.pulse { animation: pulseWhite 1.6s ease-in-out infinite; }
@keyframes pulseWhite {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); border-color: var(--line); }
  50%      { box-shadow: 0 0 16px 2px rgba(255,255,255,.55); border-color: #fff; }
}

/* ---- checklist rows ---- */
.topic-head, .topic-row {
  display: grid; grid-template-columns: 1fr 56px 118px 96px 30px; gap: 10px; align-items: center;
}
.topic-head {
  color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: .6px;
  padding: 6px 2px 8px; border-bottom: 1px solid var(--line);
}
.topic-head span:nth-child(2), .topic-head span:nth-child(3), .topic-head span:nth-child(4) { text-align: center; }
.stars { display: flex; gap: 2px; justify-self: center; }
.star { background: none; border: none; cursor: pointer; font-size: 15px; line-height: 1; color: var(--line); padding: 0 1px; transition: color .1s; }
.star.on { color: var(--accent); }
.star:hover { color: var(--accent); }
.topic-row { padding: 9px 2px; border-bottom: 1px solid var(--line-soft); }
.topic-row:last-of-type { border-bottom: none; }
.topic-row.done .name { color: var(--muted); }
.topic-row .name { font-weight: 500; font-size: 14px; }
.paper { color: var(--faint); font-size: 10px; margin-left: 8px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; text-transform: uppercase; letter-spacing: .4px; }
.paper.browse { color: var(--accent); border-color: #4a3c22; }
.learnt {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; cursor: pointer; font-size: 13px; font-weight: 700; justify-self: center;
}
.learnt.yes { background: var(--good); border-color: var(--good); color: #08130c; }
.learnt.no { color: var(--faint); }
.learnt.no:hover { color: #e08a8a; border-color: #5a3030; }
.stepper { display: flex; align-items: center; gap: 6px; justify-self: center; }
.step {
  width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1;
}
.step:hover { color: var(--text); border-color: var(--muted); }
.revnum { min-width: 16px; text-align: center; font-variant-numeric: tabular-nums; font-size: 14px; }
.revtag { color: var(--faint); font-size: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; margin-left: 6px; }
.topic-row .btn.sm.ghost { padding: 2px 7px; justify-self: end; }

/* ---- buttons ---- */
.btn {
  border: 1px solid var(--line); background: transparent; color: var(--text);
  padding: 7px 13px; border-radius: 7px; cursor: pointer; font-weight: 500; font-size: 13px;
  font-family: var(--sans); transition: border-color .12s, background .12s;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: #e6b96e; }
.btn.good { border-color: #26543c; color: var(--good); }
.btn.good:hover { background: rgba(74,222,128,.08); border-color: var(--good); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.sm { padding: 5px 11px; font-size: 12px; }

/* ---- inputs ---- */
.field { margin-bottom: 14px; }
.field label { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
input, select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 11px; border-radius: 7px; font-size: 14px; font-family: var(--sans);
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }

/* ---- modal / toast ---- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; width: min(440px, 92vw); }
.modal-card h3 { margin: 0 0 4px; font-size: 18px; font-weight: 500; }
.modal-card .sub { margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.conf-picker { display: flex; gap: 6px; }
.conf-picker button {
  width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--line);
  background: transparent; color: var(--text); cursor: pointer; font-weight: 500; font-family: var(--sans);
}
.conf-picker button.sel { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 9px 18px; border-radius: 8px;
  font-weight: 600; font-size: 13px; z-index: 60;
}
.empty { color: var(--faint); text-align: center; padding: 26px; font-size: 13.5px; }
