/* ==========================================================================
   VeyraTrack design system
   Light theme only. Every colour/size/radius/shadow is a token below.
   ========================================================================== */

:root {
  /* Colour: surfaces & text */
  --c-bg: #f5f6f8;
  --c-surface: #ffffff;
  --c-surface-2: #f0f1f4;
  --c-border: #e2e4e9;
  --c-border-strong: #cdd1d9;
  --c-text: #1a1d24;
  --c-text-muted: #6b7280;
  --c-text-subtle: #9aa1ac;

  /* Colour: brand accent */
  --c-accent: #4f46e5;
  --c-accent-hover: #4338ca;
  --c-accent-soft: #eef0fe;
  --c-text-on-accent: #ffffff;

  /* Colour: semantic */
  --c-success: #15803d;
  --c-success-soft: #dcfce7;
  --c-danger: #b91c1c;
  --c-danger-soft: #fde3e2;
  --c-warning: #b45309;
  --c-warning-soft: #fef1d6;
  --c-info: #0369a1;
  --c-info-soft: #e0f2fe;
  --c-violet: #7e22ce;
  --c-violet-soft: #f2e8fe;
  --c-neutral: #475569;
  --c-neutral-soft: #eceef1;

  /* Typography */
  --ff-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.875rem;
  --fs-md: 0.9375rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --lh-base: 1.5;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;

  /* Radius */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-full: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.10);
  --shadow-lg: 0 16px 36px rgba(16, 24, 40, 0.16);

  /* Motion */
  --t-fast: .12s ease;

  /* Layout */
  --sidebar-w: 236px;
}

/* ==========================================================================
   Reset
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ==========================================================================
   Base elements
   ========================================================================== */

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--ff-base);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-bg);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--c-text);
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4, h5, h6 { font-size: var(--fs-md); }

p { margin-bottom: var(--sp-3); }

a {
  color: var(--c-accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

small { font-size: var(--fs-xs); color: var(--c-text-muted); }

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: var(--fs-xs);
  background: var(--c-surface-2);
  padding: 1px 5px;
  border-radius: var(--r-sm);
}

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  /* :root repeated (not a typo) raises specificity to (0,2,0) so this beats every
     single-class component rule that sets `transition` (.btn, .tab, .nav-link,
     .card) without needing !important. */
  :root:root *, :root:root *::before, :root:root *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
    scroll-behavior: auto;
  }
}

/* ==========================================================================
   Form controls
   ========================================================================== */

input, select, textarea {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  color: var(--c-text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

textarea { min-height: 5.5em; resize: vertical; }

input::placeholder, textarea::placeholder { color: var(--c-text-subtle); }

input:hover, select:hover, textarea:hover { border-color: var(--c-neutral); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}

input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
}

input[type="checkbox"], input[type="radio"] {
  width: auto;
  accent-color: var(--c-accent);
}

/* Native selects render their own chevron and a different box height per OS/browser;
   turn that off and draw a matching one so selects line up with adjacent inputs. */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: var(--sp-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  background-size: 16px 16px;
}
/* Touch devices get the OS picker back: no room for a fake chevron and no hover state to style for. */
@media (pointer: coarse) {
  select {
    appearance: auto;
    -webkit-appearance: menulist;
    background-image: none;
    padding-right: var(--sp-3);
  }
}

label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--c-text-muted);
  margin-bottom: var(--sp-4);
}
label > input, label > select, label > textarea { margin-top: var(--sp-1); }

.checkbox {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 500;
  color: var(--c-text);
  margin-bottom: 0;
}
.checkbox input { width: 16px; height: 16px; }

.field-error {
  color: var(--c-danger);
  font-size: var(--fs-xs);
  margin-top: var(--sp-1);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: var(--c-surface);
  color: var(--c-text);
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-text-on-accent);
}
.btn-primary:hover { background: var(--c-accent-hover); border-color: var(--c-accent-hover); }

.btn-secondary {
  background: var(--c-surface);
  border-color: var(--c-border-strong);
  color: var(--c-text);
}
.btn-secondary:hover { background: var(--c-surface-2); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--c-text-muted);
}
.btn-ghost:hover { background: var(--c-neutral-soft); color: var(--c-text); }

.btn-sm { padding: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); }

.btn-icon { padding: var(--sp-2); }
.btn-icon.btn-sm { padding: var(--sp-1); }

/* ==========================================================================
   Tables
   ========================================================================== */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}
.table th {
  text-align: left;
  color: var(--c-text-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: var(--sp-3);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.table td {
  padding: var(--sp-3);
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--c-bg); }
.table tbody tr:last-child td { border-bottom: none; }
.table tfoot td {
  font-weight: 600;
  border-top: 1px solid var(--c-border-strong);
  border-bottom: none;
}
.table.compact th, .table.compact td { padding: var(--sp-2) var(--sp-3); }

.th-sort { color: var(--c-text-muted); display: inline-flex; align-items: center; gap: var(--sp-1); }
.th-sort:hover { color: var(--c-text); text-decoration: none; }
.th-sort.is-sorted { color: var(--c-text); }
.sort-arrow { width: 12px; height: 12px; }
.sort-arrow.is-asc { transform: rotate(180deg); }

/* legacy alias kept so old unstyled table markup does not collapse */
table.compact td, table.compact th { padding: var(--sp-2) var(--sp-3); }

/* Wrap a wide table in this so it scrolls horizontally on its own instead of
   truncating a column or forcing the whole page to scroll sideways. */
.table-wrap { overflow-x: auto; margin-bottom: var(--sp-4); }
.table-wrap > .table { min-width: 760px; margin-bottom: 0; }

/* ==========================================================================
   Panels
   ========================================================================== */

.panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--c-border);
  font-weight: 600;
}
.panel-body { display: flex; flex-direction: column; gap: var(--sp-4); }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  align-items: start;
}
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.fieldset {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.fieldset-legend {
  padding: 0 var(--sp-2);
  font-weight: 600;
  font-size: var(--fs-sm);
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 500;
  padding: 2px 8px;
  background: var(--c-neutral-soft);
  color: var(--c-neutral);
  white-space: nowrap;
}
.badge-neutral { background: var(--c-neutral-soft); color: var(--c-neutral); }
.badge-success { background: var(--c-success-soft); color: var(--c-success); }
.badge-warn { background: var(--c-warning-soft); color: var(--c-warning); }
.badge-danger { background: var(--c-danger-soft); color: var(--c-danger); }
.badge-info { background: var(--c-info-soft); color: var(--c-info); }
.badge.warn { background: var(--c-danger-soft); color: var(--c-danger); }
.badge.trial { background: var(--c-violet-soft); color: var(--c-violet); }

/* ==========================================================================
   Tabs
   ========================================================================== */

.tabs {
  display: flex;
  gap: var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--sp-5);
}
.tab {
  padding: var(--sp-3) 0;
  color: var(--c-text-muted);
  font-weight: 500;
  font-size: var(--fs-base);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--c-text); text-decoration: none; }
.tab.is-active { color: var(--c-accent); border-bottom-color: var(--c-accent); }

/* ==========================================================================
   Banners
   ========================================================================== */

.banner {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-text);
  font-size: var(--fs-base);
  margin-bottom: var(--sp-4);
}
.banner-danger {
  background: var(--c-danger-soft);
  border-color: var(--c-danger-soft);
  color: var(--c-danger);
}
.banner-warn {
  background: var(--c-warning-soft);
  border-color: var(--c-warning-soft);
  color: var(--c-warning);
}
.banner-inline {
  display: inline-flex;
  width: auto;
  padding: var(--sp-1) var(--sp-3);
  margin-bottom: 0;
  font-size: var(--fs-xs);
  font-weight: 500;
}
.banner-inline:hover { text-decoration: none; filter: brightness(0.97); }

/* ==========================================================================
   Toasts
   ========================================================================== */

#toasts {
  position: fixed;
  right: var(--sp-5);
  bottom: var(--sp-5);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: 320px;
}
.toast {
  background: var(--c-text);
  color: var(--c-text-on-accent);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
}
.toast-danger { background: var(--c-danger); }
.toast-info { background: var(--c-info); }
.toast.is-leaving {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--t-fast), transform var(--t-fast);
}

/* ==========================================================================
   Empty states
   ========================================================================== */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-5);
  color: var(--c-text-muted);
  text-align: center;
  font-size: var(--fs-base);
}

.search-empty {
  padding: var(--sp-4);
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}

/* ==========================================================================
   Avatars
   ========================================================================== */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--r-full);
  background: var(--c-accent-soft);
  color: var(--c-accent);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.avatar-xs { width: 20px; height: 20px; font-size: 10px; }

/* ==========================================================================
   App shell
   ========================================================================== */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  padding: var(--sp-4);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: block;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--c-text);
  padding: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.sidebar-brand:hover { text-decoration: none; }

.nav {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  color: var(--c-text-muted);
  font-size: var(--fs-base);
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-link:hover { background: var(--c-neutral-soft); color: var(--c-text); text-decoration: none; }
.nav-link.is-active { background: var(--c-accent-soft); color: var(--c-accent); }

.nav-count {
  margin-left: auto;
  background: var(--c-accent);
  color: var(--c-text-on-accent);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--r-full);
}

.sidebar-user {
  padding-top: var(--sp-3);
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: var(--fs-xl); font-weight: 600; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }

.topbar-search { position: relative; display: flex; align-items: center; flex: 1; max-width: 360px; }
.topbar-search .icon { position: absolute; left: var(--sp-3); color: var(--c-text-subtle); pointer-events: none; }
.topbar-search input { padding-left: var(--sp-7); }

.main {
  flex: 1;
  min-width: 0;
  padding: var(--sp-6);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: var(--sp-7);
  text-align: center;
}
.auth-card h1 { margin-bottom: var(--sp-2); }
.auth-card p { color: var(--c-text-muted); margin-bottom: var(--sp-5); }
.auth-card form + form { margin-top: var(--sp-2); }
.auth-card .btn { width: 100%; }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    flex: 0 0 auto;
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid var(--c-border);
    position: static;
    height: auto;
  }
  .sidebar-brand { margin-bottom: 0; }
  .nav { flex-direction: row; flex: none; }
  .nav-link { white-space: nowrap; }
  .sidebar-user { border-top: none; border-left: 1px solid var(--c-border); padding-top: 0; padding-left: var(--sp-3); flex-direction: row; margin-left: auto; }
  .main { padding: var(--sp-4); }
}

/* ==========================================================================
   Icons
   ========================================================================== */

.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: -3px;
}

/* ==========================================================================
   Board
   ========================================================================== */

.board {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  padding-bottom: var(--sp-4);
  flex: 1;
  min-height: 0;
}

.column {
  flex: 0 0 272px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.column-head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-1);
}
.column-head > .row { justify-content: space-between; }
.column-title { font-weight: 600; font-size: var(--fs-sm); }
.column-total { font-size: var(--fs-xs); color: var(--c-text-muted); margin-bottom: var(--sp-2); }

.guidance-wrap { margin-bottom: var(--sp-2); }
.guidance {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  cursor: pointer;
}

.column-cards {
  flex: 1;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  overflow-y: auto;
}
.column-cards:empty {
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-md);
  min-height: 80px;
}
.column-cards:empty::after {
  content: "Drop a school here";
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 80px;
  color: var(--c-text-subtle);
  font-size: var(--fs-xs);
}

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-title { display: block; font-weight: 600; font-size: var(--fs-sm); color: var(--c-text); margin-bottom: var(--sp-1); }
.card-title:hover { text-decoration: underline; }
.card-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}
.card-value { font-weight: 600; color: var(--c-text); }
.card-tags { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-2); }

.card.is-dragging { opacity: .6; box-shadow: var(--shadow-lg); }
.sortable-ghost { opacity: .5; background: var(--c-accent-soft); border: 1px dashed var(--c-accent); }

/* ==========================================================================
   School page
   ========================================================================== */

.school-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
}
.school-title { font-size: var(--fs-xl); font-weight: 700; margin-bottom: var(--sp-1); }

.school-stats, .stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface-2);
  border-radius: var(--r-md);
  min-width: 96px;
}
.stat > small { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .03em; }
.stat > strong { font-size: var(--fs-lg); font-weight: 700; }
.stat-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .03em; color: var(--c-text-muted); }
.stat-value { display: block; font-size: var(--fs-lg); font-weight: 700; color: var(--c-text); }

#fields th { width: 35%; }
.school-header > .banner, .school-header > .changes { flex: 1 1 100%; }
.changes-summary { cursor: pointer; list-style: none; margin-bottom: var(--sp-2); }
.changes-summary::-webkit-details-marker { display: none; }
.changes[open] .changes-summary { margin-bottom: var(--sp-3); }

.chart-box { height: 260px; position: relative; }

.timeline { display: flex; flex-direction: column; gap: var(--sp-3); }
.timeline-item {
  position: relative;
  border-left: 3px solid var(--c-border-strong);
  padding: var(--sp-1) var(--sp-4);
}
.timeline-dot {
  position: absolute;
  left: -5px;
  top: var(--sp-2);
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--c-border-strong);
}
.timeline-item.note { border-color: var(--c-info); }
.timeline-item.note .timeline-dot { background: var(--c-info); }
.timeline-item.email { border-color: var(--c-success); }
.timeline-item.email .timeline-dot { background: var(--c-success); }
.timeline-item.stage { border-color: var(--c-warning); }
.timeline-item.stage .timeline-dot { background: var(--c-warning); }
.timeline-item.reminder { border-color: var(--c-violet); }
.timeline-item.reminder .timeline-dot { background: var(--c-violet); }
.timeline-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.source { font-size: var(--fs-xs); color: var(--c-text-muted); font-style: italic; }

.contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--c-border);
}
.contact-row:last-child { border-bottom: none; }

.message {
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--c-border);
}
.message:last-child { border-bottom: none; }
.message-head {
  display: flex;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  margin-bottom: var(--sp-1);
}

.pricing-summary {
  background: var(--c-surface-2);
  border-radius: var(--r-md);
  padding: var(--sp-4);
}

/* ==========================================================================
   Global search
   ========================================================================== */

.search-results:empty { display: none; }
.search-results.is-hidden { display: none; }
.search-results {
  position: absolute;
  top: calc(100% + var(--sp-1));
  left: 0;
  right: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 20;
}
/* No overflow:hidden on the container (it would clip the focus ring on the first/last
   result); round the end items individually instead so the list still looks contained. */
.search-result:first-child, .search-empty:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
.search-result:last-child, .search-empty:last-child { border-radius: 0 0 var(--r-md) var(--r-md); }
.search-result:only-child, .search-empty:only-child { border-radius: var(--r-md); }
.search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  color: var(--c-text);
}
.search-result:hover { background: var(--c-bg); text-decoration: none; }

/* ==========================================================================
   Forms layout helpers
   ========================================================================== */

.field { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-4); }
.field-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--c-text-muted);
}
/* .field wraps its control directly (<label class="field"><span class="field-label">…</span><input>…</label>)
   for implicit label association; cancel the generic `label > control` margin-top/weight so the
   rendered spacing and text weight match the previous label+div sibling markup exactly. */
.field > input, .field > select, .field > textarea {
  margin-top: 0;
  font-weight: normal;
}
.field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.field-row > * { margin-bottom: 0; flex: 1 1 160px; }
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4);
}

.field-icon { position: relative; display: flex; align-items: center; }
.field-icon .icon {
  position: absolute;
  left: var(--sp-3);
  color: var(--c-text-subtle);
  pointer-events: none;
}
.field-icon input { padding-left: var(--sp-8); }

.search-row .field-icon { flex: 1 1 240px; max-width: 360px; }
.search-row .btn { flex: 0 0 auto; }

/* ==========================================================================
   Utilities
   ========================================================================== */

.subtle { color: var(--c-text-subtle); font-size: var(--fs-xs); }
.right { margin-left: auto; }
.row { display: flex; align-items: center; gap: var(--sp-2); }
.overdue { color: var(--c-danger); font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pre-wrap { white-space: pre-wrap; margin: 0; }
.is-done { opacity: .6; }
