/* ==============================================================
 *  XISOB Terminal — design layer (2026-10)
 *  Loaded after style.css. Owns colour tokens (dark + light),
 *  type, header, strip, panels, table and the phone layout.
 *  Principles: data first, glanceable on a phone, depth on demand.
 * ============================================================== */

/* ── Tokens: dark (default) ───────────────────────────────────── */
:root {
  color-scheme: dark;
  --bg:        oklch(0.155 0.006 258);
  --bg-1:      oklch(0.185 0.007 258);
  --bg-2:      oklch(0.215 0.008 258);
  --bg-3:      oklch(0.255 0.009 258);
  --line:      oklch(0.27 0.008 258);
  --line-2:    oklch(0.33 0.009 258);
  --text:      oklch(0.95 0.004 258);
  --text-2:    oklch(0.80 0.006 258);
  --dim:       oklch(0.66 0.008 258);
  --brand:     #4d8bfe;                  /* XISOB electric blue (logo) */
  --accent:    #4d8bfe;                  /* 5.6:1 on the dark background */
  --accent-dim:#3a74e0;
  --accent-ink:#0b1220;                  /* text on accent fills, 5.7:1 */
  --accent-soft: rgba(77, 139, 254, 0.16);
  --accent-2:  var(--text);
  --up:        oklch(0.78 0.16 155);
  --up-bg:     oklch(0.78 0.16 155 / 0.13);
  --down:      oklch(0.70 0.18 18);
  --down-bg:   oklch(0.70 0.18 18 / 0.13);
  --flat:      var(--dim);
  --bond:      oklch(0.74 0.09 285);
  --info:      oklch(0.75 0.11 235);
  --warn:      oklch(0.80 0.13 75);
  --hover:     oklch(1 0 0 / 0.045);
  --shadow:    0 8px 28px oklch(0 0 0 / 0.45);

  --font-ui:   'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-num:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --topbar-h: 52px;
  --tabbar-h: 60px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);   /* ease-out-quint */

  /* z-index scale */
  --z-sticky: 100; --z-tabbar: 150; --z-sheet: 170; --z-fab: 140;
}

/* ── Tokens: light ────────────────────────────────────────────── */
:root[data-theme="light"] {
  color-scheme: light;
  --bg:        oklch(0.975 0.004 258);
  --bg-1:      oklch(0.995 0.002 258);
  --bg-2:      oklch(0.955 0.005 258);
  --bg-3:      oklch(0.925 0.006 258);
  --line:      oklch(0.90 0.006 258);
  --line-2:    oklch(0.84 0.008 258);
  --text:      oklch(0.22 0.012 258);
  --text-2:    oklch(0.38 0.012 258);
  --dim:       oklch(0.50 0.012 258);
  --accent:    #2563d9;                  /* deeper shade of the brand blue: 5.4:1 on white */
  --accent-dim:#1d4fb0;
  --accent-ink:#ffffff;
  --accent-soft: rgba(37, 99, 217, 0.10);
  --up:        oklch(0.50 0.14 155);
  --up-bg:     oklch(0.50 0.14 155 / 0.10);
  --down:      oklch(0.52 0.19 22);
  --down-bg:   oklch(0.52 0.19 22 / 0.09);
  --bond:      oklch(0.48 0.12 285);
  --info:      oklch(0.50 0.13 240);
  --warn:      oklch(0.55 0.13 65);
  --hover:     oklch(0 0 0 / 0.035);
  --shadow:    0 8px 28px oklch(0.3 0.02 258 / 0.14);
}

/* ── Base ─────────────────────────────────────────────────────── */
html, body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { background: var(--bg); }
.mono, .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }

/* ── Top bar ──────────────────────────────────────────────────── */
.topbar {
  min-height: var(--topbar-h);
  padding: 8px 16px;
  gap: 14px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  z-index: var(--z-sticky);
}
.brand { min-width: 0; gap: 10px; }
.logo {
  font-family: var(--font-num);
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  background: var(--accent); color: var(--accent-ink);
  padding: 6px 8px; border-radius: var(--r-sm);
  box-shadow: none;
}
.title h1 { font-size: 15px; font-weight: 650; letter-spacing: 0; }
.title h1 .dim { color: var(--dim); font-weight: 500; }
.title .subtitle { font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--dim); }

.topbar-right { gap: 8px; flex: 1; justify-content: flex-end; min-width: 0; }

/* command button reads as a search field */
.cmd-btn {
  font-family: var(--font-ui); font-size: 13px;
  background: var(--bg-2); color: var(--text-2);
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  height: 36px; padding: 0 10px;
  transition: border-color .15s var(--ease), background .15s var(--ease), color .15s var(--ease);
}
.cmd-btn:hover { background: var(--bg-3); color: var(--text); border-color: var(--accent); }
.cmd-btn span { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.cmd-btn:hover span { background: none; color: inherit; border: 0; }
#cmdBtn { min-width: 260px; justify-content: flex-start; gap: 8px; }
#cmdBtn .cmd-ico { width: 16px; height: 16px; flex: none; opacity: .8; }
#cmdBtn .cmd-label { display: block !important; flex: 1; text-align: left; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cmdBtn kbd { font-size: 11px; padding: 1px 6px; border-bottom-width: 1px; color: var(--dim); background: var(--bg-1); }

.lang-select, .icon-btn {
  height: 36px; border-radius: var(--r-md);
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line-2);
  font-family: var(--font-ui); font-size: 13px;
}
.lang-select { padding: 0 8px; }
.icon-btn {
  width: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease);
}
.icon-btn:hover { border-color: var(--accent); background: var(--bg-3); }
.icon-btn svg { width: 18px; height: 18px; }
/* profile / help buttons, moved into the header by ui.js */
.topbar #profileBtn, .topbar #faqBtn {
  position: static !important; width: 36px !important; height: 36px !important;
  border-radius: var(--r-md) !important; background: var(--bg-2) !important;
  border: 1px solid var(--line-2) !important; box-shadow: none !important;
  font-size: 16px !important; color: var(--text) !important; z-index: auto !important;
}
.theme-ico-sun { display: none; }
:root[data-theme="light"] .theme-ico-sun { display: block; }
:root[data-theme="light"] .theme-ico-moon { display: none; }

.status { gap: 8px; }
.pill { font-family: var(--font-ui); font-size: 12px; font-weight: 600; padding: 5px 10px; background: var(--bg-2); border-color: var(--line-2); }
.market-session { font-family: var(--font-num); font-size: 12px; color: var(--dim); }
.clock { font-size: 13px; font-weight: 600; min-width: 0; }

/* ── Market strip ─────────────────────────────────────────────── */
.strip { background: var(--bg-1); border-bottom: 1px solid var(--line); }
.strip-cell { padding: 8px 14px; gap: 2px; border-right: 1px solid var(--line); }
.strip-cell .lbl {
  font-family: var(--font-ui); font-size: 11px; font-weight: 500;
  letter-spacing: 0.02em; text-transform: none; color: var(--dim);
}
.strip-cell .val { font-size: 15px; font-weight: 650; }
.strip-cell .delta { font-size: 12px; font-weight: 600; }
.strip-cell.movers span { font-size: 13px; font-weight: 600; }
.strip-cell.fx { gap: 14px; font-size: 13px; scrollbar-width: none; }
.strip-cell.fx::-webkit-scrollbar { display: none; }
.strip-cell.fx .up, .strip-cell.fx .down { font-size: 11px; }
.attribution { font-family: var(--font-ui); font-size: 11px; opacity: 1; color: var(--dim); padding: 4px 16px 0 0; letter-spacing: 0; }

/* ── Panels ───────────────────────────────────────────────────── */
.grid { background: var(--line); }
.panel { background: var(--bg-1); }
.right-col { background: var(--bg); }
.right-col > .panel { border-bottom: 1px solid var(--line); }
.panel-head {
  padding: 10px 14px; background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  gap: 10px; flex-wrap: wrap;
}
.panel-head h2 {
  font-family: var(--font-ui); font-size: 12px; font-weight: 650;
  letter-spacing: 0.04em; color: var(--text-2);
}
.panel-tools input, .panel-tools select {
  height: 34px; border-radius: var(--r-md); background: var(--bg-2);
  border: 1px solid var(--line-2); padding: 0 10px; font-family: var(--font-ui);
}
.panel-tools input::placeholder { color: var(--dim); }

.chip {
  font-family: var(--font-ui); font-size: 12px; font-weight: 500;
  border-radius: 999px; padding: 5px 11px; color: var(--text-2);
  border-color: var(--line-2); background: transparent;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--dim); background: var(--hover); }
.chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 650; }

/* ── Stock table ──────────────────────────────────────────────── */
thead th {
  background: var(--bg-1); color: var(--dim);
  font-family: var(--font-ui); font-size: 11px; font-weight: 600;
  letter-spacing: 0.03em; padding: 8px 10px; border-bottom: 1px solid var(--line);
}
tbody tr { border-bottom: 1px solid var(--line); transition: background .12s var(--ease); }
tbody tr:hover { background: var(--hover); }
tbody tr.selected { background: var(--accent-soft) !important; }
tbody tr.watch { background: transparent; }
tbody td { padding: 8px 10px; font-size: 13px; }
tbody td.col-ticker { color: var(--text); font-family: var(--font-num); font-weight: 650; }
tbody td.col-name { color: var(--text-2); }
tbody td.col-name .isin { font-size: 11px; color: var(--dim); }
tbody td.col-last { color: var(--text); font-weight: 600; }
.row-up td.col-pct, .row-up td.col-change { color: var(--up); }
.row-down td.col-pct, .row-down td.col-change { color: var(--down); }
tbody td .star { color: var(--dim); margin-right: 6px; cursor: pointer; }
tbody td .star-on { color: var(--accent); }
.tag-halal { background: var(--accent-soft); color: var(--accent); font-family: var(--font-ui); font-size: 10px; font-weight: 600; border-radius: 4px; }
.tag-unknown { display: none; }      /* "❓" on every row was noise */
tbody td.col-ticker .tag-bond { background: oklch(0.74 0.09 285 / 0.15); color: var(--bond); font-family: var(--font-ui); border-radius: 4px; }
tbody td.col-ticker .tag-flat { font-family: var(--font-ui); border-radius: 4px; }

/* ── Dividend calendar: readable sizes (was 8–10px) ───────────── */
.div-table th { font-family: var(--font-ui); font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: none; padding: 7px 10px; }
.div-table td { font-size: 12px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.div-table .tkr { font-family: var(--font-num); }

/* desktop: fit all 11 columns without sideways scrolling */
@media (min-width: 601px) {
  #grid thead th, #grid tbody td { padding-left: 8px; padding-right: 8px; }
  #grid tbody td { font-size: 12.5px; }
  #grid tbody td.col-name { max-width: 170px; white-space: nowrap; }
}
/* columns drop in order of importance; all of them are in the quote view */
@media (min-width: 601px) and (max-width: 1899px) {
  #grid tbody td.col-name .isin { display: none; }
  #grid thead th:nth-child(9), #grid tbody td:nth-child(9) { display: none; }      /* share count */
}
@media (min-width: 601px) and (max-width: 1700px) {
  #grid thead th:nth-child(6), #grid tbody td:nth-child(6),                         /* open */
  #grid thead th:nth-child(11), #grid tbody td:nth-child(11) { display: none; }    /* time */
}
/* tablet: table on top, side panels below (old grid rule collapsed the table to 0px) */
@media (min-width: 601px) and (max-width: 1100px) {
  .grid { display: flex; flex-direction: column; height: auto; }
  .tape-panel { height: 72vh; min-height: 420px; }
  .right-col { overflow: visible; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
  .right-col > .panel { border-bottom: 0; }
  .right-col > .news-panel, .right-col > .heatmap-panel { grid-column: 1 / -1; max-height: 70vh; }
  .brand { flex: none; }
  #cmdBtn { min-width: 0; flex: 1; max-width: 320px; }
}
@media (min-width: 601px) and (max-width: 1280px) {   /* high, low */
  #grid thead th:nth-child(7), #grid tbody td:nth-child(7),
  #grid thead th:nth-child(8), #grid tbody td:nth-child(8) { display: none; }
}
.topbar #profileBtn svg, .topbar #faqBtn svg { width: 18px; height: 18px; display: block; margin: auto; }

/* ── Overlays & modals ────────────────────────────────────────── */
.overlay { background: oklch(0.1 0.01 258 / 0.62); backdrop-filter: blur(3px); }
.modal, .cmd { background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.cmd input { background: var(--bg-1); font-family: var(--font-ui); }
#cmdResults .res:hover, #cmdResults .res.active { background: var(--accent-soft); }
.cmd-hint { background: var(--bg-2); font-family: var(--font-ui); font-size: 12px; }

/* light theme: a few hard-coded dark colours in style.css */
:root[data-theme="light"] body { background: var(--bg); }
:root[data-theme="light"] .topbar { background: var(--bg-1); }
:root[data-theme="light"] .hm-cell .hm-label,
:root[data-theme="light"] .heatmap-grid .hm-label { color: var(--text); }
:root[data-theme="light"] .tape { background: var(--bg-1); color: var(--text-2); }
:root[data-theme="light"] #chatToggleBtn { box-shadow: var(--shadow) !important; }

/* ── Phone tab bar + More sheet (built by ui.js) ──────────────── */
.m-tabbar, .m-sheet, .m-sheet-backdrop { display: none; }

@media (max-width: 600px) {
  html, body { font-size: 14px; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }

  /* header: brand + live status on one row, search below */
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .brand { flex: 1; }
  .title, .market-session { display: none; }   /* the logo already says XISOB */
  .topbar-right { flex: 1 0 100%; width: 100%; order: 3; justify-content: stretch; gap: 8px; }
  #cmdBtn { flex: 1; min-width: 0; height: 40px; }
  #cmdBtn kbd { display: none; }
  .topbar-right > a.cmd-btn, .lang-select, #themeBtn,
  .topbar #profileBtn, .topbar #faqBtn { display: none !important; }
  .status { position: absolute; top: 10px; right: 12px; }
  .pill { padding: 5px 9px; }
  .clock { font-size: 12px; color: var(--text-2); }

  /* strip: index first and large, FX scrolls sideways inside its own row */
  .strip { grid-template-columns: 1fr 1fr; }
  .strip-cell { padding: 8px 12px; border-bottom: 1px solid var(--line); }
  .strip-cell:first-child { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: space-between; }
  .strip-cell:first-child .val { font-size: 20px; }
  .strip-cell:first-child .delta { font-size: 13px; }
  .strip-cell .val { font-size: 14px; }
  .strip-cell .lbl { font-size: 11px; }
  .strip-cell.movers { flex-direction: row; align-items: center; gap: 14px; }
  .strip-cell.fx { grid-column: 1 / -1; overflow-x: auto; gap: 16px; }
  .attribution { display: none; }

  /* one scroll: panels grow with content, no nested scroll boxes */
  .grid { display: block; height: auto; background: var(--bg); }
  .tape-panel, .right-col > .panel, .news-panel { max-height: none !important; height: auto; overflow: visible; }
  .table-wrap, .watchlist, #watchlistPanel, #heatmapPanel, #alertsPanel, #dividendTable { max-height: none !important; overflow: visible !important; }
  .right-col { overflow: visible; }
  .stocks-panel { display: none !important; }   /* duplicate of the main list */

  /* stock list as two-line rows: ticker + price / name + change */
  #grid thead { display: none; }
  #grid, #grid tbody { display: block; width: 100%; }
  #grid tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "tk last" "nm pct";
    column-gap: 12px; row-gap: 2px;
    padding: 10px 14px; min-height: 56px; align-items: baseline;
  }
  #grid tbody td { padding: 0; border: 0; display: block; }
  #grid tbody td:nth-child(1) { grid-area: tk; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #grid tbody td:nth-child(2) { grid-area: nm; font-size: 12px; max-width: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #grid tbody td:nth-child(2) .isin { display: none; }
  #grid tbody td:nth-child(3) { grid-area: last; font-size: 15px; text-align: right; }
  #grid tbody td:nth-child(5) {
    grid-area: pct; justify-self: end; font-size: 12px; font-weight: 650;
    padding: 2px 8px; border-radius: 6px; background: var(--bg-2);
  }
  #grid tbody tr.row-up td:nth-child(5) { background: var(--up-bg); }
  #grid tbody tr.row-down td:nth-child(5) { background: var(--down-bg); }
  #grid tbody td:nth-child(4),
  #grid tbody td:nth-child(n+6) { display: none; }
  .tape-panel .panel-head { position: sticky; top: 0; z-index: 2; }
  .tape-panel .panel-tools { width: 100%; }
  .tape-panel .panel-tools input { width: 100% !important; height: 40px; font-size: 16px; }
  .tape-panel .panel-tools { flex-wrap: wrap; min-width: 0; }
  .tape-panel .filter-group { flex-wrap: nowrap !important; overflow-x: auto; max-width: 100%; width: 100%; scrollbar-width: none; gap: 6px; padding-bottom: 2px; }
  .filter-group::-webkit-scrollbar { display: none; }
  .chip { flex: none; min-height: 34px; }

  /* tabs: body[data-mtab] decides which sections show */
  body[data-mtab] .tape-panel, body[data-mtab] .right-col > section, body[data-mtab] .tape { display: none !important; }
  body[data-mtab] .strip { display: none; }
  body[data-mtab="market"] .strip { display: grid; }
  body[data-mtab="market"] .tape-panel { display: flex !important; }
  body[data-mtab="watch"] .right-col > .watchlist-panel,
  body[data-mtab="watch"] .right-col > .alerts-panel,
  body[data-mtab="global"] .right-col > .uznif-panel,
  body[data-mtab="global"] .right-col > .global-panel,
  body[data-mtab="global"] .right-col > .heatmap-panel,
  body[data-mtab="news"] .right-col > .news-panel,
  body[data-mtab="news"] .right-col > #dividendPanel,
  body[data-mtab="news"] .right-col > .events-panel { display: flex !important; }
  .right-col { display: flex; flex-direction: column; }
  body[data-mtab="news"] .right-col > .news-panel { order: -1; }
  body[data-mtab="news"] .right-col > #dividendPanel { order: 2; }
  body[data-mtab="news"] .right-col > .events-panel { order: -2; }   /* events first, then news, then dividends */
  body[data-mtab="global"] .right-col > .heatmap-panel { order: 5; }

  /* dividend table: ticker, company, amount, yield on phones */
  .div-table th:nth-child(n+5), .div-table td:nth-child(n+5) { display: none; }
  .div-table td:nth-child(2) { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #dividendPanel { max-height: none !important; }

  /* floating buttons live in the tab bar / More sheet on phones */
  #chatToggleBtn, #profileBtn, #faqBtn { display: none !important; }

  .m-tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-tabbar);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg-1); border-top: 1px solid var(--line);
  }
  .m-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    background: none; border: 0; color: var(--dim); font: 500 11px/1.1 var(--font-ui);
    min-height: 44px; cursor: pointer; position: relative;
    transition: color .15s var(--ease);
  }
  .m-tab svg { width: 22px; height: 22px; }
  .m-tab[aria-selected="true"] { color: var(--accent); }
  .m-tab[aria-selected="true"]::before {
    content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 2px;
    border-radius: 0 0 2px 2px; background: var(--accent);
  }

  .m-sheet-backdrop { position: fixed; inset: 0; z-index: var(--z-sheet); background: oklch(0.1 0.01 258 / 0.5); }
  .m-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: calc(var(--z-sheet) + 1);
    background: var(--bg-1); border-top: 1px solid var(--line-2);
    border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow);
    padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(0); transition: transform .22s var(--ease);
  }
  .m-sheet-backdrop.open, .m-sheet.open { display: block; }
  .m-sheet .grabber { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 4px auto 10px; }
  .m-sheet button, .m-sheet a, .m-sheet label {
    display: flex; align-items: center; gap: 12px; width: 100%;
    min-height: 48px; padding: 0 8px; background: none; border: 0; border-radius: var(--r-md);
    color: var(--text); font: 500 15px var(--font-ui); text-decoration: none; cursor: pointer;
  }
  .m-sheet button:active, .m-sheet a:active { background: var(--hover); }
  .m-sheet svg { width: 20px; height: 20px; color: var(--dim); flex: none; }
  .m-sheet select { margin-left: auto; height: 36px; border-radius: var(--r-md); background: var(--bg-2); color: var(--text); border: 1px solid var(--line-2); padding: 0 8px; font: 500 14px var(--font-ui); }

  /* panels on phones */
  .nf-grid { gap: 8px; }
  .nf-value { font-size: 17px; }
  .rel-lists { grid-template-columns: 1fr; }
  .modal { border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ── COMP: comparison / index chart (compare.js) ──────────────── */
#compareOverlay { z-index: 215; }
.cmp-modal { width: min(860px, 96vw); }
.cmp-title { margin: 0 40px 12px 0; font-size: 18px; font-weight: 650; }
.cmp-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.cmp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 4px 0 10px; border: 1px solid var(--line-2); border-radius: 999px; font: 600 13px var(--font-num); }
.cmp-chip i, .cmp-row i, .cmp-tip i { width: 10px; height: 3px; border-radius: 2px; background: currentColor; display: inline-block; flex: none; }
.cmp-chip button { width: 24px; height: 24px; border: 0; border-radius: 50%; background: none; color: var(--dim); cursor: pointer; font-size: 16px; line-height: 1; }
.cmp-chip button:hover { background: var(--hover); color: var(--text); }
.cmp-add { display: flex; gap: 6px; }
.cmp-add input { height: 34px; width: 150px; padding: 0 10px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font: 500 13px var(--font-ui); text-transform: uppercase; }
.cmp-add input::placeholder { text-transform: none; color: var(--dim); }
.cmp-add button { width: 34px; height: 34px; border-radius: var(--r-md); border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); font-size: 18px; cursor: pointer; }
.cmp-ranges { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.cmp-chart { position: relative; min-height: 230px; transition: opacity .15s var(--ease); }
.cmp-chart.loading { opacity: .45; }
.cmp-svg { display: block; touch-action: pan-y; }
.cmp-grid { stroke: var(--line); stroke-width: 1; }
.cmp-grid.base { stroke: var(--line-2); stroke-dasharray: 4 3; }
.cmp-axis { fill: var(--dim); font: 11px var(--font-num); }
.cmp-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cmp-line.idx { stroke: var(--text-2); stroke-width: 1.6; stroke-dasharray: 5 3; }
.cmp-cross { stroke: var(--dim); stroke-width: 1; }
.cmp-tip { position: absolute; top: 8px; min-width: 150px; padding: 8px 10px; border-radius: var(--r-md); background: var(--bg-1); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 12px; pointer-events: none; }
.cmp-tip b { display: block; margin-bottom: 4px; font-weight: 600; }
.cmp-tip div { display: flex; align-items: center; gap: 6px; font-family: var(--font-num); }
.cmp-tip span { margin-left: auto; padding-left: 10px; }
.cmp-legend { margin-top: 8px; }
.cmp-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 76px; gap: 10px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.cmp-row .mono { text-align: right; }
.cmp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-name a { font-family: var(--font-num); font-weight: 650; cursor: pointer; }
.cmp-note { margin: 10px 0 0; font-size: 11px; color: var(--dim); }
.cmp-empty { display: grid; place-items: center; height: 230px; color: var(--dim); }
/* series colours: distinct in both themes; legend + tooltip label every line, so colour is never the only cue */
.idx { color: var(--text-2); }
.c1 { color: var(--accent); }      .cmp-line.c1 { stroke: var(--accent); }
.c2 { color: oklch(0.74 0.15 70); } .cmp-line.c2 { stroke: oklch(0.74 0.15 70); }
.c3 { color: oklch(0.68 0.16 300); } .cmp-line.c3 { stroke: oklch(0.68 0.16 300); }
.c4 { color: oklch(0.72 0.12 190); } .cmp-line.c4 { stroke: oklch(0.72 0.12 190); }
.c5 { color: oklch(0.68 0.17 25); }  .cmp-line.c5 { stroke: oklch(0.68 0.17 25); }
:root[data-theme="light"] .c2 { color: oklch(0.58 0.14 65); } :root[data-theme="light"] .cmp-line.c2 { stroke: oklch(0.58 0.14 65); }
.strip-link { cursor: pointer; transition: background .15s var(--ease); }
.strip-link:hover { background: var(--hover); }
@media (max-width: 600px) {
  .cmp-modal { width: 100vw; }
  .cmp-add { flex: 1; } .cmp-add input { flex: 1; width: auto; font-size: 16px; height: 40px; } .cmp-add button { height: 40px; width: 40px; }
  .cmp-row { grid-template-columns: 12px minmax(0, 1fr) auto 70px; }
}

/* ── FA: company financials (fa.js) ───────────────────────────── */
#faOverlay { z-index: 216; }
.fa-modal { width: min(860px, 96vw); }
.fa-meta { margin: -6px 0 12px; color: var(--text-2); font-size: 13px; }
.fa-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.fa-tile { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; }
.fa-label { font-size: 11px; color: var(--dim); font-weight: 500; }
.fa-value { font: 650 17px var(--font-num); margin-top: 2px; }
.fa-sub { font-size: 11px; color: var(--dim); margin-top: 1px; }
.fa-est { font: 500 10px var(--font-ui); color: var(--warn); margin-left: 5px; vertical-align: 2px; }
.fa-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.fa-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.fa-legend i.rev, .fa-bar.rev { background: oklch(0.70 0.03 258); }
.fa-legend i.np, .fa-bar.np { background: var(--accent); }
.fa-bar.np.neg { background: var(--down); }
.fa-bars { display: flex; align-items: stretch; height: 150px; padding-top: 6px; border-bottom: 1px solid var(--line); }
.fa-bar-col { display: flex; flex-direction: column; align-items: center; }
.fa-bar-pair { flex: 1; display: flex; align-items: flex-end; gap: 4px; width: 60%; max-width: 64px; }
.fa-bar { flex: 1; border-radius: 3px 3px 0 0; min-height: 1px; transition: height .25s var(--ease); }
.fa-bar-year { font: 11px var(--font-num); color: var(--dim); padding: 4px 0; }
.fa-table-wrap { overflow-x: auto; margin-top: 12px; }
.fa-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fa-table th, .fa-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.fa-table thead th { font: 600 11px var(--font-ui); color: var(--dim); text-align: left; background: none; position: static; }
.fa-table thead th.num { text-align: right; }
.fa-table tbody th { text-align: left; font-weight: 500; color: var(--text-2); }
.fa-table td.num { text-align: right; font-family: var(--font-num); }
@media (max-width: 600px) {
  .fa-modal { width: 100vw; }
  .fa-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fa-bars { height: 120px; }
  .fa-table th:first-child { position: sticky; left: 0; background: var(--bg-1); }
}

/* ── EVTS: corporate events (events.js) ───────────────────────── */
.events-panel { max-height: none; flex-shrink: 0; }
.ev-sub { font-size: 11px; font-weight: 600; color: var(--dim); margin: 2px 0 6px; }
.ev-up { margin-bottom: 10px; }
.ev-up-item { display: grid; grid-template-columns: 64px auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 7px 8px; margin-bottom: 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-2); color: var(--text); text-decoration: none; }
.ev-up-item:hover { border-color: var(--accent); text-decoration: none; }
.ev-date { display: flex; flex-direction: column; font: 11px var(--font-num); color: var(--dim); line-height: 1.25; }
.ev-date b { font: 650 13px var(--font-ui); color: var(--text); }
.ev-name { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-tk { font: 650 12px var(--font-num); color: var(--accent); cursor: pointer; }
.ev-filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
.ev-filters .chip { flex: none; }
.ev-list { list-style: none; margin: 0; padding: 0; }
.ev-item { display: grid; grid-template-columns: 8px 46px 58px minmax(0, 1fr); gap: 8px; align-items: center; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.ev-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.ev-dividend .ev-dot { background: var(--up); }
.ev-ownership .ev-dot { background: oklch(0.68 0.16 300); }
.ev-meeting .ev-dot { background: oklch(0.74 0.15 70); }
.ev-corporate .ev-dot { background: var(--accent); }
.ev-day { font: 12px var(--font-num); color: var(--dim); }
.ev-text { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-text:hover { color: var(--accent); text-decoration: none; }
.ev-ext { color: var(--dim); margin-left: 4px; font-size: 11px; }
.ev-more { width: 100%; height: 36px; margin-top: 8px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: none; color: var(--text-2); font: 500 13px var(--font-ui); cursor: pointer; }
.ev-more:hover { border-color: var(--accent); color: var(--accent); }
.ev-empty { padding: 14px 4px; }
@media (max-width: 600px) { .ev-item { min-height: 44px; } .ev-up-item { min-height: 48px; } }

/* ── Brand mark + Telegram link ───────────────────────────────── */
.logo { display: inline-flex; align-items: center; gap: 7px; background: none; color: var(--text); padding: 0; font-size: 14px; letter-spacing: 0.04em; }
.logo-mark { width: 26px; height: 26px; border-radius: 7px; display: block; }
#tgBtn { color: var(--text); text-decoration: none; }
#tgBtn:hover { color: oklch(0.70 0.13 235); }
.attribution a { color: var(--dim); text-decoration: underline; text-underline-offset: 2px; }
.attribution a:hover { color: var(--accent); }
@media (max-width: 600px) { #tgBtn { display: none !important; } }

/* old green leftovers in style.css / inline styles */
.chat-msg.mine { background: var(--accent-soft) !important; }
#chatToggleBtn { box-shadow: 0 2px 14px rgba(77, 139, 254, 0.35) !important; }
