body {
    font-family: 'Inter', sans-serif;
}

.app-shell-body {
    overflow-x: hidden;
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

.bg-pattern {
    background-image: radial-gradient(circle at 2px 2px, rgba(0, 30, 64, 0.04) 1px, transparent 0);
    background-size: 24px 24px;
}

.civic-hero-gradient {
    background: linear-gradient(135deg, #001e40 0%, #003366 52%, #00658d 100%);
}

.soft-surface {
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.86));
}

.editorial-kicker {
    letter-spacing: 0.22em;
}

.table-scroll::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 30, 64, 0.18);
    border-radius: 999px;
}

.table-scroll::-webkit-scrollbar-track {
    background: rgba(0, 30, 64, 0.04);
}

.result-photo {
    background: linear-gradient(135deg, rgba(0, 30, 64, 0.12), rgba(45, 188, 254, 0.16));
}

.status-dot {
    display: inline-flex;
    height: 0.55rem;
    width: 0.55rem;
    border-radius: 999px;
}

.chart-shell canvas {
    max-height: 320px;
}

.shadow-civic {
    box-shadow: 0 12px 32px -4px rgba(0,30,64,0.08);
}

.app-sidebar {
    width: 18rem;
    transform: translateX(-100%);
    transition: width 0.25s ease, transform 0.25s ease;
}

.sidebar-brand-toggle {
    overflow: hidden;
}

.sidebar-brand-default-icon,
.sidebar-brand-hover-icon {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sidebar-brand-hover-icon {
    transform: scale(0.8);
}

.sidebar-brand-toggle:hover .sidebar-brand-default-icon,
.sidebar-brand-toggle:focus-visible .sidebar-brand-default-icon {
    opacity: 0;
    transform: scale(0.78);
}

.sidebar-brand-toggle:hover .sidebar-brand-hover-icon,
.sidebar-brand-toggle:focus-visible .sidebar-brand-hover-icon {
    opacity: 1;
    transform: scale(1);
}

.app-main,
.app-footer {
    transition: margin-left 0.25s ease;
}

.sidebar-backdrop {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.sidebar-submenu {
    border-left: 1px solid rgba(148, 163, 184, 0.24);
}

.user-menu-panel.is-open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.query-form-shell {
    position: relative;
}

.query-form-shell.is-loading {
    pointer-events: none;
}

.query-form-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    background: rgba(247, 250, 252, 0.78);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 140;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.query-form-shell.is-loading .query-form-overlay {
    opacity: 1;
    visibility: visible;
}

.query-form-feedback {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 999px;
    background: rgba(0, 30, 64, 0.94);
    color: #fff;
    padding: 0.9rem 1.15rem;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    box-shadow: 0 16px 42px -18px rgba(0, 30, 64, 0.45);
    position: relative;
    z-index: 141;
}

.query-form-spinner,
.button-spinner {
    display: inline-flex;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-top-color: currentColor;
    animation: civic-spin 0.7s linear infinite;
}

.button-spinner {
    width: 0.95rem;
    height: 0.95rem;
}

.ts-wrapper.sunarp-tomselect {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    min-height: 3rem;
}

.ts-wrapper.sunarp-tomselect .ts-control {
    min-height: 3rem;
    border-radius: 0.75rem;
    border: 1px solid rgb(203 213 225);
    background: #ffffff;
    box-shadow: none;
    padding: 0.7rem 0.9rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgb(0 30 64);
}

.ts-wrapper.sunarp-tomselect.focus .ts-control,
.ts-wrapper.sunarp-tomselect .ts-control:focus-within {
    border-color: rgb(0 30 64);
    background: #fff;
    box-shadow: 0 10px 24px -18px rgba(0, 30, 64, 0.22);
}

.ts-wrapper.sunarp-tomselect .ts-control > input {
    color: rgb(0 30 64);
    font-size: 0.875rem;
}

.ts-wrapper.sunarp-tomselect .ts-control > input::placeholder,
.ts-wrapper.sunarp-tomselect .ts-control .item[data-value=''] {
    color: rgb(148 163 184);
}

.ts-dropdown.sunarp-tomselect-dropdown {
    margin-top: 0.45rem;
    min-width: 100%;
    border-radius: 0.75rem;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 18px 36px -20px rgba(0, 30, 64, 0.22);
    overflow: hidden;
    z-index: 80;
}

.query-form-shell.is-loading .ts-dropdown.sunarp-tomselect-dropdown {
    visibility: hidden;
    opacity: 0;
}

.history-filter-shell {
    overflow: visible;
    background:
        radial-gradient(circle at top right, rgba(45, 188, 254, 0.08), transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 252, 0.96));
}

.history-filter-shell__header {
    position: relative;
}

.history-filter-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.7rem;
    overflow: visible;
}

.history-filter-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: rgb(100 116 139);
}

.history-filter-control {
    position: relative;
    display: flex;
    min-height: 3.35rem;
    align-items: center;
    border: 1px solid rgba(203, 213, 225, 0.95);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.history-filter-control:focus-within {
    border-color: rgba(14, 116, 144, 0.55);
    box-shadow: 0 14px 30px -24px rgba(14, 116, 144, 0.55);
}

.history-filter-icon {
    position: absolute;
    left: 1rem;
    font-size: 1.15rem;
    color: rgb(14 116 144);
    pointer-events: none;
}

.history-filter-input {
    width: 100%;
    min-height: 3.35rem;
    border: 0;
    border-radius: inherit;
    background: transparent;
    padding: 0 1rem 0 2.95rem;
    font-size: 0.94rem;
    font-weight: 600;
    color: rgb(15 23 42);
    outline: none;
}

.history-filter-input::placeholder {
    color: rgb(148 163 184);
    font-weight: 500;
}

.history-filter-select {
    width: 100%;
    min-height: 3.35rem;
    border: 1px solid rgba(203, 213, 225, 0.95);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
    padding: 0.84rem 2.9rem 0.84rem 1rem;
    font-size: 0.94rem;
    font-weight: 600;
    color: rgb(15 23 42);
    outline: none;
    appearance: none;
}

.history-filter-select:focus {
    border-color: rgba(14, 116, 144, 0.55);
    box-shadow: 0 14px 30px -24px rgba(14, 116, 144, 0.55);
}

.history-filter-control--date .history-filter-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.9;
}

.history-filter-actions {
    display: flex;
    align-items: flex-end;
}

.history-filter-shell .ts-wrapper.sunarp-tomselect {
    position: relative;
    min-height: 3.35rem;
    z-index: 1;
}

.history-filter-shell .ts-wrapper.sunarp-tomselect::after {
    content: 'expand_more';
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    font-family: 'Material Symbols Outlined';
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1;
    color: rgb(100 116 139);
    pointer-events: none;
    transition: transform 0.2s ease, color 0.2s ease;
}

.history-filter-shell .ts-wrapper.sunarp-tomselect.dropdown-active::after,
.history-filter-shell .ts-wrapper.sunarp-tomselect.focus::after {
    color: rgb(14 116 144);
    transform: translateY(-50%) rotate(180deg);
}

.history-filter-shell .ts-wrapper.sunarp-tomselect.dropdown-active,
.history-filter-shell .ts-wrapper.sunarp-tomselect.focus {
    z-index: 90;
}

.history-filter-shell .ts-wrapper.sunarp-tomselect .ts-control {
    min-height: 3.35rem;
    border-radius: 1rem;
    border: 1px solid rgba(203, 213, 225, 0.95);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
    padding: 0.84rem 2.9rem 0.84rem 1rem;
    font-size: 0.94rem;
    font-weight: 600;
    color: rgb(15 23 42);
}

.history-filter-shell .ts-wrapper.sunarp-tomselect.focus .ts-control,
.history-filter-shell .ts-wrapper.sunarp-tomselect .ts-control:focus-within {
    border-color: rgba(14, 116, 144, 0.55);
    background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(248, 250, 252, 0.98));
    box-shadow: 0 14px 30px -24px rgba(14, 116, 144, 0.55);
}

.history-filter-shell .ts-wrapper.sunarp-tomselect .ts-control > input {
    font-size: 0.94rem;
    color: rgb(15 23 42);
}

.history-filter-shell .ts-wrapper.sunarp-tomselect .ts-control > input::placeholder,
.history-filter-shell .ts-wrapper.sunarp-tomselect .ts-control .item[data-value=''] {
    color: rgb(148 163 184);
    font-weight: 500;
}

.history-filter-shell .ts-dropdown.sunarp-tomselect-dropdown {
    margin-top: 0.55rem;
    border-radius: 1rem;
    border: 1px solid rgba(226, 232, 240, 0.96);
    box-shadow: 0 24px 44px -28px rgba(15, 23, 42, 0.28);
    z-index: 120;
}

.history-filter-shell .ts-dropdown.sunarp-tomselect-dropdown .option,
.history-filter-shell .ts-dropdown.sunarp-tomselect-dropdown .create {
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.history-filter-shell .ts-dropdown.sunarp-tomselect-dropdown .active {
    background: rgba(14, 116, 144, 0.08);
    color: rgb(15 23 42);
}

@media (max-width: 1279px) {
    .history-filter-actions {
        align-items: stretch;
    }
}

@media (min-width: 1280px) {
    .history-filter-grid {
        align-items: end;
    }
}

.sunarp-pdf-modal {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    overflow-y: auto;
    margin-top: 0 !important;
}

.sunarp-pdf-modal.hidden {
    display: none;
}

.sunarp-pdf-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 30, 64, 0.58);
    backdrop-filter: blur(4px);
}

.sunarp-pdf-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    max-height: calc(100vh - 2.5rem);
    width: min(1240px, 100%);
    flex-direction: column;
    overflow: hidden;
    margin: auto;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 1.5rem;
    background: #fff;
    box-shadow: 0 36px 90px -42px rgba(0, 30, 64, 0.42);
}

.sunarp-pdf-modal__header {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    padding: 1.35rem 1.5rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    background: linear-gradient(135deg, #001e40 0%, #003366 52%, #00658d 100%);
    color: #fff;
}

.sunarp-pdf-modal__eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.sunarp-pdf-modal__title {
    margin: 0.8rem 0 0;
    font-size: 1.65rem;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.sunarp-pdf-modal__subtitle {
    margin: 0.4rem 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.9rem;
    line-height: 1.6;
}

.sunarp-pdf-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.sunarp-pdf-action,
.sunarp-pdf-close-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 2.9rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    padding: 0 1rem;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.sunarp-pdf-action {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.sunarp-pdf-action:hover,
.sunarp-pdf-close-button:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.18);
}

.sunarp-pdf-action[aria-disabled='true'] {
    opacity: 0.45;
    pointer-events: none;
}

.sunarp-pdf-action--secondary {
    background: rgba(255, 255, 255, 0.06);
}

.sunarp-pdf-close-button {
    width: 2.9rem;
    padding: 0;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sunarp-pdf-modal__body {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    gap: 1rem;
    padding: 1.5rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 0.98));
}

.sunarp-pdf-status {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 1rem;
    border: 1px solid rgba(0, 101, 141, 0.16);
    background: rgba(0, 101, 141, 0.06);
    padding: 0.95rem 1rem;
    font-size: 0.86rem;
    font-weight: 700;
    color: #0f2e4d;
}

.sunarp-pdf-status[data-tone='success'] {
    border-color: rgba(5, 150, 105, 0.18);
    background: rgba(5, 150, 105, 0.08);
    color: #047857;
}

.sunarp-pdf-status[data-tone='error'] {
    border-color: rgba(190, 24, 93, 0.18);
    background: rgba(190, 24, 93, 0.08);
    color: #9f1239;
}

.sunarp-pdf-status[data-tone='success'] .query-form-spinner,
.sunarp-pdf-status[data-tone='error'] .query-form-spinner {
    display: none;
}

.sunarp-pdf-frame {
    width: 100%;
    min-height: 72vh;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 1rem;
    background: #fff;
}

.sunarp-pdf-fallback {
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 1rem;
    background: #fff;
    padding: 1rem;
}

.sunarp-pdf-fallback img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0.75rem;
}

body.sunarp-pdf-modal-open {
    overflow: hidden;
}

body.app-modal-open {
    overflow: hidden;
}

.ts-dropdown.sunarp-tomselect-dropdown .option,
.ts-dropdown.sunarp-tomselect-dropdown .create {
    padding: 0.8rem 0.95rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.ts-dropdown.sunarp-tomselect-dropdown .active {
    background: rgba(0, 30, 64, 0.06);
    color: rgb(0 30 64);
}

.login-shell {
    position: relative;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 1.35rem;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
}

.login-brand-panel {
    position: relative;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(255, 255, 255, 0.98));
}

.login-brand-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
}

.login-brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.45rem;
    min-height: 3.45rem;
    padding: 0.2rem;
}

.login-brand-eyebrow {
    margin: 0;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgb(100 116 139);
}

.login-brand-title {
    margin: 0;
    color: rgb(0 30 64);
    font-size: clamp(1.15rem, 2.4vw, 1.34rem);
    font-weight: 900;
    line-height: 1.04;
    letter-spacing: -0.025em;
}

.login-brand-copy {
    margin: 0;
    max-width: 14.5rem;
    color: rgb(100 116 139);
    font-size: 0.73rem;
    line-height: 1.34;
}

.login-form-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.82));
}

.login-field-label {
    display: block;
    color: rgb(100 116 139);
    font-size: 0.56rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.login-input-shell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.8rem;
    padding: 0.22rem 0.45rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 0.72rem;
    background: #fff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.75),
        0 4px 14px -24px rgba(15, 23, 42, 0.2);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.login-input-shell:focus-within {
    border-color: rgba(0, 101, 141, 0.45);
    box-shadow:
        0 0 0 3px rgba(45, 188, 254, 0.08),
        0 10px 20px -26px rgba(0, 30, 64, 0.3);
}

.login-input-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 0.56rem;
    background: rgba(0, 101, 141, 0.08);
    flex-shrink: 0;
}

.login-input-control {
    width: 100%;
    min-width: 0;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    color: rgb(15 23 42);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
}

.login-input-control::placeholder {
    color: rgb(148 163 184);
    font-weight: 500;
}

.login-input-control:focus {
    outline: none;
    box-shadow: none !important;
}

.login-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border: 0;
    border-radius: 0.56rem;
    background: transparent;
    color: rgb(100 116 139);
    transition: background 0.18s ease, color 0.18s ease;
}

.login-toggle-btn:hover,
.login-toggle-btn:focus-visible {
    background: rgba(0, 101, 141, 0.08);
    color: rgb(0 30 64);
    outline: none;
}

.login-primary-button {
    border-radius: 0.82rem;
    background: linear-gradient(135deg, rgb(0 30 64), rgb(0 101 141));
    box-shadow: 0 10px 18px -18px rgba(0, 30, 64, 0.3);
    font-size: 0.84rem;
}

.login-primary-button:hover {
    background: linear-gradient(135deg, rgb(0 24 51), rgb(0 86 120));
}

.login-security-strip {
    border-top: 1px solid rgba(226, 232, 240, 0.85);
    background: rgba(248, 250, 252, 0.96);
    font-size: 0.68rem;
}

@keyframes civic-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1023px) {
    .mobile-overflow {
        overflow-x: auto;
    }

    .sunarp-pdf-modal {
        padding: 0.75rem;
    }

    .sunarp-pdf-modal__header,
    .sunarp-pdf-modal__body {
        padding: 1rem;
    }

    .sunarp-pdf-modal__title {
        font-size: 1.35rem;
    }

    .sunarp-pdf-frame {
        min-height: 62vh;
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (min-width: 1024px) {
    body.app-shell-body .app-sidebar {
        transform: translateX(0);
    }

    body.app-shell-body .app-main,
    body.app-shell-body .app-footer {
        margin-left: 18rem;
    }

    body.app-shell-body.sidebar-collapsed .app-sidebar {
        width: 6rem;
    }

    body.app-shell-body.sidebar-collapsed .app-main,
    body.app-shell-body.sidebar-collapsed .app-footer {
        margin-left: 6rem;
    }

    body.app-shell-body.sidebar-collapsed [data-sidebar-brand-text],
    body.app-shell-body.sidebar-collapsed [data-sidebar-label],
    body.app-shell-body.sidebar-collapsed .sidebar-user-meta {
        width: 0;
        min-width: 0;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
    }

    body.app-shell-body.sidebar-collapsed .sidebar-link,
    body.app-shell-body.sidebar-collapsed .sidebar-quick-action,
    body.app-shell-body.sidebar-collapsed .sidebar-user-card-inner {
        justify-content: center;
    }

    body.app-shell-body.sidebar-collapsed .sidebar-brand-row {
        justify-content: center;
    }

    body.app-shell-body.sidebar-collapsed .sidebar-submenu {
        display: none;
    }

    body.app-shell-body.sidebar-collapsed .sidebar-link,
    body.app-shell-body.sidebar-collapsed .sidebar-quick-action {
        padding-left: 0.875rem;
        padding-right: 0.875rem;
    }
}
