:root {
    --bg: #0b1220;
    --panel: #131c2b;
    --text: #e5edf6;
    --muted: #94a3b8;
    --line: #253246;
    --primary: #22c7ad;
    --primary-dark: #16a38e;
    --danger: #b42318;
    --danger-bg: #33191e;
    --success: #34d399;
    --success-bg: #102d22;
    --shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.dashboard-theme {
    --bg: #182232;
    --panel: #223044;
    --text: #e8eef6;
    --muted: #a7b4c6;
    --line: #3a4a60;
    --primary: #2dd4bf;
    --primary-dark: #14b8a6;
    --shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
    background: var(--bg);
}

.dashboard-theme label span,
.dashboard-theme .field-title {
    color: #c7d2df;
}

.dashboard-theme input,
.dashboard-theme select {
    background: #182232;
}

.dashboard-theme .metric,
.dashboard-theme .company-list,
.dashboard-theme .mini-list div {
    background: #1c293b;
}

.dashboard-theme th {
    color: #c7d2df;
}


a {
    color: inherit;
}

.ponto-auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    margin: 0;
    padding: clamp(16px, 5vw, 40px);
    background:
        radial-gradient(1000px 600px at 20% -10%, rgba(14, 165, 233, 0.33), transparent 60%),
        radial-gradient(800px 500px at 120% 30%, rgba(56, 189, 248, 0.2), transparent 50%),
        linear-gradient(180deg, #0f172a, #111827);
    color: #e5f0ff;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ponto-card {
    position: relative;
    width: min(440px, 94vw);
    padding: clamp(22px, 4vw, 34px);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 20px;
    background: linear-gradient(to bottom right, rgba(30, 41, 59, 0.65), rgba(15, 23, 42, 0.55));
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: pontoFadeIn 0.25s ease;
    backdrop-filter: blur(16px) saturate(160%);
}

.ponto-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    z-index: -1;
    border-radius: 22px;
    background: conic-gradient(from 180deg, #38bdf8 0%, #22d3ee 25%, transparent 60%, #38bdf8 100%);
    filter: blur(20px) opacity(0.18);
}

.ponto-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    text-align: center;
}

.ponto-auth-page:not(.password-page) .ponto-brand::after {
    content: "";
    order: 2;
    width: 150px;
    height: 1px;
    background: rgba(148, 163, 184, 0.32);
}

.ponto-brand img {
    width: clamp(114px, 24vw, 204px);
    height: auto;
    margin-top: 15px;
    margin-bottom: 15px;
    object-fit: contain;
    filter:
        drop-shadow(0 0 6px rgba(56, 189, 248, 0.6))
        drop-shadow(0 0 14px rgba(56, 189, 248, 0.45))
        drop-shadow(0 0 24px rgba(56, 189, 248, 0.35));
}

.ponto-brand-compact img {
    width: 90px;
    margin-top: 0;
    margin-bottom: 10px;
}

.ponto-brand h1 {
    order: 3;
    margin: 0;
    color: #e5f0ff;
    font-size: clamp(20px, 3vw, 26px);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.ponto-field {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.ponto-field label {
    color: #e5f0ff;
    font-size: clamp(14px, 1.8vw, 16px);
}

.ponto-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid #2a3346;
    border-radius: 10px;
    background: rgba(2, 6, 23, 0.45);
}

.ponto-input-wrap:focus-within {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.ponto-input {
    width: 100%;
    min-height: 44px;
    padding: 12px 44px 12px 12px;
    border: 0;
    outline: none;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 16px;
}

.ponto-input::placeholder {
    color: #94a3b8;
    opacity: 0.8;
}

.ponto-icon {
    width: 20px;
    height: 20px;
    margin-left: 12px;
    color: #9fb3c8;
    opacity: 0.9;
    flex: 0 0 auto;
}

.ponto-icon + .ponto-input {
    padding-left: 12px;
}

.ponto-eye {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #9fb3c8;
    cursor: pointer;
}

.ponto-eye svg {
    display: block;
}

.ponto-eye:hover {
    color: #cfe7ff;
    background: transparent;
}

.ponto-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    box-shadow: 0 8px 24px rgba(34, 211, 238, 0.25);
    color: #021016;
    cursor: pointer;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: clamp(14px, 1.8vw, 16px);
    font-weight: 900;
    letter-spacing: 0.3px;
    transition: transform 0.02s, filter 0.2s;
}

.ponto-btn:hover {
    filter: brightness(1.05);
}

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

.ponto-btn[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
}

.ponto-btn-secondary {
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #2a3346;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #e5f0ff;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.ponto-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.ponto-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pontoSpin 0.8s linear infinite;
}

.ponto-btn.loading .ponto-spinner {
    display: inline-block;
}

.ponto-msg-err,
.ponto-msg-ok {
    margin-top: 10px;
    text-align: center;
    font-weight: 600;
}

.ponto-msg-err {
    color: #f87171;
}

.ponto-msg-ok {
    color: #86efac;
}

.ponto-alert-warn {
    padding: 10px 12px;
    margin: 0 0 16px;
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.13);
    color: #fde68a;
    font-size: clamp(12px, 1.4vw, 14px);
    font-weight: 600;
    text-align: center;
}

.ponto-card .ponto-pw-reqs {
    display: grid;
    gap: 6px;
    margin: 14px 0 0;
    padding: 0;
}

.ponto-card .ponto-pw-reqs span {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 20px;
    padding-left: 28px;
    color: #ef4444;
    font-size: clamp(12px, 1.4vw, 14px);
    font-weight: 600;
}

.ponto-card .ponto-pw-reqs span::before {
    content: "×";
    position: absolute;
    left: 0;
    top: -1px;
    width: 18px;
    color: #ef4444;
    font-size: 19px;
    font-weight: 400;
    line-height: 20px;
    text-align: center;
}

.ponto-card .ponto-pw-reqs span.is-ok {
    color: #22c55e;
}

.ponto-card .ponto-pw-reqs span.is-ok::before {
    content: "✓";
    color: #22c55e;
}

.ponto-foot {
    margin-top: 14px;
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
}

@keyframes pontoFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

@keyframes pontoSpin {
    to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
    .ponto-card {
        padding: clamp(18px, 4vw, 24px);
        border-radius: 16px;
    }

    .ponto-input {
        min-height: 48px;
    }
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
    background: #111827;
}

.login-shell {
    width: min(100%, 440px);
}

.login-panel,
.panel,
.empty-state {
    background: #223149;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: none;
}

.login-panel {
    padding: 46px 34px 34px;
    border-color: rgba(96, 165, 250, 0.18);
    background:
        radial-gradient(circle at 32% 38%, rgba(45, 212, 191, 0.16), transparent 38%),
        linear-gradient(135deg, #193852 0%, #121b32 68%);
    color: var(--text);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.26), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.brand-block {
    display: grid;
    justify-items: center;
    gap: 16px;
    margin-bottom: 24px;
    text-align: center;
}

.brand-block img {
    display: block;
    width: 196px;
    max-width: 80%;
    height: auto;
    filter: drop-shadow(0 0 22px rgba(45, 212, 191, 0.34));
}

.login-page:not(.password-page) .brand-block::after {
    content: "";
    order: 2;
    width: 150px;
    height: 1px;
    background: rgba(148, 163, 184, 0.32);
}

.login-page:not(.password-page) .brand-block img {
    order: 1;
}

.login-page:not(.password-page) .brand-block h1 {
    order: 3;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 8px;
    border: 1px solid rgba(45, 212, 191, 0.42);
    background: #1c293b;
    color: #2dd4bf;
    font-weight: 700;
}

h1 {
    margin: 0 0 6px;
    font-size: 24px;
    line-height: 1.2;
}

.login-panel h1 {
    margin: 0;
    color: #dbeafe;
    font-size: 28px;
    font-weight: 500;
}

.panel-title-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.panel-title-row h1 {
    margin: 0;
}

p {
    margin: 0;
    color: var(--muted);
}

.form-stack {
    display: grid;
    gap: 16px;
}

.login-panel input,
.login-panel select {
    min-height: 45px;
    border-color: rgba(148, 163, 184, 0.22);
    background: #0f1b2d;
    color: #e5edf7;
}

.login-panel input::placeholder {
    color: #94a3b8;
}

.login-panel button[type="submit"]:not(.secondary-action) {
    min-height: 48px;
    margin-top: 2px;
    border-radius: 12px;
    background: #22ace5;
    color: #06111f;
    box-shadow: 0 16px 30px rgba(34, 172, 229, 0.24);
    font-weight: 800;
}

.login-panel button[type="submit"]:not(.secondary-action):hover {
    background: #38bdf8;
}

.login-footer {
    margin-top: 18px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.password-page .login-shell {
    width: min(100%, 440px);
}

.password-page .login-panel {
    padding: 32px;
}

.password-page .brand-block {
    gap: 16px;
    margin-bottom: 24px;
}

.password-page .brand-block img {
    width: 112px;
    max-width: 48%;
}

.password-page .login-panel h1 {
    color: #e2e8f0;
    font-size: 25px;
    font-weight: 700;
}

.password-warning {
    padding: 12px 16px;
    margin-bottom: 18px;
    border: 1px solid rgba(245, 158, 11, 0.8);
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.12);
    color: #fde68a;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
    text-align: center;
}

.password-input-wrap {
    position: relative;
    display: block;
}

.password-input-wrap input {
    padding-left: 44px;
}

.password-input-wrap i {
    position: absolute;
    left: 16px;
    top: 50%;
    z-index: 1;
    width: 14px;
    height: 14px;
    border: 2px solid #94a3b8;
    border-radius: 3px;
    transform: translateY(-35%);
    pointer-events: none;
}

.password-input-wrap i::before {
    content: "";
    position: absolute;
    left: 2px;
    top: -10px;
    width: 6px;
    height: 8px;
    border: 2px solid #94a3b8;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
}

.password-page .form-actions {
    grid-template-columns: 1fr;
    gap: 12px;
}

.password-page .secondary-action {
    min-height: 44px;
    border-radius: 12px;
    background: rgba(71, 115, 143, 0.58);
    color: #e2e8f0;
    font-weight: 800;
    box-shadow: none;
}

.form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.secondary-action {
    border: 1px solid var(--line);
    background: #1c293b;
    color: var(--text);
}

.secondary-action:hover {
    background: #26364c;
}

label span,
.field-title {
    display: block;
    margin-bottom: 7px;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #0b1220;
    color: var(--text);
    font: inherit;
}

input:focus,
select:focus {
    outline: 3px solid rgba(23, 105, 170, 0.18);
    border-color: var(--primary);
}

button {
    min-height: 46px;
    border: 0;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

button:hover {
    background: var(--primary-dark);
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.button-link:hover {
    background: var(--primary-dark);
}

.button-link.secondary {
    background: #1d2a3b;
    color: var(--text);
}

.button-link.danger {
    background: #7f1d1d;
    color: #fee2e2;
}

.button-link.danger:hover {
    background: #991b1b;
}

.actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.actions-inline form {
    margin: 0;
}

.actions-inline button.button-link {
    border: 0;
    min-height: 34px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
}

.alert {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 6px;
    font-size: 14px;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
}

.info-box {
    padding: 12px 14px;
    border: 1px solid rgba(45, 212, 191, 0.28);
    border-radius: 6px;
    background: rgba(45, 212, 191, 0.09);
    color: #c7d2df;
    font-size: 14px;
}

.info-box strong {
    color: #f8fafc;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    min-height: 64px;
    padding: 12px 24px;
    background: #202b3c;
    border-bottom: 1px solid var(--line);
}

.topbar div,
.topbar nav {
    display: flex;
    gap: 16px;
    align-items: center;
}

.topbar span {
    color: var(--muted);
    font-size: 14px;
}

.topbar a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.topbar a.logout-link {
    color: #ff5b5b;
}

.topbar a.logout-link:hover {
    color: #ff7a7a;
}

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto;
}

.dashboard-page {
    width: calc(100% - 48px);
    max-width: 1880px;
    margin: 20px auto 34px;
    padding: 0;
    background: transparent;
}

.erp-hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    min-height: 108px;
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
}

.hero-company {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.company-logo-frame {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 96px;
    height: 96px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    overflow: hidden;
}

.company-logo-frame::before {
    display: none;
}

.company-logo-frame img {
    grid-area: 1 / 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
}

.company-logo-frame span {
    grid-area: 1 / 1;
    z-index: 1;
    color: var(--primary);
    font-size: 24px;
    font-weight: 800;
}

.erp-hero h1 {
    margin: 6px 0;
    color: var(--text);
    font-size: 26px;
}

.erp-hero p,
.erp-hero span {
    color: var(--muted);
}

.eyebrow {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    gap: 14px;
    min-width: 0;
    justify-content: end;
    align-items: stretch;
}

.hero-stats div {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #26364c;
    width: max-content;
    text-align: center;
}

.chart-tooltip {
    position: fixed;
    z-index: 20;
    display: none;
    min-width: 150px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #1c293b;
    color: var(--text);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
    pointer-events: none;
}

.chart-tooltip strong,
.chart-tooltip span {
    display: block;
}

.chart-tooltip span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.hero-stats span,
.hero-stats strong {
    display: block;
}

.hero-stats strong {
    margin-top: 6px;
    color: var(--text);
    font-size: 15px;
}

.dashboard-filters {
    display: grid;
    grid-template-columns: minmax(260px, 1.5fr) minmax(180px, 0.7fr) minmax(240px, 1fr);
    gap: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.period-custom .dashboard-filters {
    grid-template-columns: minmax(240px, 1.4fr) minmax(160px, 0.7fr) minmax(210px, 0.9fr) minmax(150px, 0.6fr) minmax(150px, 0.6fr);
}

.view-filter-field {
    position: relative;
}

.view-filter-field span {
    color: #67e8f9;
}

.view-filter-field::after {
    display: none;
}

.view-filter-field select {
    min-height: 44px;
    padding: 10px 12px;
    border-color: rgba(45, 212, 191, 0.58);
    background:
        linear-gradient(135deg, rgba(45, 212, 191, 0.16), rgba(96, 165, 250, 0.08)),
        #0f1b2d;
    box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.12), 0 10px 26px rgba(15, 23, 42, 0.18);
    color: #f8fafc;
    font-weight: 800;
}

.view-filter-field select:focus {
    outline: 3px solid rgba(45, 212, 191, 0.2);
    border-color: #2dd4bf;
}

.custom-period-field {
    display: none;
}

.period-custom .custom-period-field {
    display: block;
}

.kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.kpi-card {
    position: relative;
    min-height: 122px;
    padding: 16px 86px 16px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #26364c;
    box-shadow: none;
    overflow: hidden;
}

.kpi-icon {
    position: absolute;
    top: 16px;
    right: 18px;
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    color: rgba(96, 232, 219, 0.82);
    opacity: 0.95;
    filter: drop-shadow(0 10px 16px rgba(45, 212, 191, 0.1));
}

.kpi-icon svg {
    width: 58px;
    height: 58px;
    fill: currentColor;
    stroke: none;
}

.kpi-icon img {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.kpi-icon-img {
    width: 78px;
    height: 78px;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.18));
}

.kpi-card::after {
    display: none;
}

.kpi-card span,
.kpi-card small {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.kpi-card .kpi-icon {
    display: grid;
    color: rgba(96, 232, 219, 0.82);
}

.kpi-card strong {
    display: block;
    margin: 12px 0 8px;
    color: var(--text);
    font-size: 25px;
    line-height: 1.1;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 14px;
}

.dash-panel {
    grid-column: span 4;
    min-height: 0;
    padding: 18px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #26364c;
    box-shadow: none;
}

.panel-wide {
    grid-column: span 8;
}

.panel-full {
    grid-column: 1 / -1;
}

.view-vendas .dash-panel[data-view~="vendas"],
.view-estoque .dash-panel[data-view~="estoque"] {
    grid-column: 1 / -1;
}

.view-vendas .dash-panel.sales-inline-panel[data-view~="vendas"] {
    grid-column: span 6;
}

.view-estoque .dash-panel.stock-half-panel[data-view~="estoque"] {
    grid-column: span 6;
}

.view-estoque .dash-panel.stock-table-panel[data-view~="estoque"] {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    align-self: stretch;
    min-height: 0;
}

.view-estoque .dash-panel.stock-table-panel[data-view~="estoque"] .dash-panel-head {
    min-height: 0;
}

.view-estoque .dash-panel.stock-table-panel[data-view~="estoque"] .stock-table-wrap {
    height: 100%;
    min-height: 0;
    max-height: 860px;
    overflow: auto;
}

.sales-inline-panel .table-wrap {
    max-height: 390px;
    overflow: auto;
}

.view-financeiro .dash-panel[data-view~="financeiro"] {
    grid-column: span 6;
}

.view-financeiro .dash-panel.panel-full[data-view~="financeiro"] {
    grid-column: 1 / -1;
}

.dash-panel-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.dash-panel-head h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.dash-panel-head p {
    font-size: 13px;
}

.dash-panel canvas {
    width: 100%;
    max-height: 320px;
    display: block;
}

.panel-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.panel-actions button,
.modal-head button {
    min-height: 36px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #1c293b;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.panel-actions button:hover,
.modal-head button:hover {
    background: var(--primary-dark);
}

.modal-head button {
    border-color: #ef4444;
    background: #b91c1c;
    color: #fff;
}

.modal-head button:hover {
    background: #dc2626;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 15;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(8, 13, 20, 0.68);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-panel {
    width: min(980px, 100%);
    max-height: min(760px, calc(100vh - 48px));
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 16px;
}

.modal-head h2 {
    margin: 0 0 4px;
}

.modal-table {
    max-height: 610px;
    overflow: auto;
}

#salesChart,
#financeChart,
#stockChart {
    height: 260px;
}

#productsChart {
    height: 300px;
}

.mini-list {
    display: grid;
    gap: 12px;
}

.mini-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.mini-list span {
    color: var(--muted);
    font-size: 13px;
}

.mini-list strong {
    text-align: right;
}

.finance-aging {
    display: grid;
    gap: 14px;
}

.aging-row {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #1c293b;
}

.aging-row div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.aging-row span,
.aging-row small {
    color: var(--muted);
}

.aging-row strong {
    text-align: right;
}

.table-progress i.primary {
    background: #2dd4bf;
}

.table-progress i.danger {
    background: #ef4444;
}

.finance-agenda-wrap {
    max-height: 390px;
    overflow: auto;
}

.title-filters {
    display: grid;
    grid-template-columns: minmax(140px, 0.6fr) minmax(140px, 0.6fr) minmax(260px, 1.6fr);
    gap: 12px;
    margin-bottom: 14px;
}

.finance-title-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.finance-title-summary div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #1c293b;
}

.finance-title-summary span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
}

.finance-title-summary strong {
    display: block;
    font-size: 16px;
}

.finance-titles-wrap {
    max-height: 470px;
    overflow: auto;
}

.finance-titles-table {
    min-width: 1120px;
}

.finance-titles-table th:nth-child(3),
.finance-titles-table td:nth-child(3),
.finance-titles-table th:nth-child(5),
.finance-titles-table td:nth-child(5) {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.title-badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.title-badge.receber {
    background: rgba(45, 212, 191, 0.14);
    color: #7df3e5;
}

.title-badge.pagar {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
}

.status-pill.vencido {
    background: rgba(245, 158, 11, 0.14);
    color: #fbbf24;
}

.status-pill.a-vencer {
    background: rgba(96, 165, 250, 0.14);
    color: #bfdbfe;
}

.status-pill.baixado {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
}

.text-success {
    color: #6ee7b7;
}

.text-danger {
    color: #fca5a5;
}

.payment-ranking {
    display: grid;
    gap: 14px;
}

.stock-table-wrap {
    max-height: 390px;
    overflow: auto;
}

.stock-table {
    min-width: 760px;
}

.stock-table td:first-child {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-ranking {
    display: grid;
    gap: 12px;
}

.stock-rank-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(120px, auto);
    gap: 8px 14px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #1c293b;
}

.stock-rank-row > div:first-child {
    min-width: 0;
}

.stock-rank-row strong,
.stock-rank-row span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-rank-row span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.stock-rank-row b {
    text-align: right;
    white-space: nowrap;
}

.stock-rank-row .table-progress {
    grid-column: 1 / -1;
    width: 100%;
    margin: 0;
}

.payment-row {
    display: grid;
    gap: 7px;
}

.payment-row-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: baseline;
}

.payment-row-head strong {
    overflow: hidden;
    color: var(--text);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.payment-row-head span {
    color: var(--text);
    font-weight: 700;
    white-space: nowrap;
}

.payment-row-head small,
.payment-row > small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.payment-bar {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #1c293b;
}

.payment-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.payment-bar i.primary {
    background: #0fb99e;
}

.payment-bar i.secondary {
    background: #1f7ab6;
}

.product-column-chart {
    display: grid;
    grid-template-columns: repeat(8, minmax(70px, 1fr));
    gap: 12px;
    align-items: end;
    min-height: 300px;
}

.product-column {
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    gap: 8px;
    min-height: 280px;
    text-align: center;
}

.product-column-value {
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.product-column-track {
    display: flex;
    align-items: end;
    justify-content: center;
    min-height: 190px;
    border-radius: 8px;
    background: #1c293b;
    overflow: hidden;
}

.product-column-track i {
    display: block;
    width: 100%;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, #2dd4bf, #1f7ab6);
}

.product-column strong {
    color: var(--text);
}

.product-column span {
    color: var(--muted);
    font-size: 12px;
    min-height: 30px;
}

.top-products-wrap {
    max-height: 390px;
    overflow: auto;
}

.top-products-table {
    min-width: 820px;
}

.top-products-table th,
.top-products-table td {
    vertical-align: middle;
}

.top-products-table th:nth-child(1),
.top-products-table td:nth-child(1) {
    width: 70px;
}

.top-products-table th:nth-child(3),
.top-products-table td:nth-child(3) {
    width: 90px;
}

.top-products-table th:nth-child(4),
.top-products-table td:nth-child(4) {
    width: 150px;
    white-space: nowrap;
}

.top-products-table th:nth-child(5),
.top-products-table td:nth-child(5) {
    width: 260px;
}

.top-products-table td:nth-child(2) {
    max-width: 520px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-products-progress {
    width: 100%;
    max-width: 220px;
}

.hero-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #1c293b;
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.hero-action:hover {
    background: var(--primary-dark);
}

.chart-lab-filter {
    grid-template-columns: minmax(260px, 1.3fr) minmax(150px, 0.7fr) minmax(130px, 0.55fr) minmax(160px, 0.7fr) minmax(150px, 0.55fr);
    align-items: end;
}

.inline-check {
    display: flex;
    min-height: 44px;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    padding: 0 4px;
}

.inline-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.chart-lab-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.example-bars,
.example-cards,
.example-lollipop,
.example-compact {
    display: grid;
    gap: 12px;
}

.example-bar-row {
    display: grid;
    grid-template-columns: minmax(140px, 0.8fr) minmax(180px, 1.5fr) minmax(110px, auto);
    gap: 12px;
    align-items: center;
}

.example-bar-row strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.example-bar-row div,
.table-progress {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #1c293b;
}

.example-bar-row i,
.table-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #2dd4bf;
}

.example-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
    gap: 10px;
    min-height: 280px;
}

.example-column {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 8px;
    text-align: center;
}

.example-column div {
    display: flex;
    align-items: end;
    min-height: 190px;
    border-radius: 8px;
    background: #1c293b;
    overflow: hidden;
}

.example-column i {
    width: 100%;
    border-radius: 8px 8px 0 0;
}

.example-column span,
.example-column strong {
    font-size: 12px;
}

.example-donut-wrap {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 22px;
    align-items: center;
}

.example-donut {
    position: relative;
    display: grid;
    place-items: center;
    width: 210px;
    height: 210px;
    border-radius: 50%;
}

.example-donut strong {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: var(--panel);
    text-align: center;
}

.example-legend {
    display: grid;
    gap: 10px;
}

.example-legend div {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
}

.example-legend i {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.example-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.example-cards div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #1c293b;
}

.example-cards span,
.example-cards small {
    color: var(--muted);
}

.example-cards strong,
.example-cards b {
    display: block;
    margin-top: 8px;
}

.example-lollipop-row {
    display: grid;
    grid-template-columns: minmax(130px, 0.8fr) minmax(180px, 1.3fr) minmax(70px, auto);
    gap: 12px;
    align-items: center;
}

.example-lollipop-row span {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.example-lollipop-row div {
    position: relative;
    height: 18px;
}

.example-lollipop-row div::before,
.example-pareto-line {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    height: 2px;
    background: #32465f;
    transform: translateY(-50%);
}

.example-lollipop-row i {
    position: absolute;
    top: 50%;
    left: 0;
    height: 2px;
    background: var(--primary);
    transform: translateY(-50%);
}

.example-lollipop-row b {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    border: 3px solid #1c293b;
    border-radius: 50%;
    background: var(--primary);
    transform: translate(-50%, -50%);
}

.example-lollipop-row strong {
    color: var(--text);
    text-align: right;
    white-space: nowrap;
}

.example-treemap {
    display: flex;
    min-height: 280px;
    gap: 8px;
    align-content: stretch;
    flex-wrap: wrap;
}

.example-treemap div {
    display: grid;
    min-width: 120px;
    min-height: 82px;
    align-content: space-between;
    padding: 12px;
    border-radius: 8px;
    color: #ffffff;
    overflow: hidden;
}

.example-treemap strong,
.example-treemap span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.example-treemap strong {
    font-size: 13px;
}

.example-treemap span {
    font-size: 22px;
    font-weight: 800;
}

.example-bubbles {
    display: flex;
    min-height: 280px;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.example-bubbles div {
    display: grid;
    place-items: center;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #ffffff;
    text-align: center;
}

.example-bubbles strong,
.example-bubbles span {
    display: block;
    line-height: 1.1;
}

.example-bubbles span {
    font-size: 12px;
}

.example-pareto {
    display: grid;
    gap: 10px;
}

.example-pareto-row {
    display: grid;
    grid-template-columns: 26px 1fr 1fr minmax(42px, auto);
    gap: 10px;
    align-items: center;
}

.example-pareto-row > span {
    color: var(--muted);
    font-weight: 700;
}

.example-pareto-bar,
.example-pareto-line {
    position: relative;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #1c293b;
}

.example-pareto-line {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    transform: none;
}

.example-pareto-bar i,
.example-pareto-line i {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.example-pareto-bar i {
    background: var(--primary);
}

.example-pareto-line i {
    background: #8b5cf6;
}

.example-pareto-row strong {
    text-align: right;
}

.example-compact div {
    display: grid;
    grid-template-columns: 36px minmax(160px, 1fr) minmax(90px, auto) minmax(52px, auto);
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #1c293b;
}

.example-compact span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.example-compact strong {
    color: var(--primary);
}

.example-compact b {
    text-align: right;
}

.example-compact small {
    color: var(--muted);
    text-align: right;
}

.example-waffle {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 18px;
    align-items: start;
}

.example-waffle-grid {
    display: grid;
    grid-template-columns: repeat(10, 13px);
    gap: 5px;
}

.example-waffle-grid i {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    background: #1c293b;
}

.table-progress {
    width: min(220px, 100%);
    margin-bottom: 4px;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(300px, 420px) 1fr;
    gap: 20px;
    align-items: start;
}

.panel,
.empty-state {
    padding: 24px;
}

.empty-state {
    min-height: 260px;
    display: grid;
    align-content: center;
    gap: 8px;
}

.dashboard-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: end;
    margin-bottom: 20px;
}

.company-dashboard {
    display: grid;
    gap: 18px;
}

.company-card {
    padding: 22px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.company-card-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.company-card-head h2 {
    margin: 0 0 4px;
    font-size: 20px;
}

.company-card-head span {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
}

.metric {
    min-height: 118px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0b1220;
}

.metric span,
.metric small {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    display: block;
    margin: 12px 0 6px;
    font-size: 22px;
    line-height: 1.2;
}

.check-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.check-row input {
    width: 18px;
    min-height: 18px;
    margin-top: 2px;
}

.check-row span {
    margin: 0;
    font-weight: 600;
}

.check-row small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-weight: 400;
}

.company-list {
    display: grid;
    gap: 10px;
    max-height: 220px;
    padding: 12px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #0b1220;
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.field-help {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.password-rules {
    display: grid;
    gap: 8px;
    padding: 0 0 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.password-rules span {
    position: relative;
    display: block;
    margin: 0;
    padding-left: 30px;
    color: #ef4444;
    font-size: 13px;
    font-weight: 700;
}

.password-rules span::before {
    content: "x";
    position: absolute;
    left: 0;
    top: -1px;
    width: 18px;
    height: 20px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #ef4444;
    font-size: 18px;
    font-weight: 400;
    line-height: 20px;
    text-align: center;
}

.password-rules span.is-ok {
    color: #86efac;
}

.password-rules span.is-ok::before {
    content: "✓";
    color: #22c55e;
    background: transparent;
    box-shadow: none;
}

.table-wrap {
    overflow-x: auto;
}

.panel-full .table-wrap {
    max-height: 420px;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: #cbd5e1;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.text-center {
    text-align: center;
}

@media (max-width: 860px) {
    .two-column,
    .dashboard-head,
    .company-card-head,
    .topbar,
    .topbar div,
    .topbar nav {
        display: grid;
    }

    .two-column {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: start;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-page {
        width: min(100% - 18px, 1440px);
    }

    .erp-hero,
    .dashboard-filters {
        display: grid;
    }

    .hero-stats,
    .dashboard-filters,
    .kpi-strip,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .hero-stats {
        min-width: 0;
    }

    .hero-stats div,
    .hero-action {
        width: 100%;
    }

    .chart-lab-grid,
    .example-donut-wrap,
    .example-cards,
    .example-waffle {
        grid-template-columns: 1fr;
    }

    .example-bar-row,
    .example-lollipop-row,
    .example-pareto-row,
    .example-compact div {
        grid-template-columns: 1fr;
    }

    .example-columns {
        grid-template-columns: repeat(4, minmax(44px, 1fr));
    }

    .example-donut {
        margin: 0 auto;
    }

    .example-waffle-grid {
        justify-content: center;
    }

    .example-lollipop-row strong,
    .example-compact b,
    .example-compact small,
    .example-pareto-row strong {
        text-align: left;
    }

    .title-filters,
    .finance-title-summary {
        grid-template-columns: 1fr;
    }

    .dash-panel,
    .panel-wide,
    .panel-full {
        grid-column: auto;
    }
}

@media (min-width: 861px) and (max-width: 1180px) {
    .kpi-strip {
        grid-template-columns: repeat(3, 1fr);
    }

    .dash-panel,
    .panel-wide {
        grid-column: span 6;
    }

    .panel-full {
        grid-column: 1 / -1;
    }
}

.dashboard-loading[hidden] {
    display: none;
}

.dashboard-loading {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(10, 18, 30, .82);
    backdrop-filter: blur(4px);
}

.dashboard-loading-card {
    width: min(430px, 100%);
    padding: 26px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 16px;
    background: #26364c;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .38);
    color: #f8fafc;
    text-align: center;
}

.dashboard-loading-card strong {
    display: block;
    margin-bottom: 16px;
    font-size: 17px;
}

.dashboard-loading-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
}

.dashboard-loading-track i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0fb99e, #49d7bd);
    transition: width .18s ease;
}

.dashboard-loading-card span {
    display: block;
    margin-top: 10px;
    color: #a7b4c6;
    font-variant-numeric: tabular-nums;
}
