/* =====================================================
   LAYARHUB DIGITAL SIGNAGE PLATFORM
   DESIGN SYSTEM v4.1 — PROFESSIONAL LIGHT
   Grayish body, white cards, dark sidebar
   No dark mode, no stickers, no emojis
===================================================== */

:root {
    /* Body & Surface */
    --bg-body: #F0F2F5;
    --bg-surface: #FFFFFF;
    --bg-surface-hover: #F7F8FA;
    --bg-elevated: #FFFFFF;
    --bg-muted: #F0F2F5;
    --bg-input: #FFFFFF;

    /* Sidebar */
    --bg-sidebar: #14171E;
    --bg-sidebar-hover: rgba(255,255,255,0.05);
    --bg-sidebar-active: rgba(255,255,255,0.09);
    --bg-sidebar-section: rgba(255,255,255,0.03);

    /* Text */
    --text-primary: #1A1D23;
    --text-secondary: #5F6B7A;
    --text-tertiary: #9CA3B0;
    --text-inverse: #FFFFFF;
    --text-sidebar-default: #6B7280;
    --text-sidebar-active: #F0F2F5;
    --text-sidebar-section: #4B5261;

    /* Borders */
    --border-default: #E3E6EB;
    --border-subtle: #EDEEF1;
    --border-sidebar: rgba(255,255,255,0.06);

    /* Brand — Indigo */
    --brand-50: #EEF2FF;
    --brand-100: #E0E7FF;
    --brand-500: #6366F1;
    --brand-600: #4F46E5;
    --brand-700: #4338CA;

    /* Semantic */
    --green-50: #ECFDF5;
    --green-600: #059669;
    --green-700: #047857;
    --red-50: #FEF2F2;
    --red-600: #DC2626;
    --red-700: #B91C1C;
    --amber-50: #FFFBEB;
    --amber-600: #D97706;
    --amber-700: #B45309;
    --sky-50: #F0F9FF;
    --sky-600: #0284C7;

    /* Layout */
    --sidebar-w: 260px;
    --header-h: 56px;

    /* Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(20,23,31,0.04);
    --shadow-sm: 0 1px 3px rgba(20,23,31,0.06), 0 1px 2px rgba(20,23,31,0.04);
    --shadow-md: 0 4px 6px -1px rgba(20,23,31,0.06), 0 2px 4px -2px rgba(20,23,31,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(20,23,31,0.06), 0 4px 6px -4px rgba(20,23,31,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(20,23,31,0.08), 0 8px 10px -6px rgba(20,23,31,0.04);

    /* Easing */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==============================
   RESET
============================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-body);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img, video { display: block; max-width: 100%; }
input, select, textarea { font-family: inherit; }

/* ==============================
   LAYOUT
============================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-area {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s var(--ease);
}

.content-area {
    flex: 1;
    padding: 24px 32px;
}

/* ==============================
   SIDEBAR
============================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s var(--ease);
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--border-sidebar);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 28px;
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-700) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.sidebar-brand-text {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-inverse);
    letter-spacing: -0.3px;
}

.sidebar-brand-text span {
    color: var(--brand-500);
}

.sidebar-nav {
    flex: 1;
    padding: 0 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sidebar-section {
    padding: 20px 12px 8px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-sidebar-section);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-sidebar-default);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s var(--ease);
    white-space: nowrap;
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.55;
    transition: opacity 0.15s var(--ease);
}

.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}

.sidebar-link:hover svg { opacity: 0.85; }

.sidebar-link.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    font-weight: 600;
}

.sidebar-link.active svg { opacity: 1; color: var(--brand-500); }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-sidebar);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--brand-600);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sidebar-active);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--text-sidebar-default);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-sidebar-default);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s var(--ease);
}

.sidebar-logout svg { width: 16px; height: 16px; }

.sidebar-logout:hover {
    background: rgba(220,38,38,0.12);
    color: #FCA5A5;
}

/* ==============================
   HEADER
============================== */
.header {
    height: var(--header-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger-btn {
    display: none;
    padding: 6px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.15s var(--ease);
}

.hamburger-btn:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.hamburger-btn svg { width: 20px; height: 20px; }

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.header-breadcrumb .separator { color: var(--text-tertiary); }
.header-breadcrumb .current { font-weight: 600; color: var(--text-primary); }
.header-breadcrumb .parent { color: var(--text-tertiary); }

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-search {
    position: relative;
    margin-right: 8px;
}

.header-search input {
    width: 220px;
    padding: 7px 12px 7px 34px;
    background: var(--bg-muted);
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: all 0.15s var(--ease);
}

.header-search input::placeholder { color: var(--text-tertiary); }

.header-search input:focus {
    border-color: var(--brand-500);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--brand-50);
    width: 280px;
}

.header-search svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.header-icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--text-secondary);
    transition: all 0.15s var(--ease);
}

.header-icon-btn:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.header-icon-btn svg { width: 18px; height: 18px; }

.header-icon-btn .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red-600);
    border: 2px solid var(--bg-surface);
}

.header-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--brand-600);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 600;
    margin-left: 4px;
    cursor: pointer;
}

/* ==============================
   PAGE HEADER
============================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.4px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ==============================
   STAT CARDS
============================== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-subtle);
    transition: all 0.2s var(--ease);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-default);
}

.stat-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg { width: 20px; height: 20px; }

.stat-icon.brand { background: var(--brand-50); color: var(--brand-600); }
.stat-icon.green { background: var(--green-50); color: var(--green-600); }
.stat-icon.red { background: var(--red-50); color: var(--red-600); }
.stat-icon.amber { background: var(--amber-50); color: var(--amber-600); }
.stat-icon.sky { background: var(--sky-50); color: var(--sky-600); }

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.stat-trend.up { background: var(--green-50); color: var(--green-600); }
.stat-trend.down { background: var(--red-50); color: var(--red-600); }
.stat-trend.neutral { background: var(--bg-muted); color: var(--text-tertiary); }
.stat-trend svg { width: 14px; height: 14px; }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==============================
   CARDS
============================== */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    margin-bottom: 20px;
    transition: border-color 0.2s var(--ease);
}

.card:hover { border-color: var(--border-default); }

.card-body { padding: 20px; }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-head .card-title { font-size: 15px; }

/* ==============================
   TABLES
============================== */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
    background: var(--bg-surface);
}

tbody td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

tbody tr { transition: background 0.1s var(--ease); }
tbody tr:hover { background: var(--bg-surface-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ==============================
   BUTTONS
============================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    transition: all 0.15s var(--ease);
    border: 1px solid transparent;
}

.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--brand-600); color: white; }
.btn-primary:hover { background: var(--brand-700); box-shadow: var(--shadow-sm); }

.btn-success { background: var(--green-600); color: white; }
.btn-success:hover { background: var(--green-700); }

.btn-danger { background: var(--red-600); color: white; }
.btn-danger:hover { background: var(--red-700); }

.btn-warning { background: var(--amber-600); color: white; }
.btn-warning:hover { background: var(--amber-700); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-default);
}
.btn-ghost:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-sm svg { width: 14px; height: 14px; }

.btn-lg { padding: 11px 20px; font-size: 14px; font-weight: 600; }

/* ==============================
   FORMS
============================== */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-label .required { color: var(--red-600); margin-left: 2px; }

.form-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="time"],
input[type="url"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: all 0.15s var(--ease);
}

input::placeholder, textarea::placeholder { color: var(--text-tertiary); }

input:focus, select:focus, textarea:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--brand-50);
}

input[type="checkbox"], input[type="radio"] {
    width: auto;
    accent-color: var(--brand-600);
}

.days-box { display: flex; gap: 8px; flex-wrap: wrap; }

.days-box label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s var(--ease);
}

.days-box label:hover { border-color: var(--brand-500); color: var(--brand-600); }

.days-box label:has(input:checked) {
    border-color: var(--brand-500);
    background: var(--brand-50);
    color: var(--brand-600);
}

/* ==============================
   BADGES
============================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-online { background: var(--green-50); color: var(--green-600); }
.badge-offline { background: var(--red-50); color: var(--red-600); }
.badge-active { background: var(--brand-50); color: var(--brand-600); }
.badge-warning { background: var(--amber-50); color: var(--amber-600); }
.badge-info { background: var(--sky-50); color: var(--sky-600); }
.badge-neutral { background: var(--bg-muted); color: var(--text-secondary); }

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.badge-online .badge-dot { animation: pulse-dot 2s ease-in-out infinite; }

/* ==============================
   MODALS
============================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20,23,31,0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.show { display: flex; }

.modal-box {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    width: 480px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modal-enter 0.2s var(--ease);
}

.modal-box.wide { width: 800px; }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal-body { padding: 20px 24px 24px; }

@keyframes modal-enter {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==============================
   TOAST NOTIFICATIONS
============================== */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 320px;
    max-width: 420px;
    pointer-events: auto;
    animation: toast-in 0.3s var(--ease);
    position: relative;
    overflow: hidden;
}

.toast.removing { animation: toast-out 0.2s var(--ease) forwards; }

.toast-icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.toast-success .toast-icon { color: var(--green-600); }
.toast-error .toast-icon { color: var(--red-600); }
.toast-warning .toast-icon { color: var(--amber-600); }
.toast-info .toast-icon { color: var(--sky-600); }

.toast-content { flex: 1; }

.toast-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.toast-message { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

.toast-close {
    padding: 2px;
    color: var(--text-tertiary);
    border-radius: 4px;
    flex-shrink: 0;
    transition: all 0.15s var(--ease);
}

.toast-close:hover { background: var(--bg-muted); color: var(--text-primary); }
.toast-close svg { width: 16px; height: 16px; }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--brand-500);
    opacity: 0.25;
    transition: width linear;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ==============================
   SKELETON LOADING
============================== */
.skeleton {
    background: var(--bg-muted);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.w-100 { width: 100%; }
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-25 { width: 25%; }

.skeleton-heading { height: 22px; width: 40%; margin-bottom: 16px; }

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

@keyframes skeleton-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ==============================
   ALERTS
============================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-success { background: var(--green-50); color: var(--green-600); }
.alert-error { background: var(--red-50); color: var(--red-600); }
.alert-warning { background: var(--amber-50); color: var(--amber-600); }
.alert-info { background: var(--sky-50); color: var(--sky-600); }

/* ==============================
   LOADING SPINNER
============================== */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    flex-direction: column;
    gap: 12px;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid var(--border-default);
    border-top-color: var(--brand-600);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.loading-state .loading-text { font-size: 13px; color: var(--text-tertiary); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ==============================
   EMPTY STATE
============================== */
.empty-state { text-align: center; padding: 60px 20px; }

.empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-state-text { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; }

/* ==============================
   MEDIA GRID
============================== */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.media-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    transition: all 0.2s var(--ease);
}

.media-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-default); }

.media-thumb {
    width: 100%;
    height: 140px;
    background: var(--bg-muted);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }

.media-body { padding: 12px; }

.media-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.media-meta { font-size: 12px; color: var(--text-tertiary); line-height: 1.5; }
.media-actions { margin-top: 10px; display: flex; gap: 6px; }

/* ==============================
   PLAYLIST BUILDER
============================== */
.builder-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0;
}

.builder-column {
    background: var(--bg-muted);
    border-radius: var(--radius);
    padding: 16px;
}

.builder-column-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.media-select-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s var(--ease);
    margin-bottom: 6px;
}

.media-select-item:hover { box-shadow: var(--shadow-sm); }

.media-select-item img {
    width: 56px;
    height: 42px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.media-select-item-name {
    flex: 1;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    transition: all 0.15s var(--ease);
}

.playlist-item:hover { box-shadow: var(--shadow-sm); }

.playlist-item-num {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 600;
    width: 20px;
    flex-shrink: 0;
}

.playlist-item-name {
    flex: 1;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-item input[type="number"] {
    width: 52px;
    padding: 4px 6px;
    text-align: center;
    font-size: 12px;
}

/* ==============================
   FILTER BAR
============================== */
.filter-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.filter-bar input { flex: 1; min-width: 200px; }
.filter-bar select { width: auto; min-width: 160px; }

/* ==============================
   UPLOAD PROGRESS
============================== */
.upload-progress {
    width: 100%;
    height: 4px;
    background: var(--bg-muted);
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background: var(--brand-600);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s var(--ease);
}

/* ==============================
   CODE DISPLAY
============================== */
.code-display {
    background: var(--bg-muted);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.code-display-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--brand-600);
    letter-spacing: 4px;
    font-family: "SF Mono", "Fira Code", monospace;
}

.code-display-label { font-size: 12px; color: var(--text-tertiary); margin-bottom: 8px; }

/* ==============================
   DEVICE INFO BOX
============================== */
.device-info-box {
    background: var(--bg-muted);
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.device-info-box strong { color: var(--text-primary); font-weight: 600; }

.device-info-box .value {
    font-weight: 600;
    color: var(--text-primary);
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 12px;
}

/* ==============================
   STORAGE BAR
============================== */
.storage-bar-wrap { margin-bottom: 10px; }

.storage-bar {
    height: 10px;
    background: var(--bg-muted);
    border-radius: 20px;
    overflow: hidden;
}

.storage-bar-fill {
    height: 100%;
    background: var(--brand-600);
    border-radius: 20px;
    transition: width 0.5s var(--ease);
}

.storage-bar-fill.warning { background: var(--amber-600); }
.storage-bar-fill.danger { background: var(--red-600); }

.storage-info { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-secondary); }

/* ==============================
   QUICK ACTIONS
============================== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: all 0.2s var(--ease);
    gap: 8px;
}

.quick-action:hover { box-shadow: var(--shadow-md); border-color: var(--brand-500); color: var(--brand-600); }
.quick-action strong { font-size: 13px; font-weight: 600; }
.quick-action span { font-size: 12px; color: var(--text-tertiary); }

/* ==============================
   REMOTE CONTROL
============================== */
.remote-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.remote-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s var(--ease);
}

.remote-btn svg { width: 24px; height: 24px; }
.remote-btn.span-full { grid-column: 1 / -1; }

/* ==============================
   LOGIN PAGE
============================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}

.login-logo { text-align: center; margin-bottom: 32px; }

.login-logo-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-700) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(79,70,229,0.3);
}

.login-logo-icon svg { width: 32px; height: 32px; color: white; }

.login-logo h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.login-logo h1 span { color: var(--brand-600); }

.login-logo p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-tertiary);
    border-bottom: 2px solid transparent;
    transition: all 0.15s var(--ease);
}

.auth-tab:hover { color: var(--text-primary); }

.auth-tab.active {
    color: var(--brand-600);
    border-bottom-color: var(--brand-600);
    font-weight: 600;
}

.auth-panel { display: none; }
.auth-panel.active { display: block; }

.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-secondary); }
.auth-footer a { color: var(--brand-600); font-weight: 500; }
.auth-footer a:hover { text-decoration: underline; }

/* ==============================
   PLAYER SCREEN
============================== */
.player-screen {
    width: 100vw;
    height: 100dvh;
    background: #000;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
}

.player-screen > img,
.player-screen > video { width: 100%; height: 100%; display: block; }

.player-screen.mode-cover > img,
.player-screen.mode-cover > video { object-fit: cover; }

.player-screen.mode-contain > img,
.player-screen.mode-contain > video { object-fit: contain; }

.player-screen.mode-stretch > img,
.player-screen.mode-stretch > video { object-fit: fill; }

.player-screen .fade-enter { animation: player-fade 1s ease-in-out; }

@keyframes player-fade { from { opacity: 0; } to { opacity: 1; } }

.player-status {
    position: fixed;
    top: 16px;
    right: 16px;
    background: rgba(5,150,105,0.9);
    color: white;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    z-index: 9999;
}

.player-error {
    color: white;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
}

.player-error h2 { font-size: 42px; font-weight: 700; margin-bottom: 16px; color: var(--brand-500); letter-spacing: -1px; }
.player-error p { font-size: 18px; opacity: 0.7; margin-bottom: 24px; }

.player-error button {
    background: #1E293B;
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s var(--ease);
}

.player-error button:hover { background: rgba(255,255,255,0.1); }

/* ==============================
   ANIMATIONS
============================== */
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ==============================
   SCROLLBAR
============================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ==============================
   UTILITIES
============================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-mono { font-family: "SF Mono", "Fira Code", monospace; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex-grow: 1; }
.shrink-0 { flex-shrink: 0; }

.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hidden { display: none !important; }

code {
    background: var(--bg-muted);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 12px;
    color: var(--text-primary);
}

/* ==============================
   SIDEBAR OVERLAY (MOBILE)
============================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20,23,31,0.5);
    z-index: 99;
}

.sidebar-overlay.show { display: block; }

/* ==============================
   RESPONSIVE
============================== */
@media (max-width: 1024px) {
    .builder-grid { grid-template-columns: 1fr; }
    .modal-box.wide { width: 95%; }
    .header-search input { width: 180px; }
    .header-search input:focus { width: 220px; }
}

@media (max-width: 768px) {
    .hamburger-btn { display: flex; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
    .content-area { padding: 20px 16px; }
    .header { padding: 0 16px; }
    .page-title { font-size: 20px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .stats-row { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar input, .filter-bar select { width: 100%; }
    .header-search { display: none; }
    .media-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* ==============================
   ACCESSIBILITY
============================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}