/* ???????????????????????????????????????????????????????????????????
   CSA Media Portal — Design System v2
   ??????????????????????????????????????????????????????????????????? */

/* ?? Design Tokens ??????????????????????????????????????????????? */
:root {
    /* Surfaces — slightly warmer dark palette */
    --surface-base:     #0c0e11;
    --surface-raised:   #111318;
    --surface-overlay:  #181c23;
    --surface-card:     #151920;
    --surface-subtle:   #1e232d;
    --surface-muted:    #252b38;
    --surface-border:   #2a3040;

    /* Brand */
    --brand-primary:     #00a651;
    --brand-primary-dim: #007a3d;
    --brand-primary-lit: #00c260;
    --brand-accent:      #ffe033;
    --brand-glow:        rgba(0, 166, 81, 0.14);
    --brand-glow-strong: rgba(0, 166, 81, 0.24);

    /* Text */
    --text-primary:   #eef0f4;
    --text-secondary: #828ea3;
    --text-muted:     #4e5868;
    --text-disabled:  #343d4d;
    --text-inverse:   #0c0e11;

    /* Border */
    --border-subtle:  rgba(255,255,255,0.055);
    --border-default: rgba(255,255,255,0.09);
    --border-strong:  rgba(255,255,255,0.16);
    --border-brand:   rgba(0, 166, 81, 0.35);

    /* Status */
    --status-success: #00a651;
    --status-warning: #f59e0b;
    --status-danger:  #ef4444;
    --status-info:    #3b82f6;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.35);
    --shadow-sm: 0 2px 6px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 6px 20px rgba(0,0,0,0.55), 0 2px 6px rgba(0,0,0,0.35);
    --shadow-lg: 0 20px 48px rgba(0,0,0,0.65), 0 6px 16px rgba(0,0,0,0.4);
    --shadow-brand: 0 0 24px rgba(0, 166, 81, 0.3);
    --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.04);

    /* Spacing scale */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  20px;
    --space-6:  24px;
    --space-7:  28px;
    --space-8:  32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Radius */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   14px;
    --radius-xl:   20px;
    --radius-2xl:  28px;
    --radius-full: 9999px;

    /* Typography */
    --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
    --font-display: 'Inter', var(--font-sans);

    /* Layout */
    --sidebar-width:     248px;
    --sidebar-collapsed:  60px;
    --topbar-height:      58px;
    --content-max-width: 1440px;

    /* Transitions */
    --transition-fast: 110ms ease;
    --transition-base: 190ms ease;
    --transition-slow: 320ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ?? Reset ???????????????????????????????????????????????????????? */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: var(--font-sans);
    background: var(--surface-base);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--brand-primary-lit); }

img, svg { display: block; }

button { font-family: inherit; }

/* ?? App Shell ???????????????????????????????????????????????????? */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
    /* Subtle noise texture on the shell background */
    background: var(--surface-base);
}

/* ???????????????????????????????????????????????????????????????????
   SIDEBAR
   ??????????????????????????????????????????????????????????????????? */
.sidebar {
    width: var(--sidebar-width);
    height: 100%;
    background: var(--surface-raised);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--transition-slow);
    z-index: 100;
    /* Thin green top accent */
    box-shadow: inset 0 2px 0 var(--brand-primary);
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--surface-muted); border-radius: var(--radius-full); }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: 0 var(--space-5);
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sidebar-brand-logo {
    height: 44px;
    width: auto;
    flex-shrink: 0;
    display: block;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.sidebar-brand-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.sidebar-brand-sub {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: var(--space-3) var(--space-3) var(--space-4);
    display: flex;
    flex-direction: column;
}

.sidebar-section-label {
    font-size: 9.5px;
    font-weight: 700;
    color: var(--text-disabled);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: var(--space-5) var(--space-3) var(--space-2);
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 9px var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
    white-space: nowrap;
    position: relative;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.sidebar-nav-item + .sidebar-nav-item { margin-top: 1px; }

.sidebar-nav-item:hover {
    background: var(--surface-overlay);
    color: var(--text-primary);
}

.sidebar-nav-item.active {
    background: var(--brand-glow);
    color: var(--brand-primary);
    font-weight: 600;
}

.sidebar-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 2.5px;
    background: var(--brand-primary);
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
    box-shadow: 0 0 6px var(--brand-primary);
}

.sidebar-nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity var(--transition-fast);
}

.sidebar-nav-item.active .sidebar-nav-icon,
.sidebar-nav-item:hover .sidebar-nav-icon { opacity: 1; }

.sidebar-nav-badge {
    margin-left: auto;
    background: var(--brand-primary);
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    line-height: 1.7;
    letter-spacing: 0.03em;
}

/* Sidebar Footer / User */
.sidebar-footer {
    padding: var(--space-3);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.sidebar-user:hover { background: var(--surface-overlay); }

.sidebar-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--brand-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--brand-primary);
    flex-shrink: 0;
    border: 1px solid var(--border-brand);
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-user-role {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.sidebar-attribution {
    margin-top: var(--space-3);
    padding: 0 var(--space-3);
    font-size: 9.5px;
    color: var(--text-disabled);
    text-align: center;
    letter-spacing: 0.01em;
    line-height: 1.5;
    opacity: 0.7;
}

.sidebar-attribution-link {
    color: var(--text-disabled);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 1px;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.sidebar-attribution-link:hover {
    color: var(--text-muted);
    border-bottom-color: rgba(255, 255, 255, 0.14);
}

/* ???????????????????????????????????????????????????????????????????
   MAIN AREA
   ??????????????????????????????????????????????????????????????????? */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: var(--surface-base);
}

/* Top Bar */
.topbar {
    height: var(--topbar-height);
    background: var(--surface-raised);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 var(--space-7);
    gap: var(--space-5);
    flex-shrink: 0;
    z-index: 50;
    transition: box-shadow var(--transition-base);
}

.topbar.scrolled {
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--surface-overlay);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 7px var(--space-4);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    min-width: 200px;
}

.topbar-search:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-glow);
    background: var(--surface-subtle);
}

.topbar-search input {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 12.5px;
    outline: none;
    width: 100%;
    font-family: inherit;
}

.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search-icon { color: var(--text-muted); width: 13px; height: 13px; flex-shrink: 0; }

/* kbd shortcut hint */
.topbar-search-kbd {
    font-size: 10px;
    color: var(--text-disabled);
    background: var(--surface-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: var(--font-mono);
    white-space: nowrap;
    flex-shrink: 0;
}

.icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
    flex-shrink: 0;
}

.icon-btn:hover {
    background: var(--surface-overlay);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.icon-btn svg { width: 15px; height: 15px; }

/* Topbar divider */
.topbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border-subtle);
    flex-shrink: 0;
}

/* ???????????????????????????????????????????????????????????????????
   PAGE CONTENT
   ??????????????????????????????????????????????????????????????????? */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-8) var(--space-8);
    width: 100%;
}

.page-content::-webkit-scrollbar { width: 5px; }
.page-content::-webkit-scrollbar-track { background: transparent; }
.page-content::-webkit-scrollbar-thumb { background: var(--surface-muted); border-radius: var(--radius-full); }

/* Page Header */
.page-header { margin-bottom: var(--space-8); }

.page-header-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--brand-primary);
    margin-bottom: var(--space-2);
}

/* Small dot before eyebrow */
.page-header-eyebrow::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    flex-shrink: 0;
}

.page-header-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.page-header-subtitle {
    margin-top: var(--space-2);
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.page-header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-5);
    flex-wrap: wrap;
}

/* ???????????????????????????????????????????????????????????????????
   CARDS
   ??????????????????????????????????????????????????????????????????? */
.card {
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-xs), var(--shadow-inset);
    transition: border-color var(--transition-base);
}

.card:hover { border-color: var(--border-default); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    gap: var(--space-4);
}

.card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.5;
}

/* ?? Stat Cards ??????????????????????????????????????????????????? */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    box-shadow: var(--shadow-xs), var(--shadow-inset);
    transition: border-color var(--transition-base), transform var(--transition-slow), box-shadow var(--transition-slow);
    position: relative;
    overflow: hidden;
}

/* Subtle gradient gloss on stat card */
.stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.015) 0%, transparent 60%);
    pointer-events: none;
    border-radius: inherit;
}

.stat-card:hover {
    border-color: var(--border-default);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.stat-card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.3;
}

.stat-card-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-icon svg { width: 16px; height: 16px; }

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.04em;
    font-feature-settings: "tnum";
}

.stat-card-delta {
    font-size: 11.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1.4;
}

.stat-card-delta.up   { color: #4ade80; }
.stat-card-delta.down { color: #f87171; }

/* Icon bg variants */
.icon-bg-green  { background: rgba(0, 166, 81, 0.12);  color: #34d399; }
.icon-bg-blue   { background: rgba(59, 130, 246, 0.12); color: #60a5fa; }
.icon-bg-amber  { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.icon-bg-purple { background: rgba(139, 92, 246, 0.12); color: #a78bfa; }
.icon-bg-rose   { background: rgba(239, 68, 68, 0.12);  color: #f87171; }
.icon-bg-teal   { background: rgba(20, 184, 166, 0.12); color: #2dd4bf; }

/* ?? Content Grid ????????????????????????????????????????????????? */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--space-6);
    margin-bottom: var(--space-8);
    align-items: start;
}

/* ?? Media Grid ??????????????????????????????????????????????????? */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-4);
}

/* ???????????????????????????????????????????????????????????????????
   BUTTONS
   ??????????????????????????????????????????????????????????????????? */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 8px var(--space-5);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast),
                box-shadow var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
    border: 1px solid transparent;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.5;
    letter-spacing: 0.01em;
    font-family: inherit;
}

.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[disabled] { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
    box-shadow: 0 1px 3px rgba(0,166,81,0.3);
}
.btn-primary:hover {
    background: var(--brand-primary-lit);
    border-color: var(--brand-primary-lit);
    box-shadow: 0 0 0 3px var(--brand-glow), 0 1px 3px rgba(0,166,81,0.4);
    color: #fff;
}

.btn-secondary {
    background: var(--surface-overlay);
    color: var(--text-primary);
    border-color: var(--border-default);
}
.btn-secondary:hover {
    background: var(--surface-subtle);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--surface-overlay);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(239,68,68,0.1);
    color: #f87171;
    border-color: rgba(239,68,68,0.2);
}
.btn-danger:hover {
    background: rgba(239,68,68,0.2);
    border-color: rgba(239,68,68,0.4);
    color: #fca5a5;
}

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 10px var(--space-6); font-size: 14px; }

/* ???????????????????????????????????????????????????????????????????
   BADGES
   ??????????????????????????????????????????????????????????????????? */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.6;
}

.badge-green  { background: rgba(0,166,81,0.14);   color: #4ade80; border: 1px solid rgba(0,166,81,0.2); }
.badge-blue   { background: rgba(59,130,246,0.14);  color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.badge-amber  { background: rgba(245,158,11,0.14);  color: #fbbf24; border: 1px solid rgba(245,158,11,0.2); }
.badge-red    { background: rgba(239,68,68,0.14);   color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.badge-purple { background: rgba(139,92,246,0.14);  color: #a78bfa; border: 1px solid rgba(139,92,246,0.2); }
.badge-muted  { background: var(--surface-subtle);  color: var(--text-muted); border: 1px solid var(--border-subtle); }

/* ???????????????????????????????????????????????????????????????????
   MEDIA CARD
   ??????????????????????????????????????????????????????????????????? */
.media-card {
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition-base), transform var(--transition-slow), box-shadow var(--transition-slow);
    cursor: pointer;
}

.media-card:hover {
    border-color: var(--border-default);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.media-card-thumb {
    aspect-ratio: 16/9;
    background: var(--surface-subtle);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-card-thumb-icon { color: var(--text-muted); opacity: 0.3; }
.media-card-thumb-icon svg { width: 36px; height: 36px; }

.media-card-type-badge {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
}

.media-card-body { padding: var(--space-4); }

.media-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.media-card-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ???????????????????????????????????????????????????????????????????
   UPLOAD ZONE
   ??????????????????????????????????????????????????????????????????? */
.upload-zone {
    border: 1.5px dashed var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-16) var(--space-8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-base), background var(--transition-base), box-shadow var(--transition-base);
    background: var(--surface-raised);
    position: relative;
    overflow: hidden;
}

/* Subtle radial highlight at centre */
.upload-zone::before {
    content: '';
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0,166,81,0.04) 0%, transparent 70%);
    pointer-events: none;
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--brand-primary);
    background: rgba(0,166,81,0.04);
    box-shadow: 0 0 0 4px var(--brand-glow);
}

.upload-zone-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-xl);
    background: var(--surface-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-2);
    border: 1px solid var(--border-default);
    transition: border-color var(--transition-base), background var(--transition-base);
}

.upload-zone:hover .upload-zone-icon,
.upload-zone.drag-over .upload-zone-icon {
    background: var(--brand-glow-strong);
    border-color: var(--border-brand);
}

.upload-zone-icon svg { width: 26px; height: 26px; color: var(--brand-primary); }

.upload-zone-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.upload-zone-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 340px;
    line-height: 1.6;
}

.upload-zone-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    background: var(--surface-subtle);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

/* ???????????????????????????????????????????????????????????????????
   FILTER BAR
   ??????????????????????????????????????????????????????????????????? */
.filter-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
}

.filter-search {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--surface-overlay);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 8px var(--space-4);
    flex: 1;
    min-width: 200px;
    max-width: 340px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.filter-search:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-glow);
}

.filter-search input {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 12.5px;
    outline: none;
    width: 100%;
    font-family: inherit;
}

.filter-search input::placeholder { color: var(--text-muted); }
.filter-search svg { width: 13px; height: 13px; color: var(--text-muted); flex-shrink: 0; }

.filter-chip-group { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.filter-chip {
    padding: 5px 13px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    font-family: inherit;
    letter-spacing: 0.01em;
}

.filter-chip:hover { border-color: var(--border-default); color: var(--text-primary); background: var(--surface-overlay); }
.filter-chip.active { background: var(--brand-glow); border-color: var(--border-brand); color: var(--brand-primary); font-weight: 600; }

/* ???????????????????????????????????????????????????????????????????
   TABLE
   ??????????????????????????????????????????????????????????????????? */
.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.data-table td {
    padding: 13px var(--space-4);
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--surface-overlay); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ???????????????????????????????????????????????????????????????????
   FORM CONTROLS
   ??????????????????????????????????????????????????????????????????? */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }

.form-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.form-control {
    background: var(--surface-overlay);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 9px var(--space-4);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    width: 100%;
    font-family: inherit;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-glow);
    background: var(--surface-subtle);
}

.form-control:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--surface-raised);
}

.form-select {
    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='%234e5868' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

/* ???????????????????????????????????????????????????????????????????
   EMPTY STATE
   ??????????????????????????????????????????????????????????????????? */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-16) var(--space-8);
    text-align: center;
    gap: var(--space-3);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-xl);
    background: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
    box-shadow: var(--shadow-inset);
}

.empty-state-icon svg { width: 28px; height: 28px; color: var(--text-disabled); }

.empty-state-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.empty-state-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 300px;
    line-height: 1.65;
}

/* ???????????????????????????????????????????????????????????????????
   SETTINGS CARDS
   ??????????????????????????????????????????????????????????????????? */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-5);
}

.settings-card-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-card-icon svg { width: 15px; height: 15px; }

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.settings-row:last-child { border-bottom: none; padding-bottom: 0; }

.settings-row-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.settings-row-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-feature-settings: "tnum";
}

/* ???????????????????????????????????????????????????????????????????
   ACTIVITY LIST
   ??????????????????????????????????????????????????????????????????? */
.activity-list { display: flex; flex-direction: column; }

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    margin-top: 7px;
    flex-shrink: 0;
}

.activity-dot.share  { background: #3b82f6; }
.activity-dot.approve { background: #f59e0b; }
.activity-dot.delete  { background: #ef4444; }

.activity-body { flex: 1; }
.activity-text { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }
.activity-text strong { color: var(--text-primary); font-weight: 600; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ???????????????????????????????????????????????????????????????????
   MISC COMPONENTS
   ??????????????????????????????????????????????????????????????????? */

/* Divider */
.divider { height: 1px; background: var(--border-subtle); margin: var(--space-5) 0; }

/* Alerts */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    line-height: 1.55;
}

.alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.alert-info    { background: rgba(59,130,246,0.08);  border-color: rgba(59,130,246,0.2);  color: #93c5fd; }
.alert-success { background: rgba(0,166,81,0.08);    border-color: rgba(0,166,81,0.2);    color: #4ade80; }
.alert-warning { background: rgba(245,158,11,0.08);  border-color: rgba(245,158,11,0.2);  color: #fcd34d; }
.alert-danger  { background: rgba(239,68,68,0.08);   border-color: rgba(239,68,68,0.2);   color: #fca5a5; }

/* User cell */
.user-cell { display: flex; align-items: center; gap: var(--space-3); }

.user-row-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    background: var(--brand-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--brand-primary);
    border: 1px solid var(--border-brand);
    flex-shrink: 0;
}

.user-name { font-weight: 600; color: var(--text-primary); font-size: 13px; line-height: 1.3; }
.user-email { font-size: 11px; color: var(--text-muted); }

/* System status strip */
.system-strip {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    padding: var(--space-3) var(--space-5);
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-xs);
}

.system-strip-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 12px;
    color: var(--text-muted);
}

.system-strip-item:not(:last-child)::after {
    content: '';
    display: block;
    width: 1px;
    height: 14px;
    background: var(--border-subtle);
    margin-left: var(--space-5);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.status-dot-green  { background: #00a651; box-shadow: 0 0 6px rgba(0,166,81,0.5); }
.status-dot-amber  { background: #f59e0b; }
.status-dot-red    { background: #ef4444; }

/* Quick action list */
.action-list { display: flex; flex-direction: column; gap: var(--space-2); }

.action-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--surface-overlay);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    text-decoration: none;
}

.action-item:hover {
    background: var(--surface-subtle);
    border-color: var(--border-default);
    color: var(--text-primary);
}

.action-item-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.action-item-icon svg { width: 13px; height: 13px; }

.action-item-text { flex: 1; }
.action-item-arrow { color: var(--text-disabled); }
.action-item-arrow svg { width: 12px; height: 12px; }

/* Scrollbar global */
* { scrollbar-width: thin; scrollbar-color: var(--surface-muted) transparent; }

/* ???????????????????????????????????????????????????????????????????
   RESPONSIVE
   ??????????????????????????????????????????????????????????????????? */
@media (max-width: 1100px) {
    .content-grid { grid-template-columns: 1fr; }
    .asset-detail-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { width: var(--sidebar-collapsed); }
    .sidebar-brand-text,
    .sidebar-nav-item span,
    .sidebar-section-label,
    .sidebar-user-info,
    .sidebar-nav-badge,
    .sidebar-attribution { display: none; }
    .sidebar-brand { justify-content: center; padding: 0; }
    .sidebar-brand-logo { height: 30px; }
    .sidebar-nav-item { justify-content: center; padding: var(--space-3); }
    .sidebar-user { justify-content: center; }
    .page-content { padding: var(--space-5); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .settings-grid { grid-template-columns: 1fr; }
    .system-strip { display: none; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .topbar-search { display: none; }
    .page-header-title { font-size: 20px; }
}

/* ???????????????????????????????????????????????????????????????????
   UPLOAD SUCCESS PANEL
   ??????????????????????????????????????????????????????????????????? */
.upload-success-panel {
    display: flex;
    align-items: flex-start;
    gap: var(--space-5);
    padding: var(--space-6);
    background: rgba(0, 166, 81, 0.07);
    border: 1px solid rgba(0, 166, 81, 0.25);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-xs);
}

.upload-success-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: rgba(0, 166, 81, 0.15);
    border: 1px solid rgba(0, 166, 81, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.upload-success-icon svg {
    width: 22px;
    height: 22px;
    color: var(--brand-primary);
}

.upload-success-body {
    flex: 1;
    min-width: 0;
}

.upload-success-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: var(--space-1);
}

.upload-success-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.upload-success-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 12px;
    color: var(--text-muted);
}

.upload-success-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
    align-items: flex-start;
}

/* ???????????????????????????????????????????????????????????????????
   UPLOAD PROGRESS BAR
   ??????????????????????????????????????????????????????????????????? */
.upload-progress-track {
    height: 4px;
    background: var(--surface-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background: var(--brand-primary);
    border-radius: var(--radius-full);
    transition: width 0.25s ease;
    box-shadow: 0 0 8px rgba(0, 166, 81, 0.5);
}

/* ???????????????????????????????????????????????????????????????????
   ASSET DETAIL PAGE
   ??????????????????????????????????????????????????????????????????? */
.asset-detail-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--space-6);
    align-items: start;
}

@media (max-width: 1100px) {
    .asset-detail-layout { grid-template-columns: 1fr; }
}

.asset-detail-left { display: flex; flex-direction: column; gap: var(--space-5); }
.asset-detail-right { display: flex; flex-direction: column; gap: 0; }

/* Preview panel */
.asset-preview-panel {
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.asset-preview-image {
    width: 100%;
    max-height: 600px;
    object-fit: contain;
    display: block;
    background: var(--surface-base);
}

.asset-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    min-height: 320px;
    background: var(--surface-subtle);
    color: var(--text-muted);
    font-size: 13px;
}

.asset-preview-placeholder svg {
    width: 56px;
    height: 56px;
    color: var(--text-disabled);
    opacity: 0.5;
}

.asset-preview-video {
    background: linear-gradient(135deg, var(--surface-subtle) 0%, var(--surface-muted) 100%);
    min-height: 360px;
    position: relative;
}

.asset-preview-video-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
}

.asset-preview-video-icon svg {
    width: 36px;
    height: 36px;
    color: #a78bfa;
    opacity: 1;
}

.asset-preview-footer {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border-subtle);
    background: var(--surface-overlay);
}

/* Action row */
.asset-action-row {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* Metadata definition list */
.meta-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.meta-row:last-child { border-bottom: none; }

.meta-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
    flex-shrink: 0;
}

.meta-value {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: right;
    word-break: break-all;
    min-width: 0;
}

.meta-mono {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-secondary);
}

/* ???????????????????????????????????????????????????????????????????
   PHASE 4 — SHARE LINK PANEL
   ??????????????????????????????????????????????????????????????????? */

/* Inline collapsible panel below asset actions */
.share-panel {
    display: none;
    flex-direction: column;
    background: var(--surface-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    animation: panelIn 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.share-panel-open { display: flex; }

@keyframes panelIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.share-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-overlay);
    flex-shrink: 0;
}

/* Share URL copy row */
.share-url-row {
    display: flex;
    gap: var(--space-3);
    align-items: stretch;
}

.share-url-row .form-control {
    flex: 1;
    background: var(--surface-subtle);
    cursor: text;
    color: var(--brand-primary);
}

/* ?? Toggle switch ???????????????????????????????????????????????? */
.toggle-switch {
    position: relative;
    display: inline-flex;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    display: block;
    width: 42px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--surface-muted);
    border: 1px solid var(--border-default);
    transition: background var(--transition-base), border-color var(--transition-base);
    position: relative;
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    background: var(--text-muted);
    transition: transform var(--transition-base), background var(--transition-base);
}

.toggle-switch input:checked + .toggle-track {
    background: var(--brand-glow-strong);
    border-color: var(--border-brand);
}

.toggle-switch input:checked + .toggle-track::after {
    transform: translateX(18px);
    background: var(--brand-primary);
}

/* ???????????????????????????????????????????????????????????????????
   PHASE 6 — BULK ACTION BAR
   ??????????????????????????????????????????????????????????????????? */
.bulk-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-5);
    background: var(--surface-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-xs);
}

.media-card-wrapper {
    position: relative;
}

.bulk-checkbox-wrap {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.5);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(4px);
}

/* ???????????????????????????????????????????????????????????????????
   PHASE 6 — SPIN ANIMATION
   ??????????????????????????????????????????????????????????????????? */
@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.spin-slow {
    animation: spin-slow 1.2s linear infinite;
}

/* ???????????????????????????????????????????????????????????????????
   PAGINATION
   ??????????????????????????????????????????????????????????????????? */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.pagination-page:hover {
    background: var(--surface-overlay);
    color: var(--text-primary);
}

.pagination-page.active {
    background: var(--brand-glow);
    color: var(--brand-primary);
    font-weight: 700;
    border: 1px solid var(--border-brand);
}