@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #0a0a0f;
    --bg-subtle: #111118;
    --surface: #16161f;
    --surface-hover: #1c1c28;
    --surface-raised: #1e1e2a;
    --border: #2a2a3a;
    --border-light: #222233;
    --text: #f0f0f5;
    --text-secondary: #a0a0b8;
    --text-muted: #5c5c78;
    --primary: #6c5ce7;
    --primary-hover: #7c6df7;
    --primary-light: rgba(108, 92, 231, 0.12);
    --primary-glow: rgba(108, 92, 231, 0.25);
    --accent: #00d084;
    --accent-light: rgba(0, 208, 132, 0.12);
    --success: #00d084;
    --success-light: rgba(0, 208, 132, 0.1);
    --error: #ff4757;
    --error-light: rgba(255, 71, 87, 0.1);
    --warning: #ffa502;
    --warning-light: rgba(255, 165, 2, 0.1);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-pill: 9999px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(108, 92, 231, 0.15);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, #6c5ce7, #a855f7);
    --gradient-accent: linear-gradient(135deg, #00d084, #00b894);
}

/* Light theme overrides — professional, cockpit-style palette (Google-blue accent) */
html[data-theme="light"] {
    --bg: #f4f5f8;
    --bg-subtle: #eef1f6;
    --surface: #ffffff;
    --surface-hover: #f2f4f8;
    --surface-raised: #ffffff;
    --border: #e4e8ef;
    --border-light: #eef1f6;
    --text: #1f2733;
    --text-secondary: #667085;
    --text-muted: #9aa4b2;
    --primary: #1a73e8;
    --primary-hover: #1765cc;
    --primary-light: #e8f0fe;
    --primary-glow: rgba(26, 115, 232, 0.18);
    --accent: #1aa260;
    --accent-light: #e6f6ee;
    --success: #1aa260;
    --success-light: #e6f6ee;
    --error: #e5484d;
    --error-light: #fdeced;
    --warning: #b9770e;
    --warning-light: #fdf6e9;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
    --shadow-md: 0 8px 28px rgba(16, 24, 40, 0.12);
    --shadow-lg: 0 8px 28px rgba(16, 24, 40, 0.16);
    --shadow-glow: none;
    --gradient-primary: linear-gradient(135deg, #1a73e8, #4285f4);
    --gradient-accent: linear-gradient(135deg, #1aa260, #34c77b);
    --radius: 10px;
    --radius-lg: 12px;
}

html[data-theme="light"] body::before {
    background: none;
}

/* Toast backgrounds need slightly different opacity in light mode */
html[data-theme="light"] .toast-success { background: rgba(0, 208, 132, 0.95); }
html[data-theme="light"] .toast-error { background: rgba(255, 71, 87, 0.95); }
html[data-theme="light"] .toast-info { background: rgba(108, 92, 231, 0.95); }
html[data-theme="light"] .toast-warning { background: rgba(255, 165, 2, 0.95); }

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Subtle background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(0, 208, 132, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 28px;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    margin-bottom: 32px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    flex-shrink: 0;
    opacity: 0.9;
    transition: opacity var(--transition);
}

.header-logo:hover {
    opacity: 1;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.user-email {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ---- App shell: top bar + left sidebar rail (cockpit-style) ---- */
.topbar {
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    position: sticky;
    top: 0;
    z-index: 30;
    margin-bottom: 0;
}

a.brand { text-decoration: none; }
a.brand:hover { opacity: 0.85; }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.01em;
    color: var(--text);
}

.brand-dot {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: linear-gradient(135deg, #0e9aa7, #22c1d6);
    box-shadow: 0 2px 8px rgba(14, 154, 167, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.brand-dot svg { width: 15px; height: 15px; display: block; }

.layout { display: flex; align-items: stretch; min-height: calc(100vh - 56px); position: relative; z-index: 1; }

.sidebar {
    width: 216px;
    min-width: 216px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 12px;
}

.sidebar-inner {
    position: sticky;
    top: 74px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.navlbl {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 12px;
    margin: 0 0 8px;
}

.tab {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 550;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    text-align: left;
    transition: background 0.14s, color 0.14s;
    font-family: inherit;
    line-height: 1.2;
}

.tab svg { width: 16px; height: 16px; flex: none; }

.tab .cnt {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: 650;
    color: var(--text-muted);
    background: var(--bg);
    border-radius: 999px;
    padding: 1px 7px;
    line-height: 1.5;
}

.tab:hover { color: var(--text); background: var(--surface-hover); }

.tab.active { color: var(--primary); background: var(--primary-light); font-weight: 650; }

.tab.active .cnt { background: var(--surface); color: var(--primary); }

main { padding: 20px 26px; flex: 1; min-width: 0; }

.pagehead {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 2px 0 16px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--border);
}

.pagehead h2 { margin: 0; font-size: 19px; font-weight: 750; letter-spacing: -0.02em; color: var(--text); }

.pagehead .psub { font-size: 12.5px; color: var(--text-secondary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

.tab-content h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 22px;
    letter-spacing: -0.01em;
    color: var(--text);
}

/* Section Labels */
.section-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Credentials Sections */
.credentials-section {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 16px;
    transition: all var(--transition);
}

.credentials-section:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.credentials-section h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    letter-spacing: -0.01em;
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 7px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 11px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all var(--transition);
    background: var(--bg-subtle);
    color: var(--text);
    font-family: inherit;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface);
}

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

/* Buttons */
.btn {
    padding: 10px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-secondary);
    font-family: inherit;
}

.btn:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    box-shadow: var(--shadow), var(--shadow-glow);
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
    filter: brightness(0.95);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    filter: none;
    box-shadow: none;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
}

/* Status Indicator */
.status-indicator {
    display: inline-block;
    margin-left: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-indicator.success { color: var(--success); }
.status-indicator.error { color: var(--error); }

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 56px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-muted);
    background: var(--surface);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    box-shadow: inset 0 0 30px rgba(108, 92, 231, 0.05);
}

.drop-zone:hover svg,
.drop-zone.drag-over svg {
    opacity: 1;
    stroke: var(--primary);
    transform: translateY(-2px);
}

.drop-zone-content svg {
    margin-bottom: 18px;
    opacity: 0.35;
    transition: all var(--transition);
}

.drop-zone-content p {
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.95rem;
}

.drop-zone .specs {
    font-size: 0.78rem;
    opacity: 0.5;
}

/* ---- Staged Files ---- */
#staged-files-container {
    margin-top: 16px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
}

.staged-files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.staged-files-header span {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.staged-files-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.staged-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.staged-file-chip .file-size {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.staged-file-chip .remove-file {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: all var(--transition);
    padding: 0;
}

.staged-file-chip .remove-file:hover {
    background: var(--error-light);
    color: var(--error);
}

/* ---- Network Selector Area ---- */
.network-selector-area {
    margin-top: 20px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 22px;
}

.network-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.network-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-subtle);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    color: var(--text-secondary);
}

.network-chip:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--text);
}

.network-chip.selected {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-hover);
    font-weight: 700;
    box-shadow: 0 0 0 1px var(--primary-glow), var(--shadow-glow);
}

.network-chip input[type="checkbox"] {
    margin: 0;
    accent-color: var(--primary);
}

/* Network Sub-panels */
.network-sub-panel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* ---- Upload Actions ---- */
#upload-actions {
    margin-top: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* ---- Upload Results Grid ---- */
#upload-results {
    margin-top: 24px;
}

#upload-results h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.upload-result-row {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
    transition: all var(--transition);
}

.upload-result-row:hover {
    border-color: var(--border);
}

.upload-result-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-subtle);
}

.upload-result-file strong {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
}

.upload-result-file .file-size {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.upload-result-networks {
    display: grid;
    gap: 0;
}

.network-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.84rem;
}

.network-cell:last-child {
    border-bottom: none;
}

.network-cell-label {
    min-width: 90px;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.network-cell-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.network-cell-progress .progress-bar {
    flex: 1;
}

.network-cell-progress .progress-text {
    min-width: 36px;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

.network-cell-status {
    min-width: 120px;
    text-align: right;
}

/* Progress Bar */
.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(108, 92, 231, 0.4);
}

.progress-text {
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 40px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Status classes */
.status-success {
    color: var(--success);
    font-weight: 700;
    font-size: 0.82rem;
}

.status-error {
    color: var(--error);
    font-weight: 600;
    font-size: 0.8rem;
}

.status-pending {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.8rem;
}

.status-skipped {
    color: var(--warning);
    font-weight: 600;
    font-size: 0.8rem;
}

.retry-btn {
    margin-left: 8px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.retry-btn:hover:not(:disabled) {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
}

.retry-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Upload Result (legacy single-row) */
.upload-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    margin-top: 8px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    font-size: 0.85rem;
    transition: all var(--transition);
}

.upload-row:first-child {
    margin-top: 16px;
}

.upload-row:hover {
    border-color: var(--border);
}

.upload-row-info {
    min-width: 200px;
    flex-shrink: 0;
}

.upload-row-info strong {
    font-weight: 600;
    color: var(--text);
}

.upload-row-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-row-progress .progress-bar {
    flex: 1;
}

.upload-row-progress .progress-text {
    min-width: 36px;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.upload-row-status {
    min-width: 90px;
    text-align: right;
}

/* Success / Error cards */
.success-card {
    margin-top: 16px;
    padding: 18px 22px;
    background: var(--success-light);
    border: 1px solid rgba(0, 208, 132, 0.25);
    border-radius: var(--radius);
}

.success-card h3 {
    color: var(--success);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.success-card p {
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.success-card code {
    background: rgba(0, 208, 132, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--success);
}

.error-card {
    margin-top: 16px;
    padding: 18px 22px;
    background: var(--error-light);
    border: 1px solid rgba(255, 71, 87, 0.25);
    border-radius: var(--radius);
    color: var(--error);
    font-size: 0.875rem;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.toolbar-right {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Empty / Loading States */
.empty-state {
    text-align: center;
    padding: 44px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.loading {
    text-align: center;
    padding: 28px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Creative Set Cards */
.cs-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin-bottom: 10px;
    transition: all var(--transition);
}

.cs-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

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

.cs-card-header h4 {
    font-size: 0.9rem;
    font-weight: 700;
}

.cs-card-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.cs-card-meta span {
    margin-right: 16px;
}

.muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 40px;
    font-size: 0.95rem;
    border-radius: var(--radius-pill);
}

/* Uploaded list in summary */
.uploaded-summary {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.uploaded-summary code {
    background: rgba(108, 92, 231, 0.1);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    color: var(--primary-hover);
}

.uploaded-list {
    list-style: none;
    margin-top: 8px;
}

.uploaded-list li {
    padding: 5px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.uploaded-list code {
    background: rgba(108, 92, 231, 0.1);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    color: var(--primary-hover);
}

/* Unity Apps / Facebook Accounts Selector */
.unity-apps-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.unity-app-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-subtle);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    color: var(--text-secondary);
}

.unity-app-chip:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--text);
}

.unity-app-chip.selected {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-hover);
    font-weight: 600;
    box-shadow: 0 0 0 1px var(--primary-glow), var(--shadow-glow);
}

.unity-app-chip input[type="checkbox"],
.unity-app-chip input[type="radio"] {
    margin: 0;
    accent-color: var(--primary);
}

/* Unity language dropdown */
.language-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--bg-subtle);
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
}

.language-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Platform icons (iOS / Android) */
.platform-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

.platform-icon.ios {
    color: var(--text-secondary);
}

.platform-icon.android {
    color: #3ddc84;
}

/* Creative set chip extras */
.cs-chip small {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: 2px;
}

.cs-chip.selected small {
    color: var(--primary);
}

/* Facebook token status */
.fb-token-status {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.82rem;
    line-height: 1.5;
}
.fb-token-status.success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(0, 208, 132, 0.25);
}
.fb-token-status.warning {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid rgba(255, 165, 2, 0.25);
}
.fb-token-status.error {
    background: var(--error-light);
    color: var(--error);
    border: 1px solid rgba(255, 71, 87, 0.25);
}

/* ---- Theme Toggle ---- */
.theme-toggle-section {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 22px 28px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-toggle-section .section-label {
    margin-bottom: 0;
}

.theme-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-subtle);
    border-radius: var(--radius-pill);
    padding: 4px;
    border: 1px solid var(--border-light);
}

.theme-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    background: none;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-pill);
    transition: all var(--transition);
    font-family: inherit;
}

.theme-btn svg {
    flex-shrink: 0;
}

.theme-btn:hover {
    color: var(--text-secondary);
    background: var(--surface-hover);
}

.theme-btn.active {
    color: white;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-sm);
}

/* ---- History Tab ---- */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.history-header h2 {
    margin-bottom: 0;
}

.history-batch {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
    transition: all var(--transition);
}

.history-batch:hover {
    border-color: var(--border);
}

.history-batch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-light);
}

.history-batch-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.history-time {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
}

.history-file-count {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.history-network-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--primary-light);
    color: var(--primary-hover);
    border: 1px solid rgba(108, 92, 231, 0.2);
}

.history-batch-status {
    font-size: 0.78rem;
    font-weight: 700;
}

.history-batch-status.status-success { color: var(--success); }
.history-batch-status.status-error { color: var(--error); }
.history-batch-status.status-warning { color: var(--warning); }

.history-batch-rows {
    padding: 0;
}

.history-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 72px 92px minmax(0, 1.1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 11px 20px;
    font-size: 0.84rem;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

.history-row:last-child {
    border-bottom: none;
}

.history-row:hover {
    background: var(--bg-subtle);
}

.history-row-status {
    text-align: center;
    font-size: 0.95rem;
    line-height: 1;
}

.history-row-file {
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.79rem;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: ltr;
}

.history-row-size {
    text-align: right;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.76rem;
    white-space: nowrap;
}

.history-row-network {
    text-align: left;
}

/* Smaller chip used inside rows; the larger chip in .history-network-badge
   stays for batch headers. */
.history-network-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--primary-light);
    color: var(--primary-hover);
    border: 1px solid rgba(108, 92, 231, 0.22);
    line-height: 1.4;
}

/* Subtle per-network tint so rows are scannable at a glance.
   Falls back to the default purple if a network key isn't known. */
.history-network-chip.net-unity {
    background: rgba(120, 132, 158, 0.18);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.28);
}
.history-network-chip.net-facebook {
    background: rgba(59, 130, 246, 0.16);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.30);
}
.history-network-chip.net-applovin {
    background: rgba(245, 158, 11, 0.16);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.30);
}

.history-row-target {
    min-width: 0;
    overflow: hidden;
}

.history-target {
    display: inline-block;
    max-width: 100%;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 0.77rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.history-target .platform-icon {
    margin-right: 5px;
    vertical-align: middle;
}

.history-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-row-meta {
    color: var(--text-muted);
    font-size: 0.72rem;
    white-space: nowrap;
    text-align: right;
}

.history-meta {
    opacity: 0.85;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 22px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    animation: toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 380px;
    word-wrap: break-word;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(8px);
}

.toast-success { background: rgba(0, 208, 132, 0.92); }
.toast-error { background: rgba(255, 71, 87, 0.92); }
.toast-info { background: rgba(108, 92, 231, 0.92); }
.toast-warning { background: rgba(255, 165, 2, 0.92); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(16px) scale(0.92); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}


/* Selection */
::selection {
    background: var(--primary-glow);
    color: var(--text);
}

/* ---- Cards (Directory / Compliance) ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 18px;
}

.card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--text); }

/* ---- Directory tab ---- */
.game-card .card-head { justify-content: space-between; }

.game-toggle { cursor: pointer; user-select: none; }
.game-toggle:hover { background: var(--surface-hover); }
.game-body { border-top: 1px solid var(--border-light); }

.dir-subsec {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 12px 18px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-title { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 700; color: var(--text); }

.game-title .gcount { font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--bg-subtle); border-radius: 999px; padding: 2px 8px; }

.dir-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.dir-table th, .dir-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    white-space: nowrap;
}

.dir-table thead th {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border);
}

.dir-table thead th.sortable { cursor: pointer; user-select: none; }
.dir-table thead th.sortable:hover { color: var(--primary); }

.dir-table tbody tr { transition: background 0.12s; }
.dir-table tbody tr:hover { background: var(--surface-hover); }
.dir-table tbody tr:last-child td { border-bottom: none; }

.dir-table td.dir-name {
    max-width: 380px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    color: var(--text);
}

.dir-path { font-size: 10.5px; color: var(--text-muted); font-weight: 500; display: block; }

/* expandable file list under each creative row */
.dir-name { cursor: pointer; }
.dir-chevron { display: inline-block; transition: transform 0.15s; color: var(--text-muted); font-size: 10px; margin-right: 6px; }
tr.expanded .dir-chevron { transform: rotate(90deg); }
.dir-files-row td { background: var(--bg-subtle); padding: 8px 12px 10px 52px; }
.dir-file { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--text-secondary); padding: 2px 0; }
.dir-fsize { color: var(--text-muted); font-size: 10.5px; margin-left: 8px; }

/* Per-version rows: one table row per file, columns aligned with the
   creative row (rule chips + a status cell per network, read-only) */
.dir-version-row td { background: var(--bg-subtle); padding: 3px 12px; border-bottom: 1px solid var(--border-light); }
.dir-version-row .dir-file-cell {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    color: var(--text-secondary);
    padding-left: 52px;
    white-space: normal;   /* wrap long file names — never clip the name or
                              the copy/play buttons behind an ellipsis */
    word-break: break-all;
    max-width: 0;          /* let the table column width win; wrap the rest */
}
.dir-version-row .net-status.file-net { cursor: default; font-size: 10px; padding: 2px 6px; opacity: 0.92; }
.dir-version-row .net-status.file-net:hover { border-color: var(--border); color: inherit; }
.dir-version-row .net-status.file-net.s-none { opacity: 0.5; }
.dir-version-row .net-status.file-net.s-uploaded:hover { border-color: var(--primary); color: var(--primary); }
.dir-version-row .net-status.file-net.s-live:hover { border-color: var(--success); color: #fff; }
.dir-version-row .net-status.file-net.s-rejected:hover { border-color: #b00020; color: #fff; }
.dir-version-row .net-status.file-net.s-queued:hover { border-color: var(--warning); color: var(--warning); }
.dir-version-row .rulechk.file-rule { cursor: default; }
.dir-version-row .rulechk.file-rule.reviewable { cursor: pointer; }
.dir-version-row .rulechk.file-rule[data-overridden="1"] { box-shadow: 0 0 0 2px var(--primary) inset; }

/* Per-version status chips (transcript / rule hits / uploads / AL LIVE) */
.fchips { margin-left: 10px; display: inline-flex; gap: 4px; vertical-align: middle; flex-wrap: wrap; }
.fchip {
    font-family: inherit;
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    white-space: nowrap;
    cursor: default;
}
.fchip-ok { background: var(--success-light, #e6f6ec); color: var(--success); }
.fchip-pending { background: var(--bg-subtle); color: var(--text-muted); }
.fchip-warn { background: var(--warning-light); color: var(--warning); }
.fchip-fail { background: var(--error-light); color: var(--error); }
.fchip-up { background: var(--primary-light); color: var(--primary); }
.fchip-live { background: var(--success); color: #fff; }

.dir-table td.dir-size, .dir-table td.dir-modified {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    font-size: 11.5px;
}

.kind-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kind-chip.kind-video { background: var(--primary-light); color: var(--primary); }
.kind-chip.kind-playable { background: var(--warning-light); color: var(--warning); }

/* compliance stage markers in the directory list */
.cstages { display: inline-flex; gap: 6px; }

.cchk {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 7px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    background: var(--surface);
    user-select: none;
    transition: all 0.14s;
}

.cchk:hover { border-color: var(--success); color: var(--success); }
.cchk.on { background: var(--success); border-color: var(--success); color: #fff; }

/* ---- Upload tray: floating list of in-flight uploads (bottom-right) ---- */
#upload-tray {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 340px;
    max-height: 60vh;          /* big batches scroll instead of filling the screen */
    overflow-y: auto;
}

.tray-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 10px;
    position: sticky;
    top: 0;
}
.tray-min {
    border: none;
    background: none;
    color: var(--text-muted);
    font-weight: 800;
    cursor: pointer;
    padding: 0 4px;
}
.tray-min:hover { color: var(--text); }

.tray-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--warning);
    border-radius: 999px;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.18));
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.tray-pill.failed { border-left-color: var(--error, #d64545); color: var(--error, #d64545); }

.tray-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.18));
    padding: 8px 11px;
}

.tray-row { display: flex; align-items: center; gap: 9px; }

.tray-ficon {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1e293b;
    color: #fff;
    border-radius: 6px;
    font-size: 10px;
}

.tray-body { flex: 1; min-width: 0; }

.tray-name {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tray-sub { display: block; font-size: 10.5px; color: var(--text-secondary); }

/* circular progress ring — fills clockwise as files complete */
.tray-ring {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) calc(var(--p, 0) * 1%), #e2e8f0 0);
    position: relative;
}
.tray-ring::after { content: ''; position: absolute; inset: 4px; background: var(--surface); border-radius: 50%; }

.tray-check, .tray-err {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}
.tray-check { background: var(--success, #16a34a); }
.tray-err { background: var(--error, #d64545); }

.tray-dismiss {
    flex: 0 0 auto;
    border: none;
    background: var(--bg-subtle, #eef1f6);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
}
.tray-dismiss:hover { color: var(--text); }

/* the specific failure reason, right under the failed row */
.tray-fail {
    margin-top: 7px;
    padding: 7px 10px;
    border-radius: 8px;
    background: #fdecec;
    color: var(--error, #d64545);
    font-size: 11px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.tray-fail strong { display: block; margin-bottom: 2px; }

/* ▶ video preview */
.play-btn {
    margin: 0 2px;
    padding: 0 6px;
    border: none;
    background: none;
    color: var(--primary);
    font-size: 11px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.12s;
}
.play-btn:hover { background: var(--primary-light); }

#preview-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 24, 0.72);
    z-index: 400;                 /* above the upload modal (200) and tray (300) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
#preview-backdrop[hidden] { display: none; }

.preview-box {
    display: flex;
    flex-direction: column;
    width: min(920px, 92vw);
    height: min(82vh, 900px);
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    overflow-wrap: anywhere;
}
#preview-close {
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
}
#preview-close:hover { color: var(--text); }
#preview-frame { flex: 1; width: 100%; border: none; background: #000; }

/* copy-name button: quiet until the row is hovered */
.copy-name {
    margin: 0 4px;
    padding: 0 5px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s, color 0.12s;
}

.dir-table tr:hover .copy-name { opacity: 1; }
.copy-name:hover { color: var(--primary); }

.dir-link { color: var(--primary); text-decoration: none; font-size: 12px; }
.dir-link:hover { text-decoration: underline; }

.dir-table input[type="checkbox"] { accent-color: var(--primary); cursor: pointer; }

tr.dir-row-selected { background: var(--primary-light) !important; }

/* ---- Directory: game filter chips ---- */
/* Frozen header, zoom-proof: the PAGE never scrolls on the Directory tab.
   Title, toolbar, chips and filters sit in normal flow; the ROWS live in
   their own scroll box (.dir-viewport) whose height is measured to fill the
   window. Column names stick to the top of that box, and horizontal scroll
   moves header + rows together — nothing can desync at any zoom level. */
.dir-sticky {
    background: var(--bg);
    padding: 10px 0 2px;
}

.dir-viewport {
    overflow: auto;
    max-height: var(--dir-viewport-h, 65vh);
}

.game-filter { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }

.game-icon { width: 26px; height: 26px; border-radius: 7px; object-fit: cover; }

.net-logo { width: 14px; height: 14px; vertical-align: -2px; margin-right: 5px; }

/* One table per game: sticky column headers under the pinned chips/filter
   block, with "Videos" / "Playables" divider rows inside the body. */
.dir-table-sticky thead th {
    position: sticky;
    top: 0;               /* relative to .dir-viewport, its scroll container */
    z-index: 55;
    box-shadow: 0 6px 12px -8px rgba(0, 0, 0, 0.25);
}

.dir-section-row { cursor: pointer; user-select: none; }
.dir-section-row:hover td { color: var(--primary); }

.dir-section-row td {
    background: var(--bg-subtle);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 9px 12px;
}

/* filter bar */
.dir-filterbar {
    display: flex;
    flex-wrap: wrap;          /* overflow wraps to a second row instead of squeezing pills */
    align-items: center;
    gap: 8px 10px;
    margin-bottom: 14px;
    font-size: 12.5px;
    color: var(--text-secondary);
}

/* months filter: plain modern field in the site's control style */
.months-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.months-field input[type="number"] {
    width: 52px;
    padding: 5px 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.14s, box-shadow 0.14s;
}

.months-field input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.dir-filterbar-sep { width: 1px; height: 18px; background: var(--border); }

.net-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    height: 26px;
    white-space: nowrap;      /* a pill never breaks its label onto two lines */
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    cursor: pointer;
    user-select: none;
    transition: all 0.14s;
    opacity: 0.55;
}

.net-toggle:hover { border-color: var(--primary); }
.net-toggle.on { color: var(--text); border-color: var(--primary); background: var(--primary-light); opacity: 1; }
.net-toggle .pill-count { font-size: 10.5px; font-weight: 700; line-height: 1; padding: 2px 6px; border-radius: 999px; background: var(--bg-subtle); color: var(--text-muted); }
.net-toggle.on .pill-count { background: var(--surface); color: var(--text); }
.dir-filterbar > .muted { white-space: nowrap; flex-shrink: 0; }

/* ---- In-Directory upload popup ---- */
.modal.upmodal { width: 94vw; max-width: 980px; }  /* outranks .modal's fixed 480px */

/* A big batch selection must never push the popup off-screen: the title and
   the Cancel/Upload buttons stay put, everything between them scrolls. */
.modal.upmodal {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);  /* backdrop has 20px padding each side */
}
.upmodal-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;   /* keep content clear of the scrollbar */
}

.upmodal-warning {
    margin: 10px 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--warning-light);
    color: var(--warning);
    font-size: 12.5px;
    font-weight: 600;
}

.upmodal-sec { margin: 12px 0; }

.upmodal-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.upmodal-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12.5px;
}

.upmodal-file:hover { background: var(--surface-hover); }

.upmodal-fname {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;   /* full names always visible — wrap, never clip */
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px;
}

.upmodal-choices { display: flex; flex-wrap: wrap; gap: 8px; }

.upmodal-choice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    background: var(--surface);
}

.upmodal-choice:hover { border-color: var(--primary); }

#upmodal-progress {
    max-height: 180px;
    overflow-y: auto;
    border-top: 1px solid var(--border-light);
    padding-top: 8px;
}

#up-chain { width: 100%; }
.up-endcard-list { max-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
/* one block per app: app name on its own line, campaign checkboxes wrap below */
.up-chain-camp { display: block; padding: 6px 0; width: 100%; }
.up-chain-app { font-weight: 700; font-size: 12px; color: var(--text); margin-bottom: 5px; }

.log-result { max-width: 340px; white-space: normal !important; font-size: 11.5px; }
.log-result .status-error { color: var(--error, #d64545); }

.upmodal-line { font-size: 12px; padding: 2px 0; color: var(--text-secondary); }
.upmodal-line.ok { color: var(--success); }
.upmodal-line.err { color: var(--error, #d64545); }

/* rule type chip in the Compliance tab */
.type-chip {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.type-chip.type-text { background: var(--primary-light); color: var(--primary); }
.type-chip.type-video { background: var(--warning-light); color: var(--warning); }
.type-chip.type-manual { background: var(--bg-subtle); color: var(--text-secondary); }

.games-chip {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

.rule-games { display: flex; gap: 10px; align-items: center; padding: 8px 0 0; font-size: 12.5px; }
.rule-games label { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.rule-games-inline { display: inline-flex; padding: 0; margin-left: 6px; gap: 8px; }
.games-chip { cursor: pointer; }
.games-chip:hover { color: var(--primary); }

/* checker assignment chip (click to reassign) */
.checker-chip {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    cursor: pointer;
    border: 1px dashed var(--border);
    color: var(--text-secondary);
    background: var(--surface);
}

.checker-chip.wired { border-style: solid; color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.checker-chip.placeholder { color: var(--warning); border-color: var(--warning); }
.checker-chip:hover { border-color: var(--primary); }

.checker-select {
    margin-left: 6px;
    font-size: 11px;
    padding: 2px 6px;
    border: 1px solid var(--primary);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
    max-width: 160px;
}

.game-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.14s;
}

.game-chip:hover { border-color: var(--primary); color: var(--text); }
.game-chip.active { border-color: var(--primary); background: var(--primary-light); color: var(--text); }

.game-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.gcount { font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--bg-subtle); border-radius: 999px; padding: 2px 8px; }
.game-chip.active .gcount { background: var(--surface); }

/* ---- Directory: per-rule compliance chips ---- */
.rulechk {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 4px;
    cursor: pointer;
    font-size: 10.5px;
    font-weight: 700;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-muted);
    background: var(--surface);
    user-select: none;
    transition: all 0.14s;
}

.rulechk:hover { border-color: var(--primary); color: var(--primary); }
.rulechk.pass { background: var(--success); border-color: var(--success); color: #fff; }
.rulechk.fail { background: var(--error, #d64545); border-color: var(--error, #d64545); color: #fff; }
.rulechk.pending { background: var(--warning-light); border-color: var(--warning); color: var(--warning); }
.rulechk.locked { cursor: default; }
.rulechk.locked:hover { border-color: var(--border); color: inherit; }
.rulechk.locked.pass:hover { border-color: var(--success); color: #fff; }
.rulechk.locked.fail:hover { border-color: var(--error, #d64545); color: #fff; }
.rulechk.approve { border-style: dashed; }
.rulechk.approve.on { background: var(--primary); border-color: var(--primary); color: #fff; border-style: solid; }

/* Ticket (funnel) status chip — Directory column + Funnel tab */
.ticket-cell { text-align: center; }
.ticket-link { text-decoration: none; }

.ticket-chip {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    cursor: pointer;
}

.ticket-chip.t-live { background: #037f4c; color: #fff; }
.ticket-chip.t-done { background: #00c875; color: #fff; }
.ticket-chip.t-wip { background: var(--warning-light); color: var(--warning); }
.ticket-chip.t-rej { background: var(--error, #d64545); color: #fff; }
.ticket-chip.t-off { background: var(--bg-subtle); color: var(--text-muted); }
.ticket-chip.t-none { background: transparent; color: var(--text-muted); border: 1px dashed var(--border); padding: 2px 10px; }
.ticket-chip.t-none:hover { border-color: var(--primary); color: var(--text); }

/* ---- Funnel tab (looks like the Monday board it replaced) ---- */
.funnel-form { padding: 14px 18px; }
.funnel-form textarea, .funnel-form input[type="date"] {
    width: 100%; padding: 11px 16px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 0.875rem; background: var(--bg-subtle); color: var(--text); font-family: inherit; resize: vertical;
}
.funnel-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 18px; border-bottom: 1px solid var(--border-light); }
.funnel-filterbar .sep { width: 1px; height: 18px; background: var(--border-light); margin: 0 6px; }
.funnel-search { font-size: 12.5px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-subtle); color: var(--text); min-width: 220px; }
.funnel-view { display: inline-flex; gap: 4px; }
/* Monday-style filter toolbar */
.funnel-filterbar { gap: 8px; }
.fb-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; background: transparent; color: #323338; font-size: 13.5px; font-family: inherit; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.fb-btn:hover { background: var(--bg-subtle); }
.fb-btn.on { background: #e5f4ff; color: #0073ea; border-color: #cce5ff; }
.fb-ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.fb-badge { background: #0073ea; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.fb-caret { font-size: 11px; opacity: 0.7; }
.fb-clear { border: 0; background: transparent; color: #0073ea; font-size: 13px; cursor: pointer; padding: 6px 8px; font-family: inherit; }
.fb-clear:hover { text-decoration: underline; }
.mv-pop.mv-pop-filter { width: 320px; }
.fp-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.fp-actions { font-weight: 400; font-size: 12.5px; color: #676879; }
.fp-actions a { color: #0073ea; text-decoration: none; }
.fp-row { gap: 10px; cursor: pointer; justify-content: flex-start; }
.fp-row input { margin: 0; }
.fp-row .mv-dot { margin: 0; width: 10px; height: 10px; }
.fp-label { flex: 1; }
.fp-count { color: #676879; font-size: 12px; }
.fp-dim { opacity: 0.55; }
.fp-foot { text-align: left; font-size: 12.5px; color: #676879; }
.fp-settled { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* advanced filter panel */
.mv-pop.mv-pop-rules { width: 860px; max-width: calc(100vw - 16px); }
.rl-head { display: flex; align-items: center; gap: 16px; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.rl-head .rl-clear { margin-left: auto; font-weight: 400; font-size: 12.5px; color: #0073ea; text-decoration: none; }
.rl-op { font-weight: 400; font-size: 12.5px; color: #676879; display: inline-flex; gap: 4px; align-items: center; }
.rl-op-btn { padding: 2px 8px; border-radius: 999px; border: 1px solid #e6e9ef; cursor: pointer; }
.rl-op-btn.on { background: #e5f4ff; border-color: #cce5ff; color: #0073ea; }
.rl-rows { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; }
.rl-row { display: grid; grid-template-columns: 110px 150px 160px 1fr 26px; gap: 8px; align-items: start; }
.rl-sel, .rl-in { font-size: 13px; padding: 6px 8px; border: 1px solid #c3c6d4; border-radius: 4px; background: #fff; color: #323338; font-family: inherit; max-width: 100%; }
.rl-val { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 32px; }
.rl-multi { display: flex; flex-wrap: wrap; gap: 4px; }
.rl-chk { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 8px; border-radius: 999px; border: 1px solid #e6e9ef; cursor: pointer; }
.rl-chk.on { background: #e5f4ff; border-color: #cce5ff; color: #0073ea; }
.rl-chk input { margin: 0; }
.rl-n { width: 70px; }
.rl-add { margin-top: 10px; }
.rl-hint { font-size: 11.5px; margin-top: 8px; }
.rl-showing { font-weight: 400; font-size: 12.5px; }
.rl-exact { font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }

/* resizable table columns */
.funnel-table.has-widths { table-layout: fixed; }
.funnel-table th { position: relative; }
.funnel-table td { overflow: hidden; text-overflow: ellipsis; }
.col-resizer { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; user-select: none; }
.col-resizer:hover, .funnel-table.resizing .col-resizer { background: linear-gradient(to right, transparent 2px, #0073ea 2px, #0073ea 4px, transparent 4px); }
.funnel-table.resizing { user-select: none; cursor: col-resize; }

.mv-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }

/* shared Monday-style bits */
.mv-chip { display: inline-flex; align-items: center; gap: 6px; background: #f5f6f8; border-radius: 4px; padding: 3px 8px 3px 0; font-size: 12.5px; color: #323338; line-height: 18px; overflow: hidden; }
.mv-chip > :first-child:not(.mv-bar):not(.mv-ico) { margin-left: 8px; }
.mv-bar { display: inline-block; width: 4px; align-self: stretch; min-height: 18px; margin-right: 2px; }
.mv-ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-left: 8px; flex: none; }
.mv-chip.mv-overdue { color: #e2445c; }
.mv-chip-tags { gap: 4px; }
.mv-tag { display: inline-block; background: #cce5ff; color: #0073ea; border-radius: 4px; padding: 1px 6px; font-size: 12.5px; line-height: 18px; }
.mv-solid { display: inline-block; color: #fff; border-radius: 4px; padding: 3px 10px; font-size: 12.5px; }
.mv-select { appearance: none; -webkit-appearance: none; color: #fff; border: 0; border-radius: 4px; padding: 5px 24px 5px 10px; font-size: 12.5px; font-family: inherit; cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 6px center; background-size: 12px; }
.mv-select option { color: #323338; background: #fff; }
.mv-select-wide { width: 100%; text-align: center; padding: 10px 24px 10px 10px; font-size: 13.5px; border-radius: 4px; }
.mv-avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; }
.mv-avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.mv-avatar-md { width: 32px; height: 32px; font-size: 12px; }
.mv-avatar-empty { background: #f5f6f8; color: #c4c4c4; border: 1px solid #e6e9ef; }

/* board */
.mv-board { display: flex; gap: 18px; padding: 16px 18px 20px; overflow-x: auto; overflow-y: hidden; align-items: stretch; height: calc(100vh - 250px); min-height: 360px; background: var(--surface); }
.mv-col { flex: 0 0 300px; background: #f5f6f8; border-radius: 6px; display: flex; flex-direction: column; min-height: 0; }
.mv-col.dragover { outline: 2px solid #0073ea; outline-offset: -2px; }
.mv-col-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; color: #fff; font-weight: 600; font-size: 15px; border-radius: 6px 6px 0 0; flex: none; }
.mv-col-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-col-count { font-size: 13px; font-weight: 500; opacity: 0.95; }
.mv-col-hide { margin-left: auto; border: 0; background: rgba(255,255,255,0.18); color: #fff; width: 22px; height: 22px; border-radius: 4px; cursor: pointer; font-size: 12px; line-height: 1; opacity: 0; transition: opacity 0.15s; }
.mv-col:hover .mv-col-hide { opacity: 1; }
.mv-col-hide:hover { background: rgba(255,255,255,0.35); }
.fp-hidden { font-size: 10.5px; color: #676879; background: #f5f6f8; border-radius: 4px; padding: 1px 6px; margin-left: 6px; }
.mv-cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1 1 auto; min-height: 80px; }
.mv-empty { min-height: 60px; }
.mv-card { background: #fff; border: 1px solid #e6e9ef; border-radius: 6px; padding: 12px 12px 8px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,0.04); color: #323338; }
.mv-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.10); }
.mv-card.dragging { opacity: 0.35; background: #f5f6f8; border-style: dashed; box-shadow: none; }
.mv-card.dragging > * { visibility: hidden; }
.mv-drag-ghost { position: fixed; z-index: 2000; pointer-events: none; opacity: 1; background: #fff; box-shadow: 0 14px 32px rgba(0,0,0,0.26); transform: rotate(2deg); cursor: grabbing; margin: 0; }
.mv-drop-slot { border: 2px dashed #0073ea; border-radius: 6px; color: #0073ea; font-size: 12px; text-align: center; padding: 14px 0; background: #e5f4ff; flex: none; }
.mv-col:not(.dragover) .mv-drop-slot { display: none; }
.mv-card-name { font-size: 14px; margin-bottom: 10px; word-break: break-word; line-height: 1.35; }
.mv-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.mv-chips:empty { display: none; }
.mv-card-foot { display: flex; align-items: center; justify-content: space-between; min-height: 28px; margin-top: 4px; }
.mv-foot-icons { display: inline-flex; align-items: center; gap: 12px; color: #676879; font-size: 13px; }
.mv-foot-icons .mv-ico { margin-left: 0; width: 18px; height: 18px; }
.mv-comments { display: inline-flex; align-items: center; gap: 4px; }
.mv-folder { color: #676879; display: inline-flex; }
.mv-folder:hover { color: #0073ea; }
.mv-folder-none { opacity: 0.5; }
.mv-more { border: 0; background: transparent; color: #676879; font-size: 18px; line-height: 1; padding: 0 4px; cursor: pointer; border-radius: 4px; }
.mv-more:hover { background: #e6e9ef; color: #323338; }
.mv-menu { position: absolute; z-index: 1200; width: 240px; background: #fff; color: #323338; border: 1px solid #e6e9ef; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.16); padding: 6px; font-size: 13.5px; overflow-y: auto; }
.mv-menu-item { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; }
.mv-menu-item:hover { background: #f5f6f8; }
.mv-menu-item .mv-dot { margin-right: 8px; }
.mv-menu-label { padding: 6px 10px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: #676879; }
.mv-menu-sep { height: 1px; background: #e6e9ef; margin: 4px 0; }
.mv-menu-danger { color: #e2445c; }
.mi-delete-btn { color: #e2445c; }

/* request form = item-page language, centered like Monday's form */
.funnel-form-card { max-width: 860px; margin: 0 auto 18px; background: #fff; color: #323338; border: 1px solid #e6e9ef; }
.mi-form { padding: 26px 32px 24px; }
.mi-form .ff-name { width: 100%; margin-left: 0; font-size: 24px; }
.mi-form .ff-name::placeholder { color: #9699a6; font-weight: 400; }
.mi-form .mi-crumb { margin: 6px 0 22px; color: #676879; font-size: 13.5px; }
.mi-form .mi-crumb b { color: #323338; font-weight: 600; }
.mi-row-top { align-items: start; }
.mi-row-top .mi-label { padding-top: 12px; }
.mi-form .mi-save { margin-top: 22px; }

/* Monday-style pickers */
.mv-pick { color: #fff; border-radius: 4px; padding: 11px 14px; font-size: 14px; text-align: center; cursor: pointer; font-weight: 500; }
.mv-pick:hover { filter: brightness(1.06); }
.mi-tags.mi-pick { color: #323338; text-align: left; font-weight: 400; padding: 8px 10px; min-height: 44px; cursor: pointer; }
.mi-pick-caret { margin-left: auto; color: #676879; font-size: 12px; }
.mv-pick-cell { cursor: pointer; }
.mv-pick-cell:hover { filter: brightness(1.06); }
.mv-pick-tags { display: inline-flex; gap: 4px; min-width: 40px; min-height: 22px; align-items: center; }
.mv-pop { position: fixed; z-index: 1400; display: flex; flex-direction: column; box-sizing: border-box; background: #fff; color: #323338; border: 1px solid #e6e9ef; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.18); padding: 14px; width: 420px; max-width: calc(100vw - 16px); font-size: 14px; }
.mv-pop::before { content: ""; position: absolute; top: -7px; left: calc(var(--arrow-x, 50%) - 7px); width: 14px; height: 14px; background: #fff; border-left: 1px solid #e6e9ef; border-top: 1px solid #e6e9ef; transform: rotate(45deg); }
.mv-pop.mv-pop-above::before { top: auto; bottom: -7px; transform: rotate(225deg); }
.mv-pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mv-tile { color: #fff; border-radius: 4px; padding: 10px 8px; text-align: center; font-weight: 500; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-tile:hover { filter: brightness(1.08); }
.mv-tile.current { outline: 2px solid #323338; outline-offset: 1px; }
.mv-pop-foot { border-top: 1px solid #e6e9ef; margin-top: 12px; padding-top: 10px; text-align: center; }
.mv-pop-edit { color: #323338; cursor: pointer; font-size: 14px; padding: 6px 12px; border-radius: 4px; display: inline-block; }
.mv-pop-edit:hover { background: #f5f6f8; }
.mv-pop-search { width: 100%; border: 1px solid #c3c6d4; border-radius: 4px; padding: 8px 10px; font-size: 14px; font-family: inherit; color: #323338; margin-bottom: 8px; outline: none; }
.mv-pop-search:focus { border-color: #0073ea; }
.mv-pop-list { max-height: 300px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.mv-pick-grid { overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.mv-pop-search, .mv-pop-foot { flex: none; }
.mv-pop-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 8px; border-radius: 4px; cursor: pointer; }
.mv-pop-row:hover { background: #f5f6f8; }
.mv-pop-row.on { background: #e5f4ff; }
.mv-check { color: #0073ea; font-weight: 700; width: 18px; text-align: center; }
.mv-pop-create { color: #0073ea; font-weight: 500; }
.mv-tag-x { display: inline-flex; align-items: center; gap: 4px; }
.mv-tag-x b { font-weight: 400; cursor: pointer; opacity: 0.6; padding: 0 2px; }
.mv-tag-x b:hover { opacity: 1; }
.mi-adtypes .mi-adtype-add { min-width: 110px; }

/* Labels dialog */
.modal.funnel-labels { width: 92vw; max-width: 980px; max-height: 90vh; overflow: auto; background: #fff; color: #323338; position: relative; padding: 26px 30px; }
.fl-title { margin: 0 0 4px; font-size: 22px; font-weight: 600; }
.fl-sub { color: #676879; font-size: 13.5px; margin-bottom: 18px; }
.fl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.fl-grid h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: #676879; }
.fl-row { display: grid; grid-template-columns: 34px 1fr auto auto 26px; align-items: center; gap: 8px; padding: 4px 0; }
.fl-row input[type="color"] { width: 32px; height: 28px; border: 1px solid #e6e9ef; border-radius: 4px; padding: 1px; background: #fff; cursor: pointer; }
.fl-row input[type="text"] { font-size: 13.5px; padding: 6px 10px; border: 1px solid #e6e9ef; border-radius: 4px; color: #323338; background: #fff; font-family: inherit; }
.fl-row input[type="text"]:read-only { background: #f5f6f8; color: #676879; }
.fl-check { font-size: 12px; color: #676879; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.fl-use, .fl-key { font-size: 11.5px; color: #676879; white-space: nowrap; }
.fl-x { border: 0; background: transparent; color: #676879; font-size: 18px; cursor: pointer; border-radius: 4px; }
.fl-x:hover:not(:disabled) { background: #f5f6f8; color: #e2445c; }
.fl-x:disabled { opacity: 0.3; cursor: not-allowed; }
.fl-add { margin-top: 6px; }
.fl-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: #f5f6f8; border-radius: 4px; padding: 8px 10px; }
.fl-tag-add { flex: 1; min-width: 120px; border: 0; background: transparent; font-size: 13px; padding: 4px; outline: none; color: #323338; }
.fl-foot { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
@media (max-width: 900px) { .fl-grid { grid-template-columns: 1fr; } }

/* table */
.funnel-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.funnel-table th { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); white-space: nowrap; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.funnel-table td { padding: 7px 10px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.funnel-table tr.funnel-row { cursor: pointer; }
.funnel-table tr.funnel-row:hover td { background: var(--surface-hover); }
.funnel-table .fn-name { font-weight: 500; }
.funnel-table .fn-nofolder { color: var(--text-muted); font-style: italic; }
.funnel-table .fn-due.overdue { color: #e2445c; font-weight: 600; }
.funnel-viewport { max-height: calc(100vh - 270px); overflow: auto; }

/* item page (modal) */
.modal.funnel-modal { width: 96vw; max-width: 1240px; height: 88vh; padding: 0; overflow: hidden; background: #fff; color: #323338; position: relative; }
.funnel-modal-x { position: absolute; top: 14px; right: 16px; background: none; border: 0; font-size: 22px; line-height: 1; color: #676879; cursor: pointer; z-index: 2; }
.funnel-modal-x:hover { color: #323338; }
.mi { display: grid; grid-template-columns: 1fr 1fr; height: 88vh; }
.mi-left { padding: 28px 32px; overflow: auto; border-right: 1px solid #e6e9ef; }
.mi-right { padding: 20px 28px; overflow: auto; background: #fff; }
.mi-head { margin-bottom: 22px; }
.mi-title { font-size: 26px; font-weight: 500; color: #323338; border: 1px solid transparent; border-radius: 4px; padding: 2px 6px; margin-left: -7px; width: calc(100% - 30px); font-family: inherit; background: transparent; }
.mi-title:hover, .mi-title:focus { border-color: #c3c6d4; outline: none; background: #fff; }
.mi-crumb { font-size: 14px; color: #323338; margin-top: 4px; }
.mi-crumb a { color: #676879; text-decoration: none; }
.mi-fields { display: flex; flex-direction: column; gap: 12px; }
.mi-row { display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 14px; }
.mi-label { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; color: #323338; }
.mi-ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; color: #323338; }
.mi-value { min-height: 44px; display: flex; align-items: center; }
.mi-value > * { width: 100%; }
.mi-inline, .mi-desc { border: 1px solid transparent; background: #f5f6f8; border-radius: 4px; padding: 11px 14px; font-size: 14px; color: #323338; font-family: inherit; }
.mi-inline:hover, .mi-desc:hover { border-color: #c3c6d4; }
.mi-inline:focus, .mi-desc:focus { outline: none; border-color: #0073ea; background: #fff; }
.mi-desc { resize: vertical; width: 100%; }
.mi-person { display: flex; align-items: center; gap: 10px; background: #f5f6f8; border-radius: 4px; padding-left: 10px; }
.mi-person .mi-inline { background: transparent; flex: 1; }
.mi-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: #f5f6f8; border-radius: 4px; padding: 6px 10px; }
.mi-tags .mi-inline { flex: 1; min-width: 120px; background: transparent; padding: 5px 4px; }
.mi-link { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; background: #ff642e; color: #fff; border-radius: 4px; margin-right: 6px; }
.mi-link .mi-ico { width: 16px; height: 16px; margin: 0; color: #fff; }
.mi-value .mi-link { width: 30px; }
.mi-folder { color: #0073ea; text-decoration: none; background: #f5f6f8; border-radius: 4px; padding: 11px 14px; font-size: 14px; }
.mi-save { margin-top: 18px; display: flex; align-items: center; gap: 10px; }
.mi-tabs { display: flex; gap: 22px; border-bottom: 1px solid #e6e9ef; margin-bottom: 14px; }
.mi-tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 2px 12px; font-size: 15px; color: #676879; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.mi-tab.on { color: #0073ea; border-bottom-color: #0073ea; }
.mi-tab .mi-ico { color: inherit; }
.mi-composer { border: 1px solid #c3c6d4; border-radius: 8px; padding: 12px 14px; margin-bottom: 18px; }
.mi-composer:focus-within { border-color: #0073ea; }
.mi-composer textarea { width: 100%; border: 0; resize: vertical; font-size: 15px; font-family: inherit; color: #323338; background: transparent; outline: none; }
.mi-composer-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.mi-update { border: 1px solid #e6e9ef; border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.mi-update-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mi-update-who { font-weight: 600; font-size: 15px; }
.mi-update-when { color: #676879; font-size: 13px; margin-left: auto; }
.mi-update-body { font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.mi-update-body a { color: #0073ea; }
.mi-act { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #e6e9ef; font-size: 14px; }
.mi-act-text { flex: 1; }
.mi-none { color: #676879; text-align: center; padding: 30px 0; font-size: 15px; }
@media (max-width: 900px) { .mi { grid-template-columns: 1fr; height: auto; } .mi-left { border-right: 0; border-bottom: 1px solid #e6e9ef; } .modal.funnel-modal { height: auto; max-height: 92vh; overflow: auto; } }

/* ---- Directory: per-network status cells ---- */
.dir-table th.net-head { text-align: center; }

/* AUTO switch in the network column header — inline next to the label so
   every column header stays on one aligned line */
.auto-pill {
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
    padding: 1px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: var(--surface);
    cursor: pointer;
    user-select: none;
    opacity: 0.6;
    transition: all 0.14s;
}
.auto-pill:hover { opacity: 1; border-color: var(--primary); }
.auto-pill.on {
    color: #fff;
    background: linear-gradient(135deg, #059669, #10b981);
    border-color: transparent;
    opacity: 1;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.55);
}
.dir-table td.net-cell { text-align: center; white-space: nowrap; }

.net-status {
    display: inline-block;
    width: 78px;               /* constant width so the ⬆ button never shifts */
    box-sizing: border-box;
    text-align: center;
    padding: 3px 0;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    user-select: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: var(--surface);
    transition: all 0.14s;
}

.net-status:hover { border-color: var(--primary); color: var(--primary); }
.net-status.s-uploaded { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.net-status.s-live { background: var(--success); border-color: var(--success); color: #fff; }
.net-status.s-rejected { background: #b00020; border-color: #b00020; color: #fff; }
.net-status.s-queued { background: var(--warning-light); border-color: var(--warning); color: var(--warning); }

.net-status.s-uploading {
    background: var(--warning-light);
    border-color: var(--warning);
    color: var(--warning);
    cursor: default;
    animation: uploading-pulse 1.2s ease-in-out infinite;
}

@keyframes uploading-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.net-upload {
    margin-left: 5px;
    width: 26px;
    box-sizing: border-box;
    padding: 2px 0;
    font-size: 11px;
    line-height: 1.4;
    border: 1px solid rgba(124, 92, 255, 0.45);
    border-radius: 7px;
    background: rgba(124, 92, 255, 0.08);
    color: #7c5cff;
    cursor: pointer;
    transition: all 0.16s;
    box-shadow: 0 0 8px rgba(124, 92, 255, 0.3);
}

.net-upload:hover {
    background: #7c5cff;
    border-color: #7c5cff;
    color: #fff;
    box-shadow: 0 0 14px rgba(124, 92, 255, 0.65);
    transform: translateY(-1px);
}

/* the popup's main Upload action + Directory bulk button get the same glow */
#upmodal-go, #directory-upload-btn {
    background: linear-gradient(135deg, #7c5cff, #9a7bff);
    border-color: #7c5cff;
    box-shadow: 0 0 12px rgba(124, 92, 255, 0.45);
}

#upmodal-go:hover:not(:disabled), #directory-upload-btn:hover:not(:disabled) {
    box-shadow: 0 0 18px rgba(124, 92, 255, 0.7);
}

/* version-kind tag in the expanded file list */
.ver-kind {
    display: inline-block;
    min-width: 52px;
    margin-right: 8px;
    text-align: center;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ver-kind.ver-video { background: var(--primary-light); color: var(--primary); }
.ver-kind.ver-playable { background: var(--warning-light); color: var(--warning); }
.ver-kind.ver-image { background: var(--bg-subtle); color: var(--text-muted); }

/* staged-from-Drive chip badge */
.staged-file-chip .drive-badge {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
    background: var(--primary-light);
    border-radius: 999px;
    padding: 1px 7px;
}

.staged-file-chip.noncompliant { border-color: var(--warning); }
.staged-file-chip.noncompliant .drive-badge { color: var(--warning); background: var(--warning-light); }

/* ---- Compliance tab ---- */
.compliance-card { padding: 0; }

.stage-explainer { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1px; background: var(--border-light); }

.stage-box { background: var(--surface); padding: 14px 18px; }

.stage-box .stage-name { font-size: 12.5px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 7px; }

.stage-box .stage-desc { font-size: 11.5px; color: var(--text-secondary); margin-top: 4px; line-height: 1.45; }

.stage-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 10.5px;
    font-weight: 700;
}

.rule-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-light);
}

.rule-row .rule-info { flex: 1; min-width: 0; }

.rule-row .rule-name { font-size: 13px; font-weight: 650; color: var(--text); }

.rule-row .rule-desc { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }

.rule-row .rule-patterns {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 2px 8px;
    margin-top: 4px;
    display: inline-block;
}

.sev-chip {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sev-chip.sev-high { background: var(--error-light); color: var(--error); }
.sev-chip.sev-medium { background: var(--warning-light); color: var(--warning); }
.sev-chip.sev-low { background: var(--bg-subtle); color: var(--text-secondary); }

.rule-row.disabled .rule-name, .rule-row.disabled .rule-desc, .rule-row.disabled .rule-patterns { opacity: 0.45; }

/* Regex cheat-sheet popover */
.regex-help-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; margin-left: 6px; padding: 0;
    border: 1px solid var(--border); border-radius: 50%;
    background: var(--bg-subtle); color: var(--text-secondary);
    font-size: 10px; font-weight: 700; cursor: pointer; vertical-align: middle;
}
.regex-help-btn:hover { border-color: var(--primary); color: var(--primary); }
.regex-hint { display: block; margin-top: 4px; font-size: 10.5px; }
.regex-help-pop {
    margin: 10px 18px; padding: 14px 16px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-subtle); font-size: 12px; color: var(--text);
}
.regex-help-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 8px; }
.regex-help-head button { border: none; background: none; cursor: pointer; color: var(--text-muted); font-size: 14px; }
.regex-help-pop p { margin: 6px 0; line-height: 1.5; }
.regex-help-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.regex-help-table th { text-align: left; padding: 4px 8px; font-size: 10.5px; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.regex-help-table td { padding: 4px 8px; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.regex-help-pop code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px; background: var(--bg); padding: 1px 5px;
    border-radius: 4px; border: 1px solid var(--border-light);
}
.regex-help-key { font-size: 11px; color: var(--text-secondary); }

/* Inline rule editor (✎ Edit) */
/* Inline rule editor (redesigned Nir 2026-09-14): was a single column of
   full-width fields — a name box as wide as the screen above a lone dropdown.
   Now a 3-column grid: identity on top, patterns full width, scope and
   actions on one footer row, inside a framed panel so it reads as a form
   rather than loose inputs stacked in the row. */
.rule-edit-form {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px 14px;
    padding: 16px 18px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.rule-edit-form .ef-name { grid-column: 1; }
.rule-edit-form .ef-source { grid-column: 2; }
.rule-edit-form .ef-files { grid-column: 3; }
.rule-edit-form .ef-desc,
.rule-edit-form .ef-patterns { grid-column: 1 / -1; }

/* scope + actions share the footer row: scope left, buttons hard right */
.rule-edit-form .ef-scope {
    grid-column: 1 / 3;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.rule-edit-form .rule-edit-actions {
    grid-column: 3;
    justify-content: flex-end;
    align-items: center;
}

.rule-edit-form .edit-require {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    text-transform: none;
    white-space: nowrap;
}
.rule-edit-form .edit-require input { width: auto; }

.rule-edit-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 0;
}

.rule-edit-form input,
.rule-edit-form textarea,
.rule-edit-form select {
    font-size: 12.5px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    width: 100%;
    min-width: 0;
}

.rule-edit-form textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px;
    resize: vertical;
}

.rule-edit-form input:focus,
.rule-edit-form textarea:focus,
.rule-edit-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.rule-edit-actions { display: flex; gap: 8px; }

/* the row's own buttons are hidden while its editor is open, so the editor
   spans the full row instead of leaving a dead button stack beside it */
.rule-row.editing { align-items: stretch; }

.rule-edit-form .edit-games-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.rule-edit-form .edit-games-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.rule-edit-form .edit-game {
    flex-direction: row;
    align-items: center;
    gap: 5px;
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
}
.rule-edit-form .edit-game input { width: auto; }

/* ---- Orphans tab ---- */
.orphans-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.orphans-table th {
    text-align: left; padding: 6px 10px; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.orphans-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.orphans-table .orphan-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; word-break: break-all; }
.orphans-table tr.orphan-fail td { background: var(--error-light); }

.edit-games-row { display: flex; align-items: center; gap: 12px; }

.edit-games-row .edit-games-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); }

.edit-games-row .edit-game {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
}

/* Add-rule bar (Nir 2026-09-14): the regex hint used to sit INSIDE the
   patterns column, so with align-items:flex-end that column's input floated
   above every other control and the labels stepped up and down the row. The
   hint is now its own full-width line under the fields, and each select gets
   a width that fits its longest option instead of truncating mid-word. */
.rule-add-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-subtle);
}

.rule-add-row {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.rule-add-form .form-group { margin-bottom: 0; min-width: 150px; flex: 1; }
.rule-add-form .form-group label { white-space: nowrap; }

/* enough room for the longest option in each, so nothing clips */
.rule-add-form .fg-type { flex: 0 0 150px; }
.rule-add-form .fg-source { flex: 0 0 175px; }
.rule-add-form .fg-files { flex: 0 0 150px; }

/* the inverted-rule checkbox lines up with the inputs, not the labels */
.rule-add-form .fg-check { flex: 0 0 auto; }
.rule-add-form .fg-check label {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 43px;           /* matches an input: 11px padding + text + border */
    margin-bottom: 0;
    white-space: nowrap;
}
.rule-add-form .fg-check input { width: auto; }

.rule-add-form .regex-hint { display: block; font-size: 0.75rem; line-height: 1.4; }
.rule-add-form button[type="submit"] { flex: 0 0 auto; height: 43px; }

/* ---- Modal ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.4);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* shown only via the explicit .open class — never by default */
.modal-backdrop.open { display: flex; }
.modal-backdrop[hidden] { display: none; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 480px;
    max-width: 95vw;
    padding: 22px 24px;
}

.modal h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: var(--text); }

.modal #modal-body { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.modal #modal-body ul { margin: 10px 0 0 18px; }

.modal #modal-body li { margin-bottom: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.btn-warning {
    background: var(--warning);
    color: #fff;
    border: none;
}

.btn-warning:hover { filter: brightness(1.08); color: #fff; }

/* Responsive */
@media (max-width: 640px) {
    .container { padding: 20px 16px; }
    .layout { flex-direction: column; }
    .sidebar { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid var(--border); padding: 10px 12px; }
    .sidebar-inner { position: static; flex-direction: row; overflow-x: auto; }
    .tab { width: auto; white-space: nowrap; }
    .navlbl { display: none; }
    .header-row { flex-direction: column; align-items: flex-start; gap: 14px; }
    .form-row { grid-template-columns: 1fr; }
    .tabs { overflow-x: auto; }
    .toolbar { flex-wrap: wrap; }
    .toolbar-right { margin-left: 0; width: 100%; }
    .upload-row { flex-direction: column; align-items: flex-start; gap: 10px; }
    .upload-row-info { min-width: auto; }
    .upload-row-status { text-align: left; }
    .network-chips { gap: 6px; }
    .network-chip { padding: 8px 14px; font-size: 0.82rem; }
    .staged-file-chip { font-size: 0.78rem; padding: 6px 12px; }
    #upload-actions { flex-direction: column; }
    .network-cell { flex-wrap: wrap; gap: 8px; }
    .network-cell-label { min-width: auto; }
    .network-cell-status { min-width: auto; text-align: left; }
    /* On narrow viewports collapse the 6-col grid into:
       row 1: [status] [filename .......................... ]
       row 2:         [size · network · target · meta             ] */
    .history-row {
        grid-template-columns: 22px 1fr;
        grid-template-rows: auto auto;
        gap: 4px 10px;
    }
    .history-row-status { grid-row: 1; }
    .history-row-file { grid-row: 1; grid-column: 2; }
    .history-row-size,
    .history-row-network,
    .history-row-target,
    .history-row-meta {
        grid-row: 2;
        grid-column: 2;
        display: inline-flex;
        align-items: center;
        margin-right: 8px;
    }
    .history-row-meta { margin-right: 0; }
    .history-batch-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ---- Winners tab ---- */
.winners-controls { display: inline-flex; gap: 12px; align-items: center; margin-right: 8px; flex-wrap: wrap; }
.winners-controls label { font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.winners-select { font-size: 12px; padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
.winners-meta { font-size: 11.5px; font-weight: 400; margin-left: 8px; }
.winners-source { font-size: 11.5px; margin: -4px 0 8px; }
.winners-err { display: inline-block; margin-bottom: 8px; white-space: normal; }
.winners-table td.num, .winners-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.winners-table th.winners-rankcol { color: var(--primary); }
.winners-table .winners-rank { width: 28px; text-align: center; color: var(--text-muted); font-weight: 600; }
.winners-table tr.winners-p1 .winners-rank { color: #c9a227; }
.winners-table tr.winners-p2 .winners-rank { color: #8e9aa6; }
.winners-table tr.winners-p3 .winners-rank { color: #b0793a; }
.winners-table tr.winners-podium td { font-weight: 600; }
.winners-game-bingo-bling { background: var(--primary-light); color: var(--primary); }
.winners-game-solitaire-stash { background: var(--success-light, #e6f6ec); color: var(--success); }
.winners-game-blingz { background: var(--warning-light); color: var(--warning); }
.winners-games { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.winners-net h3 { margin-bottom: 2px; }
.winners-kinds { display: grid; grid-template-columns: 1fr; gap: 14px; }
.winners-kind-head { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 4px; }
.winners-kind-head h4 { margin: 0; font-size: 13px; font-weight: 700; color: var(--text); }

/* ---- Rejection pop-ups (notifications.js, 2026-10-19) ---- */
.toast-rejection {
    background: rgba(214, 48, 49, 0.96);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 12px 12px 16px;
    max-width: 440px;
    font-weight: 500;
}
.toast-rejection .rej-body { flex: 1; cursor: pointer; min-width: 0; }
.toast-rejection .rej-title { font-weight: 700; font-size: 0.82rem; letter-spacing: 0.01em; }
.toast-rejection .rej-creative { font-weight: 700; margin-top: 3px; font-size: 0.9rem; }
.toast-rejection .rej-file { margin-top: 4px; font-size: 0.78rem; opacity: 0.95; word-break: break-word; }
.toast-rejection .rej-text { margin-top: 3px; font-size: 0.8rem; }
.toast-rejection .rej-close {
    background: transparent; border: 0; color: white; cursor: pointer;
    font-size: 0.9rem; line-height: 1; padding: 2px 4px; opacity: 0.8;
}
.toast-rejection .rej-close:hover { opacity: 1; }
tr.dir-row-flash > td { animation: dir-row-flash 3s ease-out; }
@keyframes dir-row-flash {
    0% { background: rgba(214, 48, 49, 0.28); }
    100% { background: transparent; }
}

/* ---- Notification bell + panel (Facebook-style, notifications.js 2026-10-19) ---- */
.notif { position: relative; display: inline-flex; align-items: center; margin-right: 6px; }
.notif-bell {
    position: relative; width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--border, rgba(0,0,0,0.12)); background: var(--surface, #fff);
    color: var(--text, #222); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.notif-bell svg { width: 18px; height: 18px; }
.notif-bell:hover { background: var(--bg-subtle, rgba(0,0,0,0.05)); }
.notif-bell.has-unread { color: #d63031; }
.notif-badge {
    position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px; background: #e0245e; color: #fff; font-size: 11px; font-weight: 700;
    line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface, #fff);
}
.notif-panel {
    position: absolute; top: 44px; right: 0; width: 380px; max-height: 480px; overflow: auto;
    background: var(--surface, #fff); color: var(--text, #222); border: 1px solid var(--border, rgba(0,0,0,0.12));
    border-radius: 12px; box-shadow: var(--shadow-lg, 0 12px 32px rgba(0,0,0,0.18)); z-index: 1200; text-align: left;
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; font-weight: 700; font-size: 0.95rem; border-bottom: 1px solid var(--border, rgba(0,0,0,0.08)); }
.notif-markread { background: transparent; border: 0; color: var(--accent, #6c5ce7); cursor: pointer; font-size: 0.78rem; font-weight: 600; }
.notif-empty { padding: 18px 14px; color: var(--text-muted, #777); font-size: 0.85rem; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border, rgba(0,0,0,0.06)); }
/* automation health (Settings → Automation status + bell, 2026-11-09) */
.toast-health-warn { background: #b45309 !important; }
.toast-health-ok { background: #15803d !important; }
.ah-chip { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; }
.ah-chip.ah-ok { background: #dcfce7; color: #166534; }
.ah-chip.ah-failed { background: #fee2e2; color: #991b1b; }
.ah-chip.ah-silent { background: #fef3c7; color: #92400e; }
.ah-chip.ah-busy { background: #dbeafe; color: #1e40af; }
.ah-chip.ah-never { background: #e5e7eb; color: #374151; }
tr.ah-failed td, tr.ah-silent td { background: rgba(254, 226, 226, 0.35); }
.ah-detail { max-width: 420px; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ah-sum-bad { color: #b91c1c; font-weight: 700; }
.ah-sum-ok { color: #166534; }
.notif-item:hover { background: var(--bg-subtle, rgba(0,0,0,0.04)); }
.notif-item.unread { background: rgba(224, 36, 94, 0.07); }
.notif-item.unread:hover { background: rgba(224, 36, 94, 0.12); }
.notif-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: transparent; }
.notif-item.unread .notif-dot { background: #e0245e; }
.notif-main { flex: 1; min-width: 0; font-size: 0.82rem; line-height: 1.35; }
.notif-main b { font-weight: 700; }
.notif-reason { color: var(--text-muted, #666); font-size: 0.76rem; margin-top: 2px; word-break: break-word; }
.notif-time { color: var(--text-muted, #888); font-size: 0.72rem; margin-top: 3px; }
.notif-net { display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; color: #fff; background: #d63031; margin-right: 4px; vertical-align: 1px; }
.toast-rejection { background: rgba(214, 48, 49, 0.96); max-width: 360px; padding: 10px 12px 10px 14px; }
