/* =====================================================================
 * Tokens
 * =================================================================== */
:root {
  /* Surface */
  --bg:           #f5f7fa;
  --panel:        #ffffff;
  --panel-soft:   #f9fafc;
  --line:         #e4e8ee;
  --line-soft:    #eef1f5;

  /* Ink */
  --ink:          #0f1419;
  --ink-2:        #2c333d;
  --ink-muted:    #5d6673;
  --ink-faint:    #8a93a0;

  /* Accent */
  --accent:       #4f46e5;     /* indigo-600 */
  --accent-2:     #6366f1;     /* indigo-500 */
  --accent-hover: #4338ca;     /* indigo-700 */
  --accent-soft:  #eef2ff;     /* indigo-50 */
  --accent-ring:  rgba(99, 102, 241, .25);

  /* Semantic */
  --danger:       #b42318;
  --danger-bg:    #fee4e2;
  --warn:         #92400e;
  --warn-bg:      #fef3c7;
  --ok:           #047857;
  --ok-bg:        #d1fae5;
  --info:         #1e40af;
  --info-bg:      #dbeafe;

  /* Sidebar (its own palette so light-mode tweaks don't drag the rail) */
  --rail-bg:      #0a0d12;
  --rail-bg-2:    #11161e;
  --rail-line:    #1f2630;
  --rail-ink:     #d6dae0;
  --rail-ink-2:   #9aa3b1;
  --rail-active:  #ffffff;

  /* Effect */
  --shadow-xs:    0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm:    0 1px 3px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md:    0 6px 18px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg:    0 16px 40px rgba(15, 23, 42, .12);

  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;

  --font-sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                  "Helvetica Neue", system-ui, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, monospace;

  --t-fast:       120ms cubic-bezier(.4, 0, .2, 1);
  --t-base:       180ms cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent-hover); }

h1 {
  font-size: 1.7rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 .5rem;
}
h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 1.75rem 0 .6rem;
  color: var(--ink);
}
.muted { color: var(--ink-muted); }
.link-muted { color: var(--ink-muted); text-decoration: underline; text-underline-offset: 2px; }

/* =====================================================================
 * Layout
 * =================================================================== */
body.has-nav { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
body.no-nav  { display: block; }

.sidebar {
  background: linear-gradient(180deg, var(--rail-bg) 0%, var(--rail-bg-2) 100%);
  color: var(--rail-ink);
  padding: 1.5rem 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-right: 1px solid #000;
}
.sidebar-brand {
  font-weight: 650;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  color: #fff;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rail-line);
}
.sidebar nav { display: flex; flex-direction: column; gap: .1rem; }
.sidebar nav a {
  position: relative;
  color: var(--rail-ink-2);
  padding: .55rem .75rem .55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .92rem;
  font-weight: 500;
  transition: color var(--t-fast), background var(--t-fast);
}
.sidebar nav a:hover { color: var(--rail-active); background: rgba(255,255,255,.04); }
.sidebar nav a.active {
  color: var(--rail-active);
  background: rgba(255,255,255,.07);
}
.sidebar nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 3px;
  background: var(--accent-2);
  border-radius: 0 3px 3px 0;
}
.nav-section-label {
  margin-top: 1rem;
  padding: 0 .75rem;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--rail-ink-2);
  opacity: .7;
}
.sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--rail-line);
  font-size: .85rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.sidebar-user { color: var(--rail-ink); word-break: break-all; font-size: .82rem; }
.sidebar .link-muted { color: var(--rail-ink-2); font-size: .82rem; }
.sidebar .link-muted:hover { color: #fff; }
.sidebar-version {
  margin-top: .4rem;
  align-self: flex-start;
  color: var(--rail-ink-2);
  background: rgba(255,255,255,.04);
  border: 1px solid var(--rail-line);
  font-size: .7rem;
  font-family: var(--font-mono);
  padding: .15rem .45rem;
  border-radius: 999px;
}

.main {
  padding: 2rem 2.5rem 4rem;
  max-width: 1180px;
}

/* =====================================================================
 * Auth (login)
 * =================================================================== */
body.no-nav .main { display: grid; place-items: center; min-height: 100vh; padding: 2rem; }
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 380px;
}
.auth-card h1 { text-align: center; margin-bottom: 1.5rem; }

/* =====================================================================
 * Forms
 * =================================================================== */
form { display: flex; flex-direction: column; gap: 1rem; }
label {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  font-size: .85rem;
  font-weight: 500;
  color: var(--ink-2);
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .58rem .7rem;
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* =====================================================================
 * Buttons
 * =================================================================== */
button, .btn {
  font: inherit;
  font-weight: 550;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  padding: .55rem 1.05rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  box-shadow: var(--shadow-xs);
  transition: background var(--t-fast), box-shadow var(--t-fast),
              transform var(--t-fast), border-color var(--t-fast);
}
button:hover, .btn:hover {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
button:active, .btn:active { transform: translateY(1px); box-shadow: var(--shadow-xs); }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

.btn-secondary {
  background: var(--panel);
  color: var(--ink-2);
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--panel-soft); color: var(--ink); border-color: #c9d1db; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #921a14; }
.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  border: 0;
  box-shadow: none;
  padding: .35rem .65rem;
}
.btn-ghost:hover { background: var(--panel-soft); color: var(--ink); box-shadow: none; }

button[disabled], .btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* =====================================================================
 * Alerts
 * =================================================================== */
.alert {
  padding: .7rem .9rem;
  border-radius: var(--radius);
  font-size: .9rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: #fbcaca; }
.alert-ok    { background: var(--ok-bg);     color: var(--ok);     border-color: #a7f3d0; }

/* =====================================================================
 * Cards (dashboard tiles)
 * =================================================================== */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow-xs);
  display: block;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}
.card:hover {
  border-color: #d6dde6;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-static:hover { transform: none; box-shadow: var(--shadow-xs); border-color: var(--line); }
.card-num { font-size: 2.1rem; font-weight: 650; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.card-label { color: var(--ink-muted); font-size: .85rem; font-weight: 500; }

/* =====================================================================
 * Tables
 * =================================================================== */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: .8rem 1rem; text-align: left; vertical-align: middle; }
thead { background: var(--panel-soft); }
th {
  font-size: .72rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .055em;
  border-bottom: 1px solid var(--line);
}
tbody tr { border-top: 1px solid var(--line-soft); transition: background var(--t-fast); }
tbody tr:first-child { border-top: 0; }
tbody tr:hover { background: var(--panel-soft); }
td { color: var(--ink-2); }

/* Truncated cell with hover-to-see-full (uses native title="") */
.cell-notes {
  max-width: 22rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-muted);
  cursor: help;
}

/* =====================================================================
 * Toolbar / actions
 * =================================================================== */
.toolbar {
  display: flex;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.toolbar-actions { display: flex; gap: .5rem; }

.actions-cell { display: flex; gap: .4rem; }
.actions-cell a, .actions-cell button { padding: .3rem .65rem; font-size: .82rem; font-weight: 500; }
.inline-form { display: inline; }

/* =====================================================================
 * Filter chips
 * =================================================================== */
.filter-row { display: flex; gap: .4rem; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: .3rem .8rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 500;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-muted);
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.filter-chip:hover { color: var(--ink); border-color: #c9d1db; }
.filter-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.filter-chip.active:hover { color: #fff; }

/* =====================================================================
 * Status pills
 * =================================================================== */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: .15rem .6rem;
  border-radius: 999px;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .055em;
  font-weight: 650;
  border: 1px solid transparent;
}
.status-active   { background: var(--ok-bg);    color: var(--ok);    border-color: #a7f3d0; }
.status-inactive { background: var(--warn-bg);  color: var(--warn);  border-color: #fde68a; }
.status-archived { background: #e5e7eb;         color: #4b5563;       border-color: #d1d5db; }
.status-completed{ background: var(--info-bg);  color: var(--info);  border-color: #bfdbfe; }
.status-on_hold  { background: var(--warn-bg);  color: var(--warn);  border-color: #fde68a; }
.status-draft    { background: #e5e7eb;         color: #4b5563;       border-color: #d1d5db; }
.status-sent     { background: var(--info-bg);  color: var(--info);  border-color: #bfdbfe; }
.status-paid     { background: var(--ok-bg);    color: var(--ok);    border-color: #a7f3d0; }
.status-void     { background: var(--danger-bg);color: var(--danger);border-color: #fbcaca; }

/* =====================================================================
 * Form grid
 * =================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
 * Invoice running totals (sticky panel)
 * =================================================================== */
.invoice-totals {
  position: sticky;
  top: .5rem;
  z-index: 5;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.25rem;
  margin: 0 0 1.25rem 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .35rem 2rem;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.invoice-totals-row { display: contents; }
.invoice-totals-label  { color: var(--ink-muted); font-size: .92rem; }
.invoice-totals-amount { text-align: right; font-weight: 600; color: var(--ink); }
.invoice-totals-grand .invoice-totals-label  { color: var(--ink); font-size: 1.05rem; font-weight: 600; }
.invoice-totals-grand .invoice-totals-amount { font-size: 1.4rem; letter-spacing: -0.01em; }
.invoice-totals-meta {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  color: var(--ink-muted);
  font-size: .82rem;
  border-top: 1px dashed var(--line);
  padding-top: .55rem;
  margin-top: .35rem;
}
.invoice-totals-submit {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: .5rem;
}

/* =====================================================================
 * Active-timer banner
 * =================================================================== */
.timer-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .65rem 1.1rem;
  padding: .9rem 1.1rem;
  margin: 0 0 1.5rem 0;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
/* Idle is simpler: icon | text | project select | start button */
.timer-banner-idle { grid-template-columns: auto 1fr minmax(16rem, 22rem) auto; }
/* Active layout (desktop):
 *   icon | text | controls | actions
 *   (description spans cols 2..-1 on its own row)
 */
.timer-banner-active {
  grid-template-columns: auto minmax(14rem, 1fr) auto auto;
  background: linear-gradient(90deg, var(--accent-soft) 0%, var(--panel) 55%);
  border-color: #c7d2fe;
}
.timer-banner-over {
  background: linear-gradient(90deg, #fef3c7 0%, var(--panel) 55%);
  border-color: #fcd34d;
}

/* Stacks on small screens */
@media (max-width: 900px) {
  .timer-banner,
  .timer-banner-idle,
  .timer-banner-active { grid-template-columns: auto 1fr; }
  .timer-banner-controls,
  .timer-banner-actions,
  .timer-banner-desc,
  .timer-banner-project { grid-column: 1 / -1; }
}

/* Left accent bar */
.timer-banner::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--ink-faint);
  transition: background var(--t-base);
}
.timer-banner-active::before { background: var(--accent); }
.timer-banner-over::before   { background: #d97706; }

/* Icon — circular, SVG inside, perfectly centered (no glyph baseline drift) */
.timer-banner-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  flex-shrink: 0;
  position: relative;
  align-self: center;
}
.timer-banner-icon svg { display: block; }
.timer-banner-active .timer-banner-icon { background: var(--accent); }
.timer-banner-over   .timer-banner-icon { background: #d97706; }
.timer-banner-active .timer-banner-icon::after,
.timer-banner-over   .timer-banner-icon::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #34d399;
  top: -1px;
  right: -1px;
  border: 2px solid var(--panel);
  animation: timer-pulse 1.6s ease-in-out infinite;
}
.timer-banner-over .timer-banner-icon::after { background: #f59e0b; }
@keyframes timer-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.3); opacity: .65; }
}

/* Text block — stacked title + meta */
.timer-banner-text { min-width: 0; }
.timer-banner-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timer-banner-title strong { font-weight: 650; }
.timer-banner-sep { color: var(--ink-faint); margin: 0 .15rem; font-weight: 400; }
.timer-banner-meta {
  color: var(--ink-muted);
  font-size: .82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  margin-top: .15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timer-banner-dot { color: var(--ink-faint); margin: 0 .25rem; }

/* Form controls inside the banner — proper sizing, no auto-collapse */
.timer-banner select,
.timer-banner input[type=text],
.timer-banner input[type=time] {
  font: inherit;
  font-size: .92rem;
  padding: .5rem .65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.timer-banner select:focus,
.timer-banner input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.timer-banner-project { width: 100%; min-width: 16rem; }

/* End-time control with inline label */
.timer-banner-end {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .15rem .15rem .15rem .65rem;
  box-shadow: var(--shadow-xs);
}
.timer-banner-end > span {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.timer-banner-end input[type=time] {
  border: 0;
  background: transparent;
  padding: .35rem .35rem;
  font-variant-numeric: tabular-nums;
  font-size: .95rem;
  font-weight: 600;
  width: 6rem;
  box-shadow: none;
}
.timer-banner-end input[type=time]:focus { box-shadow: none; }
.timer-banner-end:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.timer-banner-controls {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
}

/* Quick-adjust segmented control */
.timer-banner-quick {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.timer-banner-quick button {
  background: transparent;
  color: var(--ink-2);
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  padding: .45rem .7rem;
  font-size: .78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
.timer-banner-quick button:last-child { border-right: 0; }
.timer-banner-quick button:hover { background: var(--panel-soft); color: var(--ink); box-shadow: none; }
.timer-banner-quick button:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }

/* Description input gets its own row in the active layout */
.timer-banner-active .timer-banner-desc {
  grid-column: 2 / -1;
  width: 100%;
  margin-top: .15rem;
}

/* Right-side actions */
.timer-banner-actions {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.timer-banner-primary {
  padding: .55rem 1.15rem;
  font-size: .92rem;
  font-weight: 600;
  background: var(--ink);
  color: #fff;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
}
.timer-banner-primary:hover { background: #000; color: #fff; }
.timer-banner-active .timer-banner-primary { background: var(--accent); }
.timer-banner-active .timer-banner-primary:hover { background: var(--accent-hover); }

.section-heading {
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 1.6rem 0 .6rem;
}

.timer-banner-save {
  padding: .5rem .9rem;
  font-size: .88rem;
  font-weight: 600;
  background: var(--panel);
  color: var(--ink-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
.timer-banner-save:hover { background: var(--panel-soft); color: var(--ink); }

/* Just-saved state: clock-out button is dimmed and unclickable until the
   user navigates somewhere else and the banner re-renders without the flag. */
.timer-banner-saved .timer-banner-primary {
  opacity: .45;
  pointer-events: none;
  filter: grayscale(.4);
}

.timer-banner-cancel {
  background: none;
  border: 0;
  color: var(--ink-muted);
  padding: .35rem .55rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: .8rem;
  font-weight: 500;
  box-shadow: none;
}
.timer-banner-cancel:hover { background: none; color: var(--danger); box-shadow: none; }

/* =====================================================================
 * Notes — search/filter toolbar + collapsible cards
 * =================================================================== */
.notes-filters {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}
.notes-search {
  flex: 1 1 240px;
  min-width: 200px;
}
.notes-filter-select {
  flex: 0 1 280px;
  min-width: 180px;
}

.notes-stream { display: flex; flex-direction: column; gap: .65rem; }

.note {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  overflow: hidden;
}
.note:hover { border-color: #d6dde6; }
.note[open] {
  border-color: #c8d1de;
  box-shadow: var(--shadow-sm);
}

/* The summary is the always-visible row that toggles the body. */
.note-head {
  display: flex;
  align-items: baseline;
  gap: .85rem;
  padding: .8rem 1.1rem;
  cursor: pointer;
  list-style: none;            /* hide the default disclosure triangle */
  flex-wrap: wrap;
}
.note-head::-webkit-details-marker { display: none; }
.note-head::before {
  content: "▸";
  color: var(--ink-faint);
  font-size: .85rem;
  margin-right: -.4rem;
  transition: transform var(--t-fast);
  display: inline-block;
}
.note[open] > .note-head::before { transform: rotate(90deg); }
.note-head:hover { background: var(--bg-soft, #f6f8fc); }

.note-title {
  font-weight: 600;
  font-size: .98rem;
  color: var(--ink);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-context {
  font-weight: 500;
  font-size: .85rem;
  color: var(--ink-muted);
  text-decoration: none;
  white-space: nowrap;
}
.note-context:hover { color: var(--accent); }
.note-meta {
  color: var(--ink-muted);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  white-space: nowrap;
}
.note-edited {
  color: var(--ink-faint);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  cursor: help;
}

/* Body + actions only visible when open. */
.note-body {
  color: var(--ink-2);
  font-size: .94rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 0 1.1rem .9rem;
  border-top: 1px solid var(--line);
  padding-top: .9rem;
}
.note-actions {
  display: inline-flex;
  align-items: center;
  gap: .15rem;
  padding: 0 1.1rem .85rem;
}
.note-actions .btn-ghost { padding: .25rem .55rem; font-size: .8rem; }
.note-delete:hover { color: var(--danger); }

/* Meeting-specific bits on a collapsed/expanded card. */
.note-kind-badge {
  display: inline-flex;
  align-items: center;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .15rem .45rem;
  border-radius: 3px;
  background: var(--accent-soft, #e6f0fb);
  color: var(--accent, #1d4ed8);
}
.note-attachment-count {
  font-size: .78rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.note-meeting-meta {
  padding: .75rem 1.1rem 0;
  font-size: .88rem;
  color: var(--ink-2);
}
.note-meeting-meta strong { color: var(--ink); margin-right: .35rem; }

/* Attachment lists — used both on the list view and the edit form. */
.note-attachment-list {
  list-style: none;
  padding: .25rem 1.1rem .5rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.note-attachment {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .88rem;
  flex-wrap: wrap;
}
.note-attachment-kind {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .1rem .4rem;
  border-radius: 3px;
  background: var(--bg-soft, #f0f3f8);
  color: var(--ink-muted);
  white-space: nowrap;
}
.note-attachment-kind.kind-recording_video { background: #fde8e8; color: #9b2c2c; }
.note-attachment-kind.kind-recording_audio { background: #fef3c7; color: #92400e; }
.note-attachment-kind.kind-chat            { background: #e0e7ff; color: #3730a3; }
.note-attachment-kind.kind-config          { background: #e0f2fe; color: #075985; }

/* Meeting fields on the note form — hidden unless kind=meeting. */
.note-meeting-fields { display: none; border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1rem; }
.note-meeting-fields legend { font-size: .85rem; font-weight: 600; color: var(--ink-muted); padding: 0 .35rem; }
.note-form-meeting .note-meeting-fields { display: block; }
.note-existing-attachments { margin-top: .75rem; font-size: .88rem; }
.note-existing-attachments .note-attachment-list { padding: .25rem 0; }
.btn-small { padding: .15rem .45rem; font-size: .72rem; }

/* =====================================================================
 * Public upload page (clients land here from a token URL)
 * =================================================================== */
.upload-card {
  max-width: 460px;
  margin: 4rem auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.25rem 2rem;
}
.upload-brand {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: .5rem;
}
.upload-card h1 { margin: 0 0 .5rem; }
.upload-card form { margin-top: 1.5rem; }
.upload-card input[type=file] {
  font: inherit;
  background: var(--panel-soft);
  border: 1px dashed var(--line);
  padding: 1rem;
  border-radius: var(--radius);
  width: 100%;
}

/* Per-client upload URL widget on the client edit page */
.upload-share {
  margin-top: 2rem;
  padding: 1.25rem 1.4rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.upload-share h2 { margin: 0 0 .35rem; }
.upload-share-row {
  display: flex;
  gap: .5rem;
  margin-top: .9rem;
}
.upload-share-row input {
  font-family: var(--font-mono);
  font-size: .85rem;
  flex: 1;
  background: var(--panel-soft);
}
