/* ══════════════════════════════════════════════════════════════════════
   LabPro — Design System
   Fonte da verdade do visual do sistema, derivado da prototipacao
   "Repaginacao sistema protese dental" (LabPro.dc.html).

   Ordem: tokens -> base -> shell -> componentes -> UIkit -> print
   ══════════════════════════════════════════════════════════════════════ */

:root {
    /* — tinta e superficies —
       Paleta da landing: branco de verdade no lugar do creme, e a escala de
       cinza fria no lugar da quente. */
    --ink: #111827;
    --ink-2: #374151;
    --muted: #6b7280;
    --muted-2: #9ca3af;
    --faint: #b6bdc7;
    /* Tres degraus, nao dois: o chao da pagina, a tela do app e o cartao.
       Com --surface e --card-bg iguais o cartao sumia -- so a borda de 1px
       o separava do fundo, e o sistema inteiro virava um bloco branco. */
    --bg: #eef1f6;
    --surface: #f7f9fc;
    --card-bg: #ffffff;

    /* — linhas — */
    --line: #e5e7eb;
    --line-soft: #f3f4f6;
    --line-list: #eef1f4;
    --stroke: #d1d5db;

    /* — acento: o azul da landing — */
    --accent: #2563eb;
    --accent-600: #1d4ed8;
    --accent-700: #1e40af;
    --accent-soft: #dbeafe;
    --accent-pale: #93c5fd;
    /* Gradiente das acoes primarias, o mesmo da landing. E uma superficie, nao
       uma cor: quem usa precisa de `background:`, nunca `background-color:`. */
    --accent-grad: linear-gradient(135deg, #3b82f6, #1d4ed8);
    --accent-grad-hover: linear-gradient(135deg, #2563eb, #1e40af);

    /* — painel escuro: o azul-marinho das secoes escuras da landing — */
    --panel-grad: linear-gradient(160deg, #16233f, #0b1120);

    /* — estados — */
    --ok: #059669;
    --ok-tint: #d1fae5;
    --warn: #b45309;
    --warn-tint: #fef3c7;
    --danger: #dc2626;
    --danger-ink: #b91c1c;
    --danger-tint: #fee2e2;
    --neutral-tint: #e5e7eb;
    --neutral-ink: #374151;
    --chip-bg: #f3f4f6;

    /* — tipografia — */
    --font: 'Archivo', system-ui, -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

    /* — raios — */
    --r-xs: 8px;
    --r-sm: 10px;
    --r-md: 12px;
    --r-lg: 13px;
    --r-xl: 16px;
    --r-2xl: 18px;
    --r-pill: 99px;

    /* — elevacao — */
    --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
    --shadow-md: 0 4px 12px rgba(15,23,42,.08);
    --shadow-lg: 0 12px 30px rgba(15,23,42,.16);
    --shadow-accent: 0 4px 16px rgba(37,99,235,.35);

    /* — shell — */
    --topbar-h: 60px;
    --tabbar-h: 76px;
    --sidebar-w: 260px;
    --content-max: 1180px;
    --gutter: 20px;

    /* aliases legados — views antigas ainda referenciam estes nomes */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #b45309;
    --warning-light: #fef3c7;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: var(--r-md);
    --radius-lg: var(--r-xl);
    --shadow: var(--shadow-sm);
}


/* ═══ BASE ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; letter-spacing: -.03em; line-height: 1.14; }
h1 { font-size: 30px; }
h2 { font-size: 22px; letter-spacing: -.025em; }
h3 { font-size: 18px; letter-spacing: -.02em; }
h4 { font-size: 15px; font-weight: 600; letter-spacing: -.015em; }
p { margin: 0 0 12px; }

/* O UIkit sublinha todo a:hover. Aqui link e quase sempre navegacao ou acao
   (menu, aba, card, botao), onde o sublinhado vira ruido — o realce fica por
   conta de cor e fundo. Onde o sublinhado ajuda, a regra reativa localmente
   (ver .table-link). */
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-700); text-decoration: none; }

img { display: block; max-width: 100%; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ═══ ICONES (SVG inline — ver Views/Shared/_Icon.cshtml) ════════════ */

.ic {
    width: 1em; height: 1em;
    display: inline-block; flex: none;
    vertical-align: -.14em;
    stroke: currentColor; fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ic-xs { font-size: 13px; }
.ic-sm { font-size: 15px; }
.ic-md { font-size: 17px; }
.ic-lg { font-size: 19px; }
.ic-xl { font-size: 21px; }

/* ═══ SHELL — TOPBAR (mobile/tablet) ═════════════════════════════════ */

/* Em PWA standalone com viewport-fit=cover a barra do sistema (relogio,
   Dynamic Island) fica POR CIMA do conteudo. Sem reservar a safe area o
   botao de menu fica embaixo dela e nao da para tocar. */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 990;
    display: flex; align-items: center; gap: 12px;
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
    background: rgba(255,255,255,.9);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.topbar-toggle {
    width: 44px; height: 44px; margin-left: -12px;
    display: grid; place-items: center;
    background: transparent; border: 0; color: var(--ink); cursor: pointer;
}
.topbar-brand { display: flex; align-items: center; gap: 9px; margin-right: auto; color: var(--ink); }
.topbar-brand:hover { color: var(--ink); }
/* A marca e o proprio logo, sem filtro: ele ja tem cor propria.
   O desenho e mais alto que largo (810x1012), entao precisa de mais altura
   que um icone quadrado para ter o mesmo peso visual ao lado do nome. */
.brand-logo { height: 34px; width: auto; flex: none; display: block; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.topbar-user { display: flex; align-items: center; gap: 9px; }
.topbar-user-info { text-align: right; line-height: 1.2; }
.topbar-user-name { font-size: 12px; font-weight: 600; }
.topbar-user-role {
    font-family: var(--font-mono); font-size: 9px;
    letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2);
}

.avatar {
    width: 34px; height: 34px; border-radius: 11px; flex: none;
    background: var(--ink); color: var(--surface);
    display: grid; place-items: center; font-size: 14px; font-weight: 600;
}
.avatar-sm { width: 28px; height: 28px; border-radius: 9px; font-size: 12px; }
.avatar-lg { width: 40px; height: 40px; border-radius: 13px; font-size: 16px; }
.avatar-tint { background: var(--accent-soft); color: var(--accent-700); }
.avatar-muted { background: var(--chip-bg); color: var(--ink-2); }

/* ═══ SHELL — NAV (drawer no mobile, sidebar no desktop) ═════════════ */

.nav-panel {
    display: flex; flex-direction: column; min-height: 100%;
    background: var(--surface); padding: 22px 18px;
}
.nav-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.nav-brand { display: flex; align-items: center; gap: 9px; color: var(--ink); }
.nav-brand:hover { color: var(--ink); }
.nav-brand .brand-logo { height: 44px; }
.nav-brand .brand-name { font-size: 18px; }
.nav-close {
    width: 40px; height: 40px; margin-right: -8px;
    display: grid; place-items: center;
    background: transparent; border: 0; color: var(--muted); cursor: pointer;
}
.nav-group {
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: .12em; text-transform: uppercase; color: var(--faint);
    padding: 18px 6px 8px;
}
.nav-link {
    display: flex; align-items: center; gap: 12px;
    height: 48px; padding: 0 12px; border-radius: var(--r-md);
    border: 0; background: transparent; width: 100%;
    font-family: var(--font); font-size: 14.5px; font-weight: 500;
    color: var(--ink); text-align: left; cursor: pointer;
    transition: background .16s ease;
}
.nav-link, .nav-link:hover, .nav-link:focus { text-decoration: none; }
.nav-link .ic { color: var(--muted); font-size: 18px; }
.nav-link:hover { background: var(--chip-bg); color: var(--ink); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-700); font-weight: 600; }
.nav-link.is-active .ic { color: var(--accent); }
.nav-badge {
    margin-left: auto; font-family: var(--font-mono); font-size: 10px;
    padding: 4px 8px; border-radius: var(--r-xs);
    background: var(--warn-tint); color: var(--warn);
}
.nav-foot {
    margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line-list);
    display: flex; align-items: center; gap: 11px;
}
/* Avatar + nome viram um so alvo de clique para "Meu perfil". O <a> assume o
   flex:1 que era do .nav-foot-info, para o botao de sair continuar na ponta. */
.nav-foot-user {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 11px;
    padding: 6px; margin: -6px;
    border-radius: var(--r-md);
    color: inherit; text-decoration: none;
    transition: background .16s ease;
}
.nav-foot-user:hover { background: var(--card-bg); color: inherit; text-decoration: none; }
.nav-foot-info { flex: 1; min-width: 0; }
.nav-foot-name { font-size: 14px; font-weight: 600; }
.nav-foot-sub {
    font-size: 11px; color: var(--muted-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-logout {
    width: 40px; height: 40px; border-radius: var(--r-md); flex: none;
    border: 1px solid var(--stroke); background: var(--card-bg);
    display: grid; place-items: center; color: var(--muted); cursor: pointer;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.nav-logout:hover { background: var(--danger-tint); color: var(--danger-ink); border-color: var(--danger-tint); }

/* drawer (mobile) */
.drawer-scrim {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(15,23,42,.45);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.drawer {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1001;
    width: 82%; max-width: 320px;
    background: var(--surface);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateX(-102%);
    transition: transform .28s cubic-bezier(.2,.85,.2,1);
    box-shadow: 24px 0 60px rgba(15,23,42,.18);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
}
body.drawer-open { overflow: hidden; }
body.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }
body.drawer-open .drawer { transform: none; }

/* o botao de fechar so existe no drawer — o mesmo partial serve a sidebar */
.sidebar .nav-close { display: none; }

/* sidebar (desktop) */
.sidebar {
    display: none;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 900;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--line);
    overflow-y: auto;
}

/* ═══ SHELL — TAB BAR (mobile) ═══════════════════════════════════════ */

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 990;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-top: 6px; padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255,255,255,.94);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
}
.tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    background: transparent; border: 0; cursor: pointer;
    color: var(--muted-2); text-decoration: none;
    font-family: var(--font); transition: color .18s ease;
}
.tab span { font-size: 10.5px; font-weight: 500; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--accent); }
.tab-fab { gap: 0; }
.tab-fab .fab {
    width: 46px; height: 38px; border-radius: var(--r-md);
    background: var(--accent-grad); color: #fff;
    display: grid; place-items: center; box-shadow: var(--shadow-accent);
}

/* ═══ SHELL — MAIN ═══════════════════════════════════════════════════ */

.app-shell { background: var(--surface); min-height: 100vh; }
/* As margens acompanham as safe areas: topbar e tab bar sao fixas e ficam por
   cima do conteudo, e no modo paisagem o notch invade as laterais. */
.main-content {
    width: 100%; max-width: var(--content-max); margin: 0 auto;
    padding-top: calc(var(--topbar-h) + env(safe-area-inset-top) + 26px);
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 32px);
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
    overflow-x: hidden;
}

@media (min-width: 960px) {
    :root { --gutter: 40px; --content-max: 1320px; }
    .topbar, .tabbar, .drawer, .drawer-scrim { display: none !important; }
    .sidebar { display: block; }
    .app-shell { padding-left: var(--sidebar-w); }
    .main-content { padding-top: 36px; padding-bottom: 60px; }
}


/* ═══ CABECALHO DE PAGINA ════════════════════════════════════════════ */

.eyebrow {
    font-family: var(--font-mono); font-size: 11px;
    letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2);
}
.eyebrow-sm { font-size: 9px; letter-spacing: .1em; }

.page-header {
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-header h1 { font-size: 30px; margin: 6px 0 0; }
/* Titulo maior, para telas que abrem com uma saudacao ou um numero de pedido */
.page-display { font-size: 34px; line-height: 1.08; margin: 8px 0 0; }
.page-amount {
    font-size: 24px; font-weight: 700; letter-spacing: -.03em;
    font-variant-numeric: tabular-nums; line-height: 1.2;
}
.section-link { font-size: 12px; font-weight: 500; }
.toggle-link {
    font-size: 13px; font-weight: 500; color: var(--accent);
    justify-content: flex-start; gap: 6px; margin-top: 6px;
}
.price { font-size: 40px; font-weight: 700; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.price-suffix { font-size: 16px; font-weight: 500; color: var(--muted-2); }
.page-header .page-lead {
    font-size: 13.5px; color: var(--muted); margin: 8px 0 0;
    max-width: 52ch; text-wrap: pretty;
}
.page-title-block { min-width: 0; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.action-separator { width: 1px; height: 24px; background: var(--stroke); margin: 0 4px; }

.section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; margin: 28px 0 12px; flex-wrap: wrap;
}
.section-head:first-child { margin-top: 0; }
.section-head h2, .section-title {
    font-size: 15px; font-weight: 600; letter-spacing: -.015em; margin: 0;
}
.section-meta {
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2);
}

.back-link {
    display: inline-flex; align-items: center; gap: 7px;
    background: transparent; border: 0; padding: 0; margin-bottom: 16px;
    color: var(--accent); font-family: var(--font); font-size: 12px;
    font-weight: 600; cursor: pointer;
}
.back-link:hover { color: var(--accent-700); }

/* legado */
.btn-back-circle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--r-md); flex-shrink: 0;
    background: var(--chip-bg); color: var(--muted); transition: all .15s ease;
}
.btn-back-circle:hover { background: var(--line); color: var(--ink); }

.breadcrumb-nav { margin-bottom: 14px; }
.breadcrumb-nav .uk-breadcrumb { margin: 0; padding: 0; }
.breadcrumb-nav .uk-breadcrumb > li > a,
.breadcrumb-nav .uk-breadcrumb > li > span {
    font-size: 12px; color: var(--muted-2);
}
.breadcrumb-nav .uk-breadcrumb > li > a:hover { color: var(--accent); }

/* ═══ CARDS ══════════════════════════════════════════════════════════ */

.card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    padding: 18px 20px;
    margin-bottom: 16px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-title { font-size: 15px; font-weight: 600; letter-spacing: -.015em; margin-bottom: 14px; }
.card-title-lg {
    font-size: 16px; font-weight: 600; letter-spacing: -.02em;
    margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft);
}

/* painel escuro — destaque de alerta / total */
.panel-ink {
    background: var(--panel-grad); color: #fff;
    border-radius: var(--r-2xl); padding: 18px 20px; margin-bottom: 16px;
}
.panel-ink .eyebrow, .panel-ink .panel-ink-sub { color: rgba(255,255,255,.55); }
.panel-ink-value {
    font-size: 32px; font-weight: 700; letter-spacing: -.035em;
    font-variant-numeric: tabular-nums; margin-top: 6px; line-height: 1;
}
.panel-ink-title {
    font-size: 21px; font-weight: 600; letter-spacing: -.02em;
    line-height: 1.25; margin-top: 10px; text-wrap: pretty;
}
.panel-ink-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.14);
}
.panel-ink-foot .panel-ink-sub { font-size: 12px; }
.panel-ink-meta { text-align: right; font-size: 11.5px; line-height: 1.6; color: rgba(255,255,255,.55); }
.panel-ink-alert { display: flex; align-items: center; gap: 8px; }
.panel-ink-alert .ic { color: #fbbf24; }
.panel-ink-alert .eyebrow { color: #fbbf24; letter-spacing: .14em; font-size: 10px; }
.btn-on-ink {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 14px; border-radius: var(--r-sm);
    background: var(--surface); color: var(--ink); border: 0;
    font-family: var(--font); font-size: 12px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
}
.btn-on-ink:hover { background: #fff; color: var(--ink); }

/* ═══ INDICADORES ════════════════════════════════════════════════════ */

.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px; margin-bottom: 8px;
}
.stat-card {
    background: var(--card-bg); border: 1px solid var(--line);
    border-radius: var(--r-xl); padding: 15px 16px 16px;
}
.stat-head { display: flex; align-items: center; gap: 9px; color: var(--accent); }
/* O icone vira uma pastilha tingida. E o ponto de cor de cada cartao, e a cor
   segue o significado do numero -- nao e enfeite. */
.stat-head .ic {
    box-sizing: content-box; padding: 7px;
    border-radius: var(--r-sm);
    background: var(--accent-soft); color: var(--accent-700);
}
.stat-card.is-warn .stat-head .ic { background: var(--warn-tint); color: var(--warn); }
.stat-card.is-ok   .stat-head .ic { background: var(--ok-tint); color: var(--ok); }
.stat-card.is-info .stat-head .ic { background: #ede9fe; color: #6d28d9; }
.stat-card.is-warn .stat-head, .stat-card.is-ok .stat-head, .stat-card.is-info .stat-head { color: inherit; }
.stat-head .eyebrow { font-size: 9px; letter-spacing: .11em; }
.stat-value {
    font-size: 32px; font-weight: 700; letter-spacing: -.04em;
    font-variant-numeric: tabular-nums; margin-top: 8px; line-height: 1;
}
.stat-value.is-money { font-size: 26px; letter-spacing: -.035em; line-height: 1.1; }
.stat-sub { font-size: 11px; color: var(--muted-2); margin-top: 4px; }
.stat-sub.is-up { color: var(--ok); }
.stat-sub.is-down { color: var(--warn); }

/* aliases legados (.kpi-*) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 20px; }
.kpi-card { background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 15px 16px 16px; }
.kpi-header { display: flex; align-items: center; gap: 7px; color: var(--accent); margin-bottom: 0; }
.kpi-icon { color: var(--accent); display: inline-flex; }
.kpi-icon.blue, .kpi-icon.green, .kpi-icon.orange, .kpi-icon.purple { background: none; color: var(--accent); width: auto; height: auto; }
.kpi-label {
    font-family: var(--font-mono); font-size: 9px; font-weight: 400;
    letter-spacing: .11em; text-transform: uppercase; color: var(--muted-2);
}
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.04em; line-height: 1; margin-top: 8px; color: var(--ink); }
.kpi-sub { font-size: 11px; color: var(--muted-2); margin-top: 4px; }
.kpi-card::after { display: none; }

/* ═══ LISTAS ═════════════════════════════════════════════════════════ */

.list-row {
    display: flex; align-items: center; gap: 14px;
    width: 100%; padding: 14px 6px; text-align: left;
    background: transparent; border: 0; border-bottom: 1px solid var(--line-list);
    border-radius: var(--r-sm); color: inherit; cursor: pointer;
    font-family: var(--font); font-size: 15px;
    transition: background .16s ease, transform .16s ease;
}
a.list-row, a.list-row:hover { color: inherit; text-decoration: none; }
.card > .list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--chip-bg); }
.list-row:active { transform: scale(.995); }
.list-row-id {
    font-family: var(--font-mono); font-size: 14px;
    color: var(--accent); min-width: 30px;
}
.list-row-body { flex: 1; min-width: 0; }
.list-row-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.list-row-sub { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }
.list-row-value { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* card de registro (pedido, dentista, tipo) */
.record-card {
    display: block; width: 100%; text-align: left; color: inherit;
    background: var(--card-bg); border: 1px solid var(--line);
    border-radius: var(--r-xl); padding: 15px 16px;
    font-family: var(--font); cursor: pointer;
    transition: background .16s ease, transform .16s ease, box-shadow .16s ease;
}
a.record-card, a.record-card:hover { color: inherit; text-decoration: none; }
.record-card:hover { box-shadow: var(--shadow-sm); }
.record-card:active { transform: scale(.995); }
.record-card-lg { border-radius: var(--r-2xl); padding: 16px; }
.record-card-lg .record-title { font-size: 18px; letter-spacing: -.02em; }
.record-card-lg .record-value { font-size: 18px; font-weight: 700; }
/* Espacamento por margem, nao por gap: .mobile-cards define display:block e
   sobrescreveria um flex aqui, derrubando o gap junto. */
.record-stack > * + * { margin-top: 10px; }
.record-row { display: flex; gap: 14px; align-items: flex-start; }
.record-main { flex: 1; min-width: 0; }
.record-title-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.record-id { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.record-title { font-size: 16px; font-weight: 600; letter-spacing: -.015em; }
.record-sub { font-size: 12px; color: var(--muted-2); margin-top: 3px; }
.record-side { text-align: right; flex: none; }
.record-value { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.record-date { font-family: var(--font-mono); font-size: 10px; color: var(--faint); margin-top: 3px; }
.record-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.record-divider { margin: 14px 0; padding: 12px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); display: flex; }
.record-metric { flex: 1; }
.record-metric-value { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.record-metric-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.record-actions { display: flex; gap: 8px; }

/* linha de informacao rotulo/valor */
.info-row {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 13px 2px; border-bottom: 1px solid var(--line-list);
}
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 13px; color: var(--muted-2); flex-shrink: 0; }
.info-value { font-size: 14.5px; font-weight: 600; text-align: right; color: var(--ink); }

/* linha de valor (composicao, totais) */
.value-row {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px;
}
.value-row:last-child { border-bottom: none; }
.value-row .value-name { display: flex; align-items: center; gap: 9px; }
.value-row .value-name .ic { color: var(--accent); }
.value-row span:last-child { font-variant-numeric: tabular-nums; font-weight: 500; }
.value-row.is-muted { color: var(--muted-2); }
.value-row.is-muted span:last-child { font-weight: 400; }
.value-row.total {
    border-top: 1px solid var(--line); border-bottom: none;
    padding-top: 16px; margin-top: 6px; align-items: baseline;
}
.value-row.total > span:first-child { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.value-row.total > span:last-child { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.value-row.saldo-restante {
    margin-top: 10px; padding: 12px 14px; border: 0; border-radius: var(--r-md);
    background: var(--accent-soft); color: var(--accent-700); font-weight: 600;
}

/* legado: item-card / etapa-row / etapa-item / mov-item */
.item-card { background: transparent; border: 0; border-bottom: 1px solid var(--line-list); border-radius: 0; padding: 14px 0; margin: 0; }
.item-card:last-child { border-bottom: none; }
.item-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.item-card-title { font-size: 15px; font-weight: 600; }
.item-card-subtitle { font-size: 12px; color: var(--muted-2); }
.item-card-divider { border-top: 1px solid var(--line-soft); margin: 10px 0; }
.item-card-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 0; font-size: 13px; color: var(--muted); }
.item-card-row strong { font-weight: 600; color: var(--ink); }
.item-card-total {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--line-soft);
    font-size: 15px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums;
}

.etapa-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.etapa-row:last-child { border-bottom: none; }
.etapa-row-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--accent); }
.etapa-row-icon.done { color: var(--accent); }
.etapa-row-nome { font-weight: 500; color: var(--ink); }
.etapa-row-valor { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); }
.etapa-row-desc { color: var(--muted-2); font-size: 12px; }
.etapa-row-date { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); white-space: nowrap; }

.etapa-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.etapa-item:last-child { border-bottom: none; }
.etapa-icon {
    width: 26px; height: 26px; border-radius: var(--r-xs); flex-shrink: 0;
    display: grid; place-items: center;
    font-family: var(--font-mono); font-size: 11px; font-weight: 500;
}
.etapa-icon.concluida { background: var(--ok-tint); color: var(--ok); }
.etapa-icon.pendente { background: var(--chip-bg); color: var(--faint); }
.etapa-icon.emandamento { background: var(--accent-soft); color: var(--accent-700); }
.etapa-info { flex: 1; min-width: 0; }
.etapa-nome { font-weight: 500; font-size: 14px; color: var(--ink); }
.etapa-valor { color: var(--muted-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ═══ TIMELINE (movimentacoes) ═══════════════════════════════════════ */

.timeline { position: relative; padding-left: 32px; }
/* a linha fica no centro do marcador: left = raio do .timeline-dot - 1px */
.timeline::before {
    content: ''; position: absolute; left: 9px; top: 8px; bottom: 14px;
    width: 2px; background: #e5e7eb;
}
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: -32px; top: 1px;
    width: 20px; height: 20px; border-radius: 50%;
    display: grid; place-items: center;
}
.timeline-dot.is-out { background: var(--warn-tint); color: var(--warn); }
.timeline-dot.is-in { background: var(--ok-tint); color: var(--ok); }
.timeline-title { font-size: 15px; font-weight: 600; }
.timeline-meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); margin-top: 3px; }

/* legado */
.mov-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.mov-item:last-child { border-bottom: none; }
.mov-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.mov-icon.entrada { background: var(--ok-tint); color: var(--ok); }
.mov-icon.saida { background: var(--warn-tint); color: var(--warn); }

/* ═══ BADGES / TAGS ══════════════════════════════════════════════════ */

.badge, .tag {
    display: inline-block; font-family: var(--font-mono);
    font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
    padding: 5px 9px; border-radius: var(--r-xs);
    background: var(--neutral-tint); color: var(--neutral-ink);
    white-space: nowrap;
}
.tag-outline { background: transparent; border: 1px solid var(--stroke); color: var(--muted); }
.tag-accent { background: var(--accent-soft); color: var(--accent-700); }
.tag-warn { background: var(--warn-tint); color: var(--warn); }
.tag-danger { background: var(--danger-tint); color: var(--danger-ink); }
.tag-muted { background: var(--chip-bg); color: var(--muted); }

.badge-recebido { background: var(--neutral-tint); color: var(--neutral-ink); }
.badge-emproducao { background: var(--accent-soft); color: var(--accent-700); }
.badge-aguardandoretorno { background: var(--warn-tint); color: var(--warn); }
.badge-concluido { background: var(--ok-tint); color: var(--ok); }
.badge-cancelado { background: var(--danger-tint); color: var(--danger-ink); }
.badge-pendente { background: var(--chip-bg); color: var(--muted); }
.badge-emandamento { background: var(--accent-soft); color: var(--accent-700); }
.badge-lab { background: var(--neutral-tint); color: var(--neutral-ink); }
.badge-dentista { background: var(--warn-tint); color: var(--warn); }
.badge-pago { background: var(--ok-tint); color: var(--ok); }
.badge-extra { background: var(--chip-bg); color: var(--muted); }

.dias-chip {
    display: inline-block; font-family: var(--font-mono);
    font-size: 10px; letter-spacing: .06em; padding: 5px 9px;
    border-radius: var(--r-xs); background: var(--neutral-tint); color: var(--neutral-ink);
    white-space: nowrap;
}
.dias-chip.ok { background: var(--neutral-tint); color: var(--neutral-ink); }
.dias-chip.warning { background: var(--warn-tint); color: var(--warn); }
.dias-chip.danger { background: var(--warn-tint); color: var(--warn); }
.dias-chip.critical { background: var(--danger-tint); color: var(--danger-ink); }

/* ═══ BOTOES ═════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 16px; border-radius: var(--r-lg);
    border: 1px solid transparent; background: transparent;
    font-family: var(--font); font-size: 14px; font-weight: 500;
    color: var(--ink); cursor: pointer; white-space: nowrap;
    transition: background .16s ease, border-color .16s ease, color .16s ease;
}
a.btn { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* enquanto o PDF e preparado para a folha de compartilhamento */
.is-loading { opacity: .6; pointer-events: none; }
.btn-primary { background: var(--accent-grad); color: #fff; font-weight: 600; box-shadow: var(--shadow-accent); }
.btn-primary:hover { background: var(--accent-grad-hover); color: #fff; }
.btn-primary:active { background: var(--accent-700); box-shadow: none; }
.btn-secondary { border-color: var(--stroke); background: var(--card-bg); }
.btn-secondary:hover { background: var(--chip-bg); border-color: #9ca3af; color: var(--ink); }
.btn-ghost { color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-700); }
.btn-danger { background: var(--danger); color: #fff; font-weight: 600; }
.btn-danger:hover { background: var(--danger-ink); color: #fff; }
.btn-danger-soft { background: var(--danger-tint); color: var(--danger-ink); }
.btn-danger-soft:hover { background: #fecaca; color: var(--danger-ink); }
.btn-block { width: 100%; }
.btn-lg { height: 52px; border-radius: var(--r-xl); font-size: 15px; font-weight: 600; }
.btn-sm { height: 38px; padding: 0 12px; border-radius: var(--r-md); font-size: 13px; }
.btn-icon { width: 44px; padding: 0; flex: none; }
.btn-icon.btn-sm { width: 38px; }
.btn-icon.btn-lg { width: 52px; }
.btn-whatsapp { border-color: var(--stroke); background: var(--card-bg); }
.btn-whatsapp:hover { background: var(--ok-tint); border-color: var(--accent-pale); color: var(--ok); }

/* ═══ CONTROLE SEGMENTADO / FILTROS ══════════════════════════════════ */

.seg { display: flex; gap: 6px; padding: 4px; background: var(--chip-bg); border-radius: var(--r-md); }
.seg-item {
    flex: 1; height: 36px; border: 0; border-radius: 9px;
    background: transparent; color: var(--muted);
    font-family: var(--font); font-size: 13px; font-weight: 500;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: color .18s ease;
}
.seg-item:hover { color: var(--ink); }
.seg-item.is-active {
    background: var(--card-bg); color: var(--ink); font-weight: 600;
    box-shadow: var(--shadow-sm);
}
/* variante com radio dentro: o proprio input marca o segmento ativo */
.seg-item:has(input:checked) {
    background: var(--card-bg); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm);
}

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filter-bar > .field { margin-bottom: 0; }
.advanced-filters {
    background: var(--card-bg); border: 1px solid var(--line);
    border-radius: var(--r-xl); padding: 16px; margin-bottom: 16px;
}
.advanced-filters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.filter-group label { display: block; margin-bottom: 4px; }

/* ═══ FORMULARIOS ════════════════════════════════════════════════════ */

.field { margin-bottom: 14px; }
.field-label, .form-label {
    display: block; font-size: 12px; font-weight: 500;
    color: var(--muted); margin-bottom: 6px;
}
.input, .form-input,
.uk-input, .uk-select, .uk-textarea {
    width: 100%; height: 46px; padding: 0 13px;
    border: 1px solid var(--stroke) !important; border-radius: var(--r-lg) !important;
    background: var(--card-bg) !important; color: var(--ink) !important;
    font-family: var(--font) !important; font-size: 14px !important;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.uk-textarea, textarea.input { height: auto; min-height: 90px; padding: 11px 13px; }
.uk-select:not([multiple]):not([size]) { height: 46px; }
.input:focus, .form-input:focus,
.uk-input:focus, .uk-select:focus, .uk-textarea:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.15) !important;
}
.input::placeholder, .uk-input::placeholder, .uk-textarea::placeholder { color: var(--faint); }
.uk-form-label { font-size: 12px !important; font-weight: 500 !important; color: var(--muted) !important; margin-bottom: 6px !important; }
.uk-form-small { height: 40px !important; font-size: 13px !important; border-radius: var(--r-md) !important; }
.uk-form-danger, .input-error { border-color: var(--danger) !important; }

.field-row { display: grid; gap: 10px; }
.field-row-2 { grid-template-columns: 1fr 1fr; }
.field-row-narrow { grid-template-columns: 1fr 110px; }
@media (max-width: 420px) { .field-row-2 { grid-template-columns: 1fr; } }

.input-icon-wrap { position: relative; display: flex; align-items: center; }
.input-icon-wrap .input, .input-icon-wrap .uk-input, .input-icon-wrap .form-input { padding-left: 38px; }
.input-icon-wrap .has-toggle { padding-right: 44px; }
.input-icon { position: absolute; left: 13px; color: var(--faint); pointer-events: none; display: inline-flex; }
.password-toggle {
    position: absolute; right: 10px; background: transparent; border: 0;
    color: var(--muted-2); cursor: pointer; display: inline-flex; padding: 6px;
}

.field-error { display: block; color: var(--danger); font-size: 12px; margin-top: 4px; font-weight: 500; }
.field-hint { display: block; color: var(--muted-2); font-size: 12px; margin-top: 4px; }

input[type="checkbox"], input[type="radio"], .uk-checkbox, .uk-radio { accent-color: var(--accent); }
.check-row {
    display: flex; gap: 12px; align-items: center; padding: 13px 4px;
    border-top: 1px solid var(--line-list); border-radius: var(--r-sm); cursor: pointer;
    transition: background .16s ease;
}
.check-row:hover { background: var(--chip-bg); }
.check-row input[type="checkbox"] { width: 19px; height: 19px; flex: none; }
.check-row-body { flex: 1; min-width: 0; }
.check-row-title { font-size: 14px; font-weight: 500; }
.check-row-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); margin-top: 2px; }
.check-row-value { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.check-row.is-done { opacity: .5; cursor: default; }
.check-row.is-done .check-row-title { text-decoration: line-through; }

/* bloco de item no formulario de pedido */
.item-block { position: relative; }
.item-block .remove-item-btn { position: absolute; top: 12px; right: 12px; }

/* etapas nos formularios de movimentacao — cada etapa e um bloco fechado, senao
   varias etapas viram uma pilha de campos soltos impossivel de ler */
.etapa-form-row {
    display: flex; flex-direction: column; gap: 8px;
    padding: 12px; margin-bottom: 10px;
    border: 1px solid var(--line); border-radius: var(--r-md);
    background: var(--surface);
}
.etapa-form-row .uk-input { width: 100%; }
.etapa-form-foot { display: flex; gap: 8px; align-items: center; }
.etapa-form-foot .uk-input { flex: 1; min-width: 0; }
.etapa-form-foot .btn { flex: none; }

/* linhas de adicionais nos formularios de pedido (coluna larga) */
.etapa-input-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.etapa-input-row input { flex: 1; min-width: 0; }
.etapa-input-row button { flex-shrink: 0; }
@media (max-width: 640px) {
    .etapa-input-row { flex-wrap: wrap; }
    .etapa-input-row input { flex: 1 1 100%; max-width: none !important; }
    .etapa-input-row input + input { flex: 1 1 auto; }
}

/* progresso de formulario em etapas */
.progress-track { height: 3px; border-radius: var(--r-pill); background: #e5e7eb; margin-top: 14px; }
.progress-fill { height: 100%; border-radius: var(--r-pill); background: var(--accent); }

/* ═══ STEPPER DE STATUS ══════════════════════════════════════════════ */

.status-stepper {
    display: grid; position: relative;
    background: var(--card-bg); border: 1px solid var(--line);
    border-radius: var(--r-xl); padding: 18px 16px 15px; margin-bottom: 20px;
}
.status-stepper::before, .status-stepper::after {
    content: ''; position: absolute; top: 29px; height: 2px;
}
.status-stepper::before { left: 12%; right: 12%; background: #e5e7eb; }
.stepper-step { display: flex; flex-direction: column; align-items: center; gap: 9px; position: relative; }
.stepper-dot {
    width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center; position: relative; z-index: 1;
    background: var(--surface); border: 2px solid var(--stroke); color: var(--faint);
    font-family: var(--font-mono); font-size: 11px;
}
.stepper-step.completed .stepper-dot { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.stepper-step.active .stepper-dot { background: var(--surface); border-color: var(--accent); color: var(--accent); }
.stepper-step.cancelled .stepper-dot { background: var(--danger-tint); border-color: var(--danger-tint); color: var(--danger-ink); }
.stepper-label { font-size: 10.5px; font-weight: 500; text-align: center; color: var(--ink-2); }
.stepper-step.active .stepper-label { font-weight: 600; color: var(--ink); }
.stepper-step.cancelled .stepper-label { color: var(--danger-ink); }
.stepper-step:not(:last-child)::after {
    content: ''; position: absolute; top: 11px; left: 50%; width: 100%; height: 2px;
    background: #e5e7eb; z-index: 0;
}
.stepper-step.completed:not(:last-child)::after { background: var(--accent); }

/* ═══ GRAFICOS ═══════════════════════════════════════════════════════ */

/* O gap e uma variavel porque barras e eixo precisam usar exatamente o mesmo
   valor — os dois sao grids de N colunas 1fr e desalinhariam se divergissem. */
.chart-card {
    --chart-gap: 12px;
    background: var(--card-bg); border: 1px solid var(--line);
    border-radius: var(--r-xl); padding: 18px 16px 12px;
}
/* Sem altura fixa: a coluna mais alta (barra + rotulo do valor) define a altura e
   o grid encosta todas no mesmo piso. Com altura fixa o rotulo estouraria o card. */
.chart-area { display: grid; align-items: end; gap: var(--chart-gap, 12px); min-height: 132px; }
.chart-col { display: flex; align-items: flex-end; justify-content: center; gap: 6px; min-width: 0; }
.chart-bars-wrap { display: flex; align-items: flex-end; justify-content: center; gap: 6px; }
.chart-bar-group { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.chart-bar { width: 12px; border-radius: 4px 4px 0 0; min-height: 2px; background: var(--accent-soft); }
.chart-bar.criados, .chart-bar.gerado, .chart-bar.is-primary { background: var(--accent); }
.chart-bar.concluidos, .chart-bar.recebido, .chart-bar.is-secondary { background: var(--accent-soft); }
.chart-axis {
    display: grid; gap: var(--chart-gap, 12px); border-top: 1px solid var(--line-soft);
    padding-top: 9px; margin-top: 10px;
}
.chart-lbl, .chart-axis > span {
    text-align: center; font-family: var(--font-mono); font-size: 10px;
    color: var(--faint); text-transform: uppercase;
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chart-axis > span.is-current, .chart-lbl.is-current { color: var(--ink); }
.chart-val {
    font-family: var(--font-mono); font-size: 10px; line-height: 1;
    color: var(--muted-2); text-align: center; white-space: nowrap;
}
.chart-val.is-zero { color: var(--faint); }
.chart-legend {
    display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
    font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em;
    text-transform: uppercase; color: var(--muted-2);
}
.chart-legend span::before {
    content: ''; display: inline-block; width: 9px; height: 9px;
    border-radius: 2px; margin-right: 6px; vertical-align: middle;
}
.chart-legend .lg-criados::before, .chart-legend .lg-gerado::before { background: var(--accent); }
.chart-legend .lg-concluidos::before, .chart-legend .lg-recebido::before { background: var(--accent-soft); }

/* barras horizontais */
.hbar-container { display: flex; flex-direction: column; gap: 14px; }
.hbar-row { display: block; }
.hbar-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 8px; }
.hbar-label { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar-meta {
    display: flex; justify-content: space-between; gap: 12px;
    margin-top: 5px; font-size: 13px; color: var(--muted-2);
}
.hbar-track { height: 8px; border-radius: var(--r-pill); background: #e5e7eb; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: var(--r-pill); background: var(--accent); min-width: 4px; }
.hbar-fill.is-alt { background: var(--accent-pale); }

/* donut (financeiro) */
.donut-container { display: flex; align-items: center; gap: 24px; padding: 6px 0; }
.donut-chart { width: 150px; height: 150px; border-radius: 50%; position: relative; flex-shrink: 0; }
.donut-center {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 86px; height: 86px; background: var(--card-bg); border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-total { font-size: 22px; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.donut-total-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-top: 3px; }
.donut-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.donut-leg-item { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.donut-leg-item strong { margin-left: auto; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.donut-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

@media (max-width: 640px) {
    .donut-container { flex-direction: column; align-items: center; }
    .donut-legend { width: 100%; }
}

/* ═══ ALERTA GLOBAL (assinatura) ═════════════════════════════════════ */

.alert-banner-critical {
    background: var(--ink); color: var(--surface);
    border: 0; border-radius: var(--r-2xl);
    padding: 16px 20px; margin-bottom: 20px;
    display: flex; align-items: center; gap: 14px;
}
.alert-banner-critical .alert-icon { color: #fbbf24; display: inline-flex; flex-shrink: 0; }
.alert-banner-critical .alert-content { flex: 1; min-width: 0; }
.alert-banner-critical .alert-title { font-size: 15px; font-weight: 600; letter-spacing: -.015em; }
.alert-banner-critical .alert-desc { font-size: 12.5px; color: rgba(255,255,255,.6); margin-top: 2px; }
.alert-banner-critical .alert-action {
    display: inline-flex; align-items: center; height: 36px; padding: 0 14px;
    border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
    font-size: 12px; font-weight: 600; white-space: nowrap; flex-shrink: 0;
}
.alert-banner-critical .alert-action:hover { background: #fff; color: var(--ink); }
@media (max-width: 640px) {
    .alert-banner-critical { flex-direction: column; align-items: flex-start; gap: 10px; }
    .alert-banner-critical .alert-content { flex: none; width: 100%; }
    .alert-banner-critical .alert-action { width: 100%; justify-content: center; }
}

/* ═══ BARRA DE ACAO FIXA (selecao) ═══════════════════════════════════ */

.action-bar {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); z-index: 995;
    width: calc(100% - 28px); max-width: 520px;
    display: none; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px; border-radius: var(--r-xl);
    background: var(--ink); color: var(--surface); box-shadow: 0 12px 30px rgba(15,23,42,.28);
}
.action-bar.is-visible { display: flex; }
.action-bar-label { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.55); }
.action-bar-value { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (min-width: 960px) { .action-bar { bottom: 24px; } }

/* legado */
.selection-bar {
    display: none; position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); z-index: 995;
    align-items: center; gap: 12px; padding: 12px 16px;
    border-radius: var(--r-xl); background: var(--ink); color: var(--surface);
    box-shadow: 0 12px 30px rgba(15,23,42,.28); font-size: 14px; white-space: nowrap;
}
.selection-bar-btn {
    height: 38px; padding: 0 14px; border: 0; border-radius: var(--r-sm);
    background: var(--surface); color: var(--ink);
    font-family: var(--font); font-size: 13px; font-weight: 600;
    cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.selection-bar-btn:hover { background: #fff; }
@media (min-width: 960px) { .selection-bar { bottom: 24px; } }

/* ═══ ESTADO VAZIO ═══════════════════════════════════════════════════ */

.empty-state { text-align: center; padding: 48px 20px; }
.empty-state .ic { color: var(--faint); font-size: 32px; }
.empty-state-title { font-size: 16px; font-weight: 600; margin-top: 14px; }
.empty-state-text { font-size: 13.5px; color: var(--muted-2); margin-top: 6px; }
.empty-state .btn { margin-top: 18px; }

/* ═══ TABELAS ════════════════════════════════════════════════════════ */

.uk-table { font-size: 14px; margin: 0; }
.uk-table th {
    font-family: var(--font-mono); font-weight: 400; font-size: 10px;
    letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2);
    padding: 12px; background: transparent; border-bottom: 1px solid var(--line);
}
.uk-table td { padding: 13px 12px; vertical-align: middle; color: var(--ink); border-bottom: 1px solid var(--line-list); }
.uk-table tbody tr:last-child td { border-bottom: none; }
.uk-table-hover tbody tr:hover { background: var(--chip-bg); }
.table-link { color: var(--accent); font-weight: 500; }
.table-link:hover { color: var(--accent-700); text-decoration: underline; }

.sortable-header {
    color: var(--muted-2); display: inline-flex; align-items: center; gap: 4px;
    cursor: pointer; white-space: nowrap;
}
.sortable-header:hover { color: var(--ink); }
.sortable-header.active { color: var(--accent); }

@media (min-width: 960px) {
    .table-sticky-header .uk-table thead th {
        position: sticky; top: 0; z-index: 10; background: var(--card-bg);
    }
}

.desktop-table { display: none !important; }
.mobile-cards { display: block; }
@media (min-width: 960px) {
    .desktop-table { display: block !important; }
    .mobile-cards { display: none !important; }
}

/* cards mobile (legado) */
.m-card {
    background: var(--card-bg); border: 1px solid var(--line);
    border-radius: var(--r-xl); padding: 15px 16px; margin-bottom: 10px;
}
.m-card-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.m-card-title { font-size: 16px; font-weight: 600; letter-spacing: -.015em; }
.m-card-body { display: grid; grid-template-columns: 1fr; gap: 2px; font-size: 13px; color: var(--muted); }
.m-card-body > div {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 6px 0; border-bottom: 1px solid var(--line-soft);
}
.m-card-body > div:last-child { border-bottom: none; }
.m-card-body dt { font-family: var(--font-mono); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.m-card-body dd { margin: 0; text-align: right; color: var(--ink); font-weight: 500; }
.m-card-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.m-card-link, .m-card-link:hover, .m-card-link:visited, .m-card-link:focus { text-decoration: none; color: inherit; display: block; }

/* ═══ DEBITOS ════════════════════════════════════════════════════════ */

.debitos-filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.debitos-filter-bar .filtro-principal { flex: 1 1 200px; min-width: 0; }
.debitos-filter-bar .filtro-secundario { flex: 0 1 170px; min-width: 0; }

.debito-card { background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--r-xl); margin-bottom: 12px; overflow: hidden; }
/* O cabecalho e um link para o pedido: alvo grande, com realce no hover. */
a.debito-card-header, a.debito-card-header:hover { color: inherit; text-decoration: none; }
.debito-card-header {
    padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    transition: background .16s ease;
}
a.debito-card-header:hover { background: var(--chip-bg); }
a.debito-card-header.debito-card-header--pago:hover { background: #a7f3d0; }
.debito-card-header--pago { background: var(--ok-tint); border-bottom-color: transparent; }
.debito-pedido-link { font-family: var(--font-mono); font-size: 14px; font-weight: 500; color: var(--accent); }
.debito-card-meta {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 0;
    padding: 12px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13px; color: var(--muted);
}
.debito-card-meta dt { font-family: var(--font-mono); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.debito-card-meta dd { margin: 0 0 4px; color: var(--ink); }
.debito-card-body { padding: 4px 16px 12px; }
.debito-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.debito-row:last-child { border-bottom: none; }
.debito-row-check { width: 26px; flex-shrink: 0; }
.debito-row-content { flex: 1; min-width: 0; }
.debito-row-desc { font-size: 14px; color: var(--ink); font-weight: 500; }
.debito-row-details { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 13px; }
.debito-row-data { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.debito-pago-data { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); margin-left: 2px; }
.debito-row--pago { opacity: .5; }
.debito-row--pago .debito-row-desc { text-decoration: line-through; }
.debito-row--adiantamento .debito-row-desc { color: var(--ok); font-size: 13.5px; }

@media (max-width: 640px) {
    /* Em coluna, flex-grow passa a agir na ALTURA: sem flex:none o campo
       colapsa e fica achatado. A largura vem do stretch do container. */
    .debitos-filter-bar { flex-direction: column; align-items: stretch; }
    .debitos-filter-bar .uk-select,
    .debitos-filter-bar .uk-button,
    .debitos-filter-bar .btn { flex: none; width: 100%; max-width: none; }
    .debito-row-details { flex-wrap: wrap; gap: 6px; }
}

/* ═══ FINANCEIRO ═════════════════════════════════════════════════════ */

.fin-filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fin-period-buttons { display: flex; gap: 6px; padding: 4px; background: var(--chip-bg); border-radius: var(--r-md); flex-shrink: 0; }
.fin-period-btn {
    flex: 1; height: 36px; padding: 0 14px; border: 0; border-radius: 9px;
    background: transparent; color: var(--muted);
    font-family: var(--font); font-size: 13px; font-weight: 500;
    display: inline-flex; align-items: center; justify-content: center;
    white-space: nowrap; transition: color .18s ease;
}
.fin-period-btn:hover { color: var(--ink); }
.fin-period-btn.active { background: var(--card-bg); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.fin-custom-period { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.fin-custom-period .uk-input { max-width: 160px; }
.fin-custom-period .uk-select { max-width: 210px; }

.fin-list-mobile { display: none; }
.fin-pag-item { padding: 12px 0; border-bottom: 1px solid var(--line-list); font-size: 13.5px; }
.fin-pag-item:last-child { border-bottom: none; }
.fin-pag-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fin-pag-bottom { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }

@media (max-width: 640px) {
    .fin-filter-bar { flex-direction: column; align-items: stretch; gap: 10px; }
    .fin-period-buttons { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .fin-custom-period { margin-left: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .fin-custom-period span { display: none; }
    .fin-custom-period .uk-input, .fin-custom-period .uk-select { width: 100%; max-width: none; }
    .fin-custom-period .uk-button, .fin-custom-period .btn { grid-column: 1 / -1; width: 100%; max-width: none; }
    .fin-table-desktop { display: none; }
    .fin-list-mobile { display: block; }
}

/* ═══ USUARIOS ═══════════════════════════════════════════════════════ */

.user-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.user-card { margin-bottom: 0; }
.user-card-avatar {
    width: 40px; height: 40px; border-radius: 13px; flex-shrink: 0;
    background: var(--ink); color: var(--surface);
    display: grid; place-items: center; font-size: 16px; font-weight: 600;
}
.user-card-avatar.inactive { background: var(--chip-bg); color: var(--faint); }
@media (max-width: 640px) { .user-cards-grid { grid-template-columns: 1fr; } }

/* ═══ LOGIN / AUTENTICACAO ═══════════════════════════════════════════ */

.login-body {
    background: var(--bg); min-height: 100vh;
    display: flex; align-items: center; justify-content: center; padding: 24px 20px;
}
.login-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 22px; padding: 32px 28px; width: 100%; max-width: 420px;
    box-shadow: 0 24px 60px rgba(15,23,42,.10);
}
.login-card-centered { text-align: center; }
.login-logo-circle {
    width: 46px; height: 46px; border-radius: var(--r-lg); margin: 0 auto 18px;
    background: var(--accent-grad); color: #fff; display: grid; place-items: center;
}
/* Marca cheia no topo do card (login e criacao de conta) */
.login-logo { display: block; height: 84px; width: auto; margin: 0 auto 20px; }
.login-heading { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin: 0; }
.login-subheading { font-size: 13.5px; color: var(--muted); margin: 8px 0 24px; }
.login-card .subtitle { font-size: 13.5px; color: var(--muted); margin-bottom: 24px; }
.btn-login {
    width: 100%; height: 50px; border: 0; border-radius: var(--r-xl);
    background: var(--accent-grad); color: #fff; box-shadow: var(--shadow-accent);
    font-family: var(--font); font-size: 15px; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-login:hover { background: var(--accent-grad-hover); color: #fff; }
.login-links {
    margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-list);
    font-size: 13px; color: var(--muted); text-align: center;
}
.login-links a { font-weight: 500; }
.form-group { margin-bottom: 16px; }
.password-rules { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.rule { font-size: 12px; color: var(--muted-2); transition: color .2s; }
.rule .rule-icon { font-size: 7px; margin-right: 5px; vertical-align: middle; }
.rule.valid, .rule.valid .rule-icon { color: var(--ok); }
.rule.invalid, .rule.invalid .rule-icon { color: var(--danger); }
.password-match { display: block; font-size: 12px; margin-top: 6px; min-height: 1em; }
.password-match.match { color: var(--ok); }
.password-match.no-match { color: var(--danger); }
.form-hint-link { font-size: 12px; font-weight: 500; }
.alert-error, .alert-success {
    border-radius: var(--r-md); padding: 12px 14px;
    margin-bottom: 18px; font-size: 13.5px;
}
.alert-error { background: var(--danger-tint); color: var(--danger-ink); }
.alert-success { background: var(--ok-tint); color: var(--ok); }

/* topo e rodape da area publica */
.login-topbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.login-topbar-inner {
    max-width: 1100px; margin: 0 auto; padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.login-topbar-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.login-topbar-brand:hover { color: var(--ink); }
/* O logo tem cores proprias — no tema claro entra sem filtro. */
.login-topbar-name { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.login-topbar-link { font-size: 13px; color: var(--muted); font-weight: 500; }
/* Fundo pontilhado da area publica. O ponto e um radial-gradient repetido:
   nao carrega imagem e acompanha o token de cor. */
.login-page {
    min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column;
    background:
        radial-gradient(circle, rgba(17,24,39,.07) 1px, transparent 1px) 0 0 / 22px 22px,
        var(--bg);
}

/* ── Login: duas colunas no desktop, so o formulario no celular ─────────── */
.auth-split {
    display: grid; grid-template-columns: 1fr; gap: 48px;
    width: 100%; max-width: 1180px; align-items: center;
}
/* A coluna de marca so existe onde ha largura para ela; no celular o
   formulario ocupa a tela e a marca vira o selo no topo do proprio card. */
.auth-brand { display: none; }
@media (min-width: 1024px) {
    .auth-split { grid-template-columns: 1.05fr .95fr; gap: 72px; }
    .auth-brand { display: block; }
}

.auth-brand-head { display: flex; align-items: center; gap: 14px; margin-bottom: 34px; }
.auth-mark {
    display: grid; place-items: center; flex: none; overflow: hidden;
    width: 64px; height: 64px;
    border-radius: var(--r-xl);
    background: var(--accent-grad);
    box-shadow: var(--shadow-accent);
}
/* O logo tem cor propria; dentro do selo ele vira solido claro.
   O zoom existe porque o SVG guarda o desenho dentro de uma moldura vazia:
   a tinta ocupa 46% da altura do viewBox, entao `contain` sozinho encaixa o
   vazio junto e a marca sai pequena. Medido no PNG embutido, o desenho ja
   esta centrado no viewBox (desvio de 0.06%), por isso o ajuste e zero --
   se algum dia parecer torto, e so mexer no --logo-nudge. */
.auth-mark {
    --logo-zoom: 1.45;   /* preenche ~67% do quadrado */
    /* Correcao optica, nao geometrica: o desenho esta centrado no viewBox
       (0.06% de desvio medido), mas tem a base mais pesada que o topo, o que
       o faz parecer caido. O -3% devolve o equilibrio visual. */
    --logo-nudge: -5%;
}
.auth-mark img {
    width: 100%; height: 100%; object-fit: contain;
    filter: brightness(0) invert(1);
    transform: translateY(var(--logo-nudge)) scale(var(--logo-zoom));
}
.auth-mark-sm { width: 34px; height: 34px; border-radius: var(--r-md); box-shadow: none; }
.auth-mark-lg { width: 88px; height: 88px; border-radius: 22px; margin: 0 auto 24px; }
.auth-brand-name { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.auth-brand-tag {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
    text-transform: uppercase; color: var(--muted-2); margin-top: 3px;
}

.auth-headline { font-size: 46px; font-weight: 700; letter-spacing: -.035em; line-height: 1.08; margin: 0; }
.auth-headline em { font-style: normal; color: var(--accent); }
.auth-lead { font-size: 15.5px; line-height: 1.6; color: var(--muted); margin: 20px 0 0; max-width: 46ch; }

.auth-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.auth-chip {
    display: inline-flex; align-items: center; gap: 8px;
    height: 40px; padding: 0 14px; border-radius: var(--r-md);
    background: var(--card-bg); border: 1px solid var(--line);
    font-size: 13.5px; font-weight: 500; color: var(--ink);
}
.auth-chip .ic { color: var(--accent); }

.auth-facts {
    display: flex; flex-wrap: wrap; gap: 44px;
    margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line);
}
.auth-fact-num { font-size: 26px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.auth-fact-label {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em;
    text-transform: uppercase; color: var(--muted-2); margin-top: 6px;
}

/* No celular o formulario nao usa cartao: assenta direto sobre o fundo. */
.auth-form-panel { width: 100%; max-width: 460px; margin: 0 auto; }
@media (min-width: 1024px) {
    .auth-form-panel {
        margin: 0 0 0 auto;
        background: var(--card-bg);
        border: 1px solid var(--line);
        border-radius: 20px;
        padding: 36px 34px;
        box-shadow: var(--shadow-lg);
    }
    .auth-form-panel .auth-mark-lg { display: none; }
}

.auth-req { color: var(--danger); }
.auth-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin: 16px 0 20px;
}
.auth-remember {
    display: inline-flex; align-items: center; gap: 9px;
    font-size: 13.5px; color: var(--ink-2); cursor: pointer;
}
.auth-remember input { width: 18px; height: 18px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 13.5px; color: var(--muted); }
.auth-secure {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    margin-top: 16px; font-size: 12px; color: var(--faint);
}
.login-container { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login-footer {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px 18px;
    width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 24px;
    color: var(--faint); font-size: 12px; font-family: var(--font-mono);
}
.login-footer-links { display: flex; gap: 18px; }
@media (max-width: 640px) { .login-footer { justify-content: center; text-align: center; } }
.login-footer a { color: var(--muted-2); }

/* ═══ SKELETON ═══════════════════════════════════════════════════════ */

.skeleton-container { padding: 18px 20px; }
.skeleton-line {
    height: 14px; margin-bottom: 12px; border-radius: 6px;
    background: linear-gradient(90deg, var(--line-soft) 25%, var(--line) 50%, var(--line-soft) 75%);
    background-size: 200% 100%; animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-line.long { width: 90%; }
.skeleton-row { display: flex; gap: 12px; margin-bottom: 12px; }
.skeleton-row .skeleton-line { flex: 1; margin-bottom: 0; }
@keyframes skeleton-pulse { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ═══ COLAPSAVEL ═════════════════════════════════════════════════════ */

.collapsible-toggle {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; user-select: none; margin: 0;
}
.collapsible-toggle .chevron-icon { transition: transform .2s ease; color: var(--faint); }
.collapsible-toggle.collapsed .chevron-icon { transform: rotate(-90deg); }
.collapsible-body { overflow: hidden; transition: max-height .3s ease, opacity .2s ease; max-height: 2000px; opacity: 1; }
.collapsible-body.collapsed { max-height: 0; opacity: 0; margin-top: 0 !important; padding-top: 0 !important; }

/* ═══ UIKIT — sobrescritas ═══════════════════════════════════════════ */

.uk-button {
    height: 44px; padding: 0 16px;
    border-radius: var(--r-lg) !important;
    font-family: var(--font) !important; font-size: 14px !important;
    font-weight: 500 !important; text-transform: none !important;
    line-height: 42px !important; transition: all .16s ease !important;
}
.uk-button-primary { background: var(--accent) !important; color: var(--surface) !important; border: 0 !important; font-weight: 600 !important; }
.uk-button-primary:hover { background: var(--accent-600) !important; }
.uk-button-success { background: var(--accent) !important; color: var(--surface) !important; border: 0 !important; font-weight: 600 !important; }
.uk-button-success:hover { background: var(--accent-600) !important; }
.uk-button-danger { background: var(--danger) !important; color: #fff !important; border: 0 !important; }
.uk-button-danger:hover { background: var(--danger-ink) !important; }
.uk-button-default {
    background: var(--card-bg) !important; color: var(--ink) !important;
    border: 1px solid var(--stroke) !important;
}
.uk-button-default:hover { background: var(--chip-bg) !important; border-color: #9ca3af !important; }
.uk-button-text { color: var(--accent) !important; }
.uk-button-small { height: 38px; line-height: 36px !important; font-size: 13px !important; padding: 0 12px; border-radius: var(--r-md) !important; }
.uk-button-link { color: var(--accent) !important; }

.whatsapp-link { color: var(--accent) !important; }
.whatsapp-link:hover { color: var(--accent-700) !important; }
.whatsapp-btn { background: var(--card-bg) !important; color: var(--ink) !important; border: 1px solid var(--stroke) !important; }
.whatsapp-btn:hover { background: var(--ok-tint) !important; color: var(--ok) !important; border-color: var(--accent-pale) !important; }

.uk-alert { border-radius: var(--r-md) !important; font-size: 14px; }
.uk-alert-success { background: var(--ok-tint) !important; color: var(--ok) !important; }
.uk-alert-danger { background: var(--danger-tint) !important; color: var(--danger-ink) !important; }
.uk-alert-warning { background: var(--warn-tint) !important; color: var(--warn) !important; }

.uk-notification { z-index: 1050; }
.uk-notification-message {
    border-radius: var(--r-md) !important; font-family: var(--font);
    font-size: 14px; box-shadow: var(--shadow-lg) !important;
    background: var(--ink); color: var(--surface);
}
.uk-notification-message-success { background: var(--ok) !important; color: #fff !important; }
.uk-notification-message-danger { background: var(--danger) !important; color: #fff !important; }
.uk-notification-close { color: inherit !important; }

.uk-modal-dialog { border-radius: var(--r-2xl); background: var(--surface); }
.uk-modal-title { font-size: 20px; font-weight: 700; letter-spacing: -.025em; }
.uk-dropdown, .uk-drop {
    border-radius: var(--r-xl); border: 1px solid var(--line);
    background: var(--card-bg); box-shadow: var(--shadow-lg); padding: 8px;
}
.uk-dropdown-nav > li > a, .uk-nav-default > li > a {
    color: var(--ink); font-size: 14px; padding: 10px 12px; border-radius: var(--r-sm);
    display: flex; align-items: center; gap: 10px;
}
.uk-dropdown-nav > li > a:hover, .uk-nav-default > li > a:hover { background: var(--chip-bg); color: var(--ink); }
.uk-dropdown-nav > li.is-danger > a { color: var(--danger-ink); }
.uk-dropdown-nav > li.is-danger > a:hover { background: var(--danger-tint); }
.uk-hr, hr.uk-divider-small::after { border-color: var(--line); }
.uk-tooltip { background: var(--ink); border-radius: var(--r-xs); font-family: var(--font); font-size: 12px; }
.uk-badge { background: var(--accent); }
.uk-label { background: var(--accent); border-radius: var(--r-xs); text-transform: uppercase; font-family: var(--font-mono); }
.uk-pagination > * > * { color: var(--muted); border-radius: var(--r-sm); }
.uk-pagination > .uk-active > * { color: var(--accent); font-weight: 600; }

/* ═══ UTILITARIOS ════════════════════════════════════════════════════ */

.money { font-weight: 600; font-variant-numeric: tabular-nums; }
.money-danger { color: var(--warn); }
.money-success { color: var(--ok); }
.num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 14px; }
.text-md { font-size: 15px; }
.text-muted { color: var(--muted-2); }
.text-faint { color: var(--faint); }
.text-label { font-family: var(--font-mono); font-size: 10px; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); }
.text-value { font-size: 14px; font-weight: 500; color: var(--ink); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); }
.text-ok { color: var(--ok); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
/* Empilhado, o gap e a unica coisa separando duas secoes: o margin-top do
   .section-head some porque ele e :first-child dentro da coluna do grid. */
@media (max-width: 960px) { .dash-grid { grid-template-columns: 1fr; gap: 30px; } }

.stack-sm > * + * { margin-top: 8px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.with-icon { display: inline-flex; align-items: center; gap: 8px; }

/* ═══ RESPONSIVO ═════════════════════════════════════════════════════ */

@media (max-width: 640px) {
    .page-header { align-items: flex-start; }
    .page-header h1 { font-size: 28px; }
    /* No celular as acoes ocupam a linha inteira; no desktop cada botao fica com
       a largura do seu conteudo. Botao de icone nunca estica. */
    .page-actions { width: 100%; }
    .page-actions .btn:not(.btn-icon),
    .page-actions .uk-button:not(.btn-icon) { flex: 1 1 auto; min-width: 0; }
    .action-separator { display: none; }
    .card { padding: 15px 16px; }
    /* busca ocupa a linha inteira e os botoes dividem a de baixo, senao o ultimo
       botao cai sozinho na esquerda com largura de conteudo */
    .filter-bar > .input-icon-wrap { flex: 1 1 100%; }
    .filter-bar > .btn:not(.btn-icon) { flex: 1 1 0; }
    .chart-card { --chart-gap: 6px; padding: 16px 12px 10px; }
    .chart-lbl, .chart-axis > span { font-size: 9px; }
    .stat-grid, .kpi-grid { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 28px; }
    .stat-value.is-money, .kpi-value { font-size: 23px; }
    .uk-table { font-size: 13px; }
    .uk-table th, .uk-table td { padding: 10px 8px; }
    .advanced-filters-grid { grid-template-columns: 1fr; }
}

@media (max-width: 959px) {
    .detail-main, .detail-sidebar { width: 100% !important; }
    .detail-sidebar { margin-top: 4px; }
}

@media (min-width: 960px) {
    /* ── Escala tipografica do desktop ────────────────────────────────
       Os tamanhos base sao calibrados para o celular, onde a tela e estreita
       e a leitura e proxima. No monitor eles ficam pequenos demais para a
       area disponivel. Tudo que cresce esta AQUI, num bloco so: nenhuma tela
       ajusta tamanho por conta propria, senao a escala se perde.
       ───────────────────────────────────────────────────────────────── */
    body { font-size: 16px; }

    /* titulos e cabecalhos */
    .page-header h1 { font-size: 34px; }
    .page-display { font-size: 40px; }
    .page-amount { font-size: 28px; }
    .page-lead { font-size: 15px; }
    h2 { font-size: 24px; }
    h3 { font-size: 20px; }
    .section-head h2, .section-title { font-size: 17px; }
    .section-meta { font-size: 11px; }
    .section-link { font-size: 13px; }
    .eyebrow { font-size: 12px; }
    .eyebrow-sm { font-size: 10px; }
    .card-title { font-size: 16px; }
    .card-title-lg { font-size: 18px; }

    /* superficies com mais respiro */
    .card { padding: 20px 24px; }
    .stat-card { padding: 18px 20px 20px; }

    /* indicadores */
    .stat-value { font-size: 38px; }
    .stat-value.is-money { font-size: 30px; }
    .stat-sub { font-size: 12.5px; }
    .kpi-value { font-size: 36px; }
    .kpi-label { font-size: 10px; }
    .kpi-sub { font-size: 12.5px; }
    .panel-ink-value { font-size: 38px; }
    .panel-ink-title { font-size: 24px; }
    .panel-ink-meta { font-size: 12.5px; }

    /* linhas de dado */
    .info-label { font-size: 14px; }
    .info-value { font-size: 15.5px; }
    .value-row { font-size: 15px; }
    .value-row.total > span:first-child { font-size: 14px; }
    .value-row.total > span:last-child { font-size: 30px; }
    .list-row-id { font-size: 15px; }
    .list-row-title { font-size: 16px; }
    .list-row-sub { font-size: 12.5px; }
    .list-row-value { font-size: 16px; }
    .record-id { font-size: 13px; }
    .record-title { font-size: 17px; }
    .record-sub { font-size: 13px; }
    .record-value { font-size: 17px; }
    .record-date { font-size: 11px; }
    .record-card-lg .record-title, .record-card-lg .record-value { font-size: 20px; }
    .record-metric-value { font-size: 17px; }
    .record-metric-label { font-size: 10px; }
    .check-row-title { font-size: 15px; }
    .check-row-meta { font-size: 11.5px; }
    .check-row-value { font-size: 16px; }
    .debito-pedido-link { font-size: 15px; }
    .debito-row-desc { font-size: 15px; }
    .debito-card-meta { font-size: 14px; }

    /* tabelas */
    .uk-table { font-size: 15px; }
    .uk-table th { font-size: 11px; padding: 14px 12px; }
    .uk-table td { padding: 15px 12px; }

    /* etapas, timeline e stepper */
    .etapa-row { font-size: 14.5px; }
    .etapa-nome { font-size: 15px; }
    .etapa-valor { font-size: 13.5px; }
    .timeline-title { font-size: 16.5px; }
    .timeline-meta { font-size: 12.5px; }
    .timeline { padding-left: 34px; }
    .timeline::before { left: 10px; }
    .timeline-dot { left: -34px; width: 22px; height: 22px; }
    .stepper-label { font-size: 11.5px; }

    /* graficos */
    .hbar-head { font-size: 15px; }
    .hbar-meta { font-size: 14px; }
    .chart-val { font-size: 11px; }
    .chart-lbl, .chart-axis > span { font-size: 11px; }

    /* controles */
    .btn { height: 46px; font-size: 15px; }
    .btn-sm { height: 40px; font-size: 14px; }
    .btn-lg { height: 54px; font-size: 16px; }
    .btn-icon { width: 46px; }
    .btn-icon.btn-sm { width: 40px; }
    .btn-icon.btn-lg { width: 54px; }
    .uk-button { height: 46px; line-height: 44px !important; font-size: 15px !important; }
    .uk-button-small { height: 40px; line-height: 38px !important; font-size: 14px !important; }
    .seg-item, .fin-period-btn { height: 40px; font-size: 14px; }
    .badge, .tag, .dias-chip { font-size: 11px; }

    /* formularios */
    .field-label, .form-label, .uk-form-label { font-size: 13px !important; }
    .input, .form-input, .uk-input, .uk-select, .uk-textarea { height: 48px; font-size: 15px !important; }
    .uk-select:not([multiple]):not([size]) { height: 48px; }
    .uk-textarea, textarea.input { height: auto; }
    .uk-form-small { height: 42px !important; font-size: 14px !important; }
    .field-hint, .field-error { font-size: 13px; }

    /* menu lateral */
    .nav-group { font-size: 11px; }
    .nav-link { font-size: 15px; }
    .nav-foot-name { font-size: 15px; }
    .nav-foot-sub { font-size: 12px; }

    /* estados e utilitarios */
    .empty-state-title { font-size: 18px; }
    .empty-state-text { font-size: 15px; }
    .text-xs { font-size: 12px; }
    .text-sm { font-size: 14px; }
    .text-base { font-size: 15px; }
    .text-md { font-size: 16px; }
    .text-label { font-size: 11px; }
    .text-value { font-size: 15px; }
    .toggle-link { font-size: 14px; }
    .login-heading { font-size: 28px; }
    .login-subheading { font-size: 15px; }
}

/* ═══ IMPRESSAO ══════════════════════════════════════════════════════ */

@media print {
    .topbar, .tabbar, .sidebar, .drawer, .drawer-scrim,
    .breadcrumb-nav, .page-actions, .action-bar, .selection-bar,
    .nav-badge, .back-link {
        display: none !important;
    }
    body { background: #fff !important; color: #000 !important; font-size: 11pt; }
    .app-shell { padding-left: 0 !important; }
    .main-content { padding: 0 !important; max-width: none !important; }
    .card, .record-card, .stat-card, .chart-card {
        border: 1px solid #ddd !important; box-shadow: none !important;
        break-inside: avoid; page-break-inside: avoid;
    }
    .panel-ink, .alert-banner-critical {
        background: #fff !important; color: #000 !important; border: 1px solid #000 !important;
    }
    .panel-ink .eyebrow, .panel-ink .panel-ink-sub { color: #444 !important; }
    .page-header { border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 16px; }
    .badge, .tag, .dias-chip {
        border: 1px solid currentColor !important; background: transparent !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .stepper-dot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .detail-sidebar form, .detail-sidebar button { display: none !important; }
}

/* ===== DOCUMENTOS LEGAIS (Termos / Privacidade) ===== */
/* Paginas longas de leitura: largura limitada e respiro entre blocos, dentro do
   _LoginLayout (sao publicas, lidas antes do cadastro). */
.legal-doc {
    max-width: 760px;
    margin: 0 auto;
    padding: 8px 4px 40px;
    text-align: left;
}
.legal-doc h1 { font-size: 26px; font-weight: 700; color: var(--ink); margin: 0 0 4px; }
.legal-doc h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    margin: 28px 0 8px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
}
.legal-doc h2:first-of-type { border-top: 0; padding-top: 0; }
.legal-doc p { font-size: 14.5px; line-height: 1.7; color: var(--muted); margin: 0 0 12px; }
.legal-doc ul { margin: 0 0 12px; padding-left: 20px; }
.legal-doc li { font-size: 14.5px; line-height: 1.7; color: var(--muted); margin-bottom: 6px; }
.legal-doc strong { color: var(--ink); font-weight: 600; }
.legal-doc a { color: var(--accent); text-decoration: none; }
.legal-doc a:hover { text-decoration: underline; }
.legal-version { font-size: 12.5px; color: var(--faint); margin-bottom: 24px !important; }

/* Aviso de minuta: precisa ser impossivel de ignorar enquanto o texto nao passar
   por revisao juridica. Remover este bloco quando o texto for aprovado. */
.legal-review-note {
    background: var(--warn-tint);
    border-left: 3px solid var(--warn);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 24px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink);
}

.legal-foot {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid var(--line-soft);
    font-size: 13.5px;
}

/* ===== ACEITE DOS TERMOS NO CADASTRO ===== */
.terms-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 4px 0 18px;
    text-align: left;
}
.terms-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}
.terms-check label { font-size: 12.5px; line-height: 1.55; color: var(--muted); cursor: pointer; }
.terms-check a { color: var(--accent); text-decoration: none; }
.terms-check a:hover { text-decoration: underline; }

/* ===== CONTAGEM REGRESSIVA DO TRIAL ===== */
/* Discreto durante quase todo o periodo e chamativo nos ultimos dois dias, que
   e quando o aviso realmente precisa ser notado. */
.trial-countdown {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    background: var(--accent-pale);
    border: 1px solid var(--accent-soft);
    border-radius: 10px;
    padding: 12px 16px;
    margin: 20px 0 4px;
}
.trial-countdown-icon { display: inline-flex; color: var(--accent); flex-shrink: 0; }
.trial-countdown-dias { font-size: 14px; font-weight: 700; color: var(--ink); }
.trial-countdown-data { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.trial-countdown.is-urgent {
    background: var(--warn-tint);
    border-color: var(--warn);
}
.trial-countdown.is-urgent .trial-countdown-icon,
.trial-countdown.is-urgent .trial-countdown-dias { color: var(--warn); }
