/* Elero Trigger — الأنماط. الهوية: حبر + إشارة ليمونية، خطان: Readex Pro للعناوين و IBM Plex Sans Arabic للنصوص. */
:root {
  --ink: #11141A;
  --ink-2: #2B303A;
  --muted: #4A505C;
  --faint: #6B7280;
  --ground: #F4F5F1;
  --surface: #FFFFFF;
  --surface-2: #F8F9F6;
  --line: #E3E5DF;
  --line-2: #D5D8D0;
  --divider: #EEF0EA;
  --lime: #C6F135;
  --lime-soft: #EEFBC4;
  --lime-ink: #2D3A08;
  --ok: #157A43;
  --ok-soft: #E3F4EA;
  --err: #B42318;
  --err-soft: #FDECEA;
  --warn: #8A4D05;
  --warn-strong: #A15C07;
  --warn-soft: #FDF1DC;
  --link: #2647C8;
  --link-soft: #E8EDFC;
  --radius: 10px;
  --radius-card: 16px;
  --font-ui: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-display: 'Readex Pro', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --shadow-pop: 0 12px 40px rgba(17, 20, 26, .18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-ui); color: var(--ink); background: var(--ground); font-size: 15px; line-height: 1.6; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; line-height: 1.3; }
p { margin: 0; }
a { color: var(--ink); }
a:hover { color: var(--muted); }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 6px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }

.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }

/* ---------- الهيكل ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); background: linear-gradient(to left, var(--surface) 260px, var(--ground) 260px); }
.sidebar { background: var(--surface); border-left: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.main { min-width: 0; padding: 28px 32px 64px; }
.page { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.topbar, .bottomnav { display: none; }

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; text-decoration: none; }
.brand-name { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -.01em; direction: ltr; }
.brand-name span { font-weight: 400; color: var(--muted); }
.brand-sub { font-size: 12px; color: var(--faint); }

.account-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); text-decoration: none; }
.avatar { width: 36px; height: 36px; flex: none; border-radius: 999px; background: var(--lime); display: grid; place-items: center; font-weight: 700; font-family: var(--font-display); color: var(--ink); text-transform: lowercase; }
.avatar.sm { width: 30px; height: 30px; font-size: 13px; }
.account-card .meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.account-card .meta b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.dot-status::before { content: ''; width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.dot-status.warn { color: var(--warn); }
.dot-status.ok { color: var(--ok); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a, .nav .nav-soon { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius); color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 15px; min-height: 44px; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: #fff; font-weight: 600; }
.nav a[aria-current="page"] svg { stroke: var(--lime); }
.nav .count { margin-inline-start: auto; font-size: 12px; background: #F1F2EE; color: var(--muted); padding: 1px 8px; border-radius: 999px; }
.nav a[aria-current="page"] .count { background: var(--lime); color: var(--ink); }
.nav .nav-soon { color: var(--faint); cursor: default; }
.nav .nav-soon small { margin-inline-start: auto; font-size: 11px; border: 1px solid var(--line); padding: 0 8px; border-radius: 999px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.plan-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.plan-card .muted { font-size: 12px; line-height: 1.6; }
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ink); border-radius: 999px; }

/* ---------- عناصر عامة ---------- */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { font-size: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: 30px; letter-spacing: -.01em; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row > * { min-width: 0; }
.grow { flex: 1 1 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #262B36; color: #fff; }
.btn.primary svg { stroke: var(--lime); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(17, 20, 26, .05); }
.btn.danger { color: var(--err); border-color: transparent; background: transparent; }
.btn.danger:hover { background: var(--err-soft); color: var(--err); }
.btn.outline-ink { border-color: var(--ink); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.lg { height: 52px; font-size: 16px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: var(--radius); border: 0; background: transparent; cursor: pointer; flex: none; color: var(--muted); }
.icon-btn:hover { background: rgba(17, 20, 26, .06); color: var(--ink); }
.linkish { background: none; border: 0; padding: 4px 0; font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; color: var(--ink); }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.pill svg { flex: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.err { background: var(--err-soft); color: var(--err); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.neutral { background: var(--divider); color: var(--muted); }
.pill.lime { background: var(--lime-soft); color: var(--lime-ink); }
.pill.info { background: var(--link-soft); color: #1E3A9E; }
.pill.ink { background: var(--ink); color: #fff; }

.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; font-size: 14px; line-height: 1.7; }
.notice svg { flex: none; margin-top: 3px; }
.notice.info { background: var(--link-soft); color: #1E3A9E; }
.notice.warn { background: var(--warn-soft); color: #5C3404; }
.notice.err { background: var(--err-soft); color: #7A1A12; }
.notice.neutral { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.notice b { font-weight: 600; }

/* ---------- النماذج ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 14px; font-weight: 600; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.7; }
.input, .textarea, .select { width: 100%; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); padding: 0 12px; height: 44px; font-size: 15px; }
.textarea { height: auto; padding: 10px 12px; line-height: 1.75; resize: vertical; min-height: 64px; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(198, 241, 53, .55); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--err); }
.field-error { color: var(--err); font-size: 13px; font-weight: 500; }
.field-error:empty { display: none; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; inset-inline-start: 12px; top: 13px; pointer-events: none; color: var(--faint); }
.input-icon .input { padding-inline-start: 40px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--ink); flex: none; }
.check .t { display: flex; flex-direction: column; gap: 2px; }
.check .t b { font-size: 14px; font-weight: 600; }
.check .t span { font-size: 13px; color: var(--muted); }
.check.disabled { cursor: default; opacity: .75; }

.segmented { display: inline-flex; padding: 4px; background: #F1F2EE; border-radius: 12px; gap: 4px; max-width: 100%; flex-wrap: wrap; }
.segmented button { height: 38px; padding: 0 16px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 500; }
.segmented button[aria-checked="true"], .segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(17, 20, 26, .08); }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.choice { text-align: start; display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.choice .radio { width: 20px; height: 20px; flex: none; border-radius: 999px; border: 2px solid #9097A3; margin-top: 2px; }
.choice[aria-checked="true"] { border: 2px solid var(--ink); padding: 13px; }
.choice[aria-checked="true"] .radio { border: 6px solid var(--ink); }
.choice .t { display: flex; flex-direction: column; gap: 3px; }
.choice .t b { font-size: 15px; font-weight: 600; }
.choice .t span { font-size: 13px; color: var(--muted); }

.switch { width: 44px; height: 26px; flex: none; border: 0; border-radius: 999px; background: #D5D8D0; position: relative; cursor: pointer; padding: 0; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 999px; background: #fff; transition: inset-inline-start .15s; }
.switch[aria-checked="true"] { background: var(--ink); }
.switch[aria-checked="true"]::after { inset-inline-start: 21px; background: var(--lime); }
.switch:disabled { opacity: .5; cursor: wait; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px; border: 1px solid var(--line-2); border-radius: 12px; min-height: 48px; background: var(--surface); }
.chips:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(198, 241, 53, .55); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding-inline: 12px 4px; border-radius: 8px; background: var(--lime-soft); font-size: 14px; font-weight: 600; color: var(--lime-ink); }
.chip button { width: 28px; height: 28px; border: 0; background: transparent; border-radius: 6px; display: grid; place-items: center; cursor: pointer; color: var(--lime-ink); }
.chip button:hover { background: rgba(45, 58, 8, .1); }
.chips input { flex: 1; min-width: 150px; border: 0; outline: none; height: 34px; background: transparent; font-size: 15px; }

/* ---------- لوحة التحكم ---------- */
.health { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; font-size: 14px; }
.health .lead { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.health .beacon { width: 9px; height: 9px; border-radius: 999px; background: var(--warn-strong); box-shadow: 0 0 0 4px var(--warn-soft); }
.health .beacon.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.health .end { margin-inline-start: auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.kpi .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.kpi .value { font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 13px; color: var(--muted); }
.bg-lime { background: var(--lime-soft); }
.bg-ok { background: var(--ok-soft); color: var(--ok); }
.bg-link { background: var(--link-soft); color: var(--link); }
.bg-warn { background: var(--warn-soft); color: var(--warn-strong); }

.chart { display: flex; flex-direction: column; gap: 8px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 190px; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.bars.dense { gap: 3px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.bar .v { font-size: 12px; font-weight: 600; color: var(--muted); }
.bar .b { width: 100%; max-width: 44px; background: #C9D0C2; border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar.peak .b { background: var(--ink); }
.bar.zero .b { background: var(--divider); }
.bar-labels { display: flex; gap: 10px; }
.bars.dense + .bar-labels { gap: 3px; }
.bar-labels span { flex: 1; text-align: center; font-size: 12px; color: var(--faint); min-width: 0; overflow: hidden; white-space: nowrap; }

.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--divider); min-width: 0; }
.list-row:first-of-type { border-top: 0; }
.list-row .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.list-row .title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.list-row .meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.thumb { width: 46px; height: 46px; flex: none; border-radius: 10px; display: grid; place-items: center; background: #E9EBE4; color: var(--muted); }
.empty { text-align: center; padding: 28px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 17px; }

.steps-start { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; counter-reset: s; }
.step-start { border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.step-start .n { width: 28px; height: 28px; border-radius: 999px; background: var(--ink); color: var(--lime); display: grid; place-items: center; font-weight: 700; font-size: 13px; font-family: var(--font-display); }
.step-start.done .n { background: var(--ok); color: #fff; }
.step-start.later { background: var(--surface-2); }

/* ---------- القواعد ---------- */
.rule-card { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.rule-card .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rule-card .title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; font-size: 16px; text-decoration: none; }
.rule-card .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.rule-card .kw { display: flex; flex-wrap: wrap; gap: 6px; }
.rule-card .kw span { background: var(--lime-soft); color: var(--lime-ink); font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 6px; }
.rule-card .side { display: flex; align-items: center; gap: 4px; }

/* ---------- المحرر ---------- */
.editor { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.editor-form { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.editor-side { flex: 1 1 320px; max-width: 380px; min-width: 0; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 20px; margin-inline: auto; }
.section-title { display: flex; align-items: center; gap: 12px; }
.section-title h2 { font-size: 18px; flex: 1; }
.step-n { width: 28px; height: 28px; border-radius: 999px; background: var(--ink); color: var(--lime); display: grid; place-items: center; font-weight: 700; font-size: 14px; font-family: var(--font-display); flex: none; }
.name-input { font-family: var(--font-display); font-size: 26px; font-weight: 600; border: 0; border-bottom: 2px dashed var(--line-2); background: transparent; padding: 4px 0; width: 100%; border-radius: 0; }
.name-input:focus { outline: none; border-bottom-color: var(--ink); }
.variant { display: flex; gap: 8px; align-items: flex-start; }
.variant .n { width: 26px; height: 26px; flex: none; margin-top: 10px; border-radius: 8px; background: #F1F2EE; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.variant .textarea { flex: 1; }
.test-box { background: var(--ground); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.match-result { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; font-weight: 600; min-height: 24px; }
.match-result.ok { color: var(--ok); }
.match-result.no { color: var(--muted); }
.savebar { position: sticky; bottom: 0; z-index: 5; margin: 8px -32px -64px; padding: 14px 32px; background: rgba(244, 245, 241, .95); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; backdrop-filter: blur(6px); }
.savebar .spacer { flex: 1; }

.phone { background: var(--ink); border-radius: 34px; padding: 10px; }
.phone-screen { background: #fff; border-radius: 26px; overflow: hidden; display: flex; flex-direction: column; }
.phone-bar { padding: 12px 16px; border-bottom: 1px solid var(--divider); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 10px; justify-content: center; }
.phone-sep { height: 8px; background: var(--ground); }
.ig-comment { display: flex; gap: 10px; font-size: 13px; line-height: 1.65; }
.ig-comment.reply { margin-inline-start: 38px; }
.ig-comment .when { font-size: 11px; color: var(--faint); }
.dm-thread { padding: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-height: 180px; }
.dm-bubble { max-width: 86%; background: #F1F2EE; border-radius: 18px 18px 18px 6px; padding: 10px 14px; font-size: 13px; line-height: 1.7; white-space: pre-line; overflow-wrap: anywhere; }
.preview-muted { padding: 16px; font-size: 13px; color: var(--faint); text-align: center; }
.variant-nav { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 12px; color: var(--muted); }

/* ---------- السجل ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-size: 14px; }
.tab .d { width: 8px; height: 8px; border-radius: 999px; }
.tab b { font-weight: 700; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.runs { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; }
.runs-head, .run-row { display: grid; grid-template-columns: 110px minmax(0, 2.2fr) minmax(0, 1.1fr) minmax(0, 1.2fr) minmax(0, 1.6fr) 44px; gap: 12px; align-items: start; padding: 12px 16px; }
.runs-head { background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600; }
.run-row { border-top: 1px solid var(--divider); font-size: 14px; cursor: pointer; text-align: start; width: 100%; background: none; border-inline: 0; border-bottom: 0; }
.run-row:hover { background: #FBFCF8; }
.run-row .who { font-weight: 600; }
.run-row .what { color: var(--ink-2); overflow-wrap: anywhere; }
.run-row .cell-label { display: none; }
.run-row .note { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.run-row .chev { color: var(--faint); display: grid; place-items: center; height: 24px; }

/* ---------- الحوارات والإشعارات ---------- */
dialog { border: 0; padding: 0; border-radius: 18px; box-shadow: var(--shadow-pop); max-width: min(520px, calc(100vw - 32px)); width: 100%; color: var(--ink); }
dialog::backdrop { background: rgba(17, 20, 26, .45); }
.dialog-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog-body h2 { font-size: 19px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
dialog.sheet { margin-inline-end: 0; margin-block: 0; height: 100vh; max-height: 100vh; max-width: min(560px, 100vw); border-radius: 0; }
dialog.sheet .dialog-body { padding: 24px; height: 100%; overflow-y: auto; }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; }
.sheet-head h2 { flex: 1; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline li:not(:last-child)::after { content: ''; position: absolute; inset-inline-start: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--divider); }
.timeline .tdot { width: 24px; height: 24px; flex: none; border-radius: 999px; display: grid; place-items: center; z-index: 1; }
.timeline .tbody { font-size: 14px; line-height: 1.6; min-width: 0; flex: 1; }
.timeline .tbody b { font-weight: 600; }
.quote { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 6px; white-space: pre-line; overflow-wrap: anywhere; font-size: 13px; }
.code { font-family: ui-monospace, monospace; font-size: 12px; direction: ltr; text-align: left; }

.toasts { position: fixed; inset-inline: 0; bottom: 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 1000; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-pop); pointer-events: auto; max-width: 480px; display: flex; gap: 10px; align-items: center; }
.toast.err { background: var(--err); }
.toast svg { stroke: var(--lime); flex: none; }
.toast.err svg { stroke: #fff; }

/* ---------- صفحات الدخول ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(20px, 6vw, 80px); gap: 22px; max-width: 560px; width: 100%; margin: 0 auto; }
.auth-form h1 { font-size: 30px; }
.auth-aside { background: var(--ink); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-aside h2 { font-size: 34px; line-height: 1.35; }
.auth-aside h2 em { font-style: normal; color: var(--lime); }
.auth-aside ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.auth-aside li { display: flex; gap: 12px; font-size: 16px; color: #E6E8EC; }
.auth-aside li span { width: 28px; height: 28px; flex: none; border-radius: 999px; background: var(--lime); color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.auth-aside .beta { font-size: 13px; color: #B9BEC8; line-height: 1.7; }

/* ---------- الشاشات الصغيرة ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .main { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  .bottomnav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; inset-inline: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); z-index: 30; }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; text-decoration: none; color: var(--muted); font-size: 11px; min-height: 48px; }
  .bottomnav a .ic { width: 44px; height: 28px; border-radius: 999px; display: grid; place-items: center; }
  .bottomnav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
  .bottomnav a[aria-current="page"] .ic { background: var(--lime-soft); }
  .page-head h1 { font-size: 24px; }
  .shell { background: var(--ground); }
  .savebar { margin: 8px -16px 0; padding: 10px 16px; bottom: calc(66px + env(safe-area-inset-bottom)); flex-wrap: nowrap; gap: 8px; }
  .savebar .spacer, .savebar [data-dirty-note] { display: none; }
  .savebar .btn { flex: 1 1 auto; padding: 0 12px; }
  .savebar .btn.danger { flex: 0 0 auto; }
  .editor-side { position: static; max-width: none; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) {
  .input, .textarea, .select, .chips input { font-size: 16px; }
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filters > :first-child { grid-column: 1 / -1; }
  .runs-head { display: none; }
  .run-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; padding: 14px 16px; }
  .run-row .c-time { order: 1; font-size: 12px; color: var(--faint); }
  .run-row .c-rule { order: 2; text-align: end; font-size: 12px; color: var(--muted); }
  .run-row .c-comment { order: 3; grid-column: 1 / -1; }
  .run-row .c-pub, .run-row .c-dm { order: 4; }
  .run-row .cell-label { display: block; font-size: 11px; color: var(--faint); margin-bottom: 2px; }
  .run-row .chev { display: none; }
  .kpi .value { font-size: 28px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .ico { display: none; }
  .bars { height: 150px; gap: 6px; }
  .bar .v { font-size: 11px; }
  .rule-card { align-items: flex-start; }
  .card { padding: 16px; }
  dialog.sheet { max-width: 100vw; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
