/* ═══════════════════════════════════════════════════
   Cinema KH — Design System & Global Styles
   ═══════════════════════════════════════════════════ */

:root {
    --bg-primary: #121212;
    --bg-secondary: #1a1a1a;
    --bg-card: #1E1E1E;
    --bg-card-hover: #282828;
    --bg-overlay: rgba(18, 18, 18, 0.85);

    --text-primary: #E0E0E0;
    --text-secondary: #A0A0A0;
    --text-muted: #606060;

    --accent: #BB86FC;
    --accent-hover: #CE93D8;
    --accent-legend: #FFC107;
    --accent-prime: #00BCD4;
    --accent-sabay: #4CAF50;

    --success: #4CAF50;
    --warning: #FFC107;
    --info: #2196F3;
    --danger: #F44336;

    --border: #303030;
    --border-light: #404040;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    font-feature-settings: 'tnum';
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── 3D Cinema Background ── */
#particleCanvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: -2;
    pointer-events: none;
    display: block;
    opacity: 0.35;
}

/* Veil between 3D background and content for readability */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: radial-gradient(ellipse at 50% 0%, transparent 0%, var(--bg-primary) 70%);
    z-index: -1;
    pointer-events: none;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }

/* ── Navbar ── */
.navbar {
    background: rgba(18, 18, 18, 0.85);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}
.navbar .container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    height: auto;
}
.nav-mobile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}
.nav-brand-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 0 8px rgba(187, 134, 252, 0.3));
}
.nav-brand-text {
    font-size: 1.15rem;
    font-weight: 800;
    background: linear-gradient(135deg, #E0E0E0 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}
.nav-hamburger {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 6px 12px;
    line-height: 1;
    transition: all .2s;
}
.nav-hamburger:hover { border-color: var(--accent); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.nav-main-links {
    display: flex;
    gap: 4px;
    align-items: center;
}
.nav-chain-links {
    display: flex;
    gap: 6px;
}
.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.nav-link {
    position: relative;
    padding: 8px 16px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
}
.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}
.nav-link.active {
    color: var(--accent);
    background: rgba(187, 134, 252, 0.1);
}

/* Chain brand nav links */
.nav-link-chain {
    font-size: 0.78rem;
    padding: 5px 14px;
    border-radius: var(--radius-full);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all .2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}
.nav-link-chain[data-chain="legend"] { border-color: rgba(255, 193, 7, 0.3); }
.nav-link-chain[data-chain="legend"]:hover { background: rgba(255, 193, 7, 0.1); border-color: #FFC107; color: #FFC107; }
.nav-link-chain[data-chain="legend"].active { background: rgba(255, 193, 7, 0.15); border-color: #FFC107; color: #FFC107; }
.nav-link-chain[data-chain="prime"] { border-color: rgba(0, 188, 212, 0.3); }
.nav-link-chain[data-chain="prime"]:hover { background: rgba(0, 188, 212, 0.1); border-color: #00BCD4; color: #00BCD4; }
.nav-link-chain[data-chain="prime"].active { background: rgba(0, 188, 212, 0.15); border-color: #00BCD4; color: #00BCD4; }
.nav-link-chain[data-chain="sabay"] { border-color: rgba(76, 175, 80, 0.3); }
.nav-link-chain[data-chain="sabay"]:hover { background: rgba(76, 175, 80, 0.1); border-color: #4CAF50; color: #4CAF50; }
.nav-link-chain[data-chain="sabay"].active { background: rgba(76, 175, 80, 0.15); border-color: #4CAF50; color: #4CAF50; }

/* Search */
.nav-search-input {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 7px 14px 7px 34px;
    color: var(--text-primary);
    font-size: 0.8rem;
    width: 160px;
    transition: all .2s;
    font-family: var(--font-sans);
}
.nav-search-input:focus { outline: none; width: 240px; border-color: var(--accent); }
.nav-search-input::placeholder { color: var(--text-muted); }
.nav-search-icon {
    position: absolute; left: 10px; top: 50%;
    transform: translateY(-50%); opacity: .4;
    pointer-events: none; font-size: 0.8rem;
}

/* Search results dropdown */
.search-results-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-top: 6px;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    backdrop-filter: blur(20px);
}
.search-results-dropdown:empty { display: none; }

/* Search result items */
.search-results-dropdown a {
    display: block;
    padding: 10px 14px;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: all .15s;
}
.search-results-dropdown a:hover {
    background: rgba(187,134,252,0.08);
    padding-left: 18px;
}

/* Keyboard focus indicator */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Smooth scroll for table containers */
.matrix-scroll { scroll-behavior: smooth; }

/* ── Hero ── */
.hero {
    position: relative;
    padding: var(--space-7) 0 var(--space-6);
    overflow: hidden;
}
.hero-content { margin-bottom: var(--space-6); }
.hero-title {
    font-size: 3.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-2);
    background: linear-gradient(135deg, #E0E0E0 0%, var(--accent) 50%, #CE93D8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}
.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}
.hero-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.hero-date-divider { color: var(--text-muted); margin: 0 4px; }
.hero-fill-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    max-width: 400px;
}
.hero-fill-track {
    flex: 1;
    height: 8px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 1px solid var(--border);
}
.hero-fill-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--warning));
    border-radius: var(--radius-full);
    transition: width 0.6s ease;
}
.hero-fill-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}
.hero-stat-icon {
    font-size: 1.4rem;
    margin-bottom: 4px;
    opacity: 0.8;
}
.hero-stats {
    display: flex;
    gap: var(--space-5);
    flex-wrap: wrap;
}
.hero-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 28px;
    min-width: 180px;
    flex: 1;
    transition: all .3s;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.hero-stat:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.hero-stat-value {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}
.hero-stat-value[data-stat="tickets"] { color: var(--success); }
.hero-stat-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    text-align: center;
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}
.card-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    font-weight: 600;
}

/* ── Glass cards ── */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: border-color .3s, box-shadow .3s;
}
.glass-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

/* ── Grid ── */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-5);
    margin: var(--space-5) 0;
    width: 100%;
}
.col-4 { flex: 1 1 calc(33.333% - 20px); min-width: 220px; }
.col-6 { flex: 1 1 calc(50% - 16px); min-width: 320px; }
.col-12 { flex: 0 0 100%; max-width: 100%; overflow: hidden; min-width: 0; }

/* ── Chart cards ── */
.chart-card h2 {
    font-size: 1rem;
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}
.chart-card h2::before {
    content: '';
    width: 4px;
    height: 18px;
    border-radius: 2px;
    background: var(--accent);
}
.chart-card canvas { max-height: 260px !important; }

/* ── Ticket Banner ── */
.ticket-banner {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    transition: border-color var(--transition);
}
.ticket-banner-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1;
}
.ticket-banner-right {
    display: flex;
    gap: 28px;
    text-align: center;
    flex-shrink: 0;
}
.ticket-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.ticket-stat-value.sold { color: var(--success); }
.ticket-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-top: 2px;
}

/* ── Matrix Table ── */
.matrix-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
}
.matrix-scroll::-webkit-scrollbar {
    height: 10px;
}
.matrix-scroll::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 5px;
}
.matrix-scroll::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 5px;
}
.matrix-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
.matrix-wrap {
    -webkit-overflow-scrolling: touch;
}

.matrix-table {
    border-collapse: collapse;
    min-width: 750px;
}
.matrix-table thead th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    padding: 12px 8px;
    text-align: center;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
    user-select: none;
    transition: color var(--transition-fast);
}
.matrix-table thead th.sortable { cursor: pointer; }
.matrix-table thead th.sortable:hover { color: var(--accent); }
.matrix-table thead th.sorted { color: var(--accent); }
.matrix-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 6;
    text-align: left;
    min-width: 150px;
    padding-left: 14px;
    background: var(--bg-secondary);
}
.matrix-table thead th.th-sold,
.matrix-table thead th.th-shows {
    color: var(--accent);
    font-size: 0.72rem;
}

.matrix-table tbody tr {
    transition: background .12s;
}
.matrix-table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}
.matrix-table tbody tr:hover td {
    background: var(--bg-card-hover);
}

.matrix-table td {
    padding: 8px 6px;
    font-size: 0.8rem;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid rgba(48, 48, 48, 0.4);
    transition: background .12s;
}

/* Movie title column — sticky left */
.matrix-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--bg-primary);
    text-align: left;
    min-width: 150px;
    max-width: 180px;
    padding-left: 14px;
    font-weight: 600;
}
.matrix-table tbody tr:nth-child(even) td:first-child {
    background: rgba(18, 18, 18, 0.98);
}
.matrix-table tbody tr:hover td:first-child {
    background: var(--bg-card-hover);
}
.matrix-table td:first-child a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all .15s;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}
.matrix-table td:first-child a:hover {
    color: var(--accent);
    border-bottom-color: rgba(187, 134, 252, 0.3);
}

.matrix-table td:nth-child(2) {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* Branch data cells — two-line layout */
.cell-show {
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.3;
}
.cell-hot .cell-show { color: var(--danger); }
.cell-warm .cell-show { color: var(--warning); }
.cell-cold .cell-show { color: var(--text-secondary); }
.cell-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    opacity: 0.4;
}

.cell-tix {
    margin-top: 2px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--success);
    line-height: 1;
}

/* Heat map background — gradient by intensity */
td.cell-hot { background: rgba(244, 67, 54, 0.08); }
td.cell-warm { background: rgba(255, 193, 7, 0.06); }
td.cell-cold { background: rgba(33, 150, 243, 0.04); }
tr:hover td.cell-hot { background: rgba(244, 67, 54, 0.14); }
tr:hover td.cell-warm { background: rgba(255, 193, 7, 0.10); }
tr:hover td.cell-cold { background: rgba(33, 150, 243, 0.08); }

/* Total columns */
.matrix-total-cell {
    font-weight: 700;
    font-size: 0.95rem;
    border-left: 2px solid var(--border);
    padding: 8px 12px;
}
.matrix-total-cell.sold { color: var(--success); }
.matrix-total-cell.shows { color: var(--accent); }

/* Matrix legend */
.matrix-legend {
    display: flex;
    gap: 20px;
    padding: 12px 16px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot {
    width: 12px; height: 12px;
    border-radius: 3px;
    display: inline-block;
}
.legend-dot.cell-hot { background: rgba(244, 67, 54, 0.3); border: 1px solid var(--danger); }
.legend-dot.cell-warm { background: rgba(255, 193, 7, 0.2); border: 1px solid var(--warning); }
.legend-dot.cell-cold { background: rgba(33, 150, 243, 0.15); border: 1px solid var(--info); }

/* Skeleton loaders */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; }
.skeleton-cell { height: 24px; width: 80%; margin: 0 auto; }
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-rank-row {
    height: 36px;
    margin: 8px 0;
    border-radius: var(--radius);
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ── Date Nav ── */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: var(--space-3) 0 var(--space-5);
}
.date-nav a {
    padding: 8px 18px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all .2s;
}
.date-nav a:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: rgba(187, 134, 252, 0.08);
}
.badge-date {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 120px;
    text-align: center;
}

/* ── Chain chips ── */
.chain-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin: 8px 0 4px; }
.chain-chip { display:inline-flex; align-items:center; gap:8px; padding:6px 14px; border-radius:9999px; background:var(--bg-card); border:1px solid var(--border); font-size:.78rem; font-weight:500; color:var(--text-secondary); }
.chain-chip .dot { width:8px; height:8px; border-radius:50%; }
.chain-chip strong { color:var(--text-primary); }
.chain-chip.is-all strong { font-size:.85rem; }
.dot-legend { background:#FFC107; box-shadow:0 0 6px rgba(255,193,7,0.4); }
.dot-prime { background:#00BCD4; box-shadow:0 0 6px rgba(0,188,212,0.4); }
.dot-sabay { background:#4CAF50; box-shadow:0 0 6px rgba(76,175,80,0.4); }

/* ── Pills filters ── */
.pills {
    display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.pill {
    padding: 7px 20px; border-radius: 9999px; border: 1px solid var(--border);
    background: transparent; color: var(--text-secondary);
    font-size: .85rem; font-weight: 500; cursor: pointer; font-family: inherit;
    transition: all .15s;
}
.pill:hover { background: rgba(255,255,255,.04); color: var(--text-primary); }
.pill.active { border-color: var(--accent); color: var(--accent); background: rgba(187,134,252,0.1); }
.pill[data-c="legend"].active { border-color: #FFC107; color: #FFC107; background: rgba(255,193,7,0.1); }
.pill[data-c="prime"].active  { border-color: #00BCD4; color: #00BCD4; background: rgba(0,188,212,0.1); }
.pill[data-c="sabay"].active  { border-color: #4CAF50; color: #4CAF50; background: rgba(76,175,80,0.1); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all var(--transition);
    text-decoration: none;
    background: none;
    color: inherit;
}
.btn-primary { background: var(--accent); color: #121212; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text-primary); border-color: var(--border-light); }

/* ── Data tables (sales/reports) ── */
.data-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.data-table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    gap: var(--space-3);
    flex-wrap: wrap;
}
.filter-input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    transition: border-color var(--transition);
}
.filter-input:focus { outline: none; border-color: var(--accent); }
.filter-input::placeholder { color: var(--text-muted); }
.data-table-info { font-size: 0.8rem; color: var(--text-muted); }

/* Branch filter bar (collapsible) */
.branch-filter-bar { position: relative; }
.branch-filter-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-primary);
    font-family: inherit;
    transition: all .2s;
    width: 100%;
    text-align: left;
}
.branch-filter-toggle:hover { border-color: var(--border-light); }
.branch-filter-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-left: auto;
}
.branch-filter-arrow { color: var(--text-muted); transition: transform .2s; }
.branch-filter-toggle.open .branch-filter-arrow { transform: rotate(180deg); }

.branch-filter-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 320px;
    overflow-y: auto;
}
.branch-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
    padding: 12px;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: all .15s;
}
.filter-chip:hover { border-color: var(--accent); color: var(--text-primary); }
.filter-chip input { accent-color: var(--accent); }

/* Showtime date tabs + pills (movie detail) */
.showtime-date-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.showtime-date-tab {
    padding: 6px 14px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    font-family: inherit;
}
.showtime-date-tab:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.showtime-date-tab.active {
    background: rgba(187,134,252,0.15);
    color: var(--accent);
    border-color: var(--accent);
}
.showtime-branch-filter { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.showtime-group { padding: 14px; border-bottom: 1px solid var(--border); }
.showtime-group:last-child { border-bottom: none; }
.showtime-group-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.showtime-group-count {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 600;
}
.showtime-group-times {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.showtime-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    transition: all .15s;
    cursor: default;
}
.showtime-pill:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.showtime-pill-time { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); font-family: var(--font-mono); }
.showtime-pill-fmt { font-size: 0.65rem; padding: 2px 6px; border-radius: var(--radius-sm); background: rgba(187,134,252,0.15); color: var(--accent); font-weight: 600; }
.showtime-pill-lang { font-size: 0.65rem; color: var(--text-muted); font-weight: 600; }

.sales-table { width: 100%; border-collapse: collapse; }
.sales-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    padding: 12px 14px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.sales-table td { padding: 14px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.sales-table tbody tr:hover td { background: var(--bg-card-hover); }
.sales-table .num { font-weight: 700; font-size: 1rem; }
.sales-table .tickets { font-size: 0.85rem; font-weight: 500; }
.sales-table .pct { font-size: 0.75rem; color: var(--text-secondary); }
.sales-table .title { text-align: left; font-weight: 600; }
.sales-table .title a { color: var(--text-primary); text-decoration: none; }
.sales-table .title a:hover { color: var(--accent); }

/* ── Movie grid ── */
.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-4);
    margin: var(--space-5) 0;
}
.movie-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
}
.movie-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.movie-card-poster {
    width: 100%;
    height: 280px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.movie-card-poster img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.movie-card-no-poster {
    font-size: 3rem;
    opacity: 0.2;
}
.movie-card-no-poster span { display: block; }
.movie-card-body { padding: var(--space-4); }
.movie-card-body h3 { font-size: 1rem; margin-bottom: 8px; font-weight: 700; }
.movie-card-body .meta { color: var(--text-secondary); font-size: 0.8rem; }

/* TBC rating pill */
.rating-tbc {
    background: rgba(160, 160, 160, 0.15);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ── Badges ── */
.badge { display: inline-block; padding: 3px 8px; border-radius: var(--radius-sm); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.badge-rating { background: rgba(187,134,252,0.15); color: var(--accent); }
.badge-sessions { background: rgba(76,175,80,0.15); color: var(--success); }

.rating-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}
.rating-g { background: rgba(76, 175, 80, 0.15); color: var(--success); border: 1px solid rgba(76, 175, 80, 0.3); }
.rating-nc15 { background: rgba(255, 193, 7, 0.15); color: var(--warning); border: 1px solid rgba(255, 193, 7, 0.3); }
.rating-r18 { background: rgba(244, 67, 54, 0.15); color: var(--danger); border: 1px solid rgba(244, 67, 54, 0.3); }
.rating-pg { background: rgba(33, 150, 243, 0.15); color: var(--info); border: 1px solid rgba(33, 150, 243, 0.3); }

/* ── Footer ── */
.footer {
    margin-top: var(--space-7);
    padding: var(--space-6) 0;
    border-top: 1px solid var(--border);
    background: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(10px);
}
.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 12px;
}
.footer-status {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 6px 12px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.footer-status time {
    color: var(--success);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

/* ── Typography ── */
h1 { font-size: 1.8rem; margin: var(--space-4) 0; font-weight: 700; }
h2 { font-size: 1.25rem; margin: var(--space-3) 0 var(--space-2); font-weight: 600; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Animations ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.4s ease forwards; }
.fade-in-stagger > * {
    opacity: 0;
    animation: fadeInUp 0.4s ease forwards;
}
.fade-in-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.fade-in-stagger > *:nth-child(2) { animation-delay: 0.10s; }
.fade-in-stagger > *:nth-child(3) { animation-delay: 0.15s; }
.fade-in-stagger > *:nth-child(4) { animation-delay: 0.20s; }
.fade-in-stagger > *:nth-child(5) { animation-delay: 0.25s; }
.fade-in-stagger > *:nth-child(6) { animation-delay: 0.30s; }

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: var(--space-5);
    right: var(--space-5);
    padding: var(--space-3) var(--space-5);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: fadeInUp 0.3s ease;
}

/* ── Light Theme ── */
[data-theme="light"] {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #eeeeee;
    --text-primary: #212121;
    --text-secondary: #757575;
    --text-muted: #9e9e9e;
    --border: #e0e0e0;
    --border-light: #bdbdbd;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
}
[data-theme="light"] .navbar { background: rgba(255,255,255,0.9); }
[data-theme="light"] .matrix-table tbody td:first-child { background: #f5f5f5; }
[data-theme="light"] .matrix-table tbody tr:nth-child(even) td:first-child { background: #fafafa; }
[data-theme="light"] .matrix-table tbody tr:hover td:first-child { background: var(--bg-card-hover); }
[data-theme="light"] .cell-cold .cell-show { color: #9e9e9e; }
[data-theme="light"] td.cell-hot { background: rgba(244, 67, 54, 0.03); }
[data-theme="light"] td.cell-warm { background: rgba(255, 193, 7, 0.02); }
[data-theme="light"] td.cell-cold { background: rgba(33, 150, 243, 0.02); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .container { padding: 0 14px; }

    /* Mobile matrix card view */
    .mobile-matrix-cards {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .mobile-movie-card {
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: 14px;
    }
    .mobile-movie-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
    }
    .mobile-movie-header a {
        font-weight: 700;
        font-size: 0.9rem;
        color: var(--text-primary);
        text-decoration: none;
    }
    .mobile-movie-totals {
        font-size: 0.75rem;
        color: var(--text-muted);
        white-space: nowrap;
    }
    .mobile-branch-list {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    .mobile-branch-chip {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 6px 10px;
        border-radius: var(--radius);
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        font-size: 0.75rem;
    }
    .mobile-branch-name { color: var(--text-secondary); font-weight: 600; }
    .mobile-branch-shows { color: var(--accent); font-weight: 700; }
    .mobile-branch-sold { color: var(--success); font-size: 0.7rem; }

    /* Hamburger nav */
    .nav-hamburger { display: block; }
    .nav-links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding: 12px 0 16px;
        gap: 8px;
        border-top: 1px solid var(--border);
    }
    .nav-links.open { display: flex; }
    .nav-main-links {
        justify-content: center;
        flex-wrap: wrap;
    }
    .nav-chain-links {
        justify-content: center;
        flex-wrap: wrap;
    }
    .nav-actions {
        justify-content: center;
        margin-left: 0;
        padding-top: 8px;
        border-top: 1px solid var(--border);
        flex-wrap: wrap;
    }
    .nav-link { font-size: 0.85rem; padding: 10px 14px; min-height: 44px; display: flex; align-items: center; }
    .nav-link-chain { font-size: 0.8rem; padding: 8px 16px; min-height: 44px; }
    .nav-search-input { width: 100%; min-width: 200px; }
    .nav-search-input:focus { width: 100%; }
    #searchResults { width: 100% !important; right: auto !important; left: 0 !important; }

    .hero { padding: var(--space-5) 0; }
    .hero-title { font-size: 1.8rem; }
    .hero-subtitle { font-size: 0.85rem; }
    .hero-stats { gap: var(--space-3); }
    .hero-stat { min-width: 100px; padding: 14px 16px; }
    .hero-stat-value { font-size: 2rem; }

    .col-4, .col-6 { flex: 1 1 100%; }
    .row { gap: var(--space-3); }

    .matrix-table td:first-child { min-width: 110px; max-width: 130px; font-size: 0.75rem; }
    .matrix-table thead th:first-child { min-width: 110px; }
    .matrix-table td { padding: 6px 3px; font-size: 0.7rem; }
    .matrix-table .cell-show { font-size: 0.72rem; }
    .matrix-total-cell { font-size: 0.78rem !important; }
    .matrix-table thead th { font-size: 0.6rem; padding: 8px 4px; }
    /* Movie column scrolls with table on mobile */
    .matrix-table thead th:first-child,
    .matrix-table tbody td:first-child {
        position: static;
    }

    .ticket-banner { flex-direction: column; align-items: flex-start; }
    .ticket-banner-left { width: 100%; }
    .ticket-banner-left select { max-width: 100% !important; width: 100%; }
    .ticket-banner-right { width: 100%; justify-content: space-around; }

    .date-nav { gap: 8px; flex-wrap: wrap; }
    .badge-date { font-size: 0.95rem; min-width: 100px; }
    .date-nav a { padding: 10px 16px; min-height: 44px; }

    .filter-input { width: 100%; }
    .data-table-toolbar { flex-direction: column; align-items: stretch; }
    .footer-row { flex-direction: column; text-align: center; }

    /* Ensure min touch targets */
    .btn { min-height: 44px; }
    .pill { min-height: 44px; display: inline-flex; align-items: center; }
}

@media (max-width: 480px) {
    .container { padding: 0 10px; }
    .hero-title { font-size: 1.4rem; }
    .hero-subtitle { font-size: 0.75rem; }
    .hero-stat { min-width: 80px; padding: 10px 12px; flex: 1 1 calc(50% - 8px); }
    .hero-stat-value { font-size: 1.5rem; }
    .hero-stat-label { font-size: 0.65rem; }
    .hero-stats { gap: var(--space-2); }

    .nav-brand-text { font-size: 1rem; }
    .nav-link { font-size: 0.78rem; padding: 8px 10px; min-height: 40px; }
    .nav-link-chain { font-size: 0.75rem; padding: 6px 12px; min-height: 40px; }

    .matrix-table td:first-child { min-width: 80px; max-width: 90px; font-size: 0.65rem; }
    .matrix-table thead th:first-child { min-width: 80px; }
    .matrix-table td { padding: 4px 2px; font-size: 0.6rem; }
    .matrix-table .cell-show { font-size: 0.65rem; }
    .matrix-total-cell { font-size: 0.7rem !important; }
    .matrix-table thead th { font-size: 0.5rem; padding: 6px 2px; }

    .badge-date { font-size: 0.85rem; min-width: 80px; }
    .date-nav a { font-size: 0.75rem; padding: 8px 12px; }

    .ticket-stat-value { font-size: 1.1rem; }
    .ticket-stat-label { font-size: 0.65rem; }
}
