/**
 * ClipShare - Apple UI Design System
 * True Apple HIG design principles
 */

/* ============ CSS Variables ============ */
:root {
    /* Apple System Colors */
    --primary: #007AFF;
    --primary-dark: #0051D5;
    --secondary: #5AC8FA;
    --success: #34C759;
    --warning: #FF9500;
    --danger: #FF3B30;
    --purple: #AF52DE;
    --indigo: #5856D6;
    --teal: #30B0C7;

    /* Gray Palette */
    --gray-1: #8E8E93;
    --gray-2: #AEAEB2;
    --gray-3: #C7C7CC;
    --gray-4: #D1D1D6;
    --gray-5: #E5E5EA;
    --gray-6: #F2F2F7;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 28px;

    /* Typography */
    --font-system: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Menlo', monospace;

    /* Font Sizes */
    --text-xs: 13px;
    --text-sm: 15px;
    --text-base: 15px;
    --text-md: 17px;
    --text-lg: 19px;
    --text-xl: 22px;
    --text-2xl: 26px;
    --text-3xl: 32px;
    --text-4xl: 40px;

    /* Shadows — Apple uses very soft, layered shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-xl: 0 24px 48px rgba(0,0,0,0.12), 0 8px 20px rgba(0,0,0,0.07);

    /* Spring easing — Apple's signature feel */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

    /* Transitions */
    --transition-fast: 140ms var(--ease-out);
    --transition-base: 220ms var(--ease-out);
    --transition-spring: 300ms var(--ease-spring);
}

/* ============ Light Mode (default + system preference) ============ */
:root,
[data-theme="light"] {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F2F2F7;
    --bg-tertiary: #E5E5EA;
    --bg-elevated: #FFFFFF;
    --bg-overlay: rgba(255,255,255,0.72);
    --text-primary: #000000;
    --text-secondary: rgba(60,60,67,0.85);
    --text-tertiary: rgba(60,60,67,0.50);
    --text-quaternary: rgba(60,60,67,0.30);
    --border-color: rgba(60,60,67,0.18);
    --border-strong: rgba(60,60,67,0.30);
    --separator: rgba(60,60,67,0.12);
    --bg-secondary-rgb: 242, 242, 247;
    --border-rgb: 60, 60, 67;
}

/* ============ Dark Mode (system preference) ============ */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #000000;
        --bg-secondary: #1C1C1E;
        --bg-tertiary: #2C2C2E;
        --bg-elevated: #1C1C1E;
        --bg-overlay: rgba(28,28,30,0.72);
        --text-primary: #FFFFFF;
        --text-secondary: rgba(235,235,245,0.85);
        --text-tertiary: rgba(235,235,245,0.50);
        --text-quaternary: rgba(235,235,245,0.25);
        --border-color: rgba(84,84,88,0.60);
        --border-strong: rgba(84,84,88,0.80);
        --separator: rgba(84,84,88,0.36);
        --bg-secondary-rgb: 28, 28, 30;
        --border-rgb: 84, 84, 88;
    }
}

/* ============ Dark Mode (manual toggle) ============ */
[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #1C1C1E;
    --bg-tertiary: #2C2C2E;
    --bg-elevated: #1C1C1E;
    --bg-overlay: rgba(28,28,30,0.72);
    --text-primary: #FFFFFF;
    --text-secondary: rgba(235,235,245,0.85);
    --text-tertiary: rgba(235,235,245,0.50);
    --text-quaternary: rgba(235,235,245,0.25);
    --border-color: rgba(84,84,88,0.60);
    --border-strong: rgba(84,84,88,0.80);
    --separator: rgba(84,84,88,0.36);
    --bg-secondary-rgb: 28, 28, 30;
    --border-rgb: 84, 84, 88;
}

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

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

body {
    font-family: var(--font-system);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    transition: background-color var(--transition-base), color var(--transition-base);
    overflow-x: hidden;
}

/* ============ Typography ============ */
h1 {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.5px;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

h2 {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.3px;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

h3 {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

h4 {
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: 600;
    letter-spacing: -0.1px;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

p {
    font-family: var(--font-system);
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    line-height: 1.6;
}

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

a:hover {
    opacity: 0.75;
}

/* ============ Layout ============ */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    width: 100%;
    box-sizing: border-box;
}

.section {
    padding: var(--spacing-2xl) 0;
}

.grid {
    display: grid;
    gap: var(--spacing-md);
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--spacing-xl);
    align-items: start;
}

.dashboard-grid > * {
    min-width: 0;
}

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

    .sidebar-stats-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-md);
    }
}

.stat-icon-box {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-stats-row {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* ============ Dashboard Hero ============ */
.dashboard-hero {
    background: blue;
    padding-top: 50px;
    padding-bottom: 50px;
}

.dashboard-body {
    padding-top: var(--spacing-xl);
    padding-bottom: var(--spacing-3xl);
    margin-top: -100px;
}

@media (max-width: 640px) {
    .dashboard-hero {
        padding-top: 24px;
        padding-bottom: 32px;
    }
    .dashboard-body {
        margin-top: -40px;
    }
}

/* ============ Frosted Glass Navbar ============ */
.navbar {
    background-color: rgba(var(--bg-secondary-rgb), 0.78);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--separator);
    padding: 0;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color var(--transition-base);
}

.navbar-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-display);
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.navbar-brand-icon {
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-brand-icon svg {
    width: 16px;
    height: 16px;
    fill: white;
}

.navbar-nav {
    display: flex;
    gap: var(--spacing-sm);
    list-style: none;
    align-items: center;
}

.navbar-nav a {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    padding: 5px 12px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    display: block;
}

.navbar-nav a:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    opacity: 1;
}

.navbar-nav a.active {
    color: var(--primary);
    background: rgba(0, 122, 255, 0.10);
}

.navbar-nav a.nav-danger {
    color: var(--danger);
}

.navbar-nav a.nav-danger:hover {
    background: rgba(255, 59, 48, 0.10);
    color: var(--danger);
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: var(--text-sm);
    font-family: var(--font-system);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.1px;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.btn:active {
    transform: scale(0.96);
    transition: transform 80ms var(--ease-out);
}

.btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary */
.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #0071F3;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.32);
    opacity: 1;
    color: white;
}

/* Secondary — fills BG */
.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    font-weight: 700;
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    filter: brightness(0.94);
    opacity: 1;
    color: var(--text-primary);
}

/* Danger */
.btn-danger {
    background: transparent;
    color: black;
    font-weight: 700;
}

.btn-danger:hover {
    background: #E62E23;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.30);
    opacity: 1;
    color: white;
}

/* Success */
.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #2EAE4E;
    opacity: 1;
    color: white;
}

/* Ghost / outlined */
.btn-ghost {
    background: transparent;
    color: var(--primary);
    border: 1px solid rgba(0, 122, 255, 0.35);
}

.btn-ghost:hover {
    background: rgba(0, 122, 255, 0.08);
    opacity: 1;
    color: var(--primary);
}

/* Sizes */
.btn-sm {
    padding: 6px 13px;
    font-size: var(--text-xs);
    border-radius: var(--radius-lg);
}

.btn-xs {
    padding: 3px 8px;
    font-size: var(--text-xs);
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: 13px 28px;
    font-size: var(--text-md);
    border-radius: var(--radius-xl);
}

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

/* ============ Forms ============ */
.form-group {
    margin-bottom: var(--spacing-md);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

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

.checkbox-label span {
    user-select: none;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    letter-spacing: -0.1px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    font-size: var(--text-base);
    font-family: var(--font-system);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3.5px rgba(0, 122, 255, 0.16);
}

textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.55;
}

/* Select arrow */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238E8E93' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Password field wrapper */
.input-wrapper {
    position: relative;
}

.input-wrapper input {
    padding-right: 44px;
}

.input-action-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast);
}

.input-action-btn:hover {
    color: var(--text-secondary);
}

/* Search with clear */
.search-filter-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}

.search-wrapper input {
    padding-left: 38px;
    padding-right: 36px;
}

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

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-quaternary);
    border: none;
    cursor: pointer;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-secondary);
    font-size: 11px;
    font-weight: 700;
    transition: all var(--transition-fast);
    padding: 0;
    line-height: 1;
}

.search-clear:hover {
    background: var(--text-tertiary);
}

/* ============ Cards ============ */
.card {
    background-color: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: box-shadow var(--transition-base);
    box-shadow: 0 10px 10px -10px rgba(0,0,0,0.25),0 18px 36px -18px rgba(0,0,0,0.27);
    overflow: hidden;
    max-width: 100%;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--separator);
}

.card-header h3, .card-header h4 {
    margin-bottom: 0;
}

.card-body {
    /* no extra margin by default */
}

.card-footer {
    display: flex;
    gap: var(--spacing-md);
    padding-top: var(--spacing-md);
    margin-top: var(--spacing-md);
    border-top: 1px solid var(--separator);
    align-items: center;
}

/* Hoverable card */
.card-hoverable:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

/* Stat card — for admin metrics */
.card-stat {
    background-color: var(--bg-elevated);
    border: 1px solid var(--separator);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    position: relative;
    overflow: hidden;
}

.card-stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: var(--stat-color, var(--primary));
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.card-stat-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-sm);
}

.card-stat-value {
    font-size: var(--text-4xl);
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--stat-color, var(--primary));
    line-height: 1;
    margin-bottom: 6px;
}

.card-stat-sub {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* ============ Segmented Control ============ */
.segmented-control {
    display: inline-flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl);
    padding: 2px;
    gap: 1px;
    border: 1px solid var(--separator);
}

.segmented-control input[type="radio"] {
    display: none;
}

.segmented-control label {
    padding: 6px 14px;
    border-radius: calc(var(--radius-xl) - 3px);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 180ms var(--ease-spring);
    color: var(--text-secondary);
    margin-bottom: 0;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}

.segmented-control input:checked + label {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* ============ File Upload Zone ============ */
.file-upload-wrapper {
    position: relative;
    display: block;
    width: 100%;
}

.file-upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.file-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xl) var(--spacing-lg);
    background-color: var(--bg-secondary);
    border: 1.5px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    text-align: center;
    min-height: 90px;
}

.file-upload-zone svg {
    width: 28px;
    height: 28px;
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
}

.file-upload-zone .upload-label {
    font-size: var(--text-sm);
    font-weight: 500;
}

.file-upload-zone .upload-hint {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.file-upload-wrapper:hover .file-upload-zone,
.file-upload-zone.drag-over {
    border-color: var(--primary);
    background: rgba(0, 122, 255, 0.05);
    color: var(--primary);
}

.file-upload-wrapper:hover .file-upload-zone svg,
.file-upload-zone.drag-over svg {
    color: var(--primary);
}

.file-upload-zone.has-file {
    border-style: solid;
    border-color: var(--success);
    background: rgba(52, 199, 89, 0.06);
}

/* ============ Tab Switcher (content card) ============ */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============ Timeline ============ */
.timeline {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    background: #e8e8e8;
    padding: 10px;
    border-radius: 20px;
}

.timeline-item {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--bg-elevated);
    border: 1px solid var(--separator);
    border-left: 3px solid transparent;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.timeline-item:hover {
    border-left-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.timeline-item.type-file:hover {
    border-left-color: var(--success);
}

.timeline-item-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background-color: rgba(0, 122, 255, 0.10);
}

.timeline-item.type-file .timeline-item-icon {
    background-color: rgba(52, 199, 89, 0.10);
}

.timeline-item-icon svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.timeline-item.type-file .timeline-item-icon svg {
    color: var(--success);
}

.timeline-item-content {
    flex: 1;
    min-width: 0;
}

.timeline-item-title {
    font-weight: 600;
    font-size: var(--text-base);
    margin-bottom: 3px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-item-meta {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-sm);
}

.timeline-item-preview {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    /* background-color: var(--bg-secondary); */
    border-radius: var(--radius-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: arial;
    line-height: 1.4;
    /* border-left: 2px solid var(--border-color); */
}

.timeline-item-actions {
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

/* ============ Batch Cards ============ */
.batch-card {
    flex-direction: column;
}

.batch-card > .timeline-item-icon.batch-icon {
    cursor: pointer;
    color: var(--primary);
}

.batch-card > .batch-content {
    flex: 1;
}

.batch-title {
    cursor: pointer;
}

.batch-title:hover {
    color: var(--primary);
}

.batch-files {
    display: none;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    margin: var(--spacing-sm) 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.batch-files.expanded {
    display: flex;
}

.batch-file-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}

.batch-file-icon {
    display: flex;
    align-items: center;
    width: 20px;
    flex-shrink: 0;
}

.batch-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.batch-file-size {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.batch-file-actions {
    display: flex;
    gap: var(--spacing-xs);
    flex-shrink: 0;
}

.batch-file-actions .btn {
    padding: 6px 10px;
}

@media (max-width: 640px) {
    .batch-file-item {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .batch-file-name {
        flex: 1 1 calc(100% - 60px);
        order: 1;
    }
    
    .batch-file-size {
        order: 2;
    }
    
    .batch-file-actions {
        order: 3;
        width: 100%;
        justify-content: flex-end;
        margin-top: var(--spacing-xs);
    }
    
    .batch-file-actions .btn {
        flex: 1;
        max-width: 100px;
    }
}

/* ============ Pagination ============ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.pagination-info {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    padding: 0 var(--spacing-sm);
}

/* ============ Storage Bar ============ */
.storage-bar-track {
    background-color: var(--bg-tertiary);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.storage-bar {
    height: 100%;
    border-radius: 3px;
    background: var(--success);
    transition: width 0.4s var(--ease-out), background-color 0.4s var(--ease-out);
}

.storage-bar[data-level="warning"] {
    background: var(--warning);
}

.storage-bar[data-level="danger"] {
    background: var(--danger);
}

/* ============ Badge / Pill ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.1px;
}

.badge-primary { background: rgba(0,122,255,0.12); color: var(--primary); }
.badge-success { background: rgba(52,199,89,0.12); color: var(--success); }
.badge-warning { background: rgba(255,149,0,0.12); color: var(--warning); }
.badge-danger  { background: rgba(255,59,48,0.12);  color: var(--danger); }
.badge-gray    { background: var(--bg-tertiary);     color: var(--text-tertiary); }

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

.table th {
    text-align: left;
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--separator);
}

.table td {
    padding: 11px var(--spacing-md);
    border-bottom: 1px solid var(--separator);
    color: var(--text-primary);
    vertical-align: middle;
}

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

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

.table td select {
    font-size: var(--text-sm);
    padding: 5px 28px 5px 10px;
}

/* User Avatar (initials) */
.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.avatar-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* ============ Alerts ============ */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    font-size: var(--text-sm);
}

.alert-success {
    background: rgba(52, 199, 89, 0.10);
    border: 1px solid rgba(52, 199, 89, 0.25);
    color: #1d9e40;
}

.alert-danger {
    background: rgba(255, 59, 48, 0.10);
    border: 1px solid rgba(255, 59, 48, 0.25);
    color: #d92c23;
}

.alert-warning {
    background: rgba(255, 149, 0, 0.10);
    border: 1px solid rgba(255, 149, 0, 0.25);
    color: #b86800;
}

.alert-info {
    background: rgba(0, 122, 255, 0.10);
    border: 1px solid rgba(0, 122, 255, 0.20);
    color: var(--primary);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .alert-success { color: var(--success); }
    :root:not([data-theme="light"]) .alert-danger  { color: var(--danger); }
    :root:not([data-theme="light"]) .alert-warning { color: var(--warning); }
}
[data-theme="dark"] .alert-success { color: var(--success); }
[data-theme="dark"] .alert-danger  { color: var(--danger); }
[data-theme="dark"] .alert-warning { color: var(--warning); }

/* ============ Toast Notifications (top-center) ============ */
#notification-container {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: max-content;
    max-width: min(400px, 90vw);
}

.notification {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    border-radius: 14px;
    font-size: var(--text-sm);
    font-weight: 500;
    width: 100%;
    pointer-events: all;
    box-shadow: var(--shadow-lg);
    animation: notifyIn 0.35s var(--ease-spring) forwards;
    border: 1px solid transparent;
}

.notification.hiding {
    animation: notifyOut 0.25s var(--ease-out) forwards;
}

@keyframes notifyIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.94); }
    to   { opacity: 1; transform: translateY(0)     scale(1); }
}

@keyframes notifyOut {
    from { opacity: 1; transform: translateY(0) scale(1); max-height: 80px; margin-bottom: 0; }
    to   { opacity: 0; transform: translateY(-6px) scale(0.95); max-height: 0; margin-bottom: -8px; }
}

.notification-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 800;
}

.notification-success {
    background: rgba(245, 255, 248, 0.96);
    border-color: rgba(52, 199, 89, 0.25);
    color: #1a8c34;
}

.notification-success .notification-icon {
    background: var(--success);
    color: white;
}

.notification-danger {
    background: rgba(255, 245, 244, 0.96);
    border-color: rgba(255, 59, 48, 0.25);
    color: #c4221a;
}

.notification-danger .notification-icon {
    background: var(--danger);
    color: white;
}

.notification-warning {
    background: rgba(255, 250, 240, 0.96);
    border-color: rgba(255, 149, 0, 0.25);
    color: #a05e00;
}

.notification-warning .notification-icon {
    background: var(--warning);
    color: white;
}

.notification-info {
    background: rgba(240, 247, 255, 0.96);
    border-color: rgba(0, 122, 255, 0.20);
    color: #0051d5;
}

.notification-info .notification-icon {
    background: var(--primary);
    color: white;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .notification-success { background: rgba(28, 40, 30, 0.96); color: #4cd964; }
    :root:not([data-theme="light"]) .notification-danger  { background: rgba(40, 22, 20, 0.96); color: #ff6b63; }
    :root:not([data-theme="light"]) .notification-warning { background: rgba(40, 32, 18, 0.96); color: #ffaa38; }
    :root:not([data-theme="light"]) .notification-info    { background: rgba(18, 28, 44, 0.96); color: #4da3ff; }
}
[data-theme="dark"] .notification-success { background: rgba(28, 40, 30, 0.96); color: #4cd964; }
[data-theme="dark"] .notification-danger  { background: rgba(40, 22, 20, 0.96); color: #ff6b63; }
[data-theme="dark"] .notification-warning { background: rgba(40, 32, 18, 0.96); color: #ffaa38; }
[data-theme="dark"] .notification-info    { background: rgba(18, 28, 44, 0.96); color: #4da3ff; }

/* ============ Confirmation Sheet ============ */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.40);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.sheet-overlay.hiding {
    animation: fadeOut 0.15s ease forwards;
}

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

.sheet-dialog {
    background: var(--bg-elevated);
    border-radius: var(--radius-2xl);
    padding: var(--spacing-xl);
    max-width: 320px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: sheetIn 0.3s var(--ease-spring);
}

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

.sheet-title {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.sheet-message {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
    line-height: 1.5;
}

.sheet-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* ============ New Content Modal ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.40);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

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

.modal-overlay.hiding {
    animation: fadeOut 0.15s ease forwards;
}

.modal-dialog {
    background: var(--bg-elevated);
    border-radius: var(--radius-2xl);
    padding: var(--spacing-xl);
    max-width: 480px;
    width: 92%;
    box-shadow: var(--shadow-xl);
    animation: sheetIn 0.3s var(--ease-spring);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: var(--gray-6);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

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

/* Preview content block */
.preview-content {
    background: var(--gray-6);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.65;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 50vh;
    overflow-y: auto;
}

/* Clickable timeline items */
.timeline-item.clickable {
    cursor: pointer;
    transition: background 0.15s ease;
}

.timeline-item.clickable:hover {
    background: var(--gray-6);
}

/* ============ Empty State ============ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-3xl) var(--spacing-xl);
    text-align: center;
    color: var(--text-tertiary);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin-bottom: var(--spacing-lg);
    opacity: 0.35;
    color: var(--text-tertiary);
}

.empty-state-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.empty-state-sub {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-lg);
    max-width: 280px;
}

/* ============ Admin Layout ============ */
.admin-layout {
    display: grid;
    grid-template-columns: 228px 1fr;
    min-height: 100vh;
    background: var(--bg-secondary);
}

.admin-sidebar {
    background: var(--bg-elevated);
    border-right: 1px solid var(--separator);
    padding: var(--spacing-xl) var(--spacing-md);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 0 var(--spacing-sm) var(--spacing-lg);
    border-bottom: 1px solid var(--separator);
    margin-bottom: var(--spacing-lg);
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-display);
    text-decoration: none;
}

.admin-sidebar-brand-icon {
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-sidebar-brand-icon svg {
    width: 16px;
    height: 16px;
    fill: white;
}

.admin-sidebar-section-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-quaternary);
    padding: 0 var(--spacing-sm);
    margin-bottom: 6px;
    margin-top: var(--spacing-md);
}

.admin-sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px var(--spacing-sm);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.admin-sidebar-nav a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

.admin-sidebar-nav a:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    opacity: 1;
}

.admin-sidebar-nav a:hover svg {
    opacity: 1;
}

.admin-sidebar-nav a.active {
    background: rgba(0,122,255,0.10);
    color: var(--primary);
    font-weight: 600;
}

.admin-sidebar-nav a.active svg {
    opacity: 1;
}

.admin-sidebar-nav a.nav-danger {
    color: var(--danger);
}

.admin-sidebar-nav a.nav-danger:hover {
    background: rgba(255,59,48,0.08);
    color: var(--danger);
}

.admin-sidebar-spacer {
    flex: 1;
}

.admin-content {
    padding: var(--spacing-xl) var(--spacing-2xl);
    max-width: 960px;
}

/* Responsive utility classes */
.show-mobile { display: none; }

/* Mobile admin hamburger button */
.admin-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1100;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--separator);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--text-primary);
}

.admin-menu-btn svg { width: 20px; height: 20px; }

/* Drawer overlay */
.admin-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.40);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
}

.admin-drawer-overlay.active { display: block; animation: fadeIn 0.15s ease; }
.admin-drawer-overlay.hiding { animation: fadeOut 0.15s ease forwards; }

@media (max-width: 768px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-menu-btn { display: flex; }

    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1050;
        width: 260px;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.25s var(--ease-out);
        border-right: 1px solid var(--separator);
        box-shadow: var(--shadow-xl);
    }

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

    .admin-content {
        padding: var(--spacing-md);
        padding-top: 64px;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    /* Admin stat cards */
    .card-stat-value { font-size: var(--text-2xl); }
    .card-stat { padding: var(--spacing-md); }

    /* Tables */
    .admin-content .table th,
    .admin-content .table td { padding: 8px 6px; font-size: 12px; }
    .admin-content .avatar-row .avatar { width: 24px !important; height: 24px !important; font-size: 10px !important; }

    /* Admin form grids */
    .admin-content .grid-2 { grid-template-columns: 1fr; }

    /* Responsive utility classes */
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
}

/* ============ Package Selector Cards ============ */
.package-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.package-option input[type="radio"] {
    display: none;
}

.package-option label {
    display: block;
    padding: var(--spacing-md);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-elevated);
    text-align: center;
    margin-bottom: 0;
}

.package-option label:hover {
    border-color: var(--primary);
    background: rgba(0,122,255,0.04);
}

.package-option input:checked + label {
    border-color: var(--primary);
    background: rgba(0,122,255,0.08);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.15);
}

.package-option-name {
    font-weight: 700;
    font-size: var(--text-base);
    color: var(--text-primary);
    margin-bottom: 4px;
}

.package-option-price {
    font-size: var(--text-sm);
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
}

.package-option-storage {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* ============ Auth Page ============ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl) var(--spacing-md);
    background:
        radial-gradient(ellipse at 15% 65%, rgba(0,122,255,0.10) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 20%, rgba(90,200,250,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(175,82,222,0.06) 0%, transparent 45%),
        var(--bg-secondary);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-elevated);
    border: 1px solid var(--separator);
    border-radius: var(--radius-2xl);
    padding: var(--spacing-xl) var(--spacing-xl);
    box-shadow: var(--shadow-xl);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.auth-logo-icon {
    width: 44px;
    height: 44px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,122,255,0.35);
}

.auth-logo-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.auth-logo-wordmark {
    font-size: var(--text-2xl);
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.auth-tagline {
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-xl);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
    color: var(--text-tertiary);
    font-size: var(--text-xs);
}

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

/* ============ Loading ============ */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.loading-spinner.dark {
    border-color: rgba(0,0,0,0.12);
    border-top-color: var(--text-secondary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-secondary) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 300% 100%;
    animation: skeleton-loading 1.4s ease infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ============ Compact form grid ============ */
.compact-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
}

/* ============ Utilities ============ */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-tertiary) !important; }
.text-primary-color { color: var(--primary) !important; }
.text-danger  { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }

.mt-0  { margin-top: 0; }
.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-0  { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.p-0  { padding: 0; }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }

.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-col      { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.flex-wrap     { flex-wrap: wrap; }

.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.w-full { width: 100%; }
.hidden { display: none !important; }

/* ============ Responsive ============ */

/* -- Tablet breakpoint -- */
@media (max-width: 768px) {
    .container { max-width: 100%; padding: 0 var(--spacing-md); }

    .modal-dialog { width: 96%; padding: var(--spacing-md); border-radius: var(--radius-xl); }

    .table { font-size: var(--text-xs); }
    .table th, .table td { padding: 8px var(--spacing-sm); }
}

/* -- Mobile breakpoint -- */
@media (max-width: 640px) {
    h1 { font-size: var(--text-2xl); }
    h2 { font-size: var(--text-xl); }

    .container { padding: 0 var(--spacing-md); overflow-x: hidden; }

    /* Navbar */
    .navbar { height: 52px; }
    .navbar-container { padding: 0 var(--spacing-md); }
    .navbar-brand { font-size: var(--text-base); gap: 8px; }
    .navbar-brand-icon { width: 28px; height: 28px; border-radius: 7px; }
    .navbar-brand-icon svg { width: 16px; height: 16px; }
    .navbar-nav { gap: 4px; }
    .navbar-nav a { padding: 6px 10px; font-size: var(--text-sm); }

    /* Dashboard grid: single column */
    .dashboard-grid { gap: var(--spacing-md); }

    /* Cards */
    .card {
        padding: var(--spacing-md);
        border-radius: var(--radius-md);
        box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    }
    .card-header { margin-bottom: var(--spacing-sm); padding-bottom: var(--spacing-sm); }

    /* Timeline items */
    .timeline-item { padding: var(--spacing-md) var(--spacing-sm); gap: var(--spacing-sm); border-radius: var(--radius-md); }
    .timeline-item-icon { width: 38px; height: 38px; }
    .timeline-item-icon svg { width: 18px; height: 18px; }
    .timeline-item-title { font-size: var(--text-base); white-space: normal; word-break: break-word; }
    .timeline-item-meta { font-size: var(--text-xs); }
    .timeline-item-preview {
        font-size: var(--text-sm);
        white-space: normal;
        word-break: break-word;
    }
    /* Action buttons */
    .timeline-item-actions .btn-sm { padding: 6px 10px; font-size: var(--text-xs); }

    /* Search / filter row: stack vertically */
    .search-filter-row { flex-direction: column; align-items: stretch; }
    .search-filter-row .search-wrapper { width: 100%; }
    .search-filter-row .segmented-control { display: flex; width: 100%; }
    .search-filter-row .segmented-control label { flex: 1; text-align: center; padding: 7px 10px; font-size: var(--text-sm); }

    /* Buttons */
    .btn { font-size: var(--text-base); padding: 10px 16px; }
    .btn-sm { font-size: var(--text-sm); padding: 7px 12px; }
    .btn-full-mobile { width: 100%; }

    /* Modals: full-width bottom sheet style */
    .modal-overlay { align-items: flex-end; }
    .modal-dialog {
        width: 100%;
        max-width: 100%;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        padding: var(--spacing-md);
        max-height: 85vh;
        animation: mobileSheetIn 0.3s var(--ease-spring);
    }
    .sheet-dialog { max-width: 90%; }

    /* Preview content */
    .preview-content { max-height: 40vh; font-size: var(--text-sm); }

    /* File upload zone */
    .file-upload-zone { padding: var(--spacing-lg) var(--spacing-md); }
    .file-upload-zone svg { width: 40px; height: 40px; }
    .file-upload-zone p { font-size: var(--text-base); }

    /* Sidebar: reflow for mobile */
    .sidebar { min-width: 0; }
    .sidebar-stats-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-sm);
    }
    .sidebar-stats-row > * { min-width: 0; }
    .sidebar-card .card-header { padding-bottom: var(--spacing-xs); margin-bottom: var(--spacing-xs); }
    .sidebar-card .stat-icon-box { width: 30px; height: 30px; border-radius: 8px; }
    .sidebar-card .stat-icon-box svg { width: 15px; height: 15px; }
    .stat-label { font-size: var(--text-sm) !important; }
    .stat-value { font-size: var(--text-lg); }

    .storage-bar-track { height: 6px; }

    /* Pagination */
    .pagination { gap: var(--spacing-sm); }
    .pagination-info { font-size: var(--text-sm); }

    /* Notifications */
    #notification-container { max-width: calc(100vw - 16px); }
    .notification { font-size: var(--text-sm); }

    /* Theme toggle */
    .theme-toggle { width: 32px; height: 32px; }
    .theme-toggle svg { width: 16px; height: 16px; }
}

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

/* -- Small phones -- */
@media (max-width: 420px) {
    .navbar-brand-icon { display: none; }
    .segmented-control label { padding: 6px 8px; font-size: var(--text-xs); }
    .timeline-item-actions .btn-sm span,
    .timeline-item-actions .btn-danger span { display: none; }
    .timeline-item-actions .btn-sm,
    .timeline-item-actions .btn-danger { padding: 8px; }
    .timeline-item-actions .btn-sm svg,
    .timeline-item-actions .btn-danger svg { width: 14px; height: 14px; }
}

/* ============ Theme Toggle ============ */
.theme-toggle {
    position: relative;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-base), transform var(--transition-spring);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    transform: scale(1.08);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: opacity 0.2s, transform 0.3s var(--ease-spring);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
}

.theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

[data-theme="dark"] .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0) scale(1);
}

[data-theme="dark"] .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon {
        opacity: 0;
        transform: rotate(90deg) scale(0.5);
    }
}

/* Auth page: floating toggle in top-right */
.theme-toggle-float {
    position: fixed;
    top: var(--spacing-md);
    right: var(--spacing-md);
    z-index: 100;
}

/* Admin sidebar toggle */
.admin-sidebar .theme-toggle {
    margin: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
}
