/* ExamOS — نظام التصميم (وثيقة 07 §5): نيلي عميق + كهرماني، مقياس 4px، IBM Plex */
:root {
  --c-primary: #2E3A8C;
  --c-primary-soft: #EEF0FA;
  --c-accent: #D97706;
  --c-ok: #15803D;
  --c-warn: #D97706;
  --c-danger: #B91C1C;
  --c-muted: #6B7280;
  --c-text: #1F2333;
  --c-text-2: #4B5163;
  --c-bg: #F7F8FC;
  --c-surface: #FFFFFF;
  --c-border: #E3E6EF;
  --r-field: 6px;
  --r-card: 12px;
  --shadow-card: 0 1px 2px rgba(20, 24, 50, .06), 0 4px 16px rgba(20, 24, 50, .05);
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-primary-soft: #232A52; --c-text: #E8EAF3; --c-text-2: #B7BCCD; --c-bg: #121523; --c-surface: #1A1E30; --c-border: #2C324A;
  }
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: var(--font); color: var(--c-text); background: var(--c-bg); line-height: 1.7; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 12px; font-weight: 700; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 12px; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 520px; }
.site-header { background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--c-text); font-size: 1.1rem; }
.brand svg { width: 28px; height: 28px; color: var(--c-primary); }
.nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.nav a { color: var(--c-text-2); }
main { padding: 32px 0 64px; }
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-card); padding: 24px; box-shadow: var(--shadow-card); }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--r-field); border: 1px solid transparent; font: inherit; font-weight: 500; cursor: pointer; min-height: 44px; transition: background .15s cubic-bezier(.2,0,0,1); }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: #26307A; text-decoration: none; }
.btn-secondary { background: var(--c-surface); color: var(--c-primary); border-color: var(--c-border); }
.btn-danger { background: transparent; color: var(--c-danger); border-color: var(--c-border); }
.btn-sm { padding: 6px 12px; min-height: 36px; font-size: .9rem; }
.btn svg { width: 18px; height: 18px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; }
.field input, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: var(--r-field); font: inherit; background: var(--c-surface); color: var(--c-text); min-height: 44px; }
.field input:focus, .field select:focus { outline: 2px solid var(--c-primary); outline-offset: 1px; border-color: var(--c-primary); }
.hint { color: var(--c-muted); font-size: .9rem; margin-top: 4px; }
.error { color: var(--c-danger); font-size: .9rem; margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.check input { width: 18px; height: 18px; margin-top: 4px; }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--r-field); margin-bottom: 16px; border: 1px solid; }
.banner svg { width: 20px; height: 20px; flex: none; }
.banner-ok { background: #ECFDF3; border-color: #A7E3BD; color: #14532D; }
.banner-warn { background: #FFF7E6; border-color: #F7D9A4; color: #7A3E00; }
.banner-danger { background: #FEECEC; border-color: #F3B4B4; color: #7F1D1D; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; background: var(--c-primary-soft); color: var(--c-primary); }
.meter { margin-bottom: 14px; }
.meter-head { display: flex; justify-content: space-between; font-size: .95rem; margin-bottom: 4px; }
.meter-bar { height: 8px; background: var(--c-border); border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--c-primary); border-radius: 999px; }
.meter-fill.warn { background: var(--c-warn); } .meter-fill.danger { background: var(--c-danger); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--c-border); vertical-align: top; }
.table th { color: var(--c-text-2); font-weight: 500; font-size: .9rem; }
.table-wrap { overflow-x: auto; }
code, .code { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; background: var(--c-primary-soft); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
.hero { padding: 56px 0 40px; text-align: center; }
.hero h1 { font-size: 2.2rem; max-width: 720px; margin: 0 auto 12px; }
.hero p { max-width: 640px; margin: 0 auto 24px; color: var(--c-text-2); font-size: 1.1rem; }
.plan { text-align: center; }
.plan .price { font-size: 1.8rem; font-weight: 700; margin: 8px 0; }
.plan .price small { font-size: .9rem; color: var(--c-muted); font-weight: 400; }
.plan.featured { border-color: var(--c-primary); box-shadow: 0 0 0 2px var(--c-primary-soft); }
.muted { color: var(--c-muted); }
.list { padding: 0; margin: 0; list-style: none; }
.list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--c-border); }
.list li:last-child { border-bottom: 0; }
.list svg { width: 20px; height: 20px; flex: none; color: var(--c-muted); margin-top: 3px; }
.empty { text-align: center; padding: 32px 16px; color: var(--c-muted); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.footer { border-top: 1px solid var(--c-border); padding: 24px 0; color: var(--c-muted); font-size: .9rem; text-align: center; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 640px) {
  .site-header .container { height: auto; padding: 10px 16px; flex-wrap: wrap; }
  .nav { width: 100%; justify-content: flex-start; gap: 8px 14px; font-size: .95rem; }
  .hero { padding: 32px 0 24px; } .hero h1 { font-size: 1.6rem; }
  .card { padding: 16px; }
}

/* الفحص المسبق والموافقة (م2) */
.precheck-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; align-items: start; margin-bottom: 12px; }
.precheck-items { display: grid; gap: 6px; }
.precheck-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--c-border); border-radius: var(--r-field); }
.pc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-border); flex: none; }
.precheck-item.ok .pc-dot { background: var(--c-ok); } .precheck-item.fail .pc-dot { background: var(--c-danger); }
.pc-label { flex: 1; font-weight: 500; } .pc-state { color: var(--c-muted); font-size: .9rem; }
.precheck-item.required .pc-label::after { content: " *"; color: var(--c-danger); }
.precheck-cam video { width: 100%; aspect-ratio: 4 / 3; background: #000; border-radius: var(--r-field); transform: scaleX(-1); object-fit: cover; }
.consent-text { background: var(--c-primary-soft); border-radius: var(--r-field); padding: 12px 14px; line-height: 1.9; font-size: .95rem; }
@media (max-width: 640px) { .precheck-grid { grid-template-columns: 1fr; } }

/* الخطورة والشارات (م2) */
.risk { display: inline-flex; align-items: center; gap: 8px; }
.risk-bar { width: 80px; height: 8px; background: var(--c-border); border-radius: 999px; overflow: hidden; }
.risk-fill { height: 100%; border-radius: 999px; background: var(--c-ok); }
.risk-fill.yellow { background: var(--c-warn); } .risk-fill.red { background: var(--c-danger); }
.badge.band-green { background: #ECFDF3; color: #14532D; } .badge.band-yellow { background: #FFF7E6; color: #7A3E00; } .badge.band-red { background: #FEECEC; color: #7F1D1D; }
.badge.ok { background: #ECFDF3; color: #14532D; } .badge.warn { background: #FFF7E6; color: #7A3E00; } .badge.bad { background: #FEECEC; color: #7F1D1D; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--c-border); color: var(--c-text-2); }
.tabs a.on { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

/* المتابعة الحية */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.live-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow-card); border-top: 4px solid var(--c-ok); }
.live-card.band-yellow { border-top-color: var(--c-warn); } .live-card.band-red { border-top-color: var(--c-danger); }
.live-card.closed { opacity: .55; }
.live-thumb { aspect-ratio: 4 / 3; background: #0F1222; display: flex; align-items: center; justify-content: center; color: #8A90A8; font-size: .85rem; position: relative; }
.live-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.live-thumb .live-score { position: absolute; top: 8px; inset-inline-end: 8px; background: rgba(0,0,0,.6); color: #fff; padding: 2px 8px; border-radius: 999px; font-weight: 700; font-size: .85rem; }
.live-body { padding: 12px; }
.live-name { font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.live-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: .8rem; color: var(--c-muted); margin: 6px 0; }
.live-meta span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c-border); margin-inline-end: 4px; }
.live-meta span.on::before { background: var(--c-ok); } .live-meta span.off::before { background: var(--c-danger); }
.live-alerts { list-style: none; padding: 0; margin: 6px 0 10px; font-size: .85rem; min-height: 1.6em; }
.live-alerts li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px dashed var(--c-border); }
.live-actions { display: flex; gap: 8px; }

/* صفحة المراجعة */
.review-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.suggested-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.sug { flex: none; width: 150px; border: 3px solid var(--c-border); border-radius: 8px; overflow: hidden; background: var(--c-surface); cursor: pointer; padding: 0; font: inherit; text-align: start; }
.sug.band-yellow { border-color: var(--c-warn); } .sug.band-red { border-color: var(--c-danger); } .sug.current { outline: 3px solid var(--c-primary); outline-offset: 1px; }
.sug img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #0F1222; }
.sug-cap { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; font-size: .78rem; }
.viewer { background: #0F1222; border-radius: var(--r-card); overflow: hidden; position: relative; min-height: 320px; display: flex; align-items: center; justify-content: center; color: #8A90A8; }
.viewer img { max-width: 100%; max-height: 520px; display: block; }
.viewer-info { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 4px; font-size: .9rem; flex-wrap: wrap; }
.viewer-nav { display: flex; gap: 6px; }
.strip-small { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0; }
.strip-small button { flex: none; width: 90px; border: 2px solid var(--c-border); border-radius: 6px; padding: 0; background: none; cursor: pointer; overflow: hidden; }
.strip-small button.current { border-color: var(--c-primary); }
.strip-small img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #0F1222; }
.tl { position: relative; height: 56px; background: var(--c-primary-soft); border-radius: var(--r-field); margin: 12px 0 4px; overflow: hidden; }
.tl-gap { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, #9CA3AF, #9CA3AF 4px, #D1D5DB 4px, #D1D5DB 8px); opacity: .7; }
.tl-frame { position: absolute; bottom: 0; width: 3px; height: 40%; background: var(--c-ok); opacity: .55; }
.tl-frame.yellow { background: var(--c-warn); height: 60%; opacity: .9; } .tl-frame.red { background: var(--c-danger); height: 90%; opacity: 1; }
.tl-ev { position: absolute; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--c-text-2); transform: translateX(-50%); cursor: pointer; border: 2px solid var(--c-surface); }
.tl-ev.yellow { background: var(--c-warn); } .tl-ev.red { background: var(--c-danger); } .tl-ev.action { background: var(--c-primary); border-radius: 2px; }
.tl-cursor { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--c-primary); }
.tl-axis { display: flex; justify-content: space-between; font-size: .75rem; color: var(--c-muted); }
.ev-list { max-height: 360px; overflow: auto; font-size: .9rem; }
.ev-list table td { padding: 6px 8px; }
.verdict-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; border: 2px solid var(--c-border); border-radius: var(--r-field); background: var(--c-surface); font: inherit; font-weight: 600; cursor: pointer; padding: 8px 14px; margin-bottom: 8px; text-align: start; }
.verdict-btn input { width: 18px; height: 18px; }
.verdict-btn.accepted:has(input:checked) { border-color: var(--c-ok); background: #ECFDF3; }
.verdict-btn.flagged:has(input:checked) { border-color: var(--c-warn); background: #FFF7E6; }
.verdict-btn.violation:has(input:checked) { border-color: var(--c-danger); background: #FEECEC; }
.reason-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.reason-chips button { border: 1px solid var(--c-border); background: var(--c-surface); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: .85rem; cursor: pointer; color: var(--c-text-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; }
.kv dt { color: var(--c-muted); } .kv dd { margin: 0; word-break: break-all; }
.clip-player video { width: 100%; max-height: 420px; background: #0F1222; border-radius: var(--r-card); }
.clips-strip button.clip-btn { width: auto; min-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 10px; font: inherit; font-size: .8rem; color: var(--c-text-2); background: var(--c-surface); }
.clip-btn.band-yellow { border-color: var(--c-warn); } .clip-btn.band-red { border-color: var(--c-danger); }
.clip-ico { font-size: 1.1rem; color: var(--c-primary); }
.sug.marked, .clip-btn.marked { box-shadow: 0 0 0 3px var(--c-primary); }
.sug.marked .sug-cap::before { content: "★ "; color: var(--c-primary); }
.tl-clip { position: absolute; top: 18px; height: 8px; background: var(--c-primary); opacity: .6; border-radius: 2px; cursor: pointer; }
@media (max-width: 900px) { .review-layout { grid-template-columns: 1fr; } }

[hidden] { display: none !important; }
