/* Austra Lead CRM — admin theme on top of Bootstrap 5.3 */
:root {
  --app-bg: #f4f6fa;
  --app-surface: #ffffff;
  --app-border: #e6e9f0;
  --app-text: #1d2433;
  --app-muted: #6b7385;
  --app-primary: #2563eb;
  --app-primary-600: #1d4ed8;
  --app-primary-50: #eff4ff;
  --app-sidebar-w: 248px;
  --app-radius: 12px;
  --bs-primary: #2563eb;
  --bs-primary-rgb: 37, 99, 235;
  --bs-link-color: #2563eb;
  --bs-link-hover-color: #1d4ed8;
  --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: var(--app-text);
  --bs-border-color: var(--app-border);
}

body { background: var(--app-bg); color: var(--app-text); -webkit-font-smoothing: antialiased; }
.xsmall { font-size: .75rem; }
code { color: #a1366b; }

.btn-primary { --bs-btn-bg: var(--app-primary); --bs-btn-border-color: var(--app-primary); --bs-btn-hover-bg: var(--app-primary-600); --bs-btn-hover-border-color: var(--app-primary-600); --bs-btn-active-bg: #1e40af; --bs-btn-disabled-bg: #93b1f5; --bs-btn-disabled-border-color: #93b1f5; font-weight: 500; }
.btn { border-radius: 8px; }
.form-control, .form-select { border-radius: 8px; border-color: #d9dee8; padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: #93b1f5; box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15); }
.form-label { font-weight: 500; font-size: .875rem; margin-bottom: .35rem; }

.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #2563eb, #22c55e); color: #fff; font-size: 1.15rem; flex: none; }

/* ---------- Auth pages ---------- */
.auth-body { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, #e3ebff 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #e6f7ee 0%, transparent 55%), var(--app-bg); }
.auth-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-panel { width: 100%; max-width: 420px; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 16px; padding: 32px; box-shadow: 0 10px 30px rgba(17, 24, 39, .06); }
.auth-foot { margin-top: 16px; }
.install-wrap { max-width: 640px; margin: 0 auto; padding: 40px 16px; }

/* ---------- App shell ---------- */
.app-body { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--app-sidebar-w); background: var(--app-surface); border-right: 1px solid var(--app-border); display: flex; flex-direction: column; z-index: 1040; transition: transform .2s ease; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 600; }
.sidebar-brand-text { font-size: .95rem; line-height: 1.2; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; }
.sidebar-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--app-muted); padding: 16px 10px 6px; font-weight: 600; }
.sidebar-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin: 1px 0; border-radius: 8px; color: #3b4457; text-decoration: none; font-size: .9rem; font-weight: 500; }
.sidebar-link i { font-size: 1.05rem; width: 20px; text-align: center; color: #8a93a6; }
.sidebar-link:hover { background: #f3f5f9; color: var(--app-text); }
.sidebar-link.active { background: var(--app-primary-50); color: var(--app-primary); }
.sidebar-link.active i { color: var(--app-primary); }
.sidebar-link.is-disabled { color: #a3aaba; cursor: not-allowed; }
.sidebar-link.is-disabled:hover { background: transparent; }
.sidebar-link.is-disabled i { color: #c3c8d3; }
.badge-phase { margin-left: auto; font-size: .65rem; font-weight: 600; color: #8a93a6; background: #f1f3f7; border-radius: 6px; padding: 2px 6px; }
.sidebar-foot { padding: 12px 18px; border-top: 1px solid var(--app-border); }
.sidebar-backdrop { display: none; }

.main-col { margin-left: var(--app-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 24px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--app-border); }
.topbar-title { font-weight: 600; }
.btn-icon { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 1.3rem; }
.btn-icon:hover { background: #f1f3f7; }
.btn-user { display: flex; align-items: center; gap: 10px; border: 0; padding: 4px 8px; }
.btn-user:hover, .btn-user[aria-expanded="true"] { background: #f1f3f7; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--app-primary-50); color: var(--app-primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem; }
.content { padding: 24px; flex: 1; }
.content:focus { outline: none; }
.skip-link { position: absolute; left: 8px; top: 8px; z-index: 2000; background: #fff; padding: 8px 12px; border-radius: 8px; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .15); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 1035; }
  .main-col { margin-left: 0; }
  .topbar { padding: 0 12px; }
  .content { padding: 16px; }
}

/* ---------- Components ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 1.35rem; font-weight: 600; margin: 0; }
.page-sub { color: var(--app-muted); margin: 4px 0 0; font-size: .9rem; }

.card-soft { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); box-shadow: 0 1px 2px rgba(17, 24, 39, .03); }
.card-header-soft { padding: 16px 20px 12px; font-weight: 600; font-size: .95rem; }
.card-soft > .card-body.pt-0 { padding-left: 20px; padding-right: 20px; }

.stat-card .card-body { padding: 18px 20px; }
.stat-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--app-primary-50); color: var(--app-primary); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; margin-bottom: 12px; }
.stat-label { color: var(--app-muted); font-size: .82rem; font-weight: 500; }
.stat-value { font-size: 1.75rem; font-weight: 650; letter-spacing: -.01em; line-height: 1.2; }
.stat-hint { color: var(--app-muted); font-size: .75rem; }

.badge-soft-success { background: #e7f7ee; color: #15803d; }
.badge-soft-warning { background: #fff5e0; color: #a15c07; }
.badge-soft-danger { background: #fdecec; color: #b42318; }
.badge-soft-secondary { background: #eef0f4; color: #4b5565; }
.badge-soft-info { background: var(--app-primary-50); color: var(--app-primary); }
.badge { font-weight: 600; }

.table-clean { --bs-table-bg: transparent; }
.table-clean thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--app-muted); font-weight: 600; border-bottom-color: var(--app-border); }
.table-clean td { vertical-align: middle; border-color: #f0f2f6; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; margin: 0; font-size: .9rem; }
.kv dt { color: var(--app-muted); font-weight: 500; }
.kv dd { margin: 0; }
.check-list li { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; }

.phase-list { margin: 0; padding-left: 1.2rem; font-size: .9rem; }
.phase-list li { padding: 4px 0; color: var(--app-muted); }
.phase-list li.done { color: #15803d; font-weight: 500; }
.phase-list li.done::marker { content: "✓  "; }

.empty-state { text-align: center; padding: 40px 16px; background: var(--app-surface); border: 1px dashed #d6dbe5; border-radius: var(--app-radius); }
.empty-state > i { font-size: 2rem; color: #a3aaba; display: block; margin-bottom: 8px; }

.app-toast { border: 0; border-radius: 10px; box-shadow: 0 8px 24px rgba(17, 24, 39, .12); border-left: 4px solid var(--app-primary); background: #fff; }
.app-toast.toast-success { border-left-color: #16a34a; }
.app-toast.toast-danger { border-left-color: #dc2626; }
.app-toast.toast-warning { border-left-color: #d97706; }

.list-group-item { border-color: #f0f2f6; }

/* ================= Phase 2–3 ================= */
.fw-medium { font-weight: 500; }
.min-w-0 { min-width: 0; }
.req { color: #b42318; }
.badge-soft-primary { background: var(--app-primary-50); color: var(--app-primary); }
.badge-soft-demo { background: #f3e8ff; color: #7e22ce; }
.alert-demo { background: #faf5ff; border: 1px solid #e9d5ff; color: #6b21a8; }
.card-link { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.card-link:hover { border-color: #c7d4f5; box-shadow: 0 4px 14px rgba(37, 99, 235, .08); color: inherit; }
.tone-bg-primary { background: var(--app-primary-50); color: var(--app-primary); }
.tone-bg-success { background: #e7f7ee; color: #15803d; }
.tone-bg-warning { background: #fff5e0; color: #a15c07; }
.delta { font-weight: 600; }
.delta-up { color: #15803d; }
.delta-down { color: #b42318; }

/* Page tabs */
.page-tabs { border-bottom: 1px solid var(--app-border); gap: 1.25rem; }
.page-tabs .nav-link { color: var(--app-muted); font-weight: 500; font-size: .9rem; padding: .5rem 0; }
.page-tabs .nav-link.active { color: var(--app-primary); border-bottom-color: var(--app-primary); }
.nav-underline .nav-link { font-size: .875rem; }

/* Range form */
.range-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-form .form-select { width: auto; min-width: 150px; }
.range-custom { display: flex; align-items: center; gap: 6px; }
.range-custom .form-control { width: auto; }

/* Charts (SVG, CSP-safe) */
.chart-svg { width: 100%; height: auto; display: block; }
.chart-grid { stroke: #eef1f6; stroke-width: 1; }
.chart-baseline { stroke: #d6dbe5; stroke-width: 1; }
.chart-axis { fill: #8a93a6; font-size: 10px; font-family: inherit; }
.chart-bar { fill: var(--app-primary); }
.chart-hit { fill: transparent; }
.chart-col:hover .chart-bar { fill: var(--app-primary-600); }
.chart-col:hover .chart-hit { fill: rgba(37, 99, 235, .05); }
.chart-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 160px; color: var(--app-muted); text-align: center; padding: 16px; }
.chart-empty > i { font-size: 1.6rem; color: #b6bdcb; }
.meter { width: 100%; height: 6px; display: block; grid-column: 1 / -1; }
.meter-track { fill: #eef1f6; }
.tone-primary { fill: var(--app-primary); stroke: var(--app-primary); background: var(--app-primary); }
.tone-info { fill: #60a5fa; stroke: #60a5fa; background: #60a5fa; }
.tone-success { fill: #16a34a; stroke: #16a34a; background: #16a34a; }
.tone-warning { fill: #f59e0b; stroke: #f59e0b; background: #f59e0b; }
.tone-danger { fill: #dc2626; stroke: #dc2626; background: #dc2626; }
.tone-secondary { fill: #9aa3b5; stroke: #9aa3b5; background: #9aa3b5; }
.bar-list { list-style: none; padding: 0; margin: 0; }
.bar-list li + li { margin-top: 10px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; color: inherit; text-decoration: none; font-size: .875rem; border-radius: 6px; }
a.bar-row:hover .bar-label { color: var(--app-primary); }
.bar-label { min-width: 0; }
.bar-num { font-weight: 600; font-variant-numeric: tabular-nums; }
.donut { width: 128px; height: 128px; flex: none; transform: none; }
.donut-track { stroke: #eef1f6; }
.donut-seg { fill: none; }
.donut-num { font-size: 7px; font-weight: 650; fill: var(--app-text); }
.donut-lbl { font-size: 3.2px; fill: var(--app-muted); text-transform: uppercase; letter-spacing: .05em; }
.kv-tight { grid-template-columns: 1fr auto; gap: 2px 12px; font-size: .85rem; }
.kv-tight dd { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.rate-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid #f0f2f6; padding-top: 12px; }
.rate-num { font-size: 1.15rem; font-weight: 650; }
.rate-lbl { font-size: .72rem; color: var(--app-muted); }
.provider-mini li { padding: 3px 0; }

/* Attention chips */
.attention-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); padding: 10px 14px; }
.attention-title { font-weight: 600; font-size: .85rem; margin-right: 4px; }
.attention-chip { font-size: .8rem; font-weight: 500; padding: 4px 10px; border-radius: 999px; text-decoration: none; }
.chip-danger { background: #fdecec; color: #b42318; }
.chip-warning { background: #fff5e0; color: #a15c07; }
.chip-info { background: var(--app-primary-50); color: var(--app-primary); }
.attention-chip:hover { filter: brightness(.97); text-decoration: underline; }

/* Activity feed */
.feed { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.feed li { position: relative; padding: 5px 0 5px 16px; }
.feed-dot { position: absolute; left: 0; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: #c3c8d3; }
.feed-dot.ev-status { background: var(--app-primary); }
.feed-dot.ev-consent { background: #16a34a; }
.feed-dot.ev-note { background: #f59e0b; }
.feed-dot.ev-created { background: #60a5fa; }

/* Tables & filter bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 16px; border-bottom: 1px solid #f0f2f6; }
.filter-bar .form-select { width: auto; max-width: 220px; }
.filter-search { position: relative; flex: 1 1 220px; max-width: 360px; }
.filter-search > i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #9aa3b5; font-size: .85rem; }
.filter-search .form-control { padding-left: 30px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 12px; padding-top: 10px; }
.filter-grid label { font-size: .75rem; color: var(--app-muted); font-weight: 500; display: flex; flex-direction: column; gap: 3px; }
.filter-grid .form-select { max-width: none; width: 100%; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid #f0f2f6; }
.th-sort { color: inherit; text-decoration: none; white-space: nowrap; }
.th-sort:hover, .th-sort.active { color: var(--app-text); }
.th-sort i { font-size: .65rem; opacity: .6; }
.table-clean > :not(caption) > * > * { padding-left: 16px; padding-right: 16px; }
.table-sm.table-clean > :not(caption) > * > * { padding-left: 8px; padding-right: 8px; }
.card-soft .table-sm.table-clean > :not(caption) > * > *:first-child { padding-left: 0; }
.col-check { width: 36px; padding-right: 0 !important; }
.lead-cell { max-width: 320px; }
.cell-wide { max-width: 220px; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; background: var(--app-primary-50); border-bottom: 1px solid #dbe6ff; }
.quick-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.qf-chip { font-size: .8rem; font-weight: 500; padding: 5px 12px; border-radius: 999px; background: var(--app-surface); border: 1px solid var(--app-border); color: #3b4457; text-decoration: none; }
.qf-chip:hover { border-color: #c7d4f5; color: var(--app-primary); }
.qf-chip.active { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
.pagination .page-link { border-radius: 6px; margin: 0 2px; border-color: var(--app-border); color: #3b4457; }
.pagination .active > .page-link { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
.json-pre { font-size: .72rem; background: #f7f8fb; border: 1px solid #eef1f6; border-radius: 6px; padding: 8px; margin: 6px 0 4px; max-width: 420px; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.audit-table details > summary { cursor: pointer; color: var(--app-primary); }
.action-code.act-auth { color: #7c3aed; }
.action-code.act-lead, .action-code.act-leads { color: #0e7490; }
.action-code.act-user, .action-code.act-users { color: #a1366b; }
.action-code.act-settings, .action-code.act-system, .action-code.act-demo { color: #a15c07; }
.perm-group td { background: #f7f8fb; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--app-muted); font-weight: 600; }

/* User page */
.action-stack { display: flex; flex-direction: column; }
.action-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f2f6; font-size: .875rem; }
.action-item:last-child { border-bottom: 0; }
.action-item form { flex: none; }
details > summary { cursor: pointer; }

/* Forms */
.form-section { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--app-muted); font-weight: 600; margin-bottom: 12px; }
fieldset[disabled] .form-control, fieldset[disabled] .form-select { background: #f7f8fb; }

/* Lead page */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 13px; top: 6px; bottom: 6px; width: 2px; background: #eef1f6; }
.tl-item { position: relative; display: flex; gap: 12px; padding: 6px 0; font-size: .875rem; }
.tl-icon { position: relative; z-index: 1; flex: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 2px solid #eef1f6; display: flex; align-items: center; justify-content: center; font-size: .8rem; color: #8a93a6; }
.tl-item.ev-status .tl-icon { color: var(--app-primary); border-color: #dbe6ff; }
.tl-item.ev-consent .tl-icon { color: #15803d; border-color: #c9eed8; }
.tl-item.ev-note .tl-icon { color: #a15c07; border-color: #fde7bf; }
.tl-item.ev-created .tl-icon { color: #2563eb; }
.tl-body { padding-top: 3px; min-width: 0; }
.note { padding: 10px 12px; background: #fffbeb; border: 1px solid #fdf0c6; border-radius: 8px; font-size: .875rem; }
.note + .note { margin-top: 8px; }
.note-body { white-space: normal; word-break: break-word; }
.wa-thread { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.wa-msg { display: flex; }
.wa-msg.wa-out { justify-content: flex-end; }
.wa-bubble { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: .875rem; }
.wa-out .wa-bubble { background: #e7f7ee; border-top-right-radius: 4px; }
.wa-in .wa-bubble { background: #f3f5f9; border-top-left-radius: 4px; }
.wa-meta { font-size: .72rem; color: var(--app-muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.wa-body { word-break: break-word; }

/* Import */
.import-stat { text-align: center; min-width: 90px; padding: 8px 12px; border-radius: 10px; background: #f7f8fb; }
.import-stat .n { font-size: 1.3rem; font-weight: 650; }
.import-stat .l { font-size: .72rem; color: var(--app-muted); }
.import-stat.ok { background: #e7f7ee; color: #15803d; }
.import-stat.bad { background: #fdecec; color: #b42318; }
.col-list li { padding: 1px 0; }

@media (max-width: 575.98px) {
  .page-head { align-items: flex-start; }
  .filter-bar .form-select { max-width: none; flex: 1 1 140px; }
  .kv { grid-template-columns: 110px 1fr; }
  .action-item { flex-direction: column; align-items: flex-start; }
  .range-form { width: 100%; }
}

/* ================= Austra Lead CRM additions ================= */
.nav-count { margin-left: auto; font-size: .68rem; font-weight: 700; color: #fff; background: #dc2626; border-radius: 999px; padding: 1px 7px; }
.bell-dot { position: absolute; top: 2px; right: 0; font-size: .6rem; font-weight: 700; color: #fff; background: #dc2626; border-radius: 999px; padding: 1px 5px; line-height: 1.2; }
.brand-mark { background: linear-gradient(135deg, #0f766e, #22c55e); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }
.text-break-all { word-break: break-all; }
.secret-box { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 12px; word-break: break-all; font-size: .85rem; }
.code-block { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f7f8fb; border: 1px solid #eef1f6; border-radius: 8px; padding: 12px; font-size: .78rem; white-space: pre-wrap; word-break: break-word; margin: 0; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; }
.status-pill .dot { margin: 0; }
.dot-success { background: #16a34a; } .dot-danger { background: #dc2626; } .dot-warning { background: #f59e0b; } .dot-secondary { background: #9aa3b5; } .dot-primary { background: var(--app-primary); } .dot-info { background: #60a5fa; }
.lifecycle { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.lifecycle li { font-size: .75rem; padding: 4px 10px; border-radius: 999px; background: #f1f3f7; color: #8a93a6; }
.lifecycle li.on { background: #e7f7ee; color: #15803d; font-weight: 600; }
.lifecycle li.bad { background: #fdecec; color: #b42318; font-weight: 600; }

/* Funnel */
.funnel { list-style: none; padding: 0; margin: 0; }
.funnel li { display: grid; grid-template-columns: 150px 1fr 70px; gap: 10px; align-items: center; padding: 5px 0; font-size: .85rem; }
.funnel .bar { height: 22px; border-radius: 6px; background: #eef1f6; overflow: hidden; }
.funnel .bar svg { display: block; width: 100%; height: 22px; }
.funnel .num { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric-def { font-size: .72rem; color: var(--app-muted); }
.metric-card .stat-value { font-size: 1.5rem; }

/* Inbox */
.inbox { display: grid; grid-template-columns: 340px 1fr; gap: 0; min-height: calc(100vh - 140px); }
.inbox-list { border-right: 1px solid var(--app-border); overflow-y: auto; max-height: calc(100vh - 140px); }
.inbox-item { display: block; padding: 12px 16px; border-bottom: 1px solid #f0f2f6; color: inherit; text-decoration: none; }
.inbox-item:hover { background: #f7f8fb; color: inherit; }
.inbox-item.active { background: var(--app-primary-50); }
.inbox-item .preview { color: var(--app-muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-dot { display: inline-block; min-width: 18px; padding: 0 5px; height: 18px; line-height: 18px; text-align: center; border-radius: 9px; background: #16a34a; color: #fff; font-size: .68rem; font-weight: 700; }
.inbox-pane { display: flex; flex-direction: column; min-width: 0; }
.inbox-head { padding: 12px 16px; border-bottom: 1px solid var(--app-border); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.inbox-thread { flex: 1; overflow-y: auto; padding: 16px; background: #fafbfc; max-height: calc(100vh - 330px); }
.inbox-compose { border-top: 1px solid var(--app-border); padding: 12px 16px; }
.wa-bubble.wa-bot { background: #eef6ff; }
.wa-bubble.wa-agent { background: #e7f7ee; }
.wa-bubble.wa-fail { background: #fdecec; }
.wa-bubble.wa-blocked { background: #f3f4f6; color: #6b7280; }
@media (max-width: 991.98px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox-list { max-height: 320px; border-right: 0; border-bottom: 1px solid var(--app-border); }
  .inbox-thread { max-height: none; }
}

.step-card { border: 1px solid var(--app-border); border-radius: 10px; padding: 14px; background: #fff; }
.step-card + .step-card { margin-top: 12px; }
.opt-row { display: grid; grid-template-columns: 130px 1fr 170px 150px 120px; gap: 6px; margin-bottom: 6px; }
@media (max-width: 767.98px) { .opt-row { grid-template-columns: 1fr; } }
.hours-grid { display: grid; grid-template-columns: 110px 70px 1fr 1fr; gap: 6px 10px; align-items: center; max-width: 520px; }
.checklist-ok { color: #15803d; } .checklist-bad { color: #b42318; } .checklist-warn { color: #a15c07; }
.flow-diagram { font-size: .82rem; }
