/* ============================================================
   TGKP Admin Panel — Design System
   Based on SaaS Support Chat (Intercom-inspired)
   CSS variables, Inter font, dark sidebar
   ============================================================ */

:root {
    /* Layout */
    --sidebar-w: 56px;
    --sidebar-w-open: 220px;

    /* Sidebar */
    --sidebar-bg: #0f1117;
    --sidebar-border: #1e2130;
    --sidebar-text: #8b92a5;
    --sidebar-hover: #1a1d2e;
    --sidebar-active: #2563eb;
    --sidebar-active-bg: #1e2a4a;

    /* Surfaces */
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e5e7eb;
    --border-2: #d1d5db;

    /* Text */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    /* Brand */
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --primary-hover: #1d4ed8;
    --primary-dark: #1e40af;

    /* Semantic */
    --green: #10b981;
    --green-light: #ecfdf5;
    --red: #ef4444;
    --red-light: #fef2f2;
    --yellow: #f59e0b;
    --yellow-light: #fffbeb;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    --orange: #f97316;
    --orange-light: #fff7ed;

    /* Components */
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.10);
    --transition: 0.2s ease;
    --transition-slow: 0.35s cubic-bezier(.4,0,.2,1);
}

/* ============================================================
   RESET & BASE
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
    margin: 0 0 8px;
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

p { margin: 0 0 12px; }

/* ============================================================
   LAYOUT: sidebar + main
   ============================================================ */

.layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-slow), min-width var(--transition-slow);
    overflow: hidden;
    z-index: 100;
}

.sidebar.open {
    width: var(--sidebar-w-open);
    min-width: var(--sidebar-w-open);
}

/* Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 14px;
    height: 56px;
    flex-shrink: 0;
}

.logo-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--transition-slow);
}

.sidebar.open .logo-text {
    opacity: 1;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 8px 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(139,146,165,.5);
    padding: 12px 8px 6px;
    white-space: nowrap;
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: opacity var(--transition-slow);
}

.sidebar.open .nav-section-label {
    opacity: 1;
    height: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    position: relative;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.nav-label {
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: opacity var(--transition-slow);
}

.sidebar.open .nav-label {
    opacity: 1;
}

/* Badge on nav item */
.nav-badge {
    position: absolute;
    top: 4px;
    left: 26px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sidebar.open .nav-badge {
    position: static;
    margin-left: auto;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 8px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: var(--sidebar-text);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-family: inherit;
    font-size: 13px;
}

.sidebar-toggle:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.toggle-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: transform var(--transition-slow);
}

.sidebar.open .toggle-icon {
    transform: rotate(180deg);
}

.toggle-label {
    opacity: 0;
    white-space: nowrap;
    transition: opacity var(--transition-slow);
}

.sidebar.open .toggle-label {
    opacity: 1;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* Topbar */
.topbar {
    height: 52px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

.topbar-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all var(--transition);
}

.topbar-btn:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

/* User avatar */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    flex-shrink: 0;
}

.user-avatar:hover {
    text-decoration: none;
    opacity: 0.9;
}

/* Content area */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-danger {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}
.btn-danger:hover { background: #dc2626; }

.btn-success {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}
.btn-success:hover { background: #059669; }

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 10px 20px;
    font-size: 14px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* ============================================================
   STAT CARDS (Dashboard)
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--green-light); color: var(--green); }
.stat-icon.yellow { background: var(--yellow-light); color: var(--yellow); }
.stat-icon.red    { background: var(--red-light); color: var(--red); }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-icon.orange { background: var(--orange-light); color: var(--orange); }

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}

.badge-green  { background: var(--green-light); color: var(--green); }
.badge-red    { background: var(--red-light); color: var(--red); }
.badge-yellow { background: var(--yellow-light); color: var(--yellow); }
.badge-blue   { background: var(--primary-light); color: var(--primary); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-orange { background: var(--orange-light); color: var(--orange); }

/* ============================================================
   TABLES
   ============================================================ */

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--surface-2);
}

table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

table tr:last-child td {
    border-bottom: none;
}

table tr:hover td {
    background: var(--surface-2);
}

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

table .text-right {
    text-align: right;
}

table .text-center {
    text-align: center;
}

table .mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
}

/* ============================================================
   FORMS
   ============================================================ */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--surface);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-select {
    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 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: var(--red);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

/* Checkbox & toggle */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Toggle switch */
.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-2);
    border-radius: 11px;
    cursor: pointer;
    transition: background var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* ============================================================
   SEARCH BAR
   ============================================================ */

.search-bar {
    position: relative;
    margin-bottom: 16px;
}

.search-bar .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

.search-bar input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--surface);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

/* ============================================================
   TOOLBAR (above tables)
   ============================================================ */

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================
   CHANNEL CARDS (Communications)
   ============================================================ */

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.channel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.channel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.channel-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.channel-icon.telegram { background: #e3f2fd; color: #0088cc; }
.channel-icon.sms      { background: var(--green-light); color: var(--green); }
.channel-icon.email    { background: var(--yellow-light); color: var(--yellow); }
.channel-icon.aws      { background: var(--orange-light); color: var(--orange); }

.channel-name {
    font-size: 14px;
    font-weight: 600;
}

.channel-status {
    font-size: 11px;
    margin-top: 2px;
}

.channel-body {
    padding: 20px;
}

.channel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 24px 20px;
}

/* ============================================================
   SLIDE PANEL (right side, 80% width)
   ============================================================ */

.slide-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 500;
}

.slide-overlay.active {
    display: block;
}

.slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 80%;
    max-width: 900px;
    background: var(--bg);
    z-index: 501;
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,.12);
}

.slide-overlay.active .slide-panel {
    transform: translateX(0);
}

.slide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.slide-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.slide-close {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all var(--transition);
}

.slide-close:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.slide-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.slide-section {
    margin-bottom: 24px;
}

.slide-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 768px) {
    .slide-panel {
        width: 100%;
        max-width: none;
    }
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: var(--shadow-md);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toastIn 0.3s ease;
    pointer-events: auto;
    max-width: 360px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--yellow); }
.toast.info    { border-left: 3px solid var(--primary); }

.toast i {
    font-size: 16px;
    flex-shrink: 0;
}

.toast.success i { color: var(--green); }
.toast.error i   { color: var(--red); }
.toast.warning i { color: var(--yellow); }
.toast.info i    { color: var(--primary); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); }
}

/* ============================================================
   PERMISSIONS GRID
   ============================================================ */

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 13px;
}

.permission-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.permission-item.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 15px;
    margin: 0;
}

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
}

.pagination a {
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.pagination a:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.pagination .active {
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

.text-muted   { color: var(--text-muted); }
.text-success { color: var(--green); }
.text-danger  { color: var(--red); }
.text-warning { color: var(--yellow); }
.text-primary { color: var(--primary); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-sm      { font-size: 12px; }
.text-xs      { font-size: 11px; }

.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.d-flex   { display: flex; }
.gap-8    { gap: 8px; }
.gap-16   { gap: 16px; }
.flex-1   { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.hidden { display: none !important; }

/* ============================================================
   TABS
   ============================================================ */

.tabs {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 4px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    white-space: nowrap;
    transition: all var(--transition);
    text-decoration: none;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--surface-2);
    text-decoration: none;
}

.tab.active {
    color: #fff;
    background: var(--primary);
    box-shadow: var(--shadow);
}

.tab i {
    font-size: 15px;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: 3px;
}

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

/* ============================================================
   AUTH PAGE (Login)
   ============================================================ */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 40px;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}

.auth-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.auth-logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.auth-subtitle {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 14px;
}

.auth-error {
    background: var(--red-light);
    color: var(--red);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background var(--transition);
    margin-top: 8px;
}

.auth-btn:hover { background: var(--primary-hover); }
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform var(--transition-slow);
        width: var(--sidebar-w-open) !important;
        min-width: var(--sidebar-w-open) !important;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar.open .nav-label,
    .sidebar.open .logo-text,
    .sidebar.open .toggle-label,
    .sidebar.open .nav-section-label {
        opacity: 1;
    }

    .content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .channels-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 24px;
        margin: 16px;
    }
}
