/* Module-level UX refinements. Loaded after the global skin so each surface can evolve safely. */
:where(button, a, input, select, textarea) { -webkit-tap-highlight-color: transparent; }
:where(button, a) { touch-action: manipulation; }
:where(h1, h2, h3) { text-wrap: balance; }

.skip-link {
    position: fixed; left: 16px; top: 12px; z-index: 100;
    transform: translateY(-160%); padding: 10px 14px; border-radius: 10px;
    background: var(--ink-900); color: #fff; font-weight: 700; text-decoration: none;
    box-shadow: var(--sh-md); transition: transform var(--ease);
}
.skip-link:focus-visible { transform: translateY(0); outline: 3px solid var(--lime); outline-offset: 3px; }
.main-content:focus { outline: 2px solid var(--lime); outline-offset: 4px; }

.module-shell { display: grid; gap: 20px; }
.module-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.module-toolbar > :first-child { min-width: 0; }
.module-toolbar .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.field input:invalid:not(:placeholder-shown),
.field select:invalid,
.field textarea:invalid:not(:placeholder-shown) {
    border-color: color-mix(in srgb, var(--red) 65%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 12%, transparent);
}
.field input:focus-visible:invalid,
.field select:focus-visible:invalid,
.field textarea:focus-visible:invalid { box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }

.empty-state { min-height: 180px; display: grid; place-items: center; text-align: center; padding: 28px; }
.empty-state > div { max-width: 42ch; }
.empty-state h3 { margin: 8px 0 4px; }
.empty-state p { margin: 0 auto; color: var(--ink-400); }

.status-alert { display: flex; align-items: flex-start; gap: 10px; border-radius: var(--r); }
.status-alert [data-lucide] { flex: none; margin-top: 1px; }

.enterprise-table-wrap { scrollbar-gutter: stable; }
.enterprise-table thead th { position: sticky; top: 0; z-index: 1; }
.enterprise-table tbody tr:focus-within { background: var(--surface-2); }

@media (max-width: 720px) {
    .module-toolbar { align-items: stretch; }
    .module-toolbar .actions { width: 100%; }
    .module-toolbar .actions > .btn { flex: 1 1 auto; }
    .enterprise-table-wrap { margin-inline: -2px; }
}

/* Global visual pass: calm enterprise hierarchy with less visual noise. */
body.app-body {
    background:
        radial-gradient(circle at 88% -12%, rgba(0,122,74,.08), transparent 30rem),
        var(--canvas);
    color: var(--ink-700);
    background-color: var(--clinical);
    font-feature-settings: "ss01" 1, "cv02" 1;
}
.app-shell { min-height: 100dvh; }
.sidebar {
    background:
        radial-gradient(circle at 15% 0%, rgba(177,211,75,.14), transparent 18rem),
        linear-gradient(180deg, #073c35 0%, #032c29 58%, #022420 100%);
    border-right: 1px solid rgba(255,255,255,.08);
}
.brand-lockup img { display: block; object-fit: contain; object-position: left center; }
.sidebar-nav a { border-radius: 10px; margin: 2px 0; min-height: 42px; }
.sidebar-nav a.active { background: rgba(0,153,93,.28); border-color: rgba(177,211,75,.18); }
.sidebar-nav a.active::before { left: -8px; width: 4px; }
.nav-label { margin: 22px 10px 7px; color: rgba(255,255,255,.42); font-size: 10px; letter-spacing: .14em; }
.sidebar-user { border: 1px solid transparent; }
.sidebar-user:hover { border-color: rgba(255,255,255,.12); }

.main-content { min-width: 0; }
.app-topbar {
    position: sticky; top: 0; z-index: 40;
    background: color-mix(in srgb, var(--canvas) 88%, transparent);
    border-bottom-color: color-mix(in srgb, var(--line) 78%, transparent);
    backdrop-filter: blur(14px);
}
.topbar-context strong { letter-spacing: -.01em; }
.topbar-status { box-shadow: inset 0 0 0 1px rgba(0,122,74,.08); }
.topbar-profile { box-shadow: var(--sh-xs); }

.page-hero, .crm-page-head { padding-bottom: 4px; }
.page-hero, .crm-page-head { position: relative; }
.page-hero::after, .crm-page-head::after {
    content: ""; display: block; position: absolute; left: 0; right: 0; bottom: -13px;
    height: 2px; border-radius: 999px;
    background: linear-gradient(90deg, var(--green) 0%, var(--pulse) 38%, color-mix(in srgb, var(--pulse) 0%, transparent) 78%);
    opacity: .9;
}
.page-hero h1, .crm-page-head h1 { color: var(--ink-900); line-height: 1.04; }
.page-hero p.muted, .crm-page-head p.muted { color: var(--ink-400); line-height: 1.55; }
.hero-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eyebrow { color: var(--green); }
.page-hero .eyebrow, .crm-page-head .crm-breadcrumb span { letter-spacing: .16em; }

.btn {
    min-height: 42px; border-radius: 10px; font-weight: 700; letter-spacing: -.005em;
    transition: transform var(--ease), background-color var(--ease), border-color var(--ease), box-shadow var(--ease), color var(--ease);
}
.btn.primary { background: var(--green); box-shadow: 0 5px 16px rgba(0,122,74,.22); }
.btn.primary:hover { background: var(--green-hover); box-shadow: 0 8px 22px rgba(0,122,74,.26); }
.btn.secondary { background: color-mix(in srgb, var(--surface) 88%, var(--green-soft)); }
.btn:focus-visible, .icon-btn:focus-visible, .filter-toggle:focus-visible, .filter-clear:focus-visible { box-shadow: var(--ring); }
.icon-btn { border: 1px solid transparent; }
.icon-btn:hover { border-color: var(--line); }

.panel, .fivix-panel, .executive-panel, .enterprise-column, .crm-list, .crm-command-bar {
    border-color: var(--line);
    box-shadow: var(--sh-xs);
}
.panel, .fivix-panel, .executive-panel { background: color-mix(in srgb, var(--surface) 96%, var(--green-soft)); }
.panel-head { gap: 16px; }
.panel-head h2, .panel-head h3 { color: var(--ink-900); letter-spacing: -.015em; }
.panel-head p { color: var(--ink-400); }
.empty-state { color: var(--ink-700); border: 1px dashed var(--line-2); border-radius: var(--r); background: color-mix(in srgb, var(--surface-2) 88%, transparent); }
.empty-state [data-lucide] { color: var(--green); }

.executive-kpis article, .kpi-link article { min-height: 132px; }
.executive-kpis article strong, .crm-metrics article strong { font-variant-numeric: tabular-nums; }
.executive-kpis article strong, .crm-metrics article strong, .duty-metrics strong { letter-spacing: -.035em; }
.kpi-link { transition: transform var(--ease), box-shadow var(--ease); }
.kpi-link:hover { transform: translateY(-2px); }
.attention-list a, .distribution-row, .pipeline-bar-row { transition: background-color var(--ease), transform var(--ease); }
.attention-list a:hover, .distribution-row:hover, .pipeline-bar-row:hover { transform: translateX(3px); }

.crm-command-bar { background: var(--surface); }
.filters-bar { gap: 8px; }
.crm-search, .filters-bar select, .filter-toggle, .filter-clear {
    min-height: 40px; border-radius: 9px; border-color: var(--line-2); background: var(--surface-2);
}
.crm-search:focus-visible, .filters-bar select:focus-visible { background: var(--surface); }
.crm-column > header { background: color-mix(in srgb, var(--surface-2) 88%, var(--green-soft)); border-bottom-color: var(--line); }
.crm-column > header::before { background: var(--status-color, var(--green)); box-shadow: 0 0 12px color-mix(in srgb, var(--status-color, var(--green)) 30%, transparent); }
.crm-card, .enterprise-deal-card { border-color: var(--line); box-shadow: var(--sh-xs); }
.crm-card:hover, .enterprise-deal-card:focus-within { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); box-shadow: var(--sh-sm); }
.crm-card-top strong { color: var(--ink-900); }
.card-open-button, .table-open-link { color: var(--green-press); }
.card-open-button:hover, .table-open-link:hover { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }

.enterprise-table-wrap, .history-table-wrap { background: var(--surface); }
.enterprise-table thead th, .history-table thead th { background: var(--surface-2); color: var(--ink-400); }
.enterprise-table tbody td, .history-table tbody td { color: var(--ink-600); }
.enterprise-table tbody tr:hover, .history-table tbody tr:hover { background: color-mix(in srgb, var(--green-soft) 34%, var(--surface)); }

.field label, .stack-form label, .edit-grid label { color: var(--ink-700); font-weight: 650; }
.field input, .field select, .field textarea, .stack-form input, .stack-form select, .stack-form textarea,
.edit-grid input, .edit-grid select, .edit-grid textarea {
    min-height: 42px; border-radius: 9px; border-color: var(--line-2); background: var(--surface-2);
    transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease);
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible,
.stack-form input:focus-visible, .stack-form select:focus-visible, .stack-form textarea:focus-visible,
.edit-grid input:focus-visible, .edit-grid select:focus-visible, .edit-grid textarea:focus-visible { background: var(--surface); }
.form-section, .side-section, .ficha-owner-box, .opportunity-command-center { border-color: var(--line); }

.duty-metrics article, .duty-agent-card, .duty-queue-row, .inbox-row { border-color: var(--line); box-shadow: var(--sh-xs); }
.duty-agent-card.available { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); background: color-mix(in srgb, var(--green-soft) 42%, var(--surface)); }
.inbox-row:hover, .duty-agent-card:hover { border-color: color-mix(in srgb, var(--green) 32%, var(--line)); box-shadow: var(--sh-sm); }
.inbox-row-main strong { color: var(--ink-900); }

.automation-tabs-nav { border-bottom: 1px solid var(--line); gap: 4px; }
.automation-tabs-nav a { min-height: 38px; }
.automation-tabs-nav a.active { box-shadow: 0 4px 12px rgba(0,122,74,.18); }
.automation-tabs-nav a.active .tab-badge { background: var(--pulse); color: var(--forest-900); }
.agent-metric-card, .automation-card, .knowledge-card, .learning-card { border-color: var(--line); box-shadow: var(--sh-xs); }

.modal { backdrop-filter: blur(4px); background: rgba(2,36,32,.46); }
.modal-card, .side-panel-content { border: 1px solid var(--line); }
.modal-head, .side-head { border-bottom-color: var(--line); }
.opportunity-tabs button { min-height: 40px; }

@media (max-width: 1024px) {
    .app-topbar { background: var(--canvas); backdrop-filter: none; }
    .sidebar-nav a.active::before { left: -6px; }
}
@media (max-width: 620px) {
    .hero-actions, .hero-actions .btn { width: 100%; }
    .hero-actions .btn { justify-content: center; }
    .topbar-status { display: none; }
    .page-hero h1, .crm-page-head h1 { font-size: 24px; }
    .executive-kpis article, .kpi-link article { min-height: 112px; }
}

/* Signature: the active operational signal travels through the working canvas. */
.topbar-status i { background: var(--pulse); box-shadow: 0 0 0 3px rgba(184,220,83,.22), 0 0 14px rgba(184,220,83,.32); }
.status-soft i, .status-dot { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 14%, transparent); }
.distribution-track i, .pipeline-bar-track i { box-shadow: 0 0 12px color-mix(in srgb, currentColor 24%, transparent); }
.crm-card .temperature.quente { color: var(--orange-ink); background: var(--orange-soft); }
.crm-card .temperature.morno { color: var(--amber); background: #fff7de; }
.crm-card .temperature.frio { color: var(--cyan); background: #e8f7f7; }
/* ============================================================
   1.11 — Premium operating room
   Unimed-only palette: forest green, clinical white and lime signal.
   ============================================================ */
:root {
    --premium-forest: #063f36;
    --premium-forest-2: #0b594a;
    --premium-green: #007a4a;
    --premium-lime: #b1d34b;
    --premium-canvas: #f3f8f5;
    --premium-surface: #ffffff;
    --premium-ink: #102d27;
    --premium-muted: #66827a;
    --premium-line: #dbe9e3;
    --premium-shadow: 0 16px 38px rgba(6, 63, 54, .08);
    --premium-shadow-hover: 0 20px 48px rgba(6, 63, 54, .14);
    --premium-radius: 18px;
    --premium-ease: 180ms cubic-bezier(.22, .8, .2, 1);
}

html { background: var(--premium-canvas); }
body.premium-app {
    background: var(--premium-canvas);
    color: var(--premium-ink);
    font-family: "Unimed Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: -0.01em;
}
body.premium-app :where(h1, h2, h3, h4, strong) { color: var(--premium-ink); }
body.premium-app :where(p, small, .muted, .eyebrow) { color: var(--premium-muted); }
.app-shell { background: var(--premium-canvas); }
.premium-sidebar {
    background: linear-gradient(180deg, var(--premium-forest) 0%, #052f2a 100%);
    border-right: 1px solid rgba(177, 211, 75, .2);
    box-shadow: 14px 0 44px rgba(6, 63, 54, .12);
}
.premium-sidebar::after { content: ""; position: absolute; left: 24px; right: 24px; bottom: 78px; height: 1px; background: linear-gradient(90deg, transparent, rgba(177, 211, 75, .34), transparent); }
.sidebar-brand-row { padding: 24px 20px 14px; }
.brand-lockup { min-height: 58px; }
.brand-lockup img { width: 176px; height: auto; object-fit: contain; }
.sidebar-rail-note { display: flex; align-items: center; gap: 8px; margin: 0 20px 20px; padding: 9px 11px; border: 1px solid rgba(177, 211, 75, .24); border-radius: 999px; color: rgba(244, 250, 247, .74); font-size: .72rem; letter-spacing: .03em; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--premium-lime); box-shadow: 0 0 0 5px rgba(177, 211, 75, .15); }
.sidebar-nav { gap: 4px; padding: 0 12px 18px; }
.sidebar-nav .nav-label { margin: 18px 10px 7px; color: rgba(244, 250, 247, .48); font-size: .65rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-nav > a { min-height: 44px; border: 1px solid transparent; border-radius: 12px; color: rgba(244, 250, 247, .78); transition: background-color var(--premium-ease), color var(--premium-ease), border-color var(--premium-ease), transform var(--premium-ease); }
.sidebar-nav > a:hover { background: rgba(255, 255, 255, .08); color: #fff; transform: translateX(2px); }
.sidebar-nav > a:focus-visible { outline: 3px solid var(--premium-lime); outline-offset: 2px; }
.sidebar-nav > a.active { position: relative; background: rgba(177, 211, 75, .16); border-color: rgba(177, 211, 75, .28); color: #fff; box-shadow: inset 3px 0 0 var(--premium-lime); }
.sidebar-nav > a.active i { color: var(--premium-lime); }
.nav-logout { margin-top: 12px; color: rgba(244, 250, 247, .56) !important; }
.premium-sidebar-user { margin: 10px 14px 18px; padding: 11px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(255,255,255,.06); }
.premium-sidebar-user:hover { background: rgba(255,255,255,.1); }
.premium-sidebar-user .avatar { background: var(--premium-lime); color: var(--premium-forest); font-weight: 800; }
.premium-sidebar-user .sidebar-user-copy { min-width: 0; }
.premium-sidebar-user strong, .premium-sidebar-user small { color: #fff; }
.premium-sidebar-user small { color: rgba(244, 250, 247, .62); }
.main-content { min-width: 0; background: var(--premium-canvas); }
.premium-topbar { min-height: 74px; padding: 12px clamp(20px, 4vw, 48px); background: rgba(255, 255, 255, .88); border-bottom: 1px solid var(--premium-line); backdrop-filter: blur(16px); }
.topbar-context { display: grid; gap: 2px; }
.topbar-overline { color: var(--premium-muted); font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.topbar-context strong { font-size: 1.02rem; letter-spacing: -.02em; }
.topbar-status { gap: 8px; color: var(--premium-green); font-size: .78rem; font-weight: 700; }
.topbar-status i { width: 8px; height: 8px; background: var(--premium-lime); box-shadow: 0 0 0 5px rgba(177, 211, 75, .18); }
.topbar-profile { min-height: 44px; gap: 10px; padding: 5px 8px 5px 5px; border: 1px solid var(--premium-line); border-radius: 999px; transition: border-color var(--premium-ease), box-shadow var(--premium-ease), background-color var(--premium-ease); }
.topbar-profile:hover { background: #fff; border-color: rgba(0, 122, 74, .35); box-shadow: 0 6px 18px rgba(6, 63, 54, .08); }
.topbar-profile > span { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: var(--premium-forest); color: #fff; font-weight: 800; }
.topbar-profile em { max-width: 18ch; overflow: hidden; color: var(--premium-ink); font-size: .82rem; font-style: normal; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.main-content > :where(.page-hero, .crm-page-head, .module-shell, .inbox-shell, .automation-body, .panel, .enterprise-grid, .executive-kpis, .executive-dashboard-grid, .distribution-grid) { width: min(100% - 48px, 1440px); margin-inline: auto; }
.page-hero, .crm-page-head { position: relative; overflow: hidden; margin-top: 28px; padding: clamp(24px, 4vw, 42px); border: 1px solid rgba(0, 122, 74, .18); border-radius: 24px; background: linear-gradient(120deg, #fff 0%, #f2faf6 68%, #e8f5dd 100%); box-shadow: var(--premium-shadow); }
.page-hero::after, .crm-page-head::after { content: ""; position: absolute; right: -32px; bottom: -54px; width: 280px; height: 130px; border-top: 2px solid rgba(0, 122, 74, .22); border-radius: 50%; transform: rotate(-11deg); pointer-events: none; }
.page-hero .eyebrow, .crm-page-head .eyebrow { color: var(--premium-green); font-size: .68rem; font-weight: 800; letter-spacing: .14em; }
.page-hero h1, .crm-page-head h1 { max-width: 18ch; margin: 8px 0 10px; font-size: clamp(1.8rem, 3.2vw, 3rem); line-height: 1.03; letter-spacing: -.055em; text-wrap: balance; }
.page-hero p:not(.eyebrow), .crm-page-head p:not(.eyebrow) { max-width: 58ch; font-size: .98rem; line-height: 1.55; }
.panel, .crm-card, .company-card, .hub-card, .agent-metric-card, .duty-agent-card, .chat-panel, .contact-panel, .inbox-list, .automation-form, .automation-overview-grid > *, .settings-card, .profile-card { border: 1px solid var(--premium-line); border-radius: var(--premium-radius); background: var(--premium-surface); box-shadow: var(--premium-shadow); }
.panel:hover, .crm-card:hover, .company-card:hover, .hub-card:hover, .agent-metric-card:hover { box-shadow: var(--premium-shadow-hover); }
.panel-head { gap: 16px; padding-bottom: 16px; border-bottom: 1px solid #edf3f0; }
.panel-head h2, .panel-head h3 { letter-spacing: -.035em; }
.btn { min-height: 44px; border-radius: 11px; font-weight: 750; transition: background-color var(--premium-ease), border-color var(--premium-ease), color var(--premium-ease), box-shadow var(--premium-ease), transform var(--premium-ease); }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--premium-green); border-color: var(--premium-green); box-shadow: 0 8px 18px rgba(0, 122, 74, .16); }
.btn.primary:hover { background: var(--premium-forest-2); border-color: var(--premium-forest-2); box-shadow: 0 10px 24px rgba(0, 122, 74, .24); }
.btn.secondary { background: #fff; border-color: var(--premium-line); color: var(--premium-forest); }
.btn.secondary:hover { border-color: rgba(0, 122, 74, .4); background: var(--premium-canvas); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(177, 211, 75, .9); outline-offset: 2px; }
.executive-kpis, .dashboard-kpis { gap: 12px; margin-top: 18px; }
.kpi-link article, .executive-kpis article { min-height: 128px; border: 1px solid var(--premium-line); border-radius: 16px; background: #fff; box-shadow: 0 8px 24px rgba(6, 63, 54, .06); transition: border-color var(--premium-ease), box-shadow var(--premium-ease), transform var(--premium-ease); }
.kpi-link:hover article { border-color: rgba(0, 122, 74, .36); box-shadow: var(--premium-shadow-hover); transform: translateY(-2px); }
.kpi-link article > i, .executive-kpis article > i { color: var(--premium-green); }
.kpi-link article strong, .executive-kpis article strong { color: var(--premium-forest); font-variant-numeric: tabular-nums; letter-spacing: -.045em; }
.alert { border-radius: 14px; box-shadow: 0 8px 20px rgba(6, 63, 54, .06); }
.empty-state { min-height: 220px; border: 1px dashed #b9d3c7; border-radius: 14px; background: linear-gradient(180deg, #fbfefc, #f1f8f4); }
.empty-state strong { color: var(--premium-forest); }
.status-soft, .connection-pill, .inbox-status, .availability, .learning-badge { border-radius: 999px; font-weight: 750; }
.crm-board, .crm-list, .company-grid, .duty-agent-grid, .knowledge-grid, .agent-metric-grid, .diagnostics-grid, .distribution-grid, .enterprise-grid { gap: 16px; }
.crm-column { border: 1px solid var(--premium-line); border-radius: 16px; background: rgba(255,255,255,.62); }
.crm-column-head { border-bottom: 1px solid var(--premium-line); }
.crm-card { box-shadow: 0 6px 18px rgba(6, 63, 54, .06); }
.crm-card-top strong { color: var(--premium-forest); }
.crm-card-footer { border-top-color: #edf3f0; }
.filters-bar, .enterprise-command-bar, .inbox-topbar, .conv-monitor-head { border: 1px solid var(--premium-line); border-radius: 14px; background: #fff; box-shadow: 0 6px 18px rgba(6, 63, 54, .05); }
.field input, .field select, .field textarea, .crm-search input, .conversation-search input { min-height: 44px; border-color: #cfe1d9; border-radius: 10px; background: #fff; color: var(--premium-ink); }
.field input::placeholder, .field textarea::placeholder, .crm-search input::placeholder, .conversation-search input::placeholder { color: #8aa49c; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .crm-search input:focus-visible, .conversation-search input:focus-visible { border-color: var(--premium-green); box-shadow: 0 0 0 4px rgba(0, 122, 74, .11); }
.enterprise-table-wrap, .history-table-wrap, .duty-queue-table, .conv-monitor-table { border: 1px solid var(--premium-line); border-radius: 14px; background: #fff; box-shadow: 0 6px 18px rgba(6, 63, 54, .05); }
.enterprise-table th, .history-table th, .duty-queue-table th, .conv-monitor-table th { color: var(--premium-muted); font-size: .69rem; letter-spacing: .1em; text-transform: uppercase; }
.enterprise-table td, .history-table td, .duty-queue-table td, .conv-monitor-table td { border-top-color: #edf3f0; }
.enterprise-table tbody tr:hover, .history-table tbody tr:hover { background: #f6fbf8; }
.automation-tabs-nav { gap: 6px; padding: 5px; border: 1px solid var(--premium-line); border-radius: 13px; background: #edf6f1; }
.automation-tabs-nav a { min-height: 40px; border-radius: 9px; color: var(--premium-muted); transition: background-color var(--premium-ease), color var(--premium-ease), box-shadow var(--premium-ease); }
.automation-tabs-nav a.active { background: #fff; color: var(--premium-forest); box-shadow: 0 5px 14px rgba(6, 63, 54, .1); }
.chat-bubble.agent { background: var(--premium-forest); color: #fff; }
.chat-bubble.lead { background: #e6f3ec; color: var(--premium-ink); }
.main-content :where(.text-success, .success, .ok) { color: var(--premium-green) !important; }
.main-content :where(.text-danger, .danger, .fail) { color: #b42318 !important; }
.main-content :where(.text-warning, .warning, .accent-orange) { color: #9a5a00 !important; }
@media (max-width: 980px) { .main-content > :where(.page-hero, .crm-page-head, .module-shell, .inbox-shell, .automation-body, .panel, .enterprise-grid, .executive-kpis, .executive-dashboard-grid, .distribution-grid) { width: min(100% - 32px, 1440px); } .premium-topbar { padding-inline: 24px; } .topbar-profile em { display: none; } }
@media (max-width: 640px) { .main-content > :where(.page-hero, .crm-page-head, .module-shell, .inbox-shell, .automation-body, .panel, .enterprise-grid, .executive-kpis, .executive-dashboard-grid, .distribution-grid) { width: calc(100% - 24px); } .premium-topbar { min-height: 64px; padding-inline: 14px; } .topbar-status { display: none; } .topbar-overline { font-size: .6rem; } .topbar-context strong { font-size: .9rem; } .page-hero, .crm-page-head { margin-top: 16px; padding: 22px 18px; border-radius: 18px; } .page-hero h1, .crm-page-head h1 { font-size: 1.8rem; } .hero-actions { width: 100%; } .hero-actions .btn { flex: 1; } .kpi-link article, .executive-kpis article { min-height: 106px; } }
@media (prefers-reduced-motion: reduce) { .sidebar-nav > a:hover, .btn:hover, .kpi-link:hover article { transform: none; } }

/* Login uses the same visual language as the authenticated shell. */
.premium-login { background: var(--premium-canvas); color: var(--premium-ink); }
.premium-login .login-shell { min-height: 100dvh; background: var(--premium-canvas); }
.premium-login .login-brand-panel { position: relative; overflow: hidden; background: linear-gradient(145deg, var(--premium-forest) 0%, #052f2a 72%, #0b594a 100%); }
.premium-login .login-brand-panel::after { content: ""; position: absolute; right: -100px; bottom: 8%; width: 440px; height: 190px; border-top: 2px solid rgba(177, 211, 75, .34); border-radius: 50%; transform: rotate(-12deg); pointer-events: none; }
.premium-login .login-brand-top img { width: min(240px, 70%); height: auto; }
.premium-login .login-kicker, .premium-login .login-brand-footer { color: rgba(244, 250, 247, .7); letter-spacing: .12em; text-transform: uppercase; }
.premium-login .login-brand-message h1 { max-width: 11ch; color: #fff; font-size: clamp(2.4rem, 5vw, 4.6rem); letter-spacing: -.06em; line-height: .98; text-wrap: balance; }
.premium-login .login-brand-message p { max-width: 40ch; color: rgba(244, 250, 247, .75); line-height: 1.6; }
.premium-login .login-form-panel { background: linear-gradient(180deg, #fff, var(--premium-canvas)); }
.premium-login .login-card { width: min(100% - 40px, 430px); padding: clamp(24px, 5vw, 44px); border: 1px solid var(--premium-line); border-radius: 24px; background: #fff; box-shadow: var(--premium-shadow-hover); }
.premium-login .login-form-heading h2 { color: var(--premium-forest); font-size: 2rem; letter-spacing: -.05em; }
.premium-login .login-field { min-height: 50px; border-color: #cfe1d9; border-radius: 11px; transition: border-color var(--premium-ease), box-shadow var(--premium-ease); }
.premium-login .login-field:focus-within { border-color: var(--premium-green); box-shadow: 0 0 0 4px rgba(0, 122, 74, .11); }
.premium-login .login-card > .btn { min-height: 50px; width: 100%; justify-content: center; }
.premium-login .login-security { color: var(--premium-muted); }
@media (max-width: 760px) { .premium-login .login-brand-panel { min-height: 34dvh; } .premium-login .login-brand-message h1 { font-size: 2.4rem; } .premium-login .login-form-panel { min-height: 66dvh; } }

/* Brand assets: official Unimed typefaces and clean directory surfaces. */
@font-face { font-family: "Unimed Sans"; src: url("../fonts/unimed-sans/UnimedSans2020-Rg.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Unimed Sans"; src: url("../fonts/unimed-sans/UnimedSans2020-Sb.otf") format("opentype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Unimed Sans"; src: url("../fonts/unimed-sans/UnimedSans2020-Bd.otf") format("opentype"); font-weight: 700 900; font-display: swap; }
@font-face { font-family: "Unimed Slab"; src: url("../fonts/unimed-slab/UnimedSlab2020-Rg.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Unimed Slab"; src: url("../fonts/unimed-slab/UnimedSlab2020-Bd.otf") format("opentype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Unimed Serif"; src: url("../fonts/unimed-serif/UnimedSerif2020-Rg.otf") format("opentype"); font-weight: 400; font-display: swap; }
:root { --unimed-primary: #00995d; --unimed-citrus: #b7d335; --unimed-orange: #f58220; --unimed-dark: #005a4c; --unimed-clinical: #f5faf7; }
body.premium-app { font-family: "Unimed Sans", system-ui, sans-serif; background: var(--unimed-clinical); }
body.premium-app :where(h1, h2, h3) { font-family: "Unimed Slab", "Unimed Sans", sans-serif; }
.avatar-image { display: block; object-fit: cover; object-position: center; overflow: hidden; }
.premium-sidebar-user .avatar-image { background: var(--premium-lime); }
.topbar-profile .topbar-avatar { display: block; width: 32px; height: 32px; border-radius: 50%; }
.directory-hero { align-items: flex-end; }
.directory-summary { width: min(100% - 48px, 1440px); margin: 20px auto 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.directory-summary article { display: flex; align-items: center; gap: 14px; min-height: 104px; padding: 18px; border: 1px solid var(--premium-line); border-radius: 16px; background: #fff; box-shadow: 0 8px 24px rgba(6,63,54,.05); }
.summary-icon { display: grid; width: 42px; height: 42px; flex: none; place-items: center; border-radius: 12px; color: #fff; background: var(--premium-green); }
.summary-icon.lime { color: var(--premium-forest); background: var(--premium-lime); } .summary-icon.cyan { background: #72c7c5; }
.directory-summary small, .directory-summary span { display: block; color: var(--premium-muted); font-size: .76rem; } .directory-summary strong { display: block; margin: 2px 0; color: var(--premium-forest); font-size: 1.7rem; letter-spacing: -.04em; }
.directory-layout { width: min(100% - 48px, 1440px); margin: 16px auto 44px; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .75fr); align-items: start; gap: 16px; }
.directory-panel, .brokerage-panel { min-width: 0; overflow: hidden; } .directory-panel-head { align-items: flex-start; } .directory-panel-head h2 { margin-top: 4px; } .directory-panel-head p:not(.eyebrow) { margin-top: 4px; }
.count-pill { padding: 6px 10px; border-radius: 999px; color: var(--premium-green); background: #e8f5ee; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.directory-list, .brokerage-list { display: grid; gap: 0; } .directory-user-row { display: grid; grid-template-columns: minmax(210px, 1.35fr) minmax(160px, 1fr) auto; align-items: center; gap: 14px; padding: 17px 20px; border-top: 1px solid #edf3f0; } .directory-user-row:hover { background: #f7fbf8; }
.directory-person { display: flex; min-width: 0; align-items: center; gap: 12px; } .directory-person .avatar { display: grid; width: 48px; height: 48px; flex: none; place-items: center; border-radius: 14px; color: var(--premium-forest); background: #dfeee4; font-weight: 800; } .directory-person > div { min-width: 0; } .directory-person strong, .directory-person span, .directory-person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .directory-person strong { color: var(--premium-forest); } .directory-person span { margin-top: 2px; color: var(--premium-muted); font-size: .8rem; } .directory-person small { margin-top: 3px; color: #91a9a0; font-size: .72rem; }
.self-badge { display: inline-block !important; margin-left: 5px; padding: 2px 6px; border-radius: 999px; color: var(--premium-green) !important; background: #e8f5ee; font-size: .63rem !important; font-weight: 700; vertical-align: middle; }
.directory-meta { display: grid; gap: 6px; justify-items: start; } .directory-meta .tag { display: inline-flex; } .role-tag { color: var(--premium-forest); background: #eef5f1; } .directory-brokerage { display: flex; align-items: center; gap: 5px; max-width: 22ch; overflow: hidden; color: var(--premium-muted); font-size: .73rem; text-overflow: ellipsis; white-space: nowrap; } .directory-brokerage svg { width: 13px; flex: none; }
.directory-row-actions { display: flex; align-items: center; gap: 3px; } .directory-row-actions form { display: contents; } .directory-row-actions .icon-btn { width: 34px; height: 34px; }
.brokerage-row { display: grid; grid-template-columns: 36px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 15px 18px; border-top: 1px solid #edf3f0; } .brokerage-row.is-inactive { opacity: .58; } .brokerage-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 11px; color: var(--premium-green); background: #e8f5ee; } .brokerage-row strong, .brokerage-row span, .brokerage-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .brokerage-row strong { color: var(--premium-forest); font-size: .86rem; } .brokerage-row span { color: var(--premium-muted); font-size: .72rem; } .brokerage-row small { margin-top: 4px; color: #91a9a0; font-size: .68rem; }
.compact-empty { min-height: 150px; border: 0; background: transparent; } .compact-empty p { margin: 0; }
.directory-modal { width: min(100% - 28px, 560px); } .wide-modal { width: min(100% - 28px, 760px); } .permission-help { margin: -4px 0 18px; } .permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; max-height: 48vh; overflow: auto; padding-right: 3px; } .permission-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px; border: 1px solid var(--premium-line); border-radius: 11px; background: #fbfefc; } .permission-item span { min-width: 0; } .permission-item strong, .permission-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .permission-item strong { color: var(--premium-forest); font-size: .78rem; } .permission-item small { color: var(--premium-muted); font-size: .67rem; } .permission-item select { min-height: 34px; max-width: 122px; padding: 0 8px; border: 1px solid var(--premium-line); border-radius: 8px; background: #fff; color: var(--premium-forest); font-size: .7rem; }
.field-hint { display: block; margin-top: 6px; color: var(--premium-muted); font-size: .7rem; } .avatar-remove-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid #edf3f0; }
.profile-layout { width: min(100% - 48px, 1120px); margin: 16px auto 44px; display: grid; grid-template-columns: minmax(270px, .72fr) minmax(0, 1.28fr); gap: 16px; align-items: start; } .profile-identity-card { grid-row: span 2; overflow: hidden; } .profile-cover { height: 106px; background: linear-gradient(120deg, var(--premium-forest), var(--premium-green) 56%, var(--premium-lime)); } .profile-identity-content { display: flex; align-items: center; gap: 16px; margin-top: -42px; padding: 0 22px; } .profile-avatar-wrap { position: relative; flex: none; } .profile-avatar { display: grid; width: 112px; height: 112px; place-items: center; border: 5px solid #fff; border-radius: 28px; color: var(--premium-forest); background: #dfeee4; box-shadow: 0 9px 22px rgba(6,63,54,.14); font-size: 2.1rem; font-weight: 800; } .avatar-edit { position: absolute; right: -5px; bottom: -5px; display: grid; width: 34px; height: 34px; place-items: center; border: 3px solid #fff; border-radius: 50%; color: var(--premium-forest); background: var(--premium-lime); cursor: pointer; } .avatar-edit svg { width: 15px; } .profile-status { display: inline-flex; align-items: center; gap: 6px; color: var(--premium-green); font-size: .7rem; font-weight: 700; } .profile-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--premium-lime); } .profile-identity-content h2 { margin: 5px 0 2px; color: var(--premium-forest); font-size: 1.25rem; } .profile-identity-content p { margin: 0; color: var(--premium-muted); font-size: .78rem; } .profile-role { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; color: var(--premium-green); font-size: .7rem; font-weight: 700; } .profile-role svg { width: 14px; } .profile-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 24px 22px 20px; padding-top: 16px; border-top: 1px solid #edf3f0; } .profile-facts small, .profile-facts strong { display: block; } .profile-facts small { color: var(--premium-muted); font-size: .68rem; } .profile-facts strong { margin-top: 3px; color: var(--premium-forest); font-size: .78rem; } .profile-form-card { padding-bottom: 20px; } .security-card .security-mark { width: 36px; height: 36px; padding: 9px; border-radius: 12px; color: var(--premium-green); background: #e8f5ee; }
@media (max-width: 980px) { .directory-summary, .directory-layout, .profile-layout { width: min(100% - 32px, 1440px); } .directory-layout, .profile-layout { grid-template-columns: 1fr; } .profile-identity-card { grid-row: auto; } }
@media (max-width: 700px) { .directory-summary { grid-template-columns: 1fr; } .directory-user-row { grid-template-columns: 1fr auto; } .directory-meta { grid-column: 1 / -1; grid-template-columns: auto auto; align-items: center; } .directory-brokerage { grid-column: 1 / -1; } .permission-grid { grid-template-columns: 1fr; } .profile-identity-content { align-items: flex-end; padding-inline: 16px; } .profile-avatar { width: 88px; height: 88px; border-radius: 22px; font-size: 1.7rem; } .profile-facts { margin-inline: 16px; } }
@media (max-width: 520px) { .directory-hero .hero-actions { display: grid; grid-template-columns: 1fr; } .directory-layout, .profile-layout, .directory-summary { width: calc(100% - 24px); } .directory-user-row { padding-inline: 13px; } .directory-person .avatar { width: 42px; height: 42px; } .directory-row-actions .icon-btn { width: 31px; height: 31px; } }

/* Layout normalization: one readable column rhythm across every module. */
body.premium-app .main-content > :not(.premium-topbar):not(.modal):not(.sidebar-backdrop):not(.page-hero):not(.crm-page-head):not(.panel):not(.alert) {
    width: min(calc(100% - 48px), 1440px);
    margin-inline: auto;
    padding-inline: 0;
    box-sizing: border-box;
}
body.premium-app .main-content > .app-topbar { width: 100%; max-width: none; padding-inline: clamp(20px, 4vw, 48px); }
body.premium-app .main-content > .modal { width: 100%; max-width: none; padding-inline: 0; }
@media (max-width: 980px) {
    body.premium-app .main-content > :not(.premium-topbar):not(.modal):not(.sidebar-backdrop):not(.page-hero):not(.crm-page-head):not(.panel):not(.alert) { width: min(calc(100% - 32px), 1440px); }
    body.premium-app .main-content > .app-topbar { padding-inline: 24px; }
}
@media (max-width: 640px) {
    body.premium-app .main-content > :not(.premium-topbar):not(.modal):not(.sidebar-backdrop):not(.page-hero):not(.crm-page-head):not(.panel):not(.alert) { width: calc(100% - 24px); }
    body.premium-app .main-content > .app-topbar { padding-inline: 14px; }
}

/* Clean pass: restore desktop density after the legacy fallback cascade. */
@media (min-width: 621px) {
    .premium-app .form-grid,
    .premium-app .field-grid,
    .premium-app .edit-grid,
    .premium-app .section-grid.two,
    .premium-app .agent-config-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .premium-app .enterprise-grid.two-columns,
    .premium-app .two-columns,
    .premium-app .diagnostics-grid,
    .premium-app .update-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

body.premium-app {
    background: #f4f8f6;
    color: #15352d;
    letter-spacing: 0;
}
body.premium-app :where(h1, h2, h3, h4) { font-family: "Unimed Sans", system-ui, sans-serif; font-weight: 700; letter-spacing: -.035em; }
body.premium-app :where(p, label, input, select, textarea, button) { letter-spacing: 0; }
.premium-topbar { min-height: 64px; background: rgba(255,255,255,.96); border-bottom: 1px solid #dce9e3; box-shadow: 0 1px 0 rgba(6,63,54,.02); }
.topbar-context strong { font-size: .95rem; font-weight: 700; }
.main-content > :where(.page-hero, .crm-page-head) { margin-top: 24px; }
.page-hero, .crm-page-head {
    min-height: 142px;
    padding: 28px 32px;
    border: 1px solid #d4e5dc;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(7,64,52,.045);
}
.page-hero::after, .crm-page-head::after { display: none; }
.page-hero h1, .crm-page-head h1 { max-width: none; margin: 6px 0 8px; color: #12352d; font-size: clamp(2rem, 3vw, 2.6rem); line-height: 1.05; letter-spacing: -.055em; }
.page-hero p:not(.eyebrow), .crm-page-head p:not(.eyebrow) { color: #688079; font-size: .91rem; line-height: 1.45; }
.hero-actions { gap: 8px; }
.panel, .profile-card, .settings-card { border-radius: 16px; box-shadow: 0 8px 24px rgba(7,64,52,.045); }
.panel-head { padding-bottom: 14px; border-bottom: 1px solid #e8f0ec; }
.panel-head h2, .panel-head h3 { font-size: 1.05rem; letter-spacing: -.025em; }
.field input, .field select, .field textarea, .form-grid input, .form-grid select, .form-grid textarea { min-height: 42px; }
.profile-layout { gap: 18px; }
.profile-identity-content { align-items: flex-start; margin-top: -42px; padding-inline: 24px; }
.profile-identity-content > div:last-child { padding-top: 52px; }
.profile-identity-content h2 { font-size: 1.08rem; line-height: 1.18; letter-spacing: -.02em; }
.profile-identity-content p { line-height: 1.35; }
.profile-facts { margin-top: 26px; }
.profile-form-card .enterprise-form { max-width: 720px; }
.profile-form-card .form-actions { padding-top: 4px; }
.profile-form-card .form-actions .btn { min-width: 140px; }
.directory-user-row { grid-template-columns: minmax(230px, 1.4fr) minmax(180px, 1fr) auto; }
.directory-summary article { min-height: 92px; box-shadow: 0 6px 18px rgba(7,64,52,.04); }
.directory-summary strong { font-size: 1.5rem; }

/* Login: calm, compact and legible instead of poster-like. */
.premium-login .login-shell { width: min(100% - 48px, 1120px); max-width: 1120px; min-height: 640px; border-radius: 20px; box-shadow: 0 16px 44px rgba(7,64,52,.1); }
.premium-login .login-brand-panel { background: #004e43; }
.premium-login .login-brand-panel::after { opacity: .38; }
.premium-login .login-brand-message h1 { max-width: 11ch; font-family: "Unimed Sans", system-ui, sans-serif; font-size: clamp(2.5rem, 4vw, 3.5rem); line-height: .98; letter-spacing: -.065em; }
.premium-login .login-brand-message p { max-width: 34ch; font-size: .88rem; }
.premium-login .login-form-panel { background: #f8fbf9; }
.premium-login .login-card { width: min(100% - 48px, 390px); padding: 32px; border-radius: 18px; box-shadow: 0 12px 28px rgba(7,64,52,.08); }
.premium-login .login-form-heading h2 { font-family: "Unimed Sans", system-ui, sans-serif; font-size: 1.8rem; letter-spacing: -.045em; }
.premium-login .login-card > .btn { min-height: 46px; }
@media (max-width: 980px) { .page-hero, .crm-page-head { padding-inline: 24px; } .premium-login .login-shell { width: min(100% - 32px, 920px); } }
@media (max-width: 620px) { .page-hero, .crm-page-head { min-height: 0; padding: 22px 18px; } .page-hero h1, .crm-page-head h1 { font-size: 1.9rem; } .profile-identity-content > div:last-child { padding-top: 44px; } .premium-login .login-shell { width: min(100% - 24px, 420px); } .premium-login .login-card { width: min(100% - 32px, 390px); padding: 26px 22px; } }
