:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #1e293b;
    --success: #16a34a;
    --success-soft: #dcfce7;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --info: #0284c7;
    --info-soft: #e0f2fe;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --sidebar-w: 260px;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* App Shell (Desktop-first) */
.app-shell {
    display: flex;
    min-height: 100vh;
}
.sidebar-edge-trigger {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 24px;
    z-index: 55;
    background: transparent;
}
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s ease;
}
.sidebar-brand {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}
.brand-custom-logo {
    height: 36px;
    max-width: 110px;
    object-fit: contain;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    padding: 2px 4px;
}
.brand-text {
    flex: 1;
    min-width: 0;
}
.sidebar-pin-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    color: #cbd5e1;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.sidebar-pin-btn:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
    transform: scale(1.05);
}
.sidebar-pin-btn.pinned {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}
.main-area {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Auto-hide mode on Desktop */
@media (min-width: 769px) {
    .app-shell.autohide-sidebar .sidebar-edge-trigger {
        display: block;
    }
    .app-shell.autohide-sidebar .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    .app-shell.autohide-sidebar .sidebar:hover,
    .app-shell.autohide-sidebar .sidebar.hover-revealed {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.45);
    }
    .app-shell.autohide-sidebar .main-area {
        margin-left: 0 !important;
    }
}
.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}
.brand-text h1 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}
.brand-text span {
    font-size: 11px;
    color: #94a3b8;
    display: block;
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
}
.nav-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    padding: 12px 10px 6px;
    font-weight: 600;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-weight: 500;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
}
.nav-item:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
    text-decoration: none;
}
.nav-item.active {
    background: var(--primary);
    color: #fff;
}
.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 12px;
    color: #94a3b8;
}

.main-area {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}
/* Sticky Header Scroll Dynamic Padding & Shadow */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 30;
    transition: padding 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}
.topbar.scrolled {
    padding-top: 8px;
    padding-bottom: 8px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.mobile-menu-btn {
    display: none;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    color: var(--text);
    align-items: center;
    justify-content: center;
}
.hamburger-box {
    width: 20px;
    height: 14px;
    display: inline-block;
    position: relative;
}
.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
    width: 20px;
    height: 2px;
    background-color: var(--text);
    border-radius: 2px;
    position: absolute;
    transition: transform 0.22s ease, opacity 0.22s ease;
}
.hamburger-inner {
    top: 50%;
    transform: translateY(-50%);
}
.hamburger-inner::before,
.hamburger-inner::after {
    content: "";
    display: block;
}
.hamburger-inner::before {
    top: -6px;
}
.hamburger-inner::after {
    bottom: -6px;
}
.mobile-menu-btn.active .hamburger-inner {
    transform: rotate(45deg);
}
.mobile-menu-btn.active .hamburger-inner::before {
    top: 0;
    opacity: 0;
}
.mobile-menu-btn.active .hamburger-inner::after {
    bottom: 0;
    transform: rotate(-90deg);
}
.global-search {
    display: flex;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    width: 100%;
    max-width: 440px;
}
.global-search input {
    border: none;
    background: transparent;
    padding: 8px 8px;
    width: 100%;
    outline: none;
    font-size: 13px;
    color: var(--text);
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.page-content {
    padding: 24px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    transition: padding-top 0.25s ease;
}
.page-content.scrolled {
    padding-top: 16px;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.page-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}
.page-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
}

/* Cards & Grids & Cursor Highlight / Scroll Shifting */
.card,
.stat-card,
.asset-card {
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.22s ease;
    position: relative;
}

.card:hover,
.stat-card:hover,
.asset-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px -4px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
    border-color: rgba(37, 99, 235, 0.35);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}
.grid {
    display: grid;
    gap: 16px;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none;
    line-height: 1.3;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #e2e8f0; color: #475569; }

/* Drag & Drop and Paste Dropzone Styles */
.file-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    background: var(--surface-2);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    outline: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 88px;
}
.file-dropzone:hover,
.file-dropzone:focus-within {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.file-dropzone.dragover {
    border-color: var(--primary);
    background: #dbeafe;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
    transform: scale(1.01);
}
.dropzone-icon {
    font-size: 26px;
    line-height: 1;
    color: var(--primary);
}
.dropzone-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.dropzone-hint {
    font-size: 11px;
    color: var(--text-muted);
}
.dropzone-hint kbd {
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 1px 4px;
    font-family: inherit;
    font-size: 10px;
    color: #334155;
}
.dropzone-preview {
    margin-top: 6px;
    display: none;
    font-size: 12px;
    color: var(--success);
    font-weight: 600;
    background: var(--success-soft);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
    max-width: 95%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dropzone-preview.active {
    display: inline-block;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.form-group { margin-bottom: 12px; }
.form-group.full { grid-column: 1 / -1; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
textarea.form-control { min-height: 80px; resize: vertical; }

/* Tables */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
th {
    background: var(--surface-2);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}
tr {
    transition: background-color 0.18s ease, transform 0.18s ease;
}
tr:last-child td { border-bottom: none; }
tr:hover td {
    background: #f1f5f9;
}
tr:hover {
    box-shadow: inset 3px 0 0 var(--primary);
}

/* Alerts */
.alert {
    padding: 11px 15px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); color: #166534; border-color: #bbf7d0; }
.alert-error { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--info-soft); color: #075985; border-color: #bae6fd; }

/* Progress Bar */
.progress {
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
}

/* Filter bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}
.filter-bar .form-control { width: auto; min-width: 180px; }

/* Media & Asset Cards */
.asset-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface);
    display: flex;
    flex-direction: column;
}
.asset-thumb {
    height: 170px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.asset-thumb img, .asset-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.asset-body {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Modal */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 60;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal-box {
    background: var(--surface);
    border-radius: 12px;
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    padding: 20px;
}
.login-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

/* Responsive (Tablet & Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 35;
}
@media (max-width: 1024px) {
    .grid-4, .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-area { margin-left: 0; }
    .mobile-menu-btn { display: inline-flex; }
    .topbar { padding: 10px 14px; }
    .page-content { padding: 14px; }
    .grid-2, .grid-3, .grid-4, .grid-6, .form-grid {
        grid-template-columns: 1fr;
    }
    .filter-bar .form-control { width: 100%; }
}
