/* Triumph Outreach UI — design tokens + components. Neutral, calm, professional.
   Use the component classes below; avoid inline styles in templates. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-hover: #f3f4f6;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;

  --accent: #3355d1;
  --accent-hover: #2944b0;
  --accent-soft: #eef2fd;
  --accent-text: #2944b0;

  --success: #15803d;  --success-soft: #ecfdf3;
  --warning: #b45309;  --warning-soft: #fffbeb;
  --danger:  #b91c1c;  --danger-soft:  #fef2f2;
  --info:    #0369a1;  --info-soft:    #f0f9ff;
  --violet:  #6d28d9;  --violet-soft:  #f5f3ff;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18);

  --sidebar-w: 252px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; color: var(--text); letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 8px; }
p:last-child { margin-bottom: 0; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.icon { flex: none; vertical-align: middle; }

/* ---------- app shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.brand-logo { width: 32px; height: 32px; border-radius: 9px; object-fit: contain; flex: none; }
.brand-name { font-weight: 650; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { padding: 4px 10px 16px; flex: 1; }
.nav-section { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; text-decoration: none;
}
.nav a:hover { background: var(--surface-hover); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav a.active .icon { color: var(--accent); }
.nav .icon { color: var(--faint); }
.nav .nav-count { margin-left: auto; font-size: 11px; font-weight: 600; min-width: 20px; text-align: center;
  padding: 0 7px; border-radius: 999px; background: var(--accent); color: #fff; }
.nav .subnav { margin: 2px 0 6px 21px; padding-left: 10px; border-left: 1px solid var(--border); }
.nav .subnav a { padding: 5px 10px; font-size: 13px; font-weight: 500; color: var(--muted); }
.nav .subnav a.active { background: none; color: var(--accent-text); font-weight: 600; }
.nav .subnav a.active::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--accent); margin-left: -12px; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input { padding-left: 34px; background: var(--surface-2); }
.topbar .search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 24px 28px 48px; max-width: 1320px; width: 100%; }

.mode-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.mode-pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.mode-pill.safe .dot { background: var(--warning); }
.mode-pill.live .dot { background: var(--success); }
.mode-pill.paused { background: var(--danger-soft); color: var(--danger) !important; border-color: #fecaca; font-weight: 600; }
.mode-pill.paused .dot { background: var(--danger); }
.danger-text { color: var(--danger); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text);
  display: grid; place-items: center; font-weight: 600; font-size: 12px; text-transform: uppercase; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 260px; }
.page-head .subtitle { color: var(--muted); margin-top: 4px; max-width: 760px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.breadcrumb a { color: var(--muted); }

/* ---------- explainer ("what is this page?") ---------- */
.explainer { border: 1px solid #dfe5fb; background: linear-gradient(180deg, #f7f9ff, #fff); border-radius: var(--radius);
  margin-bottom: 20px; }
.explainer summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; font-weight: 600; color: var(--accent-text); }
.explainer summary::-webkit-details-marker { display: none; }
.explainer summary .chev { margin-left: auto; transition: transform .15s; color: var(--faint); }
.explainer[open] summary .chev { transform: rotate(90deg); }
.explainer .body { padding: 0 16px 14px 44px; color: var(--text-2); max-width: 860px; }
.explainer .body ul { margin: 6px 0; padding-left: 18px; }
.explainer .body li { margin: 3px 0; }

/* ---------- cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2 { flex: 1; font-size: 15px; }
.card-head .hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 10px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted);
  display: flex; gap: 12px; align-items: center; }
.card + .card, .grid + .card, .card + .grid, .stats + .card, .stats + .grid, .grid + .grid { margin-top: 16px; }
.grid > .card, .grid > .grid, .grid > .stats, .grid > section { margin-top: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; }
a.stat:hover { border-color: var(--border-strong); text-decoration: none; box-shadow: var(--shadow); }
.stat .label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12.5px; color: var(--muted); }
.stat.tone-success .value { color: var(--success); }
.stat.tone-warning .value { color: var(--warning); }
.stat.tone-danger .value { color: var(--danger); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .muted, .muted { color: var(--muted); }
.table .strong { font-weight: 600; }
.cell-main { font-weight: 550; color: var(--text); min-width: 150px; }
.with-icon { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.cell-sub { font-size: 12.5px; color: var(--muted); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 550; padding: 2px 8px;
  border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.badge-neutral { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.badge-info    { background: var(--info-soft); color: var(--info); border-color: #bae6fd; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.badge-danger  { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.badge-accent  { background: var(--violet-soft); color: var(--violet); border-color: #ddd6fe; }
.badge-reply   { background: var(--violet); color: #fff; border-color: var(--violet); font-weight: 650; }
a:hover > .badge-reply { filter: brightness(1.1); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 550;
  font-size: 13.5px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--surface); border-color: #fca5a5; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; box-shadow: none; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label, .label { font-size: 13px; font-weight: 550; color: var(--text-2); }
.field .help { font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=email], input[type=number], input[type=search], input[type=password],
input[type=date], input[type=datetime-local], input[type=url], input[type=tel], select, textarea {
  font: inherit; font-size: 13.5px; width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, summary:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(51, 85, 209, .18); }
textarea { min-height: 90px; resize: vertical; }
input[type=file] { font: inherit; font-size: 13px; }
.checkbox { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.checkbox input { margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; }
.filters input, .filters select { width: auto; min-width: 150px; padding: 6px 10px; }
.filters input[type=search] { min-width: 240px; }

/* ---------- tabs / segmented ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tabs .count { font-size: 11.5px; background: var(--surface-hover); color: var(--muted); padding: 0 7px; border-radius: 999px; }

/* ---------- alerts / flash ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid; margin-bottom: 16px; font-size: 13.5px; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--success-soft); border-color: #bbf7d0; color: #14532d; }
.alert-danger  { background: var(--danger-soft); border-color: #fecaca; color: #7f1d1d; }
.alert-warning { background: var(--warning-soft); border-color: #fde68a; color: #78350f; }
.alert-info    { background: var(--info-soft); border-color: #bae6fd; color: #0c4a6e; }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .icon { color: var(--faint); margin-bottom: 8px; }
.empty h3 { color: var(--text-2); margin-bottom: 4px; }
.empty p { max-width: 460px; margin: 0 auto 12px; }

/* ---------- key/value list ---------- */
dl.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 8px 18px; margin: 0; font-size: 13.5px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; color: var(--text); word-break: break-word; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 30px; }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 24px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 0; top: 0; width: 21px; height: 21px; border-radius: 50%; display: grid;
  place-items: center; background: var(--surface-hover); color: var(--muted); border: 1px solid var(--border); }
.timeline .dot.tone-success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.timeline .dot.tone-info { background: var(--accent-soft); color: var(--accent); border-color: #c7d2fe; }
.timeline .dot.tone-warning { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.timeline .dot.tone-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.timeline .t-title { font-weight: 550; }
.timeline .t-meta { font-size: 12.5px; color: var(--muted); }
.timeline .t-body { margin-top: 6px; color: var(--text-2); font-size: 13.5px; }

/* ---------- email preview ---------- */
.email { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.email-head { padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 13px; }
.email-head .row { display: flex; gap: 8px; }
.email-head .k { color: var(--muted); width: 64px; flex: none; }
.email-subject { font-weight: 600; font-size: 14.5px; }
.email-body { padding: 16px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; color: var(--text-2); }

/* ---------- progress / funnel bars ---------- */
.bar { height: 8px; background: var(--surface-hover); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.tone-success > span { background: var(--success); }
.bar.tone-warning > span { background: #f59e0b; }
.funnel-row { display: grid; grid-template-columns: 170px 1fr 56px; gap: 12px; align-items: center; padding: 6px 0; }
.funnel-row .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- steps (how-it-works flow) ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; counter-reset: step; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; position: relative; }
.step .n { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.step h3 { margin-bottom: 4px; }
.step p { font-size: 13px; color: var(--muted); }

/* ---------- log viewer ---------- */
.log { background: #0f172a; color: #e2e8f0; border-radius: var(--radius); padding: 14px 16px; font-family: var(--mono);
  font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; max-height: 460px; overflow: auto; }
.log .lvl-WARNING { color: #fcd34d; }
.log .lvl-ERROR { color: #fca5a5; }

/* ---------- misc ---------- */
.pagination { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 14px;
  border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px;
  background: var(--surface-hover); color: var(--text-2); }
.tip { display: inline-flex; color: var(--faint); cursor: help; vertical-align: middle; }
.tip:hover { color: var(--accent); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0 !important; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }
.text-right { text-align: right; } .nowrap { white-space: nowrap; } .small { font-size: 12.5px; }
.ok-text { color: var(--success); } .warn-text { color: var(--warning); } .danger-text { color: var(--danger); }
.dot-sep::before { content: "·"; margin: 0 6px; color: var(--faint); }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- modal (native <dialog>) ---------- */
dialog { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; box-shadow: var(--shadow-lg);
  width: min(520px, calc(100vw - 32px)); color: var(--text); }
dialog::backdrop { background: rgba(17, 24, 39, .4); }
dialog .card-head { border-bottom: 1px solid var(--border); }
dialog .card-foot { justify-content: flex-end; }

/* ---------- public pages (unsubscribe) ---------- */
.public { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.public .card { max-width: 480px; width: 100%; }

/* ---------- public booking pages (/book, /b) ---------- */
.book-body { background: var(--bg); }
.book { max-width: 860px; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.book-brand { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.book-pad { padding: 24px; }
.book h1 { font-size: 22px; margin: 0 0 8px; }
.book h2 { font-size: 17px; margin: 0 0 10px; }
.book-layout { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 28px; }
.book-about { border-right: 1px solid var(--border); padding-right: 24px; }
.book-facts { list-style: none; padding: 0; margin: 8px 0 12px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }
.book-facts li { display: flex; align-items: center; gap: 8px; }
.book-tz { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; font-size: 13px; }
.book-tz select { max-width: 100%; }
.book-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.book-cal-head h2 { margin: 0; font-size: 16px; }
.book-grid { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.book-grid th { font-size: 12px; font-weight: 550; color: var(--muted); padding: 4px 0; }
.book-grid abbr { text-decoration: none; }
.book-grid td { text-align: center; padding: 0; }
.book-day { display: grid; place-items: center; width: 100%; max-width: 44px; aspect-ratio: 1; margin: 0 auto;
  border-radius: 999px; font-size: 14px; text-decoration: none; }
a.book-day { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
a.book-day:hover, a.book-day:focus-visible { background: var(--accent); color: #fff; }
a.book-day.is-selected { background: var(--accent); color: #fff; }
.book-day.is-off { color: var(--faint); }
.book-legend { margin: 6px 0 0; }
.book-times { border: 0; padding: 0; margin: 18px 0 14px; }
.book-times legend { font-weight: 650; margin-bottom: 8px; padding: 0; }
.book-time-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.book-time { display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 9px 8px; cursor: pointer; font-weight: 600; color: var(--accent-text); background: var(--surface); }
.book-time:hover { border-color: var(--accent); }
.book-time:has(input:checked) { background: var(--accent); color: #fff; border-color: var(--accent); }
.book-time input { margin: 0; }
.book-types { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 10px; }
.book-type { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; color: inherit; }
.book-type:hover { border-color: var(--accent); }
.book-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.book-submit { width: 100%; justify-content: center; }
.book-foot { text-align: center; margin: 0; }
@media (max-width: 720px) {
  .book-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .book-about { border-right: 0; padding-right: 0; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
  .book-pad { padding: 18px 16px; }
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-sidebar { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s;
    box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 40px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar .search { display: none; }
  .funnel-row { grid-template-columns: 110px 1fr 44px; }
}

/* ================= page-specific components (moved from page templates) ================= */

/* --- overview --- */
.attn { list-style: none; margin: 0; padding: 0; }
.attn li { display: flex; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.attn li:last-child { border-bottom: 0; }
.attn-text { flex: 1; font-size: 13.5px; color: var(--text-2); }
.attn-ic { width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-hover); color: var(--muted); }
.attn-ic.tone-warning { background: var(--warning-soft); color: var(--warning); }
.attn-ic.tone-danger { background: var(--danger-soft); color: var(--danger); }
.attn-ic.tone-info { background: var(--info-soft); color: var(--info); }
.quick { display: grid; gap: 8px; }
.quick .btn, .quick form, .quick form .btn { width: 100%; justify-content: flex-start; }
form.daily-form { display: inline-flex; gap: 10px; align-items: center; }
.stats.six { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.daily-form .checkbox { margin: 0; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .tick { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--border-strong); color: var(--muted); font-size: 12px; font-weight: 700; }
.checklist li.done .tick { background: var(--success); border-color: var(--success); color: #fff; }
.checklist li.done h3 { color: var(--muted); text-decoration: line-through; }
.checklist .body { flex: 1; }
.checklist .body p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
details.setup > summary { list-style: none; cursor: pointer; }
details.setup > summary::-webkit-details-marker { display: none; }
details.setup .progress { width: 140px; }
.next-list { list-style: none; margin: 0; padding: 0; }
.next-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 7px 0; font-size: 13.5px;
  border-bottom: 1px dashed var(--border); }
.next-list li:last-child { border-bottom: 0; }
.next-list li.stacked { flex-direction: column; gap: 2px; }
.next-h { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600;
  margin: 14px 0 4px; display: flex; align-items: center; gap: 6px; }
.next-h:first-child { margin-top: 0; }

/* --- guide --- */
.guide { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.guide-toc { position: sticky; top: 76px; }
.guide-toc ol { margin: 0; padding: 10px 18px 14px 34px; font-size: 13.5px; line-height: 1.9; }
.guide-body .card { scroll-margin-top: 76px; }
.guide-body ul, .guide-body ol { padding-left: 20px; line-height: 1.6; }
.guide-body li + li { margin-top: 4px; }
.guide-body h3 { display: flex; gap: 6px; align-items: center; }
.guide-body .table th { background: var(--surface-2); }
.ticks { list-style: none; padding-left: 0 !important; }
.ticks li { padding-left: 22px; position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 700; }
.glossary { grid-template-columns: minmax(150px, max-content) 1fr; }
.faq details { border-bottom: 1px solid var(--border); padding: 10px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 550; }
.faq p { margin: 8px 0 0; color: var(--text-2); }
@media (max-width: 860px) {
  .guide { grid-template-columns: 1fr; }
  .guide-toc { position: static; }
}

/* --- areas --- */
.area-card .card-head h2 { display: flex; align-items: center; gap: 6px; }
.area-card .card-foot .spacer { flex: 1; }
.mini-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.mini-stats > * { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; color: inherit; text-decoration: none; }
.mini-stats > a:hover { border-color: var(--border-strong); text-decoration: none; }
.mini-stats .v { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.mini-stats .l { font-size: 12px; color: var(--muted); }
.plain-list { list-style: none; margin: 6px 0 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.plain-list li:last-child { border-bottom: 0; }
@media (max-width: 860px) { .mini-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* --- imports --- */
.job-form .field { margin-bottom: 10px; }
.job-form .checkbox { align-items: center; color: var(--muted); }
.job-form .checkbox input { margin-top: 0; }

/* --- jobs --- */
.jobs-group { margin: 28px 0 12px; font-size: 15px; color: var(--text-2); }
.job-form .field { margin-bottom: 10px; }

/* --- activity --- */
.activity-day { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 6px 0 12px; }
.activity-day:not(:first-child) { margin-top: 18px; }
.activity-total { margin-left: auto; }

/* --- team --- */
.team-areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 16px; }

/* --- settings --- */
.setting-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 24px; padding: 12px 0;
  border-bottom: 1px solid var(--border); }
.setting-row:first-of-type { padding-top: 0; }
.setting-label label { font-weight: 550; }
.setting-label .help { font-size: 12.5px; color: var(--muted); }
.golive-list { list-style: none; margin: 0; padding: 0; }
.golive-list li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.golive-list li:last-child { border-bottom: 0; }
.golive-list .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.golive-list .done .mark { background: var(--success-soft); color: var(--success); }
.golive-list .todo .mark { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 860px) { .setting-row { grid-template-columns: 1fr; } }

/* --- shared bits: score pills, text boxes, inline forms --- */
.job-stack { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.score-pill { display: inline-grid; place-items: center; min-width: 34px; padding: 2px 8px; border-radius: 999px;
  font-weight: 650; font-size: 12.5px; font-variant-numeric: tabular-nums; border: 1px solid; }
.score-high { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.score-mid { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.score-low { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.scroll-box { max-height: 340px; overflow: auto; white-space: pre-wrap; font-size: 13px; line-height: 1.55;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.ad-text { white-space: pre-wrap; font-size: 14px; line-height: 1.65; color: var(--text-2); }
.doc h2, .doc h3, .doc h4 { margin: 18px 0 8px; } .doc p, .doc ul { margin: 0 0 10px; font-size: 13.5px; }
.doc code { font-size: 12.5px; background: var(--surface-hover); padding: 1px 5px; border-radius: 4px; }
.doc .table-wrap { margin: 8px 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.reason-list { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; }
.stage-help { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
.stage-help li { margin-bottom: 3px; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.pad-row { padding: 0 18px 18px; text-align: center; }
.runs-empty { padding: 14px 18px; margin: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form select, .inline-form input { width: auto; min-width: 140px; }

/* --- events --- */
.job-inline { display: inline-flex; gap: 8px; align-items: center; }
.job-inline .dry { color: var(--muted); }
.rel { display: inline-flex; align-items: center; gap: 6px; }
.rel .bar { width: 64px; }
.week-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.digest-text { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; max-height: 420px; overflow: auto; margin: 0; }
.assign-form { display: inline-flex; gap: 6px; align-items: center; }
.assign-form input { width: 150px; padding: 5px 9px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.post-text { white-space: pre-wrap; color: var(--text-2); background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 10px 12px; border: 1px solid var(--border); margin: 10px 0; }
.alert-card + .alert-card { margin-top: 12px; }
.center-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.center-cards .card-body .row { margin-top: 10px; }
.big-num { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* --- row menus --- */
.row-menu { position: relative; display: inline-block; text-align: left; }
.row-menu summary { list-style: none; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu-body { position: absolute; right: 0; z-index: 5; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px; min-width: 260px; }
.row-menu-body select { width: auto; flex: 1; }

/* --- leads --- */
.conv { width: 110px; }
.card[id], section[id] { scroll-margin-top: 72px; }

/* ---------- polish ---------- */
input[type=file]::file-selector-button { font: inherit; font-weight: 550; font-size: 12.5px; padding: 6px 12px; margin-right: 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  cursor: pointer; box-shadow: var(--shadow-sm); }
input[type=file]::file-selector-button:hover { background: var(--surface-hover); }
a.cell-main { display: inline-block; }
.cell-main.wide { min-width: 220px; }
.explainer .steps { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin: 8px 0; }

/* ================= integration QA fixes ================= */
/* Long URLs (unsubscribe links, booking links) wrap instead of overflowing email previews. */
.email-body, .post-text, .ad-text, .t-body { overflow-wrap: anywhere; }

/* List pages: the table gets the full width, the side cards line up underneath it. */
.grid-sidebar.grid-list { grid-template-columns: minmax(0, 1fr); }
.grid-list > .stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px;
  align-items: start; }
.grid-list > .stack > .card, .grid-list > .stack > section { margin-top: 0; }

/* Grids of cards never get the stacked-card top margin (keeps rows aligned). */
.center-cards > .card, .steps > .card, .grid > section.card { margin-top: 0; }

/* Job buttons with a "Dry run" box stay on one line. */
form.job-inline { display: inline-flex; flex-wrap: wrap; }
.job-inline .checkbox { white-space: nowrap; }
.job-inline .dry { margin: 0; align-items: center; }
.job-inline .dry input { margin-top: 0; }
.justify-end { justify-content: flex-end; }

/* Card headers: the hint drops below the title instead of squeezing it. */
.card-head { flex-wrap: wrap; row-gap: 2px; }
.card-head h2 { flex: 1 1 auto; min-width: 0; }

/* Two columns, the right one wider (e.g. form + table). */
.grid-2-3 { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
@media (max-width: 1080px) { .grid-2-3 { grid-template-columns: minmax(0, 1fr); } }

/* Compact tables for narrow cards. */
.table.compact th, .table.compact td { padding-left: 10px; padding-right: 10px; }

@media (min-width: 861px) {
  .tabs.wrap-tabs { flex-wrap: wrap; overflow: visible; }
}
@media (max-width: 860px) {
  .explainer .body { padding: 0 16px 14px 16px; }
  .explainer summary { padding: 12px 14px; }
  .filters input, .filters select, .filters input[type=search] { flex: 1 1 100%; min-width: 0; width: 100%; }
  .filters .btn { flex: none; }
  .filters > .icon { display: none; }
  .page-head .actions { width: 100%; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .stat .value { font-size: 22px; }
  .attn li { flex-wrap: wrap; }
  .attn-text { min-width: 0; flex: 1 1 200px; }
  .grid-list > .stack { grid-template-columns: minmax(0, 1fr); }
}

/* Bulk selection on lists */
.bulk-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2, #f8fafc); }
.bulk-bar .spacer { flex: 1; }
.bulk-bar .checkbox { align-items: center; }
.bulk-bar .checkbox input { margin-top: 0; }
.check-col { width: 36px; padding-right: 0 !important; }
.check-col input { width: 16px; height: 16px; cursor: pointer; }
a.nounder { text-decoration: none; }

#confirm-dialog { max-width: 460px; width: calc(100% - 32px); }

/* ---------- wording editor ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.mb-8 { margin-bottom: 8px; }
.field.has-error input, .field.has-error textarea { border-color: var(--danger, #dc2626); }
.inline-form .grow { flex: 1; min-width: 200px; }

/* ---------- phones (backlog F46) ---------- */
.tip { border-radius: 50%; }
.tip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tip-pop { position: fixed; z-index: 60; max-width: 300px; padding: 8px 11px; border-radius: 8px; font-size: 12.5px;
  line-height: 1.45; font-weight: 400; text-transform: none; letter-spacing: 0; white-space: normal;
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); pointer-events: none; }
.tip-pop[hidden] { display: none; }
.stat { min-width: 0; }
.stat .value, .stat .sub, .stat .label { overflow-wrap: anywhere; }
p.card-foot { display: block; }
.card-foot { flex-wrap: wrap; }
.content { min-width: 0; }
.content pre, .content code { overflow-wrap: anywhere; }
@media (max-width: 1080px) {
  /* Contact page: Actions (the right column) come first when the columns stack. */
  .grid-sidebar.actions-first > :last-child { order: -1; }
}
@media (max-width: 640px) {
  .tabs, .tabs.wrap-tabs { flex-wrap: wrap; overflow: visible; }
  .tabs a { padding: 8px 10px; }
  .pagination { flex-wrap: wrap; }
  .page-head { flex-wrap: wrap; }
  .page-head .actions { flex-wrap: wrap; }
  .tip { padding: 4px; margin: -4px 0; }  /* a bigger tap target */
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* List tables become one card per row; each cell shows its column name (data-label, set by app.js). */
  .table.stack-sm thead { display: none; }
  .table.stack-sm, .table.stack-sm tbody, .table.stack-sm tr, .table.stack-sm td { display: block; width: 100%; }
  .table.stack-sm tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .table.stack-sm tr:last-child { border-bottom: 0; }
  .table.stack-sm td { border: 0; padding: 3px 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  .table.stack-sm td.num { text-align: left; }
  .table.stack-sm td:empty, .table.stack-sm td.check-col:empty { display: none; }
  .table.stack-sm td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
  .table.stack-sm td.check-col { width: auto; }
  .table.stack-sm .nowrap { white-space: normal; }
}
@media (max-width: 640px) {
  /* Verification: long button labels (e.g. "Open contact: <long name>") and nested job summaries fit a phone. */
  .actions .btn { white-space: normal; max-width: 100%; }
  dl.kv { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 6px 12px; }
  dl.kv dl.kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* ---------- email status badges, batches, funnel ---------- */
.badge-stack { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.outcome { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.outcome a { text-decoration: none; display: inline-flex; gap: 4px; }
.outcome .cell-sub { margin-left: 2px; }
.legend { margin: 0 0 12px; }
.legend summary { cursor: pointer; color: var(--muted); }
.legend-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.legend-list li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.kind-counts { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.kind-counts span { white-space: nowrap; }
.batch-card .batch-line { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.batch-card .batch-line strong { font-size: 18px; }
.funnel-table td.num a { font-weight: 600; }
.funnel-table .bar { min-width: 60px; }
@media (max-width: 640px) {
  .funnel-table .bar-col { display: none; }
}

/* account menu (header avatar) */
.account-menu { position: relative; }
.account-menu > summary { list-style: none; cursor: pointer; display: grid; place-items: center; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-pop { position: absolute; right: 0; top: 38px; z-index: 50; min-width: 220px; background: var(--surface, #fff);
  border: 1px solid var(--border, #ddd); border-radius: 10px; padding: 12px; display: grid; gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); }

/* ---------- reply page: a Gmail-like conversation (pages/replies_detail.html) ---------- */
.gm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.gm-toolbar form.inline { margin: 0; }
.gm-divider { width: 1px; align-self: stretch; background: var(--border); margin: 2px 2px; }
.gm-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.gm-nav .small { margin-right: 6px; white-space: nowrap; }
.btn-icon { padding: 7px; min-width: 34px; }
.btn.is-disabled { opacity: .4; pointer-events: none; }
.gm-layout { grid-template-columns: minmax(0, 2.6fr) minmax(260px, 1fr); align-items: start; }

.gm-thread { padding: 0; overflow: hidden; overflow: clip; }  /* clip, not hidden: keeps the mobile Reply bar sticky */
.gm-subject { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 18px 20px 12px; }
.gm-subject h1 { font-size: 20px; font-weight: 500; overflow-wrap: anywhere; }

.gm-msg { border-top: 1px solid var(--border); }
.gm-msg.is-current { box-shadow: inset 3px 0 0 var(--warning); }
.gm-msg.is-mine { box-shadow: inset 3px 0 0 var(--accent); }
.gm-fold > summary { list-style: none; cursor: pointer; }
.gm-fold > summary::-webkit-details-marker { display: none; }
.gm-head { display: flex; align-items: flex-start; gap: 12px; padding: 12px 20px; }
.gm-head:hover { background: var(--surface-hover); }
.gm-fold[open] > .gm-head:hover { background: transparent; }
.gm-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 15px; background: #5f6368; }
.gm-avatar.is-mine { background: var(--accent); }
.gm-avatar-sm { width: 22px; height: 22px; font-size: 11px; }
.gm-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.gm-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.gm-name { font-weight: 600; color: var(--text); }
.gm-addr { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.gm-chip { font-size: 11px; line-height: 1; padding: 3px 7px; border-radius: 4px; background: var(--surface-hover);
  color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.gm-chip-accent { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.gm-when { flex: none; white-space: nowrap; padding-top: 2px; }
.gm-when-short { display: none; }
/* Folded: name and a one-line preview, short date. Open: address, "to ...", long date. */
.gm-fold:not([open]) .gm-addr, .gm-fold:not([open]) .gm-to, .gm-fold:not([open]) .gm-when-long { display: none; }
.gm-fold:not([open]) .gm-when-short { display: inline; }
.gm-fold[open] .gm-preview { display: none; }
.gm-fold:not([open]) .gm-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-fold:not([open]) .gm-head { padding-top: 10px; padding-bottom: 10px; }

.gm-content { padding: 0 20px 16px 68px; }
.gm-own-subject { margin-bottom: 8px; }
.gm-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; color: var(--text); }
.gm-trim { margin-top: 10px; }
.gm-trim > summary { list-style: none; display: inline-block; cursor: pointer; padding: 0 8px; border-radius: 6px;
  background: var(--surface-hover); border: 1px solid var(--border); color: var(--muted); font-size: 12px;
  line-height: 14px; letter-spacing: 1px; }
.gm-trim > summary::-webkit-details-marker { display: none; }
.gm-trim > summary:hover { background: var(--border); }
.gm-trim-label { margin: 10px 0 4px; }
.gm-quoted { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); font-size: 13px; line-height: 1.55;
  border-left: 2px solid var(--border-strong); padding-left: 12px; }
.gm-msg-foot { margin-top: 12px; }
.gm-msg-foot:empty { display: none; }

.gm-compose { border-top: 1px solid var(--border); padding: 16px 20px 20px 68px; display: flex; flex-wrap: wrap;
  gap: 10px; align-items: flex-start; background: var(--surface); }
.gm-compose > p, .gm-compose > .alert { flex: 1 1 100%; margin: 0; }
.gm-reply > summary { list-style: none; }
.gm-reply > summary::-webkit-details-marker { display: none; }
.gm-reply-btn { border-radius: 18px; padding: 7px 18px; }
.gm-ready { font-weight: 400; color: var(--muted); margin-left: 4px; }
.gm-reply[open] { flex: 1 1 100%; order: -1; }
.gm-reply[open] > summary { display: none; }
.gm-reply > .alert { margin-bottom: 10px; }
.gm-compose-card { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 12px 14px;
  box-shadow: var(--shadow); display: grid; gap: 10px; background: var(--surface); }
.gm-compose-card form { display: grid; gap: 10px; }
.gm-compose-card .field { margin: 0; }
.gm-compose-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); }
.gm-recipient { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 2px; border-radius: 16px;
  background: var(--surface-hover); border: 1px solid var(--border); color: var(--text); font-size: 13px;
  max-width: 100%; overflow-wrap: anywhere; }
.gm-from { margin-left: auto; }
.gm-subject-edit > summary { list-style: none; cursor: pointer; overflow-wrap: anywhere; }
.gm-subject-edit > summary::-webkit-details-marker { display: none; }
.gm-subject-edit[open] > summary .gm-link { display: none; }
.gm-link { color: var(--accent-text); margin-left: 6px; }
.gm-textarea { width: 100%; min-height: 220px; border: 0; border-top: 1px solid var(--border); border-radius: 0;
  padding: 12px 0 0; font: inherit; font-size: 14px; line-height: 1.6; resize: vertical; box-shadow: none; }
.gm-textarea:focus { outline: none; box-shadow: none; }
.gm-autofooter .gm-quoted { font-size: 12px; }
.gm-flyer { margin: 4px 0 10px; }
.gm-flyer > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.gm-flyer > summary::-webkit-details-marker { display: none; }
.gm-flyer-body { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 6px; }
.gm-flyer-body select, .gm-flyer-body input[type=file] { max-width: 100%; }
.gm-flyer-mode { border: 0; padding: 0; margin: 6px 0 0; }
.gm-flyer-mode legend { padding: 0; margin-bottom: 4px; color: var(--text-2); }
.gm-flyer-mode .checkbox { margin: 2px 0; }
.gm-send-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.gm-send-row .checkbox { margin: 0; align-items: center; color: var(--text-2); }
.gm-send { border-radius: 18px; padding: 8px 22px; }
.gm-close { margin-left: auto; }
.gm-hint { margin: 0; }
.gm-note { color: var(--muted); }

.gm-side .card-body { padding: 14px 16px; }
.gm-side-fold > summary { list-style: none; cursor: pointer; }
.gm-side-fold > summary::-webkit-details-marker { display: none; }
.gm-side-fold > summary .chev { margin-left: auto; transition: transform .15s; color: var(--faint); }
.gm-side-fold[open] > summary .chev { transform: rotate(90deg); }
.gm-side-fold:not([open]) > summary { border-bottom: 0; }

@media (max-width: 1080px) {
  .gm-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .gm-subject { padding: 14px 14px 10px; }
  .gm-subject h1 { font-size: 18px; }
  .gm-head { padding: 10px 14px; gap: 10px; }
  .gm-avatar { width: 32px; height: 32px; font-size: 14px; }
  .gm-content { padding: 0 14px 14px; }
  .gm-compose { padding: 12px 14px 14px; position: sticky; bottom: 0; z-index: 5;
    box-shadow: 0 -4px 12px rgba(16, 24, 40, .08); }
  .gm-compose:has(.gm-reply[open]), .gm-compose:has(#forward[open]) { position: static; box-shadow: none; }
  .gm-fold[open] .gm-when-long { display: none; }
  .gm-fold[open] .gm-when-short { display: inline; }
  .gm-toolbar { gap: 6px; }
  .gm-toolbar .btn { padding: 6px 10px; font-size: 13px; }
  .gm-toolbar .btn-icon { padding: 6px; min-width: 32px; }
  .gm-divider { display: none; }
  .gm-nav { margin-left: auto; }
  .gm-from { margin-left: 0; width: 100%; }
}

/* ---------- replies: where each reply stands (Status column, reply page) ---------- */
.reply-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; line-height: 1.2;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap; text-decoration: none; }
a.reply-status:hover { text-decoration: none; filter: brightness(.97); }
.reply-status.tone-warning { background: var(--warning-soft); color: var(--warning); border: 1px solid #fcd9a8; }
.reply-status.tone-success { background: var(--success-soft); color: var(--success); border: 1px solid #b7ebc8; }
.reply-status.tone-neutral { background: var(--surface-hover); color: var(--muted); border: 1px solid var(--border); }
.replies-table tr.is-waiting td { background: #fffdf7; }
.replies-table tr.is-waiting td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.replies-table tr.is-waiting .cell-main { font-weight: 650; }
.replies-table tr:not(.is-waiting) .cell-main { font-weight: 500; }
.replies-table .status-cell { min-width: 150px; }
#confirm-dialog [data-confirm-text] { white-space: pre-line; max-height: 60vh; overflow: auto; }
.replies-table a.row-link { color: var(--text); }
.replies-table a.row-link:hover { color: var(--accent-text); }

/* Page loading: a thin moving bar at the very top, shown the moment a link or button is clicked (app.js). */
html.is-navigating, html.is-navigating * { cursor: progress; }
html.is-navigating body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1000;
  background: linear-gradient(90deg, transparent 0, var(--accent) 40%, var(--accent) 60%, transparent 100%);
  background-size: 50% 100%; background-repeat: no-repeat; animation: nav-bar 0.9s linear infinite; }
@keyframes nav-bar { from { background-position: -50% 0; } to { background-position: 150% 0; } }
@media (prefers-reduced-motion: reduce) { html.is-navigating body::before { animation: none; background: var(--accent); opacity: .6; } }
.gm-assist { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
