/* KNKYX 3VIERTEL – Light Amber Theme
   Social Publishing & Campaign Engine
   Version: 1.0.0
*/

:root {
    --primary:         #f59e0b;
    --primary-hover:   #d97706;
    --primary-light:   #fef3c7;
    --primary-dark:    #92400e;
    --primary-text:    #78350f;

    --bg-base:         #fffbf0;
    --bg-white:        #ffffff;
    --bg-secondary:    #fef9ec;
    --bg-tertiary:     #fef3c7;

    --border:          #e7e5e4;
    --border-light:    #f5f5f4;
    --border-focus:    #f59e0b;

    --text-primary:    #1c1917;
    --text-secondary:  #57534e;
    --text-muted:      #a8a29e;
    --text-inverted:   #ffffff;

    --green:           #16a34a;
    --green-light:     #dcfce7;
    --green-text:      #166534;

    --blue:            #2563eb;
    --blue-light:      #dbeafe;
    --blue-text:       #1e40af;

    --red:             #dc2626;
    --red-light:       #fee2e2;
    --red-text:        #991b1b;

    --orange:          #ea580c;
    --orange-light:    #ffedd5;
    --orange-text:     #9a3412;

    --purple:          #7c3aed;
    --purple-light:    #ede9fe;
    --purple-text:     #5b21b6;

    --gray:            #6b7280;
    --gray-light:      #f3f4f6;
    --gray-text:       #374151;

    --amber:           #f59e0b;
    --amber-light:     #fef3c7;
    --amber-text:      #78350f;

    --shadow-sm:       0 1px 2px rgba(0,0,0,0.05);
    --shadow:          0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:       0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg:       0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);

    --radius-sm:       4px;
    --radius:          8px;
    --radius-md:       12px;
    --radius-lg:       16px;
    --radius-full:     9999px;

    --sidebar-width:   260px;
    --topbar-height:   60px;
    --transition:      150ms ease;
}

/* ─── Reset & Base ─────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ─── Layout Shell ─────────────────────────────────────────────────────────── */

.tv-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: auto;
    min-height: 100vh;
}

.tv-sidebar {
    grid-column: 1;
    grid-row: 1 / span 2;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.tv-topbar {
    grid-column: 2;
    height: var(--topbar-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.tv-content {
    grid-column: 2;
    padding: 24px;
    min-height: calc(100vh - var(--topbar-height));
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────── */

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: var(--text-inverted);
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.sidebar-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-subtitle {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 4px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 8px 20px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 0;
    transition: background var(--transition), color var(--transition);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary-text);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

/* ─── Topbar ───────────────────────────────────────────────────────────────── */

.topbar-breadcrumb {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.user-avatar {
    width: 30px;
    height: 30px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

/* ─── Page Layout ──────────────────────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.page-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ─── Cards ────────────────────────────────────────────────────────────────── */

.card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-secondary);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

/* ─── KPI Grid ─────────────────────────────────────────────────────────────── */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.kpi-icon {
    font-size: 20px;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.kpi-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.kpi-change {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}

.kpi-change.up   { color: var(--green); }
.kpi-change.down { color: var(--red); }

.kpi-card.amber  { border-top: 3px solid var(--primary); }
.kpi-card.green  { border-top: 3px solid var(--green); }
.kpi-card.blue   { border-top: 3px solid var(--blue); }
.kpi-card.purple { border-top: 3px solid var(--purple); }
.kpi-card.red    { border-top: 3px solid var(--red); }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    outline: none;
}

.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--primary);
    color: var(--text-inverted);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--text-inverted);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--border-focus);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.btn-success {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}
.btn-success:hover { background: #15803d; color: #fff; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-secondary); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 24px; font-size: 15px; }
.btn-icon { padding: 7px; gap: 0; }
.btn-full { width: 100%; justify-content: center; }

button.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ─── Badges ───────────────────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-gray   { background: var(--gray-light);   color: var(--gray-text); }
.badge-green  { background: var(--green-light);  color: var(--green-text); }
.badge-blue   { background: var(--blue-light);   color: var(--blue-text); }
.badge-red    { background: var(--red-light);    color: var(--red-text); }
.badge-orange { background: var(--orange-light); color: var(--orange-text); }
.badge-purple { background: var(--purple-light); color: var(--purple-text); }
.badge-amber  { background: var(--amber-light);  color: var(--amber-text); }

/* Platform badges */
.badge-instagram { background: #fce7f3; color: #9d174d; }
.badge-twitter   { background: #e0f2fe; color: #0369a1; }
.badge-facebook  { background: #dbeafe; color: #1d4ed8; }
.badge-linkedin  { background: #dbeafe; color: #1e40af; }
.badge-tiktok    { background: #f0fdf4; color: #166534; }
.badge-bluesky   { background: #e0f2fe; color: #075985; }
.badge-mastodon  { background: #ede9fe; color: #5b21b6; }

/* ─── Alerts ───────────────────────────────────────────────────────────────── */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-icon { flex-shrink: 0; font-size: 16px; }
.alert-success { background: var(--green-light);  color: var(--green-text);  border: 1px solid #bbf7d0; }
.alert-error   { background: var(--red-light);    color: var(--red-text);    border: 1px solid #fecaca; }
.alert-warning { background: var(--amber-light);  color: var(--amber-text);  border: 1px solid #fde68a; }
.alert-info    { background: var(--blue-light);   color: var(--blue-text);   border: 1px solid #bfdbfe; }

/* ─── Forms ────────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-control {
    display: block;
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control  { cursor: pointer; }

.form-control:disabled, .form-control[readonly] {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* ─── Table ────────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr:hover { background: var(--bg-secondary); }

.table td.muted { color: var(--text-muted); font-size: 12px; }

.table-actions { display: flex; gap: 4px; align-items: center; }

/* ─── Empty State ──────────────────────────────────────────────────────────── */

.empty-state {
    padding: 40px 20px;
    text-align: center;
}

.empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.empty-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

/* ─── Breadcrumb ───────────────────────────────────────────────────────────── */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 20px;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumb a:hover { color: var(--primary); }

.breadcrumb-sep { color: var(--border); }

.breadcrumb-current { color: var(--text-primary); font-weight: 600; }

/* ─── Post Card ────────────────────────────────────────────────────────────── */

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.post-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: box-shadow var(--transition), border-color var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.post-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.post-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.post-brand-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}

.brand-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.post-content-preview {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-channels {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.post-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* ─── Calendar ─────────────────────────────────────────────────────────────── */

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-header {
    padding: 8px 4px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.cal-cell {
    min-height: 82px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    position: relative;
    transition: background var(--transition);
}

.cal-cell:hover { background: var(--bg-secondary); }

.cal-cell.today { border-color: var(--primary); background: var(--primary-light); }
.cal-cell.other-month { background: var(--bg-base); }

.cal-day {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.cal-cell.today .cal-day {
    color: var(--primary-dark);
    font-weight: 800;
}

.cal-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cal-event {
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 3px;
    background: var(--primary-light);
    color: var(--primary-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    text-decoration: none;
    display: block;
    font-weight: 600;
}

.cal-event.published { background: var(--green-light); color: var(--green-text); }
.cal-event.scheduled { background: var(--blue-light);  color: var(--blue-text); }
.cal-event.draft     { background: var(--gray-light);  color: var(--gray-text); }
.cal-event.failed    { background: var(--red-light);   color: var(--red-text); }

/* ─── Platform Chips ───────────────────────────────────────────────────────── */

.platform-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.platform-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-white);
    color: var(--text-secondary);
}

.platform-chip:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
    background: var(--primary-light);
}

.platform-chip.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ─── Tabs ─────────────────────────────────────────────────────────────────── */

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    gap: 0;
}

.tab-item {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition);
    text-decoration: none;
}

.tab-item:hover { color: var(--text-primary); text-decoration: none; }

.tab-item.active {
    color: var(--primary-dark);
    border-bottom-color: var(--primary);
}

/* ─── Campaign Phase ───────────────────────────────────────────────────────── */

.phase-track {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.phase-item {
    flex: 1;
    padding: 14px 16px;
    text-align: center;
    position: relative;
    transition: background var(--transition);
}

.phase-item + .phase-item {
    border-left: 1px solid var(--border);
}

.phase-item.active {
    background: var(--primary-light);
}

.phase-icon { font-size: 18px; margin-bottom: 4px; }
.phase-name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.phase-item.active .phase-name { color: var(--primary-dark); }

/* ─── Pagination ───────────────────────────────────────────────────────────── */

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    padding: 16px 0;
}

.page-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid var(--border);
    transition: all var(--transition);
    background: var(--bg-white);
}

.page-item:hover { border-color: var(--primary); color: var(--primary-dark); text-decoration: none; }
.page-item.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-item.disabled { opacity: 0.4; pointer-events: none; }

/* ─── Modal ────────────────────────────────────────────────────────────────── */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    display: none;
}

.modal-backdrop.open { display: flex; }

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 540px;
    width: 100%;
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 15px; font-weight: 700; }

.modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.modal-close:hover { background: var(--bg-secondary); color: var(--text-primary); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ─── Filter Bar ───────────────────────────────────────────────────────────── */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.filter-bar .form-control {
    flex: 1;
    min-width: 180px;
}

.filter-bar select.form-control { max-width: 160px; flex: 0 0 auto; }

/* ─── Queue / Timeline ─────────────────────────────────────────────────────── */

.queue-item {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    gap: 16px;
    align-items: start;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}

.queue-item:last-child { border-bottom: none; }
.queue-item:hover { background: var(--bg-secondary); }

.queue-time { font-size: 12px; font-weight: 700; color: var(--text-muted); text-align: right; }
.queue-brand-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 2px; }

/* ─── Media Library ────────────────────────────────────────────────────────── */

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.media-item {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: border-color var(--transition);
    position: relative;
    aspect-ratio: 1;
}

.media-item:hover { border-color: var(--primary); }
.media-item.selected { border-color: var(--primary); }

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-item-meta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.5));
    font-size: 10px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    margin-bottom: 20px;
}

.media-upload-zone:hover,
.media-upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* ─── Analytics ────────────────────────────────────────────────────────────── */

.chart-placeholder {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
}

/* ─── Text Utilities ───────────────────────────────────────────────────────── */

.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary   { color: var(--text-primary); }
.text-success   { color: var(--green); }
.text-danger    { color: var(--red); }
.text-warning   { color: var(--orange); }
.text-amber     { color: var(--primary-dark); }
.text-sm        { font-size: 12px; }
.text-xs        { font-size: 11px; }
.font-bold      { font-weight: 700; }
.font-medium    { font-weight: 600; }

/* ─── Layout Utilities ─────────────────────────────────────────────────────── */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end  { justify-content: flex-end; }
.gap-4   { gap: 4px; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.gap-20  { gap: 20px; }
.mt-8    { margin-top: 8px; }
.mt-12   { margin-top: 12px; }
.mt-16   { margin-top: 16px; }
.mt-20   { margin-top: 20px; }
.mb-16   { margin-bottom: 16px; }
.mb-20   { margin-bottom: 20px; }
.mb-24   { margin-bottom: 24px; }
.p-16    { padding: 16px; }
.p-20    { padding: 20px; }
.w-full  { width: 100%; }

/* ─── Scrollbar ────────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Login Page ───────────────────────────────────────────────────────────── */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    padding: 20px;
}

.login-box {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo-mark {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-weight: 900;
    font-size: 18px;
    color: #fff;
    letter-spacing: -1px;
}

.login-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .tv-shell {
        grid-template-columns: 1fr;
    }

    .tv-sidebar {
        position: fixed;
        left: -100%;
        z-index: 200;
        width: var(--sidebar-width);
        transition: left 0.25s ease;
    }

    .tv-sidebar.open { left: 0; }

    .tv-topbar, .tv-content {
        grid-column: 1;
    }

    .tv-content { padding: 16px; }

    .form-row { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
}
