:root {
    --bg: #12090a;
    --bg-soft: #1b1010;
    --panel: rgba(28, 18, 16, 0.92);
    --panel-solid: #201412;
    --line: rgba(224, 177, 104, 0.22);
    --line-strong: rgba(224, 177, 104, 0.42);
    --text: #f6efe5;
    --muted: #b9aaa0;
    --dim: #786960;
    --gold: #d6ad6d;
    --gold-2: #f0cf92;
    --red: #e15d55;
    --green: #6bd49b;
    --blue: #78a7ff;
    --violet: #b68bff;
    --orange: #f2a65a;
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background:
        linear-gradient(rgba(18, 9, 10, 0.88), rgba(18, 9, 10, 0.9)),
        url("../site-img/content-bg.jpg") center top repeat;
    letter-spacing: 0;
}

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

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--gold-2);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 32px;
    background:
        linear-gradient(90deg, rgba(18, 9, 10, 0.78), rgba(18, 9, 10, 0.54)),
        url("../site-img/header-bg.jpg") center top / cover no-repeat;
}

.login-stage {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) 420px;
    gap: 42px;
    width: min(1120px, 100%);
    align-items: center;
}

.login-art {
    min-height: 520px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-mark {
    width: min(430px, 80%);
    height: auto;
    margin-bottom: 36px;
    filter: drop-shadow(0 24px 38px rgba(0, 0, 0, 0.48));
}

.login-copy h1 {
    margin: 0 0 12px;
    font-size: 44px;
    line-height: 1;
}

.login-copy p {
    max-width: 520px;
    margin: 0;
    color: #e9dccd;
    font-size: 16px;
    line-height: 1.7;
}

.login-panel {
    position: relative;
    padding: 28px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background:
        linear-gradient(rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
        var(--panel);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-ornament {
    position: absolute;
    inset: 8px;
    opacity: 0.34;
    background: url("../site-img/modal-bg-ornament.png") center / 100% 100% no-repeat;
    pointer-events: none;
}

.panel-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 18px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-weight: 800;
    text-transform: uppercase;
}

.panel-head img {
    width: 13px;
    height: auto;
}

.admin-form {
    position: relative;
    display: grid;
    gap: 18px;
}

.admin-form label span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.admin-form input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid rgba(240, 207, 146, 0.16);
    border-radius: 6px;
    color: var(--text);
    background: rgba(6, 4, 4, 0.56);
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.admin-form input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(214, 173, 109, 0.13);
}

.gold-button {
    height: 48px;
    border: 0;
    border-radius: 6px;
    color: #22140d;
    background: linear-gradient(180deg, var(--gold-2), var(--gold));
    font-weight: 900;
    text-transform: uppercase;
    box-shadow: 0 10px 24px rgba(214, 173, 109, 0.22);
}

.gold-button:hover {
    filter: brightness(1.08);
}

.login-foot {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.login-foot strong {
    color: var(--gold-2);
}

.admin-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 16px;
    border-right: 1px solid var(--line);
    background:
        linear-gradient(rgba(19, 10, 10, 0.94), rgba(19, 10, 10, 0.98)),
        url("../site-img/nav-bg.png") center top / cover no-repeat;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 68px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.22);
}

.sidebar-brand img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
}

.sidebar-brand small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
    margin-top: 20px;
}

.nav-link,
.nav-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    width: 100%;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #e7dbcf;
    background: transparent;
    text-align: left;
}

.nav-link:hover,
.nav-group-title:hover,
.nav-link.is-active {
    border-color: var(--line);
    background: rgba(214, 173, 109, 0.09);
    color: var(--gold-2);
}

.nav-icon {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-right: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--gold-2);
    font-size: 11px;
    font-weight: 900;
}

.nav-link span:last-child {
    margin-right: auto;
}

.nav-group {
    border-top: 1px solid rgba(214, 173, 109, 0.12);
    padding-top: 8px;
}

.nav-group-title {
    color: var(--gold);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.nav-group-items {
    display: grid;
    gap: 4px;
    padding: 4px 0 6px 10px;
}

.nav-group.is-closed .nav-group-items {
    display: none;
}

.nav-link em {
    margin-left: auto;
    color: var(--dim);
    font-size: 11px;
    font-style: normal;
}

.nav-link.is-soon {
    color: #b9aaa0;
}

.admin-main {
    min-width: 0;
    padding: 24px;
}

.admin-topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 78px;
    margin-bottom: 24px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(28, 18, 16, 0.78);
    box-shadow: var(--shadow);
}

.admin-topbar h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.1;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    color: var(--muted);
}

.topbar-user a {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--gold-2);
}

.icon-button {
    display: none;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--gold-2);
    background: rgba(0, 0, 0, 0.24);
}

.menu-button {
    min-width: 58px;
    height: 42px;
}

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

.flash-stack.is-login {
    margin-bottom: 18px;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.26);
    color: var(--text);
}

.flash button {
    border: 0;
    color: inherit;
    background: transparent;
    font-weight: 900;
}

.flash-error {
    border-color: rgba(225, 93, 85, 0.44);
}

.flash-success {
    border-color: rgba(107, 212, 155, 0.44);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    min-height: 132px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0)),
        var(--panel);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.stat-card span,
.stat-card small {
    display: block;
    color: var(--muted);
}

.stat-card span {
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.stat-card strong {
    display: block;
    margin: 14px 0 8px;
    color: var(--text);
    font-size: 26px;
    line-height: 1.1;
}

.tone-blue {
    border-color: rgba(120, 167, 255, 0.32);
}

.tone-green {
    border-color: rgba(107, 212, 155, 0.32);
}

.tone-gold {
    border-color: rgba(214, 173, 109, 0.42);
}

.tone-violet {
    border-color: rgba(182, 139, 255, 0.32);
}

.tone-orange {
    border-color: rgba(242, 166, 90, 0.34);
}

.tone-red {
    border-color: rgba(225, 93, 85, 0.34);
}

.status-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.status-pill,
.health-card {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.24);
}

.status-pill span,
.health-card span,
.health-card small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.status-pill strong,
.health-card strong {
    display: block;
    margin-top: 6px;
    color: var(--text);
}

.status-ok {
    border-color: rgba(107, 212, 155, 0.44);
}

.status-bad {
    border-color: rgba(225, 93, 85, 0.48);
}

.status-muted {
    border-color: rgba(120, 167, 255, 0.28);
}

.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
}

.admin-widget {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
        var(--panel);
    box-shadow: var(--shadow);
}

.widget-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.widget-title h2 {
    margin: 0;
    font-size: 20px;
}

.soft-link {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--gold-2);
    font-size: 12px;
    font-weight: 800;
}

.soft-link.is-disabled {
    color: var(--dim);
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 13px 12px;
    border-bottom: 1px solid rgba(214, 173, 109, 0.12);
    text-align: left;
    white-space: nowrap;
}

.admin-table th {
    color: var(--gold);
    font-size: 12px;
    text-transform: uppercase;
}

.admin-table td {
    color: #eadfd2;
}

.mini-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border: 1px solid rgba(214, 173, 109, 0.2);
    border-radius: 6px;
    color: var(--gold-2);
    background: rgba(214, 173, 109, 0.08);
    font-size: 12px;
}

.empty-cell,
.empty-note {
    color: var(--muted);
}

.activity-list {
    display: grid;
    gap: 10px;
}

.activity-item {
    padding: 12px;
    border: 1px solid rgba(214, 173, 109, 0.14);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.18);
}

.activity-item strong,
.activity-item span,
.activity-item small {
    display: block;
}

.activity-item strong {
    margin-bottom: 5px;
    color: var(--gold-2);
}

.activity-item span {
    color: #e8dcd0;
    line-height: 1.45;
}

.activity-item small {
    margin-top: 7px;
    color: var(--muted);
}

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

.health-card {
    min-height: 148px;
}

.health-card small {
    margin-top: 12px;
    line-height: 1.5;
}

.sidebar-scrim {
    display: none;
}

@media (max-width: 1320px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1040px) {
    .login-stage {
        grid-template-columns: 1fr;
    }

    .login-art {
        min-height: auto;
    }

    .login-mark {
        width: 300px;
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: fixed;
        z-index: 20;
        left: 0;
        top: 0;
        width: min(300px, 86vw);
        transform: translateX(-105%);
        transition: transform 180ms ease;
    }

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

    .sidebar-open .sidebar-scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 19;
        background: rgba(0, 0, 0, 0.58);
    }

    .icon-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

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

@media (max-width: 760px) {
    .auth-shell,
    .admin-main {
        padding: 16px;
    }

    .login-panel,
    .admin-widget {
        padding: 16px;
    }

    .login-copy h1 {
        font-size: 34px;
    }

    .admin-topbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .topbar-user {
        width: 100%;
        justify-content: space-between;
    }

    .dashboard-grid,
    .status-row,
    .health-grid {
        grid-template-columns: 1fr;
    }

    .widget-title {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .auth-shell {
        padding: 12px;
    }

    .login-stage {
        gap: 20px;
    }

    .login-copy p {
        font-size: 14px;
    }

    .login-foot {
        flex-direction: column;
    }
}


/* ===========================================================
   New modules: settings / admins / maintenance / logs
   =========================================================== */

/* Form grid for settings (auto-fit columns) */
.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    align-items: start;
}
.admin-form-grid .is-wide,
.admin-form-grid .form-actions {
    grid-column: 1 / -1;
}

/* Generic form-field (modern dark-on-light inputs) */
.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-field > span {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #c58e5c;
    text-transform: uppercase;
}
.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 11px 14px;
    background: rgba(40, 27, 23, 0.05);
    border: 1px solid rgba(123, 110, 99, 0.3);
    color: #2f2823;
    font-size: 13px;
    font-family: inherit;
    transition: 0.18s;
    box-sizing: border-box;
}
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    outline: none;
    border-color: #d0a578;
    background: rgba(40, 27, 23, 0.02);
}
.form-field .hint {
    font-size: 10.5px;
    color: rgba(123, 110, 99, 0.7);
    letter-spacing: 0.3px;
}

/* Toggle switch */
.form-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}
.form-toggle > input[type="checkbox"] { display: none; }
.form-toggle > input[type="hidden"] + input[type="checkbox"] { display: none; }
.toggle-track {
    position: relative;
    flex-shrink: 0;
    width: 42px;
    height: 22px;
    background: rgba(40, 27, 23, 0.2);
    border: 1px solid rgba(123, 110, 99, 0.4);
    border-radius: 999px;
    transition: 0.2s;
}
.toggle-knob {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: 0.2s;
}
.form-toggle input[type="checkbox"]:checked ~ .toggle-track {
    background: linear-gradient(180deg, #d0a578 0%, #8a5d3a 100%);
    border-color: #d0a578;
}
.form-toggle input[type="checkbox"]:checked ~ .toggle-track .toggle-knob {
    transform: translateX(20px);
}
.toggle-label {
    font-size: 13px;
    color: #2f2823;
}
.toggle-label small {
    display: block;
    font-size: 11px;
    color: rgba(123, 110, 99, 0.85);
    margin-top: 1px;
}
.form-toggle.is-big {
    padding: 16px 18px;
    background: rgba(40, 27, 23, 0.04);
    border: 1px solid rgba(123, 110, 99, 0.25);
    border-radius: 4px;
}
.form-toggle.is-big .toggle-track {
    width: 54px;
    height: 28px;
}
.form-toggle.is-big .toggle-knob {
    width: 24px;
    height: 24px;
}
.form-toggle.is-big input[type="checkbox"]:checked ~ .toggle-track .toggle-knob {
    transform: translateX(26px);
}

.form-actions {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-top: 6px;
}

/* Mini-badge tone variations */
.mini-badge.tone-gold { background: rgba(208, 165, 120, 0.18); color: #8a5d3a; border-color: rgba(208, 165, 120, 0.5); }
.mini-badge.tone-blue { background: rgba(105, 186, 255, 0.15); color: #2f6ea3; border-color: rgba(105, 186, 255, 0.4); }
.mini-badge.tone-red  { background: rgba(220, 66, 91, 0.15);  color: #9c2330; border-color: rgba(220, 66, 91, 0.4); }
.mini-badge.tone-green{ background: rgba(76, 175, 80, 0.15);  color: #2e7d32; border-color: rgba(76, 175, 80, 0.4); }

/* Table action column / danger link */
.admin-table .col-actions { white-space: nowrap; text-align: right; }
.admin-table .col-actions .soft-link { margin-left: 10px; }
.soft-link.danger { color: #b03a4a; }
.soft-link.danger:hover { color: #dc425b; text-decoration: underline; }

.mono { font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; }
.small { font-size: 11.5px; }
.muted { color: rgba(123, 110, 99, 0.75); }

/* Logs filters bar */
.logs-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) auto;
    gap: 14px;
    align-items: end;
    padding: 14px 0 22px;
    border-bottom: 1px solid rgba(123, 110, 99, 0.15);
    margin-bottom: 16px;
}
.logs-filters .form-actions { justify-content: flex-end; margin: 0; }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 18px 0 4px;
}
.pagination .page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: rgba(40, 27, 23, 0.04);
    border: 1px solid rgba(123, 110, 99, 0.3);
    color: #2f2823;
    font-size: 12px;
    font-weight: 600;
    transition: 0.15s;
}
.pagination .page:hover { background: rgba(208, 165, 120, 0.15); border-color: #d0a578; }
.pagination .page.is-current {
    background: linear-gradient(180deg, #d0a578 0%, #8a5d3a 100%);
    color: #fff;
    border-color: #8a5d3a;
}
.pagination .muted { margin-left: 8px; }
