/* مرصاد · البوابة — واجهة عربية من اليمين لليسار، فاتحة وداكنة حسب الجهاز */
:root {
  --bg: #f4f6f8;
  --bg-2: #eef1f4;
  --card: #ffffff;
  --ink: #0f1d2b;
  --ink-2: #44546a;
  --ink-3: #7a8799;
  --line: #e2e7ee;
  --line-2: #d3dae4;
  --brand: #0f766e;
  --brand-2: #0d9488;
  --brand-ink: #ffffff;
  --brand-soft: #e6f6f4;
  --gold: #b7791f;
  --gold-soft: #fdf3e1;
  --up: #12805c;
  --up-soft: #e5f5ee;
  --down: #c2362f;
  --down-soft: #fbeceb;
  --warn: #a8640c;
  --warn-soft: #fdf1df;
  --info: #2457c5;
  --info-soft: #e9effc;
  --shadow: 0 1px 2px rgba(15, 29, 43, .05), 0 6px 18px rgba(15, 29, 43, .06);
  --shadow-lg: 0 18px 50px rgba(15, 29, 43, .22);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Segoe UI", "Noto Kufi Arabic", "Noto Sans Arabic", Tahoma, "Geeza Pro", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1219; --bg-2: #0f1922; --card: #121d28; --ink: #e8eef5; --ink-2: #a9b6c6; --ink-3: #75849a;
    --line: #1e2c3a; --line-2: #2a3b4d; --brand: #14b8a6; --brand-2: #2dd4bf; --brand-ink: #04211e; --brand-soft: #0f2e2c;
    --gold: #f2b84b; --gold-soft: #2e2512; --up: #34d399; --up-soft: #0f2c22; --down: #f87171; --down-soft: #33181a;
    --warn: #fbbf24; --warn-soft: #30240c; --info: #7aa2ff; --info-soft: #17223b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1219; --bg-2: #0f1922; --card: #121d28; --ink: #e8eef5; --ink-2: #a9b6c6; --ink-3: #75849a;
  --line: #1e2c3a; --line-2: #2a3b4d; --brand: #14b8a6; --brand-2: #2dd4bf; --brand-ink: #04211e; --brand-soft: #0f2e2c;
  --gold: #f2b84b; --gold-soft: #2e2512; --up: #34d399; --up-soft: #0f2c22; --down: #f87171; --down-soft: #33181a;
  --warn: #fbbf24; --warn-soft: #30240c; --info: #7aa2ff; --info-soft: #17223b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--ink-3); } .ink2 { color: var(--ink-2); }
.hidden { display: none !important; }

/* boot */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 700; color: var(--ink-2); }
.boot-mark img { width: 44px; height: 44px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1240px; margin: 0 auto; padding: 0 16px; height: 62px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--ink); white-space: nowrap; }
.brand img { width: 32px; height: 32px; }
.brand small { font-weight: 500; font-size: 12px; color: var(--ink-3); display: block; margin-top: -4px; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 8px 14px; border-radius: 10px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.nav a:hover { background: var(--bg-2); color: var(--ink); }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
.who { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center;
  font-weight: 700; font-size: 14px; }
.who-name { line-height: 1.2; }
.who-name b { display: block; font-size: 14px; }
.who-name span { font-size: 12px; color: var(--ink-3); }
.icon-btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; height: 36px; min-width: 36px; padding: 0 10px; cursor: pointer;
  color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); }

/* page */
.page { max-width: 1240px; margin: 0 auto; padding: 22px 16px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.2px; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }
@media (max-width: 1020px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .g4, .g3, .g2 { grid-template-columns: minmax(0, 1fr); } .span2 { grid-column: auto; } .who-name { display: none; }
  .brand small { display: none; } .page-head h1 { font-size: 21px; } }
.section { margin-top: 22px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.section-title h2 { margin: 0; font-size: 17px; font-weight: 750; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 750; display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--ink-3); font-size: 13px; margin: -6px 0 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h3 { padding: 16px 18px 0; }
.users-head { padding: 14px 18px 12px; margin: 0; }
.users-head h3 { margin: 0; }
.card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.status-card { position: relative; overflow: hidden; }
.status-card .label { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.status-card .value { font-size: 19px; font-weight: 800; margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.status-card .detail { font-size: 13px; color: var(--ink-2); margin-top: 6px; min-height: 21px; }
.status-card::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: var(--line-2); }
.status-card.ok::before { background: var(--up); } .status-card.bad::before { background: var(--down); }
.status-card.warn::before { background: var(--warn); } .status-card.info::before { background: var(--info); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); display: inline-block; flex: none; }
.dot.ok { background: var(--up); box-shadow: 0 0 0 4px var(--up-soft); } .dot.bad { background: var(--down); box-shadow: 0 0 0 4px var(--down-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); } .dot.info { background: var(--info); box-shadow: 0 0 0 4px var(--info-soft); }
.dot.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.kpi .label { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.kpi .value { font-size: 26px; font-weight: 800; margin-top: 2px; }
.kpi .sub { font-size: 13px; color: var(--ink-2); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 680px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpis .kpi { background: var(--bg-2); border-radius: var(--radius-sm); padding: 12px 14px; }

.meter { margin-top: 14px; }
.meter-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
.bar { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--brand); transition: width .4s ease; }
.bar.down > i { background: var(--down); } .bar.up > i { background: var(--up); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700;
  background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--up-soft); color: var(--up); } .badge.bad { background: var(--down-soft); color: var(--down); }
.badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand); } .badge.gold { background: var(--gold-soft); color: var(--gold); }
.badge.lg { font-size: 13px; padding: 4px 12px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer; font-weight: 700; font-size: 14px; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: var(--card); border-color: var(--line-2); color: var(--ink); }
.btn.ghost:hover { border-color: var(--ink-3); }
.btn.danger { background: var(--down); color: #fff; }
.btn.danger.soft { background: var(--down-soft); color: var(--down); }
.btn.warn { background: var(--warn-soft); color: var(--warn); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 650; font-size: 14px; }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.input, select.input, textarea.input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card);
  outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 86px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.input[readonly] { background: var(--bg-2); color: var(--ink-2); }
.input.ltr { direction: ltr; text-align: left; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 0 10px 10px 0; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-2); border-inline-start: 0; border-radius: 10px 0 0 10px;
  background: var(--bg-2); color: var(--ink-2); font-weight: 700; }
.form-err { color: var(--down); font-size: 13.5px; min-height: 20px; margin: 4px 0 10px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-2); border-radius: 12px; padding: 4px; gap: 4px; width: 100%; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 10px 14px; cursor: pointer; font-weight: 700; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.seg button.on.real { color: var(--down); }
.seg button.on.sim { color: var(--brand); }

/* instruments */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile { border: 1.5px solid var(--line-2); border-radius: 12px; padding: 12px 14px; cursor: pointer; position: relative; background: var(--card);
  transition: border-color .15s, background .15s; }
.tile:hover { border-color: var(--ink-3); }
.tile.on { border-color: var(--brand); background: var(--brand-soft); }
.tile.locked { cursor: not-allowed; opacity: .62; background: var(--bg-2); }
.tile .sym { font-family: var(--mono); font-weight: 800; font-size: 17px; direction: ltr; }
.tile .nm { font-size: 13px; color: var(--ink-2); }
.tile .nt { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.tile .tick { position: absolute; inset-inline-end: 12px; top: 12px; }

/* tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: start; font-weight: 700; color: var(--ink-3); font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); white-space: nowrap; }
.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tr:hover td { background: color-mix(in srgb, var(--bg-2) 55%, transparent); }
.t .actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty { padding: 28px 18px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 2px; }

/* banners */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); margin-bottom: 16px; }
.banner.info { background: var(--info-soft); border-color: transparent; }
.banner.warn { background: var(--warn-soft); border-color: transparent; }
.banner.bad { background: var(--down-soft); border-color: transparent; }
.banner .ic { font-size: 20px; line-height: 1.3; }
.banner b { display: block; }

/* chart */
.chart { width: 100%; height: 190px; display: block; }
.chart .zero { stroke: var(--line-2); stroke-width: 1; }
.chart .b-up { fill: var(--up); } .chart .b-down { fill: var(--down); }
.chart text { fill: var(--ink-3); font-size: 10px; font-family: var(--mono); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-3); }

/* auth screens */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side { background: linear-gradient(155deg, #0b3b37 0%, #0f766e 55%, #115e59 100%); color: #e6fffb; padding: 48px; display: flex; flex-direction: column;
  justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 2px solid rgba(204, 251, 241, .14);
  inset-inline-end: -160px; bottom: -180px; box-shadow: 0 0 0 60px rgba(204, 251, 241, .05), 0 0 0 130px rgba(204, 251, 241, .035); }
.auth-side .brand { color: #fff; font-size: 22px; }
.auth-side .brand small { color: #99f6e4; }
.auth-side h2 { font-size: 30px; line-height: 1.35; margin: 0 0 12px; max-width: 460px; }
.auth-side p { color: #b5f0e7; max-width: 440px; margin: 0; }
.auth-points { display: grid; gap: 10px; margin-top: 26px; position: relative; z-index: 1; }
.auth-points div { display: flex; gap: 10px; align-items: center; color: #d6fbf5; }
.auth-points i { width: 26px; height: 26px; border-radius: 8px; background: rgba(255, 255, 255, .12); display: grid; place-items: center; font-style: normal; }
.auth-main { display: grid; place-items: center; padding: 32px 18px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h1 { font-size: 24px; margin: 0 0 4px; }
.auth-box > p { color: var(--ink-2); margin: 0 0 22px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(8, 15, 24, .5); display: grid; place-items: center; z-index: 60; padding: 16px; animation: fade .15s ease; }
.modal { background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; animation: rise .18s ease; }
.modal-head { padding: 18px 20px 6px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 8px 20px 4px; }
.modal-foot { padding: 12px 20px 18px; display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

/* toasts */
#toasts { position: fixed; bottom: 18px; inset-inline-start: 18px; display: grid; gap: 8px; z-index: 80; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; animation: rise .2s ease; white-space: pre-line; }
.toast.ok { background: var(--up); color: #fff; } .toast.bad { background: var(--down); color: #fff; }

/* save bar */
.savebar { position: fixed; bottom: 0; inset-inline: 0; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0, 0, 0, .08);
  z-index: 30; animation: rise .2s ease; }
.savebar-in { max-width: 1240px; margin: 0 auto; padding: 12px 16px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.gw-card { background: #0b0b0b; }
.gw-frame { display: block; width: 100%; aspect-ratio: 4 / 3; max-height: 78vh; border: 0; background: #0b0b0b; }
ol.steps { margin: 0 0 12px; padding-inline-start: 20px; display: grid; gap: 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 650; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-2); font-weight: 650; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.foot-note { text-align: center; color: var(--ink-3); font-size: 12.5px; margin-top: 30px; }

/* broadcast */
.bc-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1020px) { .bc-grid { grid-template-columns: minmax(0, 1fr); } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 12px; }
.chip { border: 1px solid var(--line-2); background: var(--card); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.saved { display: inline-flex; padding: 0; overflow: hidden; background: var(--brand-soft); border-color: transparent; }
.chip.saved button { border: 0; background: transparent; padding: 5px 10px; font: inherit; font-weight: 650; color: var(--brand); cursor: pointer; }
.chip.saved .x { padding: 5px 8px; color: var(--ink-3); }
.toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--line-2); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--bg-2); }
.toolbar button { min-width: 32px; height: 30px; border: 1px solid transparent; background: transparent; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-size: 14px; }
.toolbar button:hover { background: var(--card); border-color: var(--line-2); color: var(--ink); }
textarea.input.compose { border-radius: 0 0 10px 10px; min-height: 190px; line-height: 1.7; }
.dropzone { display: grid; gap: 2px; place-items: center; text-align: center; padding: 16px; margin-top: 12px; border: 1.5px dashed var(--line-2); border-radius: 12px; cursor: pointer;
  color: var(--ink-2); font-weight: 600; font-size: 14px; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .muted { font-weight: 500; font-size: 12.5px; }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 10px; padding: 5px 6px 5px 10px; font-size: 13px; max-width: 100%; }
.file-chip .nm { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }
.file-chip button { border: 0; background: var(--bg-2); border-radius: 6px; width: 24px; height: 24px; cursor: pointer; color: var(--ink-3); }
.sched-box { border-top: 1px dashed var(--line); padding-top: 14px; }
.days { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.addon-select { border: 1px solid var(--line-2); border-inline-start: 0; border-radius: 10px 0 0 10px; background: var(--bg-2); padding: 0 8px; font-weight: 650; color: var(--ink-2); }
.tg-chat { background: linear-gradient(160deg, #cfe3d1 0%, #a9c9a4 100%); border-radius: 12px; padding: 18px 14px; min-height: 220px; }
:root[data-theme="dark"] .tg-chat { background: linear-gradient(160deg, #1d2a33 0%, #0f1a21 100%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tg-chat { background: linear-gradient(160deg, #1d2a33 0%, #0f1a21 100%); } }
.tg-bubble { background: var(--card); color: var(--ink); border-radius: 14px 14px 14px 4px; padding: 10px 12px 6px; max-width: 92%; box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
  white-space: pre-wrap; word-break: break-word; unicode-bidi: plaintext; text-align: start; }
.tg-text code { font-family: var(--mono); background: var(--bg-2); padding: 0 4px; border-radius: 4px; }
.tg-files { display: grid; gap: 4px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.tg-meta { text-align: end; font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.target-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
td.clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

/* news */
.seg.seg-sm { width: auto; }
.seg.seg-sm button { padding: 6px 12px; font-size: 13px; }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; background: var(--bg-2); font-weight: 750; border-bottom: 1px solid var(--line); }
.news-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.news-row:last-child { border-bottom: 0; }
.news-row.high { background: color-mix(in srgb, var(--down-soft) 35%, transparent); }
.news-time { display: grid; line-height: 1.3; }
.news-time b { font-size: 17px; }
.news-time span { font-size: 12px; }
.news-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.news-vals { display: grid; grid-template-columns: repeat(3, 76px); gap: 6px; text-align: center; font-size: 13px; }
.news-vals div { display: grid; }
.news-vals .muted { font-size: 11.5px; }
@media (max-width: 680px) { .news-row { grid-template-columns: 78px minmax(0, 1fr); } .news-vals { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); } }
details > summary { cursor: pointer; padding: 6px 0; font-weight: 650; }

.pct { display: block; font-size: 12px; margin-top: 2px; opacity: .9; }
.live-tag { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-inline-start: 8px; display: inline-flex; align-items: center; gap: 5px; }

/* 08/11: one pill per desk (SPX, SPY) on the dashboard */
.desks-row { padding: 10px 14px; }
.desk-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); font-size: 13px; }

/* 08/11: risk settings per instrument — a dropdown in the card head, one short line per instrument */
.card-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-head-row h3 { margin: 0; }
select.input.risk-pick { width: auto; min-width: 150px; height: 36px; font-weight: 650; }
.risk-pair { gap: 12px; }
.risk-sum { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.risk-acct { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.risk-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; width: 100%; padding: 7px 10px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); font: inherit; font-size: 13px;
  text-align: start; cursor: pointer; }
.risk-row:hover { background: var(--bg-2); }
.risk-row.on { background: var(--brand-soft); border-color: var(--line); color: var(--ink); }
.risk-dot { color: var(--warn); font-size: 10px; vertical-align: middle; }
.risk-txt { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.risk-row.on .risk-txt { color: var(--ink-2); }
.card-head-row + .hint { margin: -4px 0 12px; }

/* 08/11: the channel's switches per instrument */
.ch-desks-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.ch-desks td, .ch-desks th { padding: 8px 10px; }
.ch-desks .check { margin: 0; }

/* 09/11: two-step verification and sign-in notices */
.notices { max-width: 1240px; margin: 0 auto; padding: 16px 16px 0; }
.notices:empty { display: none; }
.totp-key { font-size: 20px; font-weight: 700; letter-spacing: 1px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0 12px; text-align: center; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-size: 14px; }
.section-gap { margin-bottom: 12px; }

/* 15/11: phone layout. The bottom bar exists on every screen size but shows only on a phone; the top links hide there instead. */
.tabbar { display: none; }
@media (max-width: 680px) {
  body { font-size: 15px; -webkit-tap-highlight-color: transparent; }
  .topbar-in { height: 54px; gap: 10px; padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
  .topbar .nav { display: none; }
  .brand { flex: 1; font-size: 17px; }
  .brand img { width: 28px; height: 28px; }
  .who { gap: 8px; }
  .avatar { width: 32px; height: 32px; font-size: 13px; }
  .icon-btn { height: 38px; min-width: 38px; }
  .tabbar { display: flex; position: fixed; inset-inline: 0; bottom: 0; z-index: 40; background: color-mix(in srgb, var(--card) 94%, transparent);
    backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 4px 4px max(4px, env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px;
    border-radius: 12px; color: var(--ink-3); font-size: 11px; font-weight: 650; line-height: 1.2; }
  .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar a.on { color: var(--brand); }
  .tabbar a.on svg { background: var(--brand-soft); border-radius: 99px; padding: 2px 12px; box-sizing: content-box; }
  .page { padding: 16px max(12px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .notices { padding: 12px 12px 0; }
  .page-head { margin-bottom: 14px; gap: 10px; }
  .page-head .btn-row, .page-head > .btn { width: 100%; }
  .grid { gap: 12px; }
  .section { margin-top: 18px; }
  .card { padding: 14px; border-radius: 12px; }
  .card.flush > h3 { padding: 14px 14px 0; }
  .users-head { padding: 12px 14px 10px; }
  .kpi .value { font-size: 22px; }
  .status-card .value { font-size: 17px; }
  /* 16px stops the phone's browser from zooming into a field when it is touched */
  .input, select.input, textarea.input { font-size: 16px; height: 46px; }
  .btn { height: 44px; }
  .btn.sm { height: 36px; }
  .btn-row .btn:not(.sm) { flex: 1 1 auto; }
  .seg button { padding: 11px 8px; }
  .check input { width: 22px; height: 22px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px 12px; }
  .t th { padding: 9px 10px; }
  .t td { padding: 10px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  td.clip { max-width: 150px; }
  .kv { grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 6px 12px; }
  .kv dd { overflow-wrap: anywhere; }
  /* «بيع عند الربح»: the percent and the contracts of one row stay side by side */
  .risk-acct .risk-pair.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
  .card-head-row { flex-wrap: wrap; }
  select.input.risk-pick { width: 100%; }
  .tabs { margin-bottom: 12px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  /* sheets rise from the bottom like an app's */
  .modal-back { place-items: end center; padding: 0; }
  .modal { max-width: none; border-radius: 18px 18px 0 0; max-height: calc(100vh - 24px); padding-bottom: env(safe-area-inset-bottom); }
  .modal-foot .btn { flex: 1 1 auto; }
  /* the save bar and the notes sit above the bottom bar */
  body:has(.tabbar) .savebar { bottom: calc(61px + env(safe-area-inset-bottom)); }
  body:has(.savebar) .page { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
  .savebar-in { padding: 10px 12px; }
  .savebar-in .btn-row { width: 100%; }
  #toasts { inset-inline: 12px; bottom: 16px; max-width: none; }
  body:has(.tabbar) #toasts { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .auth-main { padding: 24px 16px max(24px, env(safe-area-inset-bottom)); align-items: start; padding-top: 8vh; }
  /* the green side panel with the logo is hidden on a phone: the logo comes above the form instead */
  .auth-box::before { content: ""; display: block; width: 56px; height: 56px; margin-bottom: 18px; background: url(/static/icon.svg) center / contain no-repeat; }
  .codes { grid-template-columns: minmax(0, 1fr); }
  .file-chip .nm { max-width: 160px; }
}
/* a finger needs a bigger target than a mouse, on tablets too */
@media (pointer: coarse) {
  .nav a, .tabs a { padding-top: 11px; padding-bottom: 11px; }
  .chip { padding: 7px 14px; }
  .risk-row { padding: 10px 12px; }
}
/* opened as the installed app: keep clear of the notch */
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); }
}
