/* MedX Connect design system. Plain CSS, no build step: copy to public/css/admin.css after editing. */

/* ---------- Tokens ---------- */
:root {
  --white: #ffffff;
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-border: #e3e8e7;
  --color-border-strong: #c9d3d1;
  --color-text: #14201f;
  --color-text-secondary: #41504e;
  --color-text-muted: #5b6b69;
  --color-text-disabled: #7a8886;

  --color-primary: #0b5f5a;
  --color-primary-hover: #084a46;
  --color-primary-active: #063a37;
  --color-mint: #e6f6f1;
  --color-mint-hover: #f2faf7;
  --color-mint-border: #b5e3d4;

  --color-success: #0f6b3c;
  --color-success-soft: #e7f6ec;
  --color-success-border: #b7e2c6;
  --color-warning: #8a4b00;
  --color-warning-soft: #fff4e0;
  --color-warning-border: #f2d6a2;
  --color-danger: #b42318;
  --color-danger-soft: #fdecea;
  --color-danger-border: #f5c2bc;
  --color-info: #175cd3;
  --color-info-soft: #eaf2fe;
  --color-info-border: #c3d9fb;

  --sidebar-width: 244px;
  --sidebar-collapsed: 64px;
  --topbar-height: 56px;
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 30, .05);
  --shadow-md: 0 4px 14px rgba(16, 32, 30, .08);
  --shadow-lg: 0 18px 48px rgba(16, 32, 30, .18);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--white); color: var(--color-text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--color-primary); }
a:hover { color: var(--color-primary-hover); }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 8px; letter-spacing: -.01em; font-weight: 600; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--color-border); margin: 16px 0; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--color-mint-hover); border: 1px solid var(--color-border); padding: 0 5px; border-radius: 5px; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--color-primary); color: #fff; padding: 8px 12px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { left: 8px; color: #fff; }

/* ---------- Utilities ---------- */
.muted { color: var(--color-text-muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.m-0 { margin: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row--tight { gap: 6px; }
.row--nowrap { flex-wrap: nowrap; }
.row--between { justify-content: space-between; }
.row--end { align-items: flex-end; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 16px; }
.stack--sm > * + * { margin-top: 8px; }
.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--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid--aside { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid > .card { margin-bottom: 0; }
.grid.mb-16 { margin-bottom: 16px; }
@media (max-width: 1100px) { .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid--aside { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; } }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--white); border-right: 1px solid var(--color-border); height: 100vh; position: sticky; top: 0; flex-shrink: 0; display: flex; flex-direction: column; transition: width .16s ease, transform .2s ease; z-index: 40; }
.sidebar__brand { display: flex; align-items: center; justify-content: center; height: var(--topbar-height); padding: 0 14px; border-bottom: 1px solid var(--color-border); text-decoration: none; white-space: nowrap; overflow: hidden; flex-shrink: 0; }
.sidebar__brand:hover { opacity: .88; }
.sidebar__logo-full { display: block; height: 34px; max-height: 38px; width: auto; max-width: 215px; object-fit: contain; margin: 0 auto; }
.sidebar__logo-mark { display: none; }
.sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.2; font-weight: 700; font-size: 14px; }
.sidebar__brand-text small { font-size: 11px; font-weight: 500; color: var(--color-text-muted); }
.brand-mark { flex-shrink: 0; display: block; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.sidebar__section { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--color-text-muted); padding: 14px 10px 4px; white-space: nowrap; overflow: hidden; }
.sidebar__link { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px; margin-bottom: 1px; color: var(--color-text-secondary); text-decoration: none; font: inherit; font-size: 13.5px; font-weight: 500; border: 0; background: none; border-radius: var(--radius-sm); white-space: nowrap; cursor: pointer; }
.sidebar__link svg { width: 17px; height: 17px; flex-shrink: 0; stroke: currentColor; }
.sidebar__link:hover { background: var(--color-mint-hover); color: var(--color-primary-hover); }
.sidebar__link--active, .sidebar__link--active:hover { background: var(--color-mint); color: var(--color-primary); font-weight: 600; }
.sidebar__count { margin-left: auto; background: var(--color-primary); color: #fff; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 0 7px; line-height: 18px; }
.sidebar__footer { border-top: 1px solid var(--color-border); padding: 8px 10px; }

body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .sidebar__brand { justify-content: center; padding: 0; }
body.sidebar-collapsed .sidebar__logo-full { display: none; }
body.sidebar-collapsed .sidebar__logo-mark { display: block; width: 36px; height: 36px; object-fit: contain; margin: 0 auto; }
body.sidebar-collapsed .sidebar__label, body.sidebar-collapsed .sidebar__section, body.sidebar-collapsed .sidebar__brand-text, body.sidebar-collapsed .sidebar__count { display: none; }
body.sidebar-collapsed .sidebar__link { justify-content: center; padding: 8px 0; }
body.sidebar-collapsed .sidebar__collapse svg { transform: rotate(180deg); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: var(--topbar-height); background: var(--white); border-bottom: 1px solid var(--color-border); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 30; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-text-muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--color-text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--color-primary); text-decoration: underline; }
.crumbs span[aria-hidden] { color: var(--color-border-strong); }
.topbar__search { position: relative; margin-left: auto; width: 260px; }
.topbar__search svg { position: absolute; left: 10px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); stroke: var(--color-text-muted); pointer-events: none; }
.topbar__search .form-input { padding: 6px 10px 6px 31px; font-size: 13px; }
.topbar__user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar__spacer { margin-left: auto; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--color-mint); color: var(--color-primary); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.user-chip { display: flex; flex-direction: column; line-height: 1.25; }
.user-chip__name { font-weight: 600; font-size: 13px; }
.user-chip__role { font-size: 11.5px; color: var(--color-text-muted); }
.account-switch { display: flex; align-items: center; gap: 6px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 2px 4px 2px 10px; background: var(--white); }
.account-switch select { border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--color-primary); max-width: 160px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--white); color: var(--color-text-secondary); cursor: pointer; flex-shrink: 0; }
.icon-btn svg { width: 17px; height: 17px; stroke: currentColor; }
.icon-btn:hover { background: var(--color-mint-hover); color: var(--color-primary); border-color: var(--color-border-strong); }
.topbar__menu { display: none; }
.content { padding: 20px 24px 32px; flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; }
.content--flush { padding: 0; max-width: none; display: flex; flex-direction: column; }
.backdrop { display: none; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head__title { font-size: 21px; font-weight: 600; letter-spacing: -.015em; margin: 0; overflow-wrap: anywhere; }
.page-head__desc { margin: 2px 0 0; color: var(--color-text-muted); font-size: 13.5px; max-width: 760px; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-head__actions form { margin: 0; }

@media (max-width: 1180px) { .user-chip { display: none; } .topbar__search { width: 200px; } }
@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); width: var(--sidebar-width) !important; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(16, 32, 30, .4); z-index: 35; }
  body.sidebar-collapsed .sidebar__label, body.sidebar-collapsed .sidebar__section { display: block; }
  body.sidebar-collapsed .sidebar__brand-text { display: flex; }
  body.sidebar-collapsed .sidebar__link { justify-content: flex-start; padding: 6px 10px; }
  .sidebar__collapse { display: none; }
  .topbar__menu { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px 16px 24px; }
  .content--flush { padding: 0; }
  .account-switch, .crumbs { display: none; }
  .topbar__search { flex: 1; width: auto; margin-left: 0; }
}

/* ---------- Surfaces ---------- */
.card { background: var(--white); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); min-width: 0; margin-bottom: 16px; }
.card:last-child { margin-bottom: 0; }
.card--flush { padding: 0; overflow: hidden; }
.card--narrow { max-width: 780px; }
.card--active { border-color: var(--color-mint-border); }
.card--warning { border-color: var(--color-warning-border); }
.card--danger { border-color: var(--color-danger-border); }
.card--success { border-color: var(--color-success-border); }
.card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card--flush > .card__header { padding: 14px 18px 0; }
.card__title { font-size: 14.5px; font-weight: 600; margin: 0; }
.card > h3.card__title:first-child { margin-bottom: 10px; }
.card__hint { font-size: 12.5px; color: var(--color-text-muted); margin: 2px 0 0; }
.card__link { color: var(--color-primary); font-size: 12.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.card__link:hover { text-decoration: underline; }
a.card, a.card:hover { color: inherit; text-decoration: none; }
a.card { transition: box-shadow .15s ease, border-color .15s ease; }
a.card:hover { box-shadow: var(--shadow-md); border-color: var(--color-mint-border); }
.section-title { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--color-text-muted); margin: 18px 0 8px; }
.section-title:first-child { margin-top: 0; }
.form-narrow { max-width: 780px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border-strong); background: var(--white); color: var(--color-text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.3; white-space: nowrap; transition: background .12s ease, border-color .12s ease, color .12s ease; }
.btn:hover { background: var(--color-mint-hover); border-color: var(--color-primary); color: var(--color-primary); }
.btn:active { background: var(--color-mint); }
.btn svg { width: 15px; height: 15px; stroke: currentColor; flex-shrink: 0; }
.btn--primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); color: #fff; }
.btn--primary:active { background: var(--color-primary-active); }
.btn--secondary { background: var(--white); }
.btn--danger { color: var(--color-danger); border-color: var(--color-danger-border); }
.btn--danger:hover { background: var(--color-danger-soft); border-color: var(--color-danger); color: var(--color-danger); }
.btn--danger-solid { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.btn--danger-solid:hover { background: #912018; border-color: #912018; color: #fff; }
.btn--ghost { border-color: transparent; background: transparent; color: var(--color-text-muted); }
.btn--sm { min-height: 28px; padding: 3px 9px; font-size: 12.5px; }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--white); border-color: var(--color-border); color: var(--color-text-disabled); cursor: not-allowed; }
.btn.is-loading { pointer-events: none; opacity: .75; }
.btn.is-loading::before { content: ""; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.unavailable { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--color-text-muted); }
.unavailable svg { width: 14px; height: 14px; stroke: currentColor; flex-shrink: 0; margin-top: 2px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: nowrap; }
.row-actions form { margin: 0; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-label { display: block; margin-bottom: 4px; font-weight: 600; font-size: 13px; color: var(--color-text); }
.form-group:has(> [required]) > .form-label::after { content: " *"; color: var(--color-danger); }
.form-label small, .form-label .muted { font-weight: 400; }
.form-hint { font-size: 12px; color: var(--color-text-muted); margin: 4px 0 0; }
.form-input { display: block; width: 100%; min-height: 34px; padding: 6px 10px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); font: inherit; font-size: 13.5px; background: var(--white); color: var(--color-text); transition: border-color .12s ease, box-shadow .12s ease; }
.form-input:hover:not(:disabled) { border-color: var(--color-text-disabled); }
.form-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(11, 95, 90, .16); }
.form-input::placeholder { color: var(--color-text-disabled); }
.form-input:disabled { color: var(--color-text-muted); background: var(--white); border-style: dashed; cursor: not-allowed; }
.form-input[aria-invalid="true"] { border-color: var(--color-danger); }
.form-input:-webkit-autofill, .form-input:-webkit-autofill:hover { -webkit-text-fill-color: var(--color-text); box-shadow: inset 0 0 0 1000px var(--white); }
.form-input:-webkit-autofill:focus { -webkit-text-fill-color: var(--color-text); box-shadow: inset 0 0 0 1000px var(--white), 0 0 0 3px rgba(11, 95, 90, .16); }
.form-input--mono { font-family: var(--mono); font-size: 12.5px; }
.form-input--auto { width: auto; }
.form-input--sm { min-height: 28px; padding: 3px 8px; font-size: 12.5px; }
textarea.form-input { resize: vertical; }
.form-error { color: var(--color-danger); font-size: 12.5px; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-row .form-group:last-child { margin-bottom: 14px; }
@media (max-width: 760px) { .form-row, .form-row--3, .form-row--4 { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .form-group { margin: 0; }
.filters .form-input { min-width: 140px; }
.checkbox { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.checkbox input, .form-check { width: 16px; height: 16px; accent-color: var(--color-primary); flex-shrink: 0; cursor: pointer; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 16px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.switch-row form { margin: 0; }
.fieldset { border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 0 14px; }
.fieldset legend { padding: 0 6px; font-size: 12.5px; font-weight: 600; }
.fieldset[hidden] { display: none; }

/* ---------- Toolbars ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 10px; }
.toolbar__filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1; min-width: 0; }
.toolbar__filters .form-input { width: auto; min-width: 130px; max-width: 190px; }
.toolbar__search { position: relative; flex: 1 1 240px; min-width: 200px; max-width: 340px; }
.toolbar__filters .toolbar__search .form-input { width: 100%; max-width: none; padding-left: 31px; }
.toolbar__search-icon { position: absolute; left: 10px; top: 50%; display: flex; transform: translateY(-50%); pointer-events: none; }
.toolbar__search-icon svg { width: 15px; height: 15px; stroke: var(--color-text-muted); }
.toolbar__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.results-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 2px 2px 8px; font-size: 12.5px; color: var(--color-text-muted); }
.seg { display: inline-flex; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg a, .seg button { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; font: inherit; font-size: 13px; font-weight: 500; color: var(--color-text-secondary); text-decoration: none; background: var(--white); border: 0; border-left: 1px solid var(--color-border); cursor: pointer; white-space: nowrap; }
.seg a:first-child, .seg button:first-child { border-left: 0; }
.seg a:hover, .seg button:hover { background: var(--color-mint-hover); color: var(--color-primary); }
.seg .is-active, .seg .is-active:hover { background: var(--color-mint); color: var(--color-primary); font-weight: 600; }
.date-filter { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.date-filter__custom { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.date-filter__custom .form-input { width: 142px; }
.date-filter__range { font-size: 12.5px; color: var(--color-text-muted); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--color-border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { position: relative; padding: 8px 12px; font-size: 13px; font-weight: 500; color: var(--color-text-muted); text-decoration: none; white-space: nowrap; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.tabs a:hover { background: var(--color-mint-hover); color: var(--color-primary); }
.tabs a[aria-current] { background: var(--color-mint); color: var(--color-primary); font-weight: 600; box-shadow: inset 0 -2px 0 var(--color-primary); }
.tabs__count { margin-left: 4px; font-size: 11.5px; color: var(--color-text-muted); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid; font-size: 13px; margin-bottom: 14px; }
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; stroke: currentColor; }
.alert:last-child { margin-bottom: 0; }
.alert--success { background: var(--color-success-soft); border-color: var(--color-success-border); color: var(--color-success); }
.alert--error { background: var(--color-danger-soft); border-color: var(--color-danger-border); color: #8f1c13; }
.alert--warning { background: var(--color-warning-soft); border-color: var(--color-warning-border); color: #6d3c00; }
.alert--info { background: var(--color-info-soft); border-color: var(--color-info-border); color: #124aa8; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert a { color: inherit; font-weight: 600; }

/* ---------- Tables ---------- */
.table-wrap { position: relative; overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.card--flush .table-wrap { margin: 0; padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--color-text-muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--color-border); white-space: nowrap; background: var(--white); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--color-mint-hover); }
.table tbody tr.is-selected { background: var(--color-mint); }
.table tbody tr.is-dim { opacity: .55; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table th:first-child, .table td:first-child { padding-left: 2px; }
.table th:last-child, .table td:last-child { padding-right: 2px; }
.card--flush .table th:first-child, .card--flush .table td:first-child { padding-left: 18px; }
.card--flush .table th:last-child, .card--flush .table td:last-child { padding-right: 18px; }
.table a:not(.btn) { font-weight: 500; text-decoration: none; }
.table a:not(.btn):hover { text-decoration: underline; }
.cell-title { font-weight: 600 !important; color: var(--color-text); }
.cell-sub { font-size: 12px; color: var(--color-text-muted); margin-top: 1px; }
.cell-clip { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-wide { min-width: 240px; max-width: 420px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-chip { font-size: 11.5px; font-weight: 500; padding: 1px 7px; border-radius: 5px; background: var(--white); border: 1px solid var(--color-border); color: var(--color-text-secondary); white-space: nowrap; }
.status-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 5px; background: var(--white); border: 1px solid var(--color-border); color: var(--color-text-secondary); max-width: 200px; line-height: 1.35; }
.status-chip__rule svg { width: 13px; height: 13px; stroke: var(--color-primary); display: block; }

/* ---------- Badges (status always carries a text label) ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--color-border); white-space: nowrap; background: var(--white); color: var(--color-text-secondary); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--good { background: var(--color-success-soft); color: var(--color-success); border-color: var(--color-success-border); }
.badge--warning { background: var(--color-warning-soft); color: var(--color-warning); border-color: var(--color-warning-border); }
.badge--critical { background: var(--color-danger-soft); color: var(--color-danger); border-color: var(--color-danger-border); }
.badge--info { background: var(--color-info-soft); color: var(--color-info); border-color: var(--color-info-border); }
.badge--plain::before { display: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--color-text-disabled); }
.dot--good { background: #1a9a5a; }
.dot--warning, .dot--warn { background: #d98a00; }
.dot--critical { background: var(--color-danger); }
.dot--info { background: var(--color-info); }

/* ---------- Empty / charts / meters ---------- */
.empty { text-align: center; padding: 28px 16px; color: var(--color-text-muted); font-size: 13px; }
.empty svg { width: 28px; height: 28px; stroke: var(--color-text-disabled); margin-bottom: 6px; }
.empty__title { font-weight: 600; color: var(--color-text); margin-bottom: 2px; font-size: 14px; }
.empty .btn { margin-top: 10px; }
.empty--compact { padding: 16px 8px; }
.chart-box { position: relative; height: 240px; }
.chart-box--tall { height: 300px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--color-text-secondary); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.progress { height: 6px; background: var(--color-border); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--color-primary); border-radius: 999px; }
.bar { height: 6px; background: var(--color-border); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--color-primary); }
.bar > .bar--good { background: #1a9a5a; }
.bar > .bar--warning { background: #d98a00; }
.bar > .bar--critical { background: var(--color-danger); }
.funnel-row { margin-bottom: 10px; }
.funnel-row:last-child { margin-bottom: 0; }
.funnel-row__top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 3px; }

/* Disclosure */
details.definitions summary, details.disclosure summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--color-primary); }
details.definitions dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 12.5px; margin: 10px 0 0; }
details.definitions dt { font-weight: 600; }
details.definitions dd { margin: 0; color: var(--color-text-secondary); }
details.disclosure { margin-top: 10px; }
details.disclosure > :not(summary):first-of-type { margin-top: 8px; }
.pre { background: var(--white); border: 1px solid var(--color-border); padding: 10px; border-radius: var(--radius-sm); font-family: var(--mono); font-size: 11.5px; overflow: auto; max-height: 260px; margin: 0; }
.code-line { display: block; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--white); font-size: 12.5px; word-break: break-all; }

/* Key-value lists */
.kv { display: grid; grid-template-columns: minmax(90px, max-content) minmax(0, 1fr); gap: 5px 14px; font-size: 13px; margin: 0; }
.kv dt { color: var(--color-text-muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; margin: 0; font-size: 13px; }
.facts dt { font-size: 12px; color: var(--color-text-muted); }
.facts dd { margin: 1px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.num-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px 16px; }
.num-grid__value { display: block; font-size: 19px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.num-grid__label { display: block; font-size: 12px; color: var(--color-text-muted); }
.hero-num { text-align: center; padding: 8px 0; }
.hero-num__value { font-size: 38px; font-weight: 700; letter-spacing: -.02em; color: var(--color-primary); line-height: 1.15; font-variant-numeric: tabular-nums; }
.hero-num__label { font-size: 12.5px; color: var(--color-text-muted); }
.list-plain { padding-left: 18px; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--color-text-muted); white-space: nowrap; min-width: 138px; font-size: 12.5px; }

/* ---------- Stat tiles ---------- */
.stat { padding: 12px 14px; }
.stat__label { font-size: 12.5px; color: var(--color-text-muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat__label svg { width: 15px; height: 15px; stroke: var(--color-primary); flex-shrink: 0; }
.stat__value { font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat__value--sm { font-size: 16px; letter-spacing: -.01em; }
.stat__meta { font-size: 12px; color: var(--color-text-muted); margin-top: 1px; }
.stat__period { margin-left: auto; font-size: 11px; color: var(--color-text-muted); font-weight: 500; }
a.stat { display: block; }
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: 12px; background: var(--white); box-shadow: var(--shadow-sm); }
.stat-strip > div { padding: 10px 14px; border-left: 1px solid var(--color-border); display: flex; flex-direction: column; gap: 1px; }
.stat-strip > div:first-child { border-left: 0; }
.stat-strip span { font-size: 12px; color: var(--color-text-muted); font-weight: 500; }
.stat-strip strong { font-size: 19px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat-strip strong small, .stat-strip > div > small { font-size: 12px; font-weight: 400; color: var(--color-text-muted); }
.stat-strip a { font-size: 12.5px; font-weight: 600; text-decoration: none; }
@media (max-width: 900px) { .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat-strip > div:nth-child(3) { border-left: 0; } .stat-strip > div:nth-child(n+3) { border-top: 1px solid var(--color-border); } }

/* ---------- Dashboard ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.quick-actions form { margin: 0; display: contents; }
.quick-action { position: relative; display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 7px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--white); color: var(--color-text); font: inherit; font-size: 13px; font-weight: 600; line-height: 1.25; text-align: left; text-decoration: none; cursor: pointer; width: 100%; transition: background .12s ease, border-color .12s ease; }
.quick-action svg { width: 16px; height: 16px; stroke: var(--color-primary); flex-shrink: 0; }
.quick-action:hover { background: var(--color-mint-hover); border-color: var(--color-mint-border); color: var(--color-primary); }
.quick-action__count { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--color-primary); background: var(--color-mint); border-radius: 999px; padding: 0 7px; line-height: 18px; }
.quick-action[aria-disabled="true"] { color: var(--color-text-disabled); background: var(--white); border-style: dashed; cursor: not-allowed; }
.quick-action[aria-disabled="true"] svg { stroke: var(--color-text-disabled); }
.quick-action__reason { display: block; font-size: 11px; font-weight: 400; color: var(--color-text-muted); }
@media (max-width: 1280px) { .quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 620px) { .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.pipeline-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.pipeline-strip li { min-width: 0; border-left: 1px solid var(--color-border); }
.pipeline-strip li:first-child { border-left: 0; }
.pipeline-step { display: block; padding: 2px 12px; text-decoration: none; color: inherit; border-radius: var(--radius-sm); }
.pipeline-strip li:first-child .pipeline-step { padding-left: 0; }
a.pipeline-step:hover { color: var(--color-primary); }
.pipeline-step__top { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.pipeline-step__detail { font-size: 12px; color: var(--color-text-muted); }
.pipeline-step__state { font-size: 11.5px; font-weight: 600; color: var(--color-text-secondary); }
@media (max-width: 1000px) { .pipeline-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 0; } .pipeline-strip li:nth-child(odd) { border-left: 0; } .pipeline-strip li:nth-child(odd) .pipeline-step { padding-left: 0; } }
@media (max-width: 520px) { .pipeline-strip { grid-template-columns: 1fr; } .pipeline-strip li { border-left: 0; } .pipeline-step { padding-left: 0; } }

.list-rows { list-style: none; margin: 0; padding: 0; }
.list-rows > li { border-bottom: 1px solid var(--color-border); }
.list-rows > li:last-child { border-bottom: 0; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; color: inherit; text-decoration: none; font-size: 13px; min-width: 0; }
a.list-row:hover { color: var(--color-primary); background: var(--color-mint-hover); }
.list-row__main { flex: 1; min-width: 0; }
.list-row__title { font-weight: 500; }
.list-row__sub { display: block; font-size: 12px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row__sub--wrap { white-space: normal; }
.list-row__count { font-weight: 600; font-variant-numeric: tabular-nums; }
.list-row__time { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; }

.setup-panel > summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.setup-panel > summary::-webkit-details-marker { display: none; }
.setup-panel > summary > svg { width: 16px; height: 16px; stroke: var(--color-text-muted); transform: rotate(180deg); transition: transform .12s ease; flex-shrink: 0; }
.setup-panel[open] .setup-panel > summary > svg { transform: rotate(270deg); }
.setup-panel__bar { flex: 0 1 180px; }
.setup-panel__body { margin-top: 12px; }

/* ---------- Setup stepper ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(var(--rows, 6), auto); grid-auto-flow: column; gap: 8px; }
.step { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--white); }
.step__num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12px; border: 1.5px solid var(--color-border-strong); color: var(--color-text-secondary); background: var(--white); }
.step__num svg { width: 14px; height: 14px; stroke: #fff; }
.step--done .step__num { background: var(--color-primary); border-color: var(--color-primary); }
.step--next { border-color: var(--color-mint-border); background: var(--color-mint-hover); }
.step--next .step__num { border-color: var(--color-primary); color: var(--color-primary); }
.step__title { font-weight: 600; font-size: 13px; }
.step__hint { font-size: 12px; color: var(--color-text-muted); }
.step--done .step__title { color: var(--color-text-secondary); }
.step__tag { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.step__tag--done { background: var(--color-mint); color: var(--color-primary); }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; } }

/* ---------- Action Center ---------- */
.task { display: flex; flex-direction: column; gap: 4px; margin-bottom: 0; }
.task__top { display: flex; justify-content: space-between; align-items: center; }
.task__icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--color-mint); }
.task__icon svg { width: 17px; height: 17px; stroke: var(--color-primary); }
.task__count { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.task__title { font-weight: 600; font-size: 13.5px; }
.task__desc { margin: 0; font-size: 12.5px; color: var(--color-text-muted); flex: 1; }
.task__cta { font-size: 12.5px; font-weight: 600; color: var(--color-primary); margin-top: 2px; }
.task--critical .task__count { color: var(--color-danger); }
.task--critical .task__icon { background: var(--color-danger-soft); }
.task--critical .task__icon svg { stroke: var(--color-danger); }
.task--warning .task__count { color: var(--color-warning); }
.task--warning .task__icon { background: var(--color-warning-soft); }
.task--warning .task__icon svg { stroke: var(--color-warning); }
.task--info .task__count { color: var(--color-info); }
.task--info .task__icon { background: var(--color-info-soft); }
.task--info .task__icon svg { stroke: var(--color-info); }
.task--good .task__count { color: var(--color-text-muted); }
.task--good .task__cta { color: var(--color-text-muted); }

/* ---------- Modal (native <dialog>) ---------- */
.modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--white); color: var(--color-text); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal[open] { display: flex; flex-direction: column; }
.modal--wide { width: min(880px, calc(100vw - 32px)); }
.modal--sm { width: min(420px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(16, 32, 30, .45); }
.modal__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--color-border); }
.modal__title { font-size: 15.5px; margin: 0; }
.modal__sub { font-size: 12.5px; color: var(--color-text-muted); margin: 1px 0 0; }
.modal__form { display: flex; flex-direction: column; min-height: 0; overflow: hidden; margin: 0; }
.modal__body { padding: 16px 18px; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--color-border); }
.send-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
@media (max-width: 760px) { .send-grid { grid-template-columns: 1fr; } }

/* ---------- WhatsApp preview ---------- */
.wa-preview { max-width: 340px; border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.wa-preview__bar { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--color-border); }
.wa-preview__avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--color-mint); color: var(--color-primary); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.wa-preview__name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.wa-preview__num { font-size: 11.5px; color: var(--color-text-muted); }
.wa-preview__chat { padding: 12px; min-height: 120px; }
.wa-preview__media { margin: -2px -2px 6px; border-radius: 6px; overflow: hidden; }
.wa-preview__media img { display: block; width: 100%; height: 130px; object-fit: cover; }
.wa-preview__media-note { font-size: 11.5px; color: var(--color-text-muted); padding: 8px; border: 1px dashed var(--color-border-strong); border-radius: 6px; margin-bottom: 6px; }
.wa-preview__header { font-weight: 600; margin-bottom: 3px; }
.wa-preview__body { white-space: pre-wrap; word-break: break-word; }
.wa-preview__footer { font-size: 11.5px; color: var(--color-text-muted); margin-top: 5px; }
.wa-preview__button { margin-top: 4px; padding: 6px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--color-primary); border: 1px solid var(--color-mint-border); border-radius: 6px; background: var(--white); }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: 330px minmax(0, 1fr) 290px; background: var(--white); height: calc(100vh - var(--topbar-height)); overflow: hidden; }
.inbox__list { border-right: 1px solid var(--color-border); overflow-y: auto; min-height: 0; }
.inbox__filters { padding: 10px 12px; border-bottom: 1px solid var(--color-border); display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; background: var(--white); z-index: 2; }
.inbox__pull { padding: 8px 12px; border-bottom: 1px solid var(--color-border); }
.inbox__item { display: block; padding: 10px 12px; border-bottom: 1px solid var(--color-border); text-decoration: none; color: inherit; }
.inbox__item:hover { background: var(--color-mint-hover); color: inherit; }
.inbox__item--active, .inbox__item--active:hover { background: var(--color-mint); box-shadow: inset 3px 0 0 var(--color-primary); }
.inbox__item-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 13.5px; }
.inbox__item-time { font-size: 12px; font-weight: 400; color: var(--color-text-muted); white-space: nowrap; }
.inbox__preview { color: var(--color-text-muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.inbox__badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.inbox__thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.inbox__thread-head { padding: 10px 16px; border-bottom: 1px solid var(--color-border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inbox__thread-head form { margin: 0; }
.inbox__back { display: none; }
.inbox__messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; background: var(--white); }
.inbox__context { border-left: 1px solid var(--color-border); padding: 14px; overflow-y: auto; min-height: 0; }
.inbox__context h4 { margin: 16px 0 4px; color: var(--color-text-muted); font-size: 12px; }
.inbox__pager { padding: 0 12px 10px; }
.context-event { font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid var(--color-border); }
.bubble { max-width: 72%; width: fit-content; padding: 7px 11px; border-radius: 12px; margin-bottom: 8px; font-size: 13.5px; overflow-wrap: anywhere; border: 1px solid var(--color-border); background: var(--white); }
.bubble--in { border-top-left-radius: 3px; }
.bubble--out { background: var(--color-mint); border-color: var(--color-mint-border); margin-left: auto; border-top-right-radius: 3px; }
.bubble--failed { background: var(--white); border-color: var(--color-danger-border); }
.bubble__meta { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; text-align: right; }
.bubble__error { color: var(--color-danger); text-align: left; font-size: 12px; margin-top: 3px; }
@media (max-width: 1240px) { .inbox { grid-template-columns: 290px minmax(0, 1fr); } .inbox__context { display: none; } }
@media (max-width: 760px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox--has-thread .inbox__list { display: none; }
  .inbox:not(.inbox--has-thread) .inbox__thread { display: none; }
  .inbox__back { display: inline-flex; }
  .bubble { max-width: 88%; }
}
.inbox-setup { margin: auto; max-width: 560px; padding: 24px; }
.inbox-setup h3 { font-size: 16px; margin: 0 0 4px; }
.inbox-setup__list { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 8px; }
.inbox-setup__list li { display: grid; grid-template-columns: 20px minmax(0, 1fr); column-gap: 8px; padding: 9px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--white); }
.inbox-setup__list li::before { content: ""; grid-row: span 2; width: 10px; height: 10px; border-radius: 50%; margin: 5px 0 0 4px; background: var(--color-border-strong); }
.inbox-setup__list li.is-ok::before { background: #1a9a5a; }
.inbox-setup__list li.is-bad { border-color: var(--color-danger-border); }
.inbox-setup__list li.is-bad::before { background: var(--color-danger); }
.inbox-setup__list li.is-warn::before { background: #d98a00; }
.inbox-setup__list li.is-info::before { background: var(--color-info); }
.inbox-setup__list strong { font-size: 13px; font-weight: 600; }
.inbox-setup__list span { font-size: 12.5px; color: var(--color-text-secondary); }

.composer { border-top: 1px solid var(--color-border); padding: 8px 16px 10px; background: var(--white); }
.composer__tabs { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.composer__tabs button { font: inherit; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--color-text-muted); cursor: pointer; }
.composer__tabs button:hover { color: var(--color-primary); }
.composer__tabs button[aria-selected="true"] { background: var(--color-mint); color: var(--color-primary); }
.composer__window { margin-left: auto; font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 99px; }
.composer__window.is-open { background: var(--color-mint); color: var(--color-primary); }
.composer__window.is-closed { background: var(--color-warning-soft); color: var(--color-warning); }
.composer__panel { display: none; gap: 8px; align-items: flex-end; margin: 0; }
.composer[data-tab="reply"] .composer__panel[data-panel="reply"], .composer[data-tab="template"] .composer__panel[data-panel="template"] { display: flex; }
.composer textarea { resize: none; min-height: 38px; max-height: 160px; }
.composer select { flex: 1; }
.composer__note { margin: 0; font-size: 13px; color: var(--color-text-secondary); border: 1px solid var(--color-warning-border); border-radius: var(--radius-sm); padding: 8px 10px; flex: 1; }
.composer__hint { margin: 4px 0 0; font-size: 11.5px; color: var(--color-text-muted); }

/* ---------- Data health ---------- */
.kpis { display: grid; grid-template-columns: 1.3fr repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpis .card { margin-bottom: 0; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; }
.kpi__label { font-size: 12.5px; font-weight: 500; color: var(--color-text-muted); display: flex; align-items: center; gap: 7px; }
.kpi__value { font-size: 24px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi__value small { font-size: 13px; font-weight: 500; color: var(--color-text-muted); margin-left: 2px; }
.kpi__meta { font-size: 12px; color: var(--color-text-muted); }
.kpi__row { display: flex; align-items: center; gap: 12px; }
.kpi--active { border-color: var(--color-primary); background: var(--color-mint-hover); }
.kpi--hero { background: var(--white); }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr; } }
.ring { --p: 0; --c: var(--color-primary); width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--color-border) 0); }
.ring span { width: 40px; height: 40px; border-radius: 50%; background: var(--white); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.ring--good { --c: #1a9a5a; }
.ring--warning { --c: #d98a00; }
.ring--critical { --c: var(--color-danger); }
.split { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 12px; align-items: start; }
.split > .card { margin-bottom: 0; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.issue { display: block; padding: 8px 10px; border-radius: var(--radius-sm); margin: 0 -10px; text-decoration: none; color: inherit; }
.issue:hover { background: var(--color-mint-hover); color: inherit; }
.issue--active { background: var(--color-mint); }
.issue__top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.issue__label { font-weight: 500; font-size: 13px; }
.issue__count { font-weight: 600; font-variant-numeric: tabular-nums; }
.issue__help { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.search .form-input { width: 220px; }
.score { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.score__num { font-weight: 600; width: 24px; font-variant-numeric: tabular-nums; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.card--flush .pagination { margin: 0; padding: 10px 18px; border-top: 1px solid var(--color-border); }
.pagination__info { font-size: 12.5px; color: var(--color-text-muted); }
.pagination__info strong { color: var(--color-text); font-weight: 600; }
.pagination__pages { display: flex; gap: 3px; flex-wrap: wrap; }
.page-btn { min-width: 30px; height: 30px; padding: 0 8px; display: inline-grid; place-items: center; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500; color: var(--color-text); text-decoration: none; background: var(--white); }
a.page-btn:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-mint-hover); }
.page-btn.is-current { background: var(--color-mint); border-color: var(--color-mint-border); color: var(--color-primary); font-weight: 600; }
.page-btn.is-disabled { color: var(--color-text-disabled); }
.page-btn.is-gap { border-color: transparent; }

/* ---------- Leads ---------- */
.howto { border: 1px solid var(--color-border); background: var(--white); border-radius: var(--radius); margin-bottom: 12px; padding: 10px 14px; }
.howto > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--color-primary); }
.howto__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.howto__item strong { font-size: 13px; font-weight: 600; }
.howto__item p { margin: 2px 0 6px; font-size: 12.5px; color: var(--color-text-secondary); }
@media (max-width: 1000px) { .howto__grid { grid-template-columns: 1fr; } }
.bulk-bar { position: sticky; top: calc(var(--topbar-height) + 8px); z-index: 20; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; background: var(--white); border: 1px solid var(--color-mint-border); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; box-shadow: var(--shadow-md); font-size: 13px; }
.bulk-bar[hidden] { display: none; }
.bulk-bar__count { font-weight: 600; background: var(--color-mint); color: var(--color-primary); padding: 2px 10px; border-radius: 99px; font-size: 12.5px; }
.bulk-bar select { min-width: 220px; max-width: 320px; }

/* ---------- Status rule follow-ups ---------- */
.followups { border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 10px 12px 12px; margin: 0 0 14px; }
.followups[hidden] { display: none; }
.followups legend { font-weight: 600; font-size: 13px; padding: 0 6px; }
.followups__timeline { position: relative; margin: 0 0 10px; padding-left: 14px; border-left: 2px solid var(--color-mint-border); }
.fu-row { position: relative; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 5px 0; }
.fu-row::before { content: ""; position: absolute; left: -20px; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--color-primary); transform: translateY(-50%); box-shadow: 0 0 0 3px var(--white); }
.fu-day { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.fu-day .form-input { width: 76px; }
.fu-row select { flex: 1; min-width: 200px; }
.plan { list-style: none; padding: 0 0 0 14px; margin: 8px 0; border-left: 2px solid var(--color-mint-border); }
.plan li { position: relative; display: flex; gap: 10px; padding: 5px 0; font-size: 13px; }
.plan li::before { content: ""; position: absolute; left: -20px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--color-primary); }
.plan__when { width: 90px; flex-shrink: 0; font-weight: 600; }

/* ---------- Auth ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); background: #ffffff; }
.login__panel { display: grid; place-items: center; padding: 40px 24px; background: #ffffff; }
.login__form { width: 100%; max-width: 400px; padding: 36px 36px; background: #ffffff; border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: 0 18px 48px rgba(0, 0, 0, .06); animation: login-rise .55s ease both; }
.login__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.login__form h1 { font-size: 24px; letter-spacing: -.02em; margin: 0 0 4px; color: var(--color-text); }
.login__form > p { color: var(--color-text-muted); margin: 0 0 24px; font-size: 14px; }
.login__form .form-input { min-height: 42px; }
.login__submit { min-height: 42px; font-size: 14px; transition: background .15s ease, box-shadow .15s ease, transform .15s ease; }
.login__submit:hover:not(.is-loading) { box-shadow: 0 8px 18px rgba(11, 95, 90, .24); transform: translateY(-1px); }
.login__form > .login__foot { font-size: 12.5px; margin: 20px 0 0; color: var(--color-text-muted); }
.login__about { position: relative; order: -1; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 56px 48px; background: linear-gradient(155deg, #0b4a45 0%, #073532 55%, #04211f 100%); color: #ffffff; }
.login__about::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1.5px); background-size: 22px 22px; -webkit-mask-image: radial-gradient(circle at center, #000 65%, transparent 100%); mask-image: radial-gradient(circle at center, #000 65%, transparent 100%); }
.login__blob { position: absolute; border-radius: 50%; filter: blur(55px); pointer-events: none; animation: login-drift 16s ease-in-out infinite alternate; }
.login__blob--mint { width: 380px; height: 380px; left: -80px; top: -80px; background: radial-gradient(circle, rgba(14, 124, 117, 0.45) 0%, transparent 70%); }
.login__blob--teal { width: 340px; height: 340px; right: -60px; top: 25%; background: radial-gradient(circle, rgba(0, 168, 157, 0.35) 0%, transparent 70%); animation-delay: -5s; }
.login__blob--cyan { width: 360px; height: 360px; left: 20%; bottom: -100px; background: radial-gradient(circle, rgba(45, 230, 205, 0.22) 0%, transparent 70%); animation-delay: -10s; }
.login__about-inner { position: relative; max-width: 560px; z-index: 2; }
.login__about h2 { font-size: 38px; line-height: 1.15; letter-spacing: -.03em; margin: 0 0 10px; color: #ffffff; animation: login-rise .55s ease both; }
.login__about p { font-size: 15.5px; color: rgba(255, 255, 255, 0.78); margin: 0 0 28px; animation: login-rise .55s ease .08s both; }
.login__features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.login__features li { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: var(--radius); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); animation: login-rise .55s ease both; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease; }
.login__features li:nth-child(1) { animation-delay: .14s; }
.login__features li:nth-child(2) { animation-delay: .2s; }
.login__features li:nth-child(3) { animation-delay: .26s; }
.login__features li:nth-child(4) { animation-delay: .32s; }
.login__features li:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.10); border-color: rgba(45, 230, 205, 0.4); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28); }
.login__about .icon-chip { width: 34px; height: 34px; border-radius: 9px; background: rgba(45, 230, 205, 0.15); border: 1px solid rgba(45, 230, 205, 0.3); display: inline-grid; place-items: center; }
.login__about .icon-chip svg { stroke: #2de6cd; width: 17px; height: 17px; }
.login__features strong { display: block; font-weight: 600; font-size: 14px; color: #ffffff; }
.login__features span:not(.icon-chip) { font-size: 12.5px; color: rgba(255, 255, 255, 0.72); line-height: 1.45; }
@keyframes login-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes login-drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(36px, 28px, 0) scale(1.12); } }
@media (max-width: 1100px) { .login__about { padding: 32px; } .login__about h2 { font-size: 30px; } .login__features { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .login { grid-template-columns: 1fr; } .login__about { display: none; } .login__panel { background: transparent; } }
.password-field { position: relative; }
.password-field .form-input { padding-right: 60px; }
.password-field button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--color-primary); cursor: pointer; padding: 4px 6px; }

/* ---------- Help & Guide ---------- */
.guide { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.guide__toc { position: sticky; top: calc(var(--topbar-height) + 16px); background: var(--white); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 10px; font-size: 13px; }
.guide__toc a { display: block; padding: 5px 8px; border-radius: var(--radius-sm); color: var(--color-text-secondary); text-decoration: none; }
.guide__toc a:hover { background: var(--color-mint-hover); color: var(--color-primary); }
.guide__toc strong { display: block; padding: 4px 8px 6px; font-size: 12px; font-weight: 600; color: var(--color-text-muted); }
.guide section { scroll-margin-top: calc(var(--topbar-height) + 16px); }
.guide h2 { font-size: 18px; margin: 0 0 6px; }
.guide h3 { margin-top: 16px; }
.guide p, .guide li { color: var(--color-text-secondary); }
.guide ol, .guide ul { padding-left: 20px; }
.guide li { margin-bottom: 5px; }
.guide__hero p { margin: 0; }
.code { position: relative; background: var(--white); color: var(--color-text); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 10px 12px; padding-right: 70px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-all; margin: 8px 0 12px; }
.code button { position: absolute; top: 7px; right: 7px; font-family: var(--font); font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 5px; border: 1px solid var(--color-border-strong); background: var(--white); color: var(--color-primary); cursor: pointer; }
.section-card { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.section-card:last-child { border-bottom: 0; }
.section-card__icon { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--color-mint); display: grid; place-items: center; }
.section-card__icon svg { width: 18px; height: 18px; stroke: var(--color-primary); }
.section-card h3 { margin: 0 0 2px; font-size: 14px; }
.section-card p { margin: 0 0 4px; font-size: 13px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.flow span { background: var(--color-mint); color: var(--color-primary); font-weight: 600; font-size: 12.5px; padding: 5px 9px; border-radius: var(--radius-sm); }
.flow em { color: var(--color-text-muted); font-style: normal; }
.guide .card { overflow-wrap: anywhere; }
.health-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--color-border); flex-wrap: wrap; }
.download-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.download-card__icon { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--color-mint); display: grid; place-items: center; flex-shrink: 0; }
.download-card__icon svg { width: 20px; height: 20px; stroke: var(--color-primary); }
@media (max-width: 960px) { .guide { grid-template-columns: 1fr; } .guide__toc { position: static; } }

/* ---------- Dashboard colour ---------- */
.tone--teal { --tone: #0b5f5a; --tone-soft: #e6f6f1; --tone-line: #b5e3d4; }
.tone--blue { --tone: #175cd3; --tone-soft: #eaf2fe; --tone-line: #c3d9fb; }
.tone--violet { --tone: #5b3fc4; --tone-soft: #f0edfd; --tone-line: #d6cdf8; }
.tone--coral { --tone: #b3471c; --tone-soft: #fff0e8; --tone-line: #fad3c0; }
.tone--amber { --tone: #8a5a00; --tone-soft: #fff6dc; --tone-line: #f5e0a6; }
.tone--rose { --tone: #b4366b; --tone-soft: #fdeef4; --tone-line: #f7cfdf; }
.icon-chip { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--tone-soft); flex-shrink: 0; }
.icon-chip svg { width: 18px; height: 18px; stroke: var(--tone); }
.icon-chip--sm { width: 26px; height: 26px; border-radius: 8px; }
.icon-chip--sm svg { width: 15px; height: 15px; }
.dash-tile { display: block; padding: 14px 16px; border-color: var(--tone-line); background: linear-gradient(140deg, var(--tone-soft) 0%, var(--white) 72%); }
a.dash-tile:hover { border-color: var(--tone); box-shadow: var(--shadow-md); }
.dash-tile .icon-chip { background: var(--white); box-shadow: 0 0 0 1px var(--tone-line); }
.dash-tile__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dash-tile__scope { font-size: 11px; font-weight: 600; color: var(--tone); }
.dash-tile__value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.dash-tile__label { font-size: 13px; font-weight: 600; color: var(--color-text-secondary); margin-top: 2px; }
.dash-title { display: flex; align-items: center; gap: 8px; }
.dash .card__hint { margin-left: 34px; }
.dash .quick-action { padding-left: 8px; }
.dash .quick-action:not([aria-disabled="true"]):hover { background: var(--tone-soft); border-color: var(--tone-line); color: var(--color-text); }
.quick-action[aria-disabled="true"] .icon-chip { background: transparent; }
.dash .progress > span { background: linear-gradient(90deg, var(--color-primary), #1baf7a); }
.list-rows--soft > li { border-bottom: 0; margin-bottom: 6px; }
.list-rows--soft > li:last-child { margin-bottom: 0; }
.list-rows--soft .list-row { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--color-mint-hover); }
.list-rows--soft a.list-row:hover { color: inherit; box-shadow: inset 0 0 0 1px var(--color-border-strong); }
.list-rows--soft .soft-row--critical { background: var(--color-danger-soft); }
.list-rows--soft .soft-row--warning { background: var(--color-warning-soft); }
.list-rows--soft .soft-row--info { background: var(--color-info-soft); }
.dash-health { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: 12px; }
.dash-health > .card { margin-bottom: 0; }
.dash-health__side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dash-health__side > .card { margin-bottom: 0; flex: 1; }
.dash-health .list-rows--soft { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.dash-health .list-rows--soft > li { margin-bottom: 0; min-width: 0; }
.dash-health .list-rows--soft .list-row { height: 100%; }
@media (max-width: 1100px) { .dash-health { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .dash-health .list-rows--soft { grid-template-columns: 1fr; } }
.dash-count { color: #8a5a00; background: #fff6dc; border-radius: 999px; padding: 1px 9px; font-size: 12.5px; }
.dash .pipeline-strip { gap: 8px; }
.dash .pipeline-strip li { border-left: 0; }
.dash .pipeline-step, .dash .pipeline-strip li:first-child .pipeline-step { height: 100%; padding: 10px 12px; background: var(--color-mint-hover); border: 1px solid var(--color-border); }
.dash .pipeline-step--ok { background: var(--color-success-soft); border-color: var(--color-success-border); }
.dash .pipeline-step--warn { background: var(--color-warning-soft); border-color: var(--color-warning-border); }
.dash .pipeline-step--off { background: #f6f8f8; }
.dash .pipeline-step__detail { color: var(--color-text-secondary); }

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