/* ============================================================
   agenda — production stylesheet
   Direction: "Lily Pond" (soft Impressionist · frosted glass)
   A full-bleed Monet water-lily painting sits behind everything
   (.bg + .veil); content floats on frosted-glass cards. Dusty
   rose accent, sage + warm rose for states. Cormorant Garamond
   display + Mulish body.

   THEME LIVES IN :root — to switch directions, change these
   tokens + the .bg image; the rest is theme-independent.
   ============================================================ */

:root {
  --paper:      #EFEAE6;   /* soft cream paper (fallback under the painting) */
  --card:       #FFFFFF;
  --ink:        #3C4A46;   /* soft deep slate-green */
  --ink-soft:   #6E7E78;
  --ink-faint:  #97A39D;
  --accent:     #C0879D;   /* dusty rose (the lotus) */
  --accent-2:   #D6A8B8;
  --accent-soft:#F1E4E9;
  --good:       #7BA98C;   /* sage — done / submitted */
  --good-soft:  #E8F0EA;
  --alert:      #BE6B82;   /* warm rose — urgent / overdue / missing */
  --alert-soft: #F5E7EC;

  /* frosted-glass surfaces (let the painting show through) */
  --glass:        rgba(255,255,255,.58);
  --glass-strong: rgba(255,255,255,.74);
  --glass-line:   rgba(255,255,255,.65);

  --rule:       rgba(60,74,70,.12);
  --rule-2:     rgba(60,74,70,.18);
  --shadow:     0 6px 26px rgba(60,74,70,.12);
  --shadow-sm:  0 1px 3px rgba(60,74,70,.10);

  /* course color-coding (assigned in order by app.js) */
  --c-1: #9787C4;  /* lavender (cs)   */
  --c-2: #5A9E8E;  /* teal    (math) */
  --c-3: #C98F6D;  /* clay    (hist) */
  --c-4: #C77FA0;  /* rose    (engl) */
  --c-5: #6E94C0;  /* blue */
  --c-6: #9CA86A;  /* olive */

  --maxw: 760px;
  --r: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:#14211C; --card:#1B2A24; --ink:#E6ECE8; --ink-soft:#A6B5AE; --ink-faint:#6F7E77;
    --accent:#D6A8B8; --accent-2:#C0879D; --accent-soft:#2E2230; --good:#8FC2A1; --good-soft:#1C2C24;
    --alert:#E09BAD; --alert-soft:#34232B;
    --glass:rgba(27,42,36,.55); --glass-strong:rgba(27,42,36,.74); --glass-line:rgba(255,255,255,.12);
    --rule:rgba(230,236,232,.12); --rule-2:rgba(230,236,232,.18);
    --shadow:0 6px 26px rgba(0,0,0,.45); --shadow-sm:0 1px 3px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Mulish", system-ui, -apple-system, sans-serif;
  font-size: 16px; line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
[x-cloak] { display: none !important; }

a { color: var(--accent); text-decoration: none; font-weight: 700; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font-family: inherit; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- full-bleed painting + legibility veil ---------- */
.bg {
  position: fixed; inset: -8px; z-index: -2;
  background: url('/assets/bg.jpg') center/cover no-repeat;
  filter: blur(3px) brightness(1.07) saturate(1.04); transform: scale(1.04);
}
.veil {
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(249,247,243,.46), rgba(247,244,249,.58));
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px 96px; position: relative; z-index: 1; }

/* ---------- sticky frosted header (wordmark row + tabs) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.6);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border-bottom: 1px solid var(--glass-line);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 16px 16px 6px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.wordmark {
  font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; font-weight: 600;
  font-size: 40px; line-height: .9; color: var(--ink); letter-spacing: .01em;
}
.weeklabel {
  font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .05em;
  text-transform: uppercase; white-space: nowrap;
}

/* ---------- hero banner (deprecated — retained for compatibility) ---------- */
.hero {
  position: relative; height: 188px;
  background: url('/assets/bg.jpg') center 38%/cover no-repeat;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(60,74,70,.06) 0%, rgba(60,74,70,.02) 45%, rgba(60,74,70,.42) 100%);
}
.hero-inner {
  position: absolute; inset: 0; z-index: 1;
  max-width: var(--maxw); margin: 0 auto; padding: 0 18px 16px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.hero .weeklabel {
  color: #FBF8F2; text-shadow: 0 1px 8px rgba(60,74,70,.6); padding-bottom: 7px;
}

/* ---------- tabs (wrapper inside .topbar) ---------- */
.tabbar { background: transparent; }
.tabs {
  max-width: var(--maxw); margin: 0 auto; padding: 9px 16px 12px;
  display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font-size: 13.5px; font-weight: 700; color: var(--ink-soft);
  padding: 7px 14px; white-space: nowrap; border-radius: 999px; transition: background .15s, color .15s;
}
.tab:hover { background: rgba(255,255,255,.45); color: var(--ink); }
.tab.active { background: var(--accent); color: #fff; }
.tab .badge {
  font-size: 10.5px; font-weight: 800; background: var(--alert); color: #fff;
  border-radius: 999px; padding: 0 6px; margin-left: 5px; vertical-align: 1px;
}
.tab.active .badge { background: rgba(255,255,255,.92); color: var(--accent); }

/* ---------- section labels ---------- */
.seclabel {
  font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .15em;
  color: var(--ink-soft); margin: 22px 4px 10px;
}
.seclabel.alert { color: var(--alert); }

/* ---------- cards (frosted glass) ---------- */
.card {
  background: var(--glass); backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--glass-line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 4px 16px; margin-bottom: 16px;
}
.card.overdue { background: rgba(190,107,130,.13); border-color: rgba(190,107,130,.24); }

/* ---------- day blocks ---------- */
.day { margin-bottom: 16px; }
.dayhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 16px 4px 8px; }
.dayhead .left { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.dayname { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; font-size: 27px; line-height: 1; color: var(--ink); }
.day.today .dayname::after {
  content: "today"; font-family: "Mulish", sans-serif; font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .1em; color: #fff; background: var(--accent);
  padding: 3px 9px; border-radius: 999px; margin-left: 10px; vertical-align: 5px;
}
.daydate { font-size: 12.5px; font-weight: 600; color: var(--ink-faint); }
.daymins {
  font-size: 12px; font-weight: 800; color: var(--accent); white-space: nowrap;
  background: var(--accent-soft); padding: 3px 10px; border-radius: 999px;
}
.daymins.zero { color: var(--ink-faint); font-weight: 600; background: transparent; padding: 0; }

/* ---------- assignment item ---------- */
.item {
  position: relative; display: grid; grid-template-columns: 24px 1fr auto; align-items: start; gap: 13px;
  padding: 13px 4px; border-bottom: 1px solid var(--rule);
}
.item:last-child { border-bottom: 0; }
.item::before { content:""; position:absolute; left:-16px; top:11px; bottom:11px; width:3px; border-radius:999px; background:transparent; }
.item.atrisk::before { background: var(--accent); }
.item.overdue::before { background: var(--alert); }

.check {
  appearance: none; margin: 1px 0 0; width: 22px; height: 22px; cursor: pointer; flex: none;
  border: 2px solid var(--ink-faint); border-radius: 50%; background: rgba(255,255,255,.5);
  display: grid; place-content: center; transition: background .15s, border-color .15s;
}
.check:hover { border-color: var(--good); }
.check::after {
  content: ""; width: 11px; height: 6px; margin-top: -2px;
  border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) scale(0); transition: transform .15s ease;
}
.check:checked { background: var(--good); border-color: var(--good); }
.check:checked::after { transform: rotate(-45deg) scale(1); }

.body { min-width: 0; }
.iname { font-size: 15.5px; font-weight: 700; color: var(--ink); line-height: 1.3; word-break: break-word; }
.item.done .iname { color: var(--ink-faint); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.subline { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 5px; }

.code {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 9px; border-radius: 999px;
  color: var(--cc, var(--ink)); background: color-mix(in srgb, var(--cc, var(--ink)) 16%, rgba(255,255,255,.55));
}
.tag { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.tag.muted { color: var(--ink-faint); }
.tag.good { color: var(--good); font-weight: 700; }
.tag.alert { color: var(--alert); font-weight: 700; }
.tag.dot::before { content:"·"; margin-right: 9px; color: var(--ink-faint); }

.due { text-align: right; white-space: nowrap; font-size: 13.5px; font-weight: 800; color: var(--ink); }
.due small { display: block; font-weight: 600; font-size: 10.5px; color: var(--ink-faint); }
.item.atrisk .due, .item.overdue .due { color: var(--alert); }
.due.none { color: var(--ink-faint); font-weight: 600; }

/* inline editors (estimate + notes) */
.micro { grid-column: 2 / -1; margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field {
  font-family: "Mulish", sans-serif; font-size: 12.5px; font-weight: 600; color: var(--ink);
  background: rgba(255,255,255,.5); border: 1px solid var(--glass-line); border-radius: 999px; padding: 5px 12px;
}
.field.note { flex: 1 1 200px; min-width: 0; }
.field.est { width: 96px; }
.field::placeholder { color: var(--ink-faint); font-weight: 500; }

/* ---------- filters (All view) ---------- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.chip {
  appearance: none; cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--ink-soft);
  background: rgba(255,255,255,.5); border: 1.5px solid var(--glass-line); border-radius: 999px; padding: 6px 13px; transition: all .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { color: #fff; border-color: transparent; background: var(--accent); }

/* ---------- grades ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.gcard {
  background: var(--glass); backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--glass-line); border-radius: var(--r);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.gcard::before { content:""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--cc, var(--accent)); }
.gcard .gcode { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--cc, var(--ink-soft)); }
.gcard .gname { font-size: 14px; font-weight: 600; color: var(--ink-soft); margin: 3px 0 12px; }
.gcard .gscore { font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 40px; line-height: 1; color: var(--ink); }
.gcard .gletter { font-size: 15px; font-weight: 800; color: var(--ink-soft); margin-left: 8px; }
.gcard .gnone { font-size: 15px; font-weight: 600; color: var(--ink-faint); }

/* per-assignment score rows under grades */
.scorelist { margin-top: 6px; }
.scorerow { display: flex; justify-content: space-between; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--rule); font-size: 14px; }
.scorerow:last-child { border-bottom: 0; }
.scorerow .pts { font-weight: 800; white-space: nowrap; color: var(--ink); }

/* ---------- settings ---------- */
.panel {
  background: var(--glass); backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--glass-line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.panel h3 { margin: 0 0 5px; font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 23px; }
.panel p { margin: 0 0 14px; color: var(--ink-soft); font-size: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.btn {
  appearance: none; cursor: pointer; font-size: 14px; font-weight: 800; color: #fff;
  background: var(--accent); border: 0; border-radius: 999px; padding: 11px 20px; box-shadow: var(--shadow-sm);
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .55; cursor: default; filter: none; }
.btn.ghost { color: var(--accent); background: rgba(255,255,255,.55); border: 1.5px solid var(--accent); box-shadow: none; }
.btn.sage { background: var(--good); }
.status { font-size: 13px; font-weight: 700; color: var(--good); }
.status.off { color: var(--ink-faint); }
.help { font-size: 13.5px; color: var(--ink-soft); line-height: 1.7; }
.help ol { margin: 8px 0 0; padding-left: 20px; }
.banner {
  display: flex; gap: 11px; align-items: flex-start;
  background: rgba(245,231,236,.72); backdrop-filter: blur(10px) saturate(1.1); -webkit-backdrop-filter: blur(10px) saturate(1.1);
  border: 1.5px solid rgba(190,107,130,.28); color: var(--ink);
  border-radius: var(--r); padding: 13px 16px; margin-bottom: 18px; font-size: 13.5px; font-weight: 600;
}
.banner b { color: var(--alert); }

/* ---------- states: empty / loading / toast ---------- */
.empty { text-align: center; color: var(--ink-faint); font-size: 14px; padding: 40px 16px; font-weight: 600; }
.empty .big { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 24px; color: var(--ink-soft); display: block; margin-bottom: 4px; }
.loading { text-align: center; padding: 80px 16px; color: var(--ink-soft); }
.spinner {
  width: 30px; height: 30px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--rule-2); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 700;
  padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow); z-index: 50;
}

.footnote { text-align: center; color: var(--ink-faint); font-size: 12px; font-weight: 600; margin-top: 28px; }

/* ---------- login page ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(rgba(60,74,70,.18), rgba(60,74,70,.40)), url('/assets/bg.jpg') center/cover fixed;
}
.login-card {
  width: 100%; max-width: 360px; background: var(--glass-strong);
  backdrop-filter: blur(18px) saturate(1.1); -webkit-backdrop-filter: blur(18px) saturate(1.1);
  border: 1px solid var(--glass-line); border-radius: 22px;
  box-shadow: 0 12px 40px rgba(60,74,70,.25); padding: 30px 26px; text-align: center;
}
.login-card .wordmark { font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; color: var(--ink); text-shadow: none; font-size: 46px; margin-bottom: 4px; }
.login-card p { color: var(--ink-soft); font-size: 14px; margin: 0 0 20px; }
.login-card input[type=password] {
  width: 100%; font-family: "Mulish", sans-serif; font-size: 15px; color: var(--ink);
  background: rgba(255,255,255,.6); border: 1.5px solid var(--glass-line); border-radius: 999px; padding: 12px 18px; margin-bottom: 12px;
}
.login-card .btn { width: 100%; padding: 12px; }
.login-card .err { color: var(--alert); font-size: 13px; font-weight: 700; min-height: 18px; margin-bottom: 8px; }

/* ---------- print ---------- */
.print-actions { max-width: var(--maxw); margin: 0 auto; padding: 18px 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.print-sheet { max-width: var(--maxw); margin: 0 auto; padding: 0 16px 60px; }
.pday { border-top: 2px solid var(--ink); padding-top: 8px; margin-top: 18px; break-inside: avoid; }
.pday h2 { font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 24px; margin: 0 0 8px; display: flex; justify-content: space-between; }
.pitem { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; border-bottom: 1px dotted var(--rule-2); }
.pbox { width: 16px; height: 16px; border: 1.5px solid var(--ink); border-radius: 4px; flex: none; }
.plines { height: 46px; border-bottom: 1px dotted var(--rule-2); }

@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; font-size: 12px; }
  .print-actions, .tabbar, .topbar, .hero, .bg, .veil, .no-print { display: none !important; }
  .pday { border-color: #000; break-inside: avoid; }
  .pbox { border-color: #000; }
  a { color: #000; text-decoration: none; }
}

@media (max-width: 480px) {
  .hero { height: 158px; }
  .wordmark { font-size: 34px; }
  .dayname { font-size: 24px; }
  .item { grid-template-columns: 22px 1fr auto; gap: 11px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
