/* ROOM TRADER VIP — every colour comes from a token, so a theme is only a new set of values.
   The defaults below are the signature theme «VIP العاجي»; themes.js overrides them. */
:root {
  --bg: #f8f6f1; --surface: #ffffff; --surface-2: #f2efe7; --glass: rgba(255,255,255,.78); --border: #e4ded1;
  --text: #14171f; --text-2: #4a4f5a; --text-muted: #696e78; --on-primary: #ffffff;
  --primary: #8a6510; --primary-2: #6e500b; --primary-soft: #f6edd6; --accent-rgb: 138, 101, 16;
  --profit: #16a34a; --loss: #dc2626; --neutral: #64748b; --warning: #b45309; --info: #0369a1;
  --bull: #16a34a; --bear: #dc2626; --grid: #ece7dc; --fib: #b8860b;
  /* the brand itself does not follow the theme: the rail and the logo gold stay the logo's */
  --rail: #0b0f16; --rail-2: #151c28; --rail-text: #a8b0bd;
  --gold: #8a6510; --gold-hi: #e7c45a;
  --r: 16px; --r-sm: 11px;
  --fs: 14px;
  --shadow: 0 1px 2px rgba(16,20,28,.05), 0 4px 16px rgba(16,20,28,.05);
  --shadow-lg: 0 12px 40px rgba(16,20,28,.14);
  --latin: "Montserrat", "IBM Plex Sans Arabic", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-mode="dark"] {
  color-scheme: dark; --gold: #e7c45a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "IBM Plex Sans Arabic", "Tajawal", "Cairo", system-ui, "Segoe UI", sans-serif;
  font-size: var(--fs); line-height: 1.6; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-2); }
:focus-visible { outline: 2px solid rgba(var(--accent-rgb), .6); outline-offset: 2px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-muted); }
.row { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.latin { font-family: var(--latin); direction: ltr; unicode-bidi: isolate; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 26px; height: 26px; }

/* ---------- the splash, while the first answer comes back ---------- */
#splash {
  position: fixed; inset: 0; z-index: 100; background: #0b0f16;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity .35s ease, visibility .35s;
}
#splash img { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 0 60px rgba(231,196,90,.18); }
#splash.gone { opacity: 0; visibility: hidden; }
.wordmark { display: flex; flex-direction: column; align-items: center; line-height: 1; font-family: var(--latin); direction: ltr; }
.wordmark span { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .22em; margin-right: -.22em; }
.wordmark b { color: #e7c45a; font-weight: 900; font-size: 34px; letter-spacing: .08em; margin-top: 6px; }
.splash-bar { width: 120px; height: 3px; border-radius: 3px; background: rgba(231,196,90,.18); overflow: hidden; position: relative; }
.splash-bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: #e7c45a; border-radius: 3px; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-120%); } to { transform: translateX(320%); } }
@media (prefers-reduced-motion: reduce) { .splash-bar::after { animation: none; width: 100%; } #splash { transition: none; } }

/* ---------- the frame: a dark rail, a top bar, the board ---------- */
#app { display: grid; grid-template-columns: 72px 1fr; height: 100dvh; }
.rail {
  background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); overflow: hidden;
  border-inline-end: 1px solid rgba(231,196,90,.12);
}
.rail-logo { display: block; margin-bottom: 10px; flex: none; border-radius: 12px; }
.rail-logo img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.rail button {
  width: 60px; min-height: 52px; border-radius: 13px; border: 0; background: transparent; color: var(--rail-text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; flex: none; padding: 6px 2px;
  transition: background .15s, color .15s;
}
.rail button span { font-size: 10.5px; font-weight: 600; line-height: 1.2; }
.rail button:hover { background: var(--rail-2); color: #fff; }
.rail button[aria-current="true"] { background: rgba(231,196,90,.14); color: #e7c45a; box-shadow: inset 0 0 0 1px rgba(231,196,90,.35); }
.rail .sp { flex: 1; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--surface); border-bottom: 1px solid var(--border); flex: none; min-height: 58px;
}
.brand { display: flex; align-items: baseline; gap: 7px; font-family: var(--latin); direction: ltr; color: var(--text); white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-room { font-weight: 700; font-size: 14px; letter-spacing: .14em; }
.brand-vip { font-weight: 900; font-size: 17px; letter-spacing: .06em; color: var(--gold); }
.top-sep { width: 1px; height: 26px; background: var(--border); flex: none; }
.page { flex: 1; min-height: 0; overflow: auto; }
.page.flush { overflow: hidden; }

.clock {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap;
}
.clock b { font-family: var(--latin); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; letter-spacing: .04em; direction: ltr; }
.clock[data-state="low"] { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.clock[data-state="out"] { color: var(--loss); border-color: color-mix(in srgb, var(--loss) 45%, var(--border)); }
.clock[data-state="frozen"] { opacity: .7; }
.me-chip {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 4px 12px 4px 4px; font-weight: 600; font-size: 13px; min-height: 40px; white-space: nowrap;
}
.me-chip:hover { border-color: var(--primary); }
.me-chip .av {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: 13px;
}
.me-chip.guest { background: var(--primary); border-color: var(--primary); color: var(--on-primary); padding: 4px 14px; }
.me-chip.guest:hover { background: var(--primary-2); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--r-sm); padding: 9px 16px; font-weight: 600; white-space: nowrap; min-height: 42px;
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-2); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 9px; min-height: 32px; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px;
  padding: 3px 11px; font-size: 12px; font-weight: 600; color: var(--text-2);
}
.chip.gold { background: var(--primary-soft); border-color: transparent; color: var(--primary-2); }
.chip[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-2); }
input[type="text"], input[type="email"], input[type="number"], input[type="search"], select, textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 9px 12px; width: 100%; min-height: 42px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(var(--accent-rgb), .30); outline-offset: 1px; border-color: var(--primary); }
.field { position: relative; display: flex; align-items: center; }
.field .ic { position: absolute; inset-inline-start: 11px; color: var(--text-muted); pointer-events: none; }
.field input { padding-inline-start: 38px; }
label.lbl { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin: 0; font-size: 16px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 5px 13px; font-weight: 600; font-size: 13px; color: var(--text-2); min-height: 30px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.badge { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.badge.gold { background: var(--primary-soft); color: var(--primary-2); }
.badge.green { background: color-mix(in srgb, var(--profit) 14%, var(--surface)); color: var(--profit); }

/* ---------- a page and its header ---------- */
.wrap { padding: 22px; max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.wrap.narrow { max-width: 720px; }
.ph { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ph h1 { margin: 0; font-size: 24px; line-height: 1.3; }
.ph p { margin: 2px 0 0; color: var(--text-2); }
.sec-title { font-size: 12px; font-weight: 700; color: var(--text-muted); letter-spacing: .03em; margin: 4px 2px 0; }

/* ---------- tiles and meters ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.tile .tk { display: flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 12.5px; font-weight: 600; }
.tile .tk .ic { color: var(--primary); }
.tile .tv { font-family: var(--latin); font-weight: 800; font-size: 22px; line-height: 1.2; direction: ltr; text-align: end; }
.tile .tv small { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.meter { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 8px; background: var(--primary); }
.meter.low i { background: var(--warning); }
.meter.out i { background: var(--loss); }

/* ---------- sign in ---------- */
.auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-hero {
  background: #0b0f16; color: #e8e6df; padding: 40px; display: flex; flex-direction: column; justify-content: center; gap: 22px;
  position: relative; overflow: hidden;
}
.auth-hero::before {
  content: ""; position: absolute; inset: auto -10% -20% -10%; height: 55%;
  background: repeating-linear-gradient(90deg, rgba(231,196,90,.06) 0 1px, transparent 1px 64px),
              repeating-linear-gradient(0deg, rgba(231,196,90,.06) 0 1px, transparent 1px 64px);
  pointer-events: none;
}
.auth-hero > * { position: relative; }
.auth-hero img { width: 112px; height: 112px; border-radius: 26px; box-shadow: 0 0 70px rgba(231,196,90,.15); }
.auth-hero h2 { margin: 0; font-size: 28px; line-height: 1.35; color: #fff; }
.auth-hero p { margin: 0; color: #b9bec8; max-width: 440px; }
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 460px; }
.perks li { display: flex; align-items: center; gap: 10px; color: #dcdad3; }
.perks .ic { color: #e7c45a; }
.perks b { font-family: var(--latin); color: #fff; }
.auth-form { padding: 40px; display: flex; flex-direction: column; justify-content: center; gap: 16px; max-width: 520px; width: 100%; margin: 0 auto; }
.auth-form h1 { margin: 0; font-size: 24px; }
.msg { font-size: 13px; font-weight: 600; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.msg.err { background: color-mix(in srgb, var(--loss) 10%, var(--surface)); color: var(--loss); }
.msg.ok { background: color-mix(in srgb, var(--profit) 10%, var(--surface)); color: var(--profit); }
.or { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- the account ---------- */
.acc-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.acc-av { width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-size: 22px; font-weight: 700; flex: none; }
.kv { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); }
.kv:first-child { border-top: 0; }
.kv span { flex: 1; color: var(--text-muted); }

/* ---------- spaces ---------- */
.space-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.space-type { display: flex; flex-direction: column; gap: 8px; }
.space-type .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-2); }
.url-demo { font-family: var(--latin); direction: ltr; text-align: start; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--text-2); }
.url-demo b { color: var(--gold); }

/* ---------- the chart board ---------- */
.board { display: grid; height: 100%; min-height: 0; gap: 1px; background: var(--border); flex: 1; min-width: 0; }
.board.g1 { grid-template-columns: 1fr; }
.board.g2 { grid-template-columns: 1fr 1fr; }
.board.g4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.board.g6 { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; }
.board.g8 { grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr 1fr; }
.pane { background: var(--surface); min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pane-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); flex: none; min-height: 38px; }
.pane-head .sym { font-family: var(--latin); font-weight: 800; font-size: 13px; letter-spacing: .02em; direction: ltr; }
.pane-body { flex: 1; min-height: 0; direction: ltr; }
.pane-empty { flex: 1; display: grid; place-items: center; color: var(--text-muted); font-size: 13px; text-align: center; padding: 12px; }
.pane-empty .ic { width: 32px; height: 32px; color: var(--border); margin: 0 auto 6px; display: block; }

.sidebar { width: 310px; border-inline-start: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; flex: none; }
.side-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.side-head b { font-size: 14px; }
.sidebar .field { margin: 0 12px 8px; }
.sidebar h4 { margin: 12px 14px 6px; font-size: 11.5px; color: var(--text-muted); font-weight: 700; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.sidebar h4::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.sidebar .list { overflow: auto; padding: 0 8px 12px; flex: 1; }
.sidebar .item { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 10px; cursor: pointer; width: 100%; border: 0; background: transparent; text-align: start; }
.sidebar .item:hover { background: var(--surface-2); }
.sidebar .item b { font-size: 13px; font-weight: 600; display: block; }
.sidebar .item small { color: var(--text-muted); font-size: 11.5px; font-family: var(--latin); }
.sidebar .item .add { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); flex: none; }
.sidebar .item.on .add { background: var(--primary); color: var(--on-primary); }
.side-toggle { display: none; }

/* ---------- the theme picker ---------- */
.th-wrap { padding: 18px; display: flex; flex-direction: column; gap: 14px; height: 100%; min-height: 0; overflow: auto; max-width: 1200px; margin: 0 auto; }
.th-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; }
.th {
  border: 1.5px solid var(--border); border-radius: 13px; background: var(--surface); padding: 0; overflow: hidden; text-align: start;
}
.th[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .18); }
.th-prev { height: 70px; padding: 9px; display: flex; flex-direction: column; gap: 5px; }
.th-prev .bar { height: 7px; border-radius: 4px; }
.th-prev .dots { display: flex; gap: 4px; margin-top: auto; }
.th-prev .dots i { width: 9px; height: 9px; border-radius: 50%; display: block; }
.th-name { padding: 7px 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 6px; }
.th-name b { font-size: 12.5px; font-weight: 600; }
.th-name .ok { margin-inline-start: auto; color: var(--primary); display: flex; }
.th.sig .th-name b::before { content: "★ "; color: var(--gold); }

/* ---------- colour tuning, and the admin fields ---------- */
.tune { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.tune label { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 10px; padding: 7px 10px; }
.tune label span { flex: 1; font-size: 12.5px; }
.tune input[type="color"] { width: 36px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 7px; background: none; }

/* ---------- the notice, the veil, messages ---------- */
.notice { background: var(--primary-soft); color: var(--primary-2); padding: 8px 16px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--border); flex: none; }
.veil { position: fixed; inset: 0; background: rgba(5,8,12,.6); display: grid; place-items: center; z-index: 60; padding: 20px; backdrop-filter: blur(3px); }
.dialog { max-width: 400px; text-align: center; box-shadow: var(--shadow-lg); }
.dialog img { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto; display: block; }
.toast {
  position: fixed; inset-inline: 0; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); margin-inline: auto; width: max-content; max-width: 86vw;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 13px; z-index: 70;
  box-shadow: var(--shadow-lg);
}

/* ---------- tablet and phone ---------- */
@media (max-width: 980px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 22px; }
  .auth-hero h2 { font-size: 22px; }
  .auth-form { padding: 24px 22px 40px; }
}
@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail { order: 2; flex-direction: row; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); border-inline-end: 0; border-top: 1px solid rgba(231,196,90,.12); }
  .rail-logo, .rail .sp { display: none; }
  .rail button { width: auto; flex: 1; min-height: 50px; }
  #app > * { min-width: 0; }
  .top { padding: 6px 8px; gap: 6px; min-height: 52px; }
  .brand { flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.1; }
  .brand-room { font-size: 9.5px; letter-spacing: .12em; }
  .brand-vip { font-size: 15px; }
  .top-sep, .me-chip .nm { display: none; }
  #topTools { min-width: 0; overflow-x: auto; }
  .seg button { padding: 4px 9px; }
  .clock { padding: 4px 8px; gap: 4px; }
  .clock b { font-size: 12px; }
  .clock .ic { width: 16px; height: 16px; }
  .me-chip { padding: 3px; min-height: 36px; }
  .me-chip .av { width: 28px; height: 28px; }
  .me-chip.guest { padding: 4px 11px; font-size: 12px; }
  .sidebar { position: absolute; inset-inline-end: 0; top: 0; bottom: 0; width: min(86vw, 320px); z-index: 20; box-shadow: var(--shadow-lg); }
  .sidebar.closed { display: none; }
  .side-toggle { display: inline-flex; }
  .board.g4, .board.g6, .board.g8 { grid-template-columns: 1fr; grid-template-rows: none; }
  .board.g2 { grid-template-columns: 1fr; }
  .wrap { padding: 16px; }
  .ph h1 { font-size: 20px; }
}

/* ================= the chart workspace (board.js) ================= */
.bd-host { height: 100%; }
.bd { height: 100%; display: flex; flex-direction: column; min-height: 0; position: relative; background: var(--bg); }
.lang-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; min-width: 40px; height: 40px; font-weight: 700; font-size: 12px; flex: none; }
.lang-btn:hover { border-color: var(--primary); }

/* the top bar of the chart */
.tb { display: flex; align-items: center; gap: 3px; padding: 5px 8px; background: var(--surface); border-bottom: 1px solid var(--border); flex: none; overflow-x: auto; scrollbar-width: none; }
.tb::-webkit-scrollbar, .dbar::-webkit-scrollbar { display: none; }
.tbtn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--text-2); border-radius: 9px; padding: 6px 9px; min-height: 38px; font-weight: 600; font-size: 13px; white-space: nowrap; flex: none; }
.tbtn:hover { background: var(--surface-2); color: var(--text); }
.tbtn.on { background: var(--primary-soft); color: var(--primary-2); }
.tbtn.sym { color: var(--text); background: var(--surface-2); padding-inline: 12px; }
.tbtn.sym b { font-weight: 800; letter-spacing: .02em; }
.tbtn.sess .tx { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.tb-sep { width: 1px; height: 22px; background: var(--border); flex: none; margin: 0 3px; }
.tb .seg { flex: none; }
.frames button { font-family: var(--latin); font-size: 12px; padding: 5px 9px; }
.frames .more { padding: 5px 6px; display: inline-flex; align-items: center; }
.only-phone { display: none; }

/* the drawing bar, the charts, the side panel — always laid out left to right */
.bd-main { flex: 1; min-height: 0; display: flex; position: relative; }
.dbar { order: 10; width: 46px; flex: none; background: var(--surface); border-inline: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; overflow-y: auto; scrollbar-width: none; }
.bd .board { order: 20; }
.bd .sidebar { order: 30; border-inline: 1px solid var(--border); }
.bd.draw-right .dbar { order: 25; }
.bd.side-left .sidebar { order: 5; }
.dbtn { width: 36px; height: 36px; border: 0; background: transparent; color: var(--text-2); border-radius: 9px; display: grid; place-items: center; position: relative; flex: none; }
.dbtn:hover { background: var(--surface-2); color: var(--text); }
.dbtn.on { background: var(--primary-soft); color: var(--primary-2); }
.dbtn .corner { position: absolute; right: 3px; bottom: 3px; border: 3px solid transparent; border-right-color: currentColor; border-bottom-color: currentColor; opacity: .55; }
.dbar hr { width: 24px; border: 0; border-top: 1px solid var(--border); margin: 3px 0; flex: none; }

.board.multi .pane.on .pane-head { background: var(--primary-soft); }
.board:not(.multi) .pane-max { display: none; }
.board.solo .pane { display: none; }
.board.solo .pane.solo { display: flex; grid-column: 1 / -1; grid-row: 1 / -1 !important; }
.pane-head { direction: ltr; }
.pane-body { position: relative; overflow: hidden; }
.kc-host { position: absolute; inset: 0; z-index: 1; }
.pane-sym { border: 0; background: transparent; font-family: var(--latin); font-weight: 800; font-size: 13px; padding: 3px 6px; border-radius: 7px; letter-spacing: .02em; }
.pane-sym:hover, .pane-head button.chip:hover { background: var(--surface-2); border-color: var(--primary); }
.pane-head .chip { font-family: var(--latin); }
.pane-head .badge { font-size: 10.5px; }
.pane-max { min-height: 26px !important; padding: 3px 6px !important; }
.cd { font-family: var(--latin); font-size: 11.5px; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* the member's watermark, and the symbol name behind the candles */
.wm { position: absolute; pointer-events: none; display: flex; align-items: center; gap: 10px; font-family: var(--latin); font-weight: 800; white-space: nowrap; z-index: 2; color: var(--text); line-height: 1.2; direction: ltr; }
.wm img { display: block; width: auto; }
.wm.pos-c { top: calc((100% - 30px) / 2); left: calc((100% - 70px) / 2); transform: translate(-50%, -50%); }
.wm.pos-tl { top: 44px; left: 18px; } .wm.pos-tr { top: 44px; right: 88px; }
.wm.pos-bl { bottom: 48px; left: 18px; } .wm.pos-br { bottom: 48px; right: 88px; }
.swm { position: absolute; z-index: 0; pointer-events: none; top: calc((100% - 30px) / 2); left: calc((100% - 70px) / 2); transform: translate(-50%, -50%); font-family: var(--latin); font-weight: 900; font-size: clamp(28px, 9vw, 96px); letter-spacing: .04em; color: var(--text); opacity: .06; white-space: nowrap; text-align: center; line-height: 1.05; direction: ltr; }
.swm small { display: block; font-size: .45em; letter-spacing: .2em; }

/* the bar that shows over a selected drawing */
.selbar { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 5px 8px; box-shadow: var(--shadow-lg); max-width: calc(100% - 16px); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.selbar select { width: auto; min-height: 30px; padding: 3px 6px; font-size: 12px; border-radius: 8px; }
.sel-name { display: inline-flex; gap: 5px; align-items: center; font-weight: 700; font-size: 12px; color: var(--text-2); }
.sws { display: inline-flex; gap: 4px; align-items: center; }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); padding: 0; flex: none; }
.swatch.on { box-shadow: 0 0 0 2px var(--text); }
.sws input[type="color"], .f-row input[type="color"] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 7px; background: none; flex: none; }
.sb { height: 30px; min-width: 30px; border: 0; background: transparent; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; color: var(--text-2); flex: none; }
.sb:hover { background: var(--surface-2); color: var(--text); }
.sb.on { background: var(--primary-soft); color: var(--primary-2); }
.sb.wide { padding: 0 9px; font-size: 12px; font-weight: 600; }
.sb.bad { color: var(--loss); }
.sel-fill { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; color: var(--text-2); }
.sel-fill input { width: 70px; }

/* popovers, menus, dialogs */
.pop { position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow-lg); padding: 5px; max-height: 82vh; overflow: auto; min-width: 200px; }
.menu { display: flex; flex-direction: column; gap: 1px; }
.menu button { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; border-radius: 8px; padding: 8px 10px; text-align: start; min-height: 38px; width: 100%; font-size: 13.5px; color: var(--text); }
.menu button:hover { background: var(--surface-2); }
.menu button.on { color: var(--primary-2); font-weight: 600; }
.menu button small { color: var(--text-muted); font-size: 11.5px; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 6px; }
.menu-row { display: flex; gap: 2px; }
.menu-row .star { width: 38px; flex: none; justify-content: center; padding: 0; color: var(--text-muted); opacity: .5; }
.menu-row .star.on { color: var(--gold); opacity: 1; }
.menu-row .star.on .ic { fill: currentColor; }
.menu-title { font-size: 11.5px; font-weight: 700; color: var(--text-muted); padding: 6px 10px 4px; }
.cdot { width: 10px; height: 10px; border-radius: 50%; display: block; flex: none; }
.gpick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gpick button { border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 7px 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-2); }
.gpick button[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.gmini { display: grid; gap: 2px; width: 36px; height: 26px; }
.gmini i { background: currentColor; border-radius: 1.5px; opacity: .5; display: block; }
.sw-row, .f-row { display: flex; align-items: center; gap: 10px; min-height: 38px; }
.f-row select, .f-row input[type="text"], .f-row input[type="number"] { width: auto; max-width: 56%; min-height: 36px; padding: 5px 9px; }
.f-row input[type="range"] { width: 44%; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
input[type="range"] { accent-color: var(--primary); }
.dlg { width: min(94vw, 460px); max-height: 88vh; overflow: auto; text-align: start; box-shadow: var(--shadow-lg); }
.dlg.wide { width: min(94vw, 660px); }
.dlg .list { max-height: 50vh; overflow: auto; }
.dlg .sec-title { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.dlg .sec-title:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.chips { flex-wrap: wrap; }
button.chip { cursor: pointer; }

/* rows used by every list: the watch list, the indicators, the drawings, the sessions */
.list h4 { margin: 12px 8px 6px; font-size: 11.5px; color: var(--text-muted); font-weight: 700; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.list h4::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.list .item { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 10px; cursor: pointer; width: 100%; border: 0; background: transparent; text-align: start; color: var(--text); }
.list .item:hover { background: var(--surface-2); }
.list .item.static { cursor: default; }
.list .item.cur { background: var(--primary-soft); }
.list .item b { font-size: 13px; font-weight: 600; display: block; }
.list .item small { color: var(--text-muted); font-size: 11.5px; display: block; }
.list .item .add { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); flex: none; }
.list .item.on .add { background: var(--primary); color: var(--on-primary); }
.quote { display: flex; flex-direction: column; align-items: flex-end; }
.quote b, .quote-1 { font-variant-numeric: tabular-nums; }
.up { color: var(--profit) !important; } .dn { color: var(--loss) !important; }
.tabs { display: flex; border-bottom: 1px solid var(--border); flex: none; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 10px 6px; font-weight: 600; font-size: 13px; color: var(--text-muted); border-bottom: 2px solid transparent; min-height: 42px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }
.tabs .tabs-x { flex: none; width: 40px; display: grid; place-items: center; }
.side-note { font-size: 11.5px; color: var(--text-muted); padding: 6px 12px; background: var(--surface-2); flex: none; }
.on-chart { padding: 0 12px 8px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.sidebar > .field { margin: 0 12px 8px; }

/* what the member can hide */
.bd.no-draw .dbar, .bd.no-side .sidebar, .bd.no-head .pane-head, .bd.no-tb .tb, .bd.no-cd .cd { display: none; }
body.zen .rail, body.zen .top, body.zen .notice { display: none !important; }
body.zen #app { grid-template-columns: 1fr; grid-template-rows: 1fr; }
body.bare .tb, body.bare .dbar, body.bare .sidebar, body.bare .pane-head, body.bare .selbar { display: none !important; }
/* the small pill that stays when the bars are gone */
.fpill { display: none; position: absolute; top: 34px; left: 12px; z-index: 30; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); opacity: .35; transition: opacity .18s; }
.fpill:hover, .fpill:focus-within { opacity: 1; }
.fpill button { width: 34px; height: 34px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.fpill button:hover { background: var(--surface-2); color: var(--text); }
.bd.no-tb .fpill, body.bare .fpill { display: flex; }
@media (hover: none) { .fpill { opacity: .7; } }
@media (prefers-reduced-motion: reduce) { .fpill { transition: none; } }

@media (max-width: 760px) {
  .tbtn .tx { display: none; }
  .tbtn.sess .tx { display: inline; max-width: 90px; }
  .tbtn { padding: 6px 8px; }
  .only-phone { display: inline-flex; }
  .dbar { width: 42px; }
  .bd .sidebar { position: absolute; right: 0; left: auto; top: 0; bottom: 0; width: min(88vw, 330px); z-index: 20; box-shadow: var(--shadow-lg); }
  .bd.side-left .sidebar { right: auto; left: 0; }
  .bd .board { grid-template-columns: 1fr !important; grid-template-rows: none !important; grid-auto-rows: minmax(62%, 1fr); overflow-y: auto; }
  .bd .board:not(.multi) { grid-auto-rows: 1fr; }
  .bd .board .pane { grid-row: auto !important; }
  .selbar { top: 6px; }
}

/* the chart's ready-made looks, the member's picture behind the candles, and the recording light */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; max-height: 318px; overflow-y: auto; padding: 3px; }
.preset { border: 1.5px solid var(--border); border-radius: 11px; background: var(--surface); padding: 0; overflow: hidden; text-align: start; display: flex; flex-direction: column; }
.preset[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .18); }
.preset-prev { height: 46px; display: flex; align-items: flex-start; justify-content: center; gap: 6px; padding: 7px 0; direction: ltr; }
.preset-prev i { width: 8px; border-radius: 1.5px; display: block; }
.preset-name { padding: 5px 8px; border-top: 1px solid var(--border); font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; justify-content: space-between; color: var(--text); }
.preset-name small { color: var(--text-muted); font-weight: 500; font-size: 10.5px; }
.bgimg { position: absolute; inset: -16px; z-index: 0; pointer-events: none; background-size: cover; background-position: center; }
.tbtn.recording { background: color-mix(in srgb, var(--loss) 12%, var(--surface)); color: var(--loss); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--loss); display: block; animation: recblink 1.2s ease-in-out infinite; }
@keyframes recblink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }

/* the drawings tree */
.ibtn { width: 28px; height: 28px; border: 0; background: transparent; border-radius: 7px; display: grid; place-items: center; color: var(--text-2); flex: none; padding: 0; }
.ibtn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.ibtn:disabled { opacity: .25; }
.tree .item.obj { padding: 5px 6px; gap: 5px; }
.tree .item.off b, .tree .fold.off .fold-name b { color: var(--text-muted); text-decoration: line-through; }
.fold { border: 1px solid var(--border); border-inline-start: 4px solid var(--border); border-radius: 10px; margin: 6px 0; overflow: hidden; }
.fold-head { display: flex; align-items: center; gap: 3px; padding: 4px 6px; background: var(--surface-2); }
.fold-head input[type="color"] { width: 22px; height: 22px; padding: 0; border: 0; background: none; border-radius: 6px; flex: none; }
.fold-name { flex: 1; min-width: 0; border: 0; background: transparent; text-align: start; display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 7px; min-height: 30px; }
.fold-name:hover { background: var(--surface); }
.fold-name b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fold-name small { color: var(--text-muted); }
.fold-empty { padding: 8px 10px; font-size: 12px; }
input[type="time"] { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 5px 9px; min-height: 36px; }

.demo { opacity: .45; }

/* ---- replay and the practice account ---- */
.rp { flex: none; border-top: 1px solid var(--border); background: var(--surface); }
.rp[hidden], .rp-dock[hidden], .fld[hidden] { display: none; }
.rp-bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.rbtn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; flex: none; }
.rbtn:hover { background: var(--surface-2); }
.rbtn.go { background: var(--primary); border-color: var(--primary); color: var(--on-primary, #fff); width: 40px; }
.rp-speed { height: 32px; border-radius: 9px; padding: 0 8px; width: 74px; flex: none; }
.rp-clock { font-size: 13.5px; padding: 0 6px; font-variant-numeric: tabular-nums; direction: ltr; }
.rp-acc { display: flex; gap: 14px; padding-inline-start: 10px; border-inline-start: 1px solid var(--border); }
.kv { display: inline-flex; flex-direction: column; line-height: 1.25; }
.kv small { font-size: 10.5px; color: var(--text-muted); }
.kv b { font-size: 12.5px; font-variant-numeric: tabular-nums; direction: ltr; }
.up { color: var(--profit); } .dn { color: var(--loss); }
.rp-dock { display: flex; flex-direction: column; gap: 8px; padding: 8px 10px 10px; border-top: 1px solid var(--border); height: 232px; max-height: 42vh; overflow: hidden; }
.rp-ticket { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; flex: none; }
.rp-ticket > b { font-size: 13.5px; align-self: center; min-width: 74px; }
.rp-ticket .fld { width: 104px; }
.fld { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fld small { font-size: 10.5px; color: var(--text-muted); }
.fld input, .fld select { height: 30px; padding: 0 8px; border-radius: 8px; min-width: 0; width: 100%; direction: ltr; }
.tbuy { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 3px 8px; min-width: 116px; height: 44px; border: 0; border-radius: 10px; color: #fff; cursor: pointer; font: inherit; line-height: 1.25; }
.tbuy small { font-size: 11px; opacity: .92; } .tbuy b { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tbuy.sell { background: var(--loss); } .tbuy.buy { background: var(--profit); }
.tbuy:hover { filter: brightness(1.08); }
.rp-book { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.rp-book .seg { align-self: flex-start; }
.rp-list { overflow: auto; flex: 1; min-height: 0; border: 1px solid var(--border); border-radius: 10px; }
.rp-list .pad { padding: 10px 12px; font-size: 13px; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rp-table th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 11.5px; text-align: start; padding: 5px 8px; white-space: nowrap; }
.rp-table td { padding: 3px 8px; border-top: 1px solid var(--border); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rp-table td.buy { color: #2962ff; font-weight: 700; } .rp-table td.sell { color: #e0862a; font-weight: 700; }
.cellbtn { border: 1px dashed var(--border); background: transparent; color: inherit; border-radius: 6px; padding: 1px 7px; cursor: pointer; font: inherit; min-width: 44px; }
.cellbtn:hover { border-color: var(--primary); }
.rp-sum { display: flex; gap: 16px; flex-wrap: wrap; padding: 7px 10px; font-size: 12.5px; color: var(--text-2); border-bottom: 1px solid var(--border); }
body.bare .rp-dock { display: none; }
@media (max-width: 760px) {
  .rp-dock { height: auto; max-height: 48vh; overflow: auto; }
  .rp-ticket .fld { width: calc(33.3% - 6px); }
  .tbuy { flex: 1; }
  .rp-list { min-height: 110px; }
  .rp-acc { gap: 10px; }
}

/* ---- an analysis opened from a view-only link ---- */
.viewbar { display: flex; align-items: center; gap: 10px; padding: 7px 12px; background: var(--primary-soft); border-bottom: 1px solid var(--border); font-size: 13px; flex: none; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.viewing .dbar, .viewing .tbtn.sess, .viewing .only-phone { display: none !important; }

/* ---- the live room ---- */
.roombar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 13px; flex: none; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.roombar[hidden], .roombar [hidden] { display: none; }
.live { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; color: var(--loss); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--loss); animation: livedot 1.4s ease-in-out infinite; }
@keyframes livedot { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .live i { animation: none; } }
.roombar .btn.sm { display: inline-flex; align-items: center; gap: 5px; }
.chk { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.people { display: flex; flex-direction: column; gap: 4px; min-width: 300px; max-width: 92vw; padding: 6px; }
.person { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; font-size: 13px; }
.person.off { opacity: .5; }
.person select { height: 28px; padding: 0 6px; border-radius: 7px; width: auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex: none; }
.dot.on { background: var(--profit); }
