/* ===== claude design 2 — port =====
   Overrides + new styles ported from `claude design 2/`. Loaded AFTER
   styles.css so these rules win the cascade. Anything that doesn't have a
   counterpart here falls through to the original studybuddy styles. */

:root{
  /* Surface tokens — derive from the studybuddy theme system so picking a
     theme (Sepia / Forest / Ocean / etc.) actually retints the new design.
     Each cd-* token references the matching theme var with the comp's grey
     palette as the fallback (used only if a theme doesn't set the var). */
  --cd-bg:        var(--page-soft, #eef0f2);
  --cd-panel:     var(--page-tint, #f6f6f4);
  --cd-panel-2:   var(--page,      #fbfbf8);
  /* Translucent variants — used on dashboard / subject content cards so the
     background icon doodles can show through. Solid --cd-panel still used
     for the sidebar and other chrome where doodles don't sit underneath. */
  --cd-panel-a:   rgba(246, 246, 244, 0.70);
  --cd-panel-2a:  rgba(251, 251, 248, 0.70);
  --cd-ink:       var(--ink-strong,  #14161a);
  --cd-ink-soft:  var(--ink,         #2a2d33);
  --cd-muted:     var(--ink-mute,    #7c8089);
  --cd-line:      var(--hairline-bold, #e2e3df);
  --cd-line-soft: var(--hairline,      #ebece8);
  --cd-shadow-card: 0 1px 0 rgba(20,22,26,.03), 0 2px 8px rgba(20,22,26,.04);

  /* Roundness (override) */
  --r-xs:  7px;
  --r-sm:  10px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  25px;
  --r-pill: 14px;
  --r-circle: 999px;
}

/* ── Body baseline ───────────────────────────────────────────────────── */
html, body {
  background: var(--cd-bg);
  color: var(--cd-ink);
}

/* ── App shell: sidebar + main, 10px gutter ──────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  padding: 10px;
  gap: 10px;
  background: var(--cd-bg);
  flex-direction: unset;   /* override styles.css flex-row */
  overflow: hidden;
}
.app.no-chrome { display: block; padding: 0; }
.app.no-chrome > .cd-sidebar { display: none; }

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.cd-sidebar {
  background: var(--cd-panel);
  border-radius: 24px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--cd-shadow-card);
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 13.5px;
  color: var(--cd-ink);
  border: none;
  width: auto;            /* override styles.css .sidebar width:240px */
}
.cd-sidebar::-webkit-scrollbar { width: 6px; }
.cd-sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,.08); border-radius: 3px; }

.cd-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 10px;
}
.cd-brand-avatar {
  width: 38px; height: 38px;
  border-radius: var(--r-circle);
  background: linear-gradient(135deg, #cbb89a, #7a5a3a);
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 14px;
  box-shadow: inset 0 0 0 2px #fff, 0 0 0 1px var(--cd-line);
  flex: 0 0 auto;
  overflow: hidden;
}
.cd-brand-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cd-brand-name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.005em;
  flex: 1;
  color: #37352f;
}
.cd-brand-collapse {
  width: 28px; height: 28px;
  border-radius: var(--r-circle);
  display: grid; place-items: center;
  color: var(--cd-muted);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}
.cd-brand-collapse:hover { border-color: var(--cd-line); background: var(--cd-panel-2); }

.cd-search {
  margin-top: 4px;
  display: flex; align-items: center; gap: 8px;
  background: var(--cd-panel-2);
  border: 1px solid var(--cd-line);
  border-radius: var(--r-circle);
  padding: 8px 12px;
  color: var(--cd-muted);
  cursor: pointer;
  user-select: none;
}
.cd-search:hover { background: #fff; }
.cd-search-glyph { font-family: var(--mono); font-size: 12px; }
.cd-search-input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font: inherit; color: var(--cd-ink); cursor: pointer;
}
.cd-kbd {
  font-family: var(--mono); font-size: 11px;
  color: var(--cd-muted);
  background: #fff;
  border: 1px solid var(--cd-line);
  border-radius: 8px;
  padding: 2px 6px;
}

.cd-new-guide {
  margin-top: 10px;
  background: var(--cd-ink); color: #fff;
  border: 0;
  border-radius: var(--r-circle);
  padding: 10px 14px;
  text-align: left;
  font-weight: 500;
  font: inherit;
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
}
.cd-new-guide:hover { background: #000; }
.cd-new-guide .plus { font-weight: 400; opacity: 0.85; }

.cd-nav { margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.cd-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-circle);
  color: var(--cd-ink-soft);
  font-weight: 500;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.cd-nav-item:hover { background: var(--cd-panel-2); }
.cd-nav-item.active {
  background: var(--cd-panel-2);
  box-shadow: 0 1px 0 rgba(0,0,0,.03), 0 1px 6px rgba(0,0,0,.04);
  color: var(--cd-ink);
}
.cd-nav-item .ic {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  color: var(--cd-muted);
  flex: 0 0 auto;
}
.cd-nav-item.active .ic { color: var(--cd-ink); }
.cd-nav-item .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cd-muted);
  font-variant-numeric: tabular-nums;
}

.cd-section-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 6px 6px 6px;
  color: var(--cd-ink);
  font-weight: 600;
  font-size: 13px;
  gap: 6px;
}
.cd-section-toggle {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  background: transparent; border: 0; padding: 4px 6px;
  border-radius: 8px;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.cd-section-toggle:hover { background: var(--cd-panel-2); }
.cd-section-toggle .chev {
  width: 14px; height: 14px;
  display: grid; place-items: center;
  color: var(--cd-muted);
  transition: transform 150ms ease;
  flex: 0 0 auto;
}
.cd-section-label.open .cd-section-toggle .chev { transform: rotate(90deg); }
.cd-section-label .add {
  width: 22px; height: 22px;
  border-radius: var(--r-circle);
  display: grid; place-items: center;
  color: var(--cd-muted);
  border: 1px solid var(--cd-line);
  background: transparent;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}
.cd-section-label .add:hover { background: var(--cd-panel-2); color: var(--cd-ink); }

.cd-subjects { display: flex; flex-direction: column; gap: 2px; }
.cd-subject {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-circle);
  color: var(--cd-ink-soft);
  font-weight: 500;
  cursor: pointer;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 500;
  text-align: left;
  width: 100%;
}
.cd-subject:hover { background: var(--cd-panel-2); }
.cd-subject.active {
  background: var(--cd-panel-2);
  box-shadow: 0 1px 0 rgba(0,0,0,.03), 0 1px 6px rgba(0,0,0,.04);
  color: var(--cd-ink);
}
.cd-subject .swatch {
  width: 18px; height: 18px;
  border-radius: 7px;
  display: grid; place-items: center;
  font-size: 11px;
  color: #fff;
  flex: 0 0 auto;
}
.cd-subject .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cd-user {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-circle);
  border: 1px solid var(--cd-line);
  background: var(--cd-panel-2);
  cursor: pointer;
  position: relative;
}
.cd-user .av {
  width: 28px; height: 28px;
  border-radius: var(--r-circle);
  background: linear-gradient(135deg, #2d6a4f, #95d5b2);
  flex: 0 0 auto;
  overflow: hidden;
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 12px;
}
.cd-user .av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cd-user .nm { flex: 1; font-weight: 500; color: var(--cd-ink); }
.cd-user .more { color: var(--cd-muted); background: transparent; border: 0; cursor: pointer; }

.cd-user-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--cd-line);
  border-radius: var(--r-md);
  padding: 4px;
  box-shadow: 0 12px 28px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.05);
  z-index: 50;
  display: flex; flex-direction: column;
}
.cd-user-menu-item {
  background: transparent; border: 0;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font: inherit;
  font-weight: 500;
  color: var(--cd-ink);
  text-align: left;
  cursor: pointer;
}
.cd-user-menu-item:hover { background: var(--cd-panel-2); }
.cd-user-menu-item.danger { color: #b0473d; }
.cd-user-menu-item.danger:hover { background: #fbe7e3; }
.cd-user-menu-sep { height: 1px; background: var(--cd-line); margin: 4px 2px; }

/* ── Main column ─────────────────────────────────────────────────────── */
.cd-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  gap: 10px;
  background: transparent;
  height: 100%;
  overflow: hidden;
}
.cd-main--no-pad { gap: 0; }

.cd-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px 4px 14px;
  background: transparent;
  border: 0;
  height: auto;
  flex: 0 0 auto;
}
.cd-crumb { color: var(--cd-ink); font-weight: 500; }
.cd-crumb .sep { color: var(--cd-muted); margin: 0 8px; }
.cd-crumb a { color: var(--cd-muted); cursor: pointer; }
.cd-crumb a:hover { color: var(--cd-ink); }
.cd-top-actions { display: flex; gap: 8px; align-items: center; }

/* Buttons (scoped — override only when inside the new shell) */
.cd-main .btn,
.cd-main button.btn {
  background: var(--cd-panel);
  border: 1px solid var(--cd-line);
  border-radius: var(--r-pill);
  padding: 9px 14px;
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit;
  font-weight: 500;
  color: var(--cd-ink);
  cursor: pointer;
  height: auto;
}
.cd-main .btn:hover { background: #fff; }
.cd-main .btn.dark,
.cd-main .btn.accent {
  background: var(--cd-ink);
  color: #fff;
  border-color: var(--cd-ink);
}
.cd-main .btn.dark:hover,
.cd-main .btn.accent:hover { background: #000; }
.cd-main .btn.sm { padding: 7px 12px; font-size: 13px; }

.cd-icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--r-circle);
  display: grid; place-items: center;
  background: var(--cd-panel);
  border: 1px solid var(--cd-line);
  color: var(--cd-ink-soft);
  cursor: pointer;
}
.cd-icon-btn:hover { background: #fff; }

/* ── Page chrome (eyebrow + title + sub) ─────────────────────────────── */
.cd-page {
  padding: 0 14px 12px;
  position: relative;
  color: var(--cd-ink);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cd-page-head { position: relative; flex: 0 0 auto; }
.cd-page-eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cd-muted);
  padding-bottom: 2px;
}
.cd-page-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: #37352f;
  font-variation-settings: "opsz" 48;
}
.cd-page-title em { font-style: italic; font-weight: 500; color: var(--cd-ink); }
.cd-page-sub {
  color: var(--cd-ink-soft);
  max-width: 720px;
  margin: 0 0 6px;
  font-size: 13px;
}
.cd-page-sub b { color: var(--cd-ink); font-weight: 600; }
.cd-page-sub .dot { display: inline-block; margin: 0 8px; color: var(--cd-muted); }

/* Decorative collage placeholders behind page headers */
.cd-collage {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.cd-collage span {
  position: absolute;
  background: repeating-linear-gradient(135deg, #e9eaea 0 6px, #dedfde 6px 12px);
  box-shadow: 0 8px 24px rgba(20,22,26,.06);
  opacity: 0.4;
  border-radius: 10px;
}
.cd-collage span.s1 { width: 72px; height: 92px; top: 12px; right: 280px; transform: rotate(-10deg); }
.cd-collage span.s2 { width: 84px; height: 110px; top: 0; right: 150px; transform: rotate(8deg); }
.cd-collage span.s3 { width: 68px; height: 86px; top: 40px; right: 30px; transform: rotate(-5deg); }
.cd-page-head > *:not(.cd-collage) { position: relative; z-index: 1; }

/* ── Filter chip row ─────────────────────────────────────────────────── */
.cd-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0 8px;
  flex: 0 0 auto;
}
.cd-chip-tab {
  background: var(--cd-panel);
  border: 1px solid var(--cd-line);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit;
  font-weight: 500;
  color: var(--cd-ink-soft);
  cursor: pointer;
}
.cd-chip-tab:hover { background: #fff; }
.cd-chip-tab.active {
  background: var(--cd-ink);
  color: #fff;
  border-color: var(--cd-ink);
}
.cd-swatch-sm {
  width: 18px; height: 18px;
  border-radius: 5px;
  display: grid; place-items: center;
  font-size: 11px;
  color: #fff;
  flex: 0 0 auto;
}

/* ── Dashboard ───────────────────────────────────────────────────────── */
.cd-dash {
  display: grid;
  grid-template-columns: 1fr 260px;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    "hello hello"
    "stats stats"
    "cal   rail"
    "up    up";
  gap: 18px;
  padding: 4px 8px 14px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 1100px) {
  .cd-dash {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hello"
      "stats"
      "cal"
      "up"
      "rail";
    overflow: auto;
  }
}

.cd-hello-wrap { grid-area: hello; position: relative; min-height: 0; }
.cd-stats { grid-area: stats; }
.cd-cal { grid-area: cal; min-height: 0; }
.cd-upcoming { grid-area: up; }
.cd-rail { grid-area: rail; min-height: 0; }

.cd-eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cd-muted);
  padding: 4px 6px 2px;
}
.cd-hello {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 36px;
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  padding: 0 6px;
  color: #37352f;
  font-variation-settings: "opsz" 60;
}
.cd-hello em { font-style: italic; color: var(--cd-ink); }
.cd-hello-sub {
  padding: 0 6px 4px;
  color: var(--cd-ink-soft);
  max-width: 640px;
  margin: 0;
  font-size: 13px;
}
.cd-hello-sub b { color: var(--cd-ink); font-weight: 600; }

.cd-hello-wrap > *:not(.cd-collage) { position: relative; z-index: 1; }
.cd-hello-wrap .cd-collage { border-radius: var(--r-lg); }
.cd-hello-wrap .cd-collage span.c1 { width: 70px;  height: 90px;  top: 12px; right: 280px; transform: rotate(-12deg); border-radius: 10px; }
.cd-hello-wrap .cd-collage span.c2 { width: 80px;  height: 100px; top: 0;    right: 150px; transform: rotate(8deg);   border-radius: 12px; }
.cd-hello-wrap .cd-collage span.c3 { width: 64px;  height: 84px;  top: 32px; right: 40px;  transform: rotate(-5deg);  border-radius: 10px; }
.cd-hello-wrap .cd-collage span.c4 { display: none; }

.cd-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin: 0;
}
.cd-stat {
  background: var(--cd-panel);
  border-radius: var(--r-md);
  padding: 10px 14px;
  box-shadow: var(--cd-shadow-card);
  display: flex; flex-direction: column; gap: 2px;
  min-height: 0;
  justify-content: space-between;
}
.cd-stat .lbl {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cd-muted);
}
.cd-stat .row { display: flex; align-items: baseline; gap: 8px; }
.cd-stat .big {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 48;
  font-variant-numeric: tabular-nums;
  color: var(--cd-ink);
}
.cd-stat .ctx { color: var(--cd-muted); font-size: 12px; }

/* — Mini calendar (dashboard) — */
.cd-cal {
  background: var(--cd-panel);
  border-radius: var(--r-md);
  padding: 10px 12px;
  box-shadow: var(--cd-shadow-card);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.cd-cal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px 8px;
  gap: 8px;
  flex: 0 0 auto;
}
.cd-cal-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 30;
  color: var(--cd-ink);
  flex: 1;
}
.cd-cal-ctrls { display: flex; gap: 4px; }
.cd-cal-ctrls .btn { padding: 5px 10px; font-size: 12.5px; background: var(--cd-panel-2); border: 1px solid var(--cd-line); }
.cd-cal-ctrls .cd-icon-btn { background: var(--cd-panel-2); width: 28px; height: 28px; }

.cd-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto;                /* dow row sized by content */
  grid-auto-rows: 1fr;                     /* all subsequent week rows equal */
  background: var(--cd-panel-2);
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--cd-line);
  flex: 1 1 auto;
  min-height: 0;
}
.cd-dow {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cd-muted);
  padding: 5px 8px;
  border-bottom: 1px solid var(--cd-line);
  background: var(--cd-panel-2);
}
.cd-cell {
  background: var(--cd-panel-2);
  min-height: 0;
  padding: 4px 6px;
  display: flex; flex-direction: column; gap: 3px;
  border-right: 1px solid var(--cd-line-soft);
  border-bottom: 1px solid var(--cd-line-soft);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.cd-cell:nth-child(7n) { border-right: 0; }
.cd-cell:nth-last-child(-n+7) { border-bottom: 0; }
.cd-cell.dim { background: var(--cd-panel-2); color: var(--cd-muted); }
.cd-cell .num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cd-ink-soft);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.cd-cell.dim .num { color: var(--cd-muted); }
.cd-cell.today { background: #f9efe9; }
.cd-cell.today .num {
  background: var(--cd-ink);
  color: #fff;
  width: 20px; height: 20px;
  border-radius: var(--r-circle);
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
}
.cd-cell .chip {
  background: #f5d6cf;
  color: #6c2418;
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.3;
}
.cd-cell .chip.blue { background: #dde7f0; color: #1c3a55; }

/* — Upcoming list (dashboard) — */
.cd-upcoming {
  background: var(--cd-panel);
  border-radius: var(--r-md);
  padding: 8px 14px 6px;
  box-shadow: var(--cd-shadow-card);
  margin-top: 0;
  max-height: 110px;
  overflow: hidden;
}
.cd-up-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 4px;
}
.cd-up-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 24;
}
.cd-up-open { color: var(--cd-ink-soft); font-weight: 500; cursor: pointer; background: transparent; border: 0; font: inherit; font-weight: 500; font-size: 12.5px; }
.cd-up-open:hover { color: var(--cd-ink); }
.cd-up-list { display: flex; flex-direction: column; }
.cd-up-row {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  border-top: 1px solid var(--cd-line-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12.5px;
}
.cd-up-row:first-child { border-top: 0; }
.cd-up-row:hover { background: var(--cd-panel-2); }
.cd-up-when {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--cd-muted);
}
.cd-up-row .what { font-weight: 500; color: var(--cd-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-tag {
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--cd-panel-2);
  border: 1px solid var(--cd-line);
  color: var(--cd-ink-soft);
  white-space: nowrap;
}
.cd-tag.exam   { background: #f5d6cf; border-color: #eec0b7; color: #6c2418; }
.cd-tag.event  { background: #e3ecf4; border-color: #cfdbe6; color: #1c3a55; }
.cd-tag.assign { background: #eee7d6; border-color: #e0d6bf; color: #5a4a1f; }
.cd-tag.study  { background: #e0eedb; border-color: #cfe0c4; color: #2f4a23; }

/* — Right rail (Up next + tiles) — */
.cd-rail {
  display: flex; flex-direction: column; gap: 10px;
  min-height: 0;
  overflow: hidden;
}
.cd-upnext {
  background: radial-gradient(120% 100% at 100% 0%, #2a2d33 0%, #14161a 60%);
  color: #fff;
  border-radius: var(--r-md);
  padding: 16px 20px;
  min-height: 0;
  display: flex; flex-direction: column; gap: 8px;
  justify-content: space-between;
  box-shadow: var(--cd-shadow-card);
  flex: 1.15 1 0;
}
.cd-upnext .lbl {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9aa0aa;
}
.cd-upnext .ttl {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.06;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 48;
}
.cd-upnext .kind { color: #9aa0aa; font-size: 14.5px; }
.cd-upnext .when { display: flex; align-items: baseline; gap: 10px; }
.cd-upnext .when .num {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 56px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 96;
  font-variant-numeric: tabular-nums;
}
.cd-upnext .when .lab { color: #9aa0aa; font-size: 14.5px; }
.cd-upnext .when .num.today-word {
  font-size: 28px;
  font-variation-settings: "opsz" 40;
}

.cd-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 14px;
  flex: 1.5 1 0;
  min-height: 0;
}
.cd-tile {
  background: var(--cd-panel);
  border-radius: var(--r-md);
  padding: 17px 19px;
  min-height: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: var(--cd-shadow-card);
  transition: transform 0.15s ease;
  cursor: pointer;
  border: 0;
  font: inherit;
  text-align: left;
  color: var(--cd-ink);
  overflow: hidden;
  gap: 10px;
}
.cd-tile:hover { transform: translateY(-1px); }
.cd-tile.dark { background: var(--cd-ink); color: #fff; }
.cd-tile .ic {
  width: 38px; height: 38px;
  border-radius: var(--r-circle);
  background: var(--cd-panel-2);
  display: grid; place-items: center;
  color: var(--cd-ink-soft);
  border: 1px solid var(--cd-line);
  font-size: 18px;
}
.cd-tile.dark .ic {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
  color: #fff;
}
.cd-tile .h {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 24;
  line-height: 1.1;
}
.cd-tile .sub {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cd-muted);
  margin-top: 3px;
}
.cd-tile.dark .sub { color: #9aa0aa; }

.cd-rail-decor { display: none; }

/* ── Library / table ─────────────────────────────────────────────────── */
.cd-table-card {
  background: var(--cd-panel);
  border-radius: var(--r-md);
  box-shadow: var(--cd-shadow-card);
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}
table.cd-guides {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
table.cd-guides thead th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cd-muted);
  font-weight: 500;
  padding: 14px 18px;
  border-bottom: 1px solid var(--cd-line);
  background: var(--cd-panel-2);
}
table.cd-guides thead th.num { width: 48px; text-align: right; color: var(--cd-muted); padding-right: 8px; }
table.cd-guides thead th.right { text-align: right; }
table.cd-guides tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--cd-line-soft);
  vertical-align: middle;
}
table.cd-guides tbody tr:last-child td { border-bottom: 0; }
table.cd-guides tbody tr:hover { background: var(--cd-panel-2); cursor: pointer; }
td.cd-num { text-align: right; color: var(--cd-muted); font-family: var(--mono); font-size: 11.5px; padding-right: 8px; }
td.cd-right { text-align: right; }
.cd-subj { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--cd-ink); }
.cd-title-cell { font-weight: 500; color: var(--cd-ink); }
td.cd-meta { color: var(--cd-muted); font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ── Calendar (full screen) ──────────────────────────────────────────── */
.cd-cal-card {
  background: var(--cd-panel);
  border-radius: var(--r-md);
  padding: 0;
  box-shadow: var(--cd-shadow-card);
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.cd-cal-card .cd-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto;                  /* dow auto, weeks fill remaining */
  grid-auto-rows: 1fr;
  background: var(--cd-panel-2);
  gap: 0;
  border-top: 1px solid var(--cd-line);
  border-radius: 0;
  border: 0;
  flex: 1 1 auto;
  min-height: 0;
}
.cd-cal-card .cd-dow {
  padding: 8px 12px;
  border-right: 1px solid var(--cd-line);
  border-bottom: 0;
}
.cd-cal-card .cd-dow:nth-child(7) { border-right: 0; }
.cd-cal-card .cd-cell {
  background: var(--cd-panel-2);
  min-height: 0;
  padding: 6px 8px;
}
.cd-ev {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.3;
  border-left: 3px solid;
  cursor: pointer;
}
.cd-ev.coral  { background: #fbe5df; color: #6c2418; border-left-color: #d97a64; }
.cd-ev.blue   { background: #e3ecf4; color: #1c3a55; border-left-color: #6a93b9; }
.cd-ev.amber  { background: #f3ead4; color: #5a4a1f; border-left-color: #c9a44a; }
.cd-ev.green  { background: #e0eedb; color: #2f4a23; border-left-color: #7aa766; }

/* ── Notes list ──────────────────────────────────────────────────────── */
.cd-notes-card {
  background: var(--cd-panel);
  border-radius: var(--r-md);
  box-shadow: var(--cd-shadow-card);
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.cd-note-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--cd-line-soft);
  cursor: pointer;
}
.cd-note-row:last-child { border-bottom: 0; }
.cd-note-row:hover { background: var(--cd-panel-2); }
.cd-note-title {
  font-weight: 600;
  color: var(--cd-ink);
  font-size: 15px;
  margin-bottom: 4px;
}
.cd-note-meta {
  color: var(--cd-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cd-note-meta .pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--cd-panel-2);
  border: 1px solid var(--cd-line);
  padding: 2px 8px;
  border-radius: var(--r-xs);
  color: var(--cd-ink-soft);
  font-size: 12px;
  font-weight: 500;
}
.cd-note-meta .pill .cd-swatch-sm { width: 14px; height: 14px; border-radius: 4px; font-size: 9px; }
.cd-note-meta .preview {
  color: var(--cd-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 520px;
}
.cd-note-meta .em { color: var(--cd-muted); font-style: italic; }
.cd-note-ago {
  color: var(--cd-muted);
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
}

/* ── Community ───────────────────────────────────────────────────────── */
.cd-empty {
  background: var(--cd-panel);
  border: 1px dashed var(--cd-line);
  border-radius: var(--r-lg);
  padding: 34px 28px;
  box-shadow: var(--cd-shadow-card);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--cd-ink-soft);
  font-size: 15px;
  text-align: center;
  flex-wrap: wrap;
}
.cd-empty a {
  color: var(--cd-ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.cd-empty a:hover { color: #000; }

.cd-help-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 900px) {
  .cd-help-grid { grid-template-columns: 1fr; }
}
.cd-help-card {
  background: var(--cd-panel);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--cd-shadow-card);
  display: flex; flex-direction: column; gap: 8px;
}
.cd-help-card .lbl {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cd-muted);
}
.cd-help-card .h {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 30;
  color: #37352f;
}
.cd-help-card .b {
  color: var(--cd-ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
}
.cd-help-card .action { margin-top: 6px; }

/* Community body wrapper — scrolls if content overflows */
.cd-community-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Group card list (community detail) */
.cd-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 0;
}
.cd-group-card {
  background: var(--cd-panel);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--cd-shadow-card);
  display: flex; flex-direction: column; gap: 8px;
  cursor: pointer;
  border: 0;
  font: inherit;
  text-align: left;
  color: var(--cd-ink);
}
.cd-group-card:hover { transform: translateY(-1px); }
.cd-group-card .h {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 30;
}
.cd-group-card .meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cd-muted);
}

/* Make the legacy .scroll inside the new shell behave (no nested scroll) */
.cd-main .scroll { overflow: visible; height: auto; flex: initial; }

/* Page content cards — 70% alpha so the icon doodles behind .cd-main
   bleed through faintly. Keeps the warm panel tint but lets the
   background show through. Sidebar, buttons, chips stay solid. */
.cd-stat,
.cd-cal,
.cd-upcoming,
.cd-tile,
.cd-table-card,
.cd-cal-card,
.cd-notes-card,
.cd-empty,
.cd-help-card,
.cd-group-card {
  background: var(--cd-panel-a);
}
.cd-tile.dark { background: var(--cd-ink); }
.cd-upnext { /* dark gradient stays solid */ }

/* ── Skeleton (loading placeholders) ─────────────────────────────────── */
@keyframes sk-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.sk {
  display: block;
  background: linear-gradient(
    90deg,
    rgba(20,22,26,0.045) 0%,
    rgba(20,22,26,0.085) 50%,
    rgba(20,22,26,0.045) 100%
  );
  background-size: 200% 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
  color: transparent;
  user-select: none;
  pointer-events: none;
}
.sk-line   { height: 12px; width: 100%; }
.sk-line.sm { height: 10px; }
.sk-line.lg { height: 16px; }
.sk-line.w70 { width: 70%; }
.sk-line.w50 { width: 50%; }
.sk-line.w40 { width: 40%; }
.sk-line.w30 { width: 30%; }
.sk-row {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--cd-line-soft);
}
.sk-row:last-child { border-bottom: 0; }
.sk-row .sk-line { flex: 1; }
.sk-block {
  padding: 10px 0;
  display: flex; flex-direction: column; gap: 8px;
}
.sk-cell-dot {
  display: inline-block;
  width: 18px; height: 4px;
  border-radius: 2px;
  background: rgba(20,22,26,0.10);
  margin-top: 4px;
}
