/* ============================================
   Ez Rundown — Design System
   Blue SaaS Theme — Custom CSS
   ============================================ */

/* --- CSS Variables --- */
:root {
    /* Primary Blue Palette */
    --primary-50: #eef4ff;
    --primary-100: #d9e6ff;
    --primary-200: #bcd4fe;
    --primary-300: #8ebbfd;
    --primary-400: #5996fa;
    --primary-500: #3370f6;
    --primary-600: #1d51eb;
    --primary-700: #153dd8;
    --primary-800: #1733af;
    --primary-900: #192f8a;

    /* Gray Palette */
    --gray-50: #f8f9fb;
    --gray-100: #f1f3f6;
    --gray-200: #e2e6ec;
    --gray-300: #cdd3dc;
    --gray-400: #9aa3b2;
    --gray-500: #6b7685;
    --gray-600: #505a68;
    --gray-700: #3d4654;
    --gray-800: #2a3140;
    --gray-900: #1a1f2b;

    /* Semantic Colors */
    --success: #0fa958;
    --success-light: #e6f7ee;
    --danger: #e53e3e;
    --danger-light: #fee2e2;
    --warning: #dd8c09;
    --warning-light: #fef6e0;
    --info: #3370f6;
    --info-light: #eef4ff;

    /* Spacing */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;
    --sp-16: 64px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);

    /* Layout */
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 64px;
    --topbar-height: 56px;
    --bottom-nav-height: 64px;
}

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

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

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-50);
}

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

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

h1, h2, h3, h4, h5 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-900);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.5;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

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

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

.btn-secondary {
    background: #fff;
    color: var(--gray-700);
    border-color: var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-400); color: var(--gray-700); }

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

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

.btn-sm {
    padding: var(--sp-1) var(--sp-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--sp-3) var(--sp-6);
    font-size: var(--text-base);
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: var(--sp-4);
}

.form-label {
    display: block;
    margin-bottom: var(--sp-1);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--gray-700);
}

.form-input,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    padding: var(--sp-2) var(--sp-3);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--gray-800);
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(51, 112, 246, 0.15);
}

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

.form-error {
    margin-top: var(--sp-1);
    font-size: var(--text-xs);
    color: var(--danger);
}

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

/* --- Cards --- */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    font-size: var(--text-base);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: var(--sp-5);
}

.card-footer {
    padding: var(--sp-4) var(--sp-5);
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* --- Stat Card --- */
.stat-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--sp-5);
    box-shadow: var(--shadow-sm);
}

.stat-card-label {
    font-size: var(--text-sm);
    color: var(--gray-500);
    font-weight: 500;
    margin-bottom: var(--sp-1);
}

.stat-card-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-card-sub {
    font-size: var(--text-xs);
    color: var(--gray-400);
    margin-top: var(--sp-1);
}

.stat-card.accent {
    border-left: 4px solid var(--primary-500);
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    text-align: left;
    padding: var(--sp-3) var(--sp-4);
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

.table td {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table td.num {
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--sp-2);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.5;
}

.badge-primary { background: var(--primary-100); color: var(--primary-700); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* --- Alerts --- */
.alert {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    margin-bottom: var(--sp-4);
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-light);
    color: #065f30;
    border-color: #b7ebd0;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
    border-color: #fca5a5;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border-color: #fcd34d;
}

.alert-info {
    background: var(--info-light);
    color: var(--primary-800);
    border-color: var(--primary-200);
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--gray-900);
    color: var(--gray-300);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.2s ease;
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-4);
    border-bottom: 1px solid var(--gray-700);
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: var(--text-lg);
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand-text span {
    color: var(--primary-400);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: var(--sp-2);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar-nav {
    padding: var(--sp-3) 0;
    flex: 1;
}

.sidebar-section {
    padding: var(--sp-2) var(--sp-5);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-500);
    margin-top: var(--sp-4);
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: color 0.12s ease;
}

.sidebar-section:hover {
    color: var(--gray-400);
}

.sidebar-chevron {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.6;
}

.sidebar-section.collapsed .sidebar-chevron {
    transform: rotate(-90deg);
}

.sidebar-group {
    overflow: hidden;
}

.sidebar-group.collapsed {
    display: none;
}

.layout-admin.collapsed .sidebar-group {
    display: block !important;
}

.layout-admin.collapsed .sidebar-section {
    pointer-events: none;
    cursor: default;
    justify-content: center;
}

.layout-admin.collapsed .sidebar-chevron {
    display: none;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-5);
    color: var(--gray-400);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.12s ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
}

.sidebar-link.active {
    color: #fff;
    background: rgba(51, 112, 246, 0.15);
    border-left-color: var(--primary-500);
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active svg {
    opacity: 1;
}

.sidebar-link-text {
    overflow: hidden;
    white-space: nowrap;
}

/* --- Topbar --- */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-6);
    z-index: 90;
    transition: left 0.2s ease;
}

.topbar-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-900);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--text-sm);
    color: var(--gray-600);
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--primary-100);
    color: var(--primary-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

/* --- Layout: Admin --- */
.layout-admin .main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: var(--sp-6);
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left 0.2s ease;
}

/* Admin: Collapsed Sidebar */
.layout-admin.collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.layout-admin.collapsed .topbar {
    left: var(--sidebar-collapsed-width);
}

.layout-admin.collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.layout-admin.collapsed .sidebar-brand {
    justify-content: center;
    padding: 0 var(--sp-2);
}

.layout-admin.collapsed .sidebar-brand-text {
    display: none;
}

.layout-admin.collapsed .sidebar-section {
    display: none;
}

.layout-admin.collapsed .sidebar-link-text {
    display: none;
}

.layout-admin.collapsed .sidebar-link {
    justify-content: center;
    padding: var(--sp-3) 0;
    border-left: 3px solid transparent;
}

.layout-admin.collapsed .sidebar-link.active {
    border-left-color: var(--primary-500);
}

.layout-admin.collapsed .sidebar-nav {
    padding: var(--sp-3) var(--sp-2);
}

.layout-admin.collapsed .sidebar-link svg {
    width: 20px;
    height: 20px;
}

/* --- Layout: Auth --- */
.layout-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--gray-100) 100%);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    margin: var(--sp-4);
}

.auth-card .card-body {
    padding: var(--sp-8);
}

.auth-brand {
    text-align: center;
    margin-bottom: var(--sp-6);
}

.auth-brand h1 {
    font-size: var(--text-2xl);
    letter-spacing: -0.02em;
}

.auth-brand h1 span {
    color: var(--primary-600);
}

.auth-brand p {
    color: var(--gray-500);
    font-size: var(--text-sm);
    margin-top: var(--sp-1);
}

.auth-footer {
    text-align: center;
    margin-top: var(--sp-4);
    font-size: var(--text-sm);
    color: var(--gray-500);
}

/* --- Layout: User (Mobile App Style) --- */
.layout-user {
    min-height: 100vh;
}

.user-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 var(--sp-5);
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-topbar-brand {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.user-topbar-brand span {
    color: var(--primary-600);
}

.user-main {
    padding: var(--sp-5);
    padding-top: calc(var(--topbar-height) + var(--sp-5));
    padding-bottom: calc(var(--bottom-nav-height) + var(--sp-5));
    max-width: 640px;
    margin: 0 auto;
}

/* --- Bottom Navigation Bar --- */
.user-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: #fff;
    border-top: 1px solid var(--gray-200);
    display: flex;
    align-items: stretch;
    z-index: 90;
}

.user-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    position: relative;
    transition: color 0.12s ease;
}

.user-bottom-nav-item:hover {
    color: var(--primary-600);
    text-decoration: none;
}

.user-bottom-nav-item.active {
    color: var(--primary-600);
}

.user-bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--primary-600);
}

.user-bottom-nav-item svg {
    width: 22px;
    height: 22px;
}

/* --- Page Header --- */
.page-header {
    margin-bottom: var(--sp-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--sp-3);
}

.page-header h1 {
    font-size: var(--text-2xl);
}

/* --- Grid helpers --- */
.grid {
    display: grid;
    gap: var(--sp-5);
}

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

/* --- Credit Display --- */
.credit-display {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
    color: #fff;
    border-radius: var(--radius-lg);
    padding: var(--sp-8);
    box-shadow: var(--shadow-lg);
}

.credit-display-label {
    font-size: var(--text-sm);
    opacity: 0.8;
    font-weight: 500;
}

.credit-display-value {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    margin: var(--sp-2) 0;
}

.credit-display-sub {
    font-size: var(--text-sm);
    opacity: 0.7;
}

/* --- Amount indicators --- */
.amount-positive {
    color: var(--success);
    font-weight: 600;
}

.amount-negative {
    color: var(--danger);
    font-weight: 600;
}

/* --- Pagination --- */
.pagination-wrapper {
    margin-top: var(--sp-4);
    display: flex;
    justify-content: center;
}

.pagination-wrapper nav span {
    display: flex;
    gap: var(--sp-1);
}

.pagination-wrapper a,
.pagination-wrapper span > span {
    padding: var(--sp-1) var(--sp-3);
    font-size: var(--text-sm);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    color: var(--gray-600);
    text-decoration: none;
}

.pagination-wrapper a:hover {
    background: var(--gray-50);
    text-decoration: none;
}

/* --- Search Bar --- */
.search-bar {
    display: flex;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

.search-bar .form-input {
    flex: 1;
}

/* --- Utilities --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-muted { color: var(--gray-500); }
.font-mono { font-family: var(--font-mono); }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.w-full { width: 100%; }

/* --- Dark Mode --- */
html.dark {
    color-scheme: dark;
}

html.dark body {
    background-color: #0f1117;
    color: #cbd5e1;
}

html.dark h1,
html.dark h2,
html.dark h3,
html.dark h4,
html.dark h5 {
    color: #f1f5f9;
}

html.dark a {
    color: #5996fa;
}

html.dark a:hover {
    color: #8ebbfd;
}

html.dark .card,
html.dark .stat-card {
    background: #1e2535;
    border-color: #2d3748;
}

html.dark .card-header {
    border-color: #2d3748;
    color: #f1f5f9;
}

html.dark .card-footer {
    background: #171e2e;
    border-color: #2d3748;
}

html.dark .user-topbar {
    background: #1a2035;
    border-color: #2d3748;
}

html.dark .user-topbar-brand {
    color: #f1f5f9;
}

html.dark .user-bottom-nav {
    background: #1a2035;
    border-color: #2d3748;
}

html.dark .user-bottom-nav-item {
    color: #4a5568;
}

html.dark .user-bottom-nav-item:hover,
html.dark .user-bottom-nav-item.active {
    color: #5996fa;
}

html.dark .user-bottom-nav-item.active::before {
    background: #5996fa;
}

html.dark .topbar {
    background: #1a2035;
    border-color: #2d3748;
}

html.dark .topbar-title {
    color: #f1f5f9;
}

html.dark .topbar-avatar {
    background: #192f8a;
    color: #8ebbfd;
}

html.dark .form-input,
html.dark .form-select,
html.dark .form-textarea {
    background: #1e2535;
    border-color: #3d4f6b;
    color: #e2e8f0;
}

html.dark .form-input:focus,
html.dark .form-select:focus,
html.dark .form-textarea:focus {
    border-color: #3370f6;
    box-shadow: 0 0 0 3px rgba(51, 112, 246, 0.2);
}

html.dark .form-label {
    color: #94a3b8;
}

html.dark .form-input.is-invalid {
    border-color: var(--danger);
}

html.dark .table th {
    background: #171e2e;
    color: #64748b;
    border-color: #2d3748;
}

html.dark .table td {
    border-color: #1e2535;
    color: #cbd5e1;
}

html.dark .table tbody tr:hover {
    background: #1e2535;
}

html.dark .btn-secondary {
    background: #1e2535;
    border-color: #3d4f6b;
    color: #94a3b8;
}

html.dark .btn-secondary:hover {
    background: #263045;
    border-color: #4a6080;
    color: #cbd5e1;
}

html.dark .stat-card-label {
    color: #64748b;
}

html.dark .stat-card-value {
    color: #f1f5f9;
}

html.dark .text-muted {
    color: #64748b;
}

html.dark .badge-gray {
    background: #2d3748;
    color: #94a3b8;
}

html.dark .badge-info {
    background: #0f1830;
    color: #5996fa;
}

html.dark .badge-primary {
    background: #192f8a;
    color: #8ebbfd;
}

html.dark .pagination-wrapper a,
html.dark .pagination-wrapper span > span {
    background: #1e2535;
    border-color: #2d3748;
    color: #94a3b8;
}

html.dark .pagination-wrapper a:hover {
    background: #263045;
}

html.dark .layout-auth {
    background: linear-gradient(135deg, #0a1020 0%, #0f1117 100%);
}

html.dark .auth-brand p {
    color: #64748b;
}

html.dark .auth-footer {
    color: #64748b;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .topbar {
        left: 0;
    }

    .layout-admin .main-content {
        margin-left: 0;
    }

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

/* --- UI Preview specific --- */
.preview-section {
    margin-bottom: var(--sp-8);
}

.preview-section h3 {
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-2);
    border-bottom: 1px solid var(--gray-200);
}

.preview-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    align-items: center;
    margin-bottom: var(--sp-3);
}

/* --- Modal --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    margin: var(--sp-4);
}

.modal-header {
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: var(--sp-5);
}

.modal-footer {
    padding: var(--sp-4) var(--sp-5);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-3);
}

/* --- Bottom Sheet --- */
.bottom-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 150;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 151;
    max-height: 82vh;
    overflow-y: auto;
    padding: var(--sp-5) var(--sp-5) calc(var(--bottom-nav-height) + var(--sp-5));
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
    margin: 0 auto var(--sp-5);
}

.bottom-sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
    padding-bottom: var(--sp-4);
    border-bottom: 1px solid var(--gray-200);
}

.bottom-sheet-types {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

/* --- Rundown Type Card (buy sheet) --- */
.rundown-type-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.rundown-type-card-body {
    padding: var(--sp-4);
}

.rundown-type-card-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--sp-2);
}

.rundown-type-card-desc {
    font-size: var(--text-sm);
    color: var(--gray-600);
    margin-bottom: var(--sp-3);
}

.rundown-type-card-list {
    list-style: disc;
    padding-left: var(--sp-5);
    font-size: var(--text-sm);
    color: var(--gray-600);
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}

.rundown-type-card-footer {
    padding: var(--sp-3) var(--sp-4);
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rundown-type-card-credit {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--primary-600);
}

/* Dark mode: bottom sheet */
html.dark .bottom-sheet {
    background: #1e2535;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

html.dark .bottom-sheet-handle {
    background: #3d4f6b;
}

html.dark .bottom-sheet-header {
    border-color: #2d3748;
}

html.dark .rundown-type-card {
    border-color: #2d3748;
}

html.dark .rundown-type-card-title {
    color: #f1f5f9;
}

html.dark .rundown-type-card-desc,
html.dark .rundown-type-card-list {
    color: #94a3b8;
}

html.dark .rundown-type-card-footer {
    background: #171e2e;
    border-color: #2d3748;
}
