/* ==========================================================================
   Gestão de Funcionários — design system
   ========================================================================== */

/* ---- Tokens (tema claro = padrão) --------------------------------------- */
:root {
    --bg: #f3f4f9;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --surface-hover: #f3f4fb;
    --border: #e4e7f0;
    --border-strong: #d3d8e6;
    --text: #141a2e;
    --muted: #667089;
    --accent: #5b45f0;
    --accent-hover: #4a35d6;
    --accent-soft: #eeebff;
    --accent-ink: #4a35d6;
    --on-accent: #ffffff;

    --success: #0f9d6b;  --success-soft: #def7ec;
    --danger:  #dc3d58;  --danger-soft:  #ffe6ea;
    --warning: #b7791f;  --warning-soft: #fff3d6;
    --info:    #0c8fb3;  --info-soft:    #dcf5fb;

    --shadow-sm: 0 1px 2px rgba(20, 26, 46, .05);
    --shadow-md: 0 6px 20px -8px rgba(20, 26, 46, .14), 0 2px 6px rgba(20, 26, 46, .04);
    --shadow-lg: 0 24px 48px -16px rgba(20, 26, 46, .25);
    --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --topbar-h: 64px;
    --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0d1020;
    --surface: #151931;
    --surface-2: #1a1f3a;
    --surface-hover: #1e2442;
    --border: #262c4b;
    --border-strong: #343b60;
    --text: #eceffa;
    --muted: #8f98ba;
    --accent: #8b7bff;
    --accent-hover: #a094ff;
    --accent-soft: rgba(139, 123, 255, .16);
    --accent-ink: #b3a9ff;
    --on-accent: #0d1020;
    --success: #34d399;  --success-soft: rgba(52, 211, 153, .14);
    --danger:  #fb7185;  --danger-soft:  rgba(251, 113, 133, .14);
    --warning: #fbbf24;  --warning-soft: rgba(251, 191, 36, .14);
    --info:    #38bdf8;  --info-soft:    rgba(56, 189, 248, .14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 10px 28px -10px rgba(0, 0, 0, .55);
    --shadow-lg: 0 28px 56px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
}

[data-theme="corporate"] {
    --bg: #0f1a2b;
    --surface: #16243a;
    --surface-2: #1a2b45;
    --surface-hover: #1f3250;
    --border: #25395a;
    --border-strong: #31496f;
    --text: #eaf1fb;
    --muted: #8ea3c2;
    --accent: #4da3ff;
    --accent-hover: #75b8ff;
    --accent-soft: rgba(77, 163, 255, .16);
    --accent-ink: #8cc4ff;
    --on-accent: #08111f;
    --success: #34d399;  --success-soft: rgba(52, 211, 153, .14);
    --danger:  #fb7185;  --danger-soft:  rgba(251, 113, 133, .14);
    --warning: #fbbf24;  --warning-soft: rgba(251, 191, 36, .14);
    --info:    #38bdf8;  --info-soft:    rgba(56, 189, 248, .14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 10px 28px -10px rgba(0, 0, 0, .55);
    --shadow-lg: 0 28px 56px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
}

[data-theme="emerald"] {
    --bg: #0c1a14;
    --surface: #12261d;
    --surface-2: #162d23;
    --surface-hover: #1a3428;
    --border: #21402f;
    --border-strong: #2d5640;
    --text: #e8f6ee;
    --muted: #8fb2a0;
    --accent: #2fd08c;
    --accent-hover: #55e0a5;
    --accent-soft: rgba(47, 208, 140, .15);
    --accent-ink: #7be8b8;
    --on-accent: #06150e;
    --success: #34d399;  --success-soft: rgba(52, 211, 153, .14);
    --danger:  #fb7185;  --danger-soft:  rgba(251, 113, 133, .14);
    --warning: #fbbf24;  --warning-soft: rgba(251, 191, 36, .14);
    --info:    #38bdf8;  --info-soft:    rgba(56, 189, 248, .14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 10px 28px -10px rgba(0, 0, 0, .55);
    --shadow-lg: 0 28px 56px -16px 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.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
a { color: var(--accent-ink); }
em { font-style: normal; color: var(--danger); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; background: var(--surface-2); padding: .1em .4em; border-radius: 6px; border: 1px solid var(--border); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* ---- Topbar ------------------------------------------------------------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: 1920px; margin: 0 auto;
    height: var(--topbar-h);
    padding: 0 clamp(1rem, 2.4vw, 2rem);
    display: flex; align-items: center; gap: 1.5rem;
}
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--text); }
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px; flex: none;
    display: grid; place-items: center;
    background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #ff7ad9));
    color: #fff; font-size: 1.2rem;
    box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}
.brand-mark-lg { width: 56px; height: 56px; font-size: 1.8rem; border-radius: 16px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: .98rem; font-weight: 800; letter-spacing: -.01em; }
.brand-text small { font-size: .72rem; color: var(--muted); font-weight: 500; }

.topnav { display: flex; gap: .25rem; margin-left: .5rem; }
.topnav a {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .5rem .85rem; border-radius: 10px;
    color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem;
    transition: background .15s, color .15s;
}
.topnav a:hover { background: var(--surface-hover); color: var(--text); }
.topnav a.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.topnav a i { font-size: 1.1rem; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }

.theme-picker {
    position: relative; display: inline-flex; align-items: center;
    height: 38px; padding: 0 .35rem 0 .7rem; gap: .4rem;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
    color: var(--muted); cursor: pointer;
}
.theme-picker select {
    appearance: none; -webkit-appearance: none; border: 0; background: transparent;
    color: var(--text); font: inherit; font-size: .85rem; font-weight: 600;
    padding: .4rem 1.4rem .4rem .1rem; cursor: pointer; outline: none; width: auto;
}
.theme-picker:focus-within { box-shadow: var(--ring); }
.theme-picker::after { content: ''; position: absolute; right: .7rem; width: 6px; height: 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); pointer-events: none; }

/* ---- Menus (details) ---------------------------------------------------- */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
    min-width: 220px; padding: .4rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: pop .14s ease-out;
}
.menu-panel.menu-right, .user-menu .menu-panel { left: auto; right: 0; }
.menu-panel a, .menu-panel button {
    display: flex; align-items: center; gap: .6rem; width: 100%;
    padding: .6rem .75rem; border: 0; border-radius: 8px; background: transparent;
    color: var(--text); font: inherit; font-size: .9rem; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
}
.menu-panel form { margin: 0; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-hover); }
.menu-panel .is-danger { color: var(--danger); }
.menu-panel .is-danger:hover { background: var(--danger-soft); }
.menu-panel i { font-size: 1.1rem; color: var(--muted); }
.menu-panel .is-danger i { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: .35rem .25rem; }
.user-menu > summary {
    display: flex; align-items: center; gap: .55rem; height: 38px; padding: 0 .55rem 0 .3rem;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text);
    font-weight: 600; font-size: .85rem; transition: background .15s;
}
.user-menu > summary:hover { background: var(--surface-hover); }
.user-menu > summary i { color: var(--muted); font-size: .9rem; }
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

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

/* ---- Avatares ----------------------------------------------------------- */
.avatar {
    --av: var(--accent);
    width: 34px; height: 34px; flex: none; border-radius: 50%;
    display: inline-grid; place-items: center;
    font-size: .74rem; font-weight: 800; letter-spacing: .02em;
    color: color-mix(in srgb, var(--av) 70%, var(--text));
    background: color-mix(in srgb, var(--av) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--av) 30%, transparent);
}
.avatar-sm { width: 26px; height: 26px; font-size: .68rem; vertical-align: middle; }
.av-0 { --av: #5b45f0; } .av-1 { --av: #0f9d6b; } .av-2 { --av: #dc3d58; }
.av-3 { --av: #0c8fb3; } .av-4 { --av: #d97706; } .av-5 { --av: #c026d3; }

/* ---- Layout de página --------------------------------------------------- */
.page { max-width: 1920px; margin: 0 auto; padding: clamp(1.1rem, 2.4vw, 2rem); }
.page-narrow { max-width: 560px; }
.page-form { max-width: 1100px; }
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.page-head h1 { display: flex; align-items: center; gap: .6rem; }
.page-head p { margin-top: .35rem; }
.page-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); padding: 1.5rem;
}
.card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 1.1rem; display: flex; align-items: center; gap: .6rem; }
.count-pill { background: var(--accent-soft); color: var(--accent-ink); font-size: .75rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; }

/* ---- Botões ------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    height: 40px; padding: 0 1rem; border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-size: .9rem; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.btn i { font-size: 1.1rem; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-lg { height: 46px; font-size: .95rem; }
.btn-block { width: 100%; }
.btn-icon-only { width: 40px; padding: 0; }
.file-btn { cursor: pointer; }

.icon-btn {
    width: 32px; height: 32px; display: inline-grid; place-items: center;
    border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted);
    cursor: pointer; text-decoration: none; font-size: 1.05rem; transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--accent-ink); border-color: var(--border); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* ---- Formulários -------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.field label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.hint { color: var(--muted); font-size: .78rem; }
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="password"], input[type="tel"], select {
    width: 100%; height: 42px; padding: 0 .85rem;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 10px;
    font: inherit; font-size: .92rem;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
input:hover, select:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border-strong)); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[readonly] { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
select { appearance: none; -webkit-appearance: none; padding-right: 2.2rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="date"] { min-height: 42px; }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 1.05rem; }
.input-icon input { padding-left: 2.4rem; }
.stack { display: flex; flex-direction: column; gap: 1.1rem; }
.form-actions-inline { display: flex; gap: .6rem; flex-wrap: wrap; padding-top: .25rem; }

/* Formulário de funcionário */
.employee-form { display: flex; flex-direction: column; gap: 1.25rem; padding-bottom: 5.5rem; }
.form-section { padding: 1.4rem 1.5rem 1.6rem; }
.section-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.section-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-size: 1.2rem; flex: none; }
.section-head h3 { font-size: 1rem; font-weight: 700; }
.section-head p { font-size: .84rem; color: var(--muted); margin-top: .1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem 1.1rem; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-full { grid-column: 1 / -1; }
.req { color: var(--danger); }

.switches { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .75rem; }
.switch-field {
    display: flex; align-items: flex-start; gap: .85rem; padding: .9rem 1rem; cursor: pointer;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
    transition: border-color .15s, background .15s;
}
.switch-field:hover { border-color: var(--border-strong); }
.switch-field:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); }
.switch { position: relative; flex: none; width: 40px; height: 24px; margin-top: 2px; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-ui { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background .2s; }
.switch-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { box-shadow: var(--ring); }
.switch-text { display: flex; flex-direction: column; gap: .1rem; }
.switch-text strong { font-size: .9rem; font-weight: 600; }
.switch-text small { font-size: .78rem; color: var(--muted); }

.sticky-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--border); }
.sticky-actions-inner { max-width: 1100px; margin: 0 auto; padding: .85rem clamp(1.1rem, 2.4vw, 2rem); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sticky-actions-inner > div { display: flex; gap: .6rem; }

/* ---- KPIs --------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { display: flex; align-items: center; gap: 1rem; padding: 1.15rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-icon { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; flex: none; }
.tone-accent  { background: var(--accent-soft);  color: var(--accent-ink); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-danger  { background: var(--danger-soft);  color: var(--danger); }
.tone-info    { background: var(--info-soft);    color: var(--info); }
.kpi-body { display: flex; flex-direction: column; min-width: 0; }
.kpi-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-size: 1.85rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-meta { font-size: .76rem; color: var(--muted); font-weight: 500; }

/* ---- Filtros ------------------------------------------------------------ */
.table-card { padding: 0; overflow: hidden; }
.filters {
    display: grid; grid-template-columns: minmax(200px, 1.4fr) repeat(3, minmax(130px, 1fr)) minmax(120px, .8fr) minmax(200px, 1.3fr) auto;
    gap: .85rem; align-items: end; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.filters-actions { display: flex; gap: .5rem; }
.table-meta { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .85rem 1.5rem; font-size: .86rem; color: var(--muted); border-bottom: 1px solid var(--border); }
.table-meta strong { color: var(--text); font-weight: 700; }

/* ---- Tabela ------------------------------------------------------------- */
.table-wrap { overflow: auto; max-height: min(68vh, 900px); }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
.data-table th, .data-table td { padding: .8rem 1rem; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); background: var(--surface); }
.data-table thead th {
    position: sticky; top: 0; z-index: 3;
    font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
    background: var(--surface-2); border-bottom: 1px solid var(--border-strong);
}
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover td { background: var(--surface-hover); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .col-actions { position: sticky; left: 0; z-index: 2; width: 84px; min-width: 84px; }
.data-table .col-name { position: sticky; left: 84px; z-index: 2; min-width: 260px; box-shadow: 1px 0 0 var(--border); }
.data-table thead .col-actions, .data-table thead .col-name { z-index: 4; }
.col-actions-r { text-align: right !important; width: 90px; }
.row-actions { display: flex; align-items: center; gap: .15rem; }
.row-actions form { margin: 0; }
.person { display: flex; align-items: center; gap: .7rem; }
.person-name { font-weight: 600; letter-spacing: -.005em; }

.chip { display: inline-block; max-width: 230px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; padding: .18rem .6rem; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: .78rem; font-weight: 600; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 700; text-transform: capitalize; }
.badge i { font-size: .9rem; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-accent  { background: var(--accent-soft);  color: var(--accent-ink); }
.badge-muted   { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.empty-state { text-align: center; padding: 3.5rem 1.5rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.empty-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-size: 2rem; margin-bottom: .5rem; }
.empty-state h3 { color: var(--text); font-size: 1.05rem; }
.empty-state .btn { margin-top: .75rem; }

/* ---- Paginação ---------------------------------------------------------- */
.pagination { display: flex; justify-content: center; align-items: center; gap: .4rem; flex-wrap: wrap; padding: 1rem 1.5rem 1.25rem; border-top: 1px solid var(--border); }
.page-link { min-width: 36px; height: 36px; padding: 0 .5rem; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font-size: .88rem; font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; transition: background .15s, border-color .15s; }
.page-link:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.page-link.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.page-gap { color: var(--muted); padding: 0 .2rem; }

/* ---- Regras ------------------------------------------------------------- */
.rules-layout { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 1.25rem; align-items: start; }
.rules-layout .table-card .card-title { padding: 1.25rem 1.5rem 0; }
.callout { margin-top: 1.5rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--accent-soft); color: var(--text); font-size: .86rem; }
.callout strong { display: block; margin-bottom: .4rem; color: var(--accent-ink); }
.callout ol { margin: 0; padding-left: 1.1rem; color: var(--muted); display: grid; gap: .25rem; }

/* ---- Alertas ------------------------------------------------------------ */
.alert { display: flex; align-items: flex-start; gap: .6rem; padding: .8rem 1rem; border-radius: var(--radius); font-size: .88rem; font-weight: 500; margin-bottom: 1rem; }
.alert i { font-size: 1.2rem; margin-top: 1px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }

/* ---- Login -------------------------------------------------------------- */
.auth-page { background: var(--bg); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 1fr) minmax(380px, 560px); }
.auth-aside {
    position: relative; display: flex; align-items: center; padding: 3rem clamp(2rem, 6vw, 5rem); color: #fff; overflow: hidden;
    background: radial-gradient(900px 500px at 15% 10%, #7c68ff 0%, transparent 60%), radial-gradient(700px 500px at 90% 90%, #e056c4 0%, transparent 55%), linear-gradient(160deg, #3a2bb8, #231a73);
}
.auth-aside::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(to bottom, transparent, #000 40%, transparent); pointer-events: none; }
.auth-aside-inner { position: relative; z-index: 1; max-width: 460px; }
.auth-aside .brand-mark { background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); margin-bottom: 1.75rem; }
.auth-aside h1 { font-size: clamp(2rem, 1.4rem + 2vw, 3rem); margin-bottom: .8rem; }
.auth-aside p { opacity: .85; font-size: 1.05rem; margin-bottom: 1.75rem; }
.auth-aside ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.auth-aside li { display: flex; align-items: center; gap: .65rem; font-weight: 500; }
.auth-aside li i { font-size: 1.25rem; color: #9af0cd; }
.auth-card { display: grid; place-items: center; padding: 2rem; background: var(--surface); }
.auth-card-inner { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: .4rem; }
.auth-card .muted { margin-bottom: 1.5rem; }
.auth-logo-mobile { display: none; margin-bottom: 1.25rem; }

/* ---- SweetAlert --------------------------------------------------------- */
.app-swal.swal2-popup { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); font-family: var(--font); padding: 1.6rem; }
.app-swal .swal2-title { color: var(--text); font-weight: 800; font-size: 1.35rem; letter-spacing: -.01em; }
.app-swal .swal2-html-container { color: var(--muted); font-size: .95rem; }
.app-swal .swal2-input { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: none; }
.app-swal .swal2-validation-message { background: var(--danger-soft); color: var(--danger); }
.app-swal .swal2-actions { gap: .6rem; }
.swal2-container .swal2-timer-progress-bar { background: var(--accent); }
.swal2-toast.app-swal { padding: .8rem 1rem; }
.import-progress { text-align: left; }
.import-progress .bar { height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.import-progress .bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #ff7ad9)); transition: width .25s ease; }
.import-progress .row { display: flex; justify-content: space-between; margin-bottom: .5rem; font-weight: 600; color: var(--text); }
.import-progress .sub { margin-top: .6rem; font-size: .88rem; color: var(--muted); }

/* ---- Responsivo --------------------------------------------------------- */
@media (max-width: 1180px) {
    .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .filters-actions { grid-column: 1 / -1; }
    .rules-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .topnav a span, .user-name { display: none; }
    .topnav { margin-left: 0; }
    .brand-text small { display: none; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-logo-mobile { display: block; }
    .hide-sm { display: none; }
    .sticky-actions-inner { justify-content: flex-end; }
}
@media (max-width: 640px) {
    .topbar-inner { gap: .6rem; }
    .brand-text { display: none; }
    .theme-picker select { max-width: 92px; }
    .filters { grid-template-columns: 1fr 1fr; padding: 1rem; }
    .filters .field:first-child { grid-column: 1 / -1; }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .form-grid .span-2 { grid-column: 1 / -1; }
    .page-head { align-items: stretch; }
    .page-actions { width: 100%; }
    .page-actions .btn:not(.btn-icon-only) { flex: 1; }
    .table-meta { padding: .75rem 1rem; }
    .data-table .col-name { min-width: 200px; }
    .card { padding: 1.1rem; }
    .card.table-card { padding: 0; }
    .form-section { padding: 1.1rem; }
    .hide-xs { display: none; }
}
@media (max-width: 440px) {
    .form-grid, .filters { grid-template-columns: 1fr; }
    .kpis { grid-template-columns: 1fr 1fr; }
    .kpi { padding: .9rem; gap: .7rem; flex-direction: column; align-items: flex-start; }
    .kpi-value { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
    .topbar, .filters, .page-actions, .pagination, .sticky-actions, .row-actions { display: none !important; }
    .table-wrap { max-height: none; overflow: visible; }
}

/* ---- Usuários ----------------------------------------------------------- */
.pw-row { display: flex; gap: .5rem; }
.pw-row input { flex: 1; }
.inline-form { margin: 0; display: inline-block; }
.select-sm { height: 34px; width: auto; min-width: 140px; font-size: .84rem; }
.pw-panel { min-width: 280px; padding: 1rem; }
.pw-panel .field label { font-size: .8rem; }
.data-table td .person { min-width: 200px; }
.card.table-card .table-wrap { min-height: 120px; }
