/* =========================================================
   WHISPERS — Late-night design system
   Charcoal · ghostly phosphor green · warm off-white
   ========================================================= */

:root {
  --bg:        #1A1A1B;
  --bg-deep:   #131314;
  --surface:   #222224;
  --surface-2: #2A2A2C;
  --rule:      #33333A;
  --rule-soft: #26262A;

  --ink:       #E5E3DC;
  --ink-soft:  #A6A49B;
  --ink-faint: #6B6962;
  --ink-mute:  #44423D;

  --accent:        #8AECCB;
  --accent-soft:   rgba(138, 236, 203, 0.10);
  --accent-border: rgba(138, 236, 203, 0.32);
  --accent-glow:   rgba(138, 236, 203, 0.18);

  --good:      #8AECCB;
  --good-soft: rgba(138, 236, 203, 0.10);
  --warn:      #F2C57C;
  --warn-soft: rgba(242, 197, 124, 0.10);
  --bad:       #F47A6D;
  --bad-soft:  rgba(244, 122, 109, 0.10);

  --serif: 'Instrument Serif', 'Newsreader', 'EB Garamond', Georgia, serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono:  'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --radius: 2px;
  --radius-lg: 4px;
  --content-width: 1180px;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(1200px 700px at 80% -10%, rgba(138, 236, 203, 0.05), transparent 60%),
    radial-gradient(900px 500px at -10% 100%, rgba(138, 236, 203, 0.03), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  font-feature-settings: 'tnum' 0, 'ss01';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--bg); }

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--ink-mute);
  transition: border-color .15s, color .15s;
}
a:hover { color: var(--accent); border-color: var(--accent); }
a.plain, a.btn, a.tab, a.brand, a.chip { border-bottom: none; }
a.plain:hover { color: var(--accent); }

/* === Typography === */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.005em;
  text-transform: lowercase;
  overflow-wrap: break-word;
  word-break: break-word;
}
h1 {
  font-size: 3.4rem;
  line-height: 0.98;
  letter-spacing: -0.02em;
}
h2 {
  font-size: 2rem;
  line-height: 1.1;
}
h3 {
  font-size: 1.4rem;
  line-height: 1.2;
}
h4 {
  font-size: 0.74rem;
  font-family: var(--sans);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}

p { margin: 0 0 1rem; }

.lead {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--ink-soft);
  line-height: 1.4;
  font-style: italic;
}

.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.muted { color: var(--ink-faint); }
.soft  { color: var(--ink-soft); }

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

.serif { font-family: var(--serif); }
.mono  { font-family: var(--mono); font-size: 0.85em; }

/* === App shell — sidebar + content + drawer === */
:root {
  --sidebar-width: 264px;
  --topbar-height: 60px;
}

html { overflow-x: clip; }

.app {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.content-wrap {
  flex: 1;
  min-width: 0;            /* prevents flex blowout from wide tables */
  display: flex;
  flex-direction: column;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 2.5rem;
  width: 100%;
}
.main { flex: 1; padding: 2.5rem 0 5rem; }

/* === Brand === */
.brand {
  font-family: var(--serif);
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-transform: lowercase;
  border-bottom: 0;
}
.brand .dot {
  display: inline-block;
  width: 9px; height: 9px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--accent), 0 0 28px var(--accent-glow);
  animation: pulse 4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-deep);
  border-right: 1px solid var(--rule);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  z-index: 50;
  overflow-y: auto;
}
.sidebar-inner {
  display: flex;
  flex-direction: column;
  padding: 1.8rem 1.6rem 1.6rem;
  height: 100%;
  gap: 1.6rem;
}
.sidebar .brand {
  font-size: 1.9rem;
  letter-spacing: -0.015em;
}
.sidebar .brand .dot {
  width: 10px; height: 10px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  margin-top: 0.4rem;
}
.sidebar-nav a {
  font-family: var(--serif);
  font-size: 1.55rem;
  color: var(--ink-soft);
  padding: 0.45rem 0;
  text-transform: lowercase;
  border-bottom: 0;
  letter-spacing: -0.008em;
  position: relative;
  transition: color .12s ease;
}
.sidebar-nav a:hover { color: var(--ink); }
.sidebar-nav a.is-active { color: var(--accent); }
.sidebar-nav a.is-active::before {
  content: '';
  position: absolute;
  left: -1.6rem;
  top: 0.72rem;
  bottom: 0.72rem;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 12px var(--accent-glow);
}

.sidebar-cta {
  margin-top: 0.3rem;
}

.sidebar-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
}
.sidebar-bottom a {
  color: var(--ink-faint);
  font-size: 0.92rem;
  text-transform: lowercase;
  padding: 0.35rem 0;
  border-bottom: 0;
  transition: color .12s;
}
.sidebar-bottom a:hover { color: var(--ink); }
.sidebar-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

/* === Topbar (mobile only) === */
.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--rule);
  padding: 0.7rem 1rem;
  backdrop-filter: blur(8px);
  min-height: var(--topbar-height);
}
.topbar .brand {
  font-size: 1.35rem;
}
.topbar .brand .dot { width: 7px; height: 7px; box-shadow: 0 0 10px var(--accent); }
.topbar-actions { display: flex; gap: 0.5rem; }

/* === Hamburger button === */
.nav-toggle {
  background: transparent;
  border: 1px solid var(--rule);
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: border-color .15s, background .15s;
  flex-shrink: 0;
}
.nav-toggle:hover {
  border-color: var(--ink-soft);
  background: var(--surface);
}
.nav-toggle .bar {
  position: relative;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  display: block;
  transition: background .2s;
}
.nav-toggle .bar::before,
.nav-toggle .bar::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 1.5px;
  background: var(--ink);
  transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1), top .25s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-toggle .bar::before { top: -5px; }
.nav-toggle .bar::after  { top:  5px; }

body.nav-open .nav-toggle .bar          { background: transparent; }
body.nav-open .nav-toggle .bar::before  { top: 0; transform: rotate(45deg); }
body.nav-open .nav-toggle .bar::after   { top: 0; transform: rotate(-45deg); }

/* === Sidebar backdrop (mobile drawer) === */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 9, 0.78);
  backdrop-filter: blur(2px);
  z-index: 45;
  opacity: 0;
  transition: opacity .25s;
}

/* === Mobile: sidebar becomes off-canvas drawer === */
@media (max-width: 960px) {
  .app { display: block; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 296px;
    max-width: 85vw;
    transform: translateX(-101%);
    transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.55);
  }
  body.nav-open .sidebar { transform: translateX(0); }

  .sidebar-backdrop { display: block; pointer-events: none; }
  body.nav-open .sidebar-backdrop { pointer-events: auto; opacity: 1; }
  body.nav-open { overflow: hidden; }

  .topbar { display: flex; }
  .main   { padding: 1.8rem 0 4rem; }
}

/* === Page header === */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.page-head .titles .eyebrow {
  margin-bottom: 0.7rem;
  display: block;
}
.page-head h1 { margin: 0; }
.page-head .actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.05rem;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--sans);
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
  text-transform: lowercase;
  letter-spacing: 0.01em;
}
.btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.btn:active { transform: translateY(1px); }

.btn.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink-faint);
}
.btn.secondary:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--rule);
}
.btn.ghost:hover {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--ink-soft);
}
.btn.danger {
  background: transparent;
  color: var(--bad);
  border-color: var(--bad);
}
.btn.danger:hover {
  background: var(--bad);
  color: var(--bg);
}
.btn.sm { padding: 0.4rem 0.75rem; font-size: 0.78rem; }
.btn.lg { padding: 0.85rem 1.5rem; font-size: 0.95rem; }

/* === Cards / Surfaces === */
.surface {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
}
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}
.card-title h3 { margin: 0; }
.divider { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
.hairline { border: 0; border-top: 1px solid var(--rule-soft); margin: 1rem 0; }

/* === Grid === */
.grid { display: grid; gap: 1.25rem; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-12 { grid-template-columns: repeat(12, 1fr); }
@media (max-width: 880px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-2 { grid-template-columns: 1fr; }
}

/* === Stats === */
.stat {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.6rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  position: relative;
}
.stat .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  font-weight: 500;
}
.stat .value {
  font-family: var(--serif);
  font-size: 2.6rem;
  line-height: 1;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-top: 0.15rem;
}
.stat .meta {
  font-size: 0.82rem;
  color: var(--ink-faint);
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.stat.feature {
  background: linear-gradient(155deg, var(--surface-2) 0%, var(--surface) 100%);
  border-color: var(--accent-border);
}
.stat.feature .value { color: var(--ink); }
.stat.feature .label { color: var(--accent); }
.stat.feature::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 24px; height: 1px;
  background: var(--accent);
}

/* === Tables === */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  font-weight: 500;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-deep);
}
.table td {
  padding: 1rem 1rem;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 0.9rem;
  vertical-align: top;
  color: var(--ink);
}
.table tr:hover td { background: rgba(138, 236, 203, 0.03); }
.table td.num, .table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions a, .table td.actions button { font-size: 0.78rem; }
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-wrap .table tr:last-child td { border-bottom: 0; }
.table-wrap .table th:first-child,
.table-wrap .table td:first-child { padding-left: 1.5rem; }
.table-wrap .table th:last-child,
.table-wrap .table td:last-child { padding-right: 1.5rem; }

/* Date column — left-aligned mono, slightly dimmed */
.table td.col-date,
.table th.col-date {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
  white-space: nowrap;
  text-align: left;
}

/* === Forms === */
.form { display: flex; flex-direction: column; gap: 1.5rem; max-width: 780px; }
.form .row { display: grid; gap: 1.1rem; }
.form .row.cols-2 { grid-template-columns: 1fr 1fr; }
.form .row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 640px) {
  .form .row.cols-2, .form .row.cols-3 { grid-template-columns: 1fr; gap: 1.2rem; }
}

.field { display: flex; flex-direction: column; gap: 0.5rem; }
.field label {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="date"],
.field textarea,
.field select {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
  padding: 0.85rem 1rem;
  background: var(--bg-deep);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color .12s, box-shadow .12s, background .12s;
  width: 100%;
  line-height: 1.4;
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-mute); }
.field input:hover:not(:focus),
.field textarea:hover:not(:focus),
.field select:hover:not(:focus) {
  border-color: var(--ink-mute);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg);
}
.field textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.55;
}
.field .help {
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin-top: 0.15rem;
  line-height: 1.45;
}
.field.inline {
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0;
}
.field.inline label {
  text-transform: lowercase;
  letter-spacing: 0;
  font-size: 0.95rem;
  color: var(--ink);
  font-weight: 400;
  cursor: pointer;
}
.field input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Select chevron */
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23A6A49B' stroke-width='1.3' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.4rem;
  cursor: pointer;
}

/* Segmented control — full-width, equal-flex labels */
.segmented {
  display: flex;
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-deep);
  padding: 3px;
  gap: 2px;
}
.segmented label {
  flex: 1;
  text-align: center;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--ink-soft);
  border-radius: 1px;
  position: relative;
  text-transform: lowercase;
  letter-spacing: 0.01em;
  transition: color .12s, background .12s;
  user-select: none;
}
.segmented label:hover { color: var(--ink); }
.segmented input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input[type="radio"]:checked) {
  background: var(--accent);
  color: var(--bg);
  font-weight: 500;
  box-shadow: 0 0 16px var(--accent-glow);
}

/* Form action row — separated from fields with a hairline */
.form-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule-soft);
  align-items: center;
}

/* === Pills / Badges === */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.08em;
  border-radius: 999px;
  background: var(--rule);
  color: var(--ink-soft);
  border: 1px solid var(--rule);
}
.pill.retainer  { background: var(--warn-soft);                color: var(--warn);   border-color: rgba(242,197,124,0.30); }
.pill.hourly    { background: var(--accent-soft);              color: var(--accent); border-color: var(--accent-border); }
.pill.task      { background: rgba(199, 184, 229, 0.10);       color: #C7B8E5;       border-color: rgba(199, 184, 229, 0.32); }
.pill.active    { background: var(--accent-soft);              color: var(--accent); border-color: var(--accent-border); }
.pill.paused    { background: var(--warn-soft);                color: var(--warn);   border-color: rgba(242,197,124,0.30); }
.pill.completed { background: var(--rule-soft);                color: var(--ink-soft); }
.pill.archived  { background: var(--rule-soft);                color: var(--ink-faint); }

/* === Flash === */
.flash {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  border: 1px solid;
  background: var(--surface);
}
.flash.success {
  color: var(--good);
  border-color: rgba(138, 236, 203, 0.4);
  background: var(--good-soft);
}
.flash.error {
  color: var(--bad);
  border-color: rgba(244, 122, 109, 0.4);
  background: var(--bad-soft);
}

/* === Utilities === */
.row-flex { display: flex; align-items: center; gap: 1rem; }
.row-flex.between { justify-content: space-between; }
.row-flex.end { justify-content: flex-end; }
.gap-sm { gap: 0.5rem; }
.gap-lg { gap: 1.5rem; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.w-full      { width: 100%; }
.flex-1      { flex: 1; }
@media (max-width: 720px) { .hide-sm { display: none; } }

/* Inline link button (e.g. delete forms) */
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--ink-mute);
  text-transform: lowercase;
}
.link-btn:hover { color: var(--accent); border-color: var(--accent); }
.link-btn.danger { color: var(--bad); }
.link-btn.danger:hover { color: var(--bad); border-color: var(--bad); }

/* === Auth & Public layouts === */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
  background-image:
    radial-gradient(1200px 700px at 50% -10%, rgba(138, 236, 203, 0.08), transparent 60%);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 3rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}
.auth-card h1 { font-size: 2.6rem; margin-bottom: 0.4rem; }
.auth-card .lead { margin-bottom: 1.8rem; }

/* === Public client statement === */
.public-wrap {
  min-height: 100vh;
  padding: 5rem 2rem;
  background: var(--bg);
  background-image:
    radial-gradient(800px 500px at 90% 0%, rgba(138, 236, 203, 0.06), transparent 60%);
}
.public-inner { max-width: 880px; margin: 0 auto; }
.public-masthead {
  padding-bottom: 2rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}
.public-masthead .meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}
.public-masthead h1 {
  font-size: 4.2rem;
  font-weight: 400;
  letter-spacing: -0.025em;
}
.public-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.5rem;
}
@media (max-width: 640px) { .public-stats { grid-template-columns: 1fr 1fr; } }
.public-stat .eyebrow { display: block; margin-bottom: 0.6rem; }
.public-stat .val {
  font-family: var(--serif);
  font-size: 2.8rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.public-stat .sub {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-top: 0.5rem;
  letter-spacing: 0.04em;
}

.public-entry {
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--rule-soft);
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 1.5rem;
}
.public-entry .date {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  padding-top: 0.2rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.public-entry .desc {
  line-height: 1.55;
  color: var(--ink);
}
.public-entry .desc .project {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  margin-bottom: 0.35rem;
}
.public-entry .meta {
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  text-align: right;
  color: var(--ink-soft);
  font-size: 0.82rem;
  padding-top: 0.2rem;
  white-space: nowrap;
  line-height: 1.5;
}
.public-entry .meta .amt { color: var(--ink-faint); }

/* === Footer === */
.footer {
  border-top: 1px solid var(--rule);
  padding: 2rem 0;
  color: var(--ink-faint);
  font-size: 0.82rem;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.footer .shell {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer .mono { font-family: var(--mono); }

/* === Empty states === */
.empty {
  padding: 4rem 2rem;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--rule);
  border-radius: var(--radius-lg);
}
.empty h3 { margin-bottom: 0.5rem; }
.empty p { color: var(--ink-soft); }

/* === Filter chips (pill-button style — used for actions like month nav) === */
.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip {
  display: inline-block;
  padding: 0.42rem 0.95rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  transition: all .15s;
  text-transform: lowercase;
  background: var(--surface);
  border-bottom-width: 1px;
}
.chip:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
}
.chip.is-active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* === Editorial tabs (underline style — used for filters like Active/Archived/All) === */
.tabs {
  display: flex;
  gap: 2.2rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0;
}
.tabs .tab {
  display: inline-block;
  padding: 0.7rem 0 1rem;
  font-size: 0.95rem;
  color: var(--ink-faint);
  text-transform: lowercase;
  letter-spacing: 0.005em;
  position: relative;
  transition: color .15s;
  border-bottom: 0;
}
.tabs .tab:hover { color: var(--ink); }
.tabs .tab.is-active {
  color: var(--ink);
  font-weight: 500;
}
.tabs .tab.is-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.tabs .tab .count {
  display: inline-block;
  margin-left: 0.45rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  font-weight: 400;
  letter-spacing: 0.02em;
}
.tabs .tab.is-active .count { color: var(--ink-soft); }
@media (max-width: 720px) {
  .tabs { gap: 1.6rem; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .tab { font-size: 0.9rem; padding: 0.6rem 0 0.85rem; flex-shrink: 0; }
}

/* === Range form === */
.range-form {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.range-form .field { flex: 0 0 auto; min-width: 150px; }

/* === Public token block === */
.token-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--bg-deep);
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.82rem;
  overflow-x: auto;
}
.token-row .url {
  flex: 1;
  color: var(--ink-soft);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

form.inline { display: inline; }
.desc-cell {
  max-width: 480px;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: break-word;
}
.public-entry .desc,
.callout p,
.stat .meta,
.empty p     { overflow-wrap: break-word; word-break: break-word; }

/* === Specific layout helpers === */
.section-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
  letter-spacing: 0.12em;
  margin-right: 0.7rem;
  font-weight: 500;
}

/* Drop cap for serif lead in public statement */
.dropcap::first-letter {
  font-family: var(--serif);
  font-size: 3.5em;
  float: left;
  line-height: 0.85;
  margin: 0.1em 0.08em 0 -0.02em;
  color: var(--accent);
}

/* === Utility classes === */
.btn.full         { width: 100%; justify-content: center; }
.spacer           { flex: 1; }
.mono-tnum        { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.text-xs          { font-size: 0.74rem; }
.text-sm          { font-size: 0.85rem; }
.text-md          { font-size: 0.95rem; }
.text-accent      { color: var(--accent); }
.text-bad         { color: var(--bad); }
.text-warn        { color: var(--warn); }
.whitespace-pre   { white-space: pre-wrap; }
.no-wrap          { white-space: nowrap; }
.emph             { font-weight: 500; }
.h1-pill          { vertical-align: middle; margin-left: 0.55rem; }
.serif-md         { font-family: var(--serif); font-size: 1.4rem; line-height: 1.3; }

/* Callout — for highlighted notices like "above retainer" */
.callout {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 1.4rem 1.6rem;
  border-radius: var(--radius-lg);
}
.callout .eyebrow { color: var(--accent); display: block; margin-bottom: 0.5rem; }
.callout p {
  font-family: var(--serif);
  font-size: 1.4rem;
  line-height: 1.35;
  color: var(--ink);
  margin: 0;
}

/* Inset list rows for surfaces (e.g. recent entries on dashboard) */
.public-entry.padded { padding-left: 1.25rem; padding-right: 1.25rem; }

/* Dashboard split: 7fr main / 5fr aside; collapses to single column on mobile */
.grid.split-7-5 { grid-template-columns: 7fr 5fr; }
@media (max-width: 960px) { .grid.split-7-5 { grid-template-columns: 1fr; } }

/* 404 page big numeral */
.big-404 {
  font-size: 5.5rem;
  margin-bottom: 0.6rem;
  letter-spacing: -0.03em;
  color: var(--ink);
}
@media (max-width: 480px) { .big-404 { font-size: 4rem; } }

/* Public statement footer (replaces the inline-styled block) */
.public-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  font-size: 0.82rem;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.public-footer p { margin: 0; }

/* Page-head action group: explicit grid for predictable wrapping */
.page-head .actions .btn { white-space: nowrap; }

/* Table wrappers always scroll horizontally if content overflows */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Chips: scroll horizontally on small if needed */
.chips {
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

/* =========================================================
   Responsive — tablets & phones
   ========================================================= */

@media (max-width: 960px) {
  .shell                  { padding: 0 1.75rem; }
  h1                      { font-size: 2.8rem; }
  .stat .value            { font-size: 2.2rem; }
  .grid.cols-12           { grid-template-columns: 1fr !important; }
}

@media (max-width: 720px) {
  /* Smaller page rhythm */
  .shell                  { padding: 0 1.25rem; }
  .main                   { padding: 1.5rem 0 4rem; }
  .grid                   { gap: 0.9rem; }
  h1                      { font-size: 2.3rem; }
  h2                      { font-size: 1.55rem; }
  h3                      { font-size: 1.2rem; }
  .lead                   { font-size: 1.1rem; }

  /* Page head: stack title block above action buttons */
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.1rem;
    margin-bottom: 1.8rem;
    padding-bottom: 1.2rem;
  }
  .page-head .actions     { width: 100%; flex-wrap: wrap; gap: 0.5rem; }

  /* Stats: smaller numerals, tighter padding */
  .stat                   { padding: 1.25rem 1.2rem; gap: 0.35rem; }
  .stat .value            { font-size: 1.9rem; }

  /* Cards & empty states */
  .card                   { padding: 1.2rem; }
  .empty                  { padding: 2.5rem 1.2rem; }

  /* Tables: a touch denser, and they horizontally scroll */
  .table-wrap .table      { min-width: 560px; }
  .table-wrap .table th,
  .table-wrap .table td   { padding: 0.7rem 0.85rem; font-size: 0.85rem; }
  .table-wrap .table th:first-child,
  .table-wrap .table td:first-child { padding-left: 1.1rem; }
  .table-wrap .table th:last-child,
  .table-wrap .table td:last-child  { padding-right: 1.1rem; }

  /* Forms: 16px+ inputs to avoid iOS zoom */
  .field input[type="text"],
  .field input[type="email"],
  .field input[type="password"],
  .field input[type="number"],
  .field input[type="date"],
  .field textarea,
  .field select           { font-size: 16px; padding: 0.7rem 0.85rem; }
  .form                   { gap: 1.1rem; }

  /* Form action row wraps */
  .form-actions           { flex-wrap: wrap; gap: 0.5rem; }
  .form-actions .btn      { flex: 1 1 auto; justify-content: center; min-width: 44%; }
  .form-actions .link-btn { flex: 1 0 100%; text-align: left; margin-top: 0.5rem; }

  /* Auth */
  .auth-wrap              { padding: 1.5rem; }
  .auth-card              { padding: 2rem 1.5rem; max-width: 100%; }
  .auth-card h1           { font-size: 2.1rem; }

  /* Public statement */
  .public-wrap            { padding: 3rem 1.25rem; }
  .public-masthead h1     { font-size: 2.9rem; }
  .public-masthead .meta-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .public-stats           { grid-template-columns: 1fr 1fr; gap: 1.4rem; padding: 1.5rem 0; }
  .public-stat .val       { font-size: 2.1rem; }
  .public-entry {
    grid-template-columns: 56px 1fr;
    gap: 0.8rem 1rem;
    padding: 1.1rem 0;
  }
  .public-entry .meta {
    grid-column: 2;
    text-align: left;
    margin-top: 0.4rem;
    font-size: 0.78rem;
  }

  /* Token row wraps */
  .token-row              { flex-wrap: wrap; padding: 0.85rem 0.95rem; }
  .token-row .url         { flex: 1 0 100%; padding-bottom: 0.5rem; }

  /* Buttons: bigger touch targets */
  .btn                    { min-height: 40px; padding: 0.65rem 1rem; }
  .btn.sm                 { min-height: 34px; padding: 0.45rem 0.8rem; }
  .btn.lg                 { min-height: 46px; }

  /* Chips */
  .chip                   { padding: 0.45rem 0.85rem; font-size: 0.82rem; }

  /* Segmented control: smaller padding on mobile */
  .segmented label        { padding: 0.65rem 0.6rem; font-size: 0.85rem; }
}

@media (max-width: 480px) {
  h1                      { font-size: 2rem; }
  .page-head h1           { font-size: 1.9rem; }
  .public-masthead h1     { font-size: 2.4rem; }
  .public-stats           { grid-template-columns: 1fr; gap: 1.2rem; }
  .auth-card              { padding: 1.75rem 1.25rem; }
  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2            { grid-template-columns: 1fr; }
  .stat                   { padding: 1.1rem 1.1rem; }
  .stat .value            { font-size: 1.85rem; }
  .topbar                 { padding: 0.6rem 0.9rem; min-height: 54px; }
  .topbar .brand          { font-size: 1.2rem; }
  .topbar-actions .btn.sm { padding: 0.4rem 0.7rem; }
  .shell                  { padding: 0 1rem; }
}

/* Print: clean statement output for client */
@media print {
  body                    { background: #fff; color: #000; }
  body::before, .sidebar, .topbar, .sidebar-backdrop, .footer, .actions, .chips, form.inline, .btn,
  .token-row              { display: none !important; }
  .content-wrap           { margin: 0; }
  .public-wrap            { padding: 0; background: #fff; }
  .public-inner           { max-width: 100%; }
  .public-masthead        { border-bottom: 2px solid #000; }
  .public-masthead h1,
  .public-stat .val,
  .public-entry .desc,
  .stat .value, h1, h2, h3, .lead, .eyebrow, p { color: #000 !important; }
  .public-entry           { border-color: #ddd; }
  .public-stat .eyebrow,
  .public-stat .sub,
  .muted, .soft           { color: #555 !important; }
  a                       { color: #000 !important; border-bottom: none; }
}
