@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=Source+Sans+3:wght@400;500;600;700&display=swap');

:root {
    --ink: #1c1412;
    --ink-soft: #5a3f3a;
    --muted: #8a6e68;
    --line: rgba(90, 30, 24, 0.1);
    --surface: rgba(255, 255, 255, 0.82);
    --surface-solid: #ffffff;
    --bg-1: #fbf4f2;
    --bg-2: #f7ebe7;
    --bg-3: #f3e4df;
    --primary: #b42318;
    --primary-2: #d92d20;
    --accent: #f79009;
    --success: #1f7a4c;
    --warning: #b45309;
    --danger: #912018;
    --info: #b54708;
    --sidebar: #3b0d0c;
    --sidebar-text: #f5d5d0;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(90, 20, 16, 0.1);
    --font-display: 'Sora', sans-serif;
    --font-body: 'Source Sans 3', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-body);
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at -10% -10%, rgba(180, 35, 24, 0.12), transparent 55%),
        radial-gradient(900px 500px at 110% 0%, rgba(247, 144, 9, 0.1), transparent 50%),
        linear-gradient(160deg, var(--bg-1), var(--bg-2) 45%, var(--bg-3));
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 268px;
    background:
        linear-gradient(180deg, rgba(217, 45, 32, 0.22), transparent 30%),
        linear-gradient(160deg, #2a0908 0%, var(--sidebar) 55%, #5c1510 100%);
    color: var(--sidebar-text);
    padding: 1.25rem 1rem 2rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .5rem .65rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 1rem;
}
.brand-mark {
    width: 42px; height: 42px; border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    display: grid; place-items: center;
    font-family: var(--font-display);
    font-weight: 700; color: white; letter-spacing: .5px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.brand h1 {
    margin: 0; font-family: var(--font-display); font-size: 1.15rem; color: #fff; font-weight: 700;
}
.brand p { margin: .15rem 0 0; font-size: .78rem; color: rgba(215,230,238,.7); }

.nav-section { margin-bottom: 1rem; }
.nav-label {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
    color: rgba(215,230,238,.45); padding: .4rem .75rem; margin-bottom: .2rem;
}
.nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .62rem .75rem; border-radius: 10px;
    color: rgba(215,230,238,.82); font-size: .92rem; margin-bottom: .15rem;
    transition: .18s ease;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.nav-link.active { box-shadow: inset 3px 0 0 var(--accent); }
.nav-ico {
    width: 18px; text-align: center; opacity: .85; font-size: .85rem;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1rem 1.5rem; position: sticky; top: 0; z-index: 20;
    backdrop-filter: blur(12px);
    background: rgba(238, 245, 247, 0.72);
    border-bottom: 1px solid var(--line);
}
.topbar h2 {
    margin: 0; font-family: var(--font-display); font-size: 1.25rem; font-weight: 600;
}
.topbar-actions { display: flex; align-items: center; gap: .75rem; }
.user-chip {
    display: flex; align-items: center; gap: .65rem;
    background: var(--surface); border: 1px solid var(--line);
    padding: .4rem .7rem .4rem .4rem; border-radius: 999px;
}
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff; display: grid; place-items: center;
    font-family: var(--font-display); font-weight: 600; font-size: .85rem;
}
.user-meta { line-height: 1.2; }
.user-meta strong { display: block; font-size: .85rem; }
.user-meta span { font-size: .72rem; color: var(--muted); }

.content { padding: 1.25rem 1.5rem 2.5rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem; margin-bottom: 1.25rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.15rem;
    box-shadow: var(--shadow);
    position: relative; overflow: hidden;
    animation: rise .45s ease both;
}
.stat-card::after {
    content: ''; position: absolute; inset: auto -20% -40% auto;
    width: 120px; height: 120px; border-radius: 50%;
    background: radial-gradient(circle, rgba(180,35,24,.14), transparent 70%);
}
.stat-card .label { color: var(--muted); font-size: .82rem; margin-bottom: .35rem; }
.stat-card .value {
    font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; color: var(--ink);
}
.stat-card .hint { margin-top: .35rem; font-size: .75rem; color: var(--primary-2); }

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
    animation: rise .5s ease both;
}
.panel-header {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1rem 1.15rem; border-bottom: 1px solid var(--line);
}
.panel-header h3 {
    margin: 0; font-family: var(--font-display); font-size: 1rem; font-weight: 600;
}
.panel-body { padding: 1.15rem; }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }

.table-wrap { overflow-x: auto; }
table.data {
    width: 100%; border-collapse: collapse; font-size: .92rem;
}
table.data th, table.data td {
    padding: .75rem .9rem; text-align: left; border-bottom: 1px solid var(--line);
}
table.data th {
    font-size: .75rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); font-weight: 600; background: rgba(180,35,24,.03);
}
table.data tr:hover td { background: rgba(180,35,24,.03); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    border: none; cursor: pointer; border-radius: 10px;
    padding: .55rem 1rem; font-weight: 600; font-size: .88rem;
    transition: .15s ease;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    color: #fff;
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-secondary {
    background: #fff; color: var(--ink); border: 1px solid var(--line);
}
.btn-secondary:hover { background: #f4f8fa; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; border-radius: 8px; }
.btn-block { width: 100%; }

.badge {
    display: inline-flex; align-items: center;
    padding: .2rem .55rem; border-radius: 6px;
    font-size: .72rem; font-weight: 600; text-transform: capitalize;
}
.badge-success { background: rgba(31,122,76,.12); color: var(--success); }
.badge-warning { background: rgba(180,83,9,.12); color: var(--warning); }
.badge-danger { background: rgba(180,35,24,.12); color: var(--danger); }
.badge-info { background: rgba(11,110,153,.12); color: var(--info); }
.badge-muted { background: rgba(107,124,138,.12); color: var(--muted); }

.form-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;
}
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.form-control {
    width: 100%; padding: .65rem .8rem; border-radius: 10px;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    outline: none; transition: .15s ease;
}
.form-control:focus {
    border-color: rgba(180,35,24,.45);
    box-shadow: 0 0 0 3px rgba(180,35,24,.12);
}
textarea.form-control { min-height: 90px; resize: vertical; }

.alert {
    padding: .85rem 1rem; border-radius: 10px; margin-bottom: 1rem;
    border: 1px solid transparent; font-size: .9rem;
}
.alert-success { background: rgba(31,122,76,.1); color: var(--success); border-color: rgba(31,122,76,.18); }
.alert-danger { background: rgba(180,35,24,.1); color: var(--danger); border-color: rgba(180,35,24,.18); }
.alert-warning { background: rgba(180,83,9,.1); color: var(--warning); border-color: rgba(180,83,9,.18); }
.alert-info { background: rgba(11,110,153,.1); color: var(--info); border-color: rgba(11,110,153,.18); }

.toolbar {
    display: flex; flex-wrap: wrap; gap: .75rem; align-items: center;
    justify-content: space-between; margin-bottom: 1rem;
}
.search-box { display: flex; gap: .5rem; flex: 1; min-width: 220px; max-width: 420px; }

.empty {
    text-align: center; padding: 2.5rem 1rem; color: var(--muted);
}

.login-page {
    min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
    background:
        radial-gradient(900px 500px at 10% 10%, rgba(217,45,32,.28), transparent 55%),
        radial-gradient(700px 400px at 90% 80%, rgba(247,144,9,.16), transparent 50%),
        linear-gradient(145deg, #2a0908, #7a1a14 40%, #b42318);
}
.login-card {
    width: min(440px, 100%);
    background: rgba(255,255,255,.94);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 25px 60px rgba(0,0,0,.25);
    animation: rise .55s ease both;
}
.login-brand {
    text-align: center; margin-bottom: 1.5rem;
}
.login-brand .mark {
    width: 64px; height: 64px; margin: 0 auto .9rem; border-radius: 18px;
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    color: #fff; display: grid; place-items: center;
    font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
}
.login-brand h1 {
    margin: 0; font-family: var(--font-display); font-size: 1.6rem; color: var(--ink);
}
.login-brand p { margin: .4rem 0 0; color: var(--muted); font-size: .92rem; }
.login-hint-link {
    display: block; text-align: center; margin-top: 1rem;
    font-size: .88rem; color: var(--primary); font-weight: 600; cursor: pointer;
    background: none; border: none; width: 100%;
}
.login-hint-link:hover { text-decoration: underline; }

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(28, 10, 8, .55);
    display: none; align-items: center; justify-content: center;
    padding: 1rem; z-index: 100;
}
.modal-backdrop.show { display: flex; }
.modal-card {
    width: min(460px, 100%);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,.28);
    animation: rise .3s ease both;
    max-height: 90vh; overflow: auto;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.15rem; border-bottom: 1px solid var(--line);
}
.modal-header h3 {
    margin: 0; font-family: var(--font-display); font-size: 1.05rem;
}
.modal-close {
    border: none; background: #f5ecea; width: 32px; height: 32px;
    border-radius: 8px; cursor: pointer; color: var(--ink); font-size: 1.1rem;
}
.modal-body { padding: 1rem 1.15rem 1.25rem; }
.demo-list { display: flex; flex-direction: column; gap: .55rem; }
.demo-item {
    display: flex; justify-content: space-between; gap: .75rem; align-items: center;
    padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 10px;
    background: #fbf6f5; cursor: pointer; text-align: left; width: 100%;
}
.demo-item:hover { border-color: rgba(180,35,24,.35); background: #fff5f3; }
.demo-item strong { display: block; font-size: .88rem; color: var(--ink); }
.demo-item span { font-size: .75rem; color: var(--muted); }
.demo-item code {
    font-size: .72rem; background: #fff; border: 1px solid var(--line);
    padding: .15rem .4rem; border-radius: 6px; color: var(--primary);
}
.demo-note {
    margin: 0 0 .85rem; font-size: .82rem; color: var(--muted);
}

.alert-list { display: flex; flex-direction: column; gap: .55rem; }
.alert-item {
    display: flex; gap: .65rem; align-items: flex-start;
    padding: .7rem .8rem; border-radius: 10px; background: rgba(255,255,255,.65);
    border: 1px solid var(--line); font-size: .88rem;
}
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: .35rem; flex-shrink: 0; }
.dot.warning { background: var(--warning); }
.dot.danger { background: var(--danger); }
.dot.info { background: var(--info); }

.channel-bar {
    display: flex; flex-direction: column; gap: .65rem;
}
.channel-row { display: grid; grid-template-columns: 110px 1fr 80px; gap: .6rem; align-items: center; font-size: .85rem; }
.bar-track { height: 8px; background: rgba(180,35,24,.08); border-radius: 99px; overflow: hidden; }
.bar-fill {
    height: 100%; border-radius: 99px;
    background: linear-gradient(90deg, var(--primary-2), var(--primary));
    animation: grow 1s ease both;
}

.pagination { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: 1rem; }
.pagination a, .pagination span {
    padding: .4rem .7rem; border-radius: 8px; border: 1px solid var(--line);
    background: #fff; font-size: .85rem;
}
.pagination .active span { background: var(--primary); color: #fff; border-color: var(--primary); }

.mobile-toggle {
    display: none; border: 1px solid var(--line); background: #fff;
    border-radius: 10px; padding: .45rem .7rem; cursor: pointer;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}
@keyframes grow {
    from { width: 0 !important; }
}

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .sidebar {
        position: fixed; left: -280px; z-index: 50; transition: .25s ease;
    }
    .sidebar.open { left: 0; }
    .mobile-toggle { display: inline-flex; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .content, .topbar { padding-left: 1rem; padding-right: 1rem; }
    .overlay {
        display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40;
    }
    .overlay.show { display: block; }
}
