/* ============================================================
   The Case Tracker — Design System
   Editorial · Warm · Quiet
   Palette: Cream + Petrol + Brass
   Sibling to The Docket; clone the structure.
   ============================================================ */

:root {
  /* Palette — cream ground, petrol primary, brass accent */
  --bg:        #F4ECDA;
  --bg-soft:   #E9DFC0;
  --surface:   #FFFFFF;
  --surface-2: #FCF5E2;
  --ink:       #1F1F1F;
  --ink-2:     #3A3A3A;
  --muted:     #6E6E6E;
  --muted-2:   #9A9285;
  --line:      #D9D0B4;
  --line-2:    #C5B998;
  --petrol:    #1F3F4E;
  --petrol-d:  #16313D;
  --brass:     #B0884C;
  --brass-d:   #8E6B36;
  --brass-soft:#D7BD8A;
  --accent:    var(--petrol);

  /* Status colors */
  --urgent:    #B65644;
  --warn:      #B89125;

  /* Semantic status (bg / fg) — flips in dark mode */
  --success-bg: #E3EFD9;
  --success-fg: #4A7C3A;
  --warn-bg:    #FFF3CD;
  --warn-fg:    #856404;
  --danger-bg:  #FEF2F2;
  --danger-fg:  #991B1B;
  --info-bg:    #E0EAEF;
  --info-fg:    #356477;
  --neutral-bg: #ECECEC;
  --neutral-fg: #666666;
  --dormant-bg: #F1ECDC;
  --dormant-fg: #8B8270;
  --closed-bg:  #F0E0DC;
  --closed-fg:  #884730;

  /* Primary button (petrol bg + cream text) */
  --btn-primary-bg: var(--petrol);
  --btn-primary-fg: #F4ECDA;

  /* Typography */
  --serif: "Fraunces", "Times New Roman", Georgia, ui-serif, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  /* Spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px;

  /* Radius */
  --r-1: 6px; --r-2: 12px; --r-3: 20px;

  /* Shadow */
  --shadow-1: 0 1px 2px rgba(27,23,20,.05), 0 4px 12px rgba(27,23,20,.05);
  --shadow-2: 0 4px 16px rgba(27,23,20,.08), 0 12px 40px rgba(27,23,20,.10);
}

/* Dark mode — petrol becomes ground, brass takes over as primary action */
body.theme-dark {
  --bg:        #082024;
  --bg-soft:   #0E2E34;
  --surface:   #143842;
  --surface-2: #1A4250;
  --ink:       #F4ECDA;
  --ink-2:     #D9D0B4;
  --muted:     #9A9285;
  --muted-2:   #6E6E6E;
  --line:      #1F4754;
  --line-2:    #2C5A6B;
  --petrol:    #F4ECDA;
  --petrol-d:  #D9D0B4;
  --brass:     #D7BD8A;
  --brass-d:   #B0884C;
  --accent:    #D7BD8A;
  --success-bg: #1F3D2A;
  --success-fg: #9DC58B;
  --warn-bg:    #3A2F1C;
  --warn-fg:    #E5C895;
  --danger-bg:  #3A2424;
  --danger-fg:  #E89B9B;
  --info-bg:    #1A3540;
  --info-fg:    #9DBED0;
  --neutral-bg: #1A3540;
  --neutral-fg: #B0AC9F;
  --dormant-bg: #213C44;
  --dormant-fg: #C0B5A0;
  --closed-bg:  #3A2A24;
  --closed-fg:  #DBA89A;
  --btn-primary-bg: #D7BD8A;
  --btn-primary-fg: #082024;
}
@media (prefers-color-scheme: dark) {
  body:not(.theme-light) {
    --bg:        #082024;
    --bg-soft:   #0E2E34;
    --surface:   #143842;
    --surface-2: #1A4250;
    --ink:       #F4ECDA;
    --ink-2:     #D9D0B4;
    --muted:     #9A9285;
    --muted-2:   #6E6E6E;
    --line:      #1F4754;
    --line-2:    #2C5A6B;
    --petrol:    #F4ECDA;
    --petrol-d:  #D9D0B4;
    --brass:     #D7BD8A;
    --brass-d:   #B0884C;
    --accent:    #D7BD8A;
    --success-bg: #1F3D2A;
    --success-fg: #9DC58B;
    --warn-bg:    #3A2F1C;
    --warn-fg:    #E5C895;
    --danger-bg:  #3A2424;
    --danger-fg:  #E89B9B;
    --info-bg:    #1A3540;
    --info-fg:    #9DBED0;
    --neutral-bg: #1A3540;
    --neutral-fg: #B0AC9F;
    --dormant-bg: #213C44;
    --dormant-fg: #C0B5A0;
    --closed-bg:  #3A2A24;
    --closed-fg:  #DBA89A;
    --btn-primary-bg: #D7BD8A;
    --btn-primary-fg: #082024;
  }
}

/* Reset */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Tappable utility (iOS niceties) ── */
.tappable, button, .iconbtn, .util-link, .case-card, .docket-card, .chip, .beat-chip, .case-tag, .filter-chip {
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0,0,0,.05);
  touch-action: manipulation;
  user-select: none;
}

/* ── View management ── */
.view { display: none; min-height: 100dvh; }
.view.active { display: block; }

/* ── Login ── */
.login {
  max-width: 360px;
  margin: 0 auto;
  padding: 18vh var(--s-5) var(--s-6);
}
.login__brand { text-align: center; margin-bottom: var(--s-7); }
.brand__name {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--petrol);
}
.login__title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  margin: 0 0 var(--s-2);
  color: var(--ink);
}
.login__sub {
  color: var(--muted);
  margin: 0 0 var(--s-5);
  font-size: 15px;
}
.login__form { display: flex; flex-direction: column; gap: var(--s-3); }
.login__form input {
  font-family: var(--sans);
  font-size: 18px;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line-2);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.login__form input:focus { border-color: var(--brass); }
.login__btn {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  padding: var(--s-3) var(--s-4);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border: none;
  border-radius: var(--r-1);
}
.login__btn:hover { filter: brightness(0.92); }
.login__alt {
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  padding: var(--s-2);
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 3px;
}
.login__alt:hover { color: var(--brass-d); text-decoration-color: var(--brass); }
.login__error {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--urgent);
  margin-top: var(--s-2);
  text-align: center;
}

/* ── Top bar ── */
.topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
  position: sticky;
  top: 0;
  z-index: 10;
  transform: translateZ(0);
  will-change: transform;
}
.topbar__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--s-3) var(--s-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
@media (max-width: 640px) {
  .topbar__inner { padding: var(--s-3) var(--s-4); }
}
.brand {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  min-width: 0;
}
.brand__home {
  background: none;
  border: none;
  padding: 0;
}
.topbar__nav { display: flex; gap: var(--s-1); }

.iconbtn {
  background: none;
  border: none;
  color: var(--ink);
  padding: var(--s-2);
  border-radius: var(--r-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.iconbtn:hover { background: var(--bg-soft); }
.iconbtn.active { color: var(--brass); }

/* ── Main pane ── */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--s-5) var(--s-5) var(--s-8);
}
@media (max-width: 640px) {
  .main { padding: var(--s-4) var(--s-4) var(--s-8); }
}
.pane { animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.loader, .empty {
  text-align: center;
  color: var(--muted);
  padding: var(--s-7) var(--s-4);
  font-family: var(--sans);
  font-size: 14px;
}

/* ============================================================
   CASES list view
   ============================================================ */
.cases-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.cases-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.cases-add-btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: var(--s-2) var(--s-4);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border: none;
  border-radius: var(--r-1);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cases-add-btn:hover { filter: brightness(0.92); }

/* Filter rail: status chips + beat chips */
.filter-rail {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.filter-row {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
}
.filter-row--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.filter-row--scroll::-webkit-scrollbar { display: none; }
.filter-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

.chip, .filter-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 100px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color .12s, background .12s, color .12s;
}
.chip:hover, .filter-chip:hover { border-color: var(--line-2); }
.chip.active, .filter-chip.active {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border-color: var(--btn-primary-bg);
}
.chip__count {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.75;
}

/* Beat chip — colored swatch + label */
.beat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  white-space: nowrap;
}
.beat-chip::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--beat-color, var(--muted));
  flex-shrink: 0;
}
.beat-chip.active {
  background: var(--beat-color, var(--petrol));
  color: #FFF;
  border-color: var(--beat-color, var(--petrol));
}
.beat-chip.active::before { background: rgba(255,255,255,0.7); }

/* Search box */
.searchwrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}
.searchwrap input {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.searchwrap input:focus { border-color: var(--brass); }
.searchwrap__icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}

/* Cases grid */
.cases-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
}
@media (min-width: 720px) {
  .cases-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

.case-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: var(--s-4);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  position: relative;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  color: var(--ink);
  text-decoration: none;
}
.case-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
  border-color: var(--line-2);
  text-decoration: none;
}
.case-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-2);
}
.case-card__title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
}
.case-card__unseen {
  flex-shrink: 0;
  background: var(--brass);
  color: #FFF;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: 0.02em;
  min-width: 22px;
  text-align: center;
}
.case-card__meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-3);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}
.case-card__meta-row strong { color: var(--ink-2); font-weight: 600; }
.case-card__docket {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.case-card__court {
  font-weight: 600;
  color: var(--ink);
}
.case-card__casenum {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
}
.case-card__judge {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}
.case-card__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-1);
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted-2);
}
.case-card__priority {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  font-size: 10px;
}
.case-card__priority.high   { color: var(--urgent); }
.case-card__priority.medium { color: var(--brass-d); }
.case-card__priority.low    { color: var(--muted); }
.case-card__priority::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Status badge */
.status-badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 100px;
}
.status-badge.active   { background: var(--success-bg); color: var(--success-fg); }
.status-badge.dormant  { background: var(--dormant-bg); color: var(--dormant-fg); }
.status-badge.closed   { background: var(--closed-bg);  color: var(--closed-fg); }

/* ============================================================
   CASE detail view
   ============================================================ */
.detail-back {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  padding: 0;
  margin-bottom: var(--s-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.detail-back:hover { color: var(--ink); }

.detail-head {
  margin-bottom: var(--s-5);
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--s-4);
}
.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}
.detail-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  margin: 0;
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: -0.015em;
  flex: 1;
  min-width: 0;
}
.detail-title-input {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.15;
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  color: var(--ink);
  padding: 0;
  letter-spacing: -0.015em;
}
.detail-edit-btn,
.detail-delete-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--r-1);
  flex-shrink: 0;
}
.detail-edit-btn:hover { color: var(--brass-d); border-color: var(--brass); }
.detail-delete-btn:hover { color: var(--urgent); border-color: var(--urgent); }

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-3);
  align-items: center;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
}
.detail-meta-row select,
.detail-meta-row .beat-chip {
  font-family: var(--sans);
  font-size: 13px;
}
.detail-meta-row select {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--ink);
}

/* Detail sections */
.detail-section {
  margin-bottom: var(--s-6);
}
.detail-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-2);
  border-bottom: 2px solid var(--ink);
  padding-bottom: var(--s-2);
  margin-bottom: var(--s-3);
}
.detail-section-title {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
}
.detail-section-action {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--brass-d);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--r-1);
}
.detail-section-action:hover { background: var(--bg-soft); color: var(--brass-d); }

/* Docket sub-cards */
.docket-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.docket-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: var(--s-3) var(--s-4);
}
.docket-card__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-2) var(--s-3);
  margin-bottom: var(--s-1);
}
.docket-card__court {
  font-family: var(--sans);
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
}
.docket-card__casenum {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 4px;
}
.docket-card__cl-link {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--brass-d);
  margin-left: auto;
}
.docket-card__judge {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  margin-bottom: var(--s-1);
}
.docket-card__judge strong { color: var(--ink-2); font-weight: 600; }
.docket-card__parties {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
  margin-top: var(--s-1);
  line-height: 1.4;
}
.docket-card__parties-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 4px;
}
.docket-card__parties-toggle {
  background: none;
  border: none;
  color: var(--brass-d);
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
  padding: 0 4px;
}
.docket-card__parties-toggle:hover { text-decoration: underline; }
.docket-card__alert-row {
  margin-top: var(--s-2);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}
.docket-card__alert-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.docket-card__alert-status.on { color: var(--success-fg); }
.docket-card__alert-status.on::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success-fg);
}

/* Entry list */
.entry-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.entry-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: var(--s-3);
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: var(--s-3);
  align-items: start;
}
.entry-row__date {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.entry-row__num {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--brass-d);
  background: var(--bg-soft);
  padding: 0 5px;
  border-radius: 3px;
  margin-right: 4px;
}
.entry-row__desc {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}

/* Empty state inside section */
.section-empty {
  background: var(--surface-2);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-1);
  padding: var(--s-4);
  text-align: center;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
}
.section-empty button {
  margin-top: var(--s-2);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border: none;
  border-radius: var(--r-1);
  cursor: pointer;
}

/* Toggle switches (CL alerts) */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
}
.toggle__track {
  width: 36px;
  height: 20px;
  background: var(--line);
  border-radius: 100px;
  position: relative;
  transition: background .15s;
  flex-shrink: 0;
}
.toggle__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--surface);
  border-radius: 50%;
  transition: transform .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.toggle.on .toggle__track { background: var(--success-fg); }
.toggle.on .toggle__track::after { transform: translateX(16px); }

/* Notes editor */
.notes-wrap { position: relative; }
.notes-mode-row { display: flex; gap: 6px; margin-bottom: var(--s-3); align-items: center; }
.notes-edit-toggle {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  cursor: pointer;
  color: var(--muted);
}
.notes-edit-toggle.active {
  background: var(--brass);
  color: #FFF;
  border-color: var(--brass);
}
.notes-save-status {
  margin-left: auto;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}
.notes-save-btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border: none;
  border-radius: var(--r-1);
  cursor: pointer;
}
.notes-save-btn.dirty { background: var(--brass); }
.notes-editor {
  width: 100%;
  min-height: 300px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.65;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--ink);
  resize: vertical;
  outline: none;
}
.notes-editor:focus { border-color: var(--brass); }

/* Markdown rendered notes */
.md-render {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: var(--s-4);
  min-height: 100px;
}
.md-render p { margin: 0 0 var(--s-3); }
.md-render p:last-child { margin-bottom: 0; }
.md-render h1, .md-render h2, .md-render h3 {
  font-family: var(--serif);
  font-weight: 600;
  margin: var(--s-4) 0 var(--s-2);
  color: var(--ink);
}
.md-render h1 { font-size: 22px; }
.md-render h2 { font-size: 18px; }
.md-render h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.md-render ul, .md-render ol { margin: var(--s-2) 0 var(--s-3) var(--s-5); }
.md-render li { margin-bottom: 4px; }
.md-render a { color: var(--brass-d); text-decoration: underline; }
.md-render blockquote {
  border-left: 3px solid var(--brass);
  margin: var(--s-3) 0;
  padding: var(--s-1) 0 var(--s-1) var(--s-4);
  color: var(--ink-2);
  font-style: italic;
}
.md-render code {
  background: var(--bg-soft);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 90%;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.md-render strong { font-weight: 700; }
.md-render em { font-style: italic; }

/* Tags inside detail */
.tag-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.case-tag {
  display: inline-block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--bg-soft);
  color: var(--ink-2);
  border: 1px solid var(--line);
}

/* "New since visit" banner */
.new-banner {
  background: var(--info-bg);
  border-left: 3px solid var(--info-fg);
  padding: var(--s-3) var(--s-4);
  border-radius: 0 var(--r-1) var(--r-1) 0;
  margin-bottom: var(--s-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--info-fg);
}
.new-banner button {
  background: none;
  border: 1px solid var(--info-fg);
  color: var(--info-fg);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-1);
  cursor: pointer;
  white-space: nowrap;
}
.new-banner button:hover { background: var(--info-fg); color: var(--surface); }

/* ============================================================
   ADD case view
   ============================================================ */
.add-head {
  margin-bottom: var(--s-4);
}
.add-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 var(--s-2);
  letter-spacing: -0.01em;
}
.add-mode-row {
  display: flex;
  gap: 6px;
  margin-bottom: var(--s-4);
}
.add-mode-btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  color: var(--muted);
  cursor: pointer;
}
.add-mode-btn.active {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border-color: var(--btn-primary-bg);
}

.add-form {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: var(--s-5);
  box-shadow: var(--shadow-1);
}
.field-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-row--2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}
@media (max-width: 560px) {
  .field-row--2col { grid-template-columns: 1fr; }
}
.field-label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field-input,
.field-select,
.field-textarea {
  font-family: var(--sans);
  font-size: 15px;
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  width: 100%;
}
.field-input:focus,
.field-select:focus,
.field-textarea:focus { border-color: var(--brass); }
.field-help {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 2px;
}
.field-textarea {
  min-height: 90px;
  resize: vertical;
}

.add-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-2);
}
.add-submit {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: var(--s-3) var(--s-5);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border: none;
  border-radius: var(--r-1);
  cursor: pointer;
}
.add-submit:disabled { opacity: 0.55; cursor: not-allowed; }
.add-cancel {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-1);
  cursor: pointer;
}
.add-error {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--urgent);
  background: var(--danger-bg);
  border-left: 3px solid var(--urgent);
  padding: var(--s-2) var(--s-3);
  border-radius: 0 var(--r-1) var(--r-1) 0;
}

/* ============================================================
   SETTINGS view
   ============================================================ */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: var(--s-5);
  margin-bottom: var(--s-4);
  box-shadow: var(--shadow-1);
}
.settings-section-title {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 var(--s-4);
}

.beats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
@media (min-width: 560px) {
  .beats-grid { grid-template-columns: 1fr 1fr; }
}
.beat-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
}
.beat-row__swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.beat-row__swatch input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  border: none;
  background: none;
}
.beat-row__label {
  flex: 1;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
  min-width: 0;
}
.beat-row__hex {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
}

.beat-add-form {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
}
.beat-add-form input[type="text"] {
  flex: 1;
  font-family: var(--sans);
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  min-width: 160px;
}
.beat-add-form input[type="text"]:focus { border-color: var(--brass); }
.beat-add-form button {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border: none;
  border-radius: var(--r-1);
  cursor: pointer;
}
.settings-meta {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  margin-bottom: var(--s-2);
}
.settings-link {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--brass-d);
  text-decoration: underline;
}

.danger-btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: var(--s-2) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--urgent);
  color: var(--urgent);
  border-radius: var(--r-1);
  cursor: pointer;
}
.danger-btn:hover { background: var(--urgent); color: #FFF; }

/* ── Footer ── */
.appfoot {
  max-width: 960px;
  margin: var(--s-6) auto 0;
  padding: var(--s-4) var(--s-5) calc(var(--s-5) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: flex;
  gap: var(--s-3);
  align-items: center;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .appfoot { padding: var(--s-4) var(--s-4) calc(var(--s-5) + env(safe-area-inset-bottom)); }
}
.util-link {
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  color: var(--muted);
  padding: 0;
}
.util-link:hover { color: var(--brass-d); }
.util-sep { color: var(--line-2); }
.util-version { color: var(--muted-2); margin-left: auto; }

/* ============================================================
   Bottom tab bar (phone widths only)
   ============================================================ */
.bottombar { display: none; }
@media (max-width: 640px) {
  .topbar__nav { display: none; }
  .bottombar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 50;
    justify-content: space-around;
    transform: translateZ(0);
    will-change: transform;
  }
  .bottombar-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    font-family: var(--sans);
    font-size: 10px;
    cursor: pointer;
  }
  .bottombar-btn span { line-height: 1; }
  .bottombar-btn.active { color: var(--brass-d); }
  /* Leave room for the bar */
  .main { padding-bottom: 80px; }
  .appfoot { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
}

/* ── Toast ── */
.toast {
  position: fixed;
  left: 50%;
  transform: translate(-50%, 0) translateZ(0);
  bottom: calc(var(--s-5) + env(safe-area-inset-bottom));
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-1);
  font-family: var(--sans);
  font-size: 14px;
  box-shadow: var(--shadow-2);
  z-index: 100;
  animation: toastIn .22s ease;
  will-change: transform;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@media (max-width: 640px) {
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}

/* ── Hover-only action affordances on mouse-capable devices ── */
@media (hover: hover) and (pointer: fine) {
  .case-card__delete {
    opacity: 0;
    transition: opacity .12s;
  }
  .case-card:hover .case-card__delete { opacity: 1; }
}

/* ============================================================
   CALENDAR / EVENTS (Phase 5)
   ============================================================ */

/* Per-kind accent colors -- reuse existing semantic palette, no new colors. */
.kind-hearing  { color: var(--petrol);  }
.kind-deadline { color: var(--urgent);  }
.kind-reminder { color: var(--brass-d); }
.kind-other    { color: var(--muted);   }
body.theme-dark .kind-hearing { color: var(--brass); }

/* "Next 7 days" home card (cases view, above grid) */
.home-upcoming {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass);
  border-radius: var(--r-2);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-4);
  box-shadow: var(--shadow-1);
}
.home-upcoming__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}
.home-upcoming__title-h {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
}
.home-upcoming__see-all {
  background: none;
  border: none;
  color: var(--brass-d);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}
.home-upcoming__see-all:hover { text-decoration: underline; }
.home-upcoming__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.home-upcoming__row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  padding: 6px 8px;
  border-radius: var(--r-1);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 13px;
}
.home-upcoming__row:hover { background: var(--bg-soft); text-decoration: none; }
.home-upcoming__kind { display: inline-flex; flex-shrink: 0; }
.home-upcoming__date {
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  font-size: 12px;
}
.home-upcoming__title {
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-upcoming__matter {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 560px) {
  .home-upcoming__row {
    grid-template-columns: auto auto 1fr;
    grid-template-rows: auto auto;
  }
  .home-upcoming__matter {
    grid-column: 2 / 4;
    max-width: none;
  }
}

/* Calendar view */
.cal-range {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.cal-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}
.cal-day {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.cal-day__head {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.cal-day__head.is-today {
  color: var(--brass-d);
  border-bottom-color: var(--brass);
}
.cal-day__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cal-event {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: var(--s-2) var(--s-3);
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: var(--s-2) var(--s-3);
}
.cal-event--past   { opacity: 0.6; }
.cal-event--done   { opacity: 0.6; text-decoration: line-through; }
.cal-event__check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--surface);
  padding: 0;
  flex-shrink: 0;
}
.cal-event__check:hover { border-color: var(--brass); }
.cal-event__check.checked {
  background: var(--brass);
  border-color: var(--brass);
  color: #FFF;
}
.cal-event__kind {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cal-event__main {
  display: grid;
  grid-template-columns: 56px 1fr;
  grid-template-rows: auto auto;
  align-items: baseline;
  gap: 2px var(--s-2);
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.cal-event__main:hover { text-decoration: none; }
.cal-event__time {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 600;
  grid-row: 1;
  grid-column: 1;
}
.cal-event__time--empty { color: var(--muted-2); font-weight: 400; }
.cal-event__title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  grid-row: 1;
  grid-column: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event__main:hover .cal-event__title { color: var(--brass-d); }
.cal-event__matter {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  grid-row: 2;
  grid-column: 1 / 3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event__delete {
  background: none;
  border: 1px solid transparent;
  color: var(--muted-2);
  padding: 4px;
  border-radius: var(--r-1);
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-event__delete:hover {
  color: var(--urgent);
  border-color: var(--urgent);
}

/* Matter-detail Events section */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.event-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: var(--s-2) var(--s-3);
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: start;
  gap: var(--s-2) var(--s-3);
}
.event-row--past { opacity: 0.6; }
.event-row--done { opacity: 0.6; text-decoration: line-through; }
.event-row__check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--surface);
  padding: 0;
  margin-top: 2px;
  flex-shrink: 0;
}
.event-row__check:hover { border-color: var(--brass); }
.event-row__check.checked {
  background: var(--brass);
  border-color: var(--brass);
  color: #FFF;
}
.event-row__kind {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  flex-shrink: 0;
}
.event-row__main { min-width: 0; }
.event-row__date {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.event-row__title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
}
.event-row__court {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin-top: 2px;
}
.event-row__desc {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 4px;
  line-height: 1.45;
}
.event-row__delete {
  background: none;
  border: 1px solid transparent;
  color: var(--muted-2);
  padding: 4px;
  border-radius: var(--r-1);
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.event-row__delete:hover {
  color: var(--urgent);
  border-color: var(--urgent);
}

/* Inline "add event" form on matter detail */
.event-form {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: var(--s-3);
  margin-bottom: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.event-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--s-2);
}
@media (max-width: 560px) {
  .event-form__row { grid-template-columns: 1fr; }
}
.event-form__select,
.event-form__date,
.event-form__time,
.event-form__title,
.event-form__court,
.event-form__desc {
  font-family: var(--sans);
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  width: 100%;
}
.event-form__desc { resize: vertical; min-height: 50px; font-size: 13px; }
.event-form__select:focus,
.event-form__date:focus,
.event-form__time:focus,
.event-form__title:focus,
.event-form__court:focus,
.event-form__desc:focus { border-color: var(--brass); }
.event-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
}
.event-form__cancel {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--r-1);
  cursor: pointer;
}
.event-form__submit {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border: none;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--r-1);
  cursor: pointer;
}

/* Auto-extract review overlay */
.ae-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 31, 31, 0.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  animation: aeFadeIn .15s ease;
}
body.theme-dark .ae-overlay { background: rgba(0, 0, 0, 0.6); }
@keyframes aeFadeIn { from { opacity: 0; } to { opacity: 1; } }
.ae-modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  box-shadow: var(--shadow-2);
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: var(--s-4) var(--s-5);
}
.ae-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--s-2);
}
.ae-head h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}
.ae-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}
.ae-meta {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 var(--s-3);
}
.ae-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--s-3);
}
.ae-row {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface-2);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
}
.ae-row:hover { border-color: var(--brass); }
.ae-row input[type="checkbox"] { margin: 0; cursor: pointer; }
.ae-row__kind { display: inline-flex; }
.ae-row__date {
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  font-size: 12px;
}
.ae-row__title {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ae-row__conf {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
}
.ae-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
}
.ae-cancel-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--r-1);
  cursor: pointer;
}
.ae-confirm-btn {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border: none;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--r-1);
  cursor: pointer;
}
