/*
 * Airlock Cloud — design system (P3.5).
 * A refined, trustworthy-but-modern look for a security/approval product.
 *
 * Contents
 *   1. Design tokens (light + dark palettes via CSS custom properties)
 *   2. Reset & base
 *   3. Layout (header/nav, container, auth shell)
 *   4. Components
 *        - buttons
 *        - segmented tabs
 *        - cards (approval rows)
 *        - badges (status / risk)
 *        - forms & auth card
 *        - flash / toast
 *        - evidence detail + timeline
 *        - pagination
 *        - empty states
 *   5. Utilities & motion
 */

/* ========================================================================
 * 1. DESIGN TOKENS
 * ---------------------------------------------------------------------- */
:root {
  /* Type */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.85rem;
  --text-base: 0.95rem;
  --text-lg: 1.1rem;
  --text-xl: 1.4rem;
  --text-2xl: 1.85rem;

  /* Radius / depth / motion */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.14);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 170ms;

  /* Brand accent — a confident indigo/violet. */
  --accent: #0d9488;
  --accent-strong: #0f766e;
  --accent-contrast: #ffffff;

  /* ---- LIGHT palette (default) ---- */
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f2f7;
  --surface-hover: #f7f8fc;
  --border: #e3e6ef;
  --border-strong: #cdd2e0;
  --text: #1c2233;
  --text-muted: #626a7e;
  --text-faint: #8b92a5;

  --accent-tint: #d8f3ee;
  --accent-ring: rgba(13, 148, 136, 0.35);

  --success: #16794a;
  --success-tint: #e4f5ec;
  --success-border: #b9e3cc;

  --danger: #c23b34;
  --danger-tint: #fdeae8;
  --danger-border: #f2c3bf;

  --warning: #9a6b12;
  --warning-tint: #fbf1dc;
  --warning-border: #ecd9ac;

  --info: #2563a8;
  --info-tint: #e6f0fb;
  --info-border: #bcd6f0;

  color-scheme: light;
}

/* Explicit light override (theme toggle stamps data-theme). */
:root[data-theme="light"] { color-scheme: light; }

/* ---- DARK palette ---- */
:root[data-theme="dark"] {
  --accent: #2dd4bf;
  --accent-strong: #14b8a6;
  --accent-contrast: #0b0e16;

  --bg: #0b0e16;
  --surface: #151a26;
  --surface-2: #1b2231;
  --surface-hover: #1e2636;
  --border: #29313f;
  --border-strong: #3a4354;
  --text: #e6e9f2;
  --text-muted: #9aa4b8;
  --text-faint: #6b7488;

  --accent-tint: #10261f;
  --accent-ring: rgba(45, 212, 191, 0.4);

  --success: #4ade80;
  --success-tint: #10241a;
  --success-border: #235f3f;

  --danger: #f28b82;
  --danger-tint: #2a1614;
  --danger-border: #6b3029;

  --warning: #f0c368;
  --warning-tint: #2a2113;
  --warning-border: #6b5423;

  --info: #7ab8f5;
  --info-tint: #12233a;
  --info-border: #2b4d73;

  color-scheme: dark;
}

/* Follow the OS when the user hasn't chosen (no data-theme set). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --accent: #2dd4bf;
    --accent-strong: #14b8a6;
    --accent-contrast: #0b0e16;

    --bg: #0b0e16;
    --surface: #151a26;
    --surface-2: #1b2231;
    --surface-hover: #1e2636;
    --border: #29313f;
    --border-strong: #3a4354;
    --text: #e6e9f2;
    --text-muted: #9aa4b8;
    --text-faint: #6b7488;

    --accent-tint: #10261f;
    --accent-ring: rgba(45, 212, 191, 0.4);

    --success: #4ade80;
    --success-tint: #10241a;
    --success-border: #235f3f;

    --danger: #f28b82;
    --danger-tint: #2a1614;
    --danger-border: #6b3029;

    --warning: #f0c368;
    --warning-tint: #2a2113;
    --warning-border: #6b5423;

    --info: #7ab8f5;
    --info-tint: #12233a;
    --info-border: #2b4d73;

    color-scheme: dark;
  }
}

/* ========================================================================
 * 2. RESET & BASE
 * ---------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Smooth color transitions when the theme flips (respect reduced-motion). */
body,
.site-header,
.card,
.approval-card,
.badge,
.btn,
.tab,
.auth-card,
input,
.flash {
  transition: background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

h1, h2, h3 { line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: var(--text-2xl); margin: 0 0 0.25rem; }
h2 { font-size: var(--text-lg); margin: 0 0 0.5rem; }

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

code, .mono { font-family: var(--font-mono); font-size: 0.9em; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ========================================================================
 * 3. LAYOUT
 * ---------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.5rem;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 750;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}
.site-header .brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.brand-mark svg { width: 16px; height: 16px; display: block; }

.site-header nav { display: flex; align-items: center; gap: 0.75rem; }
.site-header .who {
  color: var(--text-muted);
  font-size: var(--text-sm);
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
}

/* ========================================================================
 * 4. COMPONENTS
 * ---------------------------------------------------------------------- */

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary,
.btn-approve {
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover,
.btn-approve:hover { background: var(--accent-strong); }

.btn-approve {
  color: #fff;
  background: var(--success);
  border-color: transparent;
}
.btn-approve:hover { background: color-mix(in srgb, var(--success) 84%, #000); }

.btn-reject {
  color: var(--danger);
  background: var(--danger-tint);
  border-color: var(--danger-border);
}
.btn-reject:hover { background: color-mix(in srgb, var(--danger-tint) 80%, var(--danger)); }

.btn-block { width: 100%; }

/* Ghost/link-style control (used for Sign out, Evidence link). */
.linkish {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.35rem 0.7rem;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 550;
  color: var(--text-muted);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
}
.linkish:hover {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}

/* Icon-only button (theme toggle). */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease),
    color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--surface-hover); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; display: block; }
/* Show the correct glyph per theme; toggled by the sun/moon swap. */
.icon-btn .icon-sun { display: none; }
.icon-btn .icon-moon { display: block; }
:root[data-theme="dark"] .icon-btn .icon-sun { display: block; }
:root[data-theme="dark"] .icon-btn .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .icon-btn .icon-sun { display: block; }
  :root:not([data-theme]) .icon-btn .icon-moon { display: none; }
}

/* ---- Inbox header + segmented tabs ---- */
.inbox-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.inbox-head .subtitle { color: var(--text-muted); font-size: var(--text-sm); margin: 0.1rem 0 0; }

.tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* ---- Approval cards ---- */
.approvals-list { display: flex; flex-direction: column; gap: 0.85rem; }

.card,
.approval-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.approval-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.1rem 1.2rem;
  position: relative;
}
.approval-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }

/* A subtle status accent stripe on the left edge. */
.approval-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  opacity: 0.85;
}
.approval-card.status-approved::before { background: var(--success); }
.approval-card.status-rejected::before { background: var(--danger); }

.approval-main { min-width: 0; flex: 1; }
.approval-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.6rem; }
.action-type {
  font-weight: 650;
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
  color: var(--text);
}
.cost {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.1rem 0.55rem;
  font-variant-numeric: tabular-nums;
}
.age { color: var(--text-faint); font-size: var(--text-xs); }
.summary {
  margin: 0.5rem 0 0.7rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.approval-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.approval-actions form { margin: 0; }
.decide { display: flex; align-items: center; gap: 0.5rem; }

/* Reject-with-reason-code (contract v1.2.0): the reason picker is hidden until
   the reviewer clicks Reject, then revealed as a compact panel (progressive
   disclosure — see reject_controller.js). */
.reject-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(19rem, 100%);
  padding: 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  animation: reject-panel-in var(--dur) var(--ease);
}
.reject-panel[hidden] { display: none; }
@keyframes reject-panel-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.reject-panel-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}
.reject-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.form-select,
.reject-note {
  min-height: 38px;
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.form-select {
  cursor: pointer;
  /* Native chevron; the control stays theme-aware via the tokens above. */
  appearance: auto;
}
.reject-note::placeholder { color: var(--text-muted); }
.form-select:focus-visible,
.reject-note:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
}
.reject-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.btn-ghost {
  color: var(--text-muted);
  background: transparent;
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-hover); }

/* ---- Badges ---- */
.badges { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
  padding: 0.16rem 0.55rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  text-transform: capitalize;
  white-space: nowrap;
}

/* Semantic fills */
.badge.badge-context { color: var(--info); background: var(--info-tint); border-color: var(--info-border); text-transform: none; }
.badge.rev-reversible { color: var(--text-muted); background: var(--surface-2); border-color: var(--border); }
.badge.rev-irreversible { color: var(--warning); background: var(--warning-tint); border-color: var(--warning-border); }

.badge.blast-low { color: var(--success); background: var(--success-tint); border-color: var(--success-border); }
.badge.blast-medium { color: var(--warning); background: var(--warning-tint); border-color: var(--warning-border); }
.badge.blast-high { color: var(--danger); background: var(--danger-tint); border-color: var(--danger-border); }

.badge.decision-approved { color: var(--success); background: var(--success-tint); border-color: var(--success-border); }
.badge.decision-rejected { color: var(--danger); background: var(--danger-tint); border-color: var(--danger-border); }
.badge.decision-requested { color: var(--warning); background: var(--warning-tint); border-color: var(--warning-border); }

.badge.delivery-delivered { color: var(--success); background: var(--success-tint); border-color: var(--success-border); }
.badge.delivery-failed,
.badge.delivery-exhausted { color: var(--danger); background: var(--danger-tint); border-color: var(--danger-border); }
.badge.delivery-pending,
.badge.delivery-delivering { color: var(--info); background: var(--info-tint); border-color: var(--info-border); }

.badge-lg { font-size: var(--text-sm); padding: 0.28rem 0.7rem; }

/* A little status dot inside decision badges. */
.badge::before { content: none; }

/* ---- Forms & auth card ---- */
.auth-shell {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem 1.9rem;
}
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
  margin-bottom: 1.6rem;
}
.auth-brand .brand-mark { width: 44px; height: 44px; border-radius: 12px; }
.auth-brand .brand-mark svg { width: 24px; height: 24px; }
.auth-title { font-size: var(--text-xl); margin: 0; }
.auth-subtitle { color: var(--text-muted); font-size: var(--text-sm); margin: 0; }

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.input,
.text-input,
input[type="email"],
input[type="password"],
input[type="text"],
input[type="url"] {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.8rem;
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}
.input::placeholder,
input::placeholder { color: var(--text-faint); }
.input:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.auth-actions { margin-top: 1.4rem; }
.auth-foot { margin-top: 1.2rem; text-align: center; font-size: var(--text-sm); }

/* ---- Flash / toast ---- */
#flash {
  position: fixed;
  top: 4.5rem;
  right: 1.25rem;
  left: auto;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: min(420px, calc(100vw - 2rem));
}
.flash {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  font-size: var(--text-sm);
  font-weight: 550;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: toast-in 220ms var(--ease);
}
.flash-notice { color: var(--success); background: var(--success-tint); border-color: var(--success-border); }
.flash-alert { color: var(--danger); background: var(--danger-tint); border-color: var(--danger-border); }
.flash-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.2rem;
}
.flash-close:hover { opacity: 1; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Evidence detail ---- */
.back-link { margin-bottom: 1rem; }

.evidence-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.evidence-header h1 { margin: 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
}
.panel > h2 {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 0 0 1rem;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.1rem 1.5rem;
  margin: 0;
}
.evidence-grid > div { min-width: 0; }
.evidence-grid dt {
  color: var(--text-faint);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.evidence-grid dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.evidence-grid dd code {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
}

/* ---- Timeline ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 1.1rem 1.5rem;
  border-left: 2px solid var(--border);
}
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.timeline li.tl-approved::before { background: var(--success); }
.timeline li.tl-rejected::before { background: var(--danger); }
.timeline .tl-title { font-weight: 600; }
.timeline .tl-meta { color: var(--text-muted); font-size: var(--text-sm); }
.timeline .reason {
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: 0.5rem 0.7rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
/* The chosen structured reason_code — teal-accented to read as the primary,
   curated rejection signal above any free-text note. */
.timeline .reason-code {
  color: var(--text);
  border-left: 3px solid var(--accent);
}
.timeline .reason-code code { color: var(--accent-strong); }

.delivery-attempts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.delivery-attempts li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.65rem 0.8rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}
.delivery-attempts .age { margin-left: auto; }
.delivery-error { color: var(--danger); font-family: var(--font-mono); font-size: var(--text-xs); }

.note {
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: 0.75rem 0.9rem;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.note-danger {
  color: var(--danger);
  background: var(--danger-tint);
  border: 1px solid var(--danger-border);
  border-style: solid;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.pagination-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.65rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.pagination-item:hover { color: var(--text); background: var(--surface-hover); border-color: var(--border-strong); text-decoration: none; }
.pagination-item.is-current {
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: transparent;
  cursor: default;
}
.pagination-item.is-disabled { opacity: 0.4; pointer-events: none; }
.pagination-gap { padding: 0 0.35rem; color: var(--text-faint); }

/* ---- Empty states ---- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  padding: 3.5rem 1.5rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}
.empty svg { width: 44px; height: 44px; color: var(--text-faint); opacity: 0.85; }
.empty .empty-title { font-weight: 650; font-size: var(--text-lg); color: var(--text); }
.empty .empty-sub { font-size: var(--text-sm); max-width: 34ch; }

/* ========================================================================
 * 5. UTILITIES & MOTION
 * ---------------------------------------------------------------------- */
.text-muted { color: var(--text-muted); }
.stack > * + * { margin-top: 0.75rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media (max-width: 640px) {
  .approval-card { flex-direction: column; align-items: stretch; }
  .approval-actions { justify-content: flex-end; }
  .site-header .who { max-width: 30vw; }
  #flash { left: 1rem; right: 1rem; max-width: none; }
}

/* ---- Settings page ---- */
.nav-link { display: inline-flex; align-items: center; gap: 0.35rem; }
.nav-link svg { flex-shrink: 0; }

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.settings-card h2 { margin: 0 0 0.35rem; }
.settings-help {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
  margin: 0 0 1.25rem;
  max-width: 62ch;
}
.settings-help code {
  font-family: var(--font-mono, monospace);
  font-size: 0.85em;
  padding: 0.05rem 0.3rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.settings-form .field { margin-bottom: 1rem; }
.field-hint {
  display: block;
  color: var(--text-muted);
  font-weight: 400;
  font-size: var(--text-sm);
  margin: 0.4rem 0 0;
}
label .field-hint { display: inline; margin: 0; }

.copyable {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.5rem 0.5rem 0.8rem;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  max-width: 100%;
}
.copyable code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  font-family: var(--font-mono, monospace);
  font-size: var(--text-sm);
  color: var(--text);
}
.btn-sm { min-height: 30px; padding: 0.3rem 0.7rem; font-size: var(--text-sm); flex-shrink: 0; }

.secret-reveal {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: var(--warning-tint);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-sm);
}
.secret-reveal label { color: var(--warning); }
