:root {
    --bg: #080a0d;
    --surface: rgba(14, 16, 20, 0.92);
    --surface-2: rgba(22, 25, 31, 0.92);
    --surface-3: rgba(30, 34, 42, 0.9);
    --line: rgba(255, 255, 255, 0.11);
    --line-strong: rgba(244, 196, 71, 0.44);
    --gold: #f0c84b;
    --gold-2: #f7dc7d;
    --green: #43d17a;
    --red: #ff6b6b;
    --amber: #ffbd5a;
    --blue: #75a7ff;
    --text: #f7f8fb;
    --muted: #b9c0cc;
    --muted-2: #87909f;
    --shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body.dashboard-theme {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(8, 10, 13, 0.72), rgba(8, 10, 13, 0.96)),
        var(--dashboard-bg, url('/assets/images/dashboard-bg.jpg'));
    background-repeat: no-repeat;
    background-position: center top;
    background-size: cover;
    background-attachment: fixed;
}

body.dashboard-theme::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(8, 10, 13, 0.9), rgba(8, 10, 13, 0.68) 44%, rgba(8, 10, 13, 0.94)),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0, rgba(255, 255, 255, 0.025) 1px, transparent 1px, transparent 38px);
    z-index: -1;
}

a {
    color: #ffffff;
}

.top-shell,
.login-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.layout-status-wrap {
    position: sticky;
    top: 0;
    z-index: 80;
}

.topbar {
    position: relative;
    z-index: 70;
    width: min(1580px, calc(100% - 32px));
    margin: 18px auto 0;
    display: grid;
    grid-template-columns: minmax(240px, 340px) 1fr;
    align-items: center;
    gap: 18px;
    padding: 12px;
    background: rgba(10, 12, 16, 0.88);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    overflow: visible;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--line-strong);
    background: #111;
}

.brand-title {
    color: var(--gold-2);
    font-size: 20px;
    font-weight: 800;
    text-decoration: none;
}

.top-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.top-nav a,
.top-nav button,
.nav-chip,
.nav-group-toggle,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(18, 21, 27, 0.86);
    color: #f8fafc;
    text-decoration: none;
    font-weight: 800;
    font-size: 14px;
    box-shadow: none;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.top-nav a.active,
.top-nav a:hover,
.top-nav button:hover,
.nav-group.active .nav-group-toggle,
.nav-group-toggle:hover,
.button-link:hover {
    border-color: var(--gold);
    background: rgba(240, 200, 75, 0.13);
    color: #fff4c2;
    transform: translateY(-1px);
}

.nav-group {
    position: relative;
    display: inline-block;
    z-index: 90;
}

.nav-group-toggle {
    cursor: pointer;
    font: inherit;
    outline: none;
}

.nav-submenu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 230px;
    padding: 8px;
    background: rgba(12, 14, 18, 0.98);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 9999;
}

.nav-group:nth-of-type(2) .nav-submenu {
    left: auto;
    right: 0;
    width: min(720px, calc(100vw - 28px));
    display: none;
    grid-template-columns: repeat(3, minmax(170px, 1fr));
    gap: 10px;
    padding: 12px;
}

.nav-submenu-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.nav-submenu-title {
    padding: 6px 10px 5px;
    color: var(--gold-2);
    font-size: 11px;
    font-weight: 1000;
    text-transform: uppercase;
    letter-spacing: 0;
}

.nav-submenu a {
    width: 100%;
    justify-content: flex-start;
    min-height: 38px;
    padding: 0 12px;
    margin: 0;
    border-color: transparent;
    background: transparent;
    white-space: nowrap;
    box-shadow: none;
}

.nav-submenu a:hover,
.nav-submenu a.active {
    background: rgba(240, 200, 75, 0.12);
    border-color: rgba(240, 200, 75, 0.24);
}

.nav-group:hover .nav-submenu,
.nav-group:focus-within .nav-submenu {
    display: block;
}

.nav-group:nth-of-type(2):hover .nav-submenu,
.nav-group:nth-of-type(2):focus-within .nav-submenu {
    display: grid;
}

.user-mini {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--line);
}

.user-mini img {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(240, 200, 75, 0.35);
}

.user-mini .meta {
    min-width: 0;
    line-height: 1.2;
}

.user-mini .meta .label {
    color: var(--gold-2);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.user-mini .meta .name,
.user-mini .meta .email {
    font-size: 12px;
    color: var(--muted);
}

.user-mini .meta .email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 107, 107, 0.16);
    border: 1px solid rgba(255, 107, 107, 0.35);
    color: #ffc2c2;
    font-size: 10px;
    font-weight: 900;
}

.page-wrap {
    position: relative;
    z-index: 1;
    width: min(1240px, calc(100% - 32px));
    margin: 22px auto 28px;
    flex: 1;
}

.hero-title {
    font-size: 30px;
    font-weight: 900;
    margin: 10px 0 20px;
    letter-spacing: 0;
    text-align: left;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 16px;
}

.dashboard-grid.two-row {
    max-width: 920px;
    margin: 0 auto;
}

.dashboard-card,
.panel,
.login-card,
.info-card,
.stat-card,
.day-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.dashboard-card {
    padding: 20px;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.dashboard-card::before,
.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--gold);
}

.dashboard-card h3 {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.dashboard-card .value {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 14px;
    font-weight: 900;
    color: #fff;
}

.dashboard-card .value.small {
    font-size: 34px;
}

.panel {
    padding: 20px;
}

.panel h2 {
    margin-top: 0;
    color: #fff;
    font-size: 24px;
}

.panel h3 {
    letter-spacing: 0;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.center-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.stat-card {
    position: relative;
    padding: 16px 18px 16px 20px;
    overflow: hidden;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.stat-card strong {
    display: block;
    font-size: 28px;
    color: #fff;
    line-height: 1.1;
}

.gold-btn,
button,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 18px;
    border: 1px solid rgba(240, 200, 75, 0.42);
    border-radius: 8px;
    background: linear-gradient(180deg, #f7dc7d, #e1b63c);
    color: #111318;
    font-weight: 900;
    cursor: pointer;
    text-decoration: none;
    box-shadow: none;
    transition: filter 0.16s ease, transform 0.16s ease;
}

.gold-btn:hover,
button:hover,
input[type="submit"]:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
}

.login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 24px;
}

.login-card h1 {
    margin: 0 0 12px;
    font-size: 24px;
    color: #fff;
}

.login-subtext {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 14px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label,
label {
    display: block;
    margin-bottom: 6px;
    color: var(--gold-2);
    font-weight: 800;
    font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="url"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(5, 7, 10, 0.74);
    color: #fff;
    outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(240, 200, 75, 0.16);
}

.filters-grid,
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.settings-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px;
    margin: 18px 0;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.settings-tab {
    min-height: 38px;
    background: transparent;
    color: var(--muted);
    border-color: transparent;
}

.settings-tab.active,
.settings-tab:hover {
    background: rgba(240, 200, 75, 0.14);
    border-color: rgba(240, 200, 75, 0.4);
    color: #fff4c2;
}

.settings-tab-panel {
    display: none;
}

.settings-tab-panel.active {
    display: block;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th,
.data-table td {
    padding: 12px 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.075);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    position: sticky;
    top: 0;
    background: rgba(18, 21, 27, 0.98);
    color: var(--gold-2);
    font-size: 12px;
    text-transform: uppercase;
    z-index: 1;
}

.data-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.035);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.badge.accepted {
    background: rgba(67, 209, 122, 0.13);
    color: #aaf2c4;
    border-color: rgba(67, 209, 122, 0.32);
}

.badge.violation {
    background: rgba(255, 107, 107, 0.14);
    color: #ffc4c4;
    border-color: rgba(255, 107, 107, 0.34);
}

.badge.rejected,
.badge.suspended {
    background: rgba(255, 189, 90, 0.13);
    color: #ffdcaa;
    border-color: rgba(255, 189, 90, 0.34);
}

.badge.pending,
.badge.ignored {
    background: rgba(117, 167, 255, 0.13);
    color: #c9dcff;
    border-color: rgba(117, 167, 255, 0.34);
}

.error-box,
.danger-box,
.success-box,
.notice-box {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-weight: 800;
    border: 1px solid var(--line);
}

.error-box,
.danger-box {
    background: rgba(255, 107, 107, 0.13);
    color: #ffd0d0;
    border-color: rgba(255, 107, 107, 0.34);
}

.success-box {
    background: rgba(67, 209, 122, 0.13);
    color: #bff5d1;
    border-color: rgba(67, 209, 122, 0.34);
}

.notice-box {
    background: rgba(117, 167, 255, 0.12);
    color: #d8e5ff;
    border-color: rgba(117, 167, 255, 0.26);
}

.helper-text,
.muted,
.section-help {
    color: var(--muted);
}

.section-title {
    color: #fff;
    margin: 0 0 14px;
}

.section-help {
    margin: 0 0 18px;
}

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

.center-info-card {
    max-width: 620px;
    margin: 26px auto 0;
    padding: 24px;
    text-align: center;
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.day-card {
    padding: 16px;
    background: var(--surface-2);
}

.day-card h3 {
    margin: 0 0 12px;
    color: var(--gold-2);
    font-size: 18px;
}

.day-slots {
    display: grid;
    gap: 10px;
}

.slot-row {
    display: grid;
    grid-template-columns: 70px 1fr 22px 1fr;
    gap: 10px;
    align-items: center;
}

.slot-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.slot-sep {
    text-align: center;
    color: var(--gold-2);
    font-weight: 800;
}

.copy-days {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 18px;
}

.copy-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(18, 21, 27, 0.86);
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
}

.copy-chip:hover {
    border-color: var(--gold);
    color: #fff4c2;
}

.footer-bar {
    width: min(1520px, calc(100% - 32px));
    margin: 8px auto 22px;
    padding: 24px 18px 30px;
    border-radius: 8px;
    background: rgba(8, 10, 13, 0.9);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    text-align: center;
    color: var(--muted);
}

.footer-bar a {
    color: #fff;
}

.footer-bar .mini-logo {
    margin-top: 14px;
    width: 54px;
    height: auto;
}

@media (max-width: 1100px) {
    .topbar {
        grid-template-columns: 1fr;
    }

    .top-nav {
        justify-content: flex-start;
    }

    .dashboard-grid,
    .dashboard-grid.two-row {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 700px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    .topbar,
    .page-wrap,
    .footer-bar {
        width: calc(100% - 16px);
        max-width: calc(100% - 16px);
        overflow-x: hidden;
    }

    .topbar {
        margin-top: 10px;
        padding: 8px;
        gap: 10px;
        grid-template-columns: minmax(0, 1fr);
    }

    .user-mini {
        padding: 8px;
    }

    .user-mini img {
        width: 40px;
        height: 40px;
    }

    .top-nav {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        width: 100%;
    }

    .top-nav a,
    .top-nav button,
    .nav-group,
    .nav-group-toggle {
        width: 100%;
    }

    .top-nav a,
    .top-nav button,
    .nav-group-toggle {
        min-height: 42px;
        padding: 0 10px;
        font-size: 13px;
        white-space: normal;
        text-align: center;
    }

    .nav-submenu {
        position: static;
        min-width: 100%;
        width: 100%;
        margin-top: 6px;
        box-shadow: none;
        grid-column: 1 / -1;
    }

    .nav-group:nth-of-type(2) .nav-submenu {
        position: static;
        width: 100%;
        min-width: 100%;
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 8px;
    }

    .nav-submenu-title {
        padding-top: 10px;
    }

    .dashboard-grid,
    .dashboard-grid.two-row {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 12px;
        width: 100%;
        max-width: 100%;
    }

    .page-wrap [style*="grid-template-columns"],
    .panel [style*="grid-template-columns"] {
        grid-template-columns: minmax(0, 1fr) !important;
        max-width: 100% !important;
    }

    .page-wrap [style*="display:grid"],
    .panel [style*="display:grid"] {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .page-wrap > *,
    .panel > *,
    .dashboard-grid > *,
    .form-grid > *,
    .filters-grid > *,
    .schedule-grid > * {
        min-width: 0;
        max-width: 100%;
    }

    .page-wrap {
        margin-top: 14px;
    }

    .hero-title {
        font-size: 24px;
        margin: 8px 0 14px;
    }

    .panel {
        padding: 14px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .panel h2 {
        font-size: 21px;
    }

    .dashboard-card,
    .stat-card,
    .day-card,
    .info-card,
    .center-info-card,
    .login-card {
        padding: 14px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    .dashboard-card .value,
    .stat-card strong {
        font-size: 32px;
    }

    .form-grid,
    .filters-grid,
    .schedule-grid {
        grid-template-columns: 1fr;
        width: 100%;
        max-width: 100%;
    }

    .settings-tabs {
        overflow-x: hidden;
        flex-wrap: wrap;
        align-items: stretch;
    }

    .settings-tab {
        flex: 1 1 100%;
        white-space: normal;
    }

    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="url"],
    input[type="datetime-local"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        font-size: 16px;
    }

    .data-table,
    .data-table thead,
    .data-table tbody,
    .data-table tr,
    .data-table th,
    .data-table td {
        display: block;
        width: 100%;
        max-width: 100%;
    }

    .data-table {
        border-collapse: collapse;
    }

    .data-table thead {
        display: none;
    }

    .data-table tr {
        margin: 0 0 12px;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.035);
    }

    .data-table td {
        padding: 8px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.075);
        font-size: 13px;
        overflow-wrap: anywhere;
    }

    .data-table td:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }

    .data-table td:first-child {
        padding-top: 0;
    }

    .inline-actions {
        align-items: stretch;
        width: 100%;
    }

    .inline-actions > *,
    .inline-actions button,
    .inline-actions .button-link {
        flex: 1 1 100%;
    }

    .slot-row {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .slot-sep {
        display: none;
    }

    .footer-bar {
        margin-bottom: 12px;
        padding: 18px 12px 24px;
    }

    .stack,
    .center-stack,
    .day-slots,
    .copy-days {
        width: 100%;
        max-width: 100%;
    }

    .copy-chip,
    .gold-btn,
    button,
    input[type="submit"],
    .button-link {
        width: 100%;
        max-width: 100%;
        white-space: normal;
        text-align: center;
    }
}

@media (max-width: 430px) {
    .top-nav {
        grid-template-columns: 1fr;
    }

    .global-request-chip {
        width: 100%;
    }
}
