/* ========================================
   TrafficCatch Design System
   Clean, Professional, Modern SaaS Dashboard
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ----------------------------------------
   CSS Variables (Light Mode Default)
   ---------------------------------------- */
:root {
    /* Page & Surface */
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-input: #f1f5f9;
    --bg-hover: #f1f5f9;
    --bg-table-header: #f8fafc;
    --bg-table-row-alt: #fafbfc;

    /* Borders */
    --border: #e5e7eb;
    --border-hover: #d1d5db;
    --border-focus: #2563eb;

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* Primary */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-lighter: #eff6ff;

    /* Status Colors */
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ----------------------------------------
   Dark Mode
   ---------------------------------------- */
[data-theme="dark"] {
    --bg-page: #111827;
    --bg-card: #1e2433;
    --bg-sidebar: #1a1d2e;
    --bg-input: #252a3a;
    --bg-hover: #252a3a;
    --bg-table-header: #252a3a;
    --bg-table-row-alt: #1a1f2e;

    --border: #2d3348;
    --border-hover: #3d4460;
    --border-focus: #3b82f6;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #1e3a5f;
    --primary-lighter: #172554;

    --success: #10b981;
    --success-light: #064e3b;
    --warning: #f59e0b;
    --warning-light: #78350f;
    --danger: #f43f5e;
    --danger-light: #7f1d1d;
    --info: #06b6d4;
    --info-light: #164e63;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.4);
}

/* ----------------------------------------
   Reset & Base
   ---------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-page);
}

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

a:hover {
    color: var(--primary-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* ----------------------------------------
   Typography
   ---------------------------------------- */
.font-mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

h1, .h1 { font-size: 28px; font-weight: 700; line-height: 1.3; }
h2, .h2 { font-size: 24px; font-weight: 700; line-height: 1.3; }
h3, .h3 { font-size: 20px; font-weight: 600; line-height: 1.4; }
h4, .h4 { font-size: 16px; font-weight: 600; line-height: 1.4; }
h5, .h5 { font-size: 14px; font-weight: 600; line-height: 1.5; }
h6, .h6 { font-size: 12px; font-weight: 600; line-height: 1.5; text-transform: uppercase; letter-spacing: 0.05em; }

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }
.text-blue { color: var(--primary) !important; }

.kpi-number {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* ----------------------------------------
   Layout: Dashboard Shell
   ---------------------------------------- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width var(--transition-slow);
    overflow-y: auto;
    overflow-x: hidden;
}

.app-sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.app-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-slow);
}

.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-collapsed);
}

.app-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.app-content {
    flex: 1;
    padding: 24px;
}

/* ----------------------------------------
   Sidebar Components
   ---------------------------------------- */
.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px 16px;
    gap: 10px;
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    white-space: nowrap;
}

.sidebar-logo .collapse-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.sidebar-logo .collapse-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.sidebar-search {
    padding: 0 16px 12px;
}

.sidebar-search input {
    width: 100%;
    height: 38px;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 0 12px 0 36px;
    font-size: 13px;
    color: var(--text-primary);
    transition: all var(--transition);
    font-family: inherit;
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sidebar-search .search-wrapper {
    position: relative;
}

.sidebar-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.sidebar-nav {
    flex: 1;
    padding: 4px 12px;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 12px 8px 6px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.sidebar-nav-item.active:hover {
    background: var(--primary-hover);
    color: white;
}

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

.sidebar-nav-item .nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    background: var(--danger);
    color: white;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.sidebar-nav-item .nav-chevron {
    margin-left: auto;
    font-size: 12px;
    transition: transform var(--transition);
    color: var(--text-muted);
}

.sidebar-nav-item.expanded .nav-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    padding-left: 20px;
    overflow: hidden;
    max-height: 0;
    transition: max-height var(--transition-slow);
}

.sidebar-submenu.open {
    max-height: 200px;
}

.sidebar-submenu .sidebar-nav-item {
    font-size: 13px;
    padding: 7px 12px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.theme-toggle {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    padding: 3px;
    margin-bottom: 12px;
}

.theme-toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.theme-toggle-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition);
}

.sidebar-user:hover {
    background: var(--bg-hover);
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-user .user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.sidebar-user .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-email {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-menu-btn {
    color: var(--text-muted);
    font-size: 16px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

/* ----------------------------------------
   Header Components
   ---------------------------------------- */
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left .page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.header-breadcrumb a {
    color: var(--text-secondary);
}

.header-breadcrumb .sep {
    font-size: 11px;
}

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

.header-date-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.header-date-picker:hover {
    border-color: var(--border-hover);
}

.header-icon-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    font-size: 16px;
}

.header-icon-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.header-icon-btn .notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.header-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    overflow: hidden;
    border: 2px solid var(--border);
    transition: border-color var(--transition);
}

.header-avatar:hover {
    border-color: var(--primary);
}

/* ----------------------------------------
   Cards
   ---------------------------------------- */
.tc-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: box-shadow var(--transition);
}

.tc-card:hover {
    box-shadow: var(--shadow-md);
}

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

.tc-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* KPI Stat Cards */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all var(--transition);
    cursor: pointer;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.stat-card .stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-card .stat-change {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
}

.stat-card .stat-change.positive {
    color: var(--success);
}

.stat-card .stat-change.negative {
    color: var(--danger);
}

/* ----------------------------------------
   Buttons
   ---------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

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

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

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

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
}

.btn-full {
    width: 100%;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ----------------------------------------
   Form Elements
   ---------------------------------------- */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    height: 42px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 14px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    transition: all var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

textarea.form-control {
    height: auto;
    min-height: 100px;
    padding: 12px 14px;
    resize: vertical;
}

select.form-control {
    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='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.input-with-icon {
    position: relative;
}

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

.input-with-icon .form-control {
    padding-left: 40px;
}

.input-with-icon .input-action {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    transition: color var(--transition);
}

.input-with-icon .input-action:hover {
    color: var(--text-primary);
}

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

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

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

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

.form-check label {
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Password Strength Meter */
.password-strength {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.password-strength .strength-bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    transition: background var(--transition);
}

.password-strength.weak .strength-bar:nth-child(1) { background: var(--danger); }
.password-strength.fair .strength-bar:nth-child(-n+2) { background: var(--warning); }
.password-strength.good .strength-bar:nth-child(-n+3) { background: var(--info); }
.password-strength.strong .strength-bar { background: var(--success); }

.strength-label {
    font-size: 12px;
    margin-top: 4px;
}

/* ----------------------------------------
   Badges & Pills
   ---------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-gray { background: var(--bg-input); color: var(--text-secondary); }

/* ----------------------------------------
   Tables
   ---------------------------------------- */
.tc-table-wrapper {
    overflow-x: auto;
}

.tc-table {
    width: 100%;
    border-collapse: collapse;
}

.tc-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg-table-header);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.tc-table td {
    padding: 12px 16px;
    font-size: 13.5px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.tc-table tbody tr {
    transition: background var(--transition);
}

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

.tc-table .tcid-link {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
}

.tc-table .tcid-link:hover {
    text-decoration: underline;
}

/* ----------------------------------------
   Filter Bar
   ---------------------------------------- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-pills {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 3px;
}

.filter-pill {
    padding: 6px 14px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-pill.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.filter-pill:hover:not(.active) {
    color: var(--text-primary);
}

/* ----------------------------------------
   Tabs
   ---------------------------------------- */
.tc-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    gap: 0;
    margin-bottom: 24px;
}

.tc-tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    margin-bottom: -1px;
}

.tc-tab:hover {
    color: var(--text-primary);
}

.tc-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ----------------------------------------
   Auth Pages (Login/Register)
   ---------------------------------------- */
.auth-page {
    min-height: 100vh;
    display: flex;
}

.auth-branding {
    width: 50%;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.auth-branding::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 2px 2px, rgba(255,255,255,0.07) 1px, transparent 0);
    background-size: 32px 32px;
}

.auth-branding .brand-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.auth-branding .brand-logo-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    backdrop-filter: blur(8px);
}

.auth-branding .brand-logo-text {
    font-size: 28px;
    font-weight: 700;
    color: white;
}

.auth-branding .brand-tagline {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    max-width: 360px;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.auth-branding .brand-features {
    display: flex;
    gap: 32px;
    margin-top: 48px;
    position: relative;
    z-index: 1;
}

.auth-branding .brand-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 500;
}

.auth-branding .brand-feature-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    backdrop-filter: blur(8px);
}

.auth-form-side {
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: var(--bg-card);
}

.auth-form-container {
    width: 100%;
    max-width: 420px;
}

.auth-form-container .auth-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-form-container .auth-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-footer-text {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 24px;
}

.auth-footer-text a {
    color: var(--primary);
    font-weight: 500;
}

.auth-form .form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.auth-form .forgot-link {
    font-size: 13px;
    color: var(--primary);
    font-weight: 500;
}

.alert-error {
    padding: 12px 16px;
    background: var(--danger-light);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Google OAuth button */
.btn-google {
    width: 100%;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all var(--transition);
}

.btn-google:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

/* ----------------------------------------
   Toast Notifications
   ---------------------------------------- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 320px;
    max-width: 420px;
    animation: slideInRight 0.3s ease;
    font-size: 13.5px;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ----------------------------------------
   Modals
   ---------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: fadeIn 0.2s ease;
    padding: 20px;
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    animation: scaleIn 0.2s ease;
}

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

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

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

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ----------------------------------------
   Empty States
   ---------------------------------------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state .empty-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 20px;
}

.empty-state .empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state .empty-text {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 360px;
    margin-bottom: 24px;
}

/* ----------------------------------------
   Utility Classes
   ---------------------------------------- */
.d-flex { display: flex; }
.d-grid { display: grid; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ----------------------------------------
   Responsive
   ---------------------------------------- */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .auth-branding { display: none; }
    .auth-form-side { width: 100%; }
}

@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
    }

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

    .app-main {
        margin-left: 0;
    }

    .app-content {
        padding: 16px;
    }

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

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

    .auth-form-side {
        padding: 24px;
    }
}

/* ----------------------------------------
   Scrollbar Styling
   ---------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

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

/* ----------------------------------------
   Progress Bars
   ---------------------------------------- */
.progress-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-bar .fill-primary { background: var(--primary); }
.progress-bar .fill-success { background: var(--success); }
.progress-bar .fill-warning { background: var(--warning); }
.progress-bar .fill-danger { background: var(--danger); }

/* ----------------------------------------
   Pagination
   ---------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    margin-top: 16px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.pagination-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
