/* 3B Ops Centre: private, responsive operational interface. */

:root {
  --sidebar: 272px;
  --topbar: 72px;
  --mobile-bar: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --surface-2: rgba(255, 255, 255, .045);
  --surface-3: rgba(255, 255, 255, .075);
  --accent-soft: rgba(6, 190, 190, .12);
  --accent-line: rgba(6, 190, 190, .42);
  --warn-soft: rgba(255, 54, 48, .1);
  --purple: #8368ff;
  --purple-soft: rgba(131, 104, 255, .12);
  --shadow: 0 18px 50px rgba(0, 0, 0, .24);
  --shadow-tight: 0 8px 24px rgba(0, 0, 0, .2);
  --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
          Roboto, Helvetica, Arial, sans-serif;
  --head: "Outfit", "Instrument Sans", -apple-system, BlinkMacSystemFont,
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; letter-spacing: 0; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--canvas); color-scheme: dark; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100%; overflow-x: hidden; background-color: var(--canvas);
  background-image:
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px);
  background-size: 36px 36px;
  color: var(--muted); font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: var(--accent); color: var(--on-accent); }

.icon {
  width: 18px; height: 18px; flex: 0 0 18px; fill: none;
  stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 15px; height: 15px; flex-basis: 15px; }
.icon-lg { width: 21px; height: 21px; flex-basis: 21px; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.app-shell {
  min-height: 100vh; display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}
.sidebar {
  position: sticky; top: 0; z-index: 30; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 14px 14px;
  background: var(--surface); border-right: 1px solid var(--rule);
  box-shadow: 12px 0 40px rgba(0, 0, 0, .12);
}
.brand-lockup {
  display: flex; min-height: 54px; align-items: center; gap: 12px;
  padding: 4px 8px; color: var(--ink); text-decoration: none;
}
.brand-mark {
  display: grid; width: 44px; height: 44px; flex: 0 0 44px;
  place-items: center; overflow: hidden; background: var(--canvas);
  border: 1px solid var(--edge); border-radius: 8px;
  box-shadow: var(--shadow-tight);
}
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.brand-copy strong { display: block; color: var(--ink); font: 600 16px/1.2 var(--head); }
.brand-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.side-label {
  margin: 24px 10px 8px; color: var(--muted); font-size: 10px;
  font-weight: 600; text-transform: uppercase;
}
.side-nav { display: grid; gap: 4px; }
.side-nav a {
  position: relative; display: flex; min-height: 44px; align-items: center;
  gap: 11px; padding: 0 11px; color: var(--muted); border: 1px solid transparent;
  border-radius: 7px; text-decoration: none; font-size: 14px; font-weight: 600;
  transition: color .18s ease, background .18s ease, border-color .18s ease,
              transform .18s ease;
}
.side-nav a:hover, .side-nav a:focus-visible {
  color: var(--ink); background: var(--surface-2); border-color: var(--rule);
  transform: translateX(2px); outline: none;
}
.side-nav a.on {
  color: var(--ink); background: var(--accent-soft); border-color: var(--accent-line);
}
.side-nav a.on .icon { color: var(--accent-text); }
.side-nav a.on::before {
  position: absolute; top: 9px; bottom: 9px; left: -15px; width: 3px;
  background: var(--accent); content: "";
}

[data-tooltip] { position: relative; }
@media (hover: hover) and (min-width: 861px) {
  .side-nav [data-tooltip]::after {
    position: absolute; z-index: 80; top: 50%; left: calc(100% + 12px);
    width: max-content; max-width: 240px; padding: 8px 10px;
    color: var(--ink); background: var(--surface); border: 1px solid var(--edge);
    border-radius: 6px; box-shadow: var(--shadow-tight); content: attr(data-tooltip);
    font-size: 11px; font-weight: 400; line-height: 1.4; opacity: 0;
    pointer-events: none; transform: translate(-4px, -50%);
    transition: opacity .16s ease .22s, transform .16s ease .22s;
  }
  .side-nav [data-tooltip]:hover::after,
  .side-nav [data-tooltip]:focus-visible::after {
    opacity: 1; transform: translate(0, -50%);
  }
}

.sidebar-foot {
  margin-top: auto; padding: 16px 10px 3px; border-top: 1px solid var(--rule);
}
.system-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.state-dot { width: 7px; height: 7px; flex: 0 0 7px; background: var(--accent); border-radius: 50%; }
.state-dot.warn { background: var(--warn); }
.sidebar-foot a { display: inline-block; margin-top: 8px; color: var(--ink); font-size: 12px; }

.main-column { min-width: 0; }
.main-column::before {
  position: fixed; z-index: -1; top: var(--topbar); right: 0; bottom: 0;
  left: var(--sidebar); background:
    linear-gradient(135deg, rgba(6, 190, 190, .035), transparent 28%),
    linear-gradient(315deg, rgba(255, 54, 48, .025), transparent 24%);
  pointer-events: none; content: "";
}
header.top {
  position: sticky; top: 0; z-index: 24; min-height: var(--topbar);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 0 34px; background: rgba(5, 5, 5, .92);
  border-bottom: 1px solid var(--rule); backdrop-filter: blur(18px);
}
.top-context { display: flex; min-width: 0; align-items: center; gap: 10px; }
.top-context .icon { color: var(--accent-text); }
.top-brand { display: none; }
.top-title { overflow: hidden; color: var(--ink); font: 600 14px var(--head); text-overflow: ellipsis; white-space: nowrap; }
.top-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.top-meta a { color: var(--ink); text-decoration: none; }
.top-separator { width: 1px; height: 20px; background: var(--rule); }

.wrap { width: 100%; max-width: 1480px; margin: 0 auto; padding: 34px 34px 64px; }
.auth-wrap { max-width: 520px; padding-top: 8vh; }
.page-intro {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 28px; margin-bottom: 26px;
}
.page-intro > div { min-width: 0; }
.eyebrow {
  margin: 0 0 8px; color: var(--accent-text); font-size: 11px;
  font-weight: 600; text-transform: uppercase;
}
h1 { margin: 0; color: var(--ink); font: 600 38px/1.08 var(--head); }
h2 {
  margin: 34px 0 12px; color: var(--muted);
  font: 600 11px/1.2 var(--sans); text-transform: uppercase;
}
h3 { margin: 0; color: var(--ink); font: 600 17px/1.2 var(--head); }
p { margin: 9px 0; }
.lede { max-width: 720px; color: var(--muted); font-size: 15px; }
.meta { color: var(--muted); font-size: 12px; }
.who { color: var(--ink); font-weight: 600; }
.warn { color: var(--warn); }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin: 18px 0; }
.card {
  position: relative; display: flex; min-height: 166px; overflow: hidden;
  flex-direction: column; justify-content: space-between; padding: 19px;
  color: inherit; background: var(--surface); border: 1px solid var(--edge);
  border-radius: 8px; box-shadow: var(--shadow-tight); text-decoration: none;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.card::before {
  position: absolute; top: 0; right: 0; left: 0; height: 3px;
  background: var(--card-accent, var(--accent)); content: "";
}
.card:hover, .card:focus-visible {
  background: var(--surface-2); border-color: var(--card-accent, var(--accent));
  transform: translateY(-3px); outline: none;
}
.card.teal { --card-accent: var(--accent); }
.card.purple { --card-accent: var(--purple); }
.card.red { --card-accent: var(--warn); }
.card.neutral { --card-accent: var(--muted); }
.card.warn { border-color: var(--warn); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-icon {
  display: grid; width: 34px; height: 34px; place-items: center;
  color: var(--card-accent, var(--accent-text)); background: var(--surface-3);
  border: 1px solid var(--rule); border-radius: 7px;
}
.card .label { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.card .n { margin: 15px 0 7px; color: var(--ink); font: 600 39px/1 var(--head); }
.card .n.zero { color: var(--muted); }
.card .sub { color: var(--muted); font-size: 12px; }

.metric-strip {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 24px 0 4px; overflow: hidden; background: var(--surface);
  border: 1px solid var(--edge); border-radius: 8px;
}
.metric { min-height: 104px; padding: 18px; border-right: 1px solid var(--rule); }
.metric:last-child { border-right: 0; }
.metric span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.metric strong { display: block; margin-top: 8px; color: var(--ink); font: 600 25px var(--head); }

.business-pulse { margin-top: 34px; }
.synoptic-flow {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px; overflow: hidden; background: var(--rule);
  border: 1px solid var(--edge); border-radius: 8px;
}
.pulse-stage {
  position: relative; min-height: 122px; padding: 18px; background: var(--surface);
}
.pulse-stage::after {
  position: absolute; z-index: 1; top: 50%; right: -7px; width: 12px; height: 12px;
  content: ""; background: var(--surface); border-top: 1px solid var(--rule);
  border-right: 1px solid var(--rule); transform: translateY(-50%) rotate(45deg);
}
.pulse-stage:last-child::after { display: none; }
.pulse-stage span, .pulse-stage small { display: block; color: var(--muted); }
.pulse-stage span { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.pulse-stage strong { display: block; margin: 10px 0 8px; font: 600 27px var(--head); }
.pulse-stage small { font-size: 12px; }
.pulse-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; margin-top: 12px;
}
.pulse-grid .panel + .panel, .integration-grid .panel + .panel { margin-top: 0; }
.pulse-panel { min-height: 244px; }
.pulse-stat { padding: 12px 0 17px; border-bottom: 1px solid var(--rule); }
.pulse-stat span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.pulse-stat strong { display: block; margin-top: 6px; font: 600 29px var(--head); }
.pulse-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--rule); }
.pulse-rows > span {
  min-width: 0; padding: 11px 10px; background: var(--surface);
  color: var(--muted); font-size: 11px;
}
.pulse-rows strong { display: block; margin-top: 4px; color: var(--ink); font-size: 14px; }
.pulse-callout { display: flex; flex-direction: column; }
.pulse-callout p { color: var(--muted); line-height: 1.55; }
.pulse-callout .btn { margin-top: auto; }

.ops-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .75fr); gap: 24px; margin-top: 24px; }
.integration-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px; margin: 16px 0;
}
.integration-card { min-height: 244px; }
.integration-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--rule);
}
.evidence-list { margin: 0; }
.evidence-list > div {
  display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--rule);
}
.evidence-list > div:last-child { border-bottom: 0; }
.evidence-list dt {
  color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase;
}
.evidence-list dd { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.4; }
.evidence-list dd span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.integration-alert, .integration-note {
  margin: 12px 0 0; padding: 10px 12px; border-left: 2px solid var(--warn);
  background: var(--canvas); color: var(--ink); font-size: 13px;
}
.integration-note { border-left-color: var(--purple); }
.health-engine-grid { margin-top: 14px; }
.panel {
  min-width: 0; padding: 19px; background: var(--surface);
  border: 1px solid var(--edge); border-radius: 8px; box-shadow: var(--shadow-tight);
}
.panel + .panel { margin-top: 18px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 14px;
}
.panel-head a { font-size: 12px; }
.panel-copy { margin: -4px 0 16px; color: var(--muted); font-size: 13px; }
.panel-foot { margin: 13px -19px -19px; padding: 13px 19px; border-top: 1px solid var(--rule); }
.panel-foot a { font-size: 12px; font-weight: 600; }

.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; background: var(--rule); border-radius: 6px; }
.pipeline-item { min-height: 94px; padding: 14px; background: var(--canvas); transition: background .16s ease; }
a.pipeline-item { color: inherit; text-decoration: none; }
.pipeline-item:hover { background: var(--surface-2); }
.pipeline-item span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.pipeline-item strong { display: block; margin-top: 8px; color: var(--ink); font: 600 24px var(--head); }
.attention-list { display: grid; }
.attention-row {
  display: flex; min-height: 50px; align-items: center; justify-content: space-between;
  gap: 14px; color: inherit; border-bottom: 1px solid var(--rule); text-decoration: none;
}
.attention-row:last-child { border-bottom: 0; }
.attention-row.bad strong { color: var(--warn); }
.attention-row.warn strong { color: var(--accent-text); }

.row {
  display: flex; min-height: 58px; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 2px; border-bottom: 1px solid var(--rule);
}
.row:last-child { border-bottom: 0; }
a.row { color: inherit; text-decoration: none; transition: background .15s ease, padding .15s ease; }
a.row:hover, a.row:focus-visible { padding-right: 8px; padding-left: 8px; background: var(--surface-2); outline: none; }
a.row:hover .who { color: var(--accent-text); }
.row-main { display: flex; min-width: 0; align-items: center; gap: 11px; }
.row-icon {
  display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center;
  color: var(--muted); background: var(--canvas); border: 1px solid var(--rule); border-radius: 7px;
}
.row-badges { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }

.scorecard { margin-top: 12px; padding: 15px; background: var(--canvas); border: 1px solid var(--rule); border-radius: 7px; }
.scorecard-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.scorecard-head strong { margin-left: 6px; color: var(--ink); font: 600 28px var(--head); }
.scorecard .panel-copy { margin: 7px 0 11px; }
.score-reasons { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.score-reason { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 11px; background: var(--surface); }
.score-reason strong, .score-reason small { display: block; }
.score-reason strong { color: var(--ink); font-size: 12px; }
.score-reason small { margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.score-points { min-width: 32px; color: var(--muted); font: 600 12px var(--head); text-align: right; }
.score-points.positive { color: var(--accent-text); }
.score-points.negative { color: var(--warn); }

.pill {
  display: inline-flex; min-height: 27px; align-items: center; gap: 6px;
  padding: 3px 9px; color: var(--muted); background: var(--canvas);
  border: 1px solid var(--edge); border-radius: 999px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; white-space: nowrap;
}
.pill.on { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-line); }
.pill.bad { color: var(--warn); background: var(--warn-soft); border-color: var(--warn); }
.pill.purple { color: var(--purple); background: var(--purple-soft); border-color: var(--purple); }

button, .btn {
  display: inline-flex; min-height: 44px; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 16px; color: var(--on-accent); background: var(--accent);
  border: 1px solid var(--accent); border-radius: 7px; cursor: pointer;
  font-weight: 600; text-align: center; text-decoration: none;
  transition: opacity .16s ease, transform .16s ease, box-shadow .16s ease;
}
button:hover, .btn:hover { opacity: .9; box-shadow: var(--shadow-tight); transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .5; transform: none; box-shadow: none; }
.btn.ghost { color: var(--ink); background: transparent; border-color: var(--edge); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--warn); background: transparent; border-color: var(--warn); }
.btn.wide { width: 100%; }
.btn.compact { min-height: 36px; padding: 7px 11px; font-size: 12px; }
.settings-actions { display: flex; flex: 0 0 auto; gap: 7px; }

input, textarea, select {
  width: 100%; min-height: 46px; padding: 10px 12px; color: var(--ink);
  background: var(--canvas); border: 1px solid var(--edge); border-radius: 6px;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
select { color-scheme: dark; }
select option, select optgroup {
  color: var(--ink); background-color: var(--surface);
}
textarea { line-height: 1.5; resize: vertical; }
input:hover, textarea:hover, select:hover { background: var(--surface-2); }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none;
}
label { display: block; margin: 15px 0 6px; color: var(--muted); font-size: 11px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-span { grid-column: 1 / -1; }
.checkline { display: flex; align-items: flex-start; gap: 10px; color: var(--ink); }
.checkline input { width: 18px; min-height: 18px; margin-top: 2px; }
.field-help { margin-top: 5px; color: var(--muted); font-size: 11px; }
.form-submit { margin-top: 18px; }
.form-error { display: none; margin: 10px 0 0; color: var(--warn); font-size: 12px; }

.booking-link-result { border-top: 3px solid var(--accent); }
.booking-link-maker { max-width: 680px; margin-top: 20px; }
.copy-link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.copy-link-row input { min-width: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.copy-link-row button { white-space: nowrap; }

.notice {
  margin: 16px 0; padding: 13px 15px; background: var(--accent-soft);
  border: 1px solid var(--accent-line); border-left: 3px solid var(--accent); border-radius: 6px;
}
.notice.bad { background: var(--warn-soft); border-color: var(--warn); }
.reply-alert {
  margin: 0 0 18px; padding: 18px 20px; background: var(--accent-soft);
  border: 1px solid var(--accent-line); border-left: 4px solid var(--accent); border-radius: 6px;
  scroll-margin-top: calc(var(--topbar) + 18px);
}
.reply-alert-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.reply-alert-head .eyebrow { margin-bottom: 4px; }
.reply-alert-head h2 { font-size: 20px; }
.reply-alert-head time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.reply-alert-body { margin: 14px 0 0; color: var(--ink); font-size: 18px; line-height: 1.45; white-space: pre-wrap; }
.empty { padding: 22px 0; color: var(--muted); }
.action-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.intro-actions { align-items: center; margin-top: 0; }
.lead-actions { margin: 0 0 18px; }
.lead-actions .whatsapp-personal { min-height: 52px; flex: 1 1 100%; font-size: 14px; }
.contact-action { display: flex; margin: 0; }
.contact-action .btn { height: 100%; }
.contact-sync-state {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin: -8px 0 20px; color: var(--muted); font-size: 12px;
}
.contact-sync-state strong { color: var(--ink); font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.ok { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 24px; }
.sticky-panel { position: sticky; top: calc(var(--topbar) + 22px); align-self: start; }

.recommended-panel { margin-top: 24px; border-top: 2px solid var(--accent); }
.recommended-panel .panel-head { align-items: flex-end; }
.recommended-panel .eyebrow, .message-group-head .eyebrow { margin-bottom: 4px; }
.action-list { display: grid; }
.recommended-action {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center; gap: 15px; min-height: 82px; padding: 14px 2px;
  color: inherit; border-bottom: 1px solid var(--rule); text-decoration: none;
}
.recommended-action:last-child { border-bottom: 0; }
a.recommended-action { transition: background .16s ease, padding .16s ease; }
a.recommended-action:hover, a.recommended-action:focus-visible {
  padding-right: 9px; padding-left: 9px; background: var(--surface-2);
  outline: none;
}
.action-rank {
  display: grid; width: 32px; height: 32px; place-items: center;
  color: var(--on-accent); background: var(--accent); border-radius: 7px;
  font: 600 13px var(--head);
}
.action-copy { min-width: 0; }
.action-copy > strong { display: block; color: var(--ink); font: 600 15px/1.3 var(--head); }
.action-copy > span:last-child, .action-copy > p { color: var(--muted); font-size: 12px; }
.action-kicker {
  display: block; margin-bottom: 4px; color: var(--accent-text) !important;
  font-size: 10px !important; font-weight: 600; text-transform: uppercase;
}
.action-cta {
  display: inline-flex; align-items: center; gap: 6px; color: var(--accent-text);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.action-clear {
  display: flex; min-height: 82px; align-items: center; gap: 13px;
  color: var(--accent-text);
}
.action-clear strong { color: var(--ink); }
.action-clear.spacious { min-height: 180px; justify-content: center; }
.action-workspace { padding-top: 5px; padding-bottom: 5px; }
.action-detail { grid-template-columns: 42px minmax(0, 1fr) auto; min-height: 132px; }
.action-detail .action-rank { width: 38px; height: 38px; }
.action-detail .action-copy h2 {
  margin: 0 0 5px; color: var(--ink); font: 600 18px/1.25 var(--head);
  text-transform: none;
}
.action-detail .action-copy > p { margin: 5px 0; font-size: 13px; }
.action-complete { display: flex; align-items: flex-start; gap: 7px; }
.action-complete .icon { margin-top: 2px; color: var(--accent-text); }
.action-complete strong { color: var(--ink); }
.action-button { min-width: 146px; }

.section-heading {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin: 34px 0 14px; scroll-margin-top: calc(var(--topbar) + 18px);
}
.section-heading h2 { margin: 0; color: var(--ink); font: 600 24px/1.2 var(--head); }
.travel-suggestion { scroll-margin-top: calc(var(--topbar) + 18px); border-left: 3px solid var(--warn); }
.travel-suggestion h3 { margin: 0; }
.travel-reason { max-width: 78ch; color: var(--ink); font-size: 14px; line-height: 1.55; }
.travel-window {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px; margin-top: 16px; overflow: hidden; background: var(--rule);
  border: 1px solid var(--edge); border-radius: 7px;
}
.travel-window span { padding: 14px; background: var(--canvas); }
.travel-window small { display: block; margin-bottom: 5px; color: var(--muted); text-transform: uppercase; }
.travel-window strong { display: block; color: var(--ink); }
.travel-grid { grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); }

.message-counts {
  display: flex; gap: 1px; margin-bottom: 18px; overflow: hidden;
  background: var(--rule); border: 1px solid var(--edge); border-radius: 8px;
}
.message-counts span { min-width: 140px; padding: 13px 17px; background: var(--surface); }
.message-counts strong { color: var(--ink); font: 600 20px var(--head); }
.message-library { padding-top: 4px; padding-bottom: 4px; }
.message-group { padding: 22px 0; border-bottom: 1px solid var(--edge); }
.message-group:last-child { border-bottom: 0; }
.message-group-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 8px;
}
.message-group-head h2 {
  margin: 0; color: var(--ink); font: 600 18px/1.25 var(--head);
  text-transform: none;
}
.message-row {
  display: grid; grid-template-columns: 100px minmax(0, 1fr) auto;
  align-items: center; gap: 16px; min-height: 72px; padding: 11px 2px;
  color: inherit; border-top: 1px solid var(--rule); text-decoration: none;
  transition: background .16s ease, padding .16s ease;
}
.message-row:hover, .message-row:focus-visible {
  padding-right: 9px; padding-left: 9px; background: var(--surface-2); outline: none;
}
.message-channel {
  display: inline-flex; align-items: center; gap: 7px; color: var(--accent-text);
  font-size: 10px; font-weight: 600; text-transform: uppercase;
}
.message-copy { min-width: 0; }
.message-copy strong { display: block; color: var(--ink); text-transform: capitalize; }
.message-copy span {
  display: block; overflow: hidden; color: var(--muted); font-size: 12px;
  text-overflow: ellipsis; white-space: nowrap;
}

.search-panel { padding: 14px; background: var(--surface); border: 1px solid var(--edge); border-radius: 8px; }
.search-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.search-field { position: relative; }
.search-field .icon { position: absolute; top: 50%; left: 14px; color: var(--muted); transform: translateY(-50%); }
.search-field input { padding-left: 42px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.filter-row .pill { text-decoration: none; }
.range-tabs {
  display: inline-flex; overflow: hidden; flex: 0 0 auto;
  background: var(--canvas); border: 1px solid var(--edge); border-radius: 6px;
}
.range-tabs a {
  min-width: 74px; padding: 9px 12px; color: var(--muted);
  border-right: 1px solid var(--rule); font-size: 12px; font-weight: 600;
  text-align: center; text-decoration: none;
}
.range-tabs a:last-child { border-right: 0; }
.range-tabs a:hover, .range-tabs a:focus-visible { color: var(--ink); background: var(--surface-2); outline: none; }
.range-tabs a.on { color: var(--on-accent); background: var(--accent); }
.quality-note { margin-top: 18px; border-left: 3px solid var(--purple); }
.quality-note p { max-width: 980px; color: var(--muted); line-height: 1.55; }
.quality-section { margin-top: 18px; }
.quality-section .panel-head > div { min-width: 0; }
.quality-table { overflow: hidden; border: 1px solid var(--rule); border-radius: 7px; }
.quality-head, .quality-row { display: grid; align-items: center; }
.quality-cols-7 .quality-head, .quality-cols-7 .quality-row {
  grid-template-columns: minmax(210px, 2fr) repeat(6, minmax(82px, 1fr));
}
.quality-cols-6 .quality-head, .quality-cols-6 .quality-row {
  grid-template-columns: minmax(210px, 2fr) repeat(5, minmax(82px, 1fr));
}
.quality-head { min-height: 40px; background: var(--canvas); border-bottom: 1px solid var(--rule); }
.quality-head span {
  padding: 8px 10px; color: var(--muted); font-size: 10px;
  font-weight: 700; text-transform: uppercase;
}
.quality-row { min-height: 66px; border-bottom: 1px solid var(--rule); transition: background .15s ease; }
.quality-row:last-child { border-bottom: 0; }
.quality-row:hover { background: var(--surface-2); }
.quality-primary, .quality-cell { min-width: 0; padding: 11px 10px; }
.quality-primary strong, .quality-primary span { display: block; }
.quality-primary strong { overflow-wrap: anywhere; color: var(--ink); font-size: 13px; }
.quality-primary .meta { margin-top: 4px; }
.quality-cell { color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; }
.quality-cell::before { display: none; }
.quality-split { grid-template-columns: 1fr; gap: 0; }
.list-panel { margin-top: 18px; }
.queue-when { display: grid; justify-items: end; gap: 5px; }
.payment-summary, .health-summary { margin-bottom: 24px; }
.three-panels { grid-template-columns: 1fr 1fr; }

.journey { position: relative; display: grid; }
.journey::before {
  position: absolute; top: 17px; bottom: 17px; left: 17px; width: 1px;
  background: var(--edge); content: "";
}
.journey-step {
  position: relative; display: grid; grid-template-columns: 35px minmax(0, 1fr) auto;
  gap: 12px; align-items: start; min-height: 70px; padding: 9px 0;
}
.journey-dot {
  position: relative; z-index: 1; display: grid; width: 35px; height: 35px;
  place-items: center; color: var(--muted); background: var(--canvas);
  border: 1px solid var(--edge); border-radius: 50%;
}
.journey-step.sent .journey-dot { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.journey-step.next .journey-dot { color: var(--purple); background: var(--purple-soft); border-color: var(--purple); box-shadow: 0 0 0 4px var(--purple-soft); }
.journey-step.failed .journey-dot { color: var(--warn); background: var(--warn-soft); border-color: var(--warn); }
.journey-step.cancelled { opacity: .62; }
.journey-copy { min-width: 0; padding-top: 2px; }
.journey-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; }
.journey-time { padding-top: 3px; color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; }
.journey-detail { margin-top: 4px; color: var(--muted); font-size: 12px; }
.journey-summary { margin-bottom: 16px; }
.journey-panel { border-top: 2px solid var(--accent); }

.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.status-cell { min-height: 84px; padding: 13px; background: var(--canvas); border: 1px solid var(--rule); border-radius: 7px; }
.status-cell span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.status-cell strong { display: block; margin-top: 7px; color: var(--ink); font: 600 21px var(--head); }

details { border-radius: 6px; }
summary { cursor: pointer; color: var(--ink); font-weight: 600; }
pre { max-width: 100%; }
.technical-details { margin-top: 14px; }
.technical-details summary {
  display: flex; min-height: 42px; align-items: center; padding: 0 12px;
  background: var(--canvas); border: 1px solid var(--rule); border-radius: 6px;
  font-size: 12px;
}
.technical-details[open] summary { border-color: var(--edge); border-radius: 6px 6px 0 0; }
.technical-details pre {
  overflow: auto; margin: 0; padding: 13px; background: var(--canvas);
  border: 1px solid var(--rule); border-top: 0; font-size: 11px;
}
.email-preview {
  display: block; width: 100%; height: 520px; margin-top: 10px;
  background: var(--canvas); border: 1px solid var(--edge);
}
.activity-details { margin: 0; }
.activity-details .panel-copy { margin: 14px 2px 6px; }
.activity-row { align-items: flex-start; }
.activity-row .meta { display: block; }
.block-row { display: block; }
.public-top {
  min-height: 68px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--rule);
}
.htmx-request { opacity: .55; transition: opacity .12s; }

.mobile-bar, .mobile-drawer, .mobile-scrim { display: none; }

@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(6, 190, 190, 0); }
  50% { box-shadow: 0 0 0 5px rgba(6, 190, 190, .12); }
}
.wrap > * { animation: enter .32s ease both; }
.cards .card:nth-child(2) { animation-delay: .04s; }
.cards .card:nth-child(3) { animation-delay: .08s; }
.cards .card:nth-child(4) { animation-delay: .12s; }
.top-meta .state-dot { animation: pulse 2.8s ease-in-out infinite; }

@media (max-width: 1100px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .metric-strip { grid-template-columns: repeat(3, 1fr); }
  .metric:nth-child(3) { border-right: 0; }
  .metric:nth-child(n+4) { border-top: 1px solid var(--rule); }
  .pipeline { grid-template-columns: repeat(3, 1fr); }
  .pulse-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 700px) and (max-width: 860px) {
  .metric-strip { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .metric,
  .metric:nth-child(3),
  .metric:nth-child(n+4) {
    border-top: 0;
    border-right: 1px solid var(--rule);
  }
  .metric:last-child { border-right: 0; }
}

@media (max-width: 860px) {
  :root { --topbar: 60px; }
  body { padding-bottom: calc(var(--mobile-bar) + var(--safe-b) + 12px); }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main-column::before { left: 0; }
  header.top { min-height: var(--topbar); padding: 0 17px; }
  .top-meta .desktop-only, .top-separator { display: none; }
  .top-context > .icon { display: none; }
  .top-brand {
    display: grid; width: 30px; height: 30px; flex: 0 0 30px;
    overflow: hidden; border: 1px solid var(--edge); border-radius: 6px;
  }
  .top-brand img { width: 100%; height: 100%; object-fit: cover; }
  .wrap { padding: 24px 17px 42px; }
  .page-intro { align-items: flex-start; flex-direction: column; gap: 12px; }
  .ops-grid, .split-layout, .integration-grid, .pulse-grid { grid-template-columns: 1fr; }
  .synoptic-flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pulse-stage:nth-child(3)::after { display: none; }
  .sticky-panel { position: static; }
  .mobile-bar {
    position: fixed; z-index: 50; right: 0; bottom: 0; left: 0;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding-bottom: var(--safe-b); background: var(--surface);
    border-top: 1px solid var(--edge); box-shadow: 0 -12px 34px rgba(0, 0, 0, .28);
  }
  .mobile-bar a, .mobile-bar button {
    display: grid; min-height: var(--mobile-bar); place-items: center; gap: 3px;
    padding: 9px 3px; color: var(--muted); background: transparent;
    border: 0; border-radius: 0; box-shadow: none; font-size: 10px;
    font-weight: 600; text-decoration: none; transform: none;
  }
  .mobile-bar a.on, .mobile-bar button.on { color: var(--accent-text); box-shadow: inset 0 2px 0 var(--accent); }
  .mobile-bar .icon { width: 20px; height: 20px; }
  .mobile-scrim {
    position: fixed; z-index: 51; inset: 0; background: rgba(0, 0, 0, .58);
    border: 0; border-radius: 0; opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
  }
  .mobile-drawer {
    position: fixed; z-index: 52; right: 0; bottom: calc(var(--mobile-bar) + var(--safe-b));
    left: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    padding: 15px 15px 18px; background: var(--surface); border-top: 1px solid var(--edge);
    box-shadow: 0 -24px 60px rgba(0, 0, 0, .38); opacity: 0;
    pointer-events: none; transform: translateY(18px);
    transition: opacity .2s ease, transform .2s ease;
  }
  .mobile-drawer a {
    display: flex; min-height: 50px; align-items: center; gap: 10px;
    padding: 10px 12px; color: var(--ink); background: var(--canvas);
    border: 1px solid var(--edge); border-radius: 7px; text-decoration: none; font-weight: 600;
  }
  body.menu-open .mobile-scrim { display: block; opacity: 1; pointer-events: auto; }
  body.menu-open .mobile-drawer { opacity: 1; pointer-events: auto; transform: translateY(0); }
  .journey-step { grid-template-columns: 35px minmax(0, 1fr); }
  .journey-time { grid-column: 2; padding-top: 0; text-align: left; }
  .recommended-action, .action-detail {
    grid-template-columns: 36px minmax(0, 1fr); align-items: start;
  }
  .recommended-action .action-cta, .action-detail .action-button {
    grid-column: 2; justify-self: start;
  }
  .message-row { grid-template-columns: 88px minmax(0, 1fr); }
  .message-row .action-cta { grid-column: 2; justify-self: start; }
  .quality-intro { gap: 18px; }
  .quality-intro .range-tabs { width: 100%; }
  .quality-intro .range-tabs a { flex: 1; }
  .quality-table { border: 0; border-radius: 0; }
  .quality-head { display: none; }
  .quality-cols-7 .quality-row, .quality-cols-6 .quality-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px;
    margin-top: 10px; background: var(--rule); border: 1px solid var(--rule); border-radius: 7px;
  }
  .quality-row:first-of-type { margin-top: 0; }
  .quality-primary { grid-column: 1 / -1; background: var(--canvas); }
  .quality-cell { min-height: 58px; background: var(--surface); }
  .quality-cell::before {
    display: block; margin-bottom: 4px; color: var(--muted); content: attr(data-label);
    font-size: 9px; font-weight: 700; text-transform: uppercase;
  }
}

@media (max-width: 620px) {
  .cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card { min-height: 148px; padding: 14px; }
  .card .n { font-size: 31px; }
  .card-icon { width: 30px; height: 30px; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 90px; border-top: 1px solid var(--rule); }
  .metric:nth-child(-n+2) { border-top: 0; }
  .metric:nth-child(2n) { border-right: 0; }
  .metric:nth-child(3) { border-right: 1px solid var(--rule); }
  .metric:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: 0; }
  .pipeline { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-span { grid-column: auto; }
  .panel { padding: 15px; }
  .integration-card { min-height: 0; }
  .evidence-list > div { grid-template-columns: 88px minmax(0, 1fr); }
  .synoptic-flow { grid-template-columns: 1fr 1fr; }
  .pulse-stage { min-height: 104px; padding: 15px; }
  .pulse-stage:nth-child(2n)::after { display: none; }
  .pulse-stage:nth-child(3)::after { display: block; }
  .pulse-panel { min-height: 0; }
  .status-grid { grid-template-columns: 1fr 1fr; }
  .search-line { grid-template-columns: 1fr; }
  .search-line .btn { width: 100%; }
  .queue-when { justify-items: start; }
  .row:has(.queue-when) { align-items: flex-start; flex-direction: column; }
  h1 { font-size: 29px; }
  .action-row .btn { flex: 1 1 calc(50% - 9px); }
  .action-row .contact-action { flex: 1 1 calc(50% - 9px); }
  .action-row .contact-action .btn { width: 100%; }
  .lead-actions .whatsapp-personal { flex-basis: 100%; }
  .reply-alert { padding: 16px; }
  .reply-alert-head { flex-direction: column; gap: 6px; }
  .intro-actions { width: 100%; }
  .intro-actions .btn { flex-basis: 100%; }
  .recommended-panel .panel-head, .message-group-head { align-items: flex-start; }
  .compact-actions .recommended-action { padding-top: 15px; padding-bottom: 15px; }
  .action-detail { padding: 18px 0; }
  .action-detail .action-button { width: 100%; }
  .message-counts span { min-width: 0; flex: 1; }
  .message-row { grid-template-columns: 1fr; gap: 6px; padding: 14px 2px; }
  .message-row .action-cta { grid-column: 1; }
  .message-copy span { white-space: normal; }
  .travel-window { grid-template-columns: 1fr; }
  .copy-link-row { grid-template-columns: 1fr; }
  .copy-link-row button { width: 100%; }
  .section-heading { align-items: flex-start; }
  .intro-actions form, .intro-actions form .btn { width: 100%; }
  .settings-actions:not(:has(.btn:not([hidden]))) { display: none; }
  .row:has(.settings-actions .btn:not([hidden])) { flex-wrap: wrap; }
  .settings-actions:has(.btn:not([hidden])) { width: 100%; }
  .settings-actions .btn { flex: 1 1 50%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
