/* Falaki Beta — واجهة منصة داكنة. الهوية: ليلي فلكي (كحلي عميق) + نحاسي/ذهبي، أخضر/أحمر هادئان للأسعار.
   الخطوط (من Google Fonts، لا ملفات داخل المستودع): Inter للأرقام واللاتيني أولًا، ثم IBM Plex Sans Arabic للعربي
   (Inter لا يحوي حروفًا عربية فيسقط إليه المتصفح تلقائيًا). الأرقام جدولية في كل الواجهة. نفس الرموز تُمرَّر للشارت (app.js). */
:root {
  --bg: #0b0f15; --bg2: #10161f; --panel: #131a24; --panel2: #18212d; --line: #202a37; --line2: #2a3646;
  --ink: #e6e9ee; --ink2: #b4bcc8; --muted: #7d8899; --accent: #d9a441; --accent2: #f0c368; --accent-ink: #1a1305;
  --up: #26b07a; --down: #e5534b; --warn: #e0a83a; --info: #5a9bd8; --dev: #b38cff;
  --up-bg: rgba(38,176,122,.14); --down-bg: rgba(229,83,75,.14);
  --r: 8px; --top-h: 50px; --dock-h: 220px; --wl-w: 252px; --tb-w: 40px;
  --font: "Inter", "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-num: "Inter", "IBM Plex Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 13px/1.4 var(--font); font-variant-numeric: tabular-nums; display: flex; flex-direction: column; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
input, select { background: var(--bg2); border: 1px solid var(--line2); border-radius: 6px; padding: 5px 8px; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); }
button { cursor: pointer; background: none; border: 0; }
button:disabled { opacity: .4; cursor: default; }
.num, .q-last, .q-chg, td.n, .wl-row .px, .wl-row .ch, .metric b { font-family: var(--font-num); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.spacer { flex: 1; }
.hint { color: var(--muted); margin: 6px 2px; font-size: 12px; }
.pos { color: var(--up); } .neg { color: var(--down); }
.mobile-only { display: none !important; } .xs-only { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ===== الشريط العلوي ===== */
.topbar { height: var(--top-h); flex: none; display: flex; align-items: center; gap: 12px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 30; }
.brand { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.brand b { font-size: 15px; letter-spacing: .3px; color: var(--accent2); }
.logo { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--accent2), var(--accent) 45%, #6b4a12 70%); box-shadow: 0 0 0 2px rgba(217,164,65,.18), 0 0 12px rgba(217,164,65,.22); position: relative; flex: none; }
.logo::after { content: ""; position: absolute; inset: -5px; border: 1px solid rgba(217,164,65,.35); border-radius: 50%; transform: rotate(-25deg) scaleY(.38); }
.search { position: relative; display: flex; align-items: center; width: 220px; flex: none; }
.search svg { position: absolute; inset-inline-start: 9px; color: var(--muted); width: 15px; height: 15px; }
.search input { width: 100%; padding-inline-start: 30px; height: 30px; background: var(--bg2); }
.dropdown { position: absolute; top: calc(100% + 4px); inset-inline-start: 0; min-width: 100%; width: 340px; max-height: 360px; overflow: auto; background: var(--panel2); border: 1px solid var(--line2); border-radius: var(--r); box-shadow: 0 12px 30px rgba(0,0,0,.45); display: none; z-index: 50; }
.dropdown div { padding: 8px 10px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; border-bottom: 1px solid var(--line); }
.dropdown div:hover, .dropdown div.hl { background: rgba(217,164,65,.1); }
.dropdown b { color: var(--accent2); min-width: 44px; font-family: var(--font-num); } .dropdown small { color: var(--muted); margin-inline-start: auto; }
/* ترويسة السهم: الرمز كبير + السوق، ثم الاسم */
.ident { flex: none; display: flex; flex-direction: column; justify-content: center; line-height: 1.15; padding-inline-start: 12px; border-inline-start: 1px solid var(--line); }
.ident-top { display: flex; align-items: baseline; gap: 6px; }
.ident b { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.exch { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.exch:empty { display: none; }
#symbolName { color: var(--ink2); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.quote { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.quote .q-last { font-size: 19px; font-weight: 600; }
.quote .q-chg { font-weight: 600; font-size: 13px; } .quote .q-ba { color: var(--muted); font-size: 11px; }
.pills { display: flex; gap: 6px; align-items: center; position: relative; }
.status, .pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; height: 22px; border-radius: 999px; font-size: 11.5px; background: var(--bg2); border: 1px solid var(--line2); color: var(--ink2); white-space: nowrap; }
button.status, button.pill { cursor: pointer; } button.status:hover, button.pill:hover { border-color: var(--muted); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; flex: none; }
.status[data-kind="loading"] { color: var(--info); } .status[data-kind="loading"]::before { animation: pulse 1s ease-in-out infinite; }
.status[data-kind="connected"], .status[data-kind="realtime"] { color: var(--up); }
.status[data-kind="delayed"] { color: var(--warn); } .status[data-kind="devdata"] { color: var(--dev); }
.status[data-kind="nodata"], .status[data-kind="ratelimited"], .status[data-kind="error"], .status[data-kind="notconfigured"] { color: var(--down); }
.pill.delayed { color: var(--warn); border-color: rgba(224,168,58,.35); }
.pill.dev { color: var(--dev); border-color: rgba(179,140,255,.4); background: rgba(179,140,255,.08); }
@keyframes pulse { 50% { opacity: .3; } }
.popover { position: absolute; top: calc(100% + 8px); inset-inline-start: 0; width: 320px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; box-shadow: 0 14px 34px rgba(0,0,0,.5); z-index: 60; font-size: 12px; color: var(--ink2); }
.popover h4 { margin: 0 0 6px; font-size: 13px; color: var(--ink); }
.popover dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; } .popover dt { color: var(--muted); } .popover dd { margin: 0; }
.popover p { margin: 8px 0 0; color: var(--muted); }
.seg { display: flex; background: var(--bg2); border: 1px solid var(--line2); border-radius: 7px; padding: 2px; }
.seg button { padding: 3px 9px; border-radius: 5px; color: var(--ink2); font: 600 12px var(--font-num); }
.seg button:hover { color: var(--ink); } .seg button.active { background: var(--accent); color: var(--accent-ink); }
.seg button.off, .seg button:disabled { color: var(--muted); opacity: .38; text-decoration: line-through; text-decoration-thickness: 1px; cursor: not-allowed; }
.pill.cached { color: var(--info); border-color: rgba(90,155,216,.4); background: rgba(90,155,216,.08); }
.tb-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 7px; color: var(--ink2); border: 1px solid transparent; white-space: nowrap; }
.tb-btn:hover { background: var(--panel2); color: var(--ink); border-color: var(--line2); }
.count { font: 600 10.5px var(--font-num); font-style: normal; background: var(--line2); color: var(--ink); border-radius: 999px; padding: 0 6px; min-width: 18px; text-align: center; }
.count.on { background: var(--accent); color: var(--accent-ink); }
/* شريط تحميل رفيع أسفل الشريط العلوي — لا يغطي الشارت */
.loadbar { position: absolute; inset-inline: 0; bottom: -1px; height: 2px; overflow: hidden; }
.loadbar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: load 1s linear infinite; }
@keyframes load { from { inset-inline-start: -30%; } to { inset-inline-start: 100%; } }

/* ===== منطقة العمل ===== */
.workspace { flex: 1; min-height: 0; display: flex; }
.toolbar { width: var(--tb-w); flex: none; background: var(--panel); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0; overflow-y: auto; overflow-x: visible; scrollbar-width: none; }
.toolbar::-webkit-scrollbar { display: none; }
.toolbar .sep { width: 20px; height: 1px; background: var(--line2); margin: 4px 0; flex: none; }
.toolbar button { width: 30px; height: 30px; flex: none; border-radius: 6px; color: var(--ink2); display: grid; place-items: center; position: relative; }
.toolbar button:hover { background: var(--panel2); color: var(--ink); }
.toolbar button.active { background: rgba(217,164,65,.16); color: var(--accent2); box-shadow: inset 0 0 0 1px rgba(217,164,65,.45); }
.toolbar button.on { color: var(--accent2); }
.tip { position: fixed; z-index: 100; background: #05080c; color: var(--ink); border: 1px solid var(--line2); padding: 4px 8px; border-radius: 5px; font-size: 12px; pointer-events: none; white-space: nowrap; box-shadow: 0 6px 16px rgba(0,0,0,.4); }
.center { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chart-area { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
/* ===== شبكة الشارتات المتعددة: 1 | 2 أفقي (جنبًا لجنب) | 2 عمودي (فوق بعض) | 4 (2×2) ===== */
.charts { flex: 1; min-height: 0; display: grid; gap: 2px; background: var(--line); grid-template-columns: 1fr; grid-template-rows: 1fr; }
.charts[data-layout="2h"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.charts[data-layout="2v"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.charts[data-layout="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.pane { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); outline: 1px solid transparent; outline-offset: -1px; }
.pane.active { outline-color: var(--accent); z-index: 1; }
.charts:not([data-layout="1"]) .pane.active .pane-head { box-shadow: inset 0 -2px 0 var(--accent); background: rgba(217,164,65,.07); }
.pane-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane-chart { flex: 1; min-height: 0; width: 100%; }
.pane-head { flex: none; height: 26px; display: flex; align-items: center; gap: 8px; padding: 0 8px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 12px; cursor: pointer; user-select: none; }
.charts[data-layout="1"] .pane-head { display: none; }
.pane-head .p-sym { font-size: 13px; } .pane-head .p-tf { color: var(--muted); font-size: 11px; border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; }
.pane-head .p-px { color: var(--ink2); } .pane-head .p-px .pos { color: var(--up); } .pane-head .p-px .neg { color: var(--down); }
.pane-head .icon { width: 22px; height: 22px; font-size: 12px; } .pane-head .icon[hidden] { display: none; }
.p-st { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.p-st[data-kind="connected"], .p-st[data-kind="realtime"] { background: var(--up); } .p-st[data-kind="delayed"] { background: var(--warn); } .p-st[data-kind="devdata"] { background: var(--dev); }
.p-st[data-kind="nodata"], .p-st[data-kind="ratelimited"], .p-st[data-kind="error"], .p-st[data-kind="notconfigured"] { background: var(--down); } .p-st[data-kind="loading"] { background: var(--info); animation: pulse 1s ease-in-out infinite; }
/* Focus مؤقت: شارت واحد يملأ المنطقة دون تغيير التخطيط المحفوظ */
.charts.focus .pane:not(.focused), .charts.focus .pane-slot { display: none; }
.charts.focus { grid-template-columns: 1fr !important; grid-template-rows: 1fr !important; }
.charts.focus .pane-head { display: flex !important; }
.pane-slot { background: var(--bg2); color: var(--muted); border: 1px dashed var(--line2); display: grid; place-items: center; font-size: 13px; cursor: pointer; }
.pane-slot:hover { color: var(--accent2); border-color: var(--accent); }
.pane-tabs { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.pane-tabs::-webkit-scrollbar { display: none; }
.pane-tabs[hidden] { display: none; }
.pane-tabs button { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line2); color: var(--ink2); font-size: 12px; }
.pane-tabs button i { font-style: normal; font-size: 10px; color: var(--muted); } .pane-tabs button small { color: var(--muted); }
.pane-tabs button.active { border-color: var(--accent); color: var(--accent2); background: rgba(217,164,65,.1); }
/* قوائم منبثقة (التخطيط، مساحات العمل، خيارات صف المتابعة) */
.menu { position: fixed; z-index: 120; min-width: 200px; max-width: min(320px, 92vw); background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 8px; box-shadow: 0 14px 34px rgba(0,0,0,.55); font-size: 12.5px; color: var(--ink2); }
.menu[hidden] { display: none; }
.menu h4 { margin: 4px 4px 6px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.menu button { display: block; width: 100%; text-align: start; padding: 6px 8px; border-radius: 6px; color: var(--ink2); } .menu button:hover:not(:disabled) { background: rgba(217,164,65,.1); color: var(--ink); } .menu button:disabled { opacity: .4; }
.menu button.active { color: var(--accent2); background: rgba(217,164,65,.12); } .menu button.danger:hover { color: var(--down); }
.menu .lay-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 8px; }
.menu .lay-grid button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: 1px solid var(--line2); font-size: 11px; }
.menu .lay-grid button.active { border-color: var(--accent); }
.menu .chk { display: flex; align-items: center; gap: 6px; padding: 4px 6px; cursor: pointer; } .menu .chk.off { opacity: .5; cursor: not-allowed; }
.menu .ws-list { max-height: 220px; overflow: auto; margin-bottom: 6px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.menu .ws-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.menu.small { min-width: 170px; }
.wsbar { flex: none; height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 8px; background: var(--panel); border-bottom: 1px solid var(--line); }
.bar-btn { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 7px; color: var(--ink2); border: 1px solid var(--line2); background: var(--bg2); white-space: nowrap; flex: none; font-size: 12.5px; }
.bar-btn:hover { color: var(--ink); border-color: var(--muted); } .bar-btn svg { width: 16px; height: 16px; }
.ws-btn span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; } .ws-btn .caret { font-style: normal; font-size: 10px; color: var(--muted); }
.wl-lists { display: flex; align-items: center; gap: 2px; padding: 6px 6px 4px 10px; border-bottom: 1px solid var(--line); }
.wl-lists select { flex: 1; min-width: 0; height: 28px; }
.wl-lists .icon { width: 26px; height: 26px; font-size: 13px; }
.wl-row .mkt { color: var(--muted); font-size: 10.5px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-row[draggable="true"] { cursor: grab; }
/* حالة فارغة: تظهر فقط حين لا شموع (لا تغطي بيانات) */
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); pointer-events: none; }
.empty b { color: var(--ink2); font-size: 15px; font-weight: 600; } .empty[data-kind="nodata"] b, .empty[data-kind="error"] b { color: var(--down); }
/* مقبض لوحة الحجم: سحب لتغيير الارتفاع + تصغير/توسيع (يستدعي setPaneHeight/togglePaneCollapsed الموجودين) */
.pane-grip { position: absolute; inset-inline-start: 50%; transform: translate(50%, -50%); display: flex; align-items: center; gap: 2px; z-index: 4; background: rgba(19,26,36,.92); border: 1px solid var(--line2); border-radius: 999px; padding: 0 2px 0 8px; height: 20px; touch-action: none; }
[dir="ltr"] .pane-grip { transform: translate(-50%, -50%); }
.pane-grip .grip { width: 26px; height: 18px; cursor: row-resize; background: radial-gradient(circle, var(--muted) 1.2px, transparent 1.6px) 0 0/6px 6px; opacity: .8; }
.pane-grip .icon { width: 20px; height: 18px; font-size: 11px; }
.pane-grip.collapsed .icon { transform: rotate(180deg); }
/* تلميح العلامات */
.mk-tip { position: absolute; z-index: 6; pointer-events: none; min-width: 170px; max-width: 260px; background: rgba(8,12,18,.96); border: 1px solid var(--line2); border-radius: 8px; padding: 7px 9px; font-size: 12px; box-shadow: 0 10px 26px rgba(0,0,0,.5); }
.mk-tip h5 { margin: 0 0 4px; font-size: 12.5px; display: flex; align-items: center; gap: 6px; } .mk-tip h5 i { width: 8px; height: 8px; border-radius: 2px; }
.mk-tip dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; } .mk-tip dt { color: var(--muted); } .mk-tip dd { margin: 0; text-align: end; }

/* ===== اللوحة السفلية ===== */
.dock { height: var(--dock-h); flex: none; display: flex; flex-direction: column; background: var(--panel); border-top: 1px solid var(--line); }
.dock.collapsed { height: 34px; } .dock.collapsed .dock-body { display: none; } .dock.collapsed #dockToggle { transform: rotate(180deg); }
.dock-tabs { height: 34px; flex: none; display: flex; align-items: stretch; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.dock-tabs button { padding: 0 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.dock-tabs button:hover { color: var(--ink); } .dock-tabs button.active { color: var(--accent2); border-bottom-color: var(--accent); }
.dock-tabs .icon { color: var(--muted); transition: transform .15s; align-self: center; }
.dock-msg { align-self: center; font-size: 11.5px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; padding: 0 8px; opacity: 0; transition: opacity .2s; }
.dock-msg.show { opacity: 1; } .dock-msg.err { color: #f3a29d; } .dock-msg.dev { color: #d3c0ff; }
.dock-body { flex: 1; min-height: 0; overflow: auto; padding: 8px 12px; }
.tab-pane { display: none; } .tab-pane.active { display: block; }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.form-row label { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 11px; }
.form-row label input, .form-row label select { color: var(--ink); font-size: 13px; height: 30px; }
.form-row label input[type="number"] { width: 96px; font-family: var(--font-num); }
.form-row label.chk { flex-direction: row; align-items: center; gap: 6px; height: 30px; font-size: 12px; color: var(--ink2); }
.params { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { height: 30px; padding: 0 12px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line2); color: var(--ink); font-weight: 600; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent2); }
.btn.icon { width: 34px; padding: 0; }
.icon { width: 28px; height: 28px; border-radius: 6px; color: var(--ink2); display: inline-grid; place-items: center; }
.icon:hover:not(:disabled) { background: var(--panel2); color: var(--ink); }
/* مقاييس Backtest: الأساسية الخمس أولًا بحجم أكبر، ثم الثانوية بكثافة أعلى */
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 10px 0 6px; }
.metric { background: var(--bg2); border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; }
.metric span { display: block; color: var(--muted); font-size: 11px; } .metric b { font-size: 18px; font-weight: 600; }
.metric small { display: block; color: var(--muted); font-size: 11px; font-family: var(--font-num); direction: ltr; text-align: end; }
.metrics2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 14px; margin: 0 0 8px; padding: 6px 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 7px; }
.metrics2 div { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 2px 0; } .metrics2 span { color: var(--muted); } .metrics2 b { font-weight: 600; font-family: var(--font-num); direction: ltr; }
table.grid { width: 100%; border-collapse: collapse; font-size: 12px; }
table.grid th { position: sticky; top: -8px; background: var(--panel); color: var(--muted); font-weight: 600; text-align: start; padding: 5px 6px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
table.grid td { padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid tbody tr:hover { background: rgba(255,255,255,.03); } table.grid tr.click { cursor: pointer; }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; background: var(--line2); }
.tag.long { background: var(--up-bg); color: var(--up); } .tag.short { background: var(--down-bg); color: var(--down); }
.tag.ok { background: var(--up-bg); color: var(--up); } .tag.no { color: var(--muted); }
.replay-ctl { margin-bottom: 8px; }
#rpPos { width: 100%; accent-color: var(--accent); padding: 0; border: 0; background: none; }

/* ===== قائمة المتابعة (كثيفة: سطر واحد لكل رمز) ===== */
.watchlist { width: var(--wl-w); flex: none; background: var(--panel); border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.wl-head { display: flex; align-items: center; gap: 2px; height: 34px; padding: 0 6px 0 10px; border-bottom: 1px solid var(--line); }
.wl-head b { font-size: 12.5px; }
.wl-cols, .wl-row { display: grid; grid-template-columns: minmax(0, 1fr) 54px 58px 34px 14px; gap: 6px; align-items: center; padding: 0 8px 0 10px; }
.wl-cols { color: var(--muted); font-size: 10.5px; height: 22px; border-bottom: 1px solid var(--line); grid-template-columns: minmax(0, 1fr) 54px 58px 48px; }
.wl-cols span:not(:first-child) { text-align: end; }
#watch { flex: 1; overflow: auto; min-height: 60px; }
.wl-row { height: 30px; border-bottom: 1px solid rgba(32,42,55,.6); cursor: pointer; position: relative; font-size: 12.5px; }
.wl-row:hover { background: var(--panel2); } .wl-row.active { background: rgba(217,164,65,.08); box-shadow: inset -2px 0 0 var(--accent); }
[dir="ltr"] .wl-row.active { box-shadow: inset 2px 0 0 var(--accent); }
.wl-row .sym { min-width: 0; display: flex; align-items: baseline; gap: 6px; white-space: nowrap; overflow: hidden; }
.wl-row .sym b { font-family: var(--font-num); font-weight: 600; } .wl-row .sym small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.wl-row .px { text-align: end; }
.wl-row .ch { text-align: center; font-weight: 600; font-size: 11.5px; border-radius: 4px; padding: 1px 0; }
.wl-row .ch.pos { background: var(--up-bg); } .wl-row .ch.neg { background: var(--down-bg); }
.wl-row .x { color: var(--muted); opacity: .55; text-align: center; font-size: 11px; } .wl-row:hover .x { opacity: 1; } .wl-row .x:hover { color: var(--accent2); }
.wl-empty { padding: 16px 12px; color: var(--muted); }
.wl-active { border-top: 1px solid var(--line); padding: 8px 10px; max-height: 40%; overflow: auto; }
.wl-active b { color: var(--muted); font-size: 11px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 3px 1px 8px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line2); font-size: 11.5px; }
.chip i { width: 8px; height: 8px; border-radius: 50%; } .chip b[data-rm] { cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 13px; } .chip b[data-rm]:hover { color: var(--down); }

/* ===== نافذة المؤشرات ===== */
.modal { position: fixed; inset: 0; background: rgba(3,6,10,.6); display: grid; place-items: center; z-index: 80; backdrop-filter: blur(2px); }
.modal[hidden] { display: none; }
.modal-card { width: min(860px, 94vw); height: min(560px, 86vh); background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.modal-head b { font-size: 15px; } .modal-head input { flex: 1; height: 32px; }
.cats { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.cats button { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line2); color: var(--ink2); font-size: 12px; white-space: nowrap; }
.cats button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.modal-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 300px; }
.ind-list { overflow: auto; padding: 4px 0; }
.ind-list .cat { padding: 8px 14px 4px; color: var(--muted); font-size: 11px; font-weight: 600; }
.ind-list .item { display: flex; align-items: center; gap: 8px; padding: 7px 14px; cursor: pointer; }
.ind-list .item:hover { background: var(--panel2); } .ind-list .item small { color: var(--muted); direction: ltr; font-family: var(--font-num); }
.ind-list .item .add { margin-inline-start: auto; color: var(--accent2); font-size: 16px; opacity: 0; } .ind-list .item:hover .add { opacity: 1; }
.ind-list .item.on b::after { content: " ●"; color: var(--accent); font-size: 9px; }
.ind-side { border-inline-start: 1px solid var(--line); overflow: auto; padding: 10px 12px; }
.ind-side > b { color: var(--muted); font-size: 11px; }
.ind-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; margin-top: 8px; }
.ind-card header { display: flex; align-items: center; gap: 6px; } .ind-card header b { flex: 1; }
.ind-card .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.ind-card label { display: flex; flex-direction: column; color: var(--muted); font-size: 10.5px; gap: 2px; }
.ind-card input, .ind-card select { height: 26px; padding: 2px 6px; font-size: 12px; color: var(--ink); }
.ind-card input[type="color"] { padding: 1px; width: 100%; }
.scrim { display: none; }

/* ===== اللوحة الجانبية: المتابعة | السوق السعودي ===== */
.side-tabs { display: flex; align-items: stretch; height: 34px; flex: none; border-bottom: 1px solid var(--line); padding: 0 4px; }
.side-tabs button[data-side] { padding: 0 10px; color: var(--muted); font-weight: 600; font-size: 12.5px; border-bottom: 2px solid transparent; white-space: nowrap; }
.side-tabs button[data-side].active { color: var(--accent2); border-bottom-color: var(--accent); }
.side-tabs .icon { align-self: center; }
.side-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wl-head { height: 30px; }
.mk-head { padding: 6px 8px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--line); }
.mk-search { display: flex; gap: 4px; } .mk-search input { flex: 1; height: 28px; }
.mk-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.mk-chips button { padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line2); color: var(--ink2); font-size: 11.5px; }
.mk-chips button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.mk-chips small { font-family: var(--font-num); opacity: .8; }
#mkSector { height: 28px; font-size: 12px; }
#mkInfo { margin: 0; font-size: 11px; }
.mk-badge { display: inline-block; margin-inline-end: 6px; padding: 0 6px; border-radius: 4px; font-size: 10.5px; color: var(--info); background: rgba(90,155,216,.12); border: 1px solid rgba(90,155,216,.35); }
.mk-badge.stale { color: var(--warn); background: rgba(224,168,58,.1); border-color: rgba(224,168,58,.4); }
.mk-list { flex: 1; overflow: auto; min-height: 60px; }
.mk-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 24px; gap: 6px; align-items: center; padding: 4px 8px 4px 10px; border-bottom: 1px solid rgba(32,42,55,.6); cursor: pointer; font-size: 12.5px; }
.mk-row:hover { background: var(--panel2); } .mk-row.active { background: rgba(217,164,65,.08); }
.mk-row .nm { min-width: 0; line-height: 1.25; } .mk-row .nm b { font-family: var(--font-num); margin-inline-end: 6px; }
.mk-row .nm { overflow: hidden; } .mk-row .nm .l1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .mk-row .nm small { display: block; color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-tag { font-size: 10px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line2); color: var(--ink2); font-family: var(--font-num); }
.mk-tag.NOMU { color: var(--info); border-color: rgba(90,155,216,.4); }
.mk-row .add { width: 22px; height: 22px; border-radius: 5px; color: var(--accent2); display: grid; place-items: center; font-size: 15px; }
.mk-row .add:hover { background: rgba(217,164,65,.15); } .mk-row .add.in { color: var(--up); cursor: default; }
.mk-more { padding: 8px 10px; color: var(--muted); font-size: 11.5px; }

/* ===== الماسح: الشروط، التقدم، النتائج ===== */
.dock.scr-full:not(.collapsed) { height: 330px; }
.dock.scr-full .dock-body { overflow: hidden; padding-bottom: 0; }
.tab-pane[data-pane="screener"].active { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 12px; height: 100%; }
.scr-side { overflow: auto; min-height: 0; padding-bottom: 8px; padding-inline-end: 2px; }
.scr-h { display: block; font-size: 11px; color: var(--muted); margin: 0 0 4px; }
.scr-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.scr-main #scr { flex: 1; min-height: 0; overflow: auto; padding-bottom: 8px; }
.scr-top { margin-bottom: 6px; }
.scr-top:not(.market) .mk-only { display: none; }
.conds { display: grid; grid-template-columns: 1fr; gap: 5px; }
.cond { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: var(--bg2); border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; font-size: 12px; }
.cond.on { border-color: rgba(217,164,65,.45); }
.cond > label.chk { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); flex: 1 1 100%; }
.cond .p { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 11px; }
.cond .p input { width: 58px; height: 24px; padding: 1px 5px; font-size: 12px; font-family: var(--font-num); color: var(--ink); }
.cond .p select { height: 24px; padding: 1px 4px; font-size: 11.5px; color: var(--ink); max-width: 150px; }
.cond:not(.on) .p { opacity: .55; }
.scr-prog { display: flex; align-items: center; gap: 10px; margin: 4px 0; font-size: 12px; color: var(--ink2); }
.scr-prog .bar { flex: 1; height: 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.scr-prog .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .2s; }
.scr-prog.wait .bar i { background: var(--warn); }
.scr-tools { display: flex; align-items: center; gap: 12px; margin: 2px 0 4px; font-size: 12px; }
.scr-tools .chk { display: flex; align-items: center; gap: 6px; color: var(--ink2); }
table.grid th.sort { cursor: pointer; user-select: none; } table.grid th.sort:hover { color: var(--ink); }
table.grid th.sort.asc::after { content: " ▲"; font-size: 9px; } table.grid th.sort.desc::after { content: " ▼"; font-size: 9px; }
.cchips { display: inline-flex; gap: 3px; flex-wrap: wrap; } .cchip { font-size: 10.5px; padding: 0 5px; border-radius: 4px; background: var(--line2); color: var(--muted); }
.cchip.ok { background: var(--up-bg); color: var(--up); }
.src { font: 600 10px var(--font-num); padding: 0 4px; border-radius: 3px; margin-inline-start: 4px; }
.src.dev { color: var(--dev); background: rgba(179,140,255,.12); } .src.live { color: var(--up); background: var(--up-bg); }
tr.nomatch td { opacity: .55; }

/* ===== شاشات متوسطة: تجميع متدرّج (بلا تصغير خطوط): الأساسي يبقى بنصّه (رمز/سعر/فريم/مؤشرات)، والثانوي (شارات الحالة) يصير أيقونات بتلميح ===== */
@media (min-width: 901px) {
  .ident { flex: 0 1 200px; min-width: 0; } .ident-top, #symbolName { min-width: 0; } #symbolName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .search { flex: 0 1 220px; min-width: 130px; }
}
@media (min-width: 901px) and (max-width: 1700px) {
  .brand b { display: none; }
  /* شارات الحالة الثانوية (متأخر/مخزّن/تطوير) ⇒ أيقونات صغيرة؛ زر الحالة الرئيسي يبقى نصًا ويفتح التفاصيل */
  .pill { padding: 0; width: 22px; justify-content: center; font-size: 0; gap: 0; }
  .pill::before { font-size: 12px; line-height: 1; }
  #feedPill::before { content: "⏱"; } #cachePill::before { content: "⛁"; } #devBadge::before { content: "⚑"; }
  #devBadge span { display: none; }
}
@media (min-width: 901px) and (max-width: 1500px) { #alertBtn span, .quote .q-ba, .exch { display: none; } .topbar { gap: 9px; } .search { flex-basis: 190px; } }
@media (min-width: 901px) and (max-width: 1400px) { .ident { flex-basis: 150px; } .search { flex-basis: 170px; } }

/* ===== الجوال: شريط علوي من سطرين، اللوحات أدراج/أوراق فوق الشارت (لا تضغطه) ===== */
@media (max-width: 900px) {
  :root { --top-h: auto; }
  .mobile-only { display: inline-grid !important; }
  .topbar { flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
  .brand b, .topbar > .spacer, .quote .q-ba, .quote .q-abs, #symbolName, .exch, .tb-btn span, #feedPill, #devBadge { display: none !important; }
  .brand { order: 1; } .ident { order: 2; border: 0; padding: 0; } .quote { order: 3; gap: 5px; }
  .ident b { font-size: 15px; } .quote .q-last { font-size: 16px; } .quote .q-chg { font-size: 12px; }
  #indBtn { order: 5; margin-inline-start: auto; } #alertBtn { display: none; } #wlToggle { order: 7; }
  .tb-btn { padding: 5px; }
  .search { order: 10; flex: 1 1 110px; width: auto; min-width: 0; }
  .dropdown { width: calc(100vw - 16px); }
  .seg { order: 11; flex: 0 1 auto; max-width: calc(100% - 150px); overflow-x: auto; scrollbar-width: none; } .seg::-webkit-scrollbar { display: none; } .seg button { padding: 3px 6px; flex: none; }
  .pill.cached { font-size: 10.5px; padding: 0 6px; }
  /* الحالة: نقطة + كلمة قصيرة؛ التفاصيل في نافذة صغيرة عند اللمس */
  .pills { display: contents; } .pills > .status { order: 4; } #syncPill { order: 8; }
  .status { font-size: 0; gap: 4px; padding: 0 7px; } .status::after { content: attr(data-short); font-size: 11px; }
  .popover { position: fixed; top: 52px; inset-inline: 8px; width: auto; }
  .workspace { flex-direction: column; }
  .toolbar { width: 100%; height: 38px; flex-direction: row; overflow-x: auto; overflow-y: hidden; border-inline-end: 0; border-bottom: 1px solid var(--line); padding: 0 6px; }
  .toolbar .sep { width: 1px; height: 20px; margin: 0 4px; }
  .center { min-height: 0; padding-bottom: 40px; }
  .chart-area { min-height: 0; }
  .charts[data-layout] { grid-template-columns: 1fr !important; grid-template-rows: 1fr !important; }
  body.m-tabs .pane:not(.active), body.m-tabs .pane-slot { display: none; }
  body.m-tabs .pane-head { display: none !important; }
  .ws-btn span { max-width: 84px; }
  .menu { max-width: calc(100vw - 12px); }
  .pane-grip { height: 26px; } .pane-grip .grip { width: 38px; height: 24px; } .pane-grip .icon { width: 28px; height: 24px; }
  .dock { position: fixed; inset-inline: 0; bottom: 0; height: 62dvh; z-index: 70; border-top: 1px solid var(--line2); border-radius: 12px 12px 0 0; box-shadow: 0 -16px 40px rgba(0,0,0,.55); }
  .dock.collapsed { height: 40px; box-shadow: none; border-radius: 0; }
  .dock-tabs { height: 40px; }
  .dock-msg { display: none; }
  .dock.scr-full:not(.collapsed) { height: 100dvh; border-radius: 0; }
  .dock.scr-full .dock-body { overflow: auto; }
  .tab-pane[data-pane="screener"].active { display: flex; flex-direction: column; height: auto; }
  .scr-main { order: 1; } .scr-side { order: 2; margin-top: 10px; }
  .dock-tabs #dockToggle { position: sticky; inset-inline-end: 0; background: var(--panel); flex: none; }
  .scr-side { overflow: visible; } .scr-main #scr { overflow: visible; }
  .conds { grid-template-columns: 1fr; }
  .scr-tools > .hint:last-child { display: none; }
  #scr { overflow-x: auto; }
  .form-row label input[type="number"] { width: 84px; }
  .watchlist { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(320px, 86vw); z-index: 90; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  [dir="ltr"] .watchlist { transform: translateX(105%); }
  .wl-row { height: 40px; }
  body.wl-open .watchlist { transform: none; }
  body.wl-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 85; }
  .modal-body { grid-template-columns: 1fr; grid-template-rows: 1fr auto; } .ind-side { max-height: 40%; border-inline-start: 0; border-top: 1px solid var(--line); }
  .modal-card { width: 100vw; height: 100dvh; border-radius: 0; }
  .metrics { grid-template-columns: repeat(2, 1fr); } .metrics .metric:first-child { grid-column: span 2; }
}

#wAdd { width: auto; padding: 0 8px; white-space: nowrap; }

/* ===== حوار داخلي (بدل prompt/confirm) ===== */
.dlg-backdrop { position: fixed; inset: 0; z-index: 300; background: rgba(5,8,12,.62); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dlg { width: min(420px, 100%); background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; padding: 18px 18px 14px; box-shadow: 0 24px 60px rgba(0,0,0,.6); color: var(--ink); }
.dlg h3 { margin: 0 0 8px; font-size: 15px; color: var(--accent2); }
.dlg-msg { margin: 0 0 10px; color: var(--ink2); line-height: 1.6; }
.dlg-field { display: block; margin: 6px 0 4px; }
.dlg-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.dlg-input { width: 100%; height: 34px; font-size: 14px; }
.dlg-err { margin: 6px 0 0; padding: 6px 8px; border-radius: 6px; background: var(--down-bg); color: var(--down); font-size: 12.5px; }
.dlg-acts { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-start; }
.dlg-acts button { height: 32px; padding: 0 16px; border-radius: 7px; border: 1px solid var(--line2); color: var(--ink2); }
.dlg-acts .dlg-ok { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.dlg-acts .dlg-ok.danger { background: var(--down); border-color: var(--down); color: #fff; }
.dlg-acts button:focus-visible, .dlg-input:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* ===== بانر تعارض التبويبات ===== */
.conflict-bar { flex: none; display: flex; align-items: center; gap: 10px; padding: 7px 14px; background: rgba(224,168,58,.14); border-bottom: 1px solid rgba(224,168,58,.45); color: var(--warn); font-size: 13px; flex-wrap: wrap; }
.conflict-bar span { flex: 1 1 260px; color: var(--ink); }
.conflict-bar .btn:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* ===== الحساب والمزامنة: أيقونة حالة صغيرة (لا تغطي الشارت) + حوارات النموذج/الاختيار ===== */
#syncPill { width: 22px; padding: 0; justify-content: center; font-size: 0; gap: 0; cursor: pointer; }
#syncPill::before { font-size: 13px; line-height: 1; content: "⌂"; }
#syncPill[data-status="local-saved"]::before { content: "⌂"; color: var(--muted); }
#syncPill[data-status="syncing"]::before { content: "⟳"; color: var(--info); animation: syncspin 1s linear infinite; }
#syncPill[data-status="synced"]::before { content: "✓"; color: var(--up); }
#syncPill[data-status="offline"]::before { content: "⊘"; color: var(--warn); }
#syncPill[data-status="conflict"]::before { content: "⚠"; color: var(--warn); }
#syncPill[data-status="error"]::before { content: "✕"; color: var(--down); }
#syncPill[data-status="conflict"], #syncPill[data-status="error"] { border-color: currentColor; }
@keyframes syncspin { to { transform: rotate(360deg); } }

/* ===== جوال ≤ 640px: شريط علوي بصف واحد 48px (360/390/412). الأهم فقط: الرمز (يفتح البحث) + السعر + حالة البيانات + الفريم (قائمة) + المؤشرات + المتابعة + المزامنة.
   الثانوي: الشعار/التنبيهات/شارات الأسلوب خارج الصف (التنبيهات من اللوحة السفلية). لا تصغير للخط دون 11px ولا overflow أفقي. ===== */
@media (max-width: 640px) {
  :root { --top-h: 48px; }
  .xs-only { display: inline-flex !important; }
  .topbar { flex-wrap: nowrap; gap: 4px; padding: 0 8px; height: 48px; }
  .brand { display: none !important; }
  .ident { order: 1; flex: none; padding: 0 6px; border: 0; min-width: 48px; height: 36px; border-radius: 8px; justify-content: center; cursor: pointer; background: var(--bg2); border: 1px solid var(--line2); }
  .ident:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  .ident-top { gap: 4px; align-items: center; } .ident-search { width: 13px; height: 13px; color: var(--muted); }
  .quote { order: 2; flex: 1 1 0; min-width: 0; overflow: hidden; gap: 4px; padding-inline-start: 2px; }
  .quote .q-last { font-size: 16px; } .quote .q-chg { display: none; }
  .pills { display: contents; } .pills > .status { order: 3; flex: none; }
  .status { height: 28px; padding: 0 7px; } .status::after { font-size: 11px; }
  .pill.cached { display: none; }
  #tfBtn { order: 4; gap: 2px; padding: 4px 6px; height: 32px; } #tfBtn b { font: 600 12px var(--font-num); } #tfBtn svg { width: 12px; height: 12px; }
  #indBtn { order: 5; margin-inline-start: 0; } #wlToggle { order: 6; } #syncPill { order: 7; }
  .tb-btn, #syncPill { min-width: 32px; height: 32px; }
  /* الفريمات: قائمة منسدلة تحت الشريط بدل شريط مقصوص */
  #tfBar.seg { display: none; position: absolute; top: calc(100% + 1px); inset-inline: 6px; max-width: none; flex-wrap: wrap; gap: 4px; padding: 8px; overflow: visible; z-index: 95; background: var(--panel2); box-shadow: 0 14px 34px rgba(0,0,0,.5); border-radius: 10px; order: 0; }
  body.tf-open #tfBar.seg { display: flex; }
  #tfBar.seg button { padding: 7px 12px; min-width: 44px; min-height: 36px; font-size: 13px; }
  #tfBar .tf-hint { flex: 1 1 100%; font: 400 11.5px var(--font); color: var(--muted); line-height: 1.5; padding: 4px 2px 0; text-decoration: none; }
  /* البحث: طبقة تغطّي الشريط عند الفتح */
  .search { display: none; order: 0; }
  body.search-open .search { display: flex; position: absolute; inset: 0; z-index: 96; width: auto; padding: 0 8px; background: var(--panel); gap: 6px; align-items: center; }
  body.search-open .search svg { inset-inline-start: 18px; }
  body.search-open .search input { flex: 1; height: 36px; padding-inline-start: 34px; }
  #searchClose { width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 8px; color: var(--ink2); font-size: 15px; flex: none; order: 2; }
  body.search-open .dropdown { top: calc(100% + 1px); inset-inline: 0; width: auto; max-height: 60dvh; }
}
@media (min-width: 400px) and (max-width: 640px) { .quote .q-chg { display: inline; font-size: 12px; } }
@media (prefers-reduced-motion: reduce) { #syncPill[data-status="syncing"]::before { animation: none; } }
.menu .sync-acct { padding: 4px 6px 8px; color: var(--ink2); font-size: 12.5px; line-height: 1.6; overflow-wrap: anywhere; }
.menu .sync-stat { display: flex; justify-content: space-between; gap: 8px; padding: 4px 6px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.menu .sync-err { padding: 4px 6px; font-size: 11.5px; color: var(--down); overflow-wrap: anywhere; }
.menu .sync-note { padding: 4px 6px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.menu .sync-note.warn { color: var(--neg, #b45309); }
.menu button.danger { color: var(--neg, #b91c1c); }
.dlg.dlg-wide { width: min(460px, 100%); }
.dlg-acts .dlg-link { border: 0; background: none; color: var(--accent2); padding: 0 6px; text-decoration: underline; margin-inline-start: auto; }
.dlg-choices { display: grid; gap: 6px; margin-top: 8px; } .dlg-choices.busy { opacity: .6; pointer-events: none; }
.dlg-choice { display: block; width: 100%; text-align: start; padding: 8px 10px; border: 1px solid var(--line2); border-radius: 8px; color: var(--ink); background: var(--bg2); }
.dlg-choice b { display: block; font-size: 13px; } .dlg-choice small { display: block; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.dlg-choice.primary { border-color: var(--accent); } .dlg-choice:hover { border-color: var(--muted); } .dlg-choice:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.dlg-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; } .dlg-table th, .dlg-table td { padding: 3px 6px; text-align: start; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; } .dlg-table th { color: var(--muted); font-weight: 600; }
.dlg-table tr.diff td { color: var(--accent2); }
