/* ──────────────────────────────────────────────────────────────────────────
 * RetentionIQ™ stylesheet
 *
 * Design grammar inherited from Elmer v3 "Soft Sunrise":
 *   - warm-toned neutrals (not gray)
 *   - Inter, with size scale via weight more than size
 *   - 8px-base spacing, 6–12px radius, quiet shadow scale
 *   - per-tenant brand tokens injected at the top of each page (base.html)
 *
 * See docs/design/STYLE_ALIGNMENT.md for the alignment plan and rationale.
 * ────────────────────────────────────────────────────────────────────────── */

:root {
  /* Neutrals (Elmer Soft Sunrise) — NOT tenant-themed */
  --bg:           #FAFAF8;
  --surface:     #FFFFFF;
  --surface-alt: #F5F3F0;
  --border:      #E8E4DF;
  --border-light:#F0EDE9;
  --text:        #2D2A26;
  --text-secondary: #6B6560;
  --text-muted:  #9C9590;

  /* Spacing scale (8px base, plus 4px half-step) */
  --gap-xs:  4px;
  --gap-sm:  8px;
  --gap:    12px;
  --gap-lg: 16px;
  --gap-xl: 20px;
  --gap-2xl: 24px;

  /* Radius */
  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;

  /* Shadows — quiet, layered, not dramatic */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--brand-primary); }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.mono {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
}

/* ── Header ─────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  gap: var(--gap-lg);
  background: var(--brand-primary);
  color: #fff;
  padding: 10px var(--gap-2xl);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: var(--gap); }
.brand-logo {
  height: 32px; width: auto;
  border-radius: var(--radius-sm);
  background: #fff; padding: 2px;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }
.brand-name span { color: var(--brand-accent); }
.brand-tenant {
  font-size: 11px; color: var(--brand-accent);
  text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 600;
}
.app-nav { flex: 1; display: flex; gap: 2px; }
.nav-link {
  color: #fff;
  text-decoration: none;
  padding: 7px var(--gap);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.1); }
.app-user { display: flex; align-items: center; gap: var(--gap); font-size: 13px; }
.user-name { color: rgba(255,255,255,0.85); }
.logout-form { display: inline; margin: 0; }
.link-button {
  background: none; border: 0; color: var(--brand-accent);
  font: inherit; cursor: pointer; padding: 0;
}
.link-button:hover { text-decoration: underline; }
.link-danger { color: #b00 !important; }

/* ── Main ───────────────────────────────────────────── */
.app-main { padding: var(--gap-xl) var(--gap-2xl) 40px; max-width: 1400px; margin: 0 auto; }
.page-header { margin-bottom: var(--gap-xl); }
.page-header h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; color: var(--text); }
.page-sub { color: var(--text-secondary); font-size: 13px; }
.back-link { font-size: 12px; margin-bottom: 10px; }
.back-link a { text-decoration: none; color: var(--text-secondary); }
.back-link a:hover { color: var(--brand-primary); }

/* ── Flash ──────────────────────────────────────────── */
.flash {
  padding: 10px var(--gap-lg);
  border-radius: var(--radius);
  margin-bottom: var(--gap);
  font-size: 13px;
}
.flash-error { background: #FDECEC; color: #8b1a1a; border-left: 3px solid var(--status-red); }
.flash-success { background: #E8F5ED; color: #1a5b2c; border-left: 3px solid var(--status-green); }

/* ── Login ──────────────────────────────────────────── */
.login-wrap { max-width: 400px; margin: 80px auto; }
.login-brand { text-align: center; margin-bottom: var(--gap-2xl); }
.login-brand .brand-name { font-size: 22px; color: var(--brand-primary); }
.brand-tagline {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px; margin-top: 4px;
}
.login-form {
  background: var(--surface);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.login-form h1 { margin: 0 0 var(--gap-lg); font-size: 18px; font-weight: 700; }

/* ── Forms ──────────────────────────────────────────── */
.field { margin-bottom: var(--gap); }
.field label {
  display: block;
  font-size: 12px; font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-secondary);
}
.field .input,
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=number],
.field select,
.field textarea,
.input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--surface);
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s, outline-color 0.15s;
}
.field .input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus {
  outline: 2px solid var(--brand-accent);
  outline-offset: -2px;
  border-color: var(--brand-accent);
}
.field .input.mono, .input.mono {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
}
.field-error { color: var(--status-red); font-size: 11px; margin-top: 4px; }
.field-hint { color: var(--text-muted); font-size: 11px; margin-top: 4px; }
.label-sm {
  display: block;
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 5px;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap-lg) var(--gap-xl);
  margin-bottom: var(--gap-xl);
  background: var(--surface);
}
fieldset legend {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-secondary);
  padding: 0 6px;
}

.form-narrow { max-width: 440px; }
.form-wide { max-width: 900px; }
.form-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--gap); }

/* ── Buttons ────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
  border: 0;
  padding: 9px var(--gap-lg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
  font-family: inherit;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s, color 0.15s;
}
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { opacity: 0.92; box-shadow: var(--shadow-sm); }
.btn-primary:disabled { background: var(--border); cursor: not-allowed; }
.btn-secondary {
  background: var(--surface);
  color: var(--brand-primary);
  border: 1px solid var(--brand-primary);
}
.btn-secondary:hover { background: var(--brand-primary); color: #fff; }
.btn-danger { background: var(--status-red); color: #fff; }
.btn-danger:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--brand-primary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-alt); border-color: var(--brand-primary); }
.btn-sm { padding: 6px var(--gap); font-size: 12px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }

/* ── Board ──────────────────────────────────────────── */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-lg); }
.board-column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--gap-lg);
  min-height: 420px;
  box-shadow: var(--shadow-sm);
}
.col-header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: var(--gap);
}
.col-title {
  font-weight: 700; font-size: 12px;
  letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--text-secondary);
}
.col-count {
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.col-body { display: flex; flex-direction: column; gap: 10px; }
.col-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 32px var(--gap);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

/* ── Cards ──────────────────────────────────────────── */
.card-link { text-decoration: none; color: inherit; display: block; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap) var(--gap-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.12s, transform 0.05s, border-color 0.12s;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--brand-accent);
}
.card-escalated { background: #FFF8F8; }
.card-escalated-tag {
  font-size: 11px; font-weight: 700;
  color: var(--status-critical);
  letter-spacing: 0.4px; text-transform: uppercase;
  margin-bottom: 6px;
}
.card.status-critical-red { border-left-color: var(--status-critical); }
.card.status-red { border-left-color: var(--status-red); }
.card.status-yellow { border-left-color: var(--status-yellow); }
.card.status-green { border-left-color: var(--status-green); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: var(--gap-sm); }
.card-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.card-id { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.card-signals { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.card-signals li, .signal-chips li, .chip {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  padding: 2px 9px;
  border-radius: 10px;
  display: inline-block;
}
.signal-chips { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 5px; }
.card-risk { font-size: 12px; color: var(--text-secondary); margin: 6px 0; line-height: 1.4; }
.card-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px;
  padding-top: var(--gap-sm);
  border-top: 1px solid var(--border-light);
  font-size: 12px;
}
.card-advisor { color: var(--text-secondary); font-weight: 500; }
.card-timer { font-weight: 700; font-size: 13px; }
.card-outcome { color: var(--status-green); font-weight: 600; }
.timer-green { color: var(--status-green); }
.timer-amber { color: var(--status-yellow); }
.timer-red { color: var(--status-red); }
.timer-overdue { color: var(--status-critical); }
.timer-done { color: var(--text-muted); }

/* ── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  white-space: nowrap;
}
.badge-yellow { background: var(--status-yellow); }
.badge-red { background: var(--status-red); }
.badge-critical-red { background: var(--status-critical); }
.badge-green { background: var(--status-green); }

/* ── Tags (lighter than badges; for status meta) ────── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.tag-neutral { background: var(--surface-alt); color: var(--text-secondary); }
.tag-info    { background: #EBF2FA; color: #1556a5; }
.tag-success { background: #E8F5ED; color: #1a5b2c; }
.tag-danger  { background: #FDECEC; color: #8b1a1a; }

/* ── Case detail ────────────────────────────────────── */
.case-grid { display: grid; grid-template-columns: 1fr 340px; gap: var(--gap-lg); }
.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--gap-lg) var(--gap-xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--gap-lg);
}
.panel-title {
  margin: 0 0 var(--gap);
  font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-secondary);
  font-weight: 700;
}
.case-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--gap);
  margin-bottom: var(--gap-lg);
}
.case-name { margin: 0; font-size: 22px; font-weight: 700; color: var(--text); }
.case-id { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.case-head-right { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.case-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  padding: var(--gap) var(--gap-lg);
  background: var(--surface-alt);
  border-radius: var(--radius);
  margin-bottom: var(--gap-lg);
}
.case-meta > div { display: flex; flex-direction: column; }
.meta-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-muted);
}
.meta-value { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 2px; }
.case-section { margin: 14px 0; }
.case-section p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.section-label {
  font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 700;
}

/* ── Case actions ───────────────────────────────────── */
.action-form {
  margin-bottom: var(--gap);
  padding-bottom: var(--gap);
  border-bottom: 1px solid var(--border-light);
}
.action-form:last-child { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.stage-buttons { display: flex; gap: 6px; margin-bottom: var(--gap-sm); }
.stage-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.12s, background 0.12s;
}
.stage-btn:hover { border-color: var(--brand-primary); }
.stage-btn-active { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }
.stage-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Notes ──────────────────────────────────────────── */
.note-form { margin-bottom: var(--gap); }
.note-form textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  resize: vertical;
  margin-bottom: var(--gap-sm);
  background: var(--surface);
}
.note-list { list-style: none; padding: 0; margin: 0; }
.note-list li { padding: 10px 0; border-top: 1px solid var(--border-light); }
.note-list li:first-child { border-top: 0; }
.note-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-muted);
  margin-bottom: 4px;
}
.note-author { font-weight: 600; color: var(--text-secondary); }
.note-body { font-size: 13px; line-height: 1.5; color: var(--text); white-space: pre-wrap; }
.note-empty { color: var(--text-muted); font-style: italic; }

/* ── Template list ──────────────────────────────────── */
.template-list { list-style: none; padding: 0; margin: 0; }
.template-list li { border-bottom: 1px solid var(--border-light); }
.template-list li:last-child { border-bottom: 0; }
.template-list a {
  display: flex; justify-content: space-between;
  padding: 10px 0; color: var(--text); text-decoration: none;
  font-size: 13px;
}
.template-list a:hover { color: var(--brand-primary); }
.role-tag { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }

/* ── Tables ─────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.data-table th, .data-table td {
  padding: 10px var(--gap);
  font-size: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.data-table th {
  background: var(--surface-alt);
  font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.3px;
  color: var(--text-secondary);
  font-size: 11px;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table .empty { text-align: center; color: var(--text-muted); padding: 30px; }
.row-inactive { opacity: 0.55; }
.audit-payload { color: var(--text-secondary); }
.kv {
  display: inline-block;
  background: var(--surface-alt);
  padding: 2px 7px;
  border-radius: 10px;
  margin-right: 4px;
  margin-bottom: 3px;
  font-size: 11px;
}

.filter-bar {
  display: flex; gap: var(--gap); align-items: end;
  padding: var(--gap) var(--gap-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--gap);
}
.filter-bar label {
  display: flex; flex-direction: column;
  font-size: 11px; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.filter-bar select, .filter-bar input {
  margin-top: 4px; padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit; font-size: 12px;
  background: var(--surface);
}

/* ── Comms preview ──────────────────────────────────── */
.preview-layout { display: grid; grid-template-columns: 360px 1fr; gap: var(--gap-lg); }
.kv-stack > div { margin-bottom: var(--gap); }
.action-list { padding-left: 14px; margin: 4px 0; }
.email-preview {
  width: 100%; min-height: 640px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}
.preview-text summary { cursor: pointer; font-size: 12px; color: var(--text-secondary); padding: 6px; }
.preview-text pre {
  background: var(--surface-alt);
  padding: var(--gap);
  border-radius: var(--radius-sm);
  font-size: 11px; white-space: pre-wrap;
}
.template-cards {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}
.template-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap-lg);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.12s, border-color 0.12s;
}
.template-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand-accent);
}
.template-card-head { display: flex; justify-content: space-between; margin-bottom: var(--gap-sm); }
.template-card-subject { font-size: 12px; color: var(--text-secondary); margin-bottom: var(--gap-sm); }
.template-actions { display: flex; flex-wrap: wrap; gap: 4px; }

/* ── Field user pages ───────────────────────────────── */
.field-page { background: var(--bg); }
.field-shell { max-width: 640px; margin: 0 auto; padding: 28px var(--gap-xl); }
.field-header {
  background: var(--brand-primary);
  color: #fff;
  padding: 18px 22px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.field-header .brand-name { color: #fff; font-weight: 700; }
.field-header .brand-tenant { color: var(--brand-accent); }
.field-main {
  background: var(--surface);
  padding: 28px;
  border: 1px solid var(--border);
  border-top: 0;
}
.field-footer {
  padding: 14px 22px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  color: var(--text-muted);
  text-align: center;
}

.field-card h1 { font-size: 20px; margin: 0 0 var(--gap-sm); font-weight: 700; }
.field-card p { margin: var(--gap-sm) 0; font-size: 14px; line-height: 1.55; }
.field-card-success { text-align: center; }
.field-card-warning { text-align: center; }
.success-icon, .warning-icon { font-size: 44px; color: var(--status-green); margin-bottom: 10px; line-height: 1; }
.warning-icon { color: var(--status-yellow); }
.case-snapshot {
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-accent);
  padding: 14px var(--gap-lg);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  margin: 18px 0;
}
.snap-row { display: flex; flex-direction: column; padding: 6px 0; }
.snap-row + .snap-row { border-top: 1px solid var(--border-light); }
.snap-label {
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.snap-value { font-size: 13px; color: var(--text); margin-top: 4px; }

.confirm-form { margin: 24px 0 var(--gap-lg); }
.confirm-form textarea {
  width: 100%;
  padding: 10px var(--gap);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  margin-bottom: var(--gap);
  background: var(--surface);
}

.field-tabs { border-bottom: 1px solid var(--border); margin-bottom: var(--gap-lg); }
.field-tab {
  display: inline-block;
  padding: var(--gap-sm) 14px;
  margin-right: 4px;
  text-decoration: none;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 600;
  transition: color 0.12s, border-color 0.12s;
}
.field-tab:hover { color: var(--brand-primary); }
.field-tab-active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }

.task-list { list-style: none; padding: 0; margin: 0; }
.task-row {
  display: flex; justify-content: space-between;
  gap: var(--gap-lg);
  padding: 14px var(--gap-lg);
  background: var(--surface);
  border-left: 4px solid var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--gap-sm);
  box-shadow: var(--shadow-sm);
}
.task-row.status-critical-red { border-left-color: var(--status-critical); }
.task-row.status-red { border-left-color: var(--status-red); }
.task-row.status-yellow { border-left-color: var(--status-yellow); }
.task-row.status-green { border-left-color: var(--status-green); }
.task-main { flex: 1; }
.task-name { font-weight: 600; font-size: 14px; color: var(--text); }
.task-signals { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.task-risk { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.task-side { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.task-timer { font-weight: 700; font-size: 12px; }
.task-stage {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.empty-state {
  text-align: center;
  padding: 60px var(--gap-xl);
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

/* ── Admin / brand editor ───────────────────────────── */
.brand-edit-layout { display: grid; grid-template-columns: 1fr 380px; gap: var(--gap-lg); align-items: start; }
.brand-form fieldset { background: var(--surface); }
.color-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.color-field label {
  display: block;
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.color-row { display: flex; gap: var(--gap-sm); align-items: center; }
.color-row input[type="color"] {
  width: 38px; height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  padding: 2px;
}
.color-row input[type="text"] { flex: 1; }

.brand-preview { position: sticky; top: var(--gap); }
.brand-preview h3 {
  margin: 0 0 10px; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-secondary);
  font-weight: 700;
}
.preview-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.preview-header { background: #231F20; color: #fff; padding: 14px var(--gap-lg); }
.preview-header small {
  display: block;
  color: #C8B362;
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  margin-top: 4px;
}
.preview-card {
  background: var(--surface);
  margin: var(--gap-lg);
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.preview-card-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--gap-sm); }
.preview-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}
.preview-badges { display: flex; gap: 5px; margin-bottom: var(--gap); }
.preview-btn, .preview-btn-inline {
  display: inline-block;
  background: #231F20;
  color: #fff;
  border: 0;
  padding: 8px var(--gap-lg);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}
.preview-email {
  margin: var(--gap-lg);
  background: var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.preview-email-bar { padding: 12px var(--gap-lg); font-weight: 700; }
.preview-email-body { padding: 14px var(--gap-lg); font-size: 12px; }
.preview-email-body p { margin: 0 0 var(--gap-sm); }

/* ── Admin extras ──────────────────────────────────── */
.admin-nav-row {
  display: flex; gap: 18px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.admin-nav-row a { font-size: 13px; color: var(--text-secondary); text-decoration: none; }
.admin-nav-row a:hover { color: var(--brand-primary); }
.swatch {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 3px;
  vertical-align: middle;
  border: 1px solid var(--border);
  margin-right: 3px;
}

/* ── ROI ──────────────────────────────────────────── */
.roi-presets { margin-bottom: 18px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chip-active { background: var(--brand-primary) !important; color: #fff !important; }
.roi-layout { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-lg); align-items: start; }
.roi-form .card-panel { margin-bottom: 14px; }
.card-panel-dark { background: var(--brand-primary); color: #fff; }
.panel-title-dark {
  color: var(--brand-accent);
  margin: 0 0 14px;
  font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.4px;
  font-weight: 700;
}
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); margin-bottom: 14px; }
.metric { background: rgba(255,255,255,0.06); padding: var(--gap) 14px; border-radius: var(--radius-sm); }
.metric-hl { background: var(--brand-accent); color: var(--brand-primary); }
.metric-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.85; }
.metric-value { font-size: 20px; font-weight: 700; margin-top: 4px; }
.roi-math {
  font-size: 12px;
  line-height: 1.6;
  padding-top: var(--gap);
  border-top: 1px solid rgba(255,255,255,0.12);
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 1000px) {
  .case-grid, .preview-layout, .brand-edit-layout, .roi-layout { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .board { grid-template-columns: 1fr; }
  .app-header { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .app-nav { order: 3; width: 100%; overflow-x: auto; }
  .color-grid { grid-template-columns: 1fr; }
}
