/* ============================================================
   PontoExtractor — Design System
   Tema claro, profissional. Sobrescreve o visual padrão do
   Bootstrap/Blazor para dar cara de produto.
   ============================================================ */

:root {
    /* Paleta */
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f7f8fc;
    --border: #e9ebf3;
    --border-strong: #d7dae6;

    --text: #1b2333;
    --text-muted: #697086;
    --text-soft: #98a0b3;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-active: #3730a3;
    --primary-soft: #eef2ff;
    --primary-ring: rgba(79, 70, 229, 0.25);

    --success: #15a34a;
    --success-soft: #e9f9ef;
    --danger: #dc2626;
    --danger-soft: #fdecec;
    --warning: #b45309;
    --warning-soft: #fdf4e3;

    /* Forma */
    --radius-sm: 9px;
    --radius: 14px;
    --radius-lg: 18px;

    --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.04);
    --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04), 0 2px 6px rgba(17, 24, 39, 0.05);
    --shadow: 0 6px 20px rgba(17, 24, 39, 0.07), 0 2px 6px rgba(17, 24, 39, 0.04);
    --shadow-lg: 0 20px 45px rgba(17, 24, 39, 0.12);

    /* Topo escuro (fixo nos dois temas, como o modelo) */
    --topbar: #16103a;
    --topbar-2: #1e1550;
    --topbar-text: #e9e7f5;
    --topbar-muted: #a39fc4;
    --topbar-field: rgba(255, 255, 255, 0.08);
    --topbar-field-border: rgba(255, 255, 255, 0.14);

    /* Badges de tipo (pills) */
    --pill-gray-bg: #eef1f6;   --pill-gray-fg: #475569;
    --pill-indigo-bg: #eef2ff; --pill-indigo-fg: #4f46e5;
    --pill-green-bg: #e9fbf3;  --pill-green-fg: #0f9d6a;
    --pill-blue-bg: #eaf2ff;   --pill-blue-fg: #2563eb;
    --pill-amber-bg: #fff5e6;  --pill-amber-fg: #c1791a;
}

/* ---------- Base ---------- */
html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5 {
    color: var(--text);
    font-weight: 650;
    letter-spacing: -0.02em;
}

h1 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }

a, .btn-link {
    color: var(--primary);
    text-decoration: none;
}

a:hover { color: var(--primary-hover); }

p { color: var(--text); }
.text-muted { color: var(--text-muted) !important; }

code {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.12em 0.42em;
    font-size: 0.86em;
    color: var(--primary-active);
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    opacity: 1;
    margin: 2rem 0;
}

.content { padding-top: 0; }

h1:focus, h2:focus { outline: none; }

/* Sub-navegação (pills) da área de conta — usa a cor da marca */
.nav-pills .nav-link {
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-weight: 550;
}

.nav-pills .nav-link:hover { background: var(--surface-2); color: var(--text); }

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: var(--primary-soft);
    color: var(--primary-active);
}

/* ---------- Botões ---------- */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 550;
    padding: 0.5rem 1.1rem;
    border: 1px solid transparent;
    transition: background-color .15s ease, box-shadow .15s ease,
        border-color .15s ease, transform .05s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.28);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.36);
    transform: translateY(-1px);
}

.btn-primary:active { background-color: var(--primary-active); border-color: var(--primary-active); }

.btn-primary:disabled {
    background-color: var(--primary);
    border-color: var(--primary);
    opacity: .55;
}

.btn-success {
    background-color: var(--success);
    border-color: var(--success);
    color: #fff;
    box-shadow: var(--shadow-xs);
}

.btn-success:hover, .btn-success:focus {
    background-color: #128a3f;
    border-color: #128a3f;
    color: #fff;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--border-strong);
    background: var(--surface);
}

.btn-outline-primary:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary-hover);
}

.btn-lg { padding: 0.7rem 1.5rem; font-size: 1rem; }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 3px var(--primary-ring);
    outline: none;
}

/* ---------- Formulários ---------- */
.form-label {
    font-weight: 550;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.form-control, .form-select {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.8rem;
    background-color: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-xs);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.form-control::placeholder { color: var(--text-soft); }

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    background-color: var(--surface);
}

.form-control-sm { padding: 0.35rem 0.55rem; font-size: 0.85rem; }

.form-range { accent-color: var(--primary); }

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ---------- Cards / superfícies utilitárias ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

/* Superfície reutilizável para seções de conteúdo */
.surface {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

/* ---------- Tabelas ---------- */
.table {
    color: var(--text);
    border-color: var(--border);
    --bs-table-bg: transparent;
}

.table > thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 0.75rem;
    white-space: nowrap;
}

.table > tbody td {
    padding: 0.55rem 0.75rem;
    vertical-align: middle;
    border-color: var(--border);
}

.table-bordered, .table-bordered > :not(caption) > * > * {
    border-color: var(--border);
}

.table-hover > tbody > tr:hover > * {
    background-color: var(--surface-2);
}

.table-responsive {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    /* rola na horizontal quando a tabela é mais larga que o container
       (evita cortar a última coluna); vertical continua contido p/ os cantos */
    overflow-x: auto;
    overflow-y: hidden;
}

.table-responsive .table { margin-bottom: 0; }
.table-responsive .table > thead th:first-child { padding-left: 1rem; }
.table-responsive .table > tbody td:first-child { padding-left: 1rem; }

/* ---------- Alertas ---------- */
.alert {
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 0.85rem 1.1rem;
    box-shadow: var(--shadow-xs);
}

.alert-warning {
    background: var(--warning-soft);
    border-color: #f3d9a6;
    color: var(--warning);
}

.alert-danger {
    background: var(--danger-soft);
    border-color: #f4c2c2;
    color: var(--danger);
}

.alert-success {
    background: var(--success-soft);
    border-color: #bfe8cd;
    color: var(--success);
}

/* ---------- Cabeçalho de página (reutilizável) ---------- */
.page-header {
    margin-bottom: 1.75rem;
}

.page-header h1 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.35rem;
}

.page-header .subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
    max-width: 60ch;
}

/* ---------- Telas de autenticação (login, cadastro, etc.) ---------- */
.auth-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 8rem);
    padding: 1rem 0;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 2.25rem 2rem;
}

.auth-card h1 {
    font-size: 1.35rem;
    margin-bottom: 0.3rem;
    text-align: center;
}

.auth-card .auth-sub {
    color: var(--text-muted);
    text-align: center;
    font-size: 0.92rem;
    margin-bottom: 1.6rem;
}

.auth-links {
    margin-top: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    text-align: center;
    font-size: 0.9rem;
}

.auth-links a { font-weight: 500; }

.auth-card .btn-primary { width: 100%; }

/* Grade de planos (tela do cliente) */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.plan-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.plan-card.current {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.plan-name {
    font-weight: 650;
    font-size: 1.05rem;
    color: var(--text);
}

.plan-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.plan-price span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.plan-pages { color: var(--primary-active); font-weight: 600; font-size: 0.9rem; }
.plan-desc { color: var(--text-muted); font-size: 0.9rem; margin: 0.3rem 0 0.6rem; flex: 1; }
.plan-card .btn { margin-top: auto; }

/* Barra de armazenamento */
.storage-bar {
    height: 12px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    overflow: hidden;
}

.storage-fill {
    height: 100%;
    background: var(--primary);
    transition: width .3s ease;
}

.storage-fill.warn { background: var(--warning); }
.storage-fill.full { background: var(--danger); }

/* Checklist de campos para exportar */
.export-cols {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}

.export-col {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--text);
    margin: 0;
}

/* Cards de revisão de holerite */
.holerite-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.holerite-card-head {
    font-size: 0.78rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-soft);
    margin-bottom: 0.8rem;
}

.holerite-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem 1rem;
}

.holerite-field { display: flex; flex-direction: column; }
.holerite-field.wide { grid-column: span 2; }

.holerite-field label {
    font-size: 0.78rem;
    font-weight: 550;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

/* Tabela de rubricas dentro do card: não espremer — rolar na horizontal */
.holerite-card .table-responsive { overflow-x: auto; }
.holerite-card table { min-width: 680px; }
.holerite-card td input { min-width: 90px; }
.holerite-card td:nth-child(2) input { min-width: 240px; } /* descrição */

@media (max-width: 900px) {
    .holerite-field.wide { grid-column: span 1; }
}

/* Barra de plano/cota na tela de extração */
.quota-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 0.85rem 1.1rem;
}

.quota-plan {
    font-weight: 650;
    color: var(--text);
    margin-right: 0.6rem;
}

.quota-detail { color: var(--text-muted); font-size: 0.9rem; }

.quota-remaining {
    font-weight: 650;
    font-size: 0.9rem;
    color: var(--primary-active);
    background: var(--primary-soft);
    border: 1px solid #dfe3ff;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    white-space: nowrap;
}

.quota-remaining.empty {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #f4c2c2;
}

/* Badge simples (papéis, status) */
.badge-soft {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary-soft);
    color: var(--primary-active);
    border: 1px solid #dfe3ff;
}

/* ---------- Validação ---------- */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); font-size: 0.85rem; }

/* ---------- Blazor error UI ---------- */
.blazor-error-boundary {
    background: var(--danger);
    padding: 1rem 1.25rem;
    color: white;
    border-radius: var(--radius);
}

.blazor-error-boundary::after { content: "Ocorreu um erro."; }

.darker-border-checkbox.form-check-input { border-color: var(--border-strong); }

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--text-soft);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ===== Overlay de extração (escurece a tela + barra de progresso) ===== */
.extract-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1080;
}

.extract-overlay-box {
    background: #1e293b;
    color: #f8fafc;
    border-radius: 16px;
    padding: 2rem 2.5rem;
    width: min(420px, 90vw);
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.extract-overlay-box h3 {
    margin: 0.25rem 0 0.5rem;
    font-size: 1.25rem;
    color: #f8fafc;
}

.extract-overlay-msg {
    margin: 0 0 1rem;
    color: #cbd5e1;
    font-size: 0.95rem;
}

.extract-spinner {
    width: 46px;
    height: 46px;
    margin: 0 auto 1rem;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary, #4f46e5);
    border-radius: 50%;
    animation: extract-spin 0.9s linear infinite;
}

@keyframes extract-spin {
    to { transform: rotate(360deg); }
}

.extract-progress {
    height: 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    overflow: hidden;
    margin: 0.25rem 0 0.5rem;
}

.extract-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #4f46e5);
    border-radius: 999px;
    transition: width 0.35s ease;
}

.extract-progress-label {
    margin: 0;
    font-size: 0.85rem;
    color: #cbd5e1;
}

/* Modal simples (exportação Domínio) */
.modal-backdrop-jc {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
    z-index: 1040;
}
.modal-jc {
    position: fixed; z-index: 1050; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 48px); overflow-y: auto;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .35);
}

/* Cartões de resumo (ex.: tela de Acessos). */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-label {
    color: var(--muted, #6b7280);
    font-size: .85rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

/* Seletor de perfil (Auditoria/Contabilidade) no cabeçalho claro. */
.profile-switch {
    display: inline-flex;
    padding: 4px;
    gap: 2px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.ps-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    padding: 8px 15px;
    border-radius: 9px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.ps-btn:hover { color: var(--text); }

.ps-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

@media (max-width: 720px) {
    .ps-btn { padding: 7px 11px; font-size: 12px; }
}

/* ===== Laudo de perícia (documento imprimível) ============================ */
.laudo-shell {
    min-height: 100vh;
    background: #eef1f6;
    padding: 24px 16px 48px;
}
.laudo-toolbar {
    max-width: 820px;
    margin: 0 auto 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.laudo-doc {
    max-width: 820px;
    margin: 0 auto;
    background: #fff;
    color: #1f2430;
    border: 1px solid #dfe3ea;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(20, 25, 40, .08);
    padding: 40px 44px;
    font-size: 13px;
    line-height: 1.5;
}
.laudo-head {
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 2px solid #4f46e5;
    padding-bottom: 16px;
    margin-bottom: 20px;
}
.laudo-brand { display: flex; align-items: center; gap: 8px; }
.laudo-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 10px;
    background: #eef2ff; color: #4f46e5; font-weight: 800; font-size: 18px;
}
.laudo-marca { font-weight: 700; color: #4f46e5; font-size: 15px; }
.laudo-titulo h1 { font-size: 20px; margin: 0; color: #1f2430; }
.laudo-titulo p { margin: 2px 0 0; color: #6b7280; font-size: 12px; }

.laudo-ident {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 24px;
    margin-bottom: 18px;
}
.laudo-ident > div {
    display: flex; flex-direction: column;
    border-bottom: 1px dotted #d7dbe3; padding-bottom: 4px;
}
.laudo-ident span { color: #6b7280; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.laudo-ident strong { font-size: 13px; }

.laudo-conclusao {
    border-radius: 8px; padding: 12px 14px; margin-bottom: 20px;
    display: flex; flex-direction: column; gap: 2px;
}
.laudo-conclusao.ok { background: #e9f7ef; border: 1px solid #bfe6cd; }
.laudo-conclusao.div { background: #fdecec; border: 1px solid #f3c2c2; }

.laudo-doc h2 {
    font-size: 14px; color: #4f46e5; margin: 24px 0 8px;
    border-bottom: 1px solid #e5e8ef; padding-bottom: 4px;
}
.laudo-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.laudo-tbl th, .laudo-tbl td {
    border: 1px solid #e5e8ef; padding: 6px 8px; text-align: left; vertical-align: top;
}
.laudo-tbl thead th { background: #f4f6fb; font-weight: 700; }
.laudo-tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.laudo-tbl .linha-div td { background: #fdf0f0; }
.laudo-tbl .laudo-tot td { font-weight: 700; background: #f4f6fb; }
.laudo-tbl.compacta { max-width: 360px; }
.laudo-tbl.espelho { font-size: 11.5px; }
.laudo-tbl.espelho th, .laudo-tbl.espelho td { padding: 4px 6px; }

.laudo-rodape { margin-top: 28px; }
.laudo-nota { color: #6b7280; font-size: 11px; line-height: 1.5; }
.laudo-assinatura {
    margin-top: 40px; text-align: center; width: 260px; margin-left: auto; margin-right: auto;
}
.laudo-assinatura .linha { border-top: 1px solid #1f2430; margin-bottom: 4px; }
.laudo-assinatura span { font-size: 12px; color: #4b5563; }

@media print {
    @page { size: A4; margin: 14mm; }
    .laudo-shell { background: #fff; padding: 0; }
    .no-print, .laudo-toolbar { display: none !important; }
    .laudo-doc {
        max-width: none; margin: 0; border: 0; border-radius: 0; box-shadow: none; padding: 0;
    }
    .laudo-doc section, .laudo-tbl tr { page-break-inside: avoid; }
    .laudo-tbl thead { display: table-header-group; }
}

/* ===== Menu de navegação lateral (sidebar) ============================== */
/* NavLink é componente filho e NÃO recebe o atributo de escopo (b-hash) do
   CSS isolado — por isso estas regras ficam no CSS GLOBAL, não no .razor.css. */
.side-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-group {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--text-soft);
    font-weight: 800;
    padding: 14px 12px 7px;
}
.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-btn svg { width: 18px; height: 18px; display: block; flex-shrink: 0; }
.nav-btn:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.nav-btn.active {
    background: linear-gradient(90deg, #eef2ff, #f5f3ff);
    color: var(--primary);
    font-weight: 800;
}
.nav-btn.active svg { opacity: 1; }

/* Sidebar recolhida (só ícones) em telas médias */
@media (max-width: 1050px) {
    .nav-group { display: none; }
    .nav-btn { justify-content: center; padding: 12px 0; gap: 0; }
    .nav-btn .nav-label { display: none; }
    .nav-btn:hover { transform: none; }
}
