/* ============================================================
   2DBalls Studio — Menu UI v2 (chỉ làm đẹp, không đổi logic/ID)
   ============================================================ */
:root {
    --bg: #0f1017;
    --bg-soft: #171826;
    --bg-card: #1c1e30;
    --bg-hover: #23253a;
    --border: #2c2e42;
    --border-strong: #3a3d55;
    --text: #d4d6e0;
    --text-muted: #8b8ea3;
    --text-strong: #ffffff;
    --accent: #5b8cff;
    --accent-2: #8b5bff;
    --accent-bg: #1f2f5e;
    --danger: #ff6b6b;
    --danger-bg: #5c1f1f;
    --success: #6fe3a0;
    --radius: 14px;
    --radius-sm: 9px;
    --touch-min: 44px;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
    --grad: linear-gradient(135deg, #1a2340 0%, #101120 50%, #1c1630 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Tahoma, sans-serif;
    font-size: 15px;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

.screen { width: 100%; height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

/* ============================================================
   LOGIN — nền gradient + glow
   ============================================================ */
#login-screen {
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(91, 140, 255, 0.22), transparent 60%),
        radial-gradient(ellipse 60% 40% at 90% 110%, rgba(139, 91, 255, 0.15), transparent 60%),
        var(--grad);
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(23, 24, 38, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 40px 32px;
    text-align: center;
    box-shadow: var(--shadow), 0 0 60px rgba(91, 140, 255, 0.08);
    animation: popIn 0.4s ease;
}
@keyframes popIn {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo {
    font-size: 60px;
    margin-bottom: 10px;
    display: inline-block;
    filter: drop-shadow(0 6px 18px rgba(91, 140, 255, 0.35));
}
.login-card h1 {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(90deg, #fff, #a8c4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}
.login-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card input {
    width: 100%;
    min-height: var(--touch-min);
    padding: 12px 16px;
    background: #12131d;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    color: var(--text-strong);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.login-card input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.15);
}
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; text-align: center; }
.login-info { margin-top: 12px; padding: 10px 14px; border-radius: 8px; font-size: 13px; background: rgba(111, 227, 160, 0.1); color: #6fe3a0; border: 1px solid rgba(111, 227, 160, 0.3); text-align: center; }
.login-field-wrap { text-align: left; }
.login-field-label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; display: block; }
.login-otp-banner { background: rgba(91, 140, 255, 0.1); border: 1px solid rgba(91, 140, 255, 0.25); border-radius: 10px; padding: 12px; display: flex; align-items: center; gap: 12px; margin-bottom: 16px; text-align: left; }
.otp-banner-icon { font-size: 24px; flex-shrink: 0; }
.otp-banner-text { font-size: 13px; color: var(--text); line-height: 1.4; }
.otp-banner-text b { color: #8ab4ff; }
.login-otp-input { font-size: 28px !important; letter-spacing: 12px !important; text-align: center !important; font-family: monospace, monospace !important; font-weight: 800 !important; color: #6fe3a0 !important; }
.login-otp-timer { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; text-align: center; }
.login-otp-timer b { color: #ffa940; }
.login-otp-actions { display: flex; justify-content: space-between; margin-top: 12px; gap: 8px; }

/* ============================================================
   BUTTONS — gradient + bóng đẹp
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    background: #262839;
    color: var(--text);
    min-height: 38px;
    padding: 8px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    white-space: nowrap;
    user-select: none;
    transition: all 0.18s;
}
.btn:hover { background: #30334a; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.3); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary {
    background: linear-gradient(135deg, var(--accent-bg), #2a3f7a);
    border-color: rgba(91, 140, 255, 0.5);
    color: var(--text-strong);
    box-shadow: 0 4px 16px rgba(91, 140, 255, 0.2);
}
.btn.primary:hover { background: linear-gradient(135deg, #26417e, #334d92); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(255,255,255,0.06); }
.btn.big { width: 100%; min-height: 50px; padding: 12px; font-size: 16px; margin-top: 12px; border-radius: 12px; }
.btn.danger { background: var(--danger-bg); border-color: #8a3a3a; color: var(--danger); }

/* ============================================================
   TOPBAR — glass
   ============================================================ */
.topbar {
    background: rgba(20, 21, 32, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 18px;
    min-height: 58px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}
.brand {
    font-weight: 800;
    font-size: 18px;
    color: var(--text-strong);
    white-space: nowrap;
    letter-spacing: 0.3px;
}
.brand .b-logo { margin-right: 4px; }
.brand .brand-sub { display: none; font-weight: 400; }
.version-badge-mobile {
    font-size: 11px;
    font-weight: 700;
    color: #6fe3a0;
    background: rgba(111, 227, 160, 0.16);
    border: 1px solid rgba(111, 227, 160, 0.35);
    padding: 2px 7px;
    border-radius: 6px;
    margin-left: 6px;
    vertical-align: middle;
    display: inline-block;
    letter-spacing: 0.2px;
}
.tabs { display: flex; gap: 6px; flex: 1; min-width: 0; }
.tab {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    min-height: 40px;
    padding: 8px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.18s;
}
.tab:hover { background: rgba(255,255,255,0.06); color: var(--text-strong); }
.tab.active {
    background: linear-gradient(135deg, var(--accent-bg), #2a3f7a);
    border-color: rgba(91, 140, 255, 0.5);
    color: var(--text-strong);
    box-shadow: 0 2px 12px rgba(91, 140, 255, 0.25);
}
/* Tab link Quản lí Weapon — màu vàng đặc trưng */
a.tab[href*="weapon-manager"] {
    color: #fbbf24;
    display: inline-flex;
    align-items: center;
}
a.tab[href*="weapon-manager"]:hover {
    background: rgba(251,191,36,0.12);
    color: #fcd34d;
    border-color: rgba(251,191,36,0.35);
}
.topbar-right { display: flex; gap: 8px; align-items: center; }
.header-session-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 14px;
    background: rgba(111, 227, 160, 0.1);
    border: 1px solid rgba(111, 227, 160, 0.25);
    color: #6fe3a0;
    font-weight: 600;
    font-family: monospace;
    white-space: nowrap;
}
.session-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6fe3a0;
    box-shadow: 0 0 6px #6fe3a0;
}

/* ============================================================
   PANELS
   ============================================================ */
.tab-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 22px;
    display: none;
    box-sizing: border-box;
}
.tab-panel.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.muted { color: var(--text-muted); font-size: 13px; }

/* ============================================================
   CARDS / GRID
   ============================================================ */
.card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
}
.card h3 { color: var(--text-strong); font-size: 15px; margin-bottom: 14px; }

.card-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

/* khoảng cách giữa folder list và project list bên dưới */
#folder-list { margin-bottom: 18px; }
#video-projects-view #folder-list:not(:empty) + #project-list { margin-top: 4px; }

.project-card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
}
.project-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    opacity: 0;
    transition: opacity 0.2s;
}
.project-card:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 16px rgba(91, 140, 255, 0.15);
}
.project-card:hover::before { opacity: 1; }
.project-card .pc-name {
    font-weight: 700; color: var(--text-strong); font-size: 15px;
    margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-card .pc-meta { color: var(--text-muted); font-size: 12px; margin-bottom: 14px; }
.project-card .pc-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.project-card .pc-actions .btn {
    padding: 7px 8px;
    font-size: 12px;
    font-weight: 500;
    justify-content: center;
    border-radius: var(--radius-sm);
}
.project-card .pc-actions .btn[data-act="open"] {
    grid-column: 1 / -1;
    font-weight: 700;
    font-size: 13px;
    padding: 9px 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border: none;
    box-shadow: 0 2px 10px var(--accent-bg);
}
.project-card .pc-actions .btn[data-act="videos"] {
    color: #ffd700;
    border-color: rgba(255, 215, 0, 0.25);
}

/* folder cards */
.folder-card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(8px);
}
.folder-card:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 16px rgba(91, 140, 255, 0.15);
}
.folder-card .fc-icon { font-size: 34px; filter: drop-shadow(0 4px 10px rgba(91,140,255,0.25)); }
.folder-card .fc-name { font-weight: 700; color: var(--text-strong); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-card .fc-meta { color: var(--text-muted); font-size: 12px; margin-bottom: 12px; }
.folder-card .pc-actions { display: flex; gap: 6px; }
.folder-card .pc-actions .btn { flex: 1; min-width: 60px; padding: 7px 10px; font-size: 12px; font-weight: 500; border-radius: var(--radius-sm); }

/* guide modal */
.guide-md { font-size: 13px; color: var(--text); line-height: 1.7; }
.guide-md h1 { font-size: 20px; color: var(--text-strong); margin: 14px 0 8px; }
.guide-md h2 { font-size: 16px; color: var(--text-strong); margin: 14px 0 6px; }
.guide-md h3 { font-size: 14px; color: var(--text-strong); margin: 10px 0 4px; }
.guide-md p { margin: 6px 0; }
.guide-md li { margin: 3px 0 3px 18px; }
.guide-md blockquote { border-left: 3px solid var(--accent); padding: 6px 12px; background: rgba(91,140,255,0.08); margin: 8px 0; border-radius: 4px; }
.guide-md pre { background: #0e0f16; padding: 10px 12px; border-radius: 6px; overflow-x: auto; margin: 8px 0; font-size: 12px; border: 1px solid var(--border); }
.guide-md code { font-family: Consolas, monospace; }
.guide-md .md-row { display: flex; border-bottom: 1px solid var(--border); }
.guide-md .md-row:first-child { font-weight: 600; color: var(--text-strong); }
.guide-md .md-cell { flex: 1; padding: 4px 8px; }
.guide-md .md-gap { height: 6px; }

/* modal overlay */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(8, 9, 14, 0.7);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}
.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    padding: 22px;
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    animation: popIn 0.25s ease;
}
.modal-box h3 { margin: 0 0 14px; color: var(--text-strong); }
.modal-box label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 12px; }
.modal-box input, .modal-box textarea, .modal-box select {
    width: 100%;
    background: #12131d;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-box input:focus, .modal-box textarea:focus, .modal-box select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.12);
}
.modal-box textarea { resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-actions button {
    background: #2a2c40;
    border: 1px solid var(--border-strong);
    color: var(--text);
    padding: 9px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.modal-actions button:hover { background: #363950; }
.modal-actions button.primary { background: linear-gradient(135deg, var(--accent-bg), #2a3f7a); border-color: rgba(91,140,255,0.5); }

@media (max-width: 700px) {
    .modal-box { width: 100%; max-width: 100%; }
}

/* ============================================================
   RENDER SETUP
   ============================================================ */
.render-layout { max-width: 960px; margin: 0 auto; }
.render-project-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--bg-card);
    transition: border-color 0.15s, background 0.15s;
}
.render-project-row:hover { border-color: var(--accent); background: var(--bg-hover); }
.render-project-row input[type="checkbox"] {
    width: 22px; height: 22px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0;
}
.render-project-row .r-name { flex: 1; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.render-project-row label { color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.render-project-row input[type="number"] {
    width: 72px; min-height: 36px;
    background: #12131d; border: 1px solid var(--border-strong); color: var(--text-strong);
    border-radius: 6px; padding: 4px 8px; font-size: 15px;
}
.render-options { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.opt-row { display: flex; flex-direction: column; gap: 5px; flex: 1 1 220px; }
.opt-row label { color: var(--text-muted); font-size: 13px; }
.opt-row input, .opt-row select {
    width: 100%; min-height: var(--touch-min);
    background: #12131d; border: 1px solid var(--border-strong); color: var(--text-strong);
    border-radius: 8px; padding: 10px 12px; font-size: 15px;
}

/* ============================================================
   RENDER QUEUE
   ============================================================ */
.render-queue-list { margin-top: 18px; }
.task-list { max-height: 60vh; overflow-y: auto; }
.task-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 8px;
    background: var(--bg-card);
    transition: border-color 0.15s;
}
.task-item:hover { border-color: var(--border-strong); }
.task-item .t-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.task-item .t-name { font-weight: 600; color: var(--text-strong); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.task-item .t-status { font-size: 12px; padding: 4px 10px; border-radius: 6px; background: #333; white-space: nowrap; }
.t-status.queued { background: #3a3d55; color: #ccc; }
.t-status.compiling, .t-status.simulating { background: #2f4a2a; color: #a8e6a0; }
.t-status.rendering { background: #1f3d55; color: #8fd0e6; }
.t-status.completed { background: #1f5c2f; color: var(--success); }
.t-status.error { background: var(--danger-bg); color: #ff9a9a; }
.task-item .t-bar { height: 8px; background: #262838; border-radius: 4px; overflow: hidden; position: relative; }
.task-item .t-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
/* shimmer effect khi dang render */
.task-item .t-fill.rendering::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
/* pulse glow khi dang active */
.task-item .t-status.active-pulse {
    animation: pulse-glow 1.5s ease-in-out infinite;
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 4px rgba(33,150,243,0.3); }
    50% { box-shadow: 0 0 12px rgba(33,150,243,0.6); }
}
/* khong dung fadeSlideIn cho task-item — rebuild DOM moi poll lam no blink.
   Chi giu shimmer + pulse + smooth width (controller, khong blink) */
.task-item .t-foot {
    display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 8px;
    font-size: 13px; color: var(--text-muted);
}
.task-item .t-foot a { color: var(--accent); cursor: pointer; text-decoration: none; }
.task-item .t-error { color: #ff9a9a; font-size: 12px; margin-top: 4px; word-break: break-word; }
.task-item .cancel-btn {
    margin-left: auto;
    background: var(--danger-bg);
    border: 1px solid #8a3a3a;
    color: var(--danger);
    min-height: 34px;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.15s;
}
.task-item .cancel-btn:hover { background: #7a2a2a; color: #fff; }
.task-item .delete-btn { background: #3a2a20; border: 1px solid #6a5520; color: #e6c65a; min-height: 34px; padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; font-family: inherit; transition: all 0.15s; margin-left: 6px; }
.task-item .delete-btn:hover { background: #5a4a2a; color: #fff; }

.empty-note { color: #777; text-align: center; padding: 34px 0; font-style: italic; }

/* ============================================================
   VIDEO FILTER
   ============================================================ */
.video-card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.18s;
}
.video-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.35); }
.vc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vc-title { font-weight: 600; color: var(--text-strong); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.vc-rank { font-size: 12px; color: #ffd700; background: rgba(0,0,0,0.4); padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.vc-video { width: 100%; background: #000; border-radius: 6px; overflow: hidden; }
.vc-video video { width: 100%; height: 100%; display: block; background: #000; }
.vc-stats { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #aaa; }
.vc-score { color: #ffd700; font-weight: 600; }
.vc-line b { color: var(--text); }
.vc-line { overflow-wrap: anywhere; }
.vc-actions { display: flex; gap: 8px; }
.vc-actions .btn { flex: 1; min-height: 40px; }
.vc-actions .yt-btn { background: #3a1a1a; color: #ff6b6b; border: 1px solid #5a2020; }
.vc-actions .yt-btn:hover { background: #5a1a1a; color: #ff9999; }

/* scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #343650; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #4a4d70; }

/* ============================================================
   SAFE AREA
   ============================================================ */
@supports (padding: env(safe-area-inset-top)) {
    body { padding-top: env(safe-area-inset-top); }
    #app-screen, #login-screen { padding-bottom: env(safe-area-inset-bottom); }
}

/* ============================================================
   RESPONSIVE — TABLET
   ============================================================ */
@media (max-width: 1024px) {
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .tab-panel { padding: 16px; }
}

/* ============================================================
   RESPONSIVE — MOBILE (< 768px)
   ============================================================ */
@media (max-width: 768px) {
    body { font-size: 14px; }

    /* Topbar & Tab bar */
    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 12px 6px 12px;
        min-height: 0;
        background: rgba(18, 19, 29, 0.95);
    }
    .brand {
        font-size: 16px;
        text-align: center;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .brand .brand-sub { display: none; }
    .topbar-right { display: none; }
    
    .tabs {
        order: 3;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 6px 0 2px 0;
    }
    .tab {
        width: 100%;
        min-height: 40px;
        padding: 8px 6px;
        font-size: 13px;
        font-weight: 600;
        text-align: center;
        justify-content: center;
        white-space: nowrap;
        border-radius: 9px;
        box-sizing: border-box;
    }

    /* Tab Panel tổng thể */
    .tab-panel {
        padding: 12px 10px calc(24px + env(safe-area-inset-bottom, 16px)) 10px;
    }

    /* Toolbar tab Projects */
    .panel-toolbar {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 14px;
    }
    .panel-toolbar .btn {
        flex: 1 1 calc(50% - 4px);
        min-height: 40px;
        padding: 8px 10px;
        font-size: 13px;
        justify-content: center;
    }
    .panel-toolbar #btn-folder-root {
        flex: 0 0 auto;
    }
    .panel-toolbar #project-count,
    .panel-toolbar #video-count {
        width: 100%;
        text-align: right;
        font-size: 12px;
        margin-top: 2px;
    }

    /* Thư viện video (Video Library View) */
    #video-library-view .panel-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    #video-library-view .panel-toolbar .btn {
        width: 100%;
        min-height: 40px;
    }
    #video-library-title {
        text-align: center;
        margin: 4px 0;
        font-size: 15px;
    }

    /* Project Cards & Folder Cards */
    .card-grid { grid-template-columns: 1fr; gap: 12px; }

    .project-card { padding: 14px; }
    .project-card .pc-name { font-size: 15px; }
    .project-card .pc-actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .project-card .pc-actions .btn[data-act="open"] {
        grid-column: 1 / -1;
        min-height: 44px;
        font-weight: 700;
        font-size: 14px;
    }
    .project-card .pc-actions .btn[data-act="videos"] {
        grid-column: 1 / -1;
        min-height: 38px;
        font-size: 13px;
        font-weight: 600;
        background: rgba(255, 215, 0, 0.15);
        border-color: rgba(255, 215, 0, 0.35);
        color: #ffd700;
    }
    .project-card .pc-actions .btn {
        min-height: 38px;
        font-size: 12.5px;
        padding: 6px 8px;
    }

    .folder-card { padding: 14px; }
    .folder-card .pc-actions { display: flex; gap: 6px; }
    .folder-card .pc-actions .btn { min-height: 38px; font-size: 12.5px; }

    /* Tab Render: Project selector & options */
    .render-layout { max-width: 100%; }
    .render-project-row {
        padding: 10px 12px;
        gap: 8px;
        flex-direction: column;
        align-items: flex-start;
    }
    .render-project-row .r-name {
        width: 100%;
        white-space: normal;
        word-break: break-all;
        font-size: 14px;
    }
    .render-project-row-inputs {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 8px;
    }
    .render-project-row input[type="number"] {
        width: 75px;
        min-height: 38px;
        font-size: 15px;
    }
    .render-options { gap: 10px; }
    .opt-row { flex-basis: 100%; }

    /* Task list & Queue (bỏ max-height cứng để cuộn tự nhiên theo tab-panel) */
    .task-list { max-height: none; }
    .task-item { padding: 12px; }
    .task-item .t-name { font-size: 13.5px; }
    .task-item .t-status { font-size: 11px; padding: 3px 8px; }
    .task-item .t-foot { gap: 8px; font-size: 12px; }
    .task-item .t-foot a { flex: 1 1 100%; text-align: center; background: #1c2c42; border-radius: 6px; padding: 8px; min-height: 38px; display: flex; align-items: center; justify-content: center; }
    .task-item .cancel-btn { flex: 1; margin-left: 0; min-height: 40px; }
    .task-item .delete-btn { flex: 1; margin-left: 0; min-height: 40px; }

    /* Video cards trong thư viện video */
    .video-card { padding: 12px; }
    .vc-actions { flex-direction: column; gap: 6px; }
    .vc-actions .btn { width: 100%; min-height: 42px; font-size: 13.5px; }

    /* Tab YouTube */
    .yt-channel-card {
        padding: 12px;
        gap: 10px;
    }
    .yt-avatar { width: 40px; height: 40px; }
    .yt-name { font-size: 14px; word-break: break-word; }
    .yt-meta { font-size: 12px; word-break: break-all; }
    .yt-remove-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
    }
    #btn-add-channel {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }

    /* Modal chung (.modal-box) trên mobile */
    .modal-overlay {
        padding: 10px;
        align-items: center;
        justify-content: center;
    }
    .modal-box {
        width: 100% !important;
        max-width: calc(100vw - 20px) !important;
        max-height: 88dvh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 16px 14px !important;
        margin: 0 !important;
        border-radius: 14px !important;
    }
    .modal-actions {
        display: flex;
        gap: 8px;
    }
    .modal-actions .btn {
        flex: 1;
        min-height: 42px;
    }

    .login-card { padding: 30px 20px; border-radius: 18px; }
}

/* ============================================================
   RESPONSIVE — DESKTOP
   ============================================================ */
@media (min-width: 1366px) {
    body { font-size: 15px; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
    .tab-panel { padding: 30px; }
    .render-layout { max-width: 1100px; }
}

/* ============================================================
   YOUTUBE TAB & ANALYTICS DASHBOARD
   ============================================================ */
.yt-dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px 40px 12px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-sizing: border-box;
}

/* Header */
.yt-header-card {
    background: linear-gradient(135deg, rgba(28, 30, 48, 0.95) 0%, rgba(20, 22, 38, 0.95) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
}
.yt-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.yt-title-area h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-strong);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.yt-subtext {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.4;
}
.yt-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.yt-channel-filter-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.yt-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}
.yt-select {
    background: var(--bg-soft);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-strong);
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.yt-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.2);
}
.yt-header-meta {
    display: flex;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
}
.yt-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* KPI Stat Cards */
.yt-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
}
.yt-kpi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: transform 0.2s, border-color 0.2s;
}
.yt-kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
}
.yt-kpi-icon {
    font-size: 28px;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(91, 140, 255, 0.08);
    border: 1px solid rgba(91, 140, 255, 0.2);
    flex-shrink: 0;
}
.yt-kpi-content {
    flex: 1;
    min-width: 0;
}
.yt-kpi-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.yt-kpi-val {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-strong);
    margin: 3px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    letter-spacing: -0.5px;
}
.yt-kpi-sub {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.yt-quota-mini-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin: 6px 0;
}
.yt-quota-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, #5b8cff, #8b5bff);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Filter Control Card for Timeframes & Metrics */
.yt-filter-control-card {
    padding: 14px 18px;
    margin-bottom: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.yt-fc-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.yt-fc-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.yt-fc-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-strong);
    white-space: nowrap;
}
.yt-pill-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.yt-pill {
    padding: 6px 13px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}
.yt-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.2);
}
.yt-pill.active {
    background: linear-gradient(135deg, rgba(91, 140, 255, 0.25), rgba(139, 91, 255, 0.25));
    border-color: #5b8cff;
    color: #fff;
    box-shadow: 0 0 12px rgba(91, 140, 255, 0.25);
}

/* Matrix Table Specifics */
.yt-matrix-table td {
    vertical-align: middle;
}
.yt-matrix-chan-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.yt-matrix-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}
.yt-matrix-title {
    font-weight: 700;
    color: var(--text-strong);
    font-size: 13px;
}
.yt-matrix-handle {
    font-size: 11px;
    color: var(--accent);
}
.yt-matrix-top-thumb {
    width: 48px;
    height: 27px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 8px;
    vertical-align: middle;
}
.yt-matrix-top-link {
    display: inline-flex;
    align-items: center;
    color: var(--text);
    text-decoration: none;
    font-size: 12px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.yt-matrix-top-link:hover {
    color: var(--accent);
}
.yt-matrix-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    font-family: monospace;
}
.yt-matrix-pill.positive {
    background: rgba(111, 227, 160, 0.15);
    color: #6fe3a0;
    border: 1px solid rgba(111, 227, 160, 0.3);
}
.yt-matrix-pill.neutral {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

/* Charts Grid */
.yt-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 18px;
}
.yt-chart-card {
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
}
.yt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.yt-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-strong);
}
.yt-card-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
    width: 100%;
}
.yt-chart-note {
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.yt-card-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(91, 140, 255, 0.1);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(91, 140, 255, 0.2);
}
.yt-chart-wrapper {
    position: relative;
    width: 100%;
    height: 220px;
}
.yt-automation-wrapper {
    height: 190px !important;
}
@media (max-width: 768px) {
    .yt-chart-wrapper {
        height: 170px;
    }
}

/* Video Table */
.yt-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.yt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}
.yt-table th {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.yt-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}
.yt-table tr:hover td {
    background: var(--bg-hover);
}
.yt-video-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 240px;
}
.yt-video-thumb {
    width: 76px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    background: #0b0c13;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.yt-video-title {
    font-weight: 600;
    color: var(--text-strong);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.yt-channel-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(91, 140, 255, 0.12);
    color: #8ab4ff;
    border: 1px solid rgba(91, 140, 255, 0.25);
    white-space: nowrap;
}
.yt-metric-cell {
    font-family: monospace, sans-serif;
    font-weight: 600;
    color: var(--text-strong);
    white-space: nowrap;
}
.yt-engagement-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.yt-action-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    text-decoration: none;
    font-size: 12px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    border: 1px solid var(--border);
    white-space: nowrap;
}
.yt-action-link:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.yt-empty-cell {
    text-align: center;
    padding: 30px !important;
    color: var(--text-muted);
}

/* Channels Management Grid */
.yt-channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 12px;
    margin-top: 14px;
    width: 100%;
    box-sizing: border-box;
}
@media (max-width: 600px) {
    .yt-channels-grid {
        grid-template-columns: 1fr;
    }
}
.yt-channel-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-soft);
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
.yt-channel-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-card);
    transform: translateY(-2px);
}
.yt-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.12);
}
.yt-info {
    flex: 1;
    min-width: 0;
}
.yt-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}
.yt-name {
    font-weight: 700;
    color: var(--text-strong);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.yt-handle {
    font-size: 12px;
    color: var(--accent);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.yt-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}
.yt-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 11px;
}
.yt-channel-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.yt-remove-btn {
    background: #3a2020;
    color: #ff9a9a;
    border: 1px solid #5a2020;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.yt-remove-btn:hover {
    background: #5a2020;
    color: #ffcccc;
}

/* Audience & Device Insights Section */
.yt-insights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 768px) {
    .yt-insights-grid {
        grid-template-columns: 1fr;
    }
}
.yt-insight-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.yt-insight-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}
.yt-insight-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.yt-insight-row-head {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}
.yt-insight-row-head b {
    color: var(--text-strong);
}
.yt-insight-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
}
.yt-insight-fill {
    height: 100%;
    transition: width 0.3s ease;
}
.yt-devices-pills {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 6px;
}
.yt-device-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.yt-device-box .dev-icon {
    font-size: 18px;
}
.yt-device-box .dev-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.yt-device-box .dev-name {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.yt-device-box .dev-pct {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-strong);
}

.yt-file-row { display: flex; gap: 8px; align-items: center; }
.yt-file-row input { flex: 1; }

.yt-upload-progress { padding: 8px; color: var(--text-muted); }
.yt-upload-success { padding: 10px; color: #4caf50; font-size: 14px; }
.yt-upload-success .yt-link { color: #8ab4ff; text-decoration: underline; }
.yt-upload-error { padding: 10px; color: #ff9a9a; font-size: 14px; }

.yt-file-item {
    padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #3c3c3c;
    display: flex; justify-content: space-between; align-items: center;
    transition: background 0.15s;
}
.yt-file-item:hover { background: #2a2a2a; }
.yt-file-name { font-weight: 500; color: #e0e0e0; }
.yt-file-size { color: #888; font-size: 12px; }

@media (max-width: 768px) {
    .yt-charts-grid {
        grid-template-columns: 1fr;
    }
    .yt-kpi-grid {
        grid-template-columns: 1fr 1fr;
    }
    .yt-header-top {
        flex-direction: column;
        align-items: stretch;
    }
    .yt-header-actions {
        justify-content: space-between;
    }
}
@media (max-width: 480px) {
    .yt-kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   SCHEDULER — Xuất bản video tự động (Mobile-Friendly & GMT+7)
   ============================================================ */
.scheduler-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 12px 40px 12px;
    box-sizing: border-box;
}

/* Header Banner */
.sc-header-card {
    background: linear-gradient(135deg, rgba(28, 30, 48, 0.9) 0%, rgba(20, 21, 35, 0.9) 100%);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.sc-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.sc-title-area {
    flex: 1;
    min-width: 260px;
}

.sc-title-area h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-strong);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sc-subtext {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.sc-header-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.vn-clock {
    color: #6fe3a0;
    font-weight: 700;
    font-family: monospace, sans-serif;
    font-size: 14px;
    background: rgba(111, 227, 160, 0.1);
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(111, 227, 160, 0.25);
    white-space: nowrap;
}

.btn-group-responsive {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================================
   YOUTUBE API QUOTA BANNER
   ============================================================ */
.sc-quota-bar-wrapper {
    background: linear-gradient(135deg, rgba(26, 29, 45, 0.85), rgba(18, 20, 32, 0.95));
    border: 1px solid rgba(255, 202, 40, 0.25);
    border-radius: 12px;
    padding: 14px 18px;
    margin-top: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.sc-quota-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.sc-quota-title-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sc-quota-icon {
    font-size: 24px;
    color: #ffca28;
    filter: drop-shadow(0 0 6px rgba(255, 202, 40, 0.4));
}

.sc-quota-label {
    font-size: 14px;
    color: var(--text-strong);
}

.sc-quota-numbers {
    color: #ffca28;
    font-weight: 700;
    margin-left: 6px;
}

.sc-quota-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sc-quota-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sc-qbadge {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    white-space: nowrap;
}

.sc-qbadge.ok {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.35);
}

.sc-qbadge.warning {
    background: rgba(255, 152, 0, 0.15);
    color: #ffb74d;
    border: 1px solid rgba(255, 152, 0, 0.35);
}

.sc-qbadge.danger {
    background: rgba(244, 67, 54, 0.15);
    color: #ff6b6b;
    border: 1px solid rgba(244, 67, 54, 0.35);
}

.sc-qreset-pill {
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 9px;
    border-radius: 6px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.sc-quota-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    margin: 12px 0 8px 0;
    overflow: hidden;
}

.sc-quota-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease, background 0.3s ease;
}

.sc-quota-fill.ok {
    background: linear-gradient(90deg, #34d399, #10b981);
}

.sc-quota-fill.warning {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.sc-quota-fill.danger {
    background: linear-gradient(90deg, #f87171, #ef4444);
}

.sc-quota-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 8px;
}

/* ============================================================
   MODAL LIVE QUOTA CHECKER & FREQUENCY
   ============================================================ */
.sc-quota-checker-box {
    background: rgba(18, 20, 32, 0.85);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.sc-qcheck-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.sc-qcheck-icon {
    font-size: 18px;
    color: #ffca28;
}

.sc-qcheck-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-strong);
    flex: 1;
}

.sc-qcheck-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.sc-qcheck-badge.ok {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.35);
}

.sc-qcheck-badge.warning {
    background: rgba(255, 152, 0, 0.15);
    color: #ffb74d;
    border: 1px solid rgba(255, 152, 0, 0.35);
}

.sc-qcheck-badge.danger {
    background: rgba(244, 67, 54, 0.15);
    color: #ff6b6b;
    border: 1px solid rgba(244, 67, 54, 0.35);
}

.sc-qcheck-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sc-qcheck-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 8px;
}

.sc-qcheck-stat-row b {
    color: var(--text-strong);
}

.sc-qcheck-alert {
    margin-top: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
}

.sc-qcheck-alert.warning {
    background: rgba(255, 152, 0, 0.12);
    border: 1px solid rgba(255, 152, 0, 0.3);
    color: #ffb74d;
}

.sc-qcheck-alert.danger {
    background: rgba(244, 67, 54, 0.12);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #ff8585;
}

.rule-badge.freq {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.slot-pill.quota {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.25);
    font-size: 11px;
}

.sc-modal-quota {
    max-width: 480px;
}

.quota-detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.q-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}

.q-detail-row b {
    color: var(--text-strong);
}

/* Cards Grid / Stack */
.sc-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.empty-cards-box {
    text-align: center;
    padding: 48px 20px;
    background: var(--bg-card);
    border: 1px dashed var(--border-strong);
    border-radius: 16px;
    color: var(--text-muted);
}

.empty-cards-box .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-cards-box h3 {
    font-size: 18px;
    color: var(--text-strong);
    margin-bottom: 6px;
}

/* Project Card */
.sc-project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease;
}

.sc-project-card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.sc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.sc-card-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.sc-card-icon {
    font-size: 28px;
    background: rgba(91, 140, 255, 0.12);
    padding: 8px;
    border-radius: 12px;
    flex-shrink: 0;
}

.sc-card-names {
    min-width: 0;
    flex: 1;
}

.sc-proj-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-strong);
    margin: 0 0 4px 0;
    word-break: break-all;
}

.sc-chan-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    background: #1c202d;
    border: 1px solid #2c3346;
    padding: 2px 8px;
    border-radius: 6px;
}

/* Badges row - Toned down sleek theme */
.sc-card-badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}

.rule-badge {
    font-size: 12px;
    padding: 3px 9px;
    border-radius: 6px;
    font-weight: 500;
    background: #1c202d;
    border: 1px solid #2b3245;
    color: #94a3b8;
}

.rule-badge.freq {
    background: #1e2333;
    border-color: #2d374f;
    color: #cbd5e1;
}

.rule-badge.top1 {
    background: #1a2336;
    color: #93c5fd;
    border: 1px solid #283a5c;
}

.rule-badge.ai {
    background: #1e1f2e;
    color: #c4b5fd;
    border: 1px solid #312e47;
}

.tag-pill-fixed {
    font-size: 12px;
    background: #1c202d;
    color: #94a3b8;
    border: 1px solid #2c3346;
    padding: 3px 8px;
    border-radius: 6px;
}

/* Slots */
.sc-card-slots {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
}

.slots-label {
    color: var(--text-muted);
    font-size: 12px;
}

.slots-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.slot-pill {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 6px;
    background: #1c202d;
    border: 1px solid #2c3346;
    color: #cbd5e1;
}

.slot-pill.fixed {
    background: #1a2336;
    color: #93c5fd;
    border: 1px solid #283a5c;
}

.slot-pill.rand {
    background: #20222f;
    color: #cbd5e1;
    border: 1px solid #333649;
}

.slot-pill.quota {
    background: #1c202d;
    color: #94a3b8;
    border: 1px solid #2c3346;
}

/* Progress Box */
.sc-card-progress-box {
    background: #12141d;
    border: 1px solid #262c3f;
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 6px;
}

.sc-pipeline-steps {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin: 4px 0 10px 0;
    flex-wrap: wrap;
}

.sc-step {
    flex: 1 1 20%;
    min-width: 65px;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    padding: 5px 4px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all 0.25s ease;
}

.sc-step.active {
    background: #1e2a44;
    color: #93c5fd;
    border-color: #3b82f6;
    font-weight: 600;
}

.sc-step.done {
    background: #142820;
    color: #34d399;
    border-color: #1a4233;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #93c5fd;
    font-weight: 500;
    margin-bottom: 6px;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #1a1e2b;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill.animated {
    background: #3b82f6;
}

/* Card Running State */
.sc-project-card.running {
    border: 1px solid #3b82f6 !important;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.12);
}

.live-pulse-badge {
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    margin-right: 6px;
}

/* Next Run Indicator */
.sc-card-next-run {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin: 6px 0;
}

.sc-card-next-run .next-run-val.now {
    color: #ffca28;
    font-weight: 700;
    animation: blinkBadge 1.2s infinite;
}

.sc-card-next-run .next-run-val.upcoming {
    color: #6fe3a0;
    font-weight: 600;
}

.sc-card-next-run .next-run-val.tomorrow,
.sc-card-next-run .next-run-val.future {
    color: #a8c4ff;
    font-weight: 600;
}

.sc-card-next-run .next-run-val.paused {
    color: var(--text-muted);
}

/* Daemon status pill */
.sc-badges-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sc-daemon-pill {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.sc-daemon-pill.ok {
    background: rgba(76, 175, 80, 0.12);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.25);
}

.sc-daemon-pill.warning {
    background: rgba(255, 152, 0, 0.12);
    color: #ffb74d;
    border: 1px solid rgba(255, 152, 0, 0.25);
}

.sc-daemon-pill.running {
    background: rgba(91, 140, 255, 0.2);
    color: #8ab4ff;
    border: 1px solid rgba(91, 140, 255, 0.4);
    animation: pulseDaemon 1.5s infinite;
}

@keyframes moveStripes {
    0% { background-position: 0 0; }
    100% { background-position: 20px 0; }
}

@keyframes cardGlow {
    0% { box-shadow: 0 0 15px rgba(91, 140, 255, 0.25); border-color: rgba(91, 140, 255, 0.6); }
    50% { box-shadow: 0 0 30px rgba(91, 140, 255, 0.55); border-color: rgba(91, 140, 255, 1); }
    100% { box-shadow: 0 0 15px rgba(91, 140, 255, 0.25); border-color: rgba(91, 140, 255, 0.6); }
}

@keyframes blinkBadge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes pulseDaemon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #5b8cff, #8b5bff);
    transition: width 0.3s ease;
}

/* History Box */
.sc-card-history {
    background: #131422;
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sc-card-history.success { border-left: 4px solid #4caf50; }
.sc-card-history.failed { border-left: 4px solid #ff6b6b; }

.hist-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: #6fe3a0;
}

.sc-card-history.failed .hist-header { color: #ff8585; }

.hist-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-strong);
}

.hist-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
    align-items: center;
}

.yt-watch-link {
    color: #8ab4ff;
    text-decoration: underline;
    font-weight: 600;
}

/* Staged Video Preview Box */
.staged-preview-box {
    background: #141824;
    border: 1px solid #252e42;
    border-radius: 10px;
    padding: 12px 14px;
    margin: 4px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.staged-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.staged-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #34d399;
}

.staged-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.staged-score {
    font-size: 11px;
    color: #94a3b8;
    background: #1c2233;
    border: 1px solid #2a344d;
    padding: 2px 7px;
    border-radius: 5px;
}

.staged-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.staged-title {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.staged-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #64748b;
    flex-wrap: wrap;
}

.staged-meta span b {
    color: #94a3b8;
}

.staged-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.staged-actions .btn {
    min-height: 32px;
    padding: 4px 12px;
    font-size: 12px;
}

.staged-idle-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: #13151f;
    border: 1px dashed #24293a;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 2px 0;
    flex-wrap: wrap;
}

.staged-idle-text {
    font-size: 12px;
    color: #64748b;
}

.staged-idle-box .btn {
    min-height: 28px;
    padding: 2px 10px;
    font-size: 11px;
}

/* Footer Actions */
.sc-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.sc-btn-run-now {
    min-height: 40px;
    font-weight: 700;
}

/* ============================================================
   MODAL & FORM DIALOGS (DARK THEME)
   ============================================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 6, 14, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
    box-sizing: border-box;
}

.sc-modal-card {
    background: #161726;
    border: 1px solid #2d3148;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

/* Video Preview Modal */
.sc-modal-preview {
    background: #151724;
    border: 1px solid #262c40;
    border-radius: 16px;
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}

.sc-preview-body {
    padding: 16px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #13141f;
}

.sc-preview-player-wrap {
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
    aspect-ratio: 9 / 16;
    height: auto;
    max-height: 44vh;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #2e354a;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.sc-preview-player-wrap video {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    outline: none;
    background: #000;
    border-radius: 10px;
    display: block;
}

.sc-pv-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid #1f2434;
    background: #11121c;
}

.sc-pv-footer .btn-rerender-action {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.35);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sc-pv-footer .btn-rerender-action:hover {
    background: rgba(99, 102, 241, 0.28);
    color: #ffffff;
    border-color: #6366f1;
}

.sc-pv-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sc-preview-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pv-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px 14px;
    background: #11121c;
    border: 1px solid #202434;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
}

.pv-lbl {
    color: #64748b;
    font-size: 12px;
    margin-bottom: 3px;
    display: block;
}

.pv-val {
    color: #e2e8f0;
    font-size: 13px;
}

.pv-text-block {
    background: #0e1017;
    border: 1px solid #1f2333;
    border-radius: 8px;
    padding: 10px 12px;
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
}

.pv-text-block.desc {
    max-height: 90px;
    overflow-y: auto;
    font-size: 12px;
    color: #94a3b8;
    white-space: pre-wrap;
}

.pv-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pv-tag-chip {
    background: #1a1e2b;
    border: 1px solid #293044;
    color: #94a3b8;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 11px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #26293f;
    background: #1b1d2e;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header .btn {
    min-height: 32px;
    width: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border-radius: 8px;
}

.sc-form-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #141523;
}

.sc-form-body .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.sc-form-body .form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #d1d5e8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sc-form-body select,
.sc-form-body input[type="text"],
.sc-form-body input[type="number"],
.sc-form-body textarea {
    width: 100%;
    background: #0d0e17 !important;
    border: 1px solid #2b2e46 !important;
    border-radius: 10px !important;
    color: #f1f3f9 !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sc-form-body select:focus,
.sc-form-body input[type="text"]:focus,
.sc-form-body input[type="number"]:focus,
.sc-form-body textarea:focus {
    outline: none;
    border-color: #5b8cff !important;
    box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.2);
}

.sc-form-body textarea {
    resize: vertical;
    min-height: 64px;
    line-height: 1.45;
}

.form-row-responsive {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-row-3-responsive {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.sc-highlight-box {
    background: rgba(91, 140, 255, 0.08);
    border: 1px solid rgba(91, 140, 255, 0.25);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sc-highlight-box .box-title {
    font-size: 13px;
    font-weight: 700;
    color: #8ab4ff;
}

.hint-text {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.45;
}

.req { color: #ff6b6b; }

/* Slots Container & Rows */
.sc-slots-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.sc-slot-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #0d0e17;
    border: 1px solid #282a3e;
    border-radius: 10px;
    padding: 8px 12px;
    box-sizing: border-box;
    font-size: 13px;
    color: #c4c7d9;
}

.slot-time-range {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.slot-label-txt {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.sc-slot-row input[type="time"] {
    background: #181a28 !important;
    border: 1px solid #363a55 !important;
    border-radius: 6px !important;
    color: #ffffff !important;
    padding: 6px 10px !important;
    font-size: 13px !important;
    font-family: inherit;
    width: auto !important;
    min-width: 85px;
}

.sc-slot-row input[type="time"]:focus {
    outline: none;
    border-color: #5b8cff !important;
}

.slot-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-rand {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-fixed {
    background: rgba(91, 140, 255, 0.15);
    color: #8ab4ff;
    border: 1px solid rgba(91, 140, 255, 0.35);
}

.sc-slot-row .slot-del {
    color: #ff6b6b;
    margin-left: auto;
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid #26293f;
    background: #1b1d2e;
    flex-shrink: 0;
}

.modal-footer .btn {
    min-height: 40px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
}

.switch-wrap-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #c4b5fd;
}

.switch-wrap-sm input { display: none; }
.switch-wrap-sm .slider {
    width: 30px;
    height: 16px;
}
.switch-wrap-sm .slider::before {
    width: 10px;
    height: 10px;
    left: 3px;
    top: 3px;
}
.switch-wrap-sm input:checked + .slider::before {
    transform: translateX(14px);
}

/* ============================================================
   MOBILE RESPONSIVE BREAKPOINT (< 768px) FOR SCHEDULER & MODAL
   ============================================================ */
@media (max-width: 768px) {
    .scheduler-container {
        padding: 0 4px 24px 4px;
    }

    .sc-header-card {
        padding: 14px;
    }

    .sc-header-top {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .sc-header-controls {
        align-items: stretch;
    }

    .btn-group-responsive {
        width: 100%;
        display: flex;
    }

    .btn-group-responsive .btn {
        flex: 1;
        min-height: 42px;
        font-size: 13px;
    }

    .form-row-responsive,
    .form-row-3-responsive {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .sc-card-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .sc-card-footer .btn {
        width: 100%;
        min-height: 44px;
    }

    .sc-card-footer .btn-group-sm {
        width: 100%;
        display: flex;
    }

    .sc-card-footer .btn-group-sm .btn {
        flex: 1;
        min-height: 40px;
    }

    /* Bottom-sheet Modal on Mobile */
    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .sc-modal-card,
    .sc-modal-preview,
    .sc-modal-quota {
        width: 100vw;
        max-width: 100vw;
        height: 90vh;
        height: 90dvh;
        max-height: 90dvh;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .sc-form-body,
    .sc-preview-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
        gap: 14px;
    }

    .modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 20;
        background: #1b1d2e;
        border-top: 1px solid #26293f;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 12px)) 16px;
    }

    .modal-footer .btn {
        flex: 1;
        min-height: 44px;
        font-size: 14px;
    }

    .sc-slot-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .slot-time-range {
        width: 100%;
        justify-content: space-between;
    }

    .slot-time-range input[type="time"] {
        flex: 1;
    }

    .sc-preview-player-wrap {
        max-width: 200px;
        max-height: 36vh;
        margin: 0 auto;
    }

    .sc-pv-footer {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 10px)) 16px !important;
    }

    .sc-pv-footer .btn-rerender-action {
        width: 100% !important;
        flex: none !important;
        justify-content: center !important;
        padding: 10px 12px !important;
        font-size: 13px !important;
        order: 1 !important;
    }

    .sc-pv-footer-right {
        width: 100% !important;
        display: flex !important;
        gap: 8px !important;
        order: 2 !important;
    }

    .sc-pv-footer-right #sc-btn-pv-close {
        flex: 1 !important;
        justify-content: center !important;
        min-height: 42px !important;
    }

    .sc-pv-footer-right #sc-btn-pv-publish-now {
        flex: 2 !important;
        justify-content: center !important;
        min-height: 42px !important;
        font-size: 13px !important;
    }
}

/* ============================================================
   VPS MANAGEMENT STYLES
   ============================================================ */
.vps-container {
    max-width: 1360px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.vps-header-card {
    padding: 20px;
    margin-bottom: 20px;
}

.vps-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.vps-title-area h2 {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-strong);
}

.vps-subtext {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}

.vps-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vps-auto-refresh-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.vps-header-meta {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.vps-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text);
}

/* 4 KPI Grid */
.vps-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.vps-kpi-card {
    padding: 18px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.vps-kpi-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.vps-kpi-icon {
    font-size: 22px;
}

.vps-kpi-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    flex: 1;
    margin-left: 8px;
}

.vps-kpi-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-family: monospace;
}

.vps-kpi-badge.ok {
    background: rgba(111, 227, 160, 0.15);
    color: #6fe3a0;
}

.vps-kpi-val {
    font-size: 28px;
    font-weight: 800;
    font-family: monospace;
    margin: 10px 0 6px;
    color: var(--text-strong);
}

.vps-kpi-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.vps-kpi-fill {
    height: 100%;
    background: linear-gradient(90deg, #5b8cff, #6fe3a0);
    transition: width 0.4s ease;
}

.vps-kpi-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.vps-services-list {
    margin: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vps-srv-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.vps-srv-ok {
    color: #6fe3a0;
}

/* Middle Grid: Actions & Procs */
.vps-mid-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 18px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .vps-mid-grid {
        grid-template-columns: 1fr;
    }
}

.vps-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.vps-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-strong);
}

.vps-card-note {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 7px;
    border-radius: 4px;
}

.vps-actions-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vps-actions-buttons .btn {
    text-align: left;
    padding: 10px 14px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
}

.vps-action-log-box {
    margin-top: 14px;
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

.vps-log-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.vps-log-content {
    font-family: "Consolas", monospace;
    font-size: 12px;
    color: #6fe3a0;
    white-space: pre-wrap;
    max-height: 180px;
    overflow-y: auto;
    margin: 0;
}

/* Process Table */
.vps-table-responsive {
    overflow-x: auto;
    max-height: 250px;
    overflow-y: auto;
}

.vps-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.vps-table th {
    text-align: left;
    padding: 8px 10px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
}

.vps-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.vps-proc-pid {
    font-family: monospace;
    color: var(--text-muted);
}

.vps-proc-user {
    color: #a6a9be;
}

.vps-proc-metric {
    font-family: monospace;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.vps-proc-metric.high {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

/* Web Terminal */
.vps-terminal-card {
    padding: 20px;
}

.vps-cmd-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.vps-chip-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.vps-chip {
    padding: 4px 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 11px;
    cursor: pointer;
    font-family: monospace;
    transition: all 0.15s ease;
}

.vps-chip:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.vps-terminal-wrapper {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.vps-terminal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
}

.vps-term-dots {
    display: flex;
    gap: 6px;
}

.vps-term-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.vps-term-title {
    font-size: 11px;
    color: #8b949e;
    font-family: monospace;
}

.vps-terminal-screen {
    padding: 14px;
    color: #c9d1d9;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.5;
    min-height: 220px;
    max-height: 380px;
    overflow-y: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

.vps-terminal-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #161b22;
    border-top: 1px solid #30363d;
}

.vps-prompt {
    font-family: monospace;
    font-size: 12px;
    font-weight: 700;
    color: #58a6ff;
    white-space: nowrap;
}

.vps-terminal-input-bar input {
    flex: 1;
    background: transparent;
    border: none;
    color: #f0f6fc;
    font-family: "Consolas", monospace;
    font-size: 13px;
    outline: none;
}



