:root {
    --orange: #eb7a1d;
    --orange-dark: #d76608;
    --panel: #ffffff;
    --panel-border: #dbe4ee;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.page-loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, .28);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .18s ease, visibility .18s ease;
    z-index: 1200;
}

.page-loading-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.page-loading-card {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    min-width: 240px;
    border-radius: .9rem;
    border: 1px solid #dbe4ee;
    background: #fff;
    color: #0f172a;
    padding: .8rem 1rem;
    box-shadow: 0 18px 36px rgba(15, 23, 42, .2);
}

.loader-spinner {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--orange-dark);
    animation: dashboard-spin .8s linear infinite;
}

.page-loading-text {
    margin: 0;
    font-size: .9rem;
    font-weight: 600;
}

body.is-loading {
    cursor: progress;
}

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

.container-page {
    max-width: 1460px;
    margin: 0 auto;
}

.topbar {
    background: linear-gradient(90deg, var(--orange), #f39b3c);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}

.top-refresh {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.top-refresh-select {
    border: 1px solid rgba(255, 255, 255, .45);
    background: rgba(255, 255, 255, .15);
    color: #fff;
    border-radius: .55rem;
    padding: .35rem .6rem;
    font-size: .86rem;
    font-weight: 600;
}

.top-refresh-select option {
    color: #0f172a;
}

.top-refresh-select:focus {
    outline: none;
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .25);
}

.tab-strip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem;
    border: 1px solid #d7e0ea;
    background: #eef2f7;
    border-radius: .85rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab-pill {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border-radius: .6rem;
    border: 1px solid transparent;
    padding: .55rem .9rem;
    font-size: .92rem;
    font-weight: 700;
    color: #475569;
    background: transparent;
    text-decoration: none;
    position: relative;
    transition: all .18s ease;
}

.tab-pill:hover {
    color: #334155;
    background: rgba(255, 255, 255, .55);
}

.tab-pill:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .25);
}

.tab-pill::after {
    content: "";
    position: absolute;
    left: .7rem;
    right: .7rem;
    bottom: .22rem;
    height: 2px;
    border-radius: 999px;
    background: #ea580c;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform .2s ease;
}

.tab-pill-active {
    border-color: #f7c59b;
    background: #fff;
    color: #9a3412;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .08);
}

.tab-pill-active::after {
    transform: scaleX(1);
}

.input-base {
    width: 100%;
    border: 1px solid #cdd8e4;
    border-radius: .65rem;
    padding: .55rem .7rem;
    background: #fff;
    color: #0f172a;
    font-size: .92rem;
}

.input-base:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .2);
}

.ts-wrapper.input-base {
    padding: 0;
    border: 1px solid #cdd8e4;
}

.ts-wrapper.multi .ts-control {
    border: 0;
    border-radius: .65rem;
    min-height: 43px;
    padding: .35rem .45rem;
    box-shadow: none;
}

.ts-wrapper.focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .2);
    border-radius: .65rem;
}

.ts-wrapper .ts-control > input {
    font-size: .9rem;
}

.ts-wrapper.multi .ts-control > div {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: .12rem .5rem;
    font-size: .78rem;
    font-weight: 600;
}

.ts-wrapper .ts-dropdown {
    border: 1px solid #dbe4ee;
    border-radius: .7rem;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .12);
    overflow: hidden;
    margin-top: .35rem;
}

.ts-wrapper .ts-dropdown .option {
    padding: .5rem .7rem;
    font-size: .86rem;
}

.ts-wrapper .ts-dropdown .option.active {
    background: #fff7ed;
    color: #9a3412;
}

.ts-wrapper .ts-dropdown .no-results {
    padding: .55rem .7rem;
    font-size: .82rem;
    color: #64748b;
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .7rem;
    padding: .62rem 1rem;
    font-size: .9rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--orange);
    border-color: var(--orange);
    color: #fff;
    transition: all .18s ease;
}

.btn-primary:hover {
    background: var(--orange-dark);
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(154, 52, 18, .2);
}

.btn-secondary {
    background: #eef2f7;
    color: #1f2937;
    border-color: #d6dee8;
    transition: all .18s ease;
}

.btn-secondary:hover {
    background: #e6ebf2;
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(15, 23, 42, .1);
}

.btn-export {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.btn-export:hover {
    background: #ffedd5;
}

.form-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-actions-main,
.form-actions-export {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: wrap;
}

.form-actions-export {
    margin-left: auto;
}

@media (max-width: 860px) {
    .tab-strip {
        display: flex;
        width: 100%;
    }

    .form-actions-row {
        align-items: stretch;
        gap: .7rem;
    }

    .form-actions-main,
    .form-actions-export {
        width: 100%;
    }

    .form-actions-export {
        margin-left: 0;
        justify-content: flex-start;
    }
}

.kpi-card {
    border-radius: .95rem;
    color: #fff;
    padding: 1rem 1rem;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .12);
}

.kpi-title {
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin: 0;
    opacity: .92;
}

.kpi-value {
    margin: .25rem 0 .25rem;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
}

.kpi-sub {
    margin: 0;
    font-size: .82rem;
    opacity: .95;
}

.panel-card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-top: 4px solid #23a57f;
    border-radius: .95rem;
    padding: .95rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}

.panel-title {
    margin: 0 0 .8rem;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.table-base {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

.table-base th,
.table-base td {
    font-size: .85rem;
    padding: .58rem .5rem;
    border-bottom: 1px solid #e7edf5;
    text-align: left;
    white-space: nowrap;
}

.table-base th {
    font-weight: 700;
    color: #334155;
    background: #f8fafc;
}

.table-base tbody tr:hover {
    background: #f8fbff;
}

.badge-soft {
    display: inline-block;
    border-radius: 999px;
    background: #eef6ff;
    color: #0f4f8a;
    font-weight: 700;
    padding: .25rem .55rem;
    font-size: .76rem;
}

.chart-wrap {
    position: relative;
    width: 100%;
    height: 320px;
}

.chart-wrap-wide {
    height: 360px;
}

.chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.auth-shell {
    min-height: 100vh;
    background: linear-gradient(180deg, #e2e8f0 0%, #f8fafc 55%, #f1f5f9 100%);
}

.auth-main {
    max-width: 560px;
    margin: 0 auto;
    padding: 2rem 1rem 2.4rem;
}

.auth-card {
    background: #fff;
    border: 1px solid #dbe4ee;
    border-radius: 1rem;
    padding: 1.15rem;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
}

.auth-title {
    margin: 0;
    font-size: 1.4rem;
    color: #0f172a;
    font-weight: 800;
}

.auth-subtitle {
    margin: .45rem 0 0;
    color: #475569;
    line-height: 1.45;
    font-size: .94rem;
}

.auth-grid {
    display: grid;
    gap: .75rem;
    margin-top: 1rem;
}

.form-control {
    display: block;
}

.form-label {
    display: block;
    margin: 0 0 .3rem;
    font-size: .86rem;
    font-weight: 700;
    color: #334155;
}

.field-help {
    margin: .35rem 0 0;
    font-size: .74rem;
    color: #64748b;
}

.alert-error,
.alert-success {
    border-radius: .8rem;
    border: 1px solid transparent;
    padding: .7rem .85rem;
    margin-bottom: .9rem;
}

.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.account-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.account-meta {
    font-size: .86rem;
    color: #475569;
}

.account-meta strong {
    color: #0f172a;
}

.account-actions {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: wrap;
}

.btn-text {
    border: 1px solid #d6dee8;
    border-radius: .6rem;
    background: #fff;
    color: #334155;
    font-size: .84rem;
    font-weight: 700;
    padding: .43rem .76rem;
    cursor: pointer;
    transition: all .18s ease;
}

.btn-text:hover {
    background: #f8fafc;
}

.topbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .8rem;
    flex-wrap: wrap;
}

.topbar-user-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .36);
    border-radius: 999px;
    padding: .3rem .65rem;
    font-size: .82rem;
    font-weight: 700;
    color: #fff;
}

.top-action-btn {
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: .6rem;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    padding: .34rem .62rem;
    cursor: pointer;
    transition: all .18s ease;
}

.top-action-btn:hover {
    background: rgba(255, 255, 255, .24);
}

@media (max-width: 860px) {
    .auth-main {
        padding: 1.4rem .9rem 2rem;
    }

    .topbar-right {
        width: 100%;
        justify-content: flex-start;
    }

    .top-refresh {
        width: 100%;
    }

    .top-refresh-select {
        min-width: 130px;
    }
}
