:root {
    --gold: #d4a63a;
    --gold-light: #e8bd52;
    --black: #050505;
    --panel: #0a0a0a;
    --panel-raised: #101010;
    --line: #242424;
    --line-soft: #181818;
    --text: #f5f5f5;
    --muted: #969696;
    --success: #65b66a;
    --danger: #d45c5c;
    --sidebar-width: 238px;
    --content-width: 1120px;
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: #030303;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 72% 0%, rgba(212, 166, 58, 0.07), transparent 30%),
        #030303;
    color: var(--text);
    font-family: 'Inter', Arial, sans-serif;
    font-size: 14px;
}

body,
button,
input,
select,
textarea {
    font-family: 'Inter', Arial, sans-serif;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* =========================================================
   APPLICATION FRAME
========================================================= */

.app-layout {
    width: min(1410px, calc(100% - 24px));
    min-height: 100vh;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 0;
}

.sidebar {
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    height: calc(100vh - 24px);
    min-height: 680px;
    position: sticky;
    top: 12px;
    display: flex;
    flex-direction: column;
    padding: 18px 14px 16px;
    background: linear-gradient(180deg, #0a0a0a 0%, #050505 100%);
    border: 1px solid #1d1d1d;
    border-radius: var(--radius);
    overflow-y: auto;
    z-index: 30;
}

.main-content {
    flex: 1 1 auto;
    width: calc(100% - var(--sidebar-width) - 14px);
    max-width: var(--content-width);
    min-width: 0;
    padding: 0;
}

.content-width,
.hero-panel,
.metric-grid,
.section-panel,
.alert {
    width: 100%;
    max-width: var(--content-width);
    margin-left: 0;
    margin-right: 0;
}

/* =========================================================
   SIDEBAR
========================================================= */

.brand {
    text-align: center;
    padding: 2px 8px 18px;
}

.brand-logo-wrap {
    width: 148px;
    height: 148px;
    margin: 0 auto 13px;
    display: grid;
    place-items: center;
    position: relative;
}

.brand-logo {
    max-width: 100%;
    max-height: 100%;
    position: relative;
    z-index: 2;
    object-fit: contain;
}

.brand-logo-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border: 1px solid var(--gold);
    border-radius: 50%;
    color: var(--gold);
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    letter-spacing: 1.5px;
}

.brand-app {
    font-family: 'Orbitron', sans-serif;
    color: var(--gold);
    font-weight: 700;
    letter-spacing: 1.4px;
    line-height: 1.28;
    text-transform: uppercase;
}

.brand-app-primary {
    display: block;
    font-size: 20px;
}

.brand-app-secondary {
    display: block;
    margin-top: 2px;
    color: #efefef;
    font-size: 11px;
    letter-spacing: 1.2px;
}

.brand-mission {
    width: 138px;
    margin: 15px auto 0;
    color: #c7c7c7;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.9px;
    text-transform: uppercase;
}

.brand-mission span {
    display: block;
    padding: 5px 0;
    border-top: 1px solid #242424;
}

.brand-mission span:last-child {
    border-bottom: 1px solid #242424;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-menu a {
    display: block;
    min-height: 38px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #c0c0c0;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.nav-menu a:hover {
    color: #fff;
    background: #111;
    border-color: #242424;
}

.nav-menu a.active {
    color: #070707;
    background: var(--gold);
    border-color: var(--gold);
}

.nav-heading {
    margin: 15px 10px 4px;
    color: #696969;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
}

.sidebar-user {
    margin-top: auto;
    padding: 14px 10px 0;
    border-top: 1px solid #202020;
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: #e7e7e7;
    font-size: 12px;
    font-weight: 600;
}

.sidebar-user small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 400;
}

/* =========================================================
   SHARED PANELS
========================================================= */

.panel {
    background: linear-gradient(180deg, rgba(16, 16, 16, .98), rgba(8, 8, 8, .98));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: 0 14px 35px rgba(0, 0, 0, .24);
}

/* =========================================================
   HERO — MATCHES AGPHA / ISER STRUCTURE
========================================================= */

.hero-panel {
    min-height: 162px;
    margin-bottom: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2px 520px;
    align-items: stretch;
    gap: 18px;
    padding: 18px;
    position: relative;
    overflow: hidden;
}

.hero-panel::after {
    content: '';
    position: absolute;
    right: -70px;
    top: -90px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 166, 58, .08), transparent 70%);
    pointer-events: none;
}

.hero-text-block {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    text-align: right;
    position: relative;
    z-index: 2;
}

.hero-kicker {
    color: #f1f1f1;
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
}

.hero-title {
    width: 100%;
    margin: 10px 0 0;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(26px, 2.7vw, 34px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: .6px;
    text-transform: uppercase;
    text-align: right;
}

.hero-title span {
    display: block;
}

.hero-title .gold {
    color: var(--gold);
}

.hero-title .white {
    color: #fff;
}

.hero-copy {
    max-width: 100%;
    margin: 12px 0 0;
    color: #f0f0f0;
    font-size: 14px;
    line-height: 1.45;
    text-align: right;
}

.hero-period {
    margin-top: 12px;
}

.hero-divider {
    width: 2px;
    align-self: stretch;
    background: linear-gradient(180deg, rgba(212,166,58,0), rgba(212,166,58,.95) 20%, rgba(212,166,58,.95) 80%, rgba(212,166,58,0));
    box-shadow: 0 0 12px rgba(212, 166, 58, .22);
    position: relative;
    z-index: 2;
}

.hero-image-block {
    min-height: 142px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(212, 166, 58, .16);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
    background: #101010;
    position: relative;
    z-index: 2;
}

.hero-image-block img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

/* =========================================================
   DASHBOARD
========================================================= */

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

.metric-card {
    min-width: 0;
    min-height: 118px;
    padding: 17px 18px;
    background: #090909;
    border: 1px solid #202020;
    border-radius: 16px;
}

.metric-label {
    color: #929292;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.25px;
    text-transform: uppercase;
}

.metric-value {
    margin-top: 9px;
    color: var(--gold);
    font-family: 'Inter', Arial, sans-serif;
    font-size: 38px;
    font-weight: 800;
    line-height: 1;
    overflow-wrap: anywhere;
}

.metric-note {
    margin-top: 8px;
    color: #b5b5b5;
    font-size: 11px;
    line-height: 1.4;
}

.section-panel {
    margin-top: 14px;
    padding: 21px 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.section-title {
    margin: 0 0 18px;
    color: var(--gold);
    font-family: 'Orbitron', sans-serif;
    font-size: 22px;
    line-height: 1.2;
}

.section-header .section-title {
    margin-bottom: 0;
}

.page-title {
    margin: 0 0 7px;
    color: var(--gold);
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(29px, 4.2vw, 43px);
    line-height: 1.08;
    text-transform: uppercase;
}

.page-subtitle {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

/* =========================================================
   TABLES
========================================================= */

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

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 0 12px 11px 0;
    border-bottom: 1px solid #292929;
    color: #8e8e8e;
    text-align: left;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-transform: uppercase;
}

td {
    padding: 13px 12px 13px 0;
    border-bottom: 1px solid #181818;
    color: #dfdfdf;
    vertical-align: top;
    font-size: 12px;
}

.table-link {
    color: var(--gold);
    font-weight: 700;
    text-decoration: none;
}

/* =========================================================
   FORMS
========================================================= */

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

.form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-field.full {
    grid-column: 1 / -1;
}

label {
    color: #d4d4d4;
    font-size: 12px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    color: #f5f5f5;
    background: #070707;
    border: 1px solid #303030;
    border-radius: 10px;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 166, 58, .1);
}

textarea {
    min-height: 105px;
    resize: vertical;
}

fieldset {
    margin: 0;
    padding: 16px;
    border: 1px solid #282828;
    border-radius: 14px;
}

legend {
    padding: 0 7px;
    color: var(--gold);
    font-weight: 700;
}

.choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.choice {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #ddd;
}

.choice input {
    width: auto;
    min-height: auto;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 19px;
}

.button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    text-decoration: none;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .35px;
    cursor: pointer;
}

.button-primary {
    color: #050505;
    background: var(--gold);
    border-color: var(--gold);
}

.button-primary:hover {
    background: var(--gold-light);
}

.button-secondary {
    color: #fff;
    background: #191919;
    border-color: #343434;
}

.button-danger {
    color: #fff;
    background: #4c1717;
    border-color: #682222;
}

.count-table input {
    min-width: 82px;
}

.count-table textarea {
    min-width: 210px;
    min-height: 62px;
}

.count-total {
    color: var(--gold);
    font-family: 'Inter', Arial, sans-serif;
    font-size: 18px;
    font-weight: 800;
}

.filters {
    display: grid;
    grid-template-columns: minmax(190px, 2fr) 1fr 1fr 1fr auto auto;
    gap: 10px;
    margin: 17px 0 22px;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border: 1px solid #303030;
    border-radius: 999px;
    color: #ccc;
    background: #171717;
    font-size: 10px;
    line-height: 1.2;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.detail-item {
    padding: 14px;
    background: #080808;
    border: 1px solid #202020;
    border-radius: 12px;
}

.detail-item strong {
    display: block;
    margin-bottom: 6px;
    color: #838383;
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.alert {
    margin-top: 0;
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid #333;
    border-radius: 12px;
    font-size: 12px;
}

.alert-success {
    background: rgba(101, 182, 106, .11);
    border-color: rgba(101, 182, 106, .42);
}

.alert-error {
    background: rgba(212, 92, 92, .11);
    border-color: rgba(212, 92, 92, .42);
}

.empty-state {
    padding: 16px 0;
    color: #999;
}

.help-text {
    color: #888;
    font-size: 10px;
    line-height: 1.45;
}

#map {
    height: 590px;
    overflow: hidden;
    border-radius: 14px;
}

/* =========================================================
   LOGIN / SETUP
========================================================= */

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

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

.login-brand {
    text-align: center;
    margin-bottom: 22px;
}

.login-logo-wrap {
    width: 105px;
    height: 105px;
    margin: 0 auto 15px;
    position: relative;
    display: grid;
    place-items: center;
}

.login-logo-wrap img {
    max-width: 100%;
    max-height: 100%;
    position: relative;
    z-index: 2;
}

.login-logo-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border: 1px solid var(--gold);
    border-radius: 50%;
    color: var(--gold);
    font-family: 'Orbitron', sans-serif;
    font-size: 19px;
}

.login-brand h1 {
    margin: 0;
    color: var(--gold);
    font-family: 'Orbitron', sans-serif;
    font-size: 27px;
    line-height: 1.1;
    text-transform: uppercase;
}

.login-brand p {
    margin-top: 6px;
}

.mobile-menu-button,
.mobile-menu-overlay {
    display: none;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1180px) {
    .app-layout {
        width: min(1120px, calc(100% - 20px));
    }

    .sidebar {
        flex-basis: 214px;
        width: 214px;
    }

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

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

    .form-grid.three,
    .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .app-layout {
        width: 100%;
        display: block;
        padding: 0;
    }

    .mobile-menu-button {
        display: inline-flex;
        position: fixed;
        top: 12px;
        right: 12px;
        z-index: 60;
        min-height: 38px;
        align-items: center;
        justify-content: center;
        padding: 9px 12px;
        color: #050505;
        background: var(--gold);
        border: 0;
        border-radius: 9px;
        font-size: 11px;
        font-weight: 800;
    }

    .mobile-menu-overlay {
        position: fixed;
        inset: 0;
        z-index: 39;
        background: rgba(0, 0, 0, .72);
    }

    .mobile-menu-overlay.show {
        display: block;
    }

    .sidebar {
        width: 268px;
        height: 100vh;
        min-height: 0;
        position: fixed;
        left: -290px;
        top: 0;
        z-index: 50;
        border-radius: 0 16px 16px 0;
        transition: left .2s ease;
        box-shadow: 18px 0 45px rgba(0, 0, 0, .65);
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        width: 100%;
        max-width: none;
        min-width: 0;
        margin: 0;
        padding: 62px 12px 18px;
    }

    .hero-panel {
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 18px;
        gap: 14px;
    }

    .hero-text-block,
    .hero-title,
    .hero-copy {
        align-items: flex-start;
        text-align: left;
    }

    .hero-divider {
        display: none;
    }

    .hero-image-block {
        min-height: 180px;
    }

    .form-grid,
    .form-grid.three,
    .detail-grid,
    .filters {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .panel {
        padding: 17px;
        border-radius: 14px;
    }

    .hero-title {
        font-size: 32px;
    }

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

    .metric-card {
        min-height: 108px;
    }

    .metric-value {
        font-size: 32px;
    }

    .button {
        width: 100%;
    }
}

/* =========================================================
   DESKTOP FRAME ALIGNMENT — CLOSE SIDEBAR TO MAIN PANELS
========================================================= */

@media (min-width: 821px) {
    .app-layout {
        width: calc(100% - 12px) !important;
        max-width: 1410px !important;
        margin: 0 auto !important;
        padding: 2px 0 !important;
        display: flex !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        column-gap: 10px !important;
    }

    .sidebar {
        flex: 0 0 var(--sidebar-width) !important;
        width: var(--sidebar-width) !important;
        margin: 0 !important;
        top: 2px !important;
        height: calc(100vh - 4px) !important;
    }

    .main-content {
        flex: 1 1 0 !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .main-content > .hero-panel,
    .main-content > .metric-grid,
    .main-content > .section-panel,
    .main-content > .content-width,
    .main-content > .alert {
        width: 100% !important;
        max-width: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}


/* =========================================================
   LOGO / HERO IMAGE CORRECTION — UPDATE 6
========================================================= */
.brand-logo-fallback {
    display: none !important;
}

.brand-logo,
.hero-image-block img {
    position: relative;
    z-index: 5;
    display: block;
}

/* =========================================================
   LOGIN / LOGOUT HERO LAYOUT — UPDATE 7
========================================================= */
.login-page-shell {
    width: min(1120px, calc(100% - 24px));
    margin: 12px auto 24px;
}

.login-page-shell > .hero-panel {
    width: 100%;
    max-width: none;
}

.login-page-shell .login-shell {
    min-height: auto;
    padding: 0;
    margin-top: 14px;
}

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

.login-page-shell .login-logo-fallback {
    display: none !important;
}

@media (max-width: 820px) {
    .login-page-shell {
        width: 100%;
        margin: 0;
        padding: 62px 12px 18px;
    }

    .login-page-shell .hero-panel {
        margin-bottom: 14px;
    }
}

/* AGPHA NETWORK SHARED SIDEBAR BRANDING */
.brand-logo-wrap{width:174px;height:174px;margin:0 auto 10px;text-decoration:none}.brand-logo{width:100%;height:100%;max-width:none;max-height:none;object-fit:contain;background:transparent;border:0;border-radius:0;box-shadow:none;filter:none}.brand-association{max-width:205px;margin:0 auto 14px;color:#f2f2f2;font-size:12px;font-weight:800;line-height:1.3}.brand-app{padding-top:12px;border-top:1px solid #242424}.brand-app-primary{font-size:23px;color:var(--gold)}.brand-app-secondary{font-size:12px;color:#fff}.brand-mission{margin-top:14px}

/* =========================================================
   SIDEBAR — HIDE SCROLLBARS BUT KEEP MOUSE-WHEEL SCROLLING
========================================================= */

.sidebar {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}
