:root {
    --gov-navy-950: #081421;
    --gov-navy-900: #0b1c2d;
    --gov-navy-800: #102a43;
    --gov-gold-500: #c6a75e;
    --gov-gold-300: #e2cf9b;
    --gov-bg: #f3f5f8;
    --gov-surface: #ffffff;
    --gov-border: #d8dee7;
    --gov-text: #13283f;
    --gov-muted: #5e6b7a;
    --gov-shadow-sm: 0 8px 20px rgba(16, 42, 67, 0.06);
    --gov-shadow-md: 0 14px 28px rgba(11, 28, 45, 0.1);
}

html,
body {
    background-color: var(--gov-bg);
}

body.gov-shell {
    color: var(--gov-text);
    position: relative;
    isolation: isolate;
}

body.gov-shell::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(1200px 600px at 15% -15%, rgba(16, 42, 67, 0.16), transparent 62%),
        radial-gradient(900px 500px at 95% -20%, rgba(198, 167, 94, 0.18), transparent 60%),
        linear-gradient(180deg, #eff3f7 0%, #f7f9fc 45%, #f2f5f8 100%);
}

body.gov-shell::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: linear-gradient(rgba(16, 42, 67, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(16, 42, 67, 0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.28;
    pointer-events: none;
}

/* Topbar */
.gov-topbar {
    border-bottom: 1px solid rgba(16, 42, 67, 0.12);
    background: linear-gradient(120deg, rgba(8, 20, 33, 0.96), rgba(16, 42, 67, 0.94));
    backdrop-filter: blur(10px);
    box-shadow: var(--gov-shadow-sm);
}

.gov-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #f8fbff;
}

.gov-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.625rem;
    background: linear-gradient(145deg, var(--gov-gold-300), var(--gov-gold-500));
    color: var(--gov-navy-900);
    font-size: 0.75rem;
    font-weight: 800;
}

.gov-brand-sub {
    color: #d3deeb;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gov-nav-link {
    display: inline-flex;
    align-items: center;
    border-radius: 0.625rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #c8d6e6;
    transition: all 180ms ease;
}

.gov-nav-link:hover,
.gov-nav-link:focus-visible {
    color: #ffffff;
    background: rgba(198, 167, 94, 0.16);
}

.gov-search-wrap {
    position: relative;
    width: min(100%, 20rem);
}

.gov-search-wrap svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #8ea0b6;
    pointer-events: none;
}

.gov-search-input {
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid rgba(214, 223, 235, 0.32);
    background: rgba(9, 24, 38, 0.54);
    padding: 0.55rem 0.9rem 0.55rem 2.1rem;
    color: #eff6ff;
    font-size: 0.875rem;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.gov-search-input::placeholder {
    color: #9eb0c3;
}

.gov-search-input:focus {
    outline: none;
    border-color: rgba(198, 167, 94, 0.64);
    box-shadow: 0 0 0 2px rgba(198, 167, 94, 0.22);
}

.gov-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.375rem;
    height: 2.375rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(214, 223, 235, 0.34);
    color: #d7e3f0;
    background: rgba(9, 24, 38, 0.52);
    transition: all 180ms ease;
}

.gov-icon-btn:hover,
.gov-icon-btn:focus-visible {
    border-color: rgba(198, 167, 94, 0.7);
    color: #fff;
    background: rgba(198, 167, 94, 0.2);
}

.gov-profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.35rem 0.75rem 0.35rem 0.4rem;
    border-radius: 999px;
    border: 1px solid rgba(214, 223, 235, 0.34);
    background: rgba(9, 24, 38, 0.52);
    color: #eff6ff;
}

.gov-avatar {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(140deg, rgba(198, 167, 94, 0.34), rgba(198, 167, 94, 0.7));
    color: var(--gov-navy-950);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

/* Sidebar */
.gov-sidebar-panel {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 340px);
    padding: 0.75rem;
    transform: translateX(calc(-100% - 1rem));
    transition: transform 220ms ease;
    z-index: 60;
    pointer-events: none;
}

.gov-sidebar-panel.is-open {
    transform: translateX(0);
    pointer-events: auto;
}

.gov-sidebar-panel .gov-sidebar-shell {
    height: 100%;
    overflow-y: auto;
}

.gov-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(8, 20, 33, 0.56);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.gov-sidebar-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

body.gov-sidebar-open {
    overflow: hidden;
}

.gov-sidebar-shell {
    position: relative;
    border-radius: 0.75rem;
    background: linear-gradient(168deg, rgba(8, 20, 33, 0.95), rgba(16, 42, 67, 0.94));
    color: #d8e4f0;
    box-shadow: var(--gov-shadow-md);
    border: 1px solid rgba(198, 167, 94, 0.26);
}

.gov-sidebar-shell::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(198, 167, 94, 0.2), rgba(198, 167, 94, 0.8), rgba(198, 167, 94, 0.2));
}

.gov-sidebar-title {
    color: #f8fbff;
}

.gov-sidebar-sub {
    color: #b9c8da;
}

.gov-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #f8fbff;
    background: rgba(198, 167, 94, 0.22);
    border: 1px solid rgba(198, 167, 94, 0.45);
}

.gov-sidebar-link {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6rem;
    border-radius: 0.65rem;
    padding: 0.58rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #d8e4f0;
    border: 1px solid transparent;
    transition: all 180ms ease;
}

.gov-sidebar-link:hover,
.gov-sidebar-link:focus-visible {
    color: #ffffff;
    border-color: rgba(198, 167, 94, 0.52);
    background: rgba(198, 167, 94, 0.16);
    outline: none;
}

.gov-sidebar-link svg {
    width: 0.95rem;
    height: 0.95rem;
    color: #c6a75e;
    flex-shrink: 0;
}

.gov-logout-btn {
    border: 1px solid rgba(198, 167, 94, 0.45);
    background: rgba(198, 167, 94, 0.12);
    color: #f3f8ff;
}

.gov-logout-btn:hover,
.gov-logout-btn:focus-visible {
    background: rgba(198, 167, 94, 0.24);
    border-color: rgba(198, 167, 94, 0.8);
}

/* Common card tuning */
section.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200,
div.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 {
    border-radius: 0.75rem;
    border-color: #d5dde8;
    box-shadow: 0 8px 18px rgba(16, 42, 67, 0.055);
}

.gov-meter-fill {
    height: 0.5rem;
    border-radius: 999px;
    background: linear-gradient(90deg, #0b1c2d, #102a43);
}

.gov-meter-fill-72 {
    width: 72%;
}

.gov-meter-fill-84 {
    width: 84%;
}

.gov-meter-fill-96 {
    width: 96%;
}

/* Table upgrade */
section.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200,
div.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 {
    border-radius: 0.75rem;
    border-color: #d3dce8;
    box-shadow: 0 8px 18px rgba(16, 42, 67, 0.055);
    overflow: auto;
    max-height: min(68vh, 820px);
}

section.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 > table,
div.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 > table {
    border-collapse: separate;
    border-spacing: 0;
}

section.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 > table thead,
div.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 > table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

section.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 > table thead th,
div.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 > table thead th {
    background: linear-gradient(180deg, #ecf1f7, #e5ecf4);
    color: #102a43;
    letter-spacing: 0.01em;
}

section.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 > table tbody tr:nth-child(even),
div.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 > table tbody tr:nth-child(even) {
    background: rgba(236, 241, 247, 0.38);
}

section.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 > table tbody tr:hover,
div.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 > table tbody tr:hover {
    background: rgba(16, 42, 67, 0.08);
}

section.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 > table td.text-right,
div.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 > table td.text-right {
    font-variant-numeric: tabular-nums;
}

span.inline-flex.items-center.rounded-full {
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(16, 42, 67, 0.05);
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Form upgrade */
form.space-y-4 label,
form.space-y-3 label {
    letter-spacing: 0.005em;
}

form.space-y-4 input:not([type='hidden']):not([type='checkbox']):not([type='radio']):not([type='file']),
form.space-y-4 select,
form.space-y-4 textarea,
form.space-y-3 input:not([type='hidden']):not([type='checkbox']):not([type='radio']):not([type='file']),
form.space-y-3 select,
form.space-y-3 textarea {
    border-color: #cfd8e3;
    background: #ffffff;
    box-shadow: inset 0 1px 2px rgba(15, 30, 50, 0.03);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

form.space-y-4 input:not([type='hidden']):not([type='checkbox']):not([type='radio']):not([type='file']):focus,
form.space-y-4 select:focus,
form.space-y-4 textarea:focus,
form.space-y-3 input:not([type='hidden']):not([type='checkbox']):not([type='radio']):not([type='file']):focus,
form.space-y-3 select:focus,
form.space-y-3 textarea:focus {
    border-color: rgba(16, 42, 67, 0.32);
    box-shadow: 0 0 0 3px rgba(16, 42, 67, 0.14);
}

form.space-y-4 .text-xs.text-slate-500,
form.space-y-3 .text-xs.text-slate-500 {
    color: #667689;
}

/* Button depth without changing existing classes */
.inline-flex.items-center.justify-center.rounded-xl.px-4.py-2.text-sm.font-medium.bg-slate-900.text-white {
    box-shadow: 0 8px 16px rgba(11, 28, 45, 0.23);
}

.inline-flex.items-center.justify-center.rounded-xl.px-4.py-2.text-sm.font-medium.bg-slate-900.text-white:hover {
    box-shadow: 0 10px 18px rgba(11, 28, 45, 0.27);
}

.inline-flex.items-center.justify-center.rounded-xl.px-4.py-2.text-sm.font-medium.bg-white.text-slate-900.ring-1.ring-slate-300 {
    box-shadow: 0 3px 9px rgba(15, 40, 65, 0.08);
}

/* Footer */
footer {
    border-top: 1px solid rgba(16, 42, 67, 0.12);
    background: linear-gradient(180deg, rgba(239, 244, 249, 0.25), rgba(226, 234, 243, 0.72));
}

body.gov-shell > footer,
body.gov-shell .app-footer-flow {
    position: static !important;
    inset: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    clear: both !important;
    width: 100% !important;
    margin-top: 0 !important;
    transform: none !important;
    z-index: 0 !important;
}

@media (min-width: 1024px) {
    .gov-sidebar-panel {
        position: relative;
        inset: auto;
        width: auto;
        padding: 0;
        transform: none;
        transition: none;
        z-index: 1;
        pointer-events: auto;
        align-self: stretch;
    }

    .gov-sidebar-panel .gov-sidebar-shell {
        min-height: 100%;
        overflow: visible;
    }

    body.gov-sidebar-open {
        overflow: auto;
    }
}

@media (max-width: 1024px) {
    section.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200,
    div.overflow-x-auto.rounded-2xl.bg-white.shadow-sm.ring-1.ring-slate-200 {
        max-height: none;
    }

    .gov-search-wrap {
        width: 100%;
    }
}
