/* ── densch Admin – Stylesheet ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #FF0000;
    --primary-dark: #CC0000;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text: #0f172a;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --bg: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --sidebar-w: 220px;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar__brand {
    padding: 24px 20px 20px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}
.sidebar__brand span { color: var(--primary); }

.sidebar__nav {
    flex: 1;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}
.sidebar__link:hover { background: var(--bg); color: var(--text); }
.sidebar__link.active { background: #eff6ff; color: var(--primary); font-weight: 600; }
.sidebar__link svg { flex-shrink: 0; }

.sidebar__footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}
.sidebar__user {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar__logout {
    font-size: 13px;
    color: var(--danger);
    text-decoration: none;
}
.sidebar__logout:hover { text-decoration: underline; }

/* ── Main Content ── */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}

.main__header {
    padding: 24px 32px 0;
}
.main__header h1 {
    font-size: 22px;
    font-weight: 700;
}

.main__content {
    padding: 24px 32px 48px;
}

/* ── Cards Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
}
.stat-card__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}
.stat-card__value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}
.stat-card__sub {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

/* ── Tables ── */
.table-wrap {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 24px;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}
.table-header__title {
    font-size: 15px;
    font-weight: 600;
}

table {
    width: 100%;
    border-collapse: collapse;
}
th {
    text-align: left;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}
.badge--success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.badge--danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge--warning { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.badge--info { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.badge--neutral { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

.badges { display: flex; gap: 4px; flex-wrap: wrap; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.15s;
    font-family: inherit;
    line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); }

.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #dc2626; }
.btn--success { background: var(--success); color: #fff; }
.btn--ghost { background: transparent; border: 1px solid var(--border); color: var(--text-light); }
.btn--ghost:hover { background: var(--bg); color: var(--text); }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--icon { padding: 6px; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
}
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s;
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
}
select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ── Search & Filter Bar ── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px 10px 36px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 12px center;
}
.search-input:focus { outline: none; border-color: var(--primary); }

.filter-select {
    padding: 10px 36px 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.filter-select:focus { outline: none; border-color: var(--primary); }

/* ── Pagination ── */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 16px;
}
.pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    text-decoration: none;
    border: 1px solid var(--border);
    transition: all 0.15s;
}
.pagination a:hover { background: var(--bg); color: var(--text); }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}
.tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    text-decoration: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: var(--text);
    box-shadow: var(--shadow-md);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 9999;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.toast--success { background: var(--success); }
.toast.toast--danger { background: var(--danger); }

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--white);
    border-radius: 12px;
    padding: 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal__title { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.modal__text { font-size: 14px; color: var(--text-light); margin-bottom: 20px; line-height: 1.6; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Login Page ── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}
.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}
.login-brand {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}
.login-brand span { color: var(--primary); }
.login-sub {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 32px;
}
.login-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 20px;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state__icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state__text { font-size: 15px; }

/* ── Utility ── */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-mono { font-family: 'SF Mono', 'Menlo', monospace; font-size: 13px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ── Toggle Switch ── */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}
.toggle input { display: none; }
.toggle__slider {
    position: absolute;
    inset: 0;
    background: #94a3b8;
    border-radius: 12px;
    transition: 0.2s;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
}
.toggle__slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle__slider { background: var(--success); box-shadow: none; }
.toggle input:checked + .toggle__slider::before { transform: translateX(20px); }

/* ── Responsive ── */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .main__header, .main__content { padding-left: 20px; padding-right: 20px; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
