:root {
    --bg: #eef3fb;
    --bg-soft: #f5f8fd;
    --paper: rgba(255, 255, 255, 0.86);
    --paper-strong: #ffffff;
    --ink: #263247;
    --muted: #8291aa;
    --line: rgba(216, 225, 238, 0.85);
    --accent: #7c66ff;
    --accent-strong: #5a8cff;
    --accent-soft: #e8e7ff;
    --teal: #3bc6f3;
    --danger: #ff6b7e;
    --shadow-lg: 0 28px 60px rgba(146, 166, 197, 0.28);
    --shadow-md: 0 18px 32px rgba(163, 181, 208, 0.2);
    --shadow-sm: inset 1px 1px 0 rgba(255, 255, 255, 0.88), inset -1px -1px 0 rgba(215, 226, 241, 0.65);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

* { box-sizing: border-box; }

body {
    position: relative;
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 20%, rgba(123, 102, 255, 0.17), transparent 22%),
        radial-gradient(circle at 85% 12%, rgba(59, 198, 243, 0.18), transparent 18%),
        radial-gradient(circle at 75% 78%, rgba(255, 122, 166, 0.14), transparent 22%),
        linear-gradient(180deg, #f7faff 0%, var(--bg) 100%);
}

body.menu-open {
    overflow: hidden;
}

a { color: inherit; text-decoration: none; }

button, .btn, .btn-outline, .btn-danger {
    border: none;
    border-radius: 999px;
    padding: 11px 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

button:hover, .btn:hover, .btn-outline:hover, .btn-danger:hover {
    transform: translateY(-1px);
}

button, .btn {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    box-shadow: 8px 8px 16px rgba(82, 119, 189, 0.28), -6px -6px 12px rgba(255, 255, 255, 0.55);
}

.btn-outline {
    color: var(--accent-strong);
    background: var(--paper);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    color: #fff;
    background: linear-gradient(135deg, #ea6c72, var(--danger));
    box-shadow: 8px 8px 16px rgba(180, 89, 95, 0.22), -6px -6px 12px rgba(255, 255, 255, 0.52);
}

input, select, textarea {
    width: 100%;
    margin-top: 8px;
    padding: 13px 15px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.75);
    background: linear-gradient(145deg, #f3f7fd, #e7edf6);
    box-shadow: var(--shadow-sm);
    color: var(--ink);
    font: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: rgba(47, 109, 246, 0.35);
    box-shadow: inset 4px 4px 10px rgba(175, 188, 205, 0.18), inset -4px -4px 10px rgba(255,255,255,.86), 0 0 0 3px rgba(47,109,246,.08);
}

textarea { resize: vertical; }
label { font-weight: 600; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card, .card {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(244, 248, 255, 0.8));
    border: 1px solid rgba(255, 255, 255, 0.92);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 24px;
}

.login-card { width: min(520px, 100%); }

.app-shell {
    display: grid;
    grid-template-columns: 282px 1fr;
    min-height: 100vh;
    gap: 24px;
    padding: 24px;
    position: relative;
    z-index: 2;
}

.scene-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(18px);
    pointer-events: none;
    z-index: 0;
}

.scene-glow--one {
    top: 110px;
    left: 34px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(124, 102, 255, 0.18), transparent 68%);
}

.scene-glow--two {
    top: 18px;
    right: 80px;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(59, 198, 243, 0.16), transparent 70%);
}

.scene-glow--three {
    right: 16%;
    bottom: 12%;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(255, 122, 166, 0.14), transparent 70%);
}

.mobile-nav-toggle,
.mobile-nav-backdrop {
    display: none;
}

.sidebar {
    position: relative;
}

.sidebar-panel {
    position: sticky;
    top: 24px;
    overflow: hidden;
    min-height: calc(100vh - 48px);
    padding: 24px 18px;
    border-radius: 30px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    background: linear-gradient(180deg, rgba(255,255,255,.78) 0%, rgba(243,247,255,.7) 100%);
    color: var(--ink);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,.95);
}

.sidebar h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.05;
}

.sidebar-user {
    margin: 18px 0 0;
    color: var(--muted);
}

.sidebar small { color: #9ba9be; }

.sidebar-nav {
    display: grid;
    gap: 12px;
    margin-top: 28px;
    position: relative;
    z-index: 2;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 18px;
    color: var(--ink);
    background: linear-gradient(145deg, rgba(255,255,255,.92), rgba(237,243,252,.88));
    box-shadow: 0 10px 20px rgba(175, 189, 209, 0.16);
}

.sidebar-nav a:hover {
    background: linear-gradient(145deg, rgba(255,255,255,1), rgba(233,240,252,.95));
}

.nav-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(145deg, #f7f9ff, #e6eefb);
    color: var(--accent-strong);
    box-shadow: 0 10px 18px rgba(177, 192, 217, 0.2);
    font-size: .95rem;
}

.sidebar-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(1px);
}

.sidebar-orb--one {
    width: 160px;
    height: 160px;
    right: -48px;
    top: 40px;
    background: radial-gradient(circle, rgba(59, 198, 243, 0.18), transparent 70%);
}

.sidebar-orb--two {
    width: 190px;
    height: 190px;
    left: -60px;
    bottom: -50px;
    background: radial-gradient(circle, rgba(124, 102, 255, 0.16), transparent 72%);
}

.sidebar-glow {
    position: absolute;
    inset: auto 22px 20px 22px;
    height: 70px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(124,102,255,.12), rgba(59,198,243,.18));
    filter: blur(16px);
}

.content {
    min-width: 0;
    padding: 8px 4px 24px;
}

.content-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 18px 22px;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(255,255,255,.9), rgba(244,248,255,.82));
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255,255,255,.96);
}

.content-title {
    margin: 2px 0 0;
    font-size: 1.5rem;
}

.content-pill {
    padding: 10px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(124,102,255,.14), rgba(59,198,243,.14));
    color: #6557ee;
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    box-shadow: var(--shadow-md);
}

.section-title, .hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .78rem;
    color: var(--muted);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stats article {
    background: linear-gradient(145deg, rgba(255,255,255,.92), rgba(244,248,255,.8));
    border-radius: 22px;
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255,255,255,.94);
}

.stats span { display: block; color: var(--muted); margin-bottom: 10px; }
.stats strong { font-size: 2rem; }

.split {
    display: grid;
    grid-template-columns: minmax(300px, 420px) 1fr;
    gap: 20px;
}

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.single-column { grid-template-columns: 1fr; }
.full { grid-column: 1 / -1; }

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox input { width: auto; margin: 0; }

.table-wrap {
    overflow-x: auto;
    border-radius: 18px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 920px;
    background: rgba(255,255,255,.25);
}

th, td {
    text-align: left;
    vertical-align: top;
    padding: 12px;
    border-bottom: 1px solid rgba(203, 214, 228, 0.6);
}

th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}

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

.visit-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, .9fr);
    gap: 20px;
    margin-bottom: 20px;
}

.visit-form-card {
    background: linear-gradient(145deg, rgba(255,255,255,.92), rgba(244,248,255,.82));
}

.visit-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.visit-field { display: block; }

.visit-actions { justify-content: space-between; }

.visit-tips {
    background: linear-gradient(180deg, rgba(255,255,255,.88) 0%, rgba(239,244,255,.84) 100%);
    color: var(--ink);
}

.visit-tips h3 {
    margin: 0 0 12px;
    font-size: 1.4rem;
}

.visit-tips p {
    color: var(--muted);
    line-height: 1.6;
}

.visit-tip-list {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.visit-tip-list div {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 12px;
    align-items: start;
}

.visit-tip-list strong {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(145deg, #ffffff, #e8effd);
    box-shadow: var(--shadow-md);
    color: #6557ee;
}

.visit-table-card { overflow: hidden; }

.entity-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: linear-gradient(145deg, #ece8ff, #e4f8ff);
    color: #6557ee;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    box-shadow: 4px 4px 8px rgba(163, 177, 198, 0.22), -4px -4px 8px rgba(255,255,255,.75);
}

.entity-name { margin-top: 6px; }
.action-icons { justify-content: flex-start; }

.icon-action {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: var(--shadow-md);
}

.icon-action--edit {
    background: linear-gradient(145deg, #eefbff, #dff8ff);
    color: #2ea9cf;
}

.icon-action--delete {
    background: linear-gradient(145deg, #fff0f2, #ffe0e5);
    color: #ff6b7e;
}

.flash-stack { display: grid; gap: 12px; margin-bottom: 18px; }

.flash {
    padding: 14px 16px;
    border-radius: 18px;
    box-shadow: var(--shadow-md);
}

.flash-success { background: #e2f7ef; color: #1e6f56; }
.flash-error { background: #fde7e4; color: var(--danger); }

.inline-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

.inline-input input { margin-top: 0; }
.hidden { display: none; }

.public-body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f3f3f3;
}

.public-wrap { max-width: 1280px; margin: 0 auto; padding: 40px 20px 60px; }
.gov-header { background: #d91010; color: #fff; }
.gov-header__inner { max-width: 1280px; margin: 0 auto; padding: 18px 20px; }

.gov-brand {
    display: flex;
    align-items: center;
    gap: 18px;
    font-weight: 700;
}

.gov-brand__shield {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    object-fit: contain;
}

.gov-brand__logo { font-size: 2rem; line-height: 1; }
.gov-brand__divider { width: 1px; height: 34px; background: rgba(255,255,255,.8); }
.gov-brand__title { font-size: 1.1rem; }

.public-wrap--gov { max-width: 1600px; padding-top: 8px; }
.public-heading h1 { margin: 0 0 8px; color: #3f4c5f; font-size: 3rem; font-weight: 700; }
.public-heading h2 { margin: 0 0 24px; color: #3f4c5f; font-size: 1.7rem; font-weight: 700; }

.public-search__grid {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) 380px 180px;
    gap: 18px;
    align-items: end;
}

.public-search__field input {
    margin-top: 0;
    border-radius: 3px;
    border: 1px solid #c8cdd6;
    padding: 13px 14px;
    font-size: 1rem;
    background: #fff;
    box-shadow: none;
}

.public-search__field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 400;
    color: #1f1f1f;
}

.public-search__field--full { grid-column: 1 / 2; }
.public-search__field--range { grid-column: 1 / 3; }
.public-range { display: inline-flex; align-items: center; gap: 10px; }
.public-range input { width: 170px; }
.public-search__actions { display: flex; justify-content: flex-end; }
.public-search__button { min-width: 140px; border-radius: 0; background: #355d92; padding: 14px 28px; box-shadow: none; }

.public-panel {
    margin-top: 18px;
    background: #fff;
    border-top: 3px solid #e74b3c;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
    padding: 12px 12px 10px;
}

.public-panel__toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 4px;
}

.public-panel__range { color: #2d3e50; font-size: 0.95rem; }
.public-excel { padding: 10px 14px; border: 1px solid #bcbcbc; background: #fff; color: #111; border-radius: 2px; }
.public-table-wrap { overflow-x: auto; }

.public-table {
    width: 100%;
    min-width: 1380px;
    border-collapse: collapse;
    background: #fff;
}

.public-table th,
.public-table td {
    border: 1px solid #d3d7dc;
    padding: 10px 8px;
    vertical-align: top;
    font-size: 0.92rem;
    text-align: left;
}

.public-table th {
    background: #fff;
    color: #111;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}

.public-table__empty { text-align: center !important; color: #444; }
.public-notes { margin-top: 18px; color: #111; line-height: 1.55; }
.public-notes p { margin: 0 0 10px; }

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 16px;
    }

    .mobile-nav-toggle {
        position: fixed;
        top: 14px;
        right: 14px;
        z-index: 1002;
        display: inline-flex;
        flex-direction: column;
        gap: 4px;
        width: 52px;
        height: 52px;
        border-radius: 18px;
        background: linear-gradient(145deg, rgba(255,255,255,.95), rgba(234,241,252,.9));
        box-shadow: var(--shadow-md);
    }

    .mobile-nav-toggle span {
        width: 20px;
        height: 2px;
        border-radius: 999px;
        background: var(--accent-strong);
        display: block;
    }

    .mobile-nav-backdrop {
        position: fixed;
        inset: 0;
        display: block;
        background: rgba(17, 31, 48, 0.42);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
        z-index: 998;
    }

    body.menu-open .mobile-nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(88vw, 320px);
        transform: translateX(-108%);
        transition: transform .28s ease;
        z-index: 1001;
        padding: 12px 0 12px 12px;
    }

    body.menu-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-panel {
        min-height: calc(100vh - 24px);
        top: 0;
    }

    .content {
        padding: 72px 0 20px;
    }

    .content-topbar,
    .card,
    .login-card {
        border-radius: 24px;
        padding: 20px;
    }

    .content-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .split,
    .form-grid,
    .visit-form-grid,
    .section-title,
    .hero,
    .inline-input {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .visit-shell { grid-template-columns: 1fr; }
    .visit-actions { flex-direction: column; align-items: stretch; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-title { font-size: 1.22rem; }
    .public-heading h1 { font-size: 2.2rem; }
    .public-heading h2 { font-size: 1.4rem; }
    .public-search__grid { grid-template-columns: 1fr; }
    .public-search__field--range { grid-column: auto; }
    .public-search__actions { justify-content: stretch; }
    .public-search__button { width: 100%; }
    .public-range { display: grid; grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    body {
        background:
            radial-gradient(circle at top left, rgba(47, 109, 246, 0.14), transparent 28%),
            linear-gradient(180deg, #eef4fb 0%, var(--bg-soft) 100%);
    }

    .app-shell { padding: 12px; }
    .content { padding-top: 72px; }
    .stats { grid-template-columns: 1fr; }
    .content-topbar,
    .card,
    .login-card { padding: 18px; }
    .section-title h2,
    .hero h2,
    .visit-tips h3 { font-size: 1.2rem; }
    table { min-width: 760px; }
}
