/* =====================================================================
   Design system — Carbon Suite
   Compartilhado entre os sistemas. Só as cores da marca vêm do whitelabel.
   ===================================================================== */

/* ---------- 1. Tipografia local ---------- */
@font-face {
    font-family: 'InterVar';
    src: url('../fonts/inter-var.woff2') format('woff2-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrainsMonoVar';
    src: url('../fonts/jetbrains-mono-var.woff2') format('woff2-variations');
    font-weight: 100 800;
    font-style: normal;
    font-display: swap;
}

/* ---------- 2. Tokens ---------- */
:root {
    --font-sans: 'InterVar', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrainsMonoVar', ui-monospace, SFMono-Regular, Menlo, monospace;

    --r-xs: 6px;
    --r-sm: 9px;
    --r-md: 13px;
    --r-lg: 18px;
    --r-xl: 26px;

    --sidebar-w: 258px;
    --sidebar-w-collapsed: 74px;
    --topbar-h: 64px;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, .09), 0 2px 6px -2px rgba(16, 24, 40, .05);
    --shadow-lg: 0 16px 34px -8px rgba(16, 24, 40, .16), 0 6px 14px -6px rgba(16, 24, 40, .08);
    --shadow-brand: 0 8px 20px -6px rgba(var(--brand-rgb), .38);

    --ease: cubic-bezier(.4, 0, .2, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --fast: .16s;
    --normal: .26s;
    --slow: .42s;

    /* superfícies — claro */
    --bg:            #f4f6f9;
    --bg-subtle:     #eef1f6;
    --surface:       #ffffff;
    --surface-2:     #f8fafc;
    --surface-hover: #f1f5f9;
    --border:        #e4e8ef;
    --border-strong: #d3d9e3;
    --text:          #0f172a;
    --text-muted:    #64748b;
    --text-faint:    #94a3b8;

    --ok:   #15803d;  --ok-bg:   #dcfce7;
    --warn: #b45309;  --warn-bg: #fef3c7;
    --bad:  #b91c1c;  --bad-bg:  #fee2e2;
    --info: #0369a1;  --info-bg: #e0f2fe;
    --neutral-bg: #eef2f7;
}

[data-bs-theme="dark"] {
    --bg:            #0a0f1a;
    --bg-subtle:     #0d1424;
    --surface:       #111a2b;
    --surface-2:     #16203380;
    --surface-hover: #1b2740;
    --border:        #1f2c45;
    --border-strong: #2c3d5c;
    --text:          #e8edf6;
    --text-muted:    #93a3bd;
    --text-faint:    #6b7d99;

    --ok:   #4ade80;  --ok-bg:   #052e1a;
    --warn: #fbbf24;  --warn-bg: #3a2606;
    --bad:  #f87171;  --bad-bg:  #3d1213;
    --info: #38bdf8;  --info-bg: #062c43;
    --neutral-bg: #1a2437;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
    --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, .55);
    --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, .7);
}

/* ---------- 3. Base ---------- */
* { -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-sans);
    font-size: .9375rem;
    line-height: 1.55;
    background: var(--bg);
    color: var(--text);
    letter-spacing: -.005em;
    font-feature-settings: 'cv05' 1, 'ss03' 1;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 640;
    letter-spacing: -.021em;
    color: var(--text);
}

a { color: var(--brand); text-decoration: none; transition: color var(--fast) var(--ease); }
a:hover { color: var(--brand-dark); }

.num, .tabular { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.mono { font-family: var(--font-mono); font-size: .86em; letter-spacing: -.02em; }

.text-muted   { color: var(--text-muted) !important; }
.text-faint   { color: var(--text-faint) !important; }
.text-brand   { color: var(--brand) !important; }
/* Tons de texto na mesma escala dos badges e ícones (ok/warn/bad/info), para
   um número em atraso poder ficar vermelho sem virar um badge inteiro. */
.text-ok      { color: var(--ok) !important; }
.text-warn    { color: var(--warn) !important; }
.text-bad     { color: var(--bad) !important; }
.text-info    { color: var(--info) !important; }
.fw-medium    { font-weight: 520; }
.fs-tiny      { font-size: .75rem; }
.fs-small     { font-size: .8125rem; }
.lh-tight     { line-height: 1.28; }
/* text-truncate dentro de flex só funciona se o item puder encolher */
.min-w-0      { min-width: 0; }

::selection { background: rgba(var(--brand-rgb), .18); }

/* Scrollbar discreta */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

/* ---------- 4. Estrutura ---------- */
.app-shell { min-height: 100vh; }

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width var(--normal) var(--ease), transform var(--normal) var(--ease);
}

.app-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--normal) var(--ease);
}

body.sidebar-collapsed .app-sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .app-main    { margin-left: var(--sidebar-w-collapsed); }
/* Recolhida = só ícones.
   Antes isto era `opacity: 0`, que esconde o texto mas mantém a largura dele —
   o resultado era um menu de 74px com nomes cortados no meio, em vez de ícones.
   `display: none` tira do fluxo e é o que faz a barra virar de fato uma coluna
   de ícones. */
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-badge { display: none; }

/* O título de seção vira um traço: sem ele os grupos viram um bloco só. */
body.sidebar-collapsed .nav-section-title {
    font-size: 0; padding: 0; margin: .6rem .55rem .35rem;
    border-top: 1px solid var(--border);
}
body.sidebar-collapsed .sidebar-nav .nav-link,
body.sidebar-collapsed .sidebar-foot .btn { justify-content: center; padding-inline: 0; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: 0; }
/* A seta aponta para fora quando recolhida: é o convite para reabrir. */
body.sidebar-collapsed .sidebar-foot .btn i { transform: rotate(180deg); }

/* Recolhida, o nome de cada item vive no atributo `title` do link (posto pela
   partial da barra lateral). Balão em CSS seria recortado pelo
   `overflow-x: hidden` desta mesma navegação. */

/* Marca */
.sidebar-brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 0 1.1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
}
.brand-mark {
    width: 36px; height: 36px;
    flex-shrink: 0;
    border-radius: var(--r-sm);
    display: grid; place-items: center;
    background: linear-gradient(140deg, var(--brand), var(--brand-dark));
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: -.03em;
    box-shadow: var(--shadow-brand);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.brand-text { min-width: 0; transition: opacity var(--fast) var(--ease); }
.brand-text strong { display: block; font-size: .9rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.brand-text span { display: block; font-size: .7rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Navegação */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .85rem .65rem 1.25rem;
}
.nav-section-title {
    font-size: .66rem;
    font-weight: 660;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-faint);
    padding: .5rem .7rem .35rem;
    margin-top: .55rem;
    white-space: nowrap;
    transition: opacity var(--fast) var(--ease);
}
.sidebar-nav .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: .72rem;
    padding: .56rem .7rem;
    margin-bottom: 2px;
    border-radius: var(--r-sm);
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.sidebar-nav .nav-link i { font-size: 1.06rem; flex-shrink: 0; width: 20px; text-align: center; transition: transform var(--normal) var(--ease-out); }
.sidebar-nav .nav-link:hover { background: var(--surface-hover); color: var(--text); }
.sidebar-nav .nav-link:hover i { transform: scale(1.12); }
.sidebar-nav .nav-link.active {
    background: rgba(var(--brand-rgb), .1);
    color: var(--brand);
    font-weight: 580;
}
[data-bs-theme="dark"] .sidebar-nav .nav-link.active { background: rgba(var(--brand-rgb), .2); color: #fff; }
.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: -.65rem; top: 50%;
    width: 3px; height: 20px;
    background: var(--brand);
    border-radius: 0 3px 3px 0;
    transform: translateY(-50%) scaleY(0);
    animation: navIn var(--normal) var(--ease-out) forwards;
}
@keyframes navIn { to { transform: translateY(-50%) scaleY(1); } }
.nav-label { transition: opacity var(--fast) var(--ease); }
.nav-badge {
    margin-left: auto;
    font-size: .68rem;
    font-weight: 640;
    padding: .1rem .42rem;
    border-radius: 99px;
    background: var(--bad);
    color: #fff;
    transition: opacity var(--fast) var(--ease);
}
.nav-badge.soft { background: var(--neutral-bg); color: var(--text-muted); }
.nav-badge.warn { background: var(--warn); color: #fff; }

.sidebar-foot {
    padding: .75rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* Topbar */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 0 1.15rem;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.icon-btn {
    width: 38px; height: 38px;
    display: inline-grid; place-items: center;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 1.06rem;
    transition: all var(--fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.has-dot { position: relative; }
.icon-btn.has-dot::after {
    content: '';
    position: absolute; top: 8px; right: 9px;
    width: 7px; height: 7px;
    border-radius: 99px;
    background: var(--bad);
    border: 2px solid var(--surface);
    animation: pulseDot 2s var(--ease) infinite;
}
@keyframes pulseDot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, .5); }
    50%      { box-shadow: 0 0 0 5px rgba(185, 28, 28, 0); }
}

.topbar-search { position: relative; flex: 1; max-width: 420px; }
.topbar-search i {
    position: absolute; left: .78rem; top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    font-size: .95rem;
    pointer-events: none;
}
.topbar-search input {
    width: 100%;
    height: 38px;
    padding: 0 2.6rem 0 2.25rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg);
    color: var(--text);
    font-size: .875rem;
    transition: all var(--fast) var(--ease);
}
.topbar-search input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: 0 0 0 3.5px rgba(var(--brand-rgb), .13);
}
.topbar-search kbd {
    position: absolute; right: .5rem; top: 50%;
    transform: translateY(-50%);
    font-size: .66rem;
    font-family: var(--font-mono);
    padding: .12rem .34rem;
    border-radius: 5px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text-faint);
}

.app-content { flex: 1; padding: 1.5rem 1.5rem 3rem; }
.container-app { width: 100%; max-width: 1440px; margin-inline: auto; }

.app-footer {
    padding: 1.1rem 1.5rem 1.6rem;
    text-align: center;
    font-size: .78rem;
    color: var(--text-faint);
    border-top: 1px solid var(--border);
}
.app-footer a { color: var(--text-muted); font-weight: 560; }
.app-footer a:hover { color: var(--brand); }

/* ---------- 5. Cabeçalho de página ---------- */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.35rem;
}
.page-head h1 { font-size: 1.5rem; margin: 0; line-height: 1.2; }
.page-head .subtitle { color: var(--text-muted); font-size: .875rem; margin-top: .2rem; }
.page-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.breadcrumb-mini {
    display: flex; align-items: center; gap: .35rem;
    font-size: .75rem; color: var(--text-faint);
    margin-bottom: .3rem;
}
.breadcrumb-mini a { color: var(--text-faint); }
.breadcrumb-mini a:hover { color: var(--brand); }

/* ---------- 6. Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--normal) var(--ease), transform var(--normal) var(--ease), border-color var(--normal) var(--ease);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: .95rem 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}
.card-header h2, .card-header h3, .card-header .card-title {
    font-size: .95rem; margin: 0; font-weight: 620;
}
.card-body { padding: 1.15rem; }
.card-footer { background: var(--surface-2); border-top: 1px solid var(--border); padding: .8rem 1.15rem; }

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}
.card-link-block { display: block; color: inherit; }
.card-link-block:hover { color: inherit; }

/* Card de indicador */
.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.15rem 1.2rem;
}
.stat-card::after {
    content: '';
    position: absolute;
    inset: auto -30px -46px auto;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--brand-rgb), .09), transparent 68%);
    transition: transform var(--slow) var(--ease-out);
}
.stat-card:hover::after { transform: scale(1.35); }
.stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--r-sm);
    display: grid; place-items: center;
    font-size: 1.15rem;
    margin-bottom: .85rem;
    background: rgba(var(--brand-rgb), .1);
    color: var(--brand);
    transition: transform var(--normal) var(--ease-out);
}
.stat-card:hover .stat-icon { transform: scale(1.08) rotate(-4deg); }
.stat-label { font-size: .76rem; color: var(--text-muted); font-weight: 540; text-transform: uppercase; letter-spacing: .05em; }
.stat-value {
    font-size: 1.7rem;
    font-weight: 680;
    letter-spacing: -.035em;
    line-height: 1.1;
    margin-top: .18rem;
    font-variant-numeric: tabular-nums;
}
.stat-value small { font-size: .95rem; font-weight: 560; color: var(--text-muted); }
.stat-trend { font-size: .76rem; margin-top: .45rem; display: flex; align-items: center; gap: .25rem; }
.stat-icon.ok   { background: var(--ok-bg);   color: var(--ok); }
.stat-icon.warn { background: var(--warn-bg); color: var(--warn); }
.stat-icon.bad  { background: var(--bad-bg);  color: var(--bad); }
.stat-icon.info { background: var(--info-bg); color: var(--info); }
.stat-icon.brand { background: var(--brand-light); color: var(--brand); }

/* ---------- 7. Botões ---------- */
.btn {
    --bs-btn-font-weight: 540;
    border-radius: var(--r-sm);
    font-size: .875rem;
    padding: .48rem .95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .42rem;
    transition: all var(--fast) var(--ease);
    border-width: 1px;
}
.btn i { font-size: 1rem; }
.btn:active { transform: scale(.975); }
.btn-lg { padding: .65rem 1.3rem; font-size: .95rem; border-radius: var(--r-md); }
.btn-sm { padding: .32rem .68rem; font-size: .8125rem; }

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: var(--shadow-xs);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
    box-shadow: var(--shadow-brand);
    transform: translateY(-1px);
}
.btn-primary:active { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn-outline-secondary {
    border-color: var(--border-strong);
    color: var(--text-muted);
    background: var(--surface);
}
.btn-outline-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--text-faint);
    color: var(--text);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-soft {
    background: rgba(var(--brand-rgb), .1);
    border-color: transparent;
    color: var(--brand);
}
.btn-soft:hover { background: rgba(var(--brand-rgb), .17); color: var(--brand-dark); }

.btn-group-tight .btn { border-radius: var(--r-xs); }

/* ---------- 8. Formulários ---------- */
.form-label { font-size: .8125rem; font-weight: 560; color: var(--text-muted); margin-bottom: .32rem; }
.form-label .req { color: var(--bad); }

.form-control, .form-select {
    border-radius: var(--r-sm);
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: .9rem;
    padding: .52rem .8rem;
    transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}
.form-control::placeholder { color: var(--text-faint); }
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3.5px rgba(var(--brand-rgb), .13);
    background: var(--surface);
    color: var(--text);
}
.form-control:disabled, .form-control[readonly] { background: var(--surface-2); color: var(--text-muted); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--bad); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3.5px rgba(185, 28, 28, .13); }
.invalid-feedback { font-size: .78rem; }
.form-text { font-size: .765rem; color: var(--text-faint); }
textarea.form-control { min-height: 92px; line-height: 1.55; }

.input-group-text {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-muted);
    font-size: .84rem;
    border-radius: var(--r-sm);
}

.form-check-input { border-color: var(--border-strong); cursor: pointer; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: 0 0 0 3.5px rgba(var(--brand-rgb), .13); border-color: var(--brand); }
.form-switch .form-check-input { width: 2.35em; height: 1.28em; }

/* Campo com ícone */
.field-icon { position: relative; }
.field-icon > i {
    position: absolute; left: .78rem; top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    font-size: .95rem;
    pointer-events: none;
    transition: color var(--fast) var(--ease);
}
.field-icon > .form-control { padding-left: 2.3rem; }
.field-icon:focus-within > i { color: var(--brand); }

/* Seletor segmentado */
.segmented {
    display: inline-flex;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 3px;
    gap: 2px;
}
.nav-pills .nav-link { white-space: nowrap; border-radius: var(--r-sm); font-size: .875rem; font-weight: 540; }
.nav-pills .nav-link:not(.active) { color: var(--text-muted); }
.nav-pills .nav-link:not(.active):hover { background: var(--surface-hover); color: var(--text); }
.nav-pills .nav-link.active { background: var(--brand); }

.segmented a, .segmented button {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: .8125rem;
    font-weight: 540;
    padding: .3rem .72rem;
    border-radius: calc(var(--r-sm) - 3px);
    transition: all var(--fast) var(--ease);
    white-space: nowrap;
}
.segmented a:hover, .segmented button:hover { color: var(--text); }
.segmented a.active, .segmented button.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-xs);
}

/* ---------- 9. Tabelas ---------- */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.table-wrap .table-responsive { border-radius: inherit; }

.table {
    --bs-table-bg: transparent;
    color: var(--text);
    margin: 0;
    font-size: .875rem;
}
.table > thead th {
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 640;
    text-transform: uppercase;
    letter-spacing: .055em;
    padding: .7rem .9rem;
    white-space: nowrap;
}
.table > tbody > tr { transition: background var(--fast) var(--ease); }
.table > tbody > tr:hover > * { background: var(--surface-hover); }
.table > tbody td { padding: .72rem .9rem; border-color: var(--border); vertical-align: middle; }
.table > tbody > tr:last-child td { border-bottom: 0; }
.table-row-link { cursor: pointer; }

.th-sort { color: inherit; display: inline-flex; align-items: center; gap: .25rem; }
.th-sort:hover { color: var(--brand); }

/* ---------- 10. Badges e chips ---------- */
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .72rem;
    font-weight: 580;
    padding: .22rem .58rem;
    border-radius: 99px;
    background: var(--neutral-bg);
    color: var(--text-muted);
    white-space: nowrap;
    line-height: 1.45;
}
.badge-soft .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; flex-shrink: 0; }
.badge-soft.ok   { background: var(--ok-bg);   color: var(--ok); }
.badge-soft.warn { background: var(--warn-bg); color: var(--warn); }
.badge-soft.bad  { background: var(--bad-bg);  color: var(--bad); }
.badge-soft.info { background: var(--info-bg); color: var(--info); }
.badge-soft.brand { background: rgba(var(--brand-rgb), .12); color: var(--brand); }

.chip {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .78rem;
    padding: .28rem .6rem;
    border: 1px solid var(--border);
    border-radius: 99px;
    background: var(--surface);
    color: var(--text-muted);
    transition: all var(--fast) var(--ease);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip .btn-close { font-size: .55rem; opacity: .5; }

/* ---------- 11. Avatar ---------- */
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: .78rem;
    font-weight: 620;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: -.02em;
    user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar-xs { width: 24px; height: 24px; font-size: .62rem; }
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.05rem; }
.avatar-xl { width: 76px; height: 76px; font-size: 1.5rem; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -9px; border: 2px solid var(--surface); transition: transform var(--fast) var(--ease); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .avatar:hover { transform: translateY(-3px); z-index: 2; }

/* ---------- 12. Progresso ---------- */
.progress {
    height: 7px;
    border-radius: 99px;
    background: var(--bg-subtle);
    overflow: hidden;
}
.progress-bar {
    background: var(--brand);
    border-radius: 99px;
    transition: width 1s var(--ease-out);
}
.progress-thin { height: 4px; }
.progress-bar.ok   { background: var(--ok); }
.progress-bar.warn { background: var(--warn); }
.progress-bar.bad  { background: var(--bad); }

/* Anel de progresso */
.ring { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-linecap: round; }
.ring .track { stroke: var(--bg-subtle); }
.ring .value { stroke: var(--brand); transition: stroke-dashoffset 1.1s var(--ease-out); }

/* ---------- 13. Timeline ---------- */
.timeline { position: relative; padding-left: 1.65rem; }
.timeline::before {
    content: '';
    position: absolute;
    left: 11px; top: 6px; bottom: 6px;
    width: 2px;
    background: linear-gradient(var(--border), transparent);
}
.timeline-item { position: relative; padding-bottom: 1.15rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute;
    left: -1.65rem; top: 2px;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--surface);
    border: 2px solid var(--border);
    font-size: .68rem;
    color: var(--text-muted);
    z-index: 1;
}
.timeline-dot.brand { border-color: var(--brand); color: var(--brand); background: rgba(var(--brand-rgb), .09); }
.timeline-dot.ok    { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.timeline-dot.bad   { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }

/* ---------- 14. Kanban ---------- */
.kanban {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(272px, 1fr);
    gap: .85rem;
    overflow-x: auto;
    padding-bottom: .75rem;
    scroll-snap-type: x proximity;
}
.kanban-col {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    display: flex;
    flex-direction: column;
    min-height: 180px;
    scroll-snap-align: start;
    transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.kanban-col.drop-target {
    background: rgba(var(--brand-rgb), .07);
    border-color: var(--brand);
    border-style: dashed;
}
.kanban-col-head {
    display: flex; align-items: center; gap: .5rem;
    padding: .7rem .85rem;
    font-size: .78rem;
    font-weight: 640;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.kanban-count {
    margin-left: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .7rem;
    padding: .05rem .42rem;
    border-radius: 99px;
    letter-spacing: 0;
}
.kanban-body { padding: .6rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }

.kanban-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: .72rem .8rem;
    box-shadow: var(--shadow-xs);
    cursor: grab;
    transition: box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease), opacity var(--fast) var(--ease);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .45; transform: rotate(1.5deg) scale(.99); }
.kanban-card h4 { font-size: .855rem; font-weight: 580; margin: 0 0 .3rem; line-height: 1.35; }

/* ---------- 15. Estado vazio ---------- */
.empty-state { text-align: center; padding: 3rem 1.25rem; }
.empty-state .icon {
    width: 62px; height: 62px;
    margin: 0 auto 1rem;
    border-radius: var(--r-lg);
    display: grid; place-items: center;
    font-size: 1.6rem;
    background: var(--bg-subtle);
    color: var(--text-faint);
    animation: floaty 3.4s var(--ease) infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.empty-state h3 { font-size: 1rem; margin-bottom: .3rem; }
.empty-state p { color: var(--text-muted); font-size: .875rem; max-width: 380px; margin: 0 auto 1.15rem; }

/* ---------- 16. Dropdown / modal / offcanvas ---------- */
.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    background: var(--surface);
    padding: .38rem;
    font-size: .875rem;
    animation: dropIn var(--fast) var(--ease-out);
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.dropdown-item {
    border-radius: var(--r-xs);
    padding: .48rem .65rem;
    color: var(--text);
    display: flex; align-items: center; gap: .58rem;
    transition: background var(--fast) var(--ease);
}
.dropdown-item i { font-size: 1rem; color: var(--text-muted); width: 18px; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-hover); color: var(--text); }
.dropdown-item.text-danger i { color: inherit; }
.dropdown-item.text-danger:hover { background: var(--bad-bg); color: var(--bad); }
.dropdown-divider { border-color: var(--border); margin: .3rem 0; }
.dropdown-header { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 640; }

.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}
.modal-header { border-bottom: 1px solid var(--border); padding: 1.05rem 1.25rem; }
.modal-title { font-size: 1.02rem; font-weight: 620; }
.modal-body { padding: 1.25rem; }
.modal-footer { border-top: 1px solid var(--border); padding: .9rem 1.25rem; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.modal.fade .modal-dialog { transform: translateY(14px) scale(.985); transition: transform var(--normal) var(--ease-out), opacity var(--normal); }
.modal.show .modal-dialog { transform: none; }
.modal-backdrop.show { opacity: .42; backdrop-filter: blur(3px); }

.offcanvas { background: var(--surface); color: var(--text); border-color: var(--border); }
.offcanvas-header { border-bottom: 1px solid var(--border); }

/* ---------- 17. Alertas e toasts ---------- */
.alert {
    border: 1px solid transparent;
    border-radius: var(--r-md);
    font-size: .875rem;
    padding: .8rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: .65rem;
}
.alert i { font-size: 1.05rem; margin-top: .05rem; flex-shrink: 0; }
.alert-success { background: var(--ok-bg);   color: var(--ok);   border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.alert-danger  { background: var(--bad-bg);  color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 22%, transparent); }
.alert-warning { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.alert-info    { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 22%, transparent); }

.toast-stack {
    position: fixed;
    right: 1rem; bottom: 1rem;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    max-width: min(380px, calc(100vw - 2rem));
}
.toast-item {
    display: flex; align-items: flex-start; gap: .65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--brand);
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-lg);
    padding: .75rem .9rem;
    font-size: .875rem;
    animation: toastIn var(--slow) var(--ease-out);
}
.toast-item.leaving { animation: toastOut var(--normal) var(--ease) forwards; }
.toast-item.success { border-left-color: var(--ok); }
.toast-item.danger  { border-left-color: var(--bad); }
.toast-item.warning { border-left-color: var(--warn); }
.toast-item i { font-size: 1.05rem; }
.toast-item.success i { color: var(--ok); }
.toast-item.danger i  { color: var(--bad); }
.toast-item.warning i { color: var(--warn); }
.toast-item.info i    { color: var(--info); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(28px) scale(.96); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(28px) scale(.96); } }

/* ---------- 18. Animações de entrada ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* Só opacidade, de propósito: qualquer transform aqui viraria o bloco de
   contenção dos modais (position: fixed), prendendo-os na área de conteúdo e
   deixando o backdrop por cima. O deslize fica por conta do .stagger. */
.page-enter { animation: fadeIn var(--slow) var(--ease-out) both; }
.stagger > * { animation: fadeUp var(--slow) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; }
.stagger > *:nth-child(6) { animation-delay: .22s; }
.stagger > *:nth-child(7) { animation-delay: .26s; }
.stagger > *:nth-child(8) { animation-delay: .3s; }

/* Esqueleto de carregamento */
.skeleton {
    background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--surface-hover) 37%, var(--bg-subtle) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--r-xs);
}
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ---------- 19. Agenda ---------- */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: var(--border);
    gap: 1px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
}
.cal-weekday {
    background: var(--surface-2);
    padding: .5rem;
    text-align: center;
    font-size: .7rem;
    font-weight: 640;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
}
.cal-day {
    background: var(--surface);
    min-height: 116px;
    padding: .4rem;
    display: flex;
    flex-direction: column;
    gap: .22rem;
    transition: background var(--fast) var(--ease);
}
.cal-day:hover { background: var(--surface-hover); }
.cal-day.other-month { background: var(--surface-2); }
.cal-day.other-month .cal-daynum { color: var(--text-faint); }
.cal-day.today .cal-daynum {
    background: var(--brand);
    color: #fff;
    border-radius: 99px;
    width: 22px; height: 22px;
    display: grid; place-items: center;
}
.cal-daynum { font-size: .76rem; font-weight: 600; color: var(--text-muted); margin-bottom: .1rem; }
.cal-event {
    display: flex; align-items: center; gap: .3rem;
    font-size: .72rem;
    padding: .18rem .35rem;
    border-radius: var(--r-xs);
    background: rgba(var(--brand-rgb), .1);
    color: var(--brand);
    border-left: 2.5px solid var(--brand);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: transform var(--fast) var(--ease), filter var(--fast) var(--ease);
}
.cal-event:hover { transform: translateX(2px); filter: brightness(.94); }
.cal-more { font-size: .68rem; color: var(--text-faint); padding-left: .35rem; }

.agenda-item {
    display: flex; gap: .85rem;
    padding: .8rem .9rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    transition: all var(--fast) var(--ease);
}
.agenda-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateX(2px); }
.agenda-time {
    font-variant-numeric: tabular-nums;
    font-weight: 640;
    font-size: .82rem;
    min-width: 46px;
    color: var(--brand);
}

/* ---------- 20. Arquivos ---------- */
.file-card {
    display: flex; align-items: center; gap: .75rem;
    padding: .7rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    transition: all var(--fast) var(--ease);
}
.file-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.file-icon {
    width: 38px; height: 38px;
    border-radius: var(--r-xs);
    display: grid; place-items: center;
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.dropzone {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--r-md);
    padding: 1.75rem 1rem;
    text-align: center;
    background: var(--surface-2);
    color: var(--text-muted);
    transition: all var(--normal) var(--ease);
    cursor: pointer;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--brand);
    background: rgba(var(--brand-rgb), .05);
    color: var(--brand);
}
.dropzone.dragover { transform: scale(1.008); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .65rem; }
.photo-tile {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: var(--r-sm);
    overflow: hidden;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--slow) var(--ease-out); }
.photo-tile:hover img { transform: scale(1.06); }
.photo-tile figcaption {
    position: absolute; inset: auto 0 0 0;
    padding: .8rem .55rem .4rem;
    font-size: .72rem;
    color: #fff;
    background: linear-gradient(transparent, rgba(0, 0, 0, .78));
}

/* ---------- 21. Navegação inferior (celular) ---------- */
.mobile-nav {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1035;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-top: 1px solid var(--border);
    padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
}
.mobile-nav-inner { display: grid; grid-template-columns: repeat(5, 1fr); }
.mobile-nav a {
    display: flex; flex-direction: column; align-items: center; gap: .1rem;
    padding: .42rem .2rem;
    font-size: .64rem;
    font-weight: 540;
    color: var(--text-faint);
    border-radius: var(--r-sm);
    transition: color var(--fast) var(--ease);
}
.mobile-nav a i { font-size: 1.24rem; transition: transform var(--normal) var(--ease-out); }
.mobile-nav a.active { color: var(--brand); }
.mobile-nav a.active i { transform: translateY(-2px); }
.mobile-nav a:active i { transform: scale(.88); }

.fab {
    display: none;
    position: fixed;
    right: 1rem;
    bottom: calc(74px + env(safe-area-inset-bottom));
    z-index: 1036;
    width: 54px; height: 54px;
    border-radius: 50%;
    border: 0;
    background: var(--brand);
    color: #fff;
    font-size: 1.4rem;
    box-shadow: var(--shadow-brand), var(--shadow-md);
    transition: transform var(--fast) var(--ease);
}
.fab:active { transform: scale(.9); }

/* ---------- 22. Utilitários ---------- */
.divider-text {
    display: flex; align-items: center; gap: .75rem;
    color: var(--text-faint); font-size: .78rem;
    margin: 1.1rem 0;
}
.divider-text::before, .divider-text::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.hover-reveal .reveal { opacity: 0; transition: opacity var(--fast) var(--ease); }
.hover-reveal:hover .reveal { opacity: 1; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Datas em português: só a primeira letra sobe. text-capitalize do Bootstrap
   viraria "6 De Setembro De 2026". */
.first-cap { display: inline-block; }
.first-cap::first-letter { text-transform: uppercase; }
.cursor-pointer { cursor: pointer; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; }

.bg-surface { background: var(--surface) !important; }
.bg-subtle  { background: var(--bg-subtle) !important; }
.border-app { border-color: var(--border) !important; }
.rounded-app { border-radius: var(--r-md) !important; }

/* ---------- 23. Responsivo ---------- */
@media (max-width: 1199.98px) {
    .app-content { padding: 1.25rem 1.15rem 3rem; }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }
    body.sidebar-open .app-sidebar { transform: none; }
    .app-main { margin-left: 0 !important; }
    body.sidebar-collapsed .app-sidebar { width: var(--sidebar-w); }

    .sidebar-backdrop {
        position: fixed; inset: 0;
        background: rgba(2, 6, 23, .45);
        backdrop-filter: blur(2px);
        z-index: 1039;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--normal) var(--ease);
    }
    body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
}

@media (max-width: 767.98px) {
    body { font-size: .9rem; padding-bottom: 68px; }
    .app-content { padding: 1rem .85rem 1.5rem; }
    .app-topbar { padding: 0 .75rem; gap: .35rem; }
    .topbar-search { max-width: none; }
    .topbar-search kbd { display: none; }

    .page-head { margin-bottom: 1rem; }
    .page-head h1 { font-size: 1.24rem; }
    .page-head-actions { width: 100%; }
    .page-head-actions .btn { flex: 1; }

    .card-body { padding: .95rem; }
    .card-header { padding: .8rem .95rem; }

    .stat-card { padding: .95rem 1rem; }
    .stat-value { font-size: 1.42rem; }
    .stat-icon { width: 34px; height: 34px; font-size: 1rem; margin-bottom: .6rem; }

    .mobile-nav { display: block; }
    .app-footer { padding-bottom: 1rem; }

    .kanban { grid-auto-columns: 84vw; }

    .cal-day { min-height: 66px; padding: .25rem; }
    .cal-event { font-size: 0; padding: 0; height: 5px; border-radius: 99px; border-left: 0; background: var(--brand); }
    .cal-event i, .cal-more { display: none; }

    /* Tabela vira lista de cartões no celular */
    .table-cards thead { display: none; }
    .table-cards tbody tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: var(--r-sm);
        margin-bottom: .6rem;
        padding: .3rem .1rem;
        background: var(--surface);
    }
    .table-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        border: 0;
        padding: .38rem .8rem;
    }
    .table-cards tbody td::before {
        content: attr(data-label);
        font-size: .7rem;
        font-weight: 640;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--text-faint);
        flex-shrink: 0;
    }
    .table-cards tbody td[data-label=""]::before { content: none; }
    .table-cards tbody td.cell-main {
        display: block;
        padding-top: .6rem;
        font-weight: 600;
    }
    .table-cards tbody td.cell-main::before { content: none; }

    .modal-dialog { margin: .5rem; }
    .modal-footer .btn { flex: 1; }
}

@media (max-width: 575.98px) {
    .stat-value { font-size: 1.3rem; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
}

/* Toque: alvo mínimo confortável */
@media (hover: none) {
    .btn, .icon-btn, .dropdown-item, .mobile-nav a { min-height: 40px; }
    .card-hover:hover { transform: none; }
}


/* ---------- 26. Agendamento online (página pública) ---------- */
.bk-head {
    background: linear-gradient(140deg, var(--brand-dark), var(--brand));
    color: #fff;
    padding: 1rem 0;
    position: sticky; top: 0; z-index: 20;
}
.bk-head .brand-mark { background: rgba(255,255,255,.16); box-shadow: none; }
.bk-wrap { max-width: 640px; margin-inline: auto; padding-inline: 1rem; }

/* passos */
.bk-steps {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-bottom: 1.25rem;
    font-size: .72rem;
}
.bk-step {
    display: flex; align-items: center; gap: .35rem;
    color: var(--text-faint);
    white-space: nowrap;
}
.bk-step .n {
    width: 22px; height: 22px; border-radius: 99px;
    display: grid; place-items: center;
    background: var(--bg-subtle); border: 1px solid var(--border);
    font-weight: 640; font-size: .68rem;
}
.bk-step.done  { color: var(--brand); }
.bk-step.done .n { background: rgba(var(--brand-rgb), .12); border-color: transparent; color: var(--brand); }
.bk-step.active { color: var(--text); font-weight: 600; }
.bk-step.active .n { background: var(--brand); border-color: var(--brand); color: #fff; }
.bk-steps .sep { flex: 1; height: 1px; background: var(--border); min-width: 8px; }

/* cartões selecionáveis (serviço e profissional) */
.bk-pick { display: block; cursor: pointer; margin-bottom: .55rem; }
.bk-pick input { position: absolute; opacity: 0; pointer-events: none; }
.bk-pick .box {
    display: flex; align-items: center; gap: .85rem;
    padding: .85rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    transition: all var(--fast) var(--ease);
}
.bk-pick:hover .box { border-color: var(--border-strong); }
.bk-pick input:checked + .box {
    border-color: var(--brand);
    background: rgba(var(--brand-rgb), .05);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .1);
}
.bk-pick .check {
    width: 22px; height: 22px; border-radius: 99px; flex-shrink: 0;
    border: 1.5px solid var(--border-strong);
    display: grid; place-items: center;
    color: transparent; font-size: .7rem;
    transition: all var(--fast) var(--ease);
}
.bk-pick input:checked + .box .check { background: var(--brand); border-color: var(--brand); color: #fff; }
.bk-pick .price { font-variant-numeric: tabular-nums; font-weight: 620; white-space: nowrap; }

/* seletor de dia */
.bk-days {
    display: flex; gap: .45rem;
    overflow-x: auto;
    padding-bottom: .5rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}
.bk-day {
    flex: 0 0 auto;
    width: 62px;
    padding: .55rem .3rem;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    text-align: center;
    scroll-snap-align: start;
    transition: all var(--fast) var(--ease);
    text-decoration: none;
}
.bk-day span { display: block; }
.bk-day .wd  { font-size: .66rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }
.bk-day .dd  { font-size: 1.1rem; font-weight: 660; color: var(--text); line-height: 1.2; }
.bk-day .mm  { font-size: .62rem; color: var(--text-faint); }
.bk-day:hover { border-color: var(--border-strong); }
.bk-day.active { border-color: var(--brand); background: rgba(var(--brand-rgb), .07); }
.bk-day.active .dd { color: var(--brand); }
.bk-day.full { opacity: .38; pointer-events: none; }

/* grade de horários */
.bk-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; }
.bk-slot {
    padding: .7rem .3rem;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: .95rem;
    color: var(--text);
    text-align: center;
    text-decoration: none;
    transition: all var(--fast) var(--ease);
}
.bk-slot:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.bk-slot.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* barra fixa com o resumo */
.bk-bar {
    position: sticky; bottom: 0;
    margin: 1rem -1rem -1rem;
    padding: .85rem 1rem calc(.85rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: .85rem;
    z-index: 15;
}
.bk-bar .info { flex: 1; min-width: 0; line-height: 1.25; }

@media (min-width: 641px) {
    .bk-bar { margin-inline: 0; border-radius: var(--r-md); border: 1px solid var(--border); }
}

/* ---------- 24. Acessibilidade ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* ---------- 25. Impressão (usada para gerar PDF) ---------- */
@media print {
    .app-sidebar, .app-topbar, .mobile-nav, .fab, .no-print, .page-head-actions { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 0 !important; }
    body { background: #fff; font-size: 11pt; }
    .card { border: 1px solid #ddd !important; box-shadow: none !important; break-inside: avoid; }
    .print-only { display: block !important; }
    a { color: #000; text-decoration: none; }
    @page { margin: 14mm; }
}
.print-only { display: none; }

/* ============================================================
   Campo: fotos da OS e assinatura do cliente
   ============================================================ */

.photo-thumb {
    position: relative;
    width: 96px; height: 96px;
    border-radius: var(--r-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface-2);
    flex-shrink: 0;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .photo-del {
    position: absolute; top: 3px; right: 3px;
    width: 22px; height: 22px;
    display: grid; place-items: center;
    border: 0; border-radius: 50%;
    background: rgba(0, 0, 0, .58);
    color: #fff; font-size: .72rem;
    opacity: 0; transition: opacity var(--fast) var(--ease);
    cursor: pointer;
}
.photo-thumb:hover .photo-del,
.photo-thumb:focus-within .photo-del { opacity: 1; }

.photo-add { margin: 0; }
.photo-drop {
    width: 96px; height: 96px;
    display: grid; place-items: center; align-content: center; gap: .15rem;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.photo-drop:hover { border-color: var(--brand); color: var(--brand); background: rgba(var(--brand-rgb), .05); }
.photo-drop i { font-size: 1.15rem; }

/* O quadro precisa ser confortável no dedo: nada de assinar num risco de 60px. */
.signature-pad {
    position: relative;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--r-sm);
    background: #fff;
    overflow: hidden;
}
.signature-pad canvas {
    display: block;
    width: 100%;
    height: 180px;
    touch-action: none;   /* sem isso o navegador rola a página em vez de desenhar */
    cursor: crosshair;
}
.signature-pad::after {
    content: 'assine aqui';
    position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
    font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
    color: #cbd5e1; pointer-events: none;
    transition: opacity var(--fast) var(--ease);
}
.signature-pad.has-ink::after { opacity: 0; }
.signature-clear { position: absolute; top: 6px; right: 6px; color: #64748b; }

/* ============================================================
   Linhas de lista, mini-indicador e rótulo de seção
   ============================================================ */

.list-rows { display: flex; flex-direction: column; }
.list-row {
    display: flex; align-items: center; gap: .65rem;
    padding: .6rem 0; border-bottom: 1px solid var(--border);
    min-width: 0;
}
.list-rows > .list-row:last-child { border-bottom: 0; padding-bottom: 0; }
.list-rows > .list-row:first-child { padding-top: 0; }
a.list-row { text-decoration: none; color: inherit; border-radius: var(--r-sm); }
a.list-row:hover { background: var(--surface-2); }

/* Tabela dentro de card.
   A classe existe no markup desde o começo e nunca teve regra: sem ela, a
   primeira e a última coluna encostam na borda do cartão, porque a tabela é
   irmã do .card-body e não herda o recuo dele. Só no desktop — no celular a
   .table-cards vira lista e tem o próprio espaçamento. */
@media (min-width: 768px) {
    .table-app > :not(caption) > * > * { padding-top: .7rem; padding-bottom: .7rem; }
    .table-app > :not(caption) > * > *:first-child { padding-left: 1.15rem; }
    .table-app > :not(caption) > * > *:last-child  { padding-right: 1.15rem; }
}

.mini-stat {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: .6rem .75rem;
    height: 100%;
}
.mini-stat strong { font-size: .95rem; }

/* Rótulo de seção dentro de card: separa blocos sem pesar a hierarquia */
.section-label {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
    font-weight: 600; color: var(--text-faint); margin-bottom: .5rem;
}

/* Ficha em duas colunas: rótulo curto à esquerda, valor à direita. Vira uma
   coluna no celular, senão o valor fica espremido em três palavras por linha. */
.dl-inline { display: grid; grid-template-columns: minmax(6rem, 8rem) 1fr; gap: .35rem .75rem; margin: 0; }
.dl-inline dt { font-size: .78rem; font-weight: 500; color: var(--text-muted); margin: 0; }
.dl-inline dd { font-size: .86rem; margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) {
    .dl-inline { grid-template-columns: 1fr; gap: 0 0; }
    .dl-inline dt { margin-top: .5rem; }
}

.border-start-ok   { border-left: 3px solid var(--ok); }
.border-start-warn { border-left: 3px solid var(--warn); }
.border-start-bad  { border-left: 3px solid var(--bad); }

/* ---------- Personal: a tela do treino ---------- */

/* Cartão de exercício. A carga da última vez vem antes de qualquer outra coisa,
   e por isso ela é o elemento com mais peso visual do bloco. */
.ex-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; margin-bottom: .75rem;
}
.ex-card.done { border-color: var(--ok); }
.ex-head { display: flex; align-items: flex-start; gap: .75rem; padding: .85rem 1rem; }
.ex-head .num {
    width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%;
    display: grid; place-items: center; font-size: .74rem; font-weight: 700;
    background: rgba(var(--brand-rgb), .12); color: var(--brand);
}

/* "72,5 kg × 10" da última sessão: é o dado mais consultado do sistema. */
.last-load {
    display: inline-flex; align-items: baseline; gap: .3rem;
    font-family: var(--font-mono); font-weight: 700; font-size: 1.05rem;
    color: var(--text); font-variant-numeric: tabular-nums;
}
.last-load .unit { font-size: .78rem; font-weight: 500; color: var(--text-muted); }
.last-load.empty { color: var(--text-faint); font-weight: 500; font-size: .86rem; }

.target-chip {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .18rem .5rem; border-radius: 99px;
    font-size: .74rem; font-weight: 600;
    background: var(--surface-2); color: var(--text-muted);
}
.target-chip.up   { background: var(--ok-bg);   color: var(--ok); }
.target-chip.down { background: var(--warn-bg); color: var(--warn); }

/* Linha de série: campos grandes, teclado numérico, uma mão. */
.set-row {
    display: grid; grid-template-columns: 2rem 1fr 1fr 4.5rem auto;
    gap: .4rem; align-items: center;
    padding: .45rem 1rem; border-top: 1px solid var(--border);
}
.set-row.logged { background: rgba(var(--brand-rgb), .04); }
.set-row .set-n {
    font-family: var(--font-mono); font-size: .78rem; font-weight: 700;
    color: var(--text-muted); text-align: center;
}
.set-row input.form-control {
    font-family: var(--font-mono); font-size: 1rem; font-weight: 600;
    text-align: center; padding: .5rem .3rem; height: auto;
}
.set-row .form-select { padding: .5rem .4rem; font-size: .84rem; }
@media (max-width: 480px) {
    .set-row { grid-template-columns: 1.6rem 1fr 1fr 3.8rem auto; gap: .3rem; padding: .45rem .6rem; }
    .set-row input.form-control { font-size: 1.05rem; }
}

/* Cronômetro de descanso: aparece fixo no rodapé, sem tapar o próximo campo. */
.rest-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: none; align-items: center; gap: .75rem;
    padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom));
    background: var(--brand); color: #fff;
    box-shadow: 0 -6px 20px rgba(0,0,0,.25);
}
.rest-bar.on { display: flex; }
.rest-bar .clock {
    font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700;
    font-variant-numeric: tabular-nums; min-width: 4.2rem;
}
.rest-bar .btn { --bs-btn-color: #fff; border-color: rgba(255,255,255,.5); color: #fff; }
@media (max-width: 767.98px) { .rest-bar { bottom: 62px; } }

/* Aviso de fila offline: a academia no subsolo não tem sinal. */
.offline-pill {
    position: fixed; top: .6rem; left: 50%; transform: translateX(-50%); z-index: 70;
    display: none; align-items: center; gap: .4rem;
    padding: .35rem .8rem; border-radius: 99px;
    background: var(--warn); color: #1a1a1a; font-size: .78rem; font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.offline-pill.on { display: inline-flex; }

/* Ficha em duas colunas: rótulo curto à esquerda, valor à direita. */
.dl-inline { display: grid; grid-template-columns: minmax(6rem, 8rem) 1fr; gap: .35rem .75rem; margin: 0; }
.dl-inline dt { font-size: .78rem; font-weight: 500; color: var(--text-muted); margin: 0; }
.dl-inline dd { font-size: .86rem; margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) {
    .dl-inline { grid-template-columns: 1fr; gap: 0 0; }
    .dl-inline dt { margin-top: .5rem; }
}

.border-start-ok   { border-left: 3px solid var(--ok); }
.border-start-warn { border-left: 3px solid var(--warn); }
.border-start-bad  { border-left: 3px solid var(--bad); }
.border-start-brand{ border-left: 3px solid var(--brand); }

/* Barras horizontais de volume por grupo muscular. */
.vol-row { display: grid; grid-template-columns: 8rem 1fr 3rem; gap: .5rem; align-items: center; margin-bottom: .35rem; }
.vol-row .bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.vol-row .bar span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.vol-row .bar span.low  { background: var(--warn); }
.vol-row .bar span.high { background: var(--bad); }
@media (max-width: 480px) { .vol-row { grid-template-columns: 6rem 1fr 2.6rem; font-size: .8rem; } }

/* Número grande de destaque (adesão, volume da sessão). */
.big-num {
    font-family: var(--font-mono); font-size: clamp(1.6rem, 6vw, 2.4rem);
    font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}

/* Grade de créditos: um quadradinho por sessão vendida. */
.credit-grid { display: flex; flex-wrap: wrap; gap: .3rem; }
.credit-dot {
    width: 26px; height: 26px; border-radius: 6px;
    display: grid; place-items: center; font-size: .68rem; font-weight: 700;
    background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.credit-dot.used    { background: rgba(var(--brand-rgb), .15); color: var(--brand); border-color: transparent; }
.credit-dot.free    { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.credit-dot.expired { background: var(--bad-bg); color: var(--bad); border-color: transparent; text-decoration: line-through; }
