:root {
    --bg-900: #111611;
    --bg-800: #1b2118;
    --bg-700: #2a3226;
    --card: rgba(23, 31, 22, 0.82);
    --olive: #7a8450;
    --olive-soft: #a3ae71;
    --khaki: #cbc29b;
    --steel: #94a3a8;
    --text: #edf2e8;
    --muted: #b9c0b1;
    --danger: #c64b3f;
    --success: #5ea164;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.36) 100%),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.015) 0 2px, transparent 2px 4px);
    z-index: -1;
}

a { color: var(--khaki); text-decoration: none; }
a:hover { color: #fff3c3; }

.topbar {
    position: sticky;
    top: 0;
    backdrop-filter: blur(8px);
    background: rgba(14, 18, 14, 0.86);
    border-bottom: 1px solid rgba(203, 194, 155, 0.25);
    z-index: 20;
}

.nav-inner {
    max-width: 1480px;
    margin: 0 auto;
    padding: .7rem 1.2rem;
    display: flex;
    align-items: center;
    gap: .8rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-right: .6rem;
    flex-shrink: 0;
}

.brand img {
    height: 42px;
    width: 42px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 12px rgba(163, 174, 113, 0.15);
}

.nav-links {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    align-items: center;
    margin-right: auto;
}

.nav-link {
    padding: .4rem .7rem;
    border-radius: 999px;
    border: 1px solid transparent;
    color: var(--muted);
    font-size: .86rem;
    transition: .2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    border-color: rgba(203, 194, 155, 0.35);
    color: #fff;
    background: rgba(203, 194, 155, 0.08);
}

.nav-link.active {
    border-color: rgba(163, 174, 113, 0.45);
    color: #f3eccf;
    background: rgba(163, 174, 113, 0.12);
}

/* Notification shell */
.notif-shell { position: relative; }
.notif-toggle {
    background: rgba(203, 194, 155, 0.12);
    border: 1px solid rgba(203, 194, 155, 0.3);
    border-radius: 999px;
    color: #f9f5de;
    padding: .35rem .75rem;
    font-size: .82rem;
    cursor: pointer;
}
.notif-panel {
    position: absolute;
    right: 0;
    top: calc(100% + .45rem);
    width: min(320px, calc(100vw - 1.5rem));
    max-width: calc(100vw - 1.5rem);
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(14, 18, 14, 0.97);
    border: 1px solid rgba(203, 194, 155, 0.35);
    border-radius: 10px;
    padding: .6rem;
    box-shadow: var(--shadow);
    display: none;
    z-index: 40;
    scrollbar-width: thin;
    scrollbar-color: rgba(122, 132, 80, .6) transparent;
}
.notif-panel::-webkit-scrollbar { width: 6px; }
.notif-panel::-webkit-scrollbar-track { background: transparent; }
.notif-panel::-webkit-scrollbar-thumb { background: rgba(122, 132, 80, .6); border-radius: 4px; }
.notif-panel::-webkit-scrollbar-thumb:hover { background: rgba(122, 132, 80, .85); }
.notif-panel.open { display: block; }
.notif-entry {
    border-bottom: 1px solid rgba(185,192,177,.2);
    padding: .4rem .2rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    min-width: 0;
}
.notif-entry:last-child { border-bottom: 0; }
.notif-entry.unread { color: #fff3c3; }
.notif-actions { display:flex; gap:.4rem; margin-bottom:.45rem; flex-wrap:wrap; }
.notif-actions button { border:1px solid rgba(203,194,155,.35); background:#243324; color:#f3eccf; border-radius:8px; padding:.25rem .5rem; font-size:.72rem; cursor:pointer; }
.notif-entry-main {
    display: block;
    min-width: 0;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.notif-entry-actions {
    display: flex;
    justify-content: flex-end;
    gap: .35rem;
    flex-wrap: wrap;
}
.notif-entry button { border:1px solid rgba(203,194,155,.35); background:#243324; color:#f3eccf; border-radius:6px; padding:.15rem .4rem; font-size:.7rem; cursor:pointer; float:none; }

/* User chip with credits */
.user-chip {
    background: rgba(203, 194, 155, 0.12);
    border: 1px solid rgba(203, 194, 155, 0.3);
    border-radius: 999px;
    color: #f9f5de;
    padding: .35rem .75rem;
    font-size: .82rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.user-name {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.user-name-link {
    color: inherit;
    padding: .2rem .15rem .2rem .25rem;
    border-radius: 999px;
    transition: background .15s ease, color .15s ease;
}

.user-name-link:hover {
    color: #fff3c3;
    background: rgba(203, 194, 155, 0.1);
}

.user-name-link.active {
    background: rgba(163, 174, 113, 0.16);
    color: #fff3c3;
}

.prime-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: rgba(203, 170, 60, .22);
    border: 1px solid rgba(203, 170, 60, .45);
    color: #f5d870;
    box-shadow: 0 0 12px rgba(245, 216, 112, .2);
    flex-shrink: 0;
}

.user-credits {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    color: var(--olive-soft);
    font-weight: 700;
    font-size: .82rem;
    text-decoration: none;
}
.user-credits:hover { opacity: .8; }
.user-credits svg { flex-shrink: 0; }

.logout-btn,
button {
    background: linear-gradient(135deg, var(--olive-soft), var(--olive));
    color: #1d2219;
    border: 0;
    font-weight: 700;
    padding: .62rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(122, 132, 80, 0.24);
    transition: transform .15s ease, filter .15s ease;
}

.logout-btn:hover,
button:hover { filter: brightness(1.08); transform: translateY(-1px); }

.logout-btn {
    padding: .4rem .75rem;
    font-size: .82rem;
    border-radius: 8px;
}

.shell {
    max-width: 1480px;
    margin: 2rem auto 3rem;
    padding: 0 1.2rem;
}

.page-card {
    background: var(--card);
    border: 1px solid rgba(203, 194, 155, 0.24);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.content-wrap {
    padding: 1.6rem;
}

.flash-success,
.flash-error {
    padding: .85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border: 1px solid;
    font-weight: 600;
}

.flash-success { background: rgba(94, 161, 100, .16); border-color: rgba(94, 161, 100, .56); color: #cff4d1; }
.flash-error { background: rgba(198, 75, 63, .16); border-color: rgba(198, 75, 63, .56); color: #ffd8d4; }

input, select {
    width: 100%;
    padding: .72rem .8rem;
    margin: .35rem 0 .95rem;
    color: var(--text);
    background: rgba(18, 23, 19, .7);
    border: 1px solid rgba(185, 192, 177, .35);
    border-radius: 10px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

input:focus, select:focus {
    border-color: var(--olive-soft);
    box-shadow: 0 0 0 3px rgba(163, 174, 113, .2);
}

table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(14, 18, 14, .42);
}

th, td {
    border-bottom: 1px solid rgba(185, 192, 177, .22);
    padding: .82rem;
    text-align: left;
}

th {
    color: #f6f1da;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: .76rem;
}

.table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
}

.table-scroll > table {
    min-width: 640px;
    margin: 0;
}

.muted { color: var(--muted); font-size: .95rem; }

/* Hamburger mobile */
.nav-hamburger {
    display: none;
    background: none;
    border: 1px solid rgba(203,194,155,.3);
    border-radius: 8px;
    padding: .35rem .45rem;
    cursor: pointer;
    color: #f3eccf;
    box-shadow: none;
}

.nav-hamburger svg { display: block; }

@media (max-width: 800px) {
    .shell { margin-top: 1.2rem; }
    .content-wrap { padding: 1.1rem; }
    .nav-inner { padding: .7rem 1rem; flex-wrap: wrap; }

    .nav-hamburger { display: flex; align-items: center; justify-content: center; order: -1; }

    .nav-links {
        display: none;
        width: 100%;
        order: 10;
        flex-direction: column;
        gap: .2rem;
        padding-top: .5rem;
        border-top: 1px solid rgba(203,194,155,.15);
        margin-top: .4rem;
    }

    .nav-links.open { display: flex; }

    .nav-links .nav-link {
        width: 100%;
        text-align: left;
        padding: .55rem .8rem;
        border-radius: 8px;
    }

    .brand { order: -2; margin-right: auto; }

    .user-chip { font-size: .76rem; padding: .3rem .6rem; }

    .notif-shell { position: static; }

    .notif-panel {
        position: fixed;
        left: .75rem;
        right: .75rem;
        top: 4.75rem;
        width: auto;
        max-width: none;
        max-height: calc(100dvh - 5.75rem);
    }
}

/* Site footer */
.site-footer {
    text-align: center;
    padding: 1.2rem 1rem;
    font-size: .82rem;
    color: var(--muted);
}

.site-footer a {
    color: var(--steel);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--khaki);
    text-decoration: underline;
}

.site-footer .footer-version {
    margin-left: 12px;
    font-size: .7rem;
    font-style:italic;
    color:rgba(203,194,155,.4);
}
