/* ═══════════════════════════════════════════════════════════════════════
   SoftmedSys Hub — public/css/hub.css
   Tema claro/escuro: <html data-theme="light|dark">; sem atributo segue o sistema.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    --bg: #f3f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #eef2f8;
    --line: #e3e8f0;
    --line-2: #eef1f6;
    --ink: #0f172a;
    --ink-2: #475569;
    --ink-3: #64748b;
    --ink-4: #94a3b8;
    --brand: #0061f7;
    --brand-2: #0052d1;
    --brand-soft: #eaf1ff;
    --brand-ink: #ffffff;
    --ok: #047857;     --ok-soft: #dcfce7;
    --warn: #b45309;   --warn-soft: #fff4dc;
    --bad: #c81e1e;    --bad-soft: #fde8e8;
    --info: #0369a1;   --info-soft: #e0f2fe;
    --violet: #6d28d9; --violet-soft: #ede9fe;
    --muted-soft: #eef1f6;
    --focus: 0 0 0 3px rgba(0, 97, 247, .18);
    --shadow-1: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px rgba(15, 23, 42, .05);
    --shadow-2: 0 10px 40px rgba(15, 23, 42, .18);
    --side-bg: #0b1730;
    --side-ink: #c7d2e6;
    --side-ink-2: #7f8db0;
    --side-hover: rgba(255, 255, 255, .06);
    --side-active: rgba(77, 141, 255, .16);
    --side-w: 252px;
    --r-lg: 18px;
    --r-md: 12px;
    --r-sm: 9px;
    --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-head: Manrope, Inter, ui-sans-serif, system-ui, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0a1120; --surface: #111a2c; --surface-2: #0e1627; --surface-3: #18233a;
        --line: #1f2b45; --line-2: #19243b;
        --ink: #e6ecf6; --ink-2: #aab5c9; --ink-3: #7f8ca5; --ink-4: #5b6782;
        --brand: #4d8dff; --brand-2: #6aa0ff; --brand-soft: rgba(77, 141, 255, .14); --brand-ink: #06122b;
        --ok: #34d399; --ok-soft: rgba(52, 211, 153, .12);
        --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12);
        --bad: #f87171; --bad-soft: rgba(248, 113, 113, .13);
        --info: #38bdf8; --info-soft: rgba(56, 189, 248, .12);
        --violet: #a78bfa; --violet-soft: rgba(167, 139, 250, .14);
        --muted-soft: #1a2540;
        --focus: 0 0 0 3px rgba(77, 141, 255, .28);
        --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .22);
        --shadow-2: 0 18px 50px rgba(0, 0, 0, .55);
        --side-bg: #070d1a; --side-hover: rgba(255, 255, 255, .05);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0a1120; --surface: #111a2c; --surface-2: #0e1627; --surface-3: #18233a;
    --line: #1f2b45; --line-2: #19243b;
    --ink: #e6ecf6; --ink-2: #aab5c9; --ink-3: #7f8ca5; --ink-4: #5b6782;
    --brand: #4d8dff; --brand-2: #6aa0ff; --brand-soft: rgba(77, 141, 255, .14); --brand-ink: #06122b;
    --ok: #34d399; --ok-soft: rgba(52, 211, 153, .12);
    --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12);
    --bad: #f87171; --bad-soft: rgba(248, 113, 113, .13);
    --info: #38bdf8; --info-soft: rgba(56, 189, 248, .12);
    --violet: #a78bfa; --violet-soft: rgba(167, 139, 250, .14);
    --muted-soft: #1a2540;
    --focus: 0 0 0 3px rgba(77, 141, 255, .28);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .22);
    --shadow-2: 0 18px 50px rgba(0, 0, 0, .55);
    --side-bg: #070d1a; --side-hover: rgba(255, 255, 255, .05);
    color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body.hb { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
:where(.hb) a { color: var(--brand); text-decoration: none; }
:where(.hb) a:not([class*="hb-"]):hover { text-decoration: underline; }
a.hb-kpi { color: inherit; }
.hb h1, .hb h2, .hb h3 { font-family: var(--font-head); color: var(--ink); margin: 0; letter-spacing: -.01em; }
.hb h1 { font-size: 24px; font-weight: 800; }
.hb h2 { font-size: 16px; font-weight: 750; }
.hb h3 { font-size: 14px; font-weight: 700; }
.hb .ph { line-height: 1; }
.hb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hb-muted { color: var(--ink-3); }
.hb-sub { color: var(--ink-3); font-size: 12.5px; }
.hb-num { font-variant-numeric: tabular-nums; }
.hb-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }

/* ── Estrutura ────────────────────────────────────────────────────────── */
.hb-shell { display: flex; min-height: 100vh; }
.hb-side {
    position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side-bg); color: var(--side-ink);
    display: flex; flex-direction: column; z-index: 40; transition: transform .25s ease;
}
.hb-brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; color: #fff; }
.hb-brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; color: #fff;
    background: linear-gradient(135deg, #2f7bff, #0047c2); box-shadow: 0 6px 16px rgba(0, 97, 247, .35); }
.hb-brand b { font-family: var(--font-head); font-weight: 800; font-size: 15px; letter-spacing: -.01em; display: block; }
.hb-brand small { color: var(--side-ink-2); font-size: 11.5px; }
.hb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.hb-nav-sec { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--side-ink-2); padding: 16px 10px 6px; }
.hb-nav a, .hb-nav span.hb-nav-item {
    display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--side-ink);
    font-weight: 550; font-size: 13.5px; text-decoration: none !important; position: relative;
}
.hb-nav a .ph, .hb-nav span.hb-nav-item .ph { font-size: 19px; opacity: .85; }
.hb-nav a:hover { background: var(--side-hover); color: #fff; }
.hb-nav a.is-active { background: var(--side-active); color: #fff; }
.hb-nav a.is-active::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #4d8dff; }
.hb-nav a.is-active .ph { opacity: 1; color: #8fb6ff; }
.hb-nav span.hb-nav-item { opacity: .5; cursor: default; }
.hb-nav-count { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: #fff; }
.hb-nav-count.is-warn { background: #f59e0b; color: #1f1300; }
.hb-soon { margin-left: auto; white-space: nowrap; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); color: var(--side-ink-2); }
.hb-side-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .06); }
.hb-me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; color: var(--side-ink); }
.hb-me b { display: block; color: #fff; font-size: 13px; font-weight: 650; }
.hb-me small { color: var(--side-ink-2); font-size: 11.5px; }
.hb-me a { margin-left: auto; color: var(--side-ink-2); font-size: 18px; }
.hb-me a:hover { color: #fff; text-decoration: none; }

.hb-main { flex: 1; min-width: 0; margin-left: var(--side-w); display: flex; flex-direction: column; }
.hb-top {
    position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 28px;
    background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--line-2);
}
.hb-crumbs { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; min-width: 0; }
.hb-crumbs a { color: var(--ink-3); }
.hb-crumbs b { color: var(--ink); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-top-search { margin-left: auto; position: relative; width: min(360px, 40vw); }
.hb-top-search .ph { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-4); font-size: 17px; }
.hb-top-search input { width: 100%; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface);
    color: var(--ink); padding: 0 12px 0 38px; font: inherit; }
.hb-top-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 11px var(--font); color: var(--ink-4);
    border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; background: var(--surface-2); }
.hb-content { padding: 26px 28px 48px; width: 100%; max-width: 1440px; }
.hb-iconbtn.hb-menu-btn { display: none; }

/* ── Botões ───────────────────────────────────────────────────────────── */
.hb-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 13.5px var(--font); cursor: pointer;
    text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.hb-btn .ph { font-size: 17px; }
.hb-btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--line) 60%, var(--ink-4)); }
.hb-btn:active { transform: translateY(1px); }
.hb-btn[disabled] { opacity: .55; pointer-events: none; }
.hb-btn--primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 60%, transparent); }
.hb-btn--primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.hb-btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.hb-btn--ghost:hover { background: var(--surface-3); border-color: transparent; }
.hb-btn--danger { color: var(--bad); }
.hb-btn--danger:hover { background: var(--bad-soft); border-color: transparent; }
.hb-btn--danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.hb-btn--sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.hb-btn--icon { width: 38px; padding: 0; }
.hb-btn--icon.hb-btn--sm { width: 32px; }
.hb-iconbtn { width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
    display: grid; place-items: center; font-size: 19px; cursor: pointer; }
.hb-iconbtn:hover { color: var(--ink); background: var(--surface-2); }
.hb-spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: hb-spin .7s linear infinite; display: inline-block; }
@keyframes hb-spin { to { transform: rotate(360deg); } }

/* ── Cabeçalho de página ──────────────────────────────────────────────── */
.hb-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.hb-page-head p { margin: 4px 0 0; color: var(--ink-3); }
.hb-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Cartões e grelhas ────────────────────────────────────────────────── */
.hb-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.hb-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px 0; }
.hb-card-head h2 { display: flex; align-items: center; gap: 9px; }
.hb-card-head h2 .ph { font-size: 19px; color: var(--ink-3); }
.hb-card-body { padding: 16px 20px 20px; }
.hb-card-foot { padding: 12px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; }
.hb-grid { display: grid; gap: 18px; }
.hb-grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.hb-grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.hb-stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* KPIs */
.hb-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.hb-kpi { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 15px 16px; box-shadow: var(--shadow-1);
    display: flex; flex-direction: column; gap: 8px; text-decoration: none !important; color: inherit; position: relative; overflow: hidden; }
a.hb-kpi:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.hb-kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
.hb-kpi-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; }
.hb-kpi b { font-family: var(--font-head); font-size: 25px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); line-height: 1.1; }
.hb-kpi small { color: var(--ink-3); font-size: 12px; }
.tone-brand  { background: var(--brand-soft);  color: var(--brand); }
.tone-ok     { background: var(--ok-soft);     color: var(--ok); }
.tone-warn   { background: var(--warn-soft);   color: var(--warn); }
.tone-bad    { background: var(--bad-soft);    color: var(--bad); }
.tone-info   { background: var(--info-soft);   color: var(--info); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-muted  { background: var(--muted-soft);  color: var(--ink-3); }

/* ── Distintivos ──────────────────────────────────────────────────────── */
.hb-badge { display: inline-flex; align-items: center; gap: 6px; height: 23px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.hb-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.hb-badge.no-dot::before { display: none; }
.hb-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--ink-4); }
.hb-dot.is-ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.hb-dot.is-warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.hb-dot.is-bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

/* ── Avatar ───────────────────────────────────────────────────────────── */
.hb-avatar { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font: 800 13px var(--font-head); flex: none;
    color: #fff; background: linear-gradient(135deg, var(--a1, #3b82f6), var(--a2, #1d4ed8)); letter-spacing: .02em; }
.hb-avatar--lg { width: 58px; height: 58px; border-radius: 16px; font-size: 19px; }
.hb-avatar--sm { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; }

/* ── Tabelas ──────────────────────────────────────────────────────────── */
.hb-table-wrap { overflow-x: auto; }
.hb-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.hb-table th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em;
    padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.hb-table th:first-child { border-top-left-radius: 12px; } .hb-table th:last-child { border-top-right-radius: 12px; }
.hb-table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.hb-table tbody tr { transition: background .12s; }
.hb-table tbody tr:hover { background: var(--surface-2); }
.hb-table tbody tr:last-child td { border-bottom: 0; }
.hb-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hb-table tr[data-href] { cursor: pointer; }
.hb-cell-client { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.hb-cell-client b { display: block; font-weight: 650; color: var(--ink); }
.hb-mods { display: flex; gap: 4px; flex-wrap: wrap; }
.hb-mod-pill { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 15px;
    background: color-mix(in srgb, var(--c, #0061f7) 14%, transparent); color: var(--c, #0061f7); }

/* ── Filtros ──────────────────────────────────────────────────────────── */
.hb-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; }
.hb-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.hb-chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink-2); font: 600 12.5px var(--font); cursor: pointer; text-decoration: none !important; }
.hb-chip span { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--ink-3); }
.hb-chip:hover { border-color: var(--ink-4); color: var(--ink); }
.hb-chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.hb-chip.is-on span { background: color-mix(in srgb, var(--surface) 20%, transparent); color: var(--surface); }
.hb-search { position: relative; min-width: 260px; }
.hb-search .ph { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-4); font-size: 16px; }
.hb-search input { padding-left: 34px !important; }

/* ── Formulários ──────────────────────────────────────────────────────── */
.hb-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hb-label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.hb-label em { color: var(--bad); font-style: normal; }
.hb-input, .hb-select, .hb-textarea {
    width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    padding: 0 12px; font: inherit; transition: border-color .15s, box-shadow .15s;
}
.hb-textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.hb-input:focus, .hb-select:focus, .hb-textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.hb-input[readonly] { background: var(--surface-2); color: var(--ink-3); }
.hb-hint { font-size: 12px; color: var(--ink-3); }
.hb-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.hb-form-grid .is-full { grid-column: 1 / -1; }
.hb-form-sec { font: 700 11.5px var(--font); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); grid-column: 1 / -1;
    padding-top: 6px; display: flex; align-items: center; gap: 10px; }
.hb-form-sec::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.hb-inline-url { display: flex; align-items: stretch; }
.hb-inline-url .hb-input { border-radius: 10px 0 0 10px; }
.hb-inline-url span { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-left: 0; border-radius: 0 10px 10px 0;
    background: var(--surface-2); color: var(--ink-3); font-size: 13px; white-space: nowrap; }

/* Interruptor */
.hb-switch { position: relative; display: inline-flex; width: 42px; height: 24px; flex: none; cursor: pointer; }
.hb-switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hb-switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); transition: background .18s, border-color .18s; }
.hb-switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .25); transition: transform .18s; }
.hb-switch input:checked + i { background: var(--brand); border-color: var(--brand); }
.hb-switch input:checked + i::after { transform: translateX(18px); }
.hb-switch input:disabled + i { opacity: .55; cursor: not-allowed; }
.hb-switch input:focus-visible + i { box-shadow: var(--focus); }

/* ── Separadores ──────────────────────────────────────────────────────── */
.hb-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 4px 0 20px; overflow-x: auto; }
.hb-tab { display: inline-flex; align-items: center; gap: 8px; padding: 11px 14px; border: 0; background: transparent; color: var(--ink-3);
    font: 650 13.5px var(--font); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.hb-tab .ph { font-size: 17px; }
.hb-tab:hover { color: var(--ink); }
.hb-tab.is-on { color: var(--brand); border-bottom-color: var(--brand); }
.hb-tab .hb-nav-count { background: var(--surface-3); color: var(--ink-2); }
.hb-pane[hidden] { display: none !important; }

/* ── Ficha do cliente ─────────────────────────────────────────────────── */
.hb-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 20px; }
.hb-hero-main { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.hb-hero-main h1 { font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hb-hero-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-3); font-size: 13px; }
.hb-hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hb-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 18px; font-size: 13.5px; }
.hb-kv dt { color: var(--ink-3); }
.hb-kv dd { margin: 0; font-weight: 600; color: var(--ink); text-align: right; min-width: 0; overflow-wrap: anywhere; }
.hb-progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.hb-progress span { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width .4s ease; }
.hb-progress.is-warn span { background: var(--warn); }
.hb-progress.is-bad span { background: var(--bad); }

.hb-modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.hb-module { border: 1px solid var(--line-2); border-radius: 16px; padding: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 12px;
    transition: border-color .15s, box-shadow .15s; box-shadow: var(--shadow-1); }
.hb-module.is-on { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 25%, transparent), var(--shadow-1); }
.hb-module-top { display: flex; align-items: flex-start; gap: 12px; }
.hb-module-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; flex: none;
    background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); }
.hb-module-top div { flex: 1; min-width: 0; }
.hb-module-top b { display: block; font-weight: 700; }
.hb-module-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); margin-top: auto; flex-wrap: wrap; }

.hb-rows { display: flex; flex-direction: column; }
.hb-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line-2); }
.hb-row:first-child { border-top: 0; padding-top: 2px; }
.hb-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hb-row-main b { font-weight: 650; }
.hb-limit { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line-2); }
.hb-limit:first-child { border-top: 0; padding-top: 2px; }
.hb-limit-ctl { display: flex; align-items: center; gap: 8px; }
.hb-limit-ctl .hb-input { height: 36px; text-align: right; }
.hb-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.hb-check input { accent-color: var(--brand); width: 15px; height: 15px; }

.hb-secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; padding: 14px; border-radius: 12px; word-break: break-all;
    background: #0b1730; color: #dbe7ff; border: 1px solid #1d2c4d; line-height: 1.6; white-space: pre-wrap; }
.hb-steps { margin: 0; padding-left: 18px; color: var(--ink-2); display: flex; flex-direction: column; gap: 6px; }

.hb-timeline { display: flex; flex-direction: column; }
.hb-tl { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line-2); align-items: start; }
.hb-tl:first-child { border-top: 0; }
.hb-tl-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; }
.hb-tl time { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

/* ── Listas compactas (painel) ────────────────────────────────────────── */
.hb-list { display: flex; flex-direction: column; }
.hb-li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line-2); text-decoration: none !important; color: inherit; }
.hb-li:first-child { border-top: 0; }
a.hb-li:hover b { color: var(--brand); }
.hb-li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hb-li-main b { font-weight: 650; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-days { font: 800 12px var(--font); padding: 4px 9px; border-radius: 8px; white-space: nowrap; }

.hb-empty { padding: 28px 16px; text-align: center; color: var(--ink-3); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hb-empty .ph { font-size: 30px; color: var(--ink-4); }
.hb-notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13px; align-items: flex-start; }
.hb-notice .ph { font-size: 18px; flex: none; margin-top: 1px; }

.hb-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line-2); color: var(--ink-3); font-size: 13px; }

/* ── Equipa: perfis e permissões ──────────────────────────────────────── */
.hb-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.hb-role { display: flex; flex-direction: column; }
.hb-role.is-system { border-color: color-mix(in srgb, #7c3aed 35%, var(--line-2)); }
.hb-role-top { display: flex; gap: 12px; align-items: flex-start; padding: 18px 20px 10px; }
.hb-role-top b { display: block; font-weight: 700; font-size: 15px; }
.hb-role-meta { display: flex; gap: 16px; flex-wrap: wrap; padding: 0 20px 12px; font-size: 12.5px; color: var(--ink-3); }
.hb-role-meta span { display: inline-flex; align-items: center; gap: 5px; }
.hb-role-perms { display: flex; flex-direction: column; gap: 10px; padding: 12px 20px 16px; border-top: 1px solid var(--line-2); }
.hb-role-group { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.hb-role-glabel { font-size: 12px; font-weight: 650; color: var(--ink-2); display: inline-flex; gap: 5px; align-items: center; }
.hb-role-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.hb-tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); }
.hb-role .hb-card-foot { margin-top: auto; justify-content: flex-end; }
.hb-perm-group { margin-top: 18px; border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; }
.hb-perm-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line-2); }
.hb-perm-head b { display: inline-flex; gap: 7px; align-items: center; }
.hb-perm { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 14px; border-top: 1px solid var(--line-2); cursor: pointer; }
.hb-perm:first-of-type { border-top: 0; }
.hb-perm:hover { background: var(--surface-2); }
.hb-perm input { accent-color: var(--brand); width: 16px; height: 16px; }
.hb-perm span b { display: block; font-weight: 600; font-size: 13.5px; }
.hb-perm span small { color: var(--ink-3); font-size: 12px; }
.hb-perm code { font-size: 11px; color: var(--ink-4); }
.hb-perm.is-locked { opacity: .5; cursor: not-allowed; }
.hb-pw-rules { list-style: none; margin: 14px 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-3); }
.hb-pw-rules li { display: inline-flex; align-items: center; gap: 5px; }
.hb-pw-rules li.is-ok { color: var(--ok); }

/* ── Orçamentos ───────────────────────────────────────────────────────── */
.hb-quote-grid { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }
.hb-lines { table-layout: fixed; min-width: 620px; }
.hb-lines td, .hb-lines th { padding-left: 8px; padding-right: 8px; }
.hb-sticky { position: sticky; top: 84px; }
.hb-steps-bar { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); }
.hb-fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.hb-seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); gap: 2px; flex-wrap: wrap; }
.hb-seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font: 600 13px var(--font); color: var(--ink-3); cursor: pointer; }
.hb-seg button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.hb-seg--in { border-radius: 0 10px 10px 0; border: 1px solid var(--line); border-left: 0; background: var(--surface-2); flex-wrap: nowrap; align-items: center; flex: none; }
.hb-seg--in button { padding: 6px 10px; }
.hb-mod-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.hb-mod-picks--sm { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.hb-mod-pick { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.hb-mod-pick input { accent-color: var(--brand); width: 16px; height: 16px; flex: none; }
.hb-mod-pick .hb-module-ico { width: 32px; height: 32px; font-size: 17px; border-radius: 9px; }
.hb-mod-pick b { display: block; font-size: 13px; font-weight: 650; }
.hb-mod-pick small { display: block; font-size: 11.5px; color: var(--ink-3); }
.hb-mod-pick.is-on { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); background: color-mix(in srgb, var(--c) 6%, var(--surface)); }
.hb-mod-pick.is-main { opacity: .8; cursor: default; border-style: dashed; }
.hb-lines td { vertical-align: top; }
.hb-cell-in { width: 100%; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 6px 8px; font: 500 13.5px var(--font); color: var(--ink); }
.hb-cell-in:hover:not(:disabled) { border-color: var(--line); }
.hb-cell-in:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: var(--focus); }
.hb-cell-in.num { text-align: right; font-variant-numeric: tabular-nums; }
.hb-cell-sub { font-size: 12px; color: var(--ink-3); padding-top: 2px; }
.hb-cell-in:disabled { color: var(--ink); }
.hb-linkbtn { border: 0; background: none; color: var(--brand); font: 600 12.5px var(--font); padding: 6px 0 0; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; }
.hb-tax { width: 64px; height: 28px; padding: 0 6px; display: inline-block; text-align: right; }
.hb-sum dd { font-variant-numeric: tabular-nums; }
.hb-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: var(--brand); color: #fff; }
.hb-total span { font-weight: 600; } .hb-total small { opacity: .8; font-weight: 500; }
.hb-total b { font: 800 20px var(--font-display, var(--font)); font-variant-numeric: tabular-nums; }

/* ── Produtos e planos ────────────────────────────────────────────────── */
.hb-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.hb-plan { border: 1px solid var(--line-2); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.hb-plan.is-popular { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 25%, transparent); }
.hb-plan.is-off { opacity: .6; }
.hb-plan-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hb-plan-top b { font-size: 15px; }
.hb-plan-price b { font: 800 22px var(--font-display, var(--font)); }
.hb-plan-price small { color: var(--ink-3); margin-left: 4px; }
.hb-plan-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; flex: 1; }
.hb-plan-list li { display: flex; gap: 7px; align-items: center; }
.hb-plan-list li .ph { color: var(--ok); }
.hb-plan-list li.is-no { color: var(--ink-4); } .hb-plan-list li.is-no .ph { color: var(--ink-4); }
.hb-plan .hb-btn { align-self: flex-start; }
.hb-contract-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.hb-contract-row b { white-space: nowrap; }
.hb-contract-row small { display: block; color: var(--ink-3); font-size: 12px; }

/* ── Diálogos ─────────────────────────────────────────────────────────── */
dialog.hb-dialog { border: 0; padding: 0; border-radius: 20px; width: min(620px, calc(100vw - 28px)); max-height: calc(100vh - 40px);
    background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); }
dialog.hb-dialog > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
dialog.hb-dialog--lg { width: min(780px, calc(100vw - 28px)); }
dialog.hb-dialog--sm { width: min(440px, calc(100vw - 28px)); }
dialog.hb-dialog::backdrop { background: rgba(6, 12, 26, .55); backdrop-filter: blur(3px); }
dialog.hb-dialog[open] { animation: hb-pop .18s ease-out; display: flex; flex-direction: column; }
@keyframes hb-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.hb-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 6px; }
.hb-dialog-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 13px; }
.hb-dialog-body { padding: 14px 22px 18px; overflow-y: auto; }
.hb-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 20px 20px; }

/* ── Avisos (toast) ───────────────────────────────────────────────────── */
.hb-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.hb-toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 12px;
    background: var(--ink); color: var(--surface); box-shadow: var(--shadow-2); font-size: 13.5px; animation: hb-pop .2s ease-out; }
.hb-toast .ph { font-size: 19px; }
.hb-toast.is-ok .ph { color: #34d399; } .hb-toast.is-bad .ph { color: #f87171; }

/* ── Entrada ──────────────────────────────────────────────────────────── */
.hb-auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.hb-auth-art { position: relative; overflow: hidden; color: #fff; padding: 44px; display: flex; flex-direction: column; justify-content: space-between;
    background: radial-gradient(1200px 600px at -10% -10%, #2f7bff 0%, transparent 55%), radial-gradient(900px 500px at 120% 110%, #7c3aed 0%, transparent 55%), #071331; }
.hb-auth-art::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
    background-size: 44px 44px; mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%); pointer-events: none; }
.hb-auth-art > * { position: relative; z-index: 1; }
.hb-auth-art h1 { color: #fff; font-size: 36px; line-height: 1.12; max-width: 460px; }
.hb-auth-art p { color: #b8c6e6; max-width: 440px; font-size: 15px; }
.hb-auth-points { display: grid; gap: 12px; margin-top: 26px; }
.hb-auth-points div { display: flex; gap: 12px; align-items: center; color: #dbe5fb; }
.hb-auth-points .ph { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.08); font-size: 18px; }
.hb-auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.hb-auth-box { width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; }
.hb-auth-box h2 { font-size: 24px; }

/* ── Ecrãs pequenos ───────────────────────────────────────────────────── */
@media (max-width: 1280px) { .hb-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .hb-perm code { display: none; } .hb-role-group { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1100px) { .hb-grid-main, .hb-grid-2, .hb-quote-grid { grid-template-columns: minmax(0, 1fr); } .hb-sticky { position: static; } }
@media (max-width: 1024px) {
    .hb-side { transform: translateX(-100%); box-shadow: var(--shadow-2); }
    .hb-shell.is-nav-open .hb-side { transform: none; }
    .hb-shell.is-nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(6, 12, 26, .45); z-index: 35; }
    .hb-main { margin-left: 0; }
    .hb-iconbtn.hb-menu-btn { display: grid; }
    .hb-top, .hb-content { padding-left: 16px; padding-right: 16px; }
    .hb-top-search kbd { display: none; }
}
@media (max-width: 720px) {
    .hb-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hb-form-grid { grid-template-columns: minmax(0, 1fr); }
    .hb-limit { grid-template-columns: minmax(0, 1fr); }
    .hb-top-search { display: none; }
    .hb-auth { grid-template-columns: minmax(0, 1fr); }
    .hb-auth-art { display: none; }
    .hb-search { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Definições — meios de pagamento Vendus */
.hb-pay-methods { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; min-height: 42px; align-items: center; }
