/* Sports Content Hub — admin UI (Arabic RTL). No inline styles anywhere (strict CSP). */

@font-face { font-family: "Plex Arabic"; src: url("../fonts/plex-arabic-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/plex-arabic-500.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/plex-arabic-600.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/plex-arabic-700.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/plex-latin-400.woff2") format("woff2"); font-weight: 400 500; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/plex-latin-600.woff2") format("woff2"); font-weight: 600 700; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }

:root {
    --font: "Plex Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e3e8ef;
    --text: #172033;
    --text-muted: #5b6577;
    --primary: #1f5eff;
    --primary-hover: #1a4fd8;
    --primary-soft: #e8efff;
    --success: #127a4a;
    --success-soft: #e4f5ec;
    --warning: #9a5b00;
    --warning-soft: #fff4dc;
    --danger: #c42b2b;
    --danger-soft: #fde8e8;
    --info: #1d5c8f;
    --info-soft: #e5f1fb;
    --sidebar-bg: #0f172a;
    --sidebar-text: #c6cfdd;
    --sidebar-active: #ffffff;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
    --sidebar-w: 264px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b1120; --surface: #121a2b; --surface-2: #0f1626; --border: #24304a; --text: #e6ebf3; --text-muted: #96a1b5;
        --primary: #5b8cff; --primary-hover: #7aa2ff; --primary-soft: #1a2747;
        --success: #4cc38a; --success-soft: #11291f; --warning: #f0b44c; --warning-soft: #2c2210; --danger: #f17070; --danger-soft: #331717;
        --info: #6fb3ea; --info-soft: #102335; --sidebar-bg: #070c18; color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0b1120; --surface: #121a2b; --surface-2: #0f1626; --border: #24304a; --text: #e6ebf3; --text-muted: #96a1b5;
    --primary: #5b8cff; --primary-hover: #7aa2ff; --primary-soft: #1a2747;
    --success: #4cc38a; --success-soft: #11291f; --warning: #f0b44c; --warning-soft: #2c2210; --danger: #f17070; --danger-soft: #331717;
    --info: #6fb3ea; --info-soft: #102335; --sidebar-bg: #070c18; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.65; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; }
h1, h2, h3 { line-height: 1.35; margin: 0; }
.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.text-start { text-align: start; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.skip-link { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { inset-inline-start: 8px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; flex: none; }
.sidebar-brand { display: flex; gap: var(--space-3); align-items: center; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #1f5eff, #12a37c); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; letter-spacing: .5px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { color: #fff; font-size: 15px; }
.brand-text small { font-size: 12px; opacity: .7; }
.nav-list { list-style: none; margin: 0; padding: 12px 10px; flex: 1; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--sidebar-text); font-size: 14px; margin-bottom: 2px; }
.nav-link:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav-link.is-active { background: rgba(91,140,255,.18); color: var(--sidebar-active); font-weight: 600; }
.nav-link.is-disabled { opacity: .45; cursor: not-allowed; }
.nav-link.is-disabled:hover { background: transparent; color: var(--sidebar-text); }
.nav-badge { margin-inline-start: auto; font-size: 11px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 0 7px; }
.sidebar-foot { padding: 14px 18px; font-size: 12px; opacity: .55; border-top: 1px solid rgba(255,255,255,.07); }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-3); padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-title { font-size: 18px; font-weight: 600; flex: 1; }
.icon-btn.sidebar-toggle { display: none; }
.content { padding: 24px; max-width: 1280px; width: 100%; }
.pause-banner { background: var(--danger-soft); color: var(--danger); border-bottom: 1px solid var(--border); padding: 10px 24px; font-weight: 500; font-size: 14px; }

/* System control */
.system-control { display: flex; align-items: center; gap: var(--space-2); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.status-pill.is-running { color: var(--success); background: var(--success-soft); }
.status-pill.is-running .dot { background: var(--success); }
.status-pill.is-paused { color: var(--danger); background: var(--danger-soft); }
.status-pill.is-paused .dot { background: var(--danger); }

/* Dropdown (details/summary, works without JS) */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-panel { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); width: 300px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(16,24,40,.16); padding: var(--space-4); z-index: 50; }
.user-menu .dropdown-panel { width: 230px; padding: 8px; }
.user-card { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-item { display: block; width: 100%; text-align: start; padding: 8px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown-item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-item.danger { color: var(--danger); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; font-size: 14px; line-height: 1.2; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn[disabled] { opacity: .6; cursor: progress; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.inline-form { display: inline; margin: 0; }

/* Cards & grid */
.grid { display: grid; gap: var(--space-4); margin-bottom: var(--space-4); }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: var(--space-4); min-width: 0; }
.grid > .card { margin-bottom: 0; }
.card.narrow { max-width: 560px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: var(--space-3); }
.card-head .card-title { margin-bottom: 0; }
.section-title { font-size: 14px; font-weight: 600; color: var(--text-muted); margin: 18px 0 8px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 13px; color: var(--text-muted); }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.25; }
.stat-foot { font-size: 12px; color: var(--text-muted); }
.empty { color: var(--text-muted); text-align: center; padding: 24px 8px; margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 16px; }
.kv dt { color: var(--text-muted); font-size: 14px; }
.kv dd { margin: 0; }
.roadmap { list-style: none; padding: 0; margin: 0 0 12px; }
.roadmap li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.roadmap li:last-child { border-bottom: 0; }
.roadmap li.is-done span:first-child { font-weight: 600; }
.checklist { padding-inline-start: 20px; }
.checklist li { margin-bottom: 4px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { background: var(--surface-2); font-weight: 600; color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td[dir="ltr"] { text-align: left; }

/* Badges & alerts */
.badge { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.alert { border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: var(--space-4); font-size: 14px; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--info-soft); color: var(--info); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.field > span { font-weight: 500; }
.field input, .field select, .field textarea { font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field.has-error input { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13px; }
.hint { color: var(--text-muted); font-size: 13px; margin: 0; }
.form-row { display: flex; gap: 12px; }
.form-row .grow { flex: 1; }
.small-field { width: 120px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }

/* Guest / installer */
.guest-body { background: var(--bg); }
.guest-wrap { max-width: 420px; margin: 0 auto; padding: 56px 16px; }
.guest-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; font-size: 17px; }
.guest-card { padding: 28px; }
.error-code { font-size: 44px; font-weight: 700; color: var(--text-muted); line-height: 1; margin-bottom: 8px; }
.debug { background: var(--surface-2); border: 1px solid var(--border); padding: 10px; overflow-x: auto; font-size: 12px; }
.install-wrap { max-width: 860px; margin: 0 auto; padding: 32px 16px 64px; }
.install-head { margin-bottom: 20px; }
.stepper { list-style: none; padding: 0; margin: 0; display: flex; gap: 8px; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; color: var(--text-muted); }
.stepper .step-num { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; flex: none; }
.stepper li.is-current { border-color: var(--primary); color: var(--text); font-weight: 600; }
.stepper li.is-current .step-num { background: var(--primary); color: #fff; border-color: var(--primary); }
.stepper li.is-done .step-num { background: var(--success); color: #fff; border-color: var(--success); }

/* Responsive */
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
    .two-col { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; transform: translateX(100%); transition: transform .2s ease; z-index: 40; }
    body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.35); }
    .icon-btn.sidebar-toggle { display: inline-flex; }
    .topbar { padding: 10px 16px; flex-wrap: wrap; }
    .content { padding: 16px; }
    .status-pill { display: none; }
}
@media (max-width: 560px) {
    .stats-grid { grid-template-columns: 1fr; }
    .topbar-title { font-size: 16px; }
    .stepper .step-label { display: none; }
    .form-row { flex-direction: column; }
    .small-field { width: 100%; }
    .dropdown-panel { width: min(300px, calc(100vw - 32px)); }
    .kv { grid-template-columns: 1fr; gap: 2px 0; }
    .kv dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Phase 1.1 additions */
.steps-list { padding-inline-start: 22px; margin: 0 0 12px; }
.steps-list li { margin-bottom: 6px; }
.narrow-form { max-width: 480px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 5px; }
.small-value { font-size: 16px; }
.code-block { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; font-family: var(--mono); font-size: 12px; overflow-x: auto; white-space: pre; }
.field textarea { font-family: inherit; resize: vertical; }
textarea[dir="ltr"] { font-family: var(--mono); font-size: 13px; }

/* Phase 6 — management screens */
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: flex-end; margin-bottom: var(--space-4); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row.wrap { flex-wrap: wrap; }
.input { font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-width: 0; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.mono { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.compact .field { gap: 3px; }
.compact.table th, .compact.table td, .table.compact th, .table.compact td { padding: 6px 8px; }
.filters { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; margin-bottom: var(--space-4); }
.filters .field { min-width: 150px; }
.filter-actions { display: flex; gap: var(--space-2); align-items: flex-end; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: var(--space-4); }
.tab { padding: 8px 14px; border-bottom: 2px solid transparent; color: var(--text-muted); font-size: 14px; margin-bottom: -1px; }
.tab:hover { text-decoration: none; color: var(--text); }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab .count, .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-inline-start: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 11px; text-align: center; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: var(--space-3); }
.pagination { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: var(--space-4); }
.pagination a, .pagination span { padding: 5px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; background: var(--surface); }
.pagination .is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: start; }
.matrix-cell { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; }
.list-row { padding: 7px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.list-row:last-child { border-bottom: 0; }
.kv-row { display: flex; gap: 10px; font-size: 13px; padding: 2px 0; flex-wrap: wrap; }
.kv-row > span:first-child { min-width: 110px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--border); z-index: 5; }
.action-stack { display: flex; flex-direction: column; gap: var(--space-2); }
.action-stack .btn, .action-stack form .btn { width: 100%; }
.delivery-head { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-4); align-items: start; }
.editor-layout > .card { margin-bottom: 0; }
.schedule-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; }
.article-preview { line-height: 1.9; font-size: 15px; overflow-wrap: anywhere; }
.article-preview h2, .article-preview h3, .article-preview h4 { margin: 1em 0 .4em; line-height: 1.4; }
.article-preview blockquote { margin: 1em 0; padding: 6px 14px; border-inline-start: 3px solid var(--primary); background: var(--surface-2); }
.article-preview img { max-width: 100%; height: auto; }
.article-image { max-width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.image-edit { display: flex; flex-direction: column; gap: var(--space-2); }
.test-panel { margin-top: var(--space-2); }
.test-results { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.test-step { border: 1px solid var(--border); border-inline-start-width: 4px; border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface); }
.test-step.is-ok { border-inline-start-color: var(--success); }
.test-step.is-fail { border-inline-start-color: var(--danger); }
.test-step-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.test-list { margin: 6px 0 0; padding-inline-start: 22px; max-height: 260px; overflow-y: auto; }
.test-list li { margin-bottom: 3px; }
.test-para { background: var(--surface-2); padding: 6px 10px; border-radius: 6px; margin: 6px 0; }
.char-counter { align-self: flex-end; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.char-counter.over { color: var(--danger); font-weight: 600; }
.rte { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.rte-toolbar { display: none; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.rte-toolbar button { font: inherit; font-size: 13px; min-width: 32px; padding: 4px 8px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--text); cursor: pointer; }
.rte-toolbar button:hover, .rte-toolbar button[aria-pressed="true"] { background: var(--surface); border-color: var(--border); }
.rte-area { display: none; min-height: 320px; max-height: 70vh; overflow-y: auto; padding: 12px 14px; outline: none; }
.rte-area:focus { box-shadow: inset 0 0 0 2px var(--primary-soft); }
.rte .rte-source { width: 100%; border: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); font-family: var(--mono); font-size: 13px; padding: 10px; background: var(--surface); color: var(--text); }
.rte.rte-ready .rte-toolbar { display: flex; }
.rte.rte-ready .rte-area { display: block; }
.rte.rte-ready .rte-source { display: none; }
.rte.rte-ready.rte-source-mode .rte-area { display: none; }
.rte.rte-ready.rte-source-mode .rte-source { display: block; min-height: 320px; }
.quota-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px 54px; gap: 10px; align-items: center; padding: 6px 0; }
.quota-bar { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.quota-fill { display: block; height: 100%; background: var(--primary); width: 0; }
.quota-fill.q10 { width: 10%; } .quota-fill.q20 { width: 20%; } .quota-fill.q30 { width: 30%; } .quota-fill.q40 { width: 40%; } .quota-fill.q50 { width: 50%; }
.quota-fill.q60 { width: 60%; } .quota-fill.q70 { width: 70%; } .quota-fill.q80 { width: 80%; background: var(--warning); } .quota-fill.q90 { width: 90%; background: var(--warning); } .quota-fill.q100 { width: 100%; background: var(--danger); }
.log-error td, .log-critical td { background: var(--danger-soft); }
.log-warning td { background: var(--warning-soft); }
.copyable, .copyable-http, .copyable-http-url { margin: 0 0 8px; }
@media (max-width: 1024px) {
    .editor-layout { grid-template-columns: 1fr; }
    .form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
    .filters .field { min-width: 0; flex: 1 1 100%; }
    .quota-row { grid-template-columns: minmax(0, 1fr) 80px 46px; }
    .page-actions { justify-content: stretch; }
}
/* Grid children must be allowed to shrink below their content (long <pre>/URLs) — prevents phone-width overflow. */
.grid > *, .form-grid > *, .editor-layout > * { min-width: 0; }
.form-grid { grid-template-columns: minmax(0, 1fr); }
.field input, .field select, .field textarea { max-width: 100%; min-width: 0; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1024px) { .form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .form-grid.two, .form-grid.three { grid-template-columns: minmax(0, 1fr); } }
.hint, .field-error, .alert, .stat-foot { overflow-wrap: anywhere; }
/* 2.0 — central engine screens */
tr.row-disabled td { opacity: .55; }
tr[draggable="true"] { cursor: grab; }
tr.is-dragging td { background: var(--primary-soft); }
.drag-handle { color: var(--text-muted); letter-spacing: -2px; }
.small-input { width: 72px; }
