/* ============================================================
   ClassTrack — Redesigned Stylesheet
   Neo-brutalist school aesthetic: bold type, warm paper tones,
   strong black borders, vivid accent spots.
   ============================================================ */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --bg:       #f0ece0;       /* warm paper */
  --panel:    #faf7ee;       /* slightly lighter panel */
  --line:     #0f0f0f;       /* near-black border */
  --yellow:   #ffe852;       /* primary accent */
  --teal:     #5de8d8;       /* secondary accent */
  --pink:     #ff4d6d;       /* danger / rose */
  --pink-lt:  #ffd6de;
  --green:    #22c55e;
  --green-lt: #dcfce7;
  --shadow-sm:  3px 3px 0 var(--line);
  --shadow:     4px 4px 0 var(--line);
  --shadow-lg:  6px 6px 0 var(--line);
  --radius:     0px;          /* zero-radius: every corner is square */
  --font:  'Inter', system-ui, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--line);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
.hidden { display: none !important; }
#app { min-height: 100vh; }

/* ── Layout shell ──────────────────────────────────────────── */
.main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  border-bottom: 2px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}
@media (min-width: 600px) { .topbar { padding: 0 24px; height: 60px; } }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-btn {
  border: 0; background: transparent; padding: 0;
  display: flex; align-items: center;
  min-height: 44px;
}
.brand h1 {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.04em;
  line-height: 1;
}
@media (min-width: 480px) { .brand h1 { font-size: 22px; } }

.beta {
  background: var(--yellow);
  border: 2px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--line);
  background: #fff;
  padding: 9px 14px;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  box-shadow: var(--shadow);
  white-space: nowrap;
  min-height: 40px;
  transition: transform .1s ease, box-shadow .1s ease;
}
@media (min-width: 600px) { .button { padding: 10px 16px; font-size: 14px; min-height: 44px; } }
@media (hover: hover) { .button:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); } }
.button:active  { transform: translateY(1px); box-shadow: 2px 2px 0 var(--line); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: var(--shadow); }

.button.yellow { background: var(--yellow); }
.button.teal   { background: var(--teal); }
.button.black  { background: var(--line); color: #fff; box-shadow: var(--shadow); }
.button.black:hover { box-shadow: var(--shadow-lg); }
.button.pink   { background: var(--pink-lt); }
.button.green  { background: var(--green-lt); }

/* Nav links */
.link-btn {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 14px;
  color: #555;
  min-height: 44px;
  transition: color .12s;
  position: relative;
}
.link-btn::after {
  content: '';
  position: absolute;
  bottom: 6px; left: 10px; right: 10px;
  height: 2px;
  background: var(--line);
  transform: scaleX(0);
  transition: transform .15s ease;
}
.link-btn:hover { color: var(--line); }
.link-btn:hover::after { transform: scaleX(.5); }
.link-btn.active { color: var(--line); font-weight: 900; }
.link-btn.active::after { transform: scaleX(1); }
@media (max-width: 399px) { .top-actions .link-btn { display: none; } }

/* ── Page content wrapper ───────────────────────────────────── */
.content {
  padding: 0 16px 48px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}
.content.compact { padding: 0 16px 48px; }
@media (min-width: 600px) { .content, .content.compact { padding: 0 24px 64px; } }
@media (min-width: 900px) { .content, .content.compact { padding: 0 32px 80px; } }

/* ── Page ───────────────────────────────────────────────────── */
.page { padding-top: 24px; }
@media (min-width: 600px) { .page { padding-top: 32px; } }

/* ── Typography ─────────────────────────────────────────────── */
.title {
  font-size: clamp(28px, 6vw, 48px);
  font-weight: 900;
  letter-spacing: -.04em;
  line-height: 1;
  margin: 0 0 6px;
}
.subtitle { color: #555; font-size: 14px; line-height: 1.5; }
@media (min-width: 600px) { .subtitle { font-size: 15px; } }
.label  { font-size: 13px; font-weight: 800; display: block; margin-bottom: 5px; letter-spacing: .01em; }
.small  { font-size: 13px; color: #666; line-height: 1.4; }
.muted  { font-size: 13px; color: #666; font-weight: 700; }

/* ── Page header (used in both pages) ──────────────────────── */
.transactions-head, .assignments-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 20px;
}
.transactions-actions, .assignments-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

/* ── View-mode banner ───────────────────────────────────────── */
.view-mode-banner {
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.view-mode-banner.readonly { background: #f0f7ff; }
.view-mode-banner.admin    { background: #f0fdf4; }
.view-mode-copy { min-width: 0; }
.view-mode-kicker {
  display: inline-flex;
  background: var(--yellow);
  border: 1.5px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}
.view-mode-title   { font-size: 16px; font-weight: 900; line-height: 1.2; }
.view-mode-subtitle { font-size: 13px; color: #555; margin-top: 3px; }

/* ── Sync banner ────────────────────────────────────────────── */
.sync-banner {
  border: 2px solid var(--line);
  background: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 13px;
}
.sync-banner.success { background: var(--green-lt); border-color: var(--green); }
.sync-banner.error   { background: #fff0f3; border-color: var(--pink); }
.sync-banner.info    { background: #eff6ff; }
.sync-banner-copy    { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sync-banner-kicker  { font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: #666; }
.sync-banner-title   { font-size: 13px; font-weight: 800; }
.sync-banner-subtitle { font-size: 12px; color: #666; }
.sync-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Hero stat strip ─────────────────────────────────────────── */
.transaction-hero {
  border: 2px solid var(--line);
  background: var(--line);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  overflow: hidden;
  margin-bottom: 20px;
}
@media (min-width: 600px) { .transaction-hero { grid-template-columns: repeat(4, 1fr); } }

.txn-stat-block {
  padding: 16px 18px;
  border-right: 1px solid #333;
  border-bottom: 1px solid #333;
}
.txn-stat-block:nth-child(even) { border-right: 0; }
@media (min-width: 600px) {
  .txn-stat-block { border-bottom: 0; }
  .txn-stat-block:nth-child(even) { border-right: 1px solid #333; }
  .txn-stat-block:last-child { border-right: 0; }
}
.txn-stat-block .label { color: #888; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.txn-stat-sub { font-size: 11px; color: #666; margin-top: 4px; font-weight: 600; }

.transaction-stat {
  font-size: clamp(20px, 4vw, 30px);
  font-weight: 900;
  letter-spacing: -.03em;
  color: #fff;
  line-height: 1;
}
.transaction-stat.txn-income, .txn-income  { color: #4ade80; }
.transaction-stat.txn-expense, .txn-expense { color: #fb7185; }
.transaction-stat.txn-balance.positive { color: #4ade80; }
.transaction-stat.txn-balance.negative { color: #fb7185; }

/* ── Filter panel ────────────────────────────────────────────── */
.filter-panel {
  border: 2px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 20px;
}

.filter-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sep {
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 8px);
  margin: 12px 0;
  opacity: .2;
}

/* ── Search box ──────────────────────────────────────────────── */
.search-box {
  display: flex;
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}
.search-ico {
  width: 46px;
  display: grid;
  place-items: center;
  background: var(--yellow);
  border-right: 2px solid var(--line);
  flex-shrink: 0;
}
.search-box input {
  border: 0;
  flex: 1;
  padding: 13px 12px;
  font-size: max(16px, 1em);
  background: transparent;
  outline: none;
  min-width: 0;
}
.hotkey { display: none; align-items: center; padding: 0 12px; color: #888; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
@media (min-width: 900px) { .hotkey { display: flex; } }

/* ── Pills / tabs ────────────────────────────────────────────── */
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 2px solid var(--line);
  background: #fff;
  padding: 7px 11px;
  font-weight: 700;
  font-size: 12px;
  min-height: 36px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform .1s, box-shadow .1s;
}
@media (hover: hover) { .pill:hover { transform: translateY(-1px); } }
.pill.active  { background: var(--line); color: #fff; }
.pill.subject { padding-inline: 13px; }
.pill.type    { gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid rgba(0,0,0,.3); display: inline-block; flex-shrink: 0; }
.dot.rose    { background: #f43f5e; }
.dot.teal    { background: #14b8a6; }
.dot.yellow  { background: #eab308; }
.dot.black   { background: var(--line); }

/* ── Grid helpers ────────────────────────────────────────────── */
.grid2 { display: grid; gap: 12px; }
@media (min-width: 480px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.row { display: grid; gap: 14px; }
@media (min-width: 980px) { .row { grid-template-columns: 1.1fr 1.9fr; } }

/* ── Compile range ───────────────────────────────────────────── */
.compile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 12px;
  border: 2px dashed var(--line);
  background: #fffef5;
}
.compile-row .small { flex: 1 1 220px; }

.compiled-list {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}
.compiled-list .entry-card-nested { margin: 0; }


/* ── Inputs ──────────────────────────────────────────────────── */
.input, .select, .textarea {
  width: 100%;
  border: 2px solid var(--line);
  background: #fff;
  padding: 11px 13px;
  font-size: max(16px, 1em);
  outline: none;
  transition: background .12s;
}
.input:focus, .select:focus, .textarea:focus { background: #fffef5; outline: 2px solid var(--yellow); outline-offset: 2px; }
.textarea { resize: vertical; }

/* ── Toolbar row ─────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.assignments-toolbar { flex-wrap: wrap; gap: 8px; }
.filter-state-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1.5px solid var(--line);
  background: #f3f4f6;
  box-shadow: 2px 2px 0 var(--line);
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.filter-state-chip.readonly { background: #eff6ff; }
.filter-state-chip.admin    { background: var(--green-lt); }

/* ── Day group cards ─────────────────────────────────────────── */
.day-groups {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.day-group-card {
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .15s;
}
@media (hover: hover) { .day-group-card:hover { box-shadow: var(--shadow-lg); } }
.day-group-card.open  { box-shadow: var(--shadow-lg); }
.day-group-card.day-hidden { border-style: dashed; opacity: .65; }

/* Clickable header row */
.day-group-main {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
/* Coloured top bar using a pseudo */
.day-group-main::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--yellow) 0%, var(--teal) 50%, var(--pink-lt) 100%);
  opacity: 0;
  transition: opacity .2s;
}
.day-group-card.open .day-group-main::before { opacity: 1; }
@media (hover: hover) { .day-group-main:hover { background: #fdf9ee; } }
.day-group-main:focus-visible { outline: 3px solid var(--yellow); outline-offset: -3px; }
.day-group-card.open .day-group-main { background: #fdf9ee; border-bottom: 2px solid var(--line); }

.day-group-left  { flex: 1; min-width: 0; }
.day-group-kicker {
  display: inline-flex;
  align-items: center;
  background: var(--yellow);
  border: 1.5px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .09em;
  margin-bottom: 8px;
}
.day-title {
  font-size: clamp(15px, 3.5vw, 20px);
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1.15;
  margin-bottom: 4px;
}
.day-subtitle {
  font-size: 12px;
  color: #666;
  font-weight: 600;
}

.day-group-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.day-group-count {
  min-width: 34px; height: 34px;
  background: var(--line);
  color: #fff;
  border: 2px solid var(--line);
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
  padding: 0 8px;
}
.day-group-chev {
  width: 30px; height: 30px;
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: 2px 2px 0 var(--line);
  display: grid;
  place-items: center;
  transition: transform .2s ease;
  flex-shrink: 0;
}
.day-group-card.open .day-group-chev { transform: rotate(180deg); }

.day-group-admin-bar {
  padding: 6px 14px;
  background: #f9f9f9;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
}

.day-group-body {
  padding: 14px;
  background: var(--bg);
  display: grid;
  gap: 10px;
}
@media (min-width: 600px) { .day-group-body { padding: 16px; gap: 12px; } }

/* Entry card grid inside a day */
.day-entry-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 540px) {
  .day-entry-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
@media (min-width: 900px) {
  .day-entry-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}

/* ── Entry cards ─────────────────────────────────────────────── */
.entry-card {
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: row;
  overflow: hidden;
  height: 100%;
  transition: transform .15s, box-shadow .15s;
}
.entry-card-nested { height: 100%; }
@media (hover: hover) {
  .entry-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
}
.entry-card.hidden-entry { opacity: .5; border-style: dashed; }

/* Coloured left accent stripe per type */
.entry-card-accent { width: 4px; flex-shrink: 0; background: #ddd; }
.entry-type-rose   .entry-card-accent { background: #f43f5e; }
.entry-type-teal   .entry-card-accent { background: #0d9488; }
.entry-type-yellow .entry-card-accent { background: #ca8a04; }
.entry-type-black  .entry-card-accent { background: #111; }

.entry-card-body { flex: 1; padding: 14px; min-width: 0; display: flex; flex-direction: column; gap: 0; }
@media (min-width: 480px) { .entry-card-body { padding: 16px; } }

.entry-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.entry-card-headcopy { flex: 1; min-width: 0; }
.entry-card-badges   { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }

.entry-card-kicker {
  display: inline-flex;
  background: #e0f2fe;
  border: 1.5px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 5px;
}

.entry-card-title {
  font-size: 16px;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: -.01em;
  word-break: break-word;
}

.entry-badge {
  border: 1.5px solid var(--line);
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--line);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}
.entry-badge.teal   { background: var(--teal); }
.entry-badge.rose   { background: #fda4af; }
.entry-badge.yellow { background: var(--yellow); }
.entry-badge.black  { background: var(--line); color: #fff; }

.entry-hidden-chip {
  display: inline-flex;
  background: #e5e7eb;
  border: 1.5px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.entry-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 10px;
}
.entry-meta-role {
  background: var(--teal);
  border: 1.5px solid var(--line);
  padding: 1px 6px;
  font-weight: 900;
}
.entry-meta-date { display: inline-flex; align-items: center; gap: 4px; }

.entry-description {
  font-size: 13px;
  color: #333;
  line-height: 1.55;
  margin-bottom: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.entry-highlights { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.highlight-pill {
  border: 1.5px solid var(--line);
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--line);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
}

.youtube-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--line);
  background: #fff;
  padding: 7px 12px;
  font-weight: 800;
  font-size: 12px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  color: var(--line);
  margin-bottom: 10px;
  transition: transform .1s;
}
@media (hover: hover) { .youtube-preview:hover { transform: translateY(-1px); } }

.entry-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.entry-photo {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid var(--line);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  transition: transform .1s;
}
@media (hover: hover) { .entry-photo:hover { transform: translateY(-2px); } }

.entry-card-footer.admin {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #eee;
}
.entry-card-footer.guest { display: none; }
.entry-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.entry-readonly-note {
  display: inline-flex;
  background: #eff6ff;
  border: 1.5px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  border: 2px dashed var(--line);
  background: rgba(255,255,255,.6);
  padding: 40px 24px;
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
  margin-top: 8px;
}
.empty-state p { font-size: 15px; color: #555; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,15,15,.55);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 12px;
  z-index: 200;
  cursor: pointer;
}
.modal {
  border: 2px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  max-width: 520px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  cursor: default;
}
@media (min-width: 480px) { .modal { padding: 24px; } }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}
.modal-title { font-size: 20px; font-weight: 900; letter-spacing: -.03em; }
.modal-close {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  font-size: 20px; font-weight: 900;
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  transition: background .1s;
}
.modal-close:hover { background: var(--pink-lt); }
.modal-row { display: grid; gap: 12px; margin-bottom: 16px; }
@media (min-width: 480px) { .modal-row { grid-template-columns: 1fr 1fr; } }
.modal-full-width { grid-column: 1 / -1; }
.button-group { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* ── Confirm dialog (neo-brutalist) ──────────────────────────── */
.confirm-overlay {
  z-index: 300;
}
.confirm-modal {
  max-width: 380px;
  text-align: center;
  border: 3px solid var(--line);
  box-shadow: 6px 6px 0 var(--line);
  background: #fff;
  padding: 32px 28px 24px;
}
.confirm-icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 16px;
}
.confirm-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.03em;
  margin-bottom: 8px;
}
.confirm-subtext {
  font-size: 14px;
  color: #555;
  margin-bottom: 24px;
  font-weight: 600;
}
.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.confirm-yes {
  min-width: 140px;
  font-size: 15px;
  padding: 12px 20px;
  border-width: 2.5px;
  box-shadow: 3px 3px 0 var(--line);
}
.confirm-no {
  min-width: 100px;
  font-size: 15px;
  padding: 12px 20px;
  border-width: 2.5px;
  box-shadow: 3px 3px 0 var(--line);
}

/* ── Bulk transaction select ─────────────────────────────────── */
.txn-bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 2px solid var(--line);
  background: #f8f7f0;
  box-shadow: 2px 2px 0 var(--line);
  margin-bottom: 4px;
}
.txn-checkbox-col {
  width: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: transparent;
}
.txn-checkbox {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--line);
  background: #fff;
  box-shadow: 2px 2px 0 var(--line);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background .1s, border-color .1s;
}
.txn-checkbox.checked {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.txn-checkbox svg { width: 14px; height: 14px; stroke-width: 3; }
.transaction-card.txn-selected {
  border-color: var(--teal);
  background: #f0fdf9;
  box-shadow: 3px 3px 0 var(--teal);
}
.transaction-card[data-action="txn-toggle-select"] {
  cursor: pointer;
}
.transaction-card[data-action="txn-toggle-select"]:hover {
  transform: translateY(-1px);
}

/* ── Auth modal ──────────────────────────────────────────────── */
.auth-modal { max-width: 400px; }
.auth-error { color: var(--pink); font-weight: 800; font-size: 13px; }

/* ── Entry editor modal ──────────────────────────────────────── */
.entry-editor-modal { max-width: 1060px; }
.entry-editor-head  { margin-bottom: 16px; }
.entry-editor-eyebrow {
  display: inline-flex;
  background: var(--yellow);
  border: 1.5px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 7px;
}

.entry-editor-shell { display: grid; gap: 16px; }
@media (min-width: 960px) {
  .entry-editor-shell { grid-template-columns: minmax(0, 1.4fr) minmax(260px, .9fr); align-items: start; }
}
.entry-editor-form { display: grid; gap: 12px; }

.editor-section {
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px;
}
@media (min-width: 600px) { .editor-section { padding: 16px; } }
.editor-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.editor-section-title { font-size: 17px; font-weight: 900; margin-top: 2px; letter-spacing: -.02em; }
.editor-section-chip {
  display: inline-flex;
  background: var(--green-lt);
  border: 1.5px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.editor-section-chip.subtle { background: #eff6ff; }

.editor-grid { margin-bottom: 0; }
.editor-field-full .textarea { min-height: 130px; }
.extras-grid { gap: 12px; }

/* Preview pane */
.entry-editor-preview { position: relative; }
.entry-preview-card {
  border: 2px solid var(--line);
  background: linear-gradient(160deg, #fff 0%, #fdf8eb 100%);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  display: grid;
  gap: 10px;
}
@media (min-width: 960px) { .entry-preview-card { position: sticky; top: 12px; } }
.entry-preview-top    { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.entry-preview-type   { display: inline-flex; background: var(--yellow); border: 1.5px solid var(--line); box-shadow: 2px 2px 0 var(--line); padding: 3px 8px; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.entry-preview-type.teal { background: var(--teal); }
.entry-preview-type.rose { background: #fda4af; }
.entry-preview-type.black { background: var(--line); color: #fff; }
.entry-preview-date   { font-size: 11px; font-weight: 700; color: #666; text-transform: uppercase; letter-spacing: .05em; }
.entry-preview-title  { font-size: 22px; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; }
.entry-preview-meta   { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11px; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: .04em; }
.entry-preview-description { font-size: 13px; color: #333; line-height: 1.55; }
.entry-preview-pills  { display: flex; flex-wrap: wrap; gap: 6px; }
.entry-preview-empty  { border: 1.5px dashed var(--line); background: rgba(255,255,255,.7); padding: 10px; font-size: 12px; font-weight: 700; color: #666; }
.entry-preview-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-top: 1px solid #ddd; padding-top: 10px; font-size: 12px; font-weight: 700; color: #666; }
.entry-preview-note   { border: 1.5px solid var(--line); background: #eff6ff; box-shadow: 2px 2px 0 var(--line); padding: 8px 10px; font-size: 12px; font-weight: 700; margin-top: 8px; }
.entry-editor-actions { margin-top: 0; }

/* ── Upload area ─────────────────────────────────────────────── */
.upload-area { margin-top: 10px; }
.upload-button { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.upload-progress {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 10px;
  background: #eff6ff;
  border: 1.5px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  right: 14px; bottom: 20px;
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  z-index: 300;
  max-width: 300px;
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.error   { background: var(--pink); color: #fff; }
.toast.success { background: #4ade80; }
@supports (padding: env(safe-area-inset-bottom)) {
  .toast { bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px)); right: max(14px, env(safe-area-inset-right)); }
}

/* ── Transaction list cards ──────────────────────────────────── */
.transaction-list { display: grid; gap: 16px; margin-top: 4px; }

.txn-date-group { display: grid; gap: 10px; }
.txn-date-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border: 2px solid var(--line);
  background: #f3f4f6;
  box-shadow: 2px 2px 0 var(--line);
}
.txn-date-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.txn-date-summary { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.txn-day-pill {
  font-size: 11px;
  font-weight: 900;
  padding: 3px 8px;
  border: 1.5px solid transparent;
}
.txn-day-pill.income  { background: var(--green-lt); color: #166534; border-color: var(--green); }
.txn-day-pill.expense { background: #fee2e2; color: #991b1b; border-color: #dc2626; }
.txn-day-count {
  font-size: 11px;
  font-weight: 800;
  color: #555;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.txn-date-items { display: grid; gap: 10px; }

.transaction-card {
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  overflow: hidden;
  transition: transform .12s, box-shadow .12s;
}
@media (hover: hover) { .transaction-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); } }

.txn-card-stripe { width: 4px; flex-shrink: 0; background: #ccc; }
.transaction-card.income .txn-card-stripe  { background: var(--green); }
.transaction-card.expense .txn-card-stripe { background: var(--pink); }

.transaction-card-body { flex: 1; padding: 14px; min-width: 0; }

.transaction-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.txn-name-row { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.txn-avatar {
  width: 38px; height: 38px;
  border: 2px solid var(--line);
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--line);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 12px;
  flex-shrink: 0;
  letter-spacing: 0;
}
.txn-name { font-weight: 800; font-size: 15px; line-height: 1.2; }
.transaction-date { font-size: 11px; font-weight: 700; color: #666; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

.txn-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.transaction-amount { font-size: clamp(16px, 3vw, 22px); font-weight: 900; letter-spacing: -.03em; }
.transaction-amount.income  { color: #16a34a; }
.transaction-amount.expense { color: #dc2626; }

.txn-type-badge {
  font-size: 10px;
  font-weight: 900;
  padding: 2px 7px;
  border: 1.5px solid transparent;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.txn-type-badge.income  { background: var(--green-lt); color: #166534; border-color: var(--green); }
.txn-type-badge.expense { background: #fee2e2; color: #991b1b; border-color: #dc2626; }

.txn-note { margin-top: 8px; font-size: 13px; color: #555; }
.transaction-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid #eee; }

/* ── Transaction form card ───────────────────────────────────── */
.transaction-form-card {
  border: 2px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 20px;
}
.readonly-card { background: #f0f7ff; }
.readonly-panel { display: grid; gap: 14px; margin-top: 12px; }
.readonly-copy  { color: #444; font-size: 14px; font-weight: 600; }
.readonly-grid  { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
.readonly-metric { border: 2px solid var(--line); background: #fff; box-shadow: var(--shadow-sm); padding: 12px; }
.readonly-value  { font-size: clamp(22px, 5vw, 32px); font-weight: 900; letter-spacing: -.03em; margin-top: 4px; }
.readonly-value.positive { color: #16a34a; }
.readonly-value.negative { color: #dc2626; }

/* ── Transaction filter ──────────────────────────────────────── */
.txn-filter-row { display: grid; gap: 14px; margin-top: 14px; }
@media (min-width: 700px) { .txn-filter-row { grid-template-columns: auto 1fr; align-items: start; } }

.txn-type-toggle { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.txn-type-btn {
  border: 2px solid var(--line);
  background: #fff;
  padding: 9px 14px;
  font-weight: 800;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  min-height: 42px;
  transition: transform .1s, box-shadow .1s;
}
.txn-type-btn:hover { transform: translateY(-1px); }
.txn-type-btn:active { transform: translateY(1px); }
.txn-type-btn.active.income  { background: var(--green-lt); border-color: var(--green); box-shadow: 3px 3px 0 var(--green); }
.txn-type-btn.active.expense { background: #fee2e2; border-color: #dc2626; box-shadow: 3px 3px 0 #dc2626; }
.txn-type-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.txn-dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid rgba(0,0,0,.3); display: inline-block; flex-shrink: 0; }
.txn-dot.income  { background: var(--green); }
.txn-dot.expense { background: var(--pink); }

/* Date range with icon */
.date-range { display: grid; gap: 10px; }
@media (min-width: 600px) { .date-range { grid-template-columns: 1fr 1fr; } }
.date-field {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  min-height: 58px;
  transition: transform .1s;
}
@media (hover: hover) { .date-field:hover { transform: translateY(-1px); } }
.date-ico { width: 34px; height: 34px; display: grid; place-items: center; border: 2px solid var(--line); background: var(--yellow); box-shadow: 2px 2px 0 var(--line); flex-shrink: 0; }
.date-field-text { display: flex; flex-direction: column; gap: 2px; font-weight: 900; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; min-width: 0; }
.date-input { border: 0; outline: none; background: transparent; padding: 0; font-weight: 700; font-size: 14px; width: 100%; }

/* ── Amount input ────────────────────────────────────────────── */
.amount-input-wrap { display: flex; border: 2px solid var(--line); background: #fff; overflow: hidden; }
.amount-prefix { display: grid; place-items: center; padding: 0 12px; border-right: 2px solid var(--line); background: var(--yellow); font-weight: 900; font-size: 16px; flex-shrink: 0; }
.amount-input { border: 0 !important; flex: 1; min-width: 0; background: transparent; }

/* ── Student selector ────────────────────────────────────────── */
.student-selector-frame { display: grid; gap: 8px; }
.student-selector-trigger {
  border: 2px solid var(--line);
  background: #fff;
  padding: 11px 14px;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow);
  width: 100%;
  text-align: left;
  min-height: 44px;
  transition: transform .1s, box-shadow .1s;
}
.student-selector-trigger:hover:not(:disabled) { transform: translateY(-1px); }
.student-selector-trigger:active:not(:disabled) { transform: translateY(1px); }
.student-selector-trigger:disabled { opacity: .5; cursor: not-allowed; }
.student-selector-text   { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-selector-arrow  { display: grid; place-items: center; flex-shrink: 0; width: 18px; height: 18px; transition: transform .2s; }
.student-selector-trigger.active .student-selector-arrow { transform: rotate(180deg); }

.student-selector-grid {
  border: 2px solid var(--line);
  border-top: 0;
  background: #fafaf7;
  padding: 10px;
  display: grid;
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
}

.selector-letter-group { display: grid; gap: 8px; }
.selector-letter-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #888;
  background: #fafaf7;
  padding: 2px 0 4px;
  border-bottom: 1.5px solid var(--line);
}
.selector-letter-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}
@media (min-width: 480px) { .selector-letter-items { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; } }

.student-selector-item {
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
  min-height: 96px;
  justify-content: center;
  transition: transform .1s, box-shadow .1s;
  cursor: pointer;
}
.student-selector-item:hover    { transform: translateY(-2px); box-shadow: var(--shadow); }
.student-selector-item:active   { transform: translateY(0); }
.student-selector-item.selected { background: var(--green-lt); border-color: var(--green); box-shadow: 3px 3px 0 var(--green); }

.selector-avatar {
  width: 30px; height: 30px;
  border: 2px solid var(--line);
  background: var(--line);
  color: var(--yellow);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
  flex-shrink: 0;
}
.student-selector-item.selected .selector-avatar { background: var(--green); border-color: var(--green); }
.selector-name { font-size: 10px; font-weight: 800; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ── Name chips (suggestions) ────────────────────────────────── */
.name-suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.name-chip {
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  padding: 6px 10px;
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform .1s;
}
.name-chip:hover { transform: translateY(-1px); }
.name-chip-avatar {
  width: 22px; height: 22px;
  background: var(--line); color: var(--yellow);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 9px; font-weight: 900; flex-shrink: 0;
}

/* ── Misc utility / status ───────────────────────────────────── */
.card-date   { color: #999; font-size: 12px; font-weight: 700; }
.entry-top   { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }

/* ── Safe area insets ────────────────────────────────────────── */
@supports (padding: env(safe-area-inset-top)) {
  .topbar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .content, .content.compact { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .modal-backdrop { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Mobile overrides (≤ 700px) ──────────────────────────────── */
@media (max-width: 700px) {
  .transactions-head,
  .assignments-head   { flex-direction: column; align-items: stretch; }
  .transactions-actions,
  .assignments-actions { width: 100%; }
  .transactions-actions .button,
  .assignments-actions .button { width: 100%; justify-content: center; }

  .view-mode-banner   { flex-direction: column; align-items: stretch; }
  .view-mode-banner .button { width: 100%; justify-content: center; }

  .filter-topline { flex-direction: column; align-items: stretch; }
  .filter-topline .button { width: 100%; justify-content: center; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .button { width: 100%; justify-content: center; }

  .transaction-card-head { flex-direction: column; }
  .txn-right { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }

  .transaction-hero    { grid-template-columns: 1fr 1fr; }
  .txn-filter-row      { grid-template-columns: 1fr; }
  .readonly-grid       { grid-template-columns: 1fr; }

  .day-group-main   { padding: 14px; }
  .day-group-body   { padding: 12px; }

  .filter-state-chip,
  .entry-readonly-note { width: 100%; justify-content: center; text-align: center; }

  .name-chip, .pill, .student-selector-trigger { width: 100%; justify-content: center; }
  .student-selector-frame { display: grid; gap: 8px; }
  .selector-letter-items  { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }

  .entry-card-footer.admin { }
  .transaction-form-card, .entry-card-body, .transaction-card-body { padding: 12px; }
  .modal { padding: 16px; }
}

/* ── Admin indicator in topbar ───────────────────────────────── */
.admin-indicator {
  display: inline-flex;
  align-items: center;
  background: #dcfce7;
  border: 2px solid #22c55e;
  box-shadow: 2px 2px 0 #22c55e;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #166534;
  animation: adminPop .3s ease;
}
@keyframes adminPop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── Bulk student selection ──────────────────────────────────── */
.bulk-selected-container {
  margin-bottom: 10px;
  padding: 10px;
  border: 2px dashed var(--line);
  background: #fff;
  min-height: 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.bulk-student-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--green-lt);
  border: 1.5px solid var(--green);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}
.bulk-chip-remove {
  background: transparent;
  border: 0;
  padding: 0;
  font-weight: 900;
  color: #166534;
  line-height: 1;
  font-size: 14px;
  cursor: pointer;
}
.bulk-chip-remove:hover { color: var(--pink); }
.bulk-selected-count { font-size: 11px; color: #666; margin-top: 6px; width: 100%; font-weight: 600; }
.bulk-empty-hint { color: #888; font-size: 13px; padding: 4px 0; }

/* ── Filter state / result chips ────────────────────────────── */
.filter-active-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 8px 12px;
  background: #eff6ff;
  border: 1.5px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
  font-size: 13px;
  font-weight: 700;
}

/* ── Assignments page: remove extra margin from filter panel ── */
.page .filter-panel { margin-top: 0; }
.page .sync-banner  { margin-bottom: 14px; }
.page .view-mode-banner { margin-bottom: 14px; }
.page .transaction-hero { margin-bottom: 16px; }

/* ── "No results" toolbar result counter ─────────────────────── */
.result-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #555;
}

/* ── Section gaps on page ───────────────────────────────────── */
.page > * + * { margin-top: 14px; }
.page > .transaction-hero { margin-top: 0; }
.page > .transactions-head, .page > .assignments-head { margin-top: 0; }

/* ══════════════════════════════════════════════════════════════
   FIXES: chevron clicks, compact filters, Supabase view
   ══════════════════════════════════════════════════════════════ */

/* FIX: chevron and its SVG must never capture pointer events —
   clicks always pass through to the parent <button> */
.day-group-chev,
.day-group-chev svg,
.day-group-count,
.day-group-kicker,
.day-group-left *,
.day-group-right * { pointer-events: none; }

/* ── Compact scrollable subject chip strip ───────────────────── */
.subject-scroll-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  padding-bottom: 4px;
  /* hide scrollbar on webkit but keep scrollability */
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin: 0 -16px;     /* bleed to panel edge */
  padding: 0 16px 6px;
}
.subject-scroll-row::-webkit-scrollbar { display: none; }

.subject-chip {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
  border: 2px solid var(--line);
  background: #fff;
  padding: 5px 11px;
  font-weight: 700;
  font-size: 12px;
  min-height: 32px;
  box-shadow: 2px 2px 0 var(--line);
  transition: transform .1s, background .1s;
  cursor: pointer;
}
.subject-chip:hover  { transform: translateY(-1px); background: #fdf9ee; }
.subject-chip.active { background: var(--line); color: #fff; box-shadow: 2px 2px 0 #555; }

/* Tighten the filter panel overall — less vertical padding */
.filter-panel { padding: 12px 16px; }
@media (min-width: 600px) { .filter-panel { padding: 14px 18px; } }

/* Remove the top margin from the search box inside filter panel
   (the sep divider provides enough breathing room) */
.filter-panel .search-box { margin-top: 0; }
.filter-panel .sep { margin: 10px 0 10px; }

/* Remove date inputs from the filter panel completely on mobile —
   show as a compact collapsed row */
.date-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

/* Compact the filter-topline on mobile */
@media (max-width: 600px) {
  .filter-topline { margin-bottom: 10px; }
  .filter-topline > div:first-child .small { display: none; } /* hide description text on mobile */
}

/* ══════════════════════════════════════════════════════════════
   INLINE ENTRY FORM (replaces modal)
   ══════════════════════════════════════════════════════════════ */

.entry-form-panel {
  border: 2px solid var(--line);
  background: #fffef5;
  box-shadow: var(--shadow-lg);
  padding: 18px;
  margin-bottom: 16px;
  animation: slideDown .2s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.entry-form-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--line);
}
.entry-form-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.03em;
  margin-top: 4px;
}

.entry-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 540px) {
  .entry-form-grid { grid-template-columns: 1fr; }
}
.entry-form-full {
  grid-column: 1 / -1;
}

.entry-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 2px solid var(--line);
}
@media (max-width: 480px) {
  .entry-form-actions .button { flex: 1; justify-content: center; }
}

.entry-image-upload {
  border: 2px dashed var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  padding: 12px;
  display: grid;
  gap: 10px;
}
.entry-image-input {
  background: #f9fafb;
}
.entry-image-upload-copy {
  display: grid;
  gap: 6px;
}
.uploading-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--line);
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--line);
  padding: 4px 8px;
  width: fit-content;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.entry-photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}
.entry-photo-preview {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 2px solid var(--line);
  box-shadow: var(--shadow-sm);
  background: #fff;
}

/* ══════════════════════════════════════════════════════════════
   DAY GROUPS — compact grid, all collapsed by default
   ══════════════════════════════════════════════════════════════ */

.day-groups {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .day-groups { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1100px) {
  .day-groups { grid-template-columns: repeat(3, 1fr); }
}

/* When a day is open it should span full width */
.day-group-card.open {
  grid-column: 1 / -1;
}

/* Tighter header since cards are smaller in grid */
.day-group-main { padding: 14px 16px; }
.day-title { font-size: clamp(14px, 2.5vw, 18px); }
.day-subtitle { font-size: 11px; }

/* Type dot badges inside subtitle */
.day-subtitle { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.day-dot {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 800;
  border: 1.5px solid var(--line);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.day-dot.assignment { background: #fda4af; }
.day-dot.activity   { background: var(--teal); }
.day-dot.quiz       { background: var(--yellow); }
.day-dot.note       { background: #e0f2fe; }

/* ══════════════════════════════════════════════════════════════
   FIX: pointer-events on chevron button — only the visual
   SPANS inside the header should be non-interactive, not
   buttons in the admin bar.
   ══════════════════════════════════════════════════════════════ */

/* Only target the visual spans that are direct children of the toggle button */
.day-group-main > .day-group-left,
.day-group-main > .day-group-left *,
.day-group-main > .day-group-right,
.day-group-main > .day-group-right * {
  pointer-events: none;
}

/* Admin bar buttons must remain clickable */
.day-group-admin-bar button,
.day-group-admin-bar button * {
  pointer-events: auto;
}

/* Entry card grid inside open day — responsive */
.day-entry-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .day-entry-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
