/* VoltEdge Admin — Shared Design System */
/* Brand color is injected via <style>:root{--brand:...}</style> in each page */

:root {
    --brand: #3b82f6;
    /* default blue — overridden per admin */
    --brand-dim: rgba(59, 130, 246, 0.15);
    --brand-border: rgba(59, 130, 246, 0.25);
    --brand-text: #ffffff;

    --bg: #0a0a0a;
    --surface: #111111;
    --surface2: #181818;
    --surface3: #1f1f1f;
    --border: rgba(255, 255, 255, 0.07);
    --border2: rgba(255, 255, 255, 0.12);

    --text: #f0f0f0;
    --text-2: rgba(255, 255, 255, 0.6);
    --text-3: rgba(255, 255, 255, 0.35);

    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 7px;

    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    line-height: 1.5;
}

/* ── LAYOUT ── */
.admin-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.admin-content::-webkit-scrollbar {
    width: 4px;
}

.admin-content::-webkit-scrollbar-thumb {
    background: var(--border2);
    border-radius: 2px;
}

/* ── SIDEBAR ── */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width .25s;
}

.sidebar::-webkit-scrollbar {
    width: 0;
}

.sidebar-header {
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    object-fit: contain;
    flex-shrink: 0;
    border: 1px solid var(--border2);
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-logo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--brand-dim);
    border: 1px solid var(--brand-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-user {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 2px;
}

.sidebar-nav {
    padding: 10px 10px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.nav-item.active {
    background: var(--brand-dim);
    color: var(--text);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: var(--brand);
}

.nav-icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 100px;
    display: none;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 10px;
}

.sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 11px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-3);
    font-size: 12px;
    transition: all .15s;
    margin-bottom: 2px;
}

.footer-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-2);
}

.footer-link.danger {
    color: rgba(239, 68, 68, 0.6);
}

.footer-link.danger:hover {
    background: rgba(239, 68, 68, 0.07);
    color: #f87171;
}

/* ── TOP BAR ── */
.topbar {
    height: 58px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 14px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.topbar-date {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 1px;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-bell {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 16px;
    position: relative;
    transition: background .15s;
}

.topbar-bell:hover {
    background: rgba(255, 255, 255, 0.09);
}

.topbar-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 100px;
    display: none;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
}

.topbar-avatar {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--brand-dim);
    border: 1px solid var(--brand-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: var(--brand);
    flex-shrink: 0;
}

.topbar-username {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
}

/* ── FLASH MESSAGE ── */
.flash {
    margin: 16px 24px 0;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    animation: flashIn .3s ease-out;
}

@keyframes flashIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flash-success {
    background: rgba(34, 197, 94, .1);
    border: 1px solid rgba(34, 197, 94, .25);
    color: #4ade80;
}

.flash-error {
    background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .25);
    color: #f87171;
}

/* ── CARDS ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── STAT CARDS ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 18px;
    text-decoration: none;
    display: block;
    transition: border-color .2s, transform .2s;
}

.stat-card:hover {
    border-color: var(--brand-border);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 22px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    color: var(--brand);
}

.stat-label {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 5px;
}

/* ── TABLES ── */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead tr {
    border-bottom: 1px solid var(--border2);
}

th {
    text-align: left;
    padding: 11px 14px;
    color: var(--text-3);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: .5px;
    text-transform: uppercase;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

td {
    padding: 12px 14px;
    color: var(--text-2);
    vertical-align: middle;
}

/* ── BADGES ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}

.badge-pending {
    background: rgba(251, 191, 36, .12);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, .2);
}

.badge-preparing {
    background: rgba(59, 130, 246, .12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, .2);
}

.badge-on_way {
    background: rgba(139, 92, 246, .12);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, .2);
}

.badge-ready {
    background: rgba(34, 197, 94, .12);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, .2);
}

.badge-completed {
    background: rgba(255, 255, 255, .06);
    color: var(--text-3);
    border: 1px solid var(--border);
}

.badge-cancelled {
    background: rgba(239, 68, 68, .12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, .2);
}

.badge-table {
    background: rgba(139, 92, 246, .1);
    color: #a78bfa;
}

.badge-room {
    background: rgba(236, 72, 153, .1);
    color: #f472b6;
}

.badge-takeaway {
    background: rgba(251, 146, 60, .1);
    color: #fb923c;
}

.badge-delivery {
    background: rgba(34, 197, 94, .1);
    color: #4ade80;
}

/* ── FORM FIELDS ── */
.ifield {
    width: 100%;
    padding: 10px 13px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color .2s, background .2s;
    font-family: inherit;
}

.ifield:focus {
    border-color: var(--brand);
    background: rgba(255, 255, 255, 0.07);
}

.ifield::placeholder {
    color: var(--text-3);
}

.ifield option {
    background: #1a1a1a;
}

label.field-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    letter-spacing: .8px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .2s;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--brand);
    color: var(--brand-text);
    box-shadow: 0 3px 14px rgba(59, 130, 246, .3);
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-2);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.btn-danger {
    background: rgba(239, 68, 68, .12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, .2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, .2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
}

/* ── MODAL ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 18px;
    padding: 28px;
    width: 100%;
    max-width: 460px;
    animation: modalIn .25s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(.96) translateY(8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-footer .btn {
    flex: 1;
    justify-content: center;
}

/* ── FILTER PILLS ── */
.filter-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-pill {
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-3);
    transition: all .15s;
    text-decoration: none;
    display: inline-block;
}

.filter-pill:hover {
    border-color: var(--border2);
    color: var(--text-2);
}

.filter-pill.active {
    background: var(--brand-dim);
    border-color: var(--brand-border);
    color: var(--text);
    font-weight: 600;
}

/* ── MISC ── */
.section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-3);
}

.empty-state-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: .5;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

.text-brand {
    color: var(--brand);
}

.text-muted {
    color: var(--text-3);
}

.fw-700 {
    font-weight: 700;
}

.gap-2 {
    gap: 8px;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media(max-width:768px) {

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* ── ALIASES & MISSING CLASSES ── */

/* .input-field → alias for .ifield (used in some pages) */
.input-field {
    width: 100%;
    padding: 10px 13px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid var(--border2);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color .2s, background .2s;
    font-family: inherit;
}

.input-field:focus {
    border-color: var(--brand);
    background: rgba(255, 255, 255, 0.07);
}

.input-field::placeholder {
    color: var(--text-3);
}

.input-field option {
    background: #1a1a1a;
}

/* .filter-btn → alias for .filter-pill (used in feedback.php) */
.filter-btn {
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-3);
    transition: all .15s;
    text-decoration: none;
    display: inline-block;
}

.filter-btn:hover {
    border-color: var(--border2);
    color: var(--text-2);
}

.filter-btn.active {
    background: var(--brand-dim);
    border-color: var(--brand-border);
    color: var(--text);
    font-weight: 600;
}

/* .space-y-4 → vertical flex gap */
.space-y-4 {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.space-y-3 {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.space-y-2 {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* .modal → the inner modal box (used without -overlay suffix) */
.modal {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 18px;
    padding: 28px;
    width: 100%;
    max-width: 460px;
    animation: modalIn .25s ease-out;
}

/* Page-level content max-width helper */
.page-content {
    max-width: 900px;
}

.page-content-wide {
    max-width: 1200px;
}

/* Action bar — top of page with title + button */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.action-bar-left {
    font-size: 13px;
    color: var(--text-3);
}

/* Card grid layouts */
.card-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.card-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.card-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

/* Item card (menu items, categories) */
.item-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color .2s, transform .2s;
}

.item-card:hover {
    border-color: var(--border2);
    transform: translateY(-2px);
}

.item-card-img {
    position: relative;
    height: 160px;
    overflow: hidden;
    background: var(--surface2);
}

.item-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-card-body {
    padding: 12px;
}

.item-card-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 3px;
}

.item-card-sub {
    font-size: 11px;
    color: var(--text-3);
    margin-bottom: 8px;
}

.item-card-price {
    font-size: 16px;
    font-weight: 800;
    color: var(--brand);
}

.item-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

/* Visibility badge on cards */
.vis-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

.vis-badge-visible {
    background: rgba(34, 197, 94, 0.85);
    color: #fff;
}

.vis-badge-hidden {
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
}

/* Status badge (rooms, tables) */
.status-available {
    background: rgba(34, 197, 94, .15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, .3);
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}

.status-occupied {
    background: rgba(239, 68, 68, .15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, .3);
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}

.status-inactive {
    background: rgba(255, 255, 255, .06);
    color: var(--text-3);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}

/* Feedback card */
.fb-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    transition: border-color .2s;
}

.fb-card:hover {
    border-color: var(--border2);
}

.fb-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), rgba(var(--brand-rgb, 59, 130, 246), .2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--brand-text);
    flex-shrink: 0;
}

.fb-stars {
    color: #fbbf24;
    font-size: 13px;
}

/* Settings form sections */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media(max-width:768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* QR preview box */
.qr-box {
    background: white;
    padding: 16px;
    border-radius: 14px;
    display: inline-block;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .3);
}

/* URL display box */
.url-box {
    font-family: monospace;
    font-size: 13px;
    background: rgba(0, 0, 0, .4);
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    word-break: break-all;
    color: var(--text);
}

/* Method cards (tv_launch, download_apk) */
.method-card {
    background: rgba(255, 255, 255, .03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    transition: border-color .2s;
}

.method-card:hover {
    border-color: var(--border2);
}

.method-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.method-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.method-desc {
    font-size: 12px;
    color: var(--text-3);
    line-height: 1.5;
    margin-bottom: 10px;
}

/* Step list */
.step-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    background: rgba(255, 255, 255, .02);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-dim);
    border: 1px solid var(--brand-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: var(--brand);
    flex-shrink: 0;
}

.step-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.step-desc {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 2px;
}

/* Info box */
.info-box {
    padding: 12px 14px;
    background: rgba(255, 255, 255, .03);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-3);
}

.info-box strong {
    color: var(--text);
}

/* Tip box */
.tip-box {
    padding: 12px 14px;
    background: rgba(251, 191, 36, .04);
    border: 1px solid rgba(251, 191, 36, .15);
    border-radius: 10px;
    font-size: 12px;
    color: rgba(251, 191, 36, .8);
}

/* ── MODAL OVERLAY — ensure .modal works both with and without -overlay ── */
.modal-overlay,
.modal[id] {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.open,
.modal[id].open {
    display: flex;
}

/* Inner modal box when used inside overlay */
.modal-overlay .modal-box,
.modal[id]>div:first-child {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 18px;
    padding: 28px;
    width: 100%;
    max-width: 460px;
    animation: modalIn .25s ease-out;
}

/* Consistent save/submit button */
.btn-save {
    width: 100%;
    padding: 12px;
    background: var(--brand);
    color: var(--brand-text);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

.btn-save:hover {
    filter: brightness(1.1);
}

/* Form group */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: .8px;
    text-transform: uppercase;
    margin-bottom: 7px;
}

/* Two-col form grid */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Modal footer buttons */
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
    justify-content: center;
}

/* ── LIGHT MODE ── */
html.light {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface2: #f0f2f5;
    --surface3: #e8eaed;
    --border: rgba(0, 0, 0, 0.08);
    --border2: rgba(0, 0, 0, 0.14);
    --text: #111111;
    --text-2: rgba(0, 0, 0, 0.6);
    --text-3: rgba(0, 0, 0, 0.38);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.07);
}

/* sidebar */
html.light .nav-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

html.light .footer-link:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-2);
}

html.light .sidebar-logo {
    background: rgba(0, 0, 0, 0.04);
}

/* topbar */
html.light .topbar-bell {
    background: rgba(0, 0, 0, 0.05);
}

html.light .topbar-bell:hover {
    background: rgba(0, 0, 0, 0.09);
}

html.light .topbar-user {
    background: rgba(0, 0, 0, 0.04);
}

html.light .topbar-username {
    color: rgba(0, 0, 0, 0.6);
}

/* cards & surfaces */
html.light .card {
    background: #fff;
}

html.light .stat-card {
    background: #fff;
}

/* tables */
html.light tbody tr:hover {
    background: rgba(0, 0, 0, 0.025);
}

html.light td {
    color: rgba(0, 0, 0, 0.65);
}

html.light th {
    color: rgba(0, 0, 0, 0.4);
}

/* forms */
html.light .ifield {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.14);
    color: #111;
}

html.light .ifield:focus {
    background: rgba(0, 0, 0, 0.06);
}

html.light .ifield::placeholder {
    color: rgba(0, 0, 0, 0.3);
}

html.light .ifield option {
    background: #fff;
    color: #111;
}

/* buttons */
html.light .btn-ghost {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.65);
    border-color: rgba(0, 0, 0, 0.12);
}

html.light .btn-ghost:hover {
    background: rgba(0, 0, 0, 0.09);
    color: #111;
}

/* modals */
html.light .modal-overlay .modal,
html.light .modal-box {
    background: #fff;
}

html.light .profile-tab:not(.active):hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-2);
}

/* misc */
html.light .section-empty {
    color: rgba(0, 0, 0, 0.35);
}

/* ── THEME TOGGLE BUTTON ── */
.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border2);
    background: rgba(128, 128, 128, 0.08);
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background .15s, border-color .15s;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: rgba(128, 128, 128, 0.15);
    border-color: var(--border2);
    color: var(--text);
}

/* ── LIGHT MODE — inline style overrides ── */
/* These target the hardcoded rgba(255,255,255,...) and #111 patterns used in
   menu_items, categories, rooms, tables, and other admin pages */

/* Card backgrounds that use #111 or rgba(255,255,255,0.06) borders */
html.light [style*="background:#111"],
html.light [style*="background: #111"] {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}

/* Muted white text → dark muted */
html.light [style*="color:rgba(255,255,255,0.4)"],
html.light [style*="color: rgba(255,255,255,0.4)"],
html.light [style*="color:rgba(255,255,255,0.3)"],
html.light [style*="color: rgba(255,255,255,0.3)"],
html.light [style*="color:rgba(255,255,255,0.35)"],
html.light [style*="color: rgba(255,255,255,0.35)"],
html.light [style*="color:rgba(255,255,255,0.5)"],
html.light [style*="color: rgba(255,255,255,0.5)"] {
    color: rgba(0, 0, 0, 0.45) !important;
}

/* White text on dark buttons → keep readable */
html.light [style*="color:white"],
html.light [style*="color: white"] {
    color: #111111 !important;
}

/* Ghost button backgrounds */
html.light [style*="background:rgba(255,255,255,0.05)"],
html.light [style*="background: rgba(255,255,255,0.05)"],
html.light [style*="background:rgba(255,255,255,0.04)"],
html.light [style*="background: rgba(255,255,255,0.04)"],
html.light [style*="background:rgba(255,255,255,0.08)"],
html.light [style*="background: rgba(255,255,255,0.08)"] {
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
    color: rgba(0, 0, 0, 0.7) !important;
}

/* White border on ghost buttons */
html.light [style*="border:1px solid rgba(255,255,255,0.1)"],
html.light [style*="border: 1px solid rgba(255,255,255,0.1)"],
html.light [style*="border:1px solid rgba(255,255,255,0.06)"],
html.light [style*="border: 1px solid rgba(255,255,255,0.06)"] {
    border-color: rgba(0, 0, 0, 0.1) !important;
}

/* Modal close buttons */
html.light [style*="background:rgba(255,255,255,0.08)"][style*="color:white"],
html.light [style*="background:rgba(255,255,255,0.08)"] {
    background: rgba(0, 0, 0, 0.07) !important;
    color: rgba(0, 0, 0, 0.7) !important;
}

/* Empty state text */
html.light [style*="color:rgba(255,255,255,0.3)"] {
    color: rgba(0, 0, 0, 0.35) !important;
}

/* Label text in modals */
html.light label[style*="color:rgba(255,255,255"] {
    color: rgba(0, 0, 0, 0.5) !important;
}

/* Item count / muted spans */
html.light span[style*="rgba(255,255,255"] {
    color: rgba(0, 0, 0, 0.45) !important;
}

/* Divs with only muted white color (category name count, item count labels) */
html.light div[style*="color:rgba(255,255,255,0.4)"],
html.light div[style*="color: rgba(255,255,255,0.4)"],
html.light div[style*="color:rgba(255,255,255,0.3)"],
html.light div[style*="color: rgba(255,255,255,0.3)"],
html.light div[style*="color:rgba(255,255,255,0.35)"],
html.light div[style*="color: rgba(255,255,255,0.35)"] {
    color: rgba(0, 0, 0, 0.45) !important;
}

/* Table cells with inline white colors */
html.light td[style*="rgba(255,255,255"],
html.light th[style*="rgba(255,255,255"] {
    color: rgba(0, 0, 0, 0.5) !important;
}

/* Ensure card body text (item name, category name) is dark */
html.light [style*="background:#111"] div[style*="font-weight:700"],
html.light [style*="background:#111"] div[style*="font-weight: 700"] {
    color: rgba(0, 0, 0, 0.88) !important;
}

/* Don't override white text on colored gradient buttons — they're readable in both modes */
html.light [style*="background:linear-gradient"][style*="color:white"],
html.light [style*="background: linear-gradient"][style*="color:white"] {
    color: white !important;
}

/* 0.6 and 0.7 opacity text — currently uncovered */
html.light [style*="color:rgba(255,255,255,0.6)"],
html.light [style*="color: rgba(255,255,255,0.6)"],
html.light [style*="color:rgba(255,255,255,0.7)"],
html.light [style*="color: rgba(255,255,255,0.7)"] {
    color: rgba(0,0,0,0.6) !important;
}
/* 0.25 opacity helper text */
html.light [style*="color:rgba(255,255,255,0.25)"],
html.light [style*="color: rgba(255,255,255,0.25)"] {
    color: rgba(0,0,0,0.3) !important;
}
/* 0.02 background — near invisible on white */
html.light [style*="background:rgba(255,255,255,0.02)"],
html.light [style*="background: rgba(255,255,255,0.02)"] {
    background: rgba(0,0,0,0.02) !important;
}
/* Branch selector in topbar */
html.light .topbar select {
    background: rgba(0,0,0,0.05) !important;
    border-color: rgba(0,0,0,0.14) !important;
    color: rgba(0,0,0,0.7) !important;
}
/* Profile button hover states */
.topbar-user:hover { background: rgba(255,255,255,0.08); }
html.light .topbar-user:hover { background: rgba(0,0,0,0.07) !important; }


/* ══════════════════════════════════════════════
   RESPONSIVE — Mobile & Tablet
   ══════════════════════════════════════════════ */

/* ── Sidebar overlay backdrop (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.open {
    display: block;
}
html.light .sidebar-overlay { background: rgba(0,0,0,0.35); }

/* ── Hamburger toggle button ── */
.menu-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border2);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    transition: background .15s;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

html.light .menu-toggle {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.12);
    color: #111;
}

/* ── Tablet (769px – 1024px): narrower sidebar ── */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
        min-width: 200px;
    }

    .admin-content {
        padding: 18px;
    }

    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }

    .topbar {
        padding: 0 16px;
    }
}

/* ── Mobile (≤768px): sidebar slides in as drawer ── */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 260px;
        min-width: 260px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        width: 100%;
    }

    .admin-content {
        padding: 14px;
    }

    /* Topbar */
    .topbar {
        padding: 0 12px;
        gap: 8px;
    }

    .topbar-date {
        display: none;
    }

    .topbar-username {
        display: none;
    }

    /* Stats */
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }

    .stat-value {
        font-size: 22px;
    }

    /* Grids */
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .card-grid-2,
    .card-grid-3,
    .card-grid-4 {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .form-grid-2 {
        grid-template-columns: 1fr;
    }

    /* Tables: make them scroll horizontally */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 560px;
    }

    /* Cards */
    .card {
        padding: 16px;
    }

    /* Filter bars wrap nicely */
    .filter-bar {
        gap: 4px;
    }

    .filter-pill {
        font-size: 11px;
        padding: 5px 10px;
    }

    /* Modals full-width on mobile */
    .modal-overlay,
    .modal[id] {
        padding: 10px;
        align-items: flex-end;
    }

    .modal-overlay .modal-box,
    .modal[id]>div:first-child,
    .modal {
        max-width: 100%;
        border-radius: 18px 18px 0 0;
    }

    /* Action bar stacks */
    .action-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Flash message */
    .flash {
        margin: 10px 14px 0;
    }

    /* Buttons in topbar */
    .menu-toggle,
    .topbar-bell,
    .theme-toggle {
        width: 44px;
        height: 44px;
    }

    .topbar-bell {
        font-size: 14px;
    }

    .theme-toggle {
        font-size: 14px;
    }
}

/* ── Small phones (≤480px) ── */
@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card {
        padding: 14px 12px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-icon {
        font-size: 18px;
    }

    .admin-content {
        padding: 10px;
    }

    .topbar {
        height: 52px;
    }

    .card-grid-2,
    .card-grid-3,
    .card-grid-4 {
        grid-template-columns: 1fr 1fr;
    }
}