/* Мой кабинет — тикеры и графики. Everything is prefixed with .grn- to stay out of the theme's way. */

:root {
  --grn-accent: #f2a93b;
  --grn-accent-ink: #0d1117;
  --grn-up: #1f9d55;
  --grn-down: #d9480f;
  --grn-line: rgba(127, 127, 127, 0.28);
  --grn-soft: rgba(127, 127, 127, 0.09);
}

/* ---------------------------------------------------------- ticker in text */
.grn-tk {
  display: inline;
  cursor: pointer;
  border-bottom: 1.5px dashed var(--grn-accent);
  border-radius: 2px;
  padding: 0 1px;
  transition: background-color .15s;
  white-space: normal;
}
.grn-tk:hover, .grn-tk:focus-visible { background: rgba(242, 169, 59, 0.16); outline: none; }
.grn-tk__badge {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--grn-soft);
  font-size: .78em;
  font-weight: 600;
  line-height: 1.6;
  vertical-align: .08em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.grn-tk__sym:empty, .grn-tk__chg:empty { display: none; }
.grn-tk__badge:has(.grn-tk__sym:empty):has(.grn-tk__chg:empty) { display: none; }
.grn-tk[data-tone="up"] .grn-tk__chg, [data-tone="up"] > .grn-row__chg, .grn-modal__chg[data-tone="up"] { color: var(--grn-up); }
.grn-tk[data-tone="down"] .grn-tk__chg, [data-tone="down"] > .grn-row__chg, .grn-modal__chg[data-tone="down"] { color: var(--grn-down); }

/* ------------------------------------------------- block "в статье" */
.grn-box {
  margin: 1.8em 0;
  padding: 16px 18px;
  border: 1px solid var(--grn-line);
  border-left: 4px solid var(--grn-accent);
  border-radius: 10px;
  background: var(--grn-soft);
  font-size: 15px;
  line-height: 1.4;
}
.grn-box__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.grn-box__title { font-weight: 700; font-size: 16px; }
.grn-box__cab { font-size: 13px; font-weight: 600; color: inherit; opacity: .75; text-decoration: none; }
.grn-box__cab:hover { opacity: 1; text-decoration: underline; }
.grn-box__list { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.grn-row { display: flex; align-items: center; gap: 10px; margin: 0 !important; padding: 0 !important; list-style: none !important; }
.grn-row + .grn-row { border-top: 1px solid var(--grn-line); }
.grn-row::before, .grn-row::marker { content: none !important; }
.grn-row__main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; margin: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.grn-row__main:hover .grn-row__chart { text-decoration: underline; }
.grn-row__id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.grn-row__sym { font-weight: 700; }
.grn-row__name { font-size: 12px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grn-row__px { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; min-width: 84px; }
.grn-row__price { font-weight: 600; }
.grn-row__chg { font-size: 12px; font-weight: 600; }
.grn-row__chart { font-size: 13px; font-weight: 600; color: var(--grn-accent); white-space: nowrap; }

/* ------------------------------------------------------- buttons */
.grn-fav, .grn-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; margin: 0;
  border-radius: 8px; border: 1px solid var(--grn-accent);
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap;
  text-decoration: none !important; cursor: pointer;
}
.grn-fav { background: var(--grn-accent); color: var(--grn-accent-ink); }
.grn-fav:hover { filter: brightness(1.06); }
.grn-fav.is-on { background: transparent; color: var(--grn-accent); }
.grn-fav--sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.grn-fav__star { font-size: 1.05em; }
.grn-btn--ghost { background: transparent; color: inherit; border-color: var(--grn-line); }
.grn-btn--ghost:hover { border-color: var(--grn-accent); }
.grn-btn--link { background: transparent; border-color: transparent; color: inherit; opacity: .8; }
.grn-btn--link:hover { opacity: 1; text-decoration: underline !important; }

/* "Мой кабинет" */
.grn-cab-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 8px;
  background: var(--grn-accent); color: var(--grn-accent-ink) !important;
  font-weight: 700; font-size: 14px; line-height: 1.2; text-decoration: none !important; white-space: nowrap;
}
.grn-cab-btn:hover { filter: brightness(1.06); color: var(--grn-accent-ink) !important; }
.grn-cab-btn__icon { font-size: 1.05em; }
.grn-cab-menu-item { display: flex; align-items: center; }
.grn-cab-btn--menu { margin: 0 0 0 8px; }
.grn-cab-btn--float {
  position: fixed; right: 18px; bottom: 18px; z-index: 99990;
  padding: 11px 16px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
}
@media (max-width: 640px) {
  .grn-cab-btn--float { right: 12px; bottom: 12px; padding: 10px 14px; font-size: 13px; }
  .grn-row__chart { display: none; }
  .grn-box { padding: 12px 14px; }
}

/* ---------------------------------------------------------- modal */
html.grn-lock, html.grn-lock body { overflow: hidden !important; }
.grn-modal[hidden] { display: none !important; }
.grn-modal {
  position: fixed; inset: 0; z-index: 2147483000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(5, 8, 12, .62);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 15px; line-height: 1.4;
}
.grn-modal__box {
  width: min(1320px, 100%); height: min(860px, 100%);
  display: flex; flex-direction: column;
  border-radius: 14px; overflow: hidden; box-shadow: 0 24px 64px rgba(0, 0, 0, .45);
}
.grn-modal--dark .grn-modal__box { background: #131722; color: #e6edf3; --grn-line: rgba(255, 255, 255, .12); }
.grn-modal--light .grn-modal__box { background: #fff; color: #131722; --grn-line: rgba(0, 0, 0, .1); }
.grn-modal__head { display: flex; align-items: center; gap: 16px; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--grn-line); }
.grn-modal__id { flex: 1; min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.grn-modal__title { font-size: 20px; font-weight: 700; }
.grn-modal__sym { font-weight: 600; opacity: .7; }
.grn-modal__cls { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--grn-soft); }
.grn-modal__px { display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; }
.grn-modal__price { font-size: 20px; font-weight: 700; }
.grn-modal__chg { font-size: 14px; font-weight: 600; }
.grn-modal__close {
  width: 38px; height: 38px; flex: none; margin: 0; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: inherit; font-size: 26px; line-height: 1; cursor: pointer;
}
.grn-modal__close:hover { background: var(--grn-soft); }
.grn-modal__chart { flex: 1; min-height: 0; }
.grn-modal__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--grn-line); }

@media (max-width: 640px) {
  .grn-modal { padding: 0; align-items: stretch; }
  .grn-modal__box { width: 100%; height: 100%; border-radius: 0; }
  .grn-modal__head { flex-wrap: wrap; padding: 10px 10px 10px 14px; gap: 6px 10px; }
  .grn-modal__id { order: 1; flex-basis: calc(100% - 48px); }
  .grn-modal__close { order: 2; }
  .grn-modal__px { order: 3; flex-basis: 100%; }
  .grn-modal__title, .grn-modal__price { font-size: 18px; }
  .grn-modal__foot { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .grn-modal__foot .grn-fav { flex: 1 1 100%; min-height: 44px; }
  .grn-modal__foot .grn-btn { flex: 1 1 0; }
}

/* ---------------------------------------------- movers tables [grn_movers] */
/* Adaptive by the block's own width (container query): the same table fits a sidebar, a half-width panel and a phone. */
.grn-mv { margin: 0 0 1.5em; font-family: var(--grn-font, var(--f-ui, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif)); line-height: 1.35; font-variant-numeric: tabular-nums; container-type: inline-size; container-name: grnmv; min-width: 0; max-width: 100%; }
.grn-mv__title { margin: 0 0 10px; }
.grn-mv__sub { margin: 0 0 8px; font-size: 1.05em; }
.grn-mv__tabs { display: flex; gap: 6px; margin: 0 0 10px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.grn-mv__tabs::-webkit-scrollbar { display: none; }
.grn-mv__tab {
  flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--grn-line);
  background: transparent; color: inherit; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.grn-mv__tab:hover { border-color: var(--grn-accent); }
.grn-mv__tab.is-on { background: var(--grn-accent); border-color: var(--grn-accent); color: var(--grn-accent-ink); }
.grn-mv--columns .grn-mv__panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 18px; }
.grn-mv__panel { min-width: 0; }
.grn-mv__panel[hidden], .grn-mv__row[hidden], .grn-mv__none[hidden] { display: none !important; }

/* filter */
.grn-mv__filters { margin: 0 0 10px; border: 1px solid var(--grn-line); border-radius: 10px; }
.grn-mv__fbtn { display: flex; align-items: center; gap: 4px; padding: 8px 12px; cursor: pointer; font-size: 14px; font-weight: 600; list-style: none; }
.grn-mv__fbtn::-webkit-details-marker { display: none; }
.grn-mv__fbtn::after { content: '▾'; margin-left: auto; opacity: .6; transition: transform .15s; }
.grn-mv__filters[open] .grn-mv__fbtn::after { transform: rotate(180deg); }
.grn-mv__fsum { font-weight: 400; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grn-mv__fbody { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; font-size: 13px; }
.grn-mv__frow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.grn-mv__flabel { font-weight: 600; opacity: .8; }
.grn-mv__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.grn-mv__chip {
  min-height: 32px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--grn-line);
  background: transparent; color: inherit; font: inherit; font-size: 13px; cursor: pointer;
}
.grn-mv__chip.is-on { border-color: var(--grn-accent); color: var(--grn-accent); font-weight: 600; }
.grn-mv__range { display: inline-flex; gap: 8px; }
.grn-mv__range label, .grn-mv__fsel, .grn-mv__fchk { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; white-space: nowrap; }
.grn-mv__range input, .grn-mv__fsel select {
  min-height: 32px; margin: 0; padding: 0 8px; border-radius: 8px; border: 1px solid var(--grn-line);
  background: transparent; color: inherit; font: inherit; font-size: 13px;
}
.grn-mv__range input { width: 70px; }
.grn-mv__fsel select option { color: #111; }
.grn-mv__reset { margin-left: auto; padding: 0; border: 0; background: none; color: var(--grn-accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.grn-mv__none { margin: 10px 0; opacity: .75; font-size: 14px; }

/* table */
.grn-mv__table { width: 100%; border-collapse: collapse; margin: 0; font-size: 14px; border: 0; table-layout: auto; }
.grn-mv__table th, .grn-mv__table td { padding: 8px 6px; border: 0; border-bottom: 1px solid var(--grn-line); text-align: left; vertical-align: middle; background: none; }
.grn-mv__table th { font-size: 12px; font-weight: 600; opacity: .7; text-transform: none; white-space: nowrap; }
.grn-mv__table .grn-mv__r { text-align: right; white-space: nowrap; }
.grn-mv__n { width: 28px; opacity: .55; }
.grn-mv__a { width: 40px; text-align: right !important; }
.grn-mv__row { cursor: pointer; transition: background .12s; }
.grn-mv__row:hover, .grn-mv__row:focus-visible { background: var(--grn-soft); outline: none; }
.grn-mv__co { min-width: 0; max-width: 0; width: 100%; }
.grn-mv__sym { display: block; font-weight: 700; }
.grn-mv__name { display: block; font-size: 12px; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grn-mv__px { font-weight: 600; }
.grn-mv__pct { font-weight: 700; }
.grn-mv__pct[data-tone="up"] { color: var(--grn-up); }
.grn-mv__pct[data-tone="down"] { color: var(--grn-down); }
.grn-mv__add {
  width: 34px; height: 34px; margin: 0; padding: 0; border-radius: 8px; border: 1px solid var(--grn-line);
  background: transparent; color: var(--grn-accent); font-size: 16px; line-height: 1; cursor: pointer;
}
.grn-mv__add:hover { border-color: var(--grn-accent); }
.grn-mv__add.is-on { background: var(--grn-accent); border-color: var(--grn-accent); color: var(--grn-accent-ink); }
.grn-mv__foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin-top: 8px; font-size: 12px; opacity: .8; }
.grn-mv__more { font-weight: 600; color: var(--grn-accent); }
.grn-mv__empty { opacity: .7; font-size: 14px; }

/* Narrow block (phone, sidebar, half-width panel): each row becomes a two-line card —
   ticker and company on the left, price over change on the right, ★ at the edge. */
@container grnmv (max-width: 520px) {
  .grn-mv__table thead { display: none; }
  .grn-mv__table, .grn-mv__table tbody { display: block; }
  .grn-mv__row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto 40px; grid-template-areas: "co px add" "co pct add";
    align-items: center; column-gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--grn-line);
  }
  .grn-mv .grn-mv__table .grn-mv__row td { display: block; padding: 0; border: 0; width: auto; max-width: none; }
  .grn-mv .grn-mv__table .grn-mv__row .grn-mv__n, .grn-mv .grn-mv__table .grn-mv__row .grn-mv__vol { display: none; }
  .grn-mv__row .grn-mv__co { grid-area: co; }
  .grn-mv__row .grn-mv__px { grid-area: px; font-size: 14px; }
  .grn-mv__row .grn-mv__pct { grid-area: pct; font-size: 13px; }
  .grn-mv__row .grn-mv__a { grid-area: add; }
  .grn-mv__range { width: 100%; }
  .grn-mv__range label { flex: 1; }
  .grn-mv__range input { width: 100%; }
  .grn-mv__reset { margin-left: 0; }
}
/* Very old browsers without container queries: the same by screen width. */
@supports not (container-type: inline-size) {
  @media (max-width: 640px) {
    .grn-mv__table thead { display: none; }
    .grn-mv__table, .grn-mv__table tbody { display: block; }
    .grn-mv__row { display: grid; grid-template-columns: minmax(0, 1fr) auto 40px; grid-template-areas: "co px add" "co pct add"; align-items: center; column-gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--grn-line); }
    .grn-mv__row td { display: block; padding: 0; border: 0; width: auto; max-width: none; }
    .grn-mv__row .grn-mv__n, .grn-mv__row .grn-mv__vol { display: none; }
    .grn-mv__row .grn-mv__co { grid-area: co; }
    .grn-mv__row .grn-mv__px { grid-area: px; }
    .grn-mv__row .grn-mv__pct { grid-area: pct; }
    .grn-mv__row .grn-mv__a { grid-area: add; }
  }
}
