/* ═══════════════════════════════════════════════════════════════
   Matik Content Script — Design System v2
   Font: Plus Jakarta Sans · Architecture: dark sidebar + card UI
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
    /* Brand */
    --primary:       #2563EB;
    --primary-d:     #1D4ED8;
    --primary-l:     #EFF6FF;
    --primary-glow:  rgba(37,99,235,.14);

    /* Semantic */
    --success:  #059669;
    --warning:  #D97706;
    --danger:   #DC2626;
    --info:     #0891B2;

    /* Surface */
    --bg:          #F2F5FB;
    --card:        #FFFFFF;
    --surface-alt: #F8FAFD;
    --surface-2:   #F0F4FF;

    /* Text */
    --text:        #111827;
    --text-muted:  #6B7280;
    --text-faint:  #9CA3AF;

    /* Border */
    --border:   rgba(17,24,39,.07);
    --border-m: rgba(17,24,39,.12);

    /* Sidebar */
    --sidebar-w:    256px;
    --sidebar-bg1:  #0f0e2a;
    --sidebar-bg2:  #1a1650;
    --sidebar-bg3:  #0f0e2a;
    --sb-text:      rgba(255,255,255,.55);
    --sb-text-h:    rgba(255,255,255,.90);
    --sb-active:    rgba(255,255,255,.12);
    --sb-active-bd: rgba(255,255,255,.20);

    /* Topbar */
    --topbar-h: 60px;

    /* Radii */
    --r-xs:   6px;
    --r-sm:   10px;
    --r:      16px;
    --r-lg:   20px;
    --r-xl:   26px;
    --r-pill: 9999px;

    /* Shadows */
    --sh-xs: 0 1px 3px rgba(0,0,0,.05);
    --sh-sm: 0 2px 8px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --sh:    0 4px 20px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
    --sh-md: 0 8px 32px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.05);
    --sh-lg: 0 20px 56px rgba(0,0,0,.13), 0 6px 18px rgba(0,0,0,.07);

    /* Transition */
    --ease: cubic-bezier(.4,0,.2,1);
}

/* ── Base ───────────────────────────────────────────────────── */
body {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Topbar (mobile) ────────────────────────────────────────── */
.topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(16px) saturate(1.8);
    -webkit-backdrop-filter: blur(16px) saturate(1.8);
    border-bottom: 1px solid var(--border);
    z-index: 1030; display: none;
    box-shadow: var(--sh-sm);
}
@media (max-width: 991px) { .topbar { display: block; } }

.topbar-inner {
    display: flex; align-items: center;
    height: 100%; padding: 0 20px; gap: 14px;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* Hamburger */
.sidebar-toggle {
    background: none; border: none; padding: 6px; cursor: pointer;
    display: flex; flex-direction: column; gap: 5px; border-radius: var(--r-sm);
    transition: background .15s;
}
.sidebar-toggle:hover { background: var(--border); }
.sidebar-toggle span {
    display: block; width: 22px; height: 2px;
    background: var(--text); border-radius: var(--r-pill);
    transition: .2s;
}

/* ── Brand ──────────────────────────────────────────────────── */
.brand-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #3B82F6, #6366F1);
    color: #fff; font-weight: 800; font-size: 17px;
    flex-shrink: 0; box-shadow: 0 4px 12px rgba(99,102,241,.35);
    letter-spacing: -.5px;
}
.brand-name {
    font-weight: 700; font-size: 15px; color: var(--text);
    letter-spacing: -.2px;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg,
        var(--sidebar-bg1) 0%,
        var(--sidebar-bg2) 50%,
        var(--sidebar-bg3) 100%);
    display: flex; flex-direction: column;
    z-index: 1020; transition: transform .28s var(--ease);
    overflow-y: auto; overflow-x: hidden;
}

/* Subtle shimmer stripe on sidebar */
.sidebar::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at 30% 20%,
        rgba(99,102,241,.18) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 80%,
        rgba(37,99,235,.12) 0%, transparent 55%);
    pointer-events: none;
}

.sidebar-header {
    display: flex; align-items: center; gap: 11px;
    padding: 26px 22px 22px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    position: relative;
}
.sidebar-header .brand-name {
    color: #fff; font-size: 16px;
    font-weight: 800; letter-spacing: -.3px;
}

.sidebar-nav { padding: 14px 12px; flex: 1; position: relative; }

.nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 14px; border-radius: 12px;
    color: var(--sb-text); text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: background .18s var(--ease), color .18s var(--ease);
    margin-bottom: 3px; position: relative;
}
.nav-link:hover {
    background: var(--sb-active);
    color: var(--sb-text-h);
}
.nav-link.active {
    background: var(--sb-active);
    color: #fff; font-weight: 600;
    box-shadow: inset 0 0 0 1px var(--sb-active-bd);
}
.nav-link.active::before {
    content: '';
    position: absolute; left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%; border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, #60A5FA, #818CF8);
}
.nav-link-danger { color: rgba(252,165,165,.7) !important; }
.nav-link-danger:hover {
    background: rgba(239,68,68,.15) !important;
    color: #FCA5A5 !important;
}
.nav-icon {
    width: 22px; text-align: center; font-size: 16px;
    flex-shrink: 0; opacity: .8;
}
.nav-link.active .nav-icon,
.nav-link:hover .nav-icon { opacity: 1; }

.nav-group-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .1em; color: rgba(255,255,255,.28);
    padding: 14px 14px 5px;
}
.sidebar-divider {
    border-top: 1px solid rgba(255,255,255,.08);
    margin: 10px 0;
}

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); top: var(--topbar-h); }
    .sidebar.open { transform: translateX(0); }
}
.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 1010; display: none;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh; background: var(--bg);
    flex: 1;
}
.content-inner {
    padding: 36px 32px;
    max-width: 1240px;
}

@media (max-width: 991px) {
    .main-content { margin-left: 0; padding-top: calc(var(--topbar-h) + 4px); }
    .content-inner { padding: 20px 16px; }
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: flex-start;
    justify-content: space-between;
    gap: 16px; margin-bottom: 32px; flex-wrap: wrap;
}
.page-title {
    font-size: 24px; font-weight: 800;
    margin: 0; letter-spacing: -.4px;
    color: var(--text);
}
.page-subtitle {
    color: var(--text-muted); font-size: 14px;
    margin: 3px 0 0; font-weight: 400;
}

/* ── Cards (base) ───────────────────────────────────────────── */
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--r); box-shadow: var(--sh-sm);
}
.card-body { padding: 22px; }
.card-header {
    padding: 18px 22px; border-bottom: 1px solid var(--border);
    font-weight: 600; font-size: 14px;
    background: transparent; border-radius: var(--r) var(--r) 0 0;
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px; margin-bottom: 32px;
}
@media (max-width: 767px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 400px) { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
    background: var(--card);
    border-radius: var(--r-lg);
    padding: 22px 22px 20px;
    box-shadow: var(--sh);
    border: 1px solid var(--border);
    position: relative; overflow: hidden;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sh-md);
}
/* Colored top stripe */
.stat-card::before {
    content: ''; position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    background: var(--border-m);
}
.stat-card.primary::before { background: linear-gradient(90deg, #2563EB, #6366F1); }
.stat-card.success::before { background: linear-gradient(90deg, #059669, #34D399); }
.stat-card.warning::before { background: linear-gradient(90deg, #D97706, #FBBF24); }
.stat-card.danger::before  { background: linear-gradient(90deg, #DC2626, #F87171); }

/* Decorative blob */
.stat-card::after {
    content: ''; position: absolute;
    top: -18px; right: -18px;
    width: 80px; height: 80px; border-radius: 50%;
    opacity: .06;
    background: var(--text);
}
.stat-card.primary::after { background: #2563EB; opacity: .12; }
.stat-card.success::after { background: #059669; opacity: .12; }
.stat-card.warning::after { background: #D97706; opacity: .12; }
.stat-card.danger::after  { background: #DC2626; opacity: .12; }

.stat-label {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-faint); margin-bottom: 8px;
}
.stat-value {
    font-size: 36px; font-weight: 800; color: var(--text);
    line-height: 1; letter-spacing: -.8px;
}
.stat-card.primary .stat-value { color: var(--primary); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger  .stat-value { color: var(--danger);  }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: var(--r-pill);
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
}
.badge-tofu      { background: #DBEAFE; color: #1D4ED8; }
.badge-mofu      { background: #FEF3C7; color: #92400E; }
.badge-bofu      { background: #D1FAE5; color: #065F46; }
.badge-draft     { background: #F1F5F9; color: #475569; }
.badge-ready     { background: #DBEAFE; color: #1E40AF; }
.badge-shooting  { background: #FEF3C7; color: #92400E; }
.badge-published { background: #D1FAE5; color: #065F46; }
.badge-archived  { background: #F1F5F9; color: #94A3B8; }

/* ── Script Cards ───────────────────────────────────────────── */
.script-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 18px;
}

.script-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px;
    box-shadow: var(--sh-sm);
    display: flex; flex-direction: column;
    transition: box-shadow .22s var(--ease), transform .22s var(--ease);
    position: relative; overflow: hidden;
}
.script-card::before {
    content: ''; position: absolute;
    top: 0; left: 0; bottom: 0; width: 4px;
    border-radius: var(--r-lg) 0 0 var(--r-lg);
    background: var(--border-m);
}
.script-card:hover {
    box-shadow: var(--sh-md);
    transform: translateY(-3px);
}
.script-card:has([value="video"]) .script-card::before,
.script-card-type-video::before { background: linear-gradient(180deg, #3B82F6, #6366F1); }

.script-card-top {
    display: flex; gap: 7px;
    margin-bottom: 14px; align-items: center;
    flex-wrap: wrap;
}
.script-card-title {
    font-size: 15px; font-weight: 700; color: var(--text);
    margin-bottom: 10px; line-height: 1.45;
    letter-spacing: -.15px;
}
.script-card-excerpt {
    font-size: 13px; color: var(--text-muted); margin-bottom: 14px;
    flex: 1; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    line-height: 1.6;
}
.script-card-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }
.script-card-footer { margin-top: auto; padding-top: 14px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    border-radius: var(--r-sm);
    font-weight: 600; font-size: 14px;
    transition: all .18s var(--ease);
    letter-spacing: -.1px;
}
.btn-primary {
    background: linear-gradient(135deg, #2563EB, #4F46E5);
    border: none; color: #fff;
    box-shadow: 0 4px 14px rgba(37,99,235,.35);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #1D4ED8, #4338CA);
    box-shadow: 0 6px 20px rgba(37,99,235,.45);
    transform: translateY(-1px); color: #fff;
}
.btn-primary:active { transform: translateY(0); }
.btn-outline-secondary {
    border-color: var(--border-m); color: var(--text-muted);
    background: var(--card);
}
.btn-outline-secondary:hover {
    background: var(--surface-alt);
    border-color: var(--border-m); color: var(--text);
}
.btn-outline-primary {
    border-color: var(--primary); color: var(--primary);
    background: transparent;
}
.btn-outline-primary:hover {
    background: var(--primary-l); color: var(--primary);
}
.btn-outline-danger {
    border-color: rgba(220,38,38,.3); color: var(--danger);
    background: transparent;
}
.btn-outline-danger:hover {
    background: #FEF2F2; border-color: var(--danger); color: var(--danger);
}
.btn-lg { padding: 13px 26px; font-size: 15px; border-radius: var(--r); }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-icon { padding: 5px 9px; font-size: 12px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-label {
    font-weight: 600; font-size: 13.5px;
    margin-bottom: 7px; color: var(--text);
    letter-spacing: -.1px;
}
.form-control, .form-select {
    border: 1.5px solid var(--border-m);
    border-radius: var(--r-sm);
    padding: 11px 15px; font-size: 14px;
    background: var(--card); color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
}
.form-control::placeholder { color: var(--text-faint); }
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    outline: none; background: var(--card);
}
.form-control-sm, .form-select-sm {
    padding: 8px 12px; font-size: 13px;
    border-radius: var(--r-xs);
}
textarea.form-control { resize: vertical; line-height: 1.6; }
.font-mono { font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace; }

.form-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 28px; margin-bottom: 22px;
    box-shadow: var(--sh-xs);
}
.form-section-title {
    font-size: 12px; font-weight: 700; color: var(--text-faint);
    text-transform: uppercase; letter-spacing: .1em;
    margin-bottom: 20px; padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

/* ── Scene Builder ──────────────────────────────────────────── */
.scenes-list { display: flex; flex-direction: column; gap: 18px; }

.scene-block {
    background: var(--surface-alt);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    transition: box-shadow .15s;
}
.scene-block:hover { box-shadow: var(--sh-sm); }
.scene-block-header {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}
.scene-block-num {
    font-size: 11px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .1em;
    color: var(--primary); margin-right: 10px;
}
.scene-block-body {
    padding: 18px; display: flex;
    flex-direction: column; gap: 14px;
}
.scene-field-label {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-muted); margin-bottom: 5px;
}

/* ── Filter Bar ─────────────────────────────────────────────── */
.filter-bar {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 16px 20px;
    margin-bottom: 16px;
    display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
    box-shadow: var(--sh-xs);
}
.filter-bar .form-control,
.filter-bar .form-select { max-width: 200px; }
@media (max-width: 575px) {
    .filter-bar { flex-direction: column; }
    .filter-bar .form-control,
    .filter-bar .form-select { max-width: 100%; width: 100%; }
}

/* ── Format Chips ───────────────────────────────────────────── */
.format-chips {
    display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.format-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 16px; border-radius: var(--r-pill);
    font-size: 13px; font-weight: 600;
    border: 1.5px solid var(--border-m);
    color: var(--text-muted); text-decoration: none;
    background: var(--card);
    transition: all .16s var(--ease);
    box-shadow: var(--sh-xs);
}
.format-chip:hover {
    border-color: var(--primary);
    color: var(--primary); background: var(--primary-l);
}
.format-chip.active {
    background: linear-gradient(135deg, #2563EB, #4F46E5);
    border-color: transparent; color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
    border-radius: var(--r); border: none;
    font-size: 14px; padding: 14px 18px;
    font-weight: 500;
}
.alert-success { background: #ECFDF5; color: #065F46; }
.alert-danger   { background: #FEF2F2; color: #991B1B; }
.alert-info     { background: #EFF6FF; color: #1E40AF; }
.alert-warning  { background: #FFFBEB; color: #92400E; }

/* ── Tables ─────────────────────────────────────────────────── */
.table { font-size: 14px; }
.table th {
    font-weight: 700; color: var(--text-faint);
    font-size: 11px; text-transform: uppercase;
    letter-spacing: .07em; border-bottom-width: 1px;
}

/* ── View/Detail Page ───────────────────────────────────────── */
.script-detail-header {
    background: linear-gradient(135deg, #1D4ED8 0%, #6366F1 60%, #8B5CF6 100%);
    color: #fff; border-radius: var(--r-xl);
    padding: 36px 36px 32px;
    margin-bottom: 24px;
    box-shadow: 0 12px 40px rgba(37,99,235,.28);
    position: relative; overflow: hidden;
}
.script-detail-header::before {
    content: '';
    position: absolute; top: -60px; right: -60px;
    width: 220px; height: 220px; border-radius: 50%;
    background: rgba(255,255,255,.06);
    pointer-events: none;
}
.script-detail-header::after {
    content: '';
    position: absolute; bottom: -40px; left: 30%;
    width: 160px; height: 160px; border-radius: 50%;
    background: rgba(255,255,255,.04);
    pointer-events: none;
}
.script-detail-title {
    font-size: 26px; font-weight: 800;
    margin: 14px 0 20px; line-height: 1.35;
    letter-spacing: -.4px;
}
.detail-meta-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
    position: relative;
}
@media (max-width: 767px) { .detail-meta-grid { grid-template-columns: repeat(2, 1fr); } }

.detail-meta-item .meta-label {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em;
    opacity: .65; margin-bottom: 3px;
}
.detail-meta-item .meta-value { font-size: 14px; font-weight: 700; }

/* ── Scene Display (view.php) ───────────────────────────────── */
.scene-display {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden; margin-bottom: 16px;
    box-shadow: var(--sh-xs);
    transition: box-shadow .18s;
}
.scene-display:hover { box-shadow: var(--sh); }
.scene-display-header {
    background: linear-gradient(135deg, #0F172A, #1E293B);
    color: #fff; padding: 13px 22px;
    display: flex; align-items: center; gap: 14px;
}
.scene-num {
    font-size: 11px; font-weight: 800;
    letter-spacing: .12em; opacity: .5;
}
.scene-type-label {
    font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    color: #FCD34D;
}
.scene-display-body { padding: 22px; }
.scene-field { margin-bottom: 22px; }
.scene-field:last-child { margin-bottom: 0; }
.scene-field-name {
    font-size: 10px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .1em;
    color: var(--text-faint); margin-bottom: 9px;
    padding-bottom: 7px;
    border-bottom: 1.5px solid var(--border);
}
.scene-field-content {
    font-size: 15px; line-height: 1.75; color: var(--text);
}
.scene-field-content p { margin: 0 0 8px; }
.scene-field-content p:last-child { margin-bottom: 0; }

/* Copy button */
.btn-copy {
    border: 1.5px solid var(--border-m); background: var(--surface-alt);
    color: var(--text-muted); font-size: 12px; padding: 4px 12px;
    border-radius: var(--r-pill); cursor: pointer;
    transition: all .15s var(--ease); font-weight: 600;
    font-family: inherit;
}
.btn-copy:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-copy.copied { background: var(--success); color: #fff; border-color: var(--success); }

/* ── Action Bar ─────────────────────────────────────────────── */
.action-bar {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 16px 22px;
    margin-bottom: 24px;
    display: flex; gap: 10px;
    flex-wrap: wrap; align-items: center;
    box-shadow: var(--sh-xs);
}

/* ── Share / WA Buttons ─────────────────────────────────────── */
.btn-share-wa {
    background: linear-gradient(135deg, #25D366, #128C7E);
    border: none; color: #fff;
    box-shadow: 0 4px 12px rgba(37,211,102,.3);
}
.btn-share-wa:hover {
    background: linear-gradient(135deg, #1EBE5A, #0E7A6E);
    color: #fff; box-shadow: 0 6px 18px rgba(37,211,102,.4);
}
.btn-copy-link {
    background: linear-gradient(135deg, #2563EB, #4F46E5);
    border: none; color: #fff; font-weight: 700;
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
}
.btn-copy-link:hover {
    background: linear-gradient(135deg, #1D4ED8, #4338CA);
    color: #fff;
}

/* ── Progress ───────────────────────────────────────────────── */
.progress-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px; margin-bottom: 24px;
    box-shadow: var(--sh-xs);
}
.progress-title { font-weight: 700; margin-bottom: 14px; font-size: 15px; }
.progress {
    border-radius: var(--r-pill);
    height: 8px; background: var(--surface-2);
    overflow: hidden;
}
.progress-bar {
    background: linear-gradient(90deg, #2563EB, #6366F1);
    border-radius: var(--r-pill); transition: width .4s var(--ease);
}
.scene-checklist {
    list-style: none; padding: 0; margin: 14px 0 0;
    display: flex; flex-wrap: wrap; gap: 8px;
}
.scene-checklist li label {
    display: flex; align-items: center; gap: 7px;
    font-size: 13px; cursor: pointer;
    padding: 6px 13px; border-radius: var(--r-pill);
    border: 1.5px solid var(--border-m);
    background: var(--surface-alt);
    transition: all .15s var(--ease); font-weight: 500;
}
.scene-checklist li label:has(input:checked) {
    background: var(--primary-l);
    border-color: var(--primary); color: var(--primary);
    font-weight: 600;
}

/* ── Shooting Mode ──────────────────────────────────────────── */
.shooting-mode-overlay {
    display: none; position: fixed; inset: 0;
    background: #080818; z-index: 9999;
    overflow-y: auto; padding: 24px 0;
}
.shooting-mode-overlay.active { display: block; }
.shooting-scene-card {
    background: linear-gradient(135deg, #1E293B, #0F172A);
    border-radius: var(--r-xl);
    border: 1px solid rgba(255,255,255,.07);
    margin: 0 auto 20px; max-width: 620px; padding: 28px;
    color: #fff; box-shadow: var(--sh-lg);
}
.shooting-num {
    font-size: 11px; font-weight: 800;
    letter-spacing: .12em; color: #64748B;
}
.shooting-type {
    font-size: 20px; font-weight: 800;
    color: #FCD34D; margin: 7px 0 18px;
    letter-spacing: -.3px;
}
.shooting-dialog {
    font-size: 19px; line-height: 1.85; color: #F1F5F9;
    font-weight: 400;
}
.shooting-dialog p { margin: 0 0 14px; }
.shooting-dialog p:last-child { margin: 0; }
.shooting-copy-btn {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,.15);
    color: rgba(255,255,255,.5);
    padding: 10px 20px; border-radius: var(--r-pill);
    font-size: 13px; cursor: pointer;
    margin-top: 20px; width: 100%;
    transition: all .15s var(--ease); font-family: inherit; font-weight: 600;
}
.shooting-copy-btn:hover {
    background: var(--primary); border-color: var(--primary);
    color: #fff;
}
.shooting-exit-btn {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    color: #fff; border: none;
    padding: 12px 24px; border-radius: var(--r-pill);
    font-weight: 700; cursor: pointer;
    width: 100%; margin-bottom: 20px;
    max-width: 620px; display: block;
    margin-left: auto; margin-right: auto;
    font-size: 15px; font-family: inherit;
    box-shadow: 0 4px 16px rgba(220,38,38,.35);
    transition: box-shadow .15s, transform .15s;
}
.shooting-exit-btn:hover {
    box-shadow: 0 6px 20px rgba(220,38,38,.45);
    transform: translateY(-1px);
}

/* ── Login Page ─────────────────────────────────────────────── */
.login-page {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    background: linear-gradient(135deg, #EEF2FF 0%, #F0F4FF 50%, #F5F3FF 100%);
    padding: 24px;
}
.login-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 52px 44px;
    width: 100%; max-width: 420px;
    box-shadow: var(--sh-lg);
}
.login-brand { text-align: center; margin-bottom: 36px; }
.login-brand-logo {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, #2563EB, #6366F1);
    border-radius: 18px; display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 28px; font-weight: 800; color: #fff;
    margin-bottom: 14px;
    box-shadow: 0 8px 24px rgba(99,102,241,.35);
}
.login-brand-name { font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -.4px; }
.login-brand-sub  { font-size: 13px; color: var(--text-muted); margin-top: 5px; }

/* ── Category Manager ───────────────────────────────────────── */
.category-list { list-style: none; padding: 0; margin: 0; }
.category-item {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 12px 4px; border-bottom: 1px solid var(--border);
}
.category-item:last-child { border-bottom: none; }

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
    text-align: center; padding: 72px 24px;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 52px; margin-bottom: 14px; opacity: .7; }
.empty-state-title {
    font-size: 20px; font-weight: 800;
    color: var(--text); margin-bottom: 8px;
    letter-spacing: -.3px;
}

/* ── Dark Mode ──────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:          #0D1117;
        --card:        #161B22;
        --surface-alt: #1C2330;
        --surface-2:   #1A2030;
        --text:        #E6EDF3;
        --text-muted:  #8B949E;
        --text-faint:  #6E7681;
        --border:      rgba(240,246,252,.08);
        --border-m:    rgba(240,246,252,.13);
        --primary-l:   rgba(37,99,235,.15);
        --primary-glow:rgba(37,99,235,.2);
    }
}
[data-theme="dark"] {
    --bg:          #0D1117;
    --card:        #161B22;
    --surface-alt: #1C2330;
    --surface-2:   #1A2030;
    --text:        #E6EDF3;
    --text-muted:  #8B949E;
    --text-faint:  #6E7681;
    --border:      rgba(240,246,252,.08);
    --border-m:    rgba(240,246,252,.13);
    --primary-l:   rgba(37,99,235,.15);
    --primary-glow:rgba(37,99,235,.2);
}
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: var(--surface-alt); color: var(--text);
    border-color: var(--border-m);
}
[data-theme="dark"] .form-control::placeholder { color: var(--text-faint); }
[data-theme="dark"] .script-detail-header::before,
[data-theme="dark"] .script-detail-header::after { opacity: .04; }
[data-theme="dark"] .stat-card::after { opacity: .08; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 575px) {
    .page-header { flex-direction: column; }
    .action-bar  { flex-direction: column; }
    .action-bar .btn { width: 100%; text-align: center; }
    .detail-meta-grid { grid-template-columns: repeat(2, 1fr); }
    .script-detail-header { padding: 24px 20px; }
    .script-detail-title { font-size: 22px; }
    .form-section { padding: 20px; }
    .login-box { padding: 36px 24px; }
}

/* ── Utility ────────────────────────────────────────────────── */
.ms-auto { margin-left: auto !important; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-danger { color: var(--danger) !important; }
.text-muted  { color: var(--text-muted) !important; }
.fw-bold { font-weight: 700 !important; }
.fw-800  { font-weight: 800 !important; }
.d-flex  { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.w-100 { width: 100%; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-auto { margin-top: auto; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-m); border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }
