:root {
    --brand: #6366f1;
    --brand-dark: #818cf8;
    --bg: #0f1117;
    --card-bg: #1a1d27;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #2d3140;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #22d3ee;
    --secondary: #6b7280;
    --primary: #6366f1;
    --dark: #05060a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top bar ---------- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-brand a { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user { color: var(--muted); font-size: 0.9rem; }
.btn-logout {
    background: var(--dark); color: #fff; padding: 6px 14px; border-radius: 6px; font-size: 0.85rem;
}
.btn-logout:hover { text-decoration: none; opacity: .9; }

/* ---------- Notification bell ---------- */
.notif-wrapper { position: relative; }
.notif-bell { background: none; border: none; font-size: 1.2rem; cursor: pointer; position: relative; }
.notif-count {
    background: var(--danger); color: #fff; font-size: 0.65rem; border-radius: 50%;
    padding: 1px 5px; position: relative; top: -8px; left: -4px;
}
.notif-dropdown {
    position: absolute; right: 0; top: 32px; width: 320px; max-height: 400px; overflow-y: auto;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.notif-dropdown-header { padding: 10px 14px; font-weight: 600; border-bottom: 1px solid var(--border); }
.notif-list .notif-item { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 0.85rem; cursor: pointer; }
.notif-list .notif-item.unread { background: #262a3a; font-weight: 600; }
.notif-list .notif-empty { padding: 14px; color: var(--muted); font-size: 0.85rem; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: calc(100vh - 54px); }
.sidebar { width: 220px; background: var(--card-bg); border-right: 1px solid var(--border); padding: 20px 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { display: block; padding: 10px 24px; color: var(--text); font-size: 0.92rem; }
.sidebar li.active a, .sidebar li a:hover { background: #22263a; color: var(--brand-dark); text-decoration: none; }
.content { flex: 1; padding: 28px 32px; }

/* ---------- Cards / panels ---------- */
.panel { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 24px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 18px; text-align: center; }
.stat-num { display: block; font-size: 1.7rem; font-weight: 700; color: var(--brand); }
.stat-label { font-size: 0.8rem; color: var(--muted); }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
.kv-table th { text-align: left; color: var(--muted); padding: 6px 10px 6px 0; width: 160px; vertical-align: top; }
.kv-table td { padding: 6px 0; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; color: #fff; }
.badge-success { background: var(--success); }
.badge-danger { background: var(--danger); }
.badge-warning { background: var(--warning); }
.badge-info { background: var(--info); }
.badge-secondary { background: var(--secondary); }
.badge-primary { background: var(--primary); }
.badge-dark { background: var(--dark); }

/* ---------- Buttons ---------- */
.btn-primary, .btn-secondary, .btn-danger {
    display: inline-block; border: none; border-radius: 6px; padding: 9px 16px; font-size: 0.88rem;
    cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #2d3140; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-link { background: none; border: none; color: var(--brand); cursor: pointer; text-decoration: underline; padding: 0; font-size: inherit; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid label { display: flex; flex-direction: column; font-size: 0.85rem; font-weight: 600; gap: 6px; color: var(--text); }
.form-grid .full-width { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea {
    font-weight: 400; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem;
    background: #12141c; color: var(--text);
}
.form-grid fieldset { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; border: 1px dashed var(--border); border-radius: 8px; padding: 14px; }
.form-grid button { grid-column: 1 / -1; justify-self: start; }

.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; }
.filter-bar select { padding: 8px; border-radius: 6px; border: 1px solid var(--border); background: #12141c; color: var(--text); }

/* ---------- Alerts ---------- */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 0.88rem; }
.alert-success { background: #14311f; color: #4ade80; }
.alert-danger { background: #3a1414; color: #fca5a5; }
.alert-warning { background: #3a2c0e; color: #fcd34d; }

/* ---------- Progress ---------- */
.progress-bar { background: #2d3140; border-radius: 999px; height: 10px; overflow: hidden; margin-top: 8px; }
.progress-fill { background: var(--brand); height: 100%; }

/* ---------- Auth page ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e1b4b, #0f1117); }
.auth-card { background: var(--card-bg); padding: 36px; border-radius: 14px; width: 360px; box-shadow: 0 20px 50px rgba(0,0,0,.5); border: 1px solid var(--border); }
.auth-card h1 { margin: 0 0 4px; font-size: 1.4rem; color: var(--text); }
.auth-card .muted { color: var(--muted); margin-bottom: 20px; font-size: 0.9rem; }
.auth-card label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; margin-top: 14px; color: var(--text); }
.auth-card input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; background: #12141c; color: var(--text); }
.auth-card button { width: 100%; margin-top: 22px; padding: 11px; }

.muted { color: var(--muted); }

/* ---------- Video view / approval ---------- */
.thumb-preview { max-width: 320px; border-radius: 8px; margin: 10px 0; display: block; }
.approval-actions { margin-top: 16px; display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.revision-form { width: 100%; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.revision-form textarea { padding: 10px; border-radius: 6px; border: 1px solid var(--border); }

/* ---------- Notifications page ---------- */
.notif-full-list { list-style: none; margin: 0; padding: 0; }
.notif-full-list li { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.notif-full-list li.unread { font-weight: 600; }
.notif-date { color: var(--muted); font-size: 0.8rem; white-space: nowrap; margin-left: 12px; }

/* ---------- Calendar ---------- */
.calendar-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.cal-label { font-weight: 600; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-day-header { font-size: 0.75rem; font-weight: 700; color: var(--muted); text-align: center; padding: 4px; }
.cal-cell { background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; min-height: 90px; padding: 6px; font-size: 0.75rem; }
.cal-cell .cal-date { font-weight: 600; margin-bottom: 4px; }
.cal-cell.other-month { background: #14161f; color: #4b5162; }
.cal-event { display: block; border-radius: 4px; padding: 2px 5px; margin-bottom: 3px; color: #fff; font-size: 0.7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-legend { margin-top: 14px; font-size: 0.8rem; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 10px; }

@media (max-width: 800px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; }
    .form-grid, .two-col, .stat-grid { grid-template-columns: 1fr; }
}
