/* ==========================================================================
   eMarkt — Design System
   Os temas (public/temas/<tema>/theme.css) sobrescrevem apenas --brand e
   --brand-strong; todo o restante deriva desses tokens.
   ========================================================================== */

:root {
    --brand: #7c3aed;
    --brand-strong: #6d28d9;
    --brand-contrast: #ffffff;
    --brand-soft: color-mix(in srgb, var(--brand) 12%, transparent);

    --bg: #f5f6fa;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --surface-hover: #f1f3f9;
    --border: #e4e7ef;
    --border-strong: #cfd5e2;
    --text: #0f172a;
    --text-muted: #64748b;

    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0284c7;

    --radius-lg: 18px;
    --radius: 12px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 10px 30px -14px rgba(15, 23, 42, .16);
    --shadow-lg: 0 30px 60px -20px rgba(15, 23, 42, .35);

    --sidebar-w: 264px;
    --topbar-h: 64px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    color-scheme: light;
}

:root[data-mode="dark"] {
    --bg: #0b0f19;
    --surface: #121826;
    --surface-2: #0f1522;
    --surface-hover: #1a2233;
    --border: #232c3d;
    --border-strong: #334055;
    --text: #e6e9f0;
    --text-muted: #94a3b8;
    --brand-soft: color-mix(in srgb, var(--brand) 22%, transparent);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .6);
    --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .7);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-mode="light"]) {
        --bg: #0b0f19;
        --surface: #121826;
        --surface-2: #0f1522;
        --surface-hover: #1a2233;
        --border: #232c3d;
        --border-strong: #334055;
        --text: #e6e9f0;
        --text-muted: #94a3b8;
        --brand-soft: color-mix(in srgb, var(--brand) 22%, transparent);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .6);
        --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .7);
        color-scheme: dark;
    }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: 1.65rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 1rem; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 48px; height: 48px; }
.icon-sun { display: none; }
:root[data-mode="dark"] .icon-sun { display: inline; }
:root[data-mode="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-mode="light"]) .icon-sun { display: inline; }
    :root:not([data-mode="light"]) .icon-moon { display: none; }
}

.muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-4 { margin-top: 1.5rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

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

.brand {
    display: flex;
    align-items: center;
    height: 76px;
    padding: 0 22px;
    border-bottom: 1px solid var(--border);
}
.brand:hover { text-decoration: none; }
.brand-logo { max-height: 44px; max-width: 100%; object-fit: contain; }
.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border-radius: 11px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 80%, #fff), var(--brand-strong));
    color: #fff;
    box-shadow: 0 8px 18px -8px var(--brand);
}
.brand-mark svg { width: 21px; height: 21px; margin: 2px 2px 0 0; }
.brand-text { margin-left: 11px; font-size: 1.45rem; font-weight: 800; letter-spacing: -.04em; color: var(--text); }
.brand-text span { color: var(--brand); }
.auth-logo .brand-mark { width: 52px; height: 52px; border-radius: 15px; }
.auth-logo .brand-mark svg { width: 28px; height: 28px; }
.auth-logo .brand-text { font-size: 1.9rem; }
.auth-logo { align-items: center; }

.nav { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-section {
    padding: 6px 12px 8px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    font-size: .93rem;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--brand-soft); color: var(--brand); }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }

.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 28px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(10px);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar-menu { display: none; }
.topbar-title { font-weight: 700; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.avatar {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: var(--brand-contrast);
    font-weight: 700;
    font-size: .9rem;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta strong { font-size: .88rem; }
.user-meta small { font-size: .74rem; color: var(--text-muted); }

.content { flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 32px 28px 48px; }

.app-footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 18px 28px;
    border-top: 1px solid var(--border);
    font-size: .82rem;
    color: var(--text-muted);
}
.app-footer a, .auth-footer a { color: inherit; font-weight: 600; }

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar-open .sidebar { transform: none; }
    .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(15, 23, 42, .45); }
    .main { margin-left: 0; }
    .topbar { padding: 0 16px; }
    .topbar-menu { display: inline-grid; }
    .content { padding: 24px 16px 40px; }
    .app-footer { padding: 16px; }
}
@media (max-width: 560px) {
    .user-meta { display: none; }
    .user-chip { padding: 2px; }
}

/* ---------- Page header ---------- */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}
.page-header h1 { margin: 0; }
.page-subtitle { margin: 4px 0 0; color: var(--text-muted); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card-body { padding: 24px; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 { margin: 0; }
.card-header .icon { color: var(--text-muted); }
.card + .card { margin-top: 24px; }
.card.danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.card.danger .card-header { color: var(--danger); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid-2 > .card + .card { margin-top: 0; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.stat-label { font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.stat-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }

.tone { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; flex-shrink: 0; }
.tone-brand { background: var(--brand-soft); color: var(--brand); }
.tone-success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.tone-warning { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.tone-danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.tone-info { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }

/* ---------- Quick action tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 28px; }
.tile {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font: inherit;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tile:hover { text-decoration: none; transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); box-shadow: var(--shadow); }
.tile-title, .tile-desc { display: block; }
.tile-title { margin: 0 0 2px; font-size: 1rem; font-weight: 700; }
.tile-desc { margin: 0; font-size: .86rem; color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-size: .92rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .btn-icon:focus-visible, .tile:focus-visible, .nav-link:focus-visible, .tab:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent);
}
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--brand); color: var(--brand-contrast); box-shadow: 0 6px 16px -8px var(--brand); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.93); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.93); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { filter: brightness(.93); }
.btn-soft-danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.btn-soft-danger:hover { background: color-mix(in srgb, var(--danger) 20%, transparent); }

.btn-sm { height: 32px; padding: 0 12px; font-size: .84rem; border-radius: 8px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-lg { height: 52px; padding: 0 22px; font-size: 1.02rem; border-radius: 12px; }
.btn-block { width: 100%; }

.btn-icon {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background .15s;
}
.btn-icon:hover { background: var(--surface-hover); }
.btn-icon.sm { width: 30px; height: 30px; border-radius: 8px; }
.btn-icon.sm .icon { width: 15px; height: 15px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }
label, .label { display: block; margin-bottom: 6px; font-size: .88rem; font-weight: 600; }
.hint { margin-top: 6px; font-size: .8rem; color: var(--text-muted); }

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 13px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: .95rem;
    transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; }
input[type="file"] { padding: 7px; cursor: pointer; }
input::file-selector-button {
    margin-right: 12px;
    padding: 6px 12px;
    border: 0;
    border-radius: 7px;
    background: var(--brand-soft);
    color: var(--brand);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
input[readonly] { background: var(--surface-2); color: var(--text-muted); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--border); }

.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.input-icon > input { padding-left: 40px !important; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .input-icon { flex: 1; min-width: 220px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.card > .table-wrap:first-child table thead th:first-child { border-top-left-radius: var(--radius-lg); }
.card > .table-wrap:first-child table thead th:last-child { border-top-right-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th {
    padding: 11px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.table .text-right { text-align: right; }
.table .text-center { text-align: center; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-empty td { padding: 40px 16px; text-align: center; color: var(--text-muted); }
.cell-title { font-weight: 600; }
.cell-sub { font-size: .8rem; color: var(--text-muted); }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 700;
    white-space: nowrap;
    background: var(--surface-hover);
    color: var(--text-muted);
}
.badge .icon { width: 13px; height: 13px; }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.badge-warning { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.badge-danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.badge-info { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }

/* ---------- Alerts ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 18px;
    border: 1px solid;
    border-radius: var(--radius);
    font-size: .92rem;
}
.alert .icon { margin-top: 2px; }
.alert p:last-child { margin-bottom: 0; }
.alert-success { background: color-mix(in srgb, var(--success) 9%, var(--surface)); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: var(--success); }
.alert-error { background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.alert-warning { background: color-mix(in srgb, var(--warning) 10%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 35%, transparent); color: var(--warning); }
.alert-info { background: color-mix(in srgb, var(--info) 9%, var(--surface)); border-color: color-mix(in srgb, var(--info) 35%, transparent); color: var(--info); }
.alert > div { color: var(--text); }

.code-box {
    padding: 14px;
    font-family: var(--mono);
    font-size: .9rem;
    word-break: break-all;
    background: var(--surface-2);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}

/* ---------- Tabs ---------- */
.tabs {
    display: flex;
    flex-wrap: wrap; /* abas quebram de linha em vez de criar barras de rolagem */
    gap: 0 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    margin-bottom: -1px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--text-muted);
    font: inherit;
    font-size: .92rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-in .2s ease; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.empty-state .icon-xl { color: var(--border-strong); margin-bottom: 12px; }
.empty-state h1, .empty-state h2 { color: var(--text); }

/* ---------- List rows ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }

/* ---------- Modal ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.modal.open { display: flex; animation: fade-in .15s ease; }
.modal-dialog {
    width: 100%;
    max-width: 440px;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: pop-in .18s ease;
}
.modal-dialog h2 { margin-bottom: 4px; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.modal-actions.inline { flex-direction: row; justify-content: flex-end; }
.modal-icon { margin: 0 auto 14px; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--info);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: .92rem;
    animation: pop-in .2s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: all .2s; }

/* ---------- Auth pages (login, recuperação, instalador) ---------- */
.layout-auth {
    background:
        radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, var(--brand-soft), transparent 60%),
        var(--bg);
    background-attachment: fixed;
}
.auth-wrap { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-mode-toggle { position: absolute; top: 16px; right: 16px; }
.auth-main { width: 100%; display: flex; justify-content: center; }
.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 36px 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
}
.auth-card.wide { max-width: 560px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 20px; }
.auth-logo img { max-height: 64px; }
.auth-card h1 { text-align: center; font-size: 1.45rem; margin-bottom: 4px; }
.auth-card .lead { text-align: center; color: var(--text-muted); margin-bottom: 24px; }
.auth-links { margin-top: 18px; text-align: center; font-size: .9rem; }
.auth-footer { margin-top: 28px; font-size: .82rem; color: var(--text-muted); text-align: center; }

.steps { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 24px; }
.step { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-size: .8rem; font-weight: 700; background: var(--surface-hover); color: var(--text-muted); }
.step.done { background: var(--brand-soft); color: var(--brand); }
.step.current { background: var(--brand); color: var(--brand-contrast); }
.step-line { width: 22px; height: 2px; border-radius: 2px; background: var(--border); }
.step-line.done { background: var(--brand); }

.check-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.check-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: .92rem; }
.check-list li:last-child { border-bottom: 0; }

fieldset { margin: 0 0 20px; padding: 0; border: 0; }
legend { margin-bottom: 12px; padding: 0; font-weight: 700; font-size: .78rem; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }

/* ---------- PDV (caixa) ---------- */
.layout-pos { height: 100vh; height: 100dvh; overflow: hidden; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: 100vh; height: 100dvh; }
.pos-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pos-header { display: flex; align-items: center; gap: 12px; height: 68px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.pos-header .brand-logo { max-height: 36px; }
.pos-header .operator { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.pos-scan { padding: 20px 24px 12px; }
.pos-scan form { display: flex; gap: 10px; }
.pos-scan .input-icon { flex: 1; }
.pos-scan input { min-height: 54px !important; font-size: 1.1rem !important; border-radius: 12px !important; }
.pos-scan .btn { height: 54px; }
.pos-cart { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 24px 24px; }
.pos-cart .card { overflow: hidden; }
.qty { display: inline-flex; align-items: center; gap: 6px; }
.qty-value { min-width: 28px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.pos-side { display: flex; flex-direction: column; gap: 16px; padding: 24px; background: var(--surface); border-left: 1px solid var(--border); overflow-y: auto; }
.pos-total {
    padding: 24px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: var(--brand-contrast);
    box-shadow: 0 18px 40px -18px var(--brand);
}
.pos-total-label { font-size: .85rem; font-weight: 600; opacity: .85; text-transform: uppercase; letter-spacing: .08em; }
.pos-total-amount { font-size: clamp(2.2rem, 4vw, 3rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.pos-total-items { font-size: .9rem; opacity: .85; }
.pos-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; }
.kbd-hints { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--text-muted); }
kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; font-family: var(--mono); font-size: .75rem; background: var(--surface-2); color: var(--text); }
.change-amount { font-size: 2.6rem; font-weight: 800; color: var(--success); text-align: center; margin: 12px 0; font-variant-numeric: tabular-nums; }
.amount-input { text-align: center; font-size: 1.6rem !important; font-weight: 700; min-height: 60px !important; }

@media (max-width: 960px) {
    .layout-pos { height: auto; overflow: auto; }
    .pos { grid-template-columns: 1fr; height: auto; }
    .pos-side { border-left: 0; border-top: 1px solid var(--border); }
    .pos-cart { min-height: 40vh; }
}

/* ---------- Impressão ---------- */
@media print {
    .sidebar, .topbar, .app-footer, .page-actions, .toolbar, .toast-stack { display: none !important; }
    .main { margin: 0; }
    .card { box-shadow: none; }
}
