/* ═══════════════════════════════════════════════════════
   ADMIN PANEL — LINEN & CLAY v1.0
   Soft Pastel CRM Edition — Warm, Elegant, Organic
   ═══════════════════════════════════════════════════════ */

/* ─── 1. Design Tokens (Linen & Clay Palette) ───────── */
:root {
    /* ── Backgrounds ── */
    --bg-body: #f5f2ee;
    /* тёплый linen */
    --bg-sidebar: #faf8f5;
    /* почти белый cream */
    --bg-card: #ffffff;
    --bg-card-hover: #fefcfa;
    --bg-input: #f9f7f4;
    --bg-muted: #f0ede8;

    /* ── Brand / Primary (Clay Rose) ── */
    --primary: #b07d6e;
    /* тёплый глиняный */
    --primary-light: #c9957e;
    --primary-soft: #e8cfc7;
    --primary-gradient: var(--primary);
    --primary-glow: none;
    --primary-hover-shadow: 0 8px 24px rgba(176, 125, 110, 0.35);
    --focus-ring: 0 0 0 3px rgba(176, 125, 110, 0.14);
    --table-row-hover-bg: rgba(176, 125, 110, 0.035);
    --empty-state-bg: linear-gradient(135deg, rgba(240, 237, 232, 0.6), rgba(245, 242, 238, 0.3));
    --empty-state-border: 1px dashed rgba(176, 125, 110, 0.2);

    /* ── Accent Palette ── */
    --accent-sage: #7da49a;
    /* шалфей */
    --accent-sage-soft: #d0e4e0;
    --accent-dust: #9b8db0;
    /* пыльная сирень */
    --accent-dust-soft: #ddd7ea;
    --accent-sand: #c4a882;
    /* тёплый песок */
    --accent-sand-soft: #eddfc9;
    --accent-rose: #c47c84;
    /* пыльная роза */
    --accent-rose-soft: #f0d4d7;

    /* ── Status Colors (мягкие) ── */
    --status-success: #6a9e8b;
    --status-success-bg: #e8f3f0;
    --status-success-bd: #c2ddd7;
    --status-error: #b87070;
    --status-error-bg: #f5e8e8;
    --status-error-bd: #e0c0c0;
    --status-warning: #b89a5a;
    --status-warning-bg: #f7f2e4;
    --status-warning-bd: #e0d1a0;
    --status-info: #6a8bb0;
    --status-info-bg: #e8eef5;
    --status-info-bd: #c0cedf;

    /* ── Borders & Shadows ── */
    --border-soft: 1px solid rgba(176, 125, 110, 0.12);
    --border-medium: 1px solid rgba(176, 125, 110, 0.22);
    --border-strong: 1px solid rgba(176, 125, 110, 0.35);
    --border-color: rgba(176, 125, 110, 0.15);
    --shadow-sm: 0 1px 4px rgba(120, 90, 75, 0.07), 0 2px 8px rgba(120, 90, 75, 0.05);
    --shadow-md: 0 4px 16px rgba(120, 90, 75, 0.10), 0 1px 3px rgba(120, 90, 75, 0.06);
    --shadow-lg: 0 8px 32px rgba(120, 90, 75, 0.12), 0 2px 6px rgba(120, 90, 75, 0.07);
    --shadow-hover: 0 12px 40px rgba(120, 90, 75, 0.16), 0 3px 8px rgba(120, 90, 75, 0.08);

    /* ── Typography ── */
    --font-body: 'Manrope', 'Noto Sans', system-ui, -apple-system, sans-serif;
    --font-heading: 'Rubik', 'Manrope', 'Noto Sans', system-ui, sans-serif;
    --text-primary: #3d332c;
    /* тёплый почти-чёрный */
    --text-secondary: #7a6b62;
    /* тёплый серо-коричневый */
    --text-muted: #b0a49c;
    /* мягкий бежевый */
    --text-placeholder: #c8bdb8;

    /* ── Border Radius ── */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 9999px;

    /* ── Transitions ── */
    --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quint: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ── Layout ── */
    --sidebar-width: 272px;

    /* ── Legacy / Compat aliases (used by module templates) ── */
    --glass-border: var(--border-medium);
    --glass-shadow: var(--shadow-lg);
    --primary-color: var(--primary);
    --accent-cyan: var(--status-info);
    --accent-emerald: var(--status-success);
    --accent-red: var(--status-error);
    --accent-amber: var(--status-warning);
    --accent-gold: var(--status-warning);
    --primary-light: var(--primary);
}

/* ─── 2. Reset & Body ───────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Decorations removed for strict styling */
body::before {
    display: none;
}

/* Тонкая текстура (grain) */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.018;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 128px 128px;
    pointer-events: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    margin-top: 0;
    color: var(--text-primary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s var(--ease-smooth);
}

a:hover {
    color: var(--primary-light);
    text-decoration: none;
}

[style*="font-family: 'Outfit'"] {
    font-family: var(--font-heading) !important;
}

[style*="font-family: 'Inter'"] {
    font-family: var(--font-body) !important;
}

button,
input,
select,
textarea {
    font-family: var(--font-body);
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: var(--bg-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-soft);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ─── 3. Sidebar ────────────────────────────────────── */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: var(--border-soft);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.4s var(--ease-smooth);
    box-shadow: 2px 0 20px rgba(120, 90, 75, 0.06);
}

/* Декоративная вертикальная полоса — фирменный элемент */
.sidebar::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom,
            transparent 0%,
            var(--primary-soft) 20%,
            var(--primary) 50%,
            var(--accent-sage) 80%,
            transparent 100%);
    opacity: 0.7;
    border-radius: 0 2px 2px 0;
}

.sidebar-header {
    padding: 1.75rem 1.5rem;
    border-bottom: var(--border-soft);
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: var(--border-medium);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s var(--ease-bounce);
    cursor: pointer;
}

.sidebar-logo:hover {
    transform: scale(1.06) rotate(-4deg);
    box-shadow: var(--shadow-md);
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0.85rem;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ─── Nav Links ──────────────────────────────────────── */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
    transition: all 0.22s var(--ease-smooth);
}

.nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    background: var(--primary-gradient);
    border-radius: 0 3px 3px 0;
    transition: transform 0.25s var(--ease-bounce);
}

.nav-link:hover {
    color: var(--text-primary) !important;
    background: var(--bg-muted);
}

.nav-link:hover::after {
    transform: translateY(-50%) scaleY(0.5);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(176, 125, 110, 0.12) 0%, rgba(176, 125, 110, 0.06) 100%);
    color: var(--primary) !important;
    font-weight: 600;
}

.nav-link.active::after {
    transform: translateY(-50%) scaleY(1);
}

.nav-link.active .nav-icon {
    color: var(--primary);
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: color 0.2s;
    flex-shrink: 0;
}

.nav-link:hover .nav-icon {
    color: var(--primary);
}

/* Разделитель в меню */
.sidebar-divider {
    height: 1px;
    background: var(--bg-muted);
    margin: 0.75rem 0.5rem;
    border: none;
}

/* Подменю */
.nav-subitems {
    list-style: none;
    padding: 0.25rem 0 0.25rem 2.5rem;
    margin: 0;
}

.nav-subitems .nav-link {
    padding: 0.5rem 0.85rem;
    font-size: 0.84rem;
    color: var(--text-muted) !important;
    gap: 0.65rem;
}

.nav-subitems .nav-link:hover {
    color: var(--text-secondary) !important;
    background: transparent;
}

/* Dot colour shift on hover */
.nav-subitems .nav-link:hover>span:first-child {
    background: var(--primary) !important;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.25rem 1rem;
    border-top: var(--border-soft);
    background: rgba(240, 237, 232, 0.5);
}

/* ─── 4. Main Content ───────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem 2.25rem;
    min-height: 100vh;
    transition: margin-left 0.4s var(--ease-smooth);
}

/* ─── 5. Cards ──────────────────────────────────────── */
.card,
.glass-card,
.u-card,
.dashboard-card,
.settings-group,
.log-container {
    background: var(--bg-card);
    border: var(--border-soft);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s var(--ease-smooth);
    position: relative;
    overflow: hidden;
}

/* Тонкая полоска-акцент сверху карточки (фирменный элемент) */
.card::before,
.glass-card::before,
.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 1.5rem;
    right: 1.5rem;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: linear-gradient(90deg, transparent, var(--primary-soft), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover,
.glass-card:hover,
.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(176, 125, 110, 0.2);
}

.card:hover::before,
.glass-card:hover::before,
.dashboard-card:hover::before {
    opacity: 1;
}

/* ─── 6. Badges ─────────────────────────────────────── */
.badge,
.u-badge {
    padding: 0.3rem 0.72rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-primary {
    background: var(--primary-soft);
    color: var(--primary);
}

.badge-success {
    background: var(--status-success-bg);
    color: var(--status-success);
}

.badge-danger {
    background: var(--status-error-bg);
    color: var(--status-error);
}

.badge-warning {
    background: var(--status-warning-bg);
    color: var(--status-warning);
}

.badge-secondary {
    background: var(--bg-muted);
    color: var(--text-muted);
}

.badge-info {
    background: var(--status-info-bg);
    color: var(--status-info);
}

/* ─── 7. Forms & Inputs ─────────────────────────────── */
.form-control,
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="search"],
select,
textarea {
    background: var(--bg-input) !important;
    border: var(--border-medium) !important;
    border-radius: var(--radius-md) !important;
    color: var(--text-primary) !important;
    padding: 0.72rem 1rem !important;
    font-size: 0.93rem;
    transition: all 0.25s var(--ease-smooth);
    box-shadow: inset 0 1px 3px rgba(120, 90, 75, 0.05);
}

.form-control::placeholder,
input::placeholder {
    color: var(--text-placeholder) !important;
}

.form-control:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    background: #ffffff !important;
    border-color: var(--primary) !important;
    box-shadow: var(--focus-ring) !important;
    outline: none;
}

label {
    color: var(--text-secondary);
    font-size: 0.83rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    margin-bottom: 0.45rem;
    display: block;
}

/* Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 34px;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 22px;
    width: 22px;
    background: var(--bg-input);
    border: var(--border-medium);
    border-radius: 6px;
    transition: all 0.2s var(--ease-smooth);
}

.checkbox-container:hover input~.checkmark {
    border-color: var(--primary);
}

.checkbox-container input:checked~.checkmark {
    background: var(--primary-gradient);
    border-color: transparent;
    box-shadow: var(--primary-glow);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked~.checkmark:after {
    display: block;
    animation: zoomIn 0.18s var(--ease-bounce);
}

/* ─── 8. Buttons ────────────────────────────────────── */
.btn {
    border: none !important;
    border-radius: var(--radius-md);
    padding: 0.7rem 1.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.25s var(--ease-smooth);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    letter-spacing: 0.01em;
}

.btn-primary,
.save-btn {
    background: var(--primary-gradient) !important;
    color: white !important;
    box-shadow: var(--primary-glow);
}

.btn-primary:hover,
.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--primary-hover-shadow);
    color: white !important;
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-danger {
    background: linear-gradient(135deg, #c47c7c, #a85858) !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(180, 100, 100, 0.22);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(180, 100, 100, 0.35);
    color: white !important;
}

.btn-success {
    background: linear-gradient(135deg, #7aaa98, #5a8f7e) !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(100, 160, 140, 0.22);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(100, 160, 140, 0.35);
    color: white !important;
}

.btn-outline {
    background: transparent;
    border: var(--border-medium) !important;
    color: var(--text-secondary) !important;
}

.btn-outline:hover {
    background: var(--bg-muted);
    border-color: rgba(176, 125, 110, 0.28) !important;
    color: var(--text-primary) !important;
}

/* Принудительный запрет на сжатие круглых кнопок таблицами (предотвращает эффект овала на Android/Mobile) */
button[style*="border-radius: 50%"],
a.btn[style*="border-radius: 50%"],
.btn[style*="border-radius: 50%"],
.btn-delete,
.ui-icon-btn,
.btn-circle {
    flex-shrink: 0 !important;
    min-width: 36px !important;
    min-height: 36px !important;
    aspect-ratio: 1 / 1 !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.btn-secondary {
    background: var(--bg-muted) !important;
    color: var(--text-secondary) !important;
    border: var(--border-soft) !important;
}

.btn-secondary:hover {
    background: #e8e4de !important;
    color: var(--text-primary) !important;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ─── 9. Tables ─────────────────────────────────────── */
.table,
.u-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
}

.table th {
    background: var(--bg-muted) !important;
    color: var(--text-muted) !important;
    font-weight: 600;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border: none !important;
    border-bottom: var(--border-soft) !important;
    padding: 0.9rem 1rem;
}

.table td {
    padding: 0.9rem 1rem;
    vertical-align: middle;
    border: none !important;
    border-bottom: var(--border-soft) !important;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: background 0.15s;
}

.table tbody tr:hover td {
    background: var(--table-row-hover-bg);
}

.table tbody tr:last-child td {
    border-bottom: none !important;
}

/* ─── 10. Modals ────────────────────────────────────── */
.modal-base,
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(61, 51, 44, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s var(--ease-smooth);
}

.modal-base>.modal-card,
.modal-overlay>.modal-card {
    background: var(--bg-card);
    border: var(--border-soft);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalSlideUp 0.32s var(--ease-out-quint);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content {
    background: var(--bg-card) !important;
    border: var(--border-soft) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-lg) !important;
}

.modal-header {
    border-bottom: var(--border-soft) !important;
    padding: 1.4rem 1.75rem !important;
    background: var(--bg-input);
}

.modal-body {
    padding: 1.75rem !important;
}

.modal-footer {
    border-top: var(--border-soft) !important;
    padding: 1.25rem 1.75rem !important;
    background: var(--bg-input);
}

.ui-modal-shell {
    max-width: 640px !important;
}

.ui-modal-header,
.ui-modal-footer {
    background: var(--bg-muted);
}

.ui-modal-header {
    padding: 1.4rem 1.6rem;
    border-bottom: var(--border-soft);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.ui-modal-header h3,
.ui-modal-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.ui-modal-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

.ui-modal-body {
    padding: 1.6rem;
}

.ui-modal-footer {
    padding: 1.1rem 1.6rem;
    border-top: var(--border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ui-modal-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: var(--border-soft);
    background: var(--bg-muted);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-smooth);
    cursor: pointer;
}

.ui-modal-close:hover {
    color: var(--status-error);
    background: var(--status-error-bg);
    border-color: var(--status-error-bd);
}

/* ─── 11. Icon Buttons ──────────────────────────────── */
.ui-icon-btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0 !important;
    border-radius: 50% !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    font-size: 0.85rem;
    line-height: 1;
    transition: all 0.2s var(--ease-smooth);
}

.ui-icon-btn.ui-icon-btn--danger {
    color: var(--status-error) !important;
    background: var(--status-error-bg) !important;
    border: 1px solid var(--status-error-bd) !important;
}

.ui-icon-btn.ui-icon-btn--danger:hover {
    background: #eecfcf !important;
}

.ui-icon-btn.ui-icon-btn--success {
    color: var(--status-success) !important;
    background: var(--status-success-bg) !important;
    border: 1px solid var(--status-success-bd) !important;
}

.ui-icon-btn.ui-icon-btn--success:hover {
    background: #d4ece7 !important;
}

.ui-icon-btn.ui-icon-btn--warning {
    color: var(--status-warning) !important;
    background: var(--status-warning-bg) !important;
    border: 1px solid var(--status-warning-bd) !important;
}

.ui-icon-btn.ui-icon-btn--info {
    color: var(--status-info) !important;
    background: var(--status-info-bg) !important;
    border: 1px solid var(--status-info-bd) !important;
}

/* ─── 12. Alerts & Status Blocks ────────────────────── */
.ui-inline-status,
.ui-alert {
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    line-height: 1.5;
    font-size: 0.9rem;
}

.ui-inline-status--info,
.ui-alert--info {
    background: var(--status-info-bg);
    color: var(--status-info);
    border: 1px solid var(--status-info-bd);
}

.ui-inline-status--success,
.ui-alert--success {
    background: var(--status-success-bg);
    color: var(--status-success);
    border: 1px solid var(--status-success-bd);
}

.ui-inline-status--warning,
.ui-alert--warning {
    background: var(--status-warning-bg);
    color: var(--status-warning);
    border: 1px solid var(--status-warning-bd);
}

.ui-inline-status--error,
.ui-alert--error {
    background: var(--status-error-bg);
    color: var(--status-error);
    border: 1px solid var(--status-error-bd);
}

.ui-alert-stack {
    display: grid;
    gap: 0.75rem;
}

.ui-alert {
    position: relative;
    box-shadow: var(--shadow-sm);
}

.ui-alert__body {
    flex: 1;
    min-width: 0;
}

.ui-alert__title {
    display: block;
    font-weight: 700;
    margin-bottom: 0.1rem;
}

.ui-alert__close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-smooth);
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.7;
}

.ui-alert__close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

/* ─── 13. Toast Notifications ───────────────────────── */
.ui-toast-region {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 12000;
    width: min(360px, calc(100vw - 32px));
    display: grid;
    gap: 0.6rem;
    pointer-events: none;
}

.ui-toast {
    pointer-events: auto;
    background: var(--bg-card);
    border: var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 0.85rem 0.95rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.26s var(--ease-out-quint);
}

.ui-toast--success {
    border-left: 3px solid var(--status-success);
}

.ui-toast--error {
    border-left: 3px solid var(--status-error);
}

.ui-toast--warning {
    border-left: 3px solid var(--status-warning);
}

.ui-toast--info {
    border-left: 3px solid var(--status-info);
}

.ui-toast__icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    font-size: 0.85rem;
}

.ui-toast--success .ui-toast__icon {
    color: var(--status-success);
    background: var(--status-success-bg);
}

.ui-toast--error .ui-toast__icon {
    color: var(--status-error);
    background: var(--status-error-bg);
}

.ui-toast--warning .ui-toast__icon {
    color: var(--status-warning);
    background: var(--status-warning-bg);
}

.ui-toast--info .ui-toast__icon {
    color: var(--status-info);
    background: var(--status-info-bg);
}

.ui-toast__text {
    color: var(--text-primary);
    font-size: 0.88rem;
    line-height: 1.45;
    flex: 1;
}

.ui-toast__close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0.1rem;
    cursor: pointer;
    transition: color 0.18s;
}

.ui-toast__close:hover {
    color: var(--text-primary);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(16px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ─── 14. Overview Cards (Stats) ────────────────────── */
.ui-overview-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.5rem;
    height: 100%;
    border-radius: var(--radius-xl);
}

.ui-overview-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-lg);
    flex: 0 0 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.ui-overview-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}

.ui-overview-value {
    color: var(--text-primary);
    font-size: 1.85rem;
    font-weight: 800;
    font-family: var(--font-heading);
    line-height: 1;
}

/* ─── 15. Search Shell ──────────────────────────────── */
.ui-search-shell {
    background: var(--bg-input);
    border: var(--border-medium);
    border-radius: var(--radius-full);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ui-search-shell:focus-within {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

/* ─── 16. Empty State ───────────────────────────────── */
.ui-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    min-height: 30vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--empty-state-bg);
    border: var(--empty-state-border);
    border-radius: var(--radius-xl);
}

.ui-empty-state>i {
    font-size: 3rem;
    color: var(--primary-soft);
    margin-bottom: 1rem;
}

.ui-empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ─── 17. Close Button (Bootstrap compat) ───────────── */
.close {
    color: var(--text-muted) !important;
    text-shadow: none !important;
    opacity: 0.7;
}

.close:hover {
    color: var(--status-error) !important;
    opacity: 1;
}

/* ─── 18. Mobile Adaptation ─────────────────────────── */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1100;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: var(--border-medium);
    color: var(--text-secondary);
    box-shadow: var(--shadow-md);
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    cursor: pointer;
}

.mobile-menu-btn:hover {
    background: var(--bg-muted);
    color: var(--primary);
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 992px) {

    html.sidebar-pre-collapsed body,
    body.sidebar-collapsed {
        --sidebar-width: 272px;
    }

    body.sidebar-mobile-open {
        overflow: hidden;
        position: fixed;
        left: 0;
        right: 0;
        width: 100%;
    }

    .sidebar {
        width: min(86vw, 320px);
        max-width: 320px;
        transform: translateX(-105%);
        box-shadow: 16px 0 40px rgba(61, 51, 44, 0.18);
    }

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

    body.sidebar-collapsed .sidebar-text-wrap,
    body.sidebar-collapsed .nav-text,
    body.sidebar-collapsed .sub-toggle,
    html.sidebar-pre-collapsed .sidebar-text-wrap,
    html.sidebar-pre-collapsed .nav-text,
    html.sidebar-pre-collapsed .sub-toggle {
        display: inline-flex !important;
        max-width: 220px !important;
        opacity: 1 !important;
        transform: none !important;
        margin: 0 !important;
        padding: 0 !important;
        pointer-events: auto !important;
    }

    body.sidebar-collapsed .sidebar-sound-btn,
    html.sidebar-pre-collapsed .sidebar-sound-btn {
        width: 32px;
        min-width: 32px;
        opacity: 1;
        margin: 0;
        padding: 0;
        border-width: 1px;
        overflow: visible;
    }

    body.sidebar-collapsed .sidebar-header>div,
    html.sidebar-pre-collapsed .sidebar-header>div,
    body.sidebar-collapsed .nav-link,
    html.sidebar-pre-collapsed .nav-link,
    body.sidebar-collapsed .btn-sidebar-action,
    html.sidebar-pre-collapsed .btn-sidebar-action {
        justify-content: flex-start !important;
        gap: 0.75rem !important;
        padding-left: 0.95rem !important;
        padding-right: 0.95rem !important;
    }

    .sidebar-header {
        padding: calc(env(safe-area-inset-top, 0px) + 0.95rem) 1rem 1rem;
    }

    .sidebar-menu {
        padding: 0.85rem 0.75rem;
    }

    .sidebar-footer {
        padding: 0.95rem 0.85rem calc(env(safe-area-inset-bottom, 0px) + 0.9rem);
    }

    .nav-link {
        min-height: 48px;
        font-size: 0.92rem;
    }

    .mobile-menu-btn {
        display: flex;
        top: calc(env(safe-area-inset-top, 0px) + 0.8rem);
        left: 0.8rem;
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: calc(env(safe-area-inset-top, 0px) + 4.6rem) 0.9rem calc(env(safe-area-inset-bottom, 0px) + 1.15rem);
    }

    .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }

    .content-header {
        align-items: stretch;
        gap: 0.9rem;
        margin-bottom: 1.35rem;
    }

    .content-header .header-title,
    .content-header .header-actions {
        width: 100%;
    }

    .content-header .header-title h1 {
        font-size: 1.45rem !important;
        line-height: 1.15;
        margin-bottom: 0.25rem;
    }

    .content-header .header-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }

    .content-header .header-actions>* {
        width: 100%;
        justify-content: center;
    }

    .card,
    .glass-card,
    .u-card,
    .dashboard-card,
    .settings-group,
    .log-container {
        padding: 1rem;
        border-radius: 18px;
    }

    .dashboard-card,
    .utility-card {
        min-height: auto;
    }

    .utility-card {
        align-items: flex-start;
        padding: 1rem 1rem 1.05rem;
    }

    .utility-card .fa-arrow-right {
        margin-left: 0 !important;
        margin-top: 0.35rem;
    }

    .submodules-dock {
        justify-content: flex-start;
    }

    .table-responsive {
        display: block;
        width: calc(100% + 2rem);
        margin-left: -1rem;
        margin-right: -1rem;
        padding: 0 1rem 0.3rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 680px;
        margin-bottom: 0;
    }

    .table th,
    .table td {
        font-size: 0.88rem;
        white-space: nowrap;
        vertical-align: middle;
    }

    .btn,
    button.btn,
    .btn-primary,
    .btn-outline,
    .btn-secondary {
        min-height: 44px;
    }

    .ui-modal-shell,
    .modal-card,
    .modal-base .modal-content {
        width: calc(100vw - 1rem) !important;
        max-width: calc(100vw - 1rem) !important;
        max-height: calc(100vh - 1rem);
        margin: 0.5rem auto;
        border-radius: 20px;
        overflow-y: auto;
        padding: 0 !important;
    }

    .ui-modal-header,
    .ui-modal-body,
    .ui-modal-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .ui-modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .ui-modal-footer>* {
        width: 100%;
    }

    .theme-toggle-grid {
        grid-template-columns: 1fr;
    }

    .floating-save-bar {
        bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
        width: calc(100vw - 1.5rem);
    }

    .floating-save-bar .btn {
        width: 100%;
    }

    .sidebar-backdrop.active {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(61, 51, 44, 0.42);
        z-index: 999;
        backdrop-filter: blur(4px);
    }
}

@media (max-width: 768px) {
    .main-content {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .content-header .header-title h1 {
        font-size: 1.32rem !important;
    }

    .subtitle {
        font-size: 0.88rem;
    }

    .section-heading {
        margin-bottom: 0.9rem;
    }

    .btn-sidebar-action {
        min-height: 44px;
    }

    .ui-alert {
        padding: 0.9rem 1rem;
        gap: 0.75rem;
    }
}

@media (max-width: 576px) {
    .mobile-menu-btn {
        left: 0.7rem;
        top: calc(env(safe-area-inset-top, 0px) + 0.7rem);
    }

    .main-content {
        padding-top: calc(env(safe-area-inset-top, 0px) + 4.3rem);
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }

    .card,
    .glass-card,
    .u-card,
    .dashboard-card,
    .settings-group,
    .log-container {
        padding: 0.9rem;
        border-radius: 16px;
    }

    .content-header .header-actions {
        gap: 0.55rem;
    }

    .table-responsive {
        width: calc(100% + 1.3rem);
        margin-left: -0.65rem;
        margin-right: -0.65rem;
        padding: 0 0.65rem 0.25rem;
    }

    .ui-modal-shell,
    .modal-card,
    .modal-base .modal-content {
        width: calc(100vw - 0.5rem) !important;
        max-width: calc(100vw - 0.5rem) !important;
        margin: 0.25rem auto;
        border-radius: 18px;
    }
}

/* ─── 19. Utilities ─────────────────────────────────── */

/* Time input block (used in booking/settings and about/index) */
.time-block {
    background: var(--bg-input);
    border: var(--border-medium);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
}

.time-block__icon {
    padding: 0 0.75rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    flex-shrink: 0;
}

.time-block input[type="time"] {
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    padding: 0.6rem 0.75rem 0.6rem 0 !important;
    flex: 1;
    -webkit-text-fill-color: var(--text-primary);
    color-scheme: light;
}

.time-block input[type="time"]:focus {
    outline: none !important;
    box-shadow: none !important;
}

[data-theme="dark"] .time-block input[type="time"] {
    color-scheme: dark;
}

.text-gradient {
    color: var(--text-primary);
    font-weight: 700;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.content-header .header-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

/* ─── 20. Entrance Animations ───────────────────────── */
.fade-in,
.anim-item {
    opacity: 0;
    transform: translateY(16px);
    transition:
        opacity 0.65s var(--ease-out-quint),
        transform 0.65s var(--ease-out-quint);
    transition-delay: var(--anim-delay, 0ms);
    will-change: transform, opacity;
}

.fade-in.anim-visible,
.anim-item.anim-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* ─── 21. Sidebar Bottom Buttons ────────────────────── */
.btn-sidebar-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.55rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease-smooth);
    border: var(--border-soft);
    background: transparent;
    color: var(--text-muted);
    text-decoration: none;
}

.btn-sidebar-action:hover {
    background: var(--bg-muted);
    color: var(--text-secondary);
    text-decoration: none;
}

.btn-sidebar-action.restart {
    color: var(--status-warning);
    border-color: var(--status-warning-bd);
}

.btn-sidebar-action.restart:hover {
    background: var(--status-warning-bg);
}

.btn-sidebar-action.logout {
    color: var(--status-error);
    border-color: var(--status-error-bd);
}

.btn-sidebar-action.logout:hover {
    background: var(--status-error-bg);
}

/* ─── 22. Pagination ────────────────────────────────── */
.page-link {
    color: var(--primary);
    background: var(--bg-card);
    border-color: var(--border-soft);
    transition: all 0.2s;
}

.page-link:hover {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: var(--primary-soft);
}

.page-item.active .page-link {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    box-shadow: var(--primary-glow);
}

/* ─── 23. Code / Pre ────────────────────────────────── */
code {
    background: var(--bg-muted);
    color: var(--primary);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.88em;
}

pre {
    background: var(--bg-muted);
    border: var(--border-soft);
    border-radius: var(--radius-md);
    padding: 1rem;
    overflow-x: auto;
    color: var(--text-secondary);
}

/* ─── 24. Keyframes ─────────────────────────────────── */
@keyframes zoomIn {
    from {
        transform: scale(0.4) rotate(45deg);
    }

    to {
        transform: scale(1) rotate(45deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.85);
    }
}

/* ─── 25. Section separator style ───────────────────── */
.section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-placeholder);
    padding: 0 0.5rem;
    margin: 1rem 0 0.5rem;
}

/* Theme toggle button inside settings */

.theme-toggle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-top: 0.5rem;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: var(--border-medium);
    background: var(--bg-input);
    cursor: pointer;
    transition: all 0.22s var(--ease-smooth);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.theme-option input[type="radio"] {
    display: none;
}

.theme-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: var(--primary-glow);
}

.theme-option:hover:not(:has(input:checked)) {
    border-color: var(--border-strong);
    background: var(--bg-muted);
}

.theme-option i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════
   27. SIDEBAR COLLAPSE & TOGGLE
   ═══════════════════════════════════════════════════════ */

.sidebar {
    transition: width 0.4s var(--ease-smooth), transform 0.4s var(--ease-smooth);
}

.main-content {
    transition: margin-left 0.4s var(--ease-smooth);
}

.sidebar-toggle-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: var(--border-medium);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary);
    font-size: 1.15rem;
    transition: all 0.22s var(--ease-bounce);
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: var(--primary-glow);
    transform: scale(1.06);
}

/* Collapsed state */
body.sidebar-collapsed {
    --sidebar-width: 82px;
}

body.sidebar-collapsed .sidebar-text-wrap,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .sub-toggle {
    display: none !important;
}

body.sidebar-collapsed .sidebar-header>div {
    justify-content: center !important;
    padding: 0 !important;
}

body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

body.sidebar-collapsed .nav-icon {
    font-size: 1.2rem;
    margin: 0 !important;
}

body.sidebar-collapsed .nav-subitems {
    padding: 0.4rem 0 0.4rem 0;
    text-align: center;
}

body.sidebar-collapsed .nav-subitems .nav-link {
    justify-content: center;
    padding: 0.6rem 0;
}

body.sidebar-collapsed .nav-subitems .nav-link span:first-child {
    width: 8px;
    height: 8px;
}

body.sidebar-collapsed .btn-sidebar-action {
    justify-content: center;
    padding: 0.8rem 0;
}

body.sidebar-collapsed .btn-sidebar-action i {
    margin: 0 !important;
    font-size: 1.1rem;
}

/* Sound icon in sidebar header */
.sidebar-sound-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: var(--border-soft);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: all 0.22s var(--ease-smooth);
    flex-shrink: 0;
}

.sidebar-sound-btn:hover {
    background: var(--bg-muted);
    color: var(--primary);
    border-color: var(--border-medium);
}

/* ═══════════════════════════════════════════════════════
   DARK THEME — COCOA & SLATE (Pastel Dark)
   A flawless, soft continuation of the light Linen & Clay theme.
   ═══════════════════════════════════════════════════════ */
[data-theme="dark"] {
    /* ── Backgrounds (Deep Warm Cocoa/Taupe) ── */
    --bg-body: #2b2725;
    --bg-sidebar: #312c29;
    --bg-card: #38322e;
    --bg-card-hover: #3d3733;
    --bg-input: #423b37;
    --bg-muted: #48413c;

    /* ── Brand / Primary (Soft Illuminated Clay/Peach) ── */
    --primary: #d4a390;
    --primary-light: #e0b8a8;
    --primary-soft: rgba(212, 163, 144, 0.18);
    --primary-gradient: linear-gradient(135deg, #d4a390, #c48e7a);
    --primary-glow: none;
    --primary-hover-shadow: 0 8px 24px rgba(212, 163, 144, 0.25);
    --focus-ring: 0 0 0 3px rgba(212, 163, 144, 0.18);
    --table-row-hover-bg: rgba(212, 163, 144, 0.08);
    --empty-state-bg: linear-gradient(135deg, rgba(66, 59, 55, 0.8), rgba(56, 50, 46, 0.85));
    --empty-state-border: 1px dashed rgba(212, 163, 144, 0.2);

    /* ── Accent Palette (Bright, Soft Pastels) ── */
    --accent-sage: #9cbdae;
    --accent-sage-soft: rgba(156, 189, 174, 0.16);
    --accent-dust: #bca8cc;
    --accent-dust-soft: rgba(188, 168, 204, 0.16);
    --accent-sand: #e0c8a6;
    --accent-sand-soft: rgba(224, 200, 166, 0.16);
    --accent-rose: #d6a1a5;
    --accent-rose-soft: rgba(214, 161, 165, 0.16);

    /* ── Status Colors (Soft Pastel Equivalents) ── */
    --status-success: #95c2ae;
    --status-success-bg: rgba(149, 194, 174, 0.15);
    --status-success-bd: rgba(149, 194, 174, 0.25);
    --status-error: #d69696;
    --status-error-bg: rgba(214, 150, 150, 0.15);
    --status-error-bd: rgba(214, 150, 150, 0.25);
    --status-warning: #dbc18c;
    --status-warning-bg: rgba(219, 193, 140, 0.15);
    --status-warning-bd: rgba(219, 193, 140, 0.25);
    --status-info: #a5bbd6;
    --status-info-bg: rgba(165, 187, 214, 0.15);
    --status-info-bd: rgba(165, 187, 214, 0.25);

    /* ── Borders & Shadows (Deep blurred amber shadow) ── */
    --border-soft: 1px solid rgba(220, 192, 180, 0.08);
    --border-medium: 1px solid rgba(220, 192, 180, 0.14);
    --border-strong: 1px solid rgba(220, 192, 180, 0.24);
    --border-color: rgba(220, 192, 180, 0.12);
    --shadow-sm: 0 1px 4px rgba(17, 14, 12, 0.20), 0 2px 8px rgba(17, 14, 12, 0.12);
    --shadow-md: 0 4px 16px rgba(17, 14, 12, 0.28), 0 1px 3px rgba(17, 14, 12, 0.16);
    --shadow-lg: 0 8px 32px rgba(17, 14, 12, 0.35), 0 2px 6px rgba(17, 14, 12, 0.22);
    --shadow-hover: 0 12px 40px rgba(17, 14, 12, 0.40), 0 3px 8px rgba(17, 14, 12, 0.25);

    /* ── Typography (Warm Off-Whites) ── */
    --text-primary: #f2ebe6;
    --text-secondary: #d4c8c0;
    --text-muted: #a69b93;
    --text-placeholder: #857a73;

    /* ── Legacy Compat ── */
    --glass-border: var(--border-medium);
    --glass-shadow: var(--shadow-lg);
    --primary-color: var(--primary);
    --accent-cyan: var(--status-info);
    --accent-emerald: var(--status-success);
    --accent-red: var(--status-error);
    --accent-amber: var(--status-warning);
    --accent-gold: var(--status-warning);
}


/* ── Dark: Body & Scrollbar ── */
[data-theme="dark"] body {
    background-color: var(--bg-body);
    color: var(--text-primary);
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg-muted);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #7d6f65;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ── Dark: Sidebar ── */
[data-theme="dark"] .sidebar {
    background: var(--bg-sidebar);
    border-right-color: var(--border-soft);
}

[data-theme="dark"] .sidebar-header {
    border-bottom-color: var(--border-soft);
}

[data-theme="dark"] .sidebar-nav-link {
    color: var(--text-secondary);
}

[data-theme="dark"] .sidebar-nav-link:hover,
[data-theme="dark"] .sidebar-nav-link.active {
    background: var(--bg-muted);
    color: var(--text-primary);
}

[data-theme="dark"] .sidebar-nav-link.active {
    background: var(--primary-soft);
    color: var(--primary-light);
    border-left-color: var(--primary);
}

[data-theme="dark"] .sidebar-section-label {
    color: var(--text-muted);
    border-bottom-color: var(--border-soft);
}

[data-theme="dark"] .sidebar-footer {
    border-top-color: var(--border-soft);
    background: transparent;
}

/* ── Dark: Top Bar ── */
[data-theme="dark"] .top-bar {
    background: var(--bg-card);
    border-bottom-color: var(--border-soft);
}

[data-theme="dark"] .top-bar-actions .btn-outline {
    border-color: var(--border-medium);
    color: var(--text-secondary);
}

/* ── Dark: Cards ── */
[data-theme="dark"] .glass-card,
[data-theme="dark"] .card {
    background: var(--bg-card);
    border-color: var(--border-soft);
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .glass-card:hover {
    background: var(--bg-card-hover);
}

/* ── Dark: Tables ── */
[data-theme="dark"] .table {
    color: var(--text-primary);
}

[data-theme="dark"] .table thead th {
    background: var(--bg-muted);
    color: var(--text-secondary);
    border-bottom-color: var(--border-medium);
}

[data-theme="dark"] .table tbody tr {
    border-bottom-color: var(--border-soft);
}

[data-theme="dark"] .table tbody tr:hover {
    background: var(--bg-muted);
}

[data-theme="dark"] .table thead {
    background: var(--bg-muted) !important;
}

/* ── Dark: Inputs & Forms ── */
[data-theme="dark"] .form-control,
[data-theme="dark"] select,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] textarea {
    background: var(--bg-input) !important;
    border-color: var(--border-medium) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .form-control:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary-soft) !important;
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--text-placeholder) !important;
}

/* ── Dark: Buttons ── */
[data-theme="dark"] .btn-outline {
    border-color: var(--border-medium);
    color: var(--text-secondary);
    background: transparent;
}

[data-theme="dark"] .btn-outline:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

[data-theme="dark"] .btn-primary {
    background: var(--primary);
    color: #fff;
}

[data-theme="dark"] .btn-primary:hover {
    background: var(--primary-light);
}

/* ── Dark: Badges ── */
[data-theme="dark"] .badge {
    border-color: var(--border-medium);
}

/* ── Dark: Modals ── */
[data-theme="dark"] .ui-modal-shell,
[data-theme="dark"] .modal-card {
    background: var(--bg-card);
    border-color: var(--border-medium);
}

[data-theme="dark"] .ui-modal-header {
    border-bottom-color: var(--border-soft);
}

[data-theme="dark"] .ui-modal-body {
    background: var(--bg-card);
    color: var(--text-primary);
}

[data-theme="dark"] .ui-modal-close {
    background: var(--bg-muted);
    color: var(--text-muted);
    border-color: var(--border-soft);
}

[data-theme="dark"] .ui-modal-close:hover {
    background: var(--status-error-bg);
    color: var(--status-error);
}

/* ── Dark: Status selects (booking) ── */
[data-theme="dark"] .status-select {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-medium) !important;
}

[data-theme="dark"] .status-select option {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* ── Dark: Inline Status ── */
[data-theme="dark"] .ui-inline-status {
    background: var(--bg-muted);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

[data-theme="dark"] .ui-inline-status--warning {
    background: var(--status-warning-bg);
    border-color: var(--status-warning-bd);
    color: var(--status-warning);
}

[data-theme="dark"] .ui-inline-status--error {
    background: var(--status-error-bg);
    border-color: var(--status-error-bd);
    color: var(--status-error);
}

/* ── Dark: Empty State ── */
[data-theme="dark"] .ui-empty-state {
    color: var(--text-muted);
}

/* ── Dark: Toast ── */
[data-theme="dark"] .admin-toast {
    background: var(--bg-card);
    border-color: var(--border-medium);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
}

/* ── Dark: Togggle (dry-run-track / glass-switch slider) ── */
[data-theme="dark"] .dry-run-track,
[data-theme="dark"] .slider {
    background-color: var(--bg-muted);
    border-color: var(--border-medium);
}

/* ── Dark: Mass Actions Bar ── */
[data-theme="dark"] .mass-actions-bar {
    background: var(--bg-card);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

/* ── Dark: Filter Buttons ── */
[data-theme="dark"] .filter-btn {
    background: var(--bg-input);
    border-color: var(--border-medium);
    color: var(--text-secondary);
}

[data-theme="dark"] .filter-btn:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

[data-theme="dark"] .filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: transparent;
    font-weight: 500;
}

.filter-btn.active i {
    color: white !important;
}

/* ── Dark: Settings Item divider ── */
[data-theme="dark"] .settings-item {
    border-bottom-color: var(--border-soft);
}

/* ── Dark: Key Display (iiko) ── */
[data-theme="dark"] .key-display {
    background: var(--bg-muted);
    border-color: var(--border-medium);
    color: var(--status-info);
}

/* ── Dark: Sidebar collapse toggle button ── */
[data-theme="dark"] .sidebar-toggle-btn {
    color: var(--text-muted);
    border-color: var(--border-soft);
}

[data-theme="dark"] .sidebar-toggle-btn:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

/* Sidebar Motion Refresh */
html.sidebar-pre-collapsed .sidebar,
html.sidebar-pre-collapsed .main-content,
html.sidebar-pre-collapsed .sidebar *,
body:not(.sidebar-motion-ready) .sidebar,
body:not(.sidebar-motion-ready) .main-content,
body:not(.sidebar-motion-ready) .sidebar * {
    transition: none !important;
}

.sidebar-header,
.sidebar-footer,
.sidebar-menu,
.nav-link,
.nav-subitems,
.btn-sidebar-action,
.sidebar-toggle-btn,
.sidebar-sound-btn,
.nav-icon {
    transition: all 0.3s var(--ease-smooth);
}

.sidebar-text-wrap,
.nav-text,
.sub-toggle {
    display: inline-flex !important;
    align-items: center;
    min-width: 0;
    max-width: 220px;
    overflow: hidden;
    white-space: nowrap;
    opacity: 1;
    transform: translateX(0);
    transition:
        max-width 0.28s var(--ease-smooth),
        opacity 0.22s var(--ease-smooth),
        transform 0.28s var(--ease-smooth),
        margin 0.28s var(--ease-smooth),
        padding 0.28s var(--ease-smooth);
}

.sidebar-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: var(--border-soft);
    background: var(--bg-muted);
    box-shadow: none;
    color: var(--text-secondary);
    font-size: 1rem;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-medium);
    box-shadow: none;
    transform: translateY(-1px);
}

[data-theme="dark"] .sidebar-toggle-btn {
    background: var(--bg-input);
    color: var(--text-secondary);
}

[data-theme="dark"] .sidebar-toggle-btn:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
    box-shadow: none;
}

html.sidebar-pre-collapsed body,
body.sidebar-collapsed {
    --sidebar-width: 92px;
}

html.sidebar-pre-collapsed .sidebar-text-wrap,
html.sidebar-pre-collapsed .nav-text,
html.sidebar-pre-collapsed .sub-toggle,
body.sidebar-collapsed .sidebar-text-wrap,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .sub-toggle {
    display: inline-flex !important;
    max-width: 0 !important;
    opacity: 0 !important;
    transform: translateX(-10px);
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
}

html.sidebar-pre-collapsed .sidebar-header>div,
body.sidebar-collapsed .sidebar-header>div {
    justify-content: center !important;
    gap: 0.45rem;
    padding: 0 !important;
}

html.sidebar-pre-collapsed .nav-link,
body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
}

html.sidebar-pre-collapsed .nav-icon,
body.sidebar-collapsed .nav-icon {
    font-size: 1rem;
    margin: 0 !important;
}

html.sidebar-pre-collapsed .nav-subitems,
body.sidebar-collapsed .nav-subitems {
    padding: 0.4rem 0;
    text-align: center;
}

html.sidebar-pre-collapsed .nav-subitems .nav-link,
body.sidebar-collapsed .nav-subitems .nav-link {
    justify-content: center;
    padding: 0.6rem 0.75rem;
}

html.sidebar-pre-collapsed .nav-subitems .nav-link span:first-child,
body.sidebar-collapsed .nav-subitems .nav-link span:first-child {
    width: 6px;
    height: 6px;
}

html.sidebar-pre-collapsed .btn-sidebar-action,
body.sidebar-collapsed .btn-sidebar-action {
    justify-content: center;
    gap: 0;
    padding: 0.68rem;
}

html.sidebar-pre-collapsed .btn-sidebar-action i,
body.sidebar-collapsed .btn-sidebar-action i {
    margin: 0 !important;
    font-size: 1rem;
}

html.sidebar-pre-collapsed .sidebar-sound-btn,
body.sidebar-collapsed .sidebar-sound-btn {
    width: 0;
    min-width: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    border-width: 0;
    overflow: hidden;
}


.ui-error-report-modal {
    max-width: 760px !important;
    width: min(92vw, 760px);
}

.ui-error-report-code {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    border: var(--border-soft);
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.5;
}

.ui-error-report-textarea {
    width: 100%;
    min-height: 220px;
    resize: vertical;
    border-radius: var(--radius-md);
    border: var(--border-medium);
    background: var(--bg-input);
    color: var(--text-primary);
    padding: 1rem 1.1rem;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.86rem;
    line-height: 1.6;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.ui-error-report-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.ui-log-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.85rem 0.9rem 1rem;
    border-bottom: var(--border-soft);
    margin-bottom: 0.75rem;
}

.ui-log-source-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.ui-log-source-btn {
    border: var(--border-soft);
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    padding: 0.5rem 0.95rem;
    font-size: 0.84rem;
    font-weight: 700;
    transition: all 0.2s var(--ease-smooth);
}

.ui-log-source-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-medium);
    transform: translateY(-1px);
}

.ui-log-source-btn.active {
    background: var(--primary);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

.ui-log-toolbar-note {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

[data-theme="dark"] .ui-error-report-code,
[data-theme="dark"] .ui-error-report-textarea,
[data-theme="dark"] .ui-log-source-btn {
    background: var(--bg-input);
    border-color: var(--border-medium);
}

[data-theme="dark"] code,
[data-theme="dark"] pre {
    background: var(--bg-input);
    border-color: var(--border-medium);
    color: var(--text-secondary);
}

[data-theme="dark"] .card:hover,
[data-theme="dark"] .glass-card:hover,
[data-theme="dark"] .dashboard-card:hover {
    border-color: rgba(197, 155, 139, 0.24);
}

[data-theme="dark"] .modal-base,
[data-theme="dark"] .modal-overlay {
    background: rgba(18, 14, 12, 0.72);
}