/* =====================================================
   РЫНКИ — шапка раздела «Экономика» (js/markets.js)
   Тёмная витрина в духе биржевого терминала: плитки курсов и индексов,
   вкладки с таблицами и карточками котировок, карточка бумаги с графиком.
   ===================================================== */

.mk-hero,
.mk-quote {
    --mk-bg: #05090f;
    --mk-panel: #070c14;
    --mk-surface: rgba(255, 255, 255, 0.028);
    --mk-surface-2: rgba(255, 255, 255, 0.06);
    --mk-ink: #e9eff7;
    --mk-muted: #93a3b8;
    --mk-faint: #66788f;
    --mk-line: rgba(150, 180, 220, 0.14);
    --mk-line-strong: rgba(150, 180, 220, 0.28);
    --mk-up: #3ddc97;
    --mk-down: #ff6b5f;
    --mk-flat: #93a3b8;
    --mk-accent: #f4c35a;
    --mk-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
    --dir-color: var(--mk-flat);

    color: var(--mk-ink);
    font-family: "Inter", Arial, sans-serif;
    line-height: 1.4;
}

/* Цвет изменения: рост — зелёный, падение — красный */
.mk-hero [data-dir="up"],
.mk-quote [data-dir="up"] { --dir-color: var(--mk-up); }
.mk-hero [data-dir="down"],
.mk-quote [data-dir="down"] { --dir-color: var(--mk-down); }
.mk-hero [data-dir="flat"],
.mk-quote [data-dir="flat"] { --dir-color: var(--mk-flat); }

/* Общие кнопки сайта (style.css) — с отступами, анимацией и шириной 100% на телефоне; здесь не нужны.
   :where не добавляет специфичности, поэтому классы ниже перекрывают сброс */
:where(.mk-hero, .mk-quote) button {
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: inherit;
    box-shadow: none;
    transition: none;
    cursor: pointer;
}

.mk-hero [hidden],
.mk-quote [hidden],
.mk-quote[hidden] {
    display: none !important;
}

.mk-hero button:focus-visible,
.mk-hero input:focus-visible,
.mk-quote button:focus-visible {
    outline: 2px solid rgba(140, 195, 255, 0.85);
    outline-offset: 2px;
}

.mk-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.mk-dim {
    color: var(--mk-faint);
    font-weight: 400;
}

.mk-arrow {
    margin-right: 4px;
    font-size: 0.72em;
    vertical-align: 1px;
}

/* ---------- Фон ---------- */
.mk-hero {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(ellipse 55% 85% at 88% -15%, rgba(244, 195, 90, 0.1), transparent 62%),
        radial-gradient(ellipse 70% 90% at 8% 115%, rgba(40, 110, 200, 0.17), transparent 66%),
        var(--mk-bg);
}

/* Сетка «терминала», тает книзу */
.mk-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(150, 180, 220, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(150, 180, 220, 0.045) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%);
    mask-image: linear-gradient(180deg, #000, transparent 70%);
    pointer-events: none;
}

.mk-wrap {
    width: min(100% - 48px, 1280px);
    margin: 0 auto;
    padding: 30px 0 24px;
}

/* ---------- Заголовок и время обновления ---------- */
.mk-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.mk-kicker {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 10px;
    color: var(--mk-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.mk-kicker__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mk-accent);
    box-shadow: 0 0 10px rgba(244, 195, 90, 0.8);
}

.mk-title {
    margin: 0;
    color: #fff;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 60px;
    font-weight: 700;
    line-height: 0.98;
    letter-spacing: 0.01em;
}

.mk-lead {
    max-width: 380px;
    margin: 12px 0 0;
    color: #b6c3d4;
    font-size: 14px;
    line-height: 1.5;
}

.mk-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    padding: 9px 15px;
    border: 1px solid var(--mk-line);
    border-radius: 999px;
    background: rgba(7, 13, 23, 0.6);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--mk-muted);
    font-size: 12.5px;
}

.mk-status__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mk-up);
    animation: mk-beacon 2.4s ease-out infinite;
}

.mk-status[data-state="loading"] .mk-status__dot {
    background: var(--mk-faint);
    animation: mk-blink 1s ease-in-out infinite;
}

.mk-status[data-state="error"] .mk-status__dot {
    background: var(--mk-down);
    animation: none;
}

.mk-hero.is-updating .mk-status__dot {
    animation: mk-blink 0.9s ease-in-out infinite;
}

.mk-status__text {
    color: var(--mk-ink);
    font-weight: 600;
}

.mk-status__text time {
    font-variant-numeric: tabular-nums;
}

.mk-hero .mk-status__retry {
    color: var(--mk-accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

@keyframes mk-beacon {
    0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.6); }
    100% { box-shadow: 0 0 0 9px rgba(61, 220, 151, 0); }
}

@keyframes mk-blink {
    50% { opacity: 0.3; }
}

/* ---------- Плитки ---------- */
.mk-tiles {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.mk-hero .mk-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 136px;
    padding: 13px 14px 12px;
    border: 1px solid var(--mk-line);
    border-radius: 12px;
    background: var(--mk-surface);
    color: var(--mk-ink);
    text-align: left;
    transition: border-color 0.2s, background 0.2s;
}

.mk-hero button.mk-tile:hover {
    border-color: var(--mk-line-strong);
    background: var(--mk-surface-2);
}

.mk-tile__label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--mk-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.mk-tile__label em {
    overflow: hidden;
    color: var(--mk-faint);
    font-style: normal;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-transform: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mk-tile__value {
    margin-top: 8px;
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mk-tile__value small {
    margin-left: 3px;
    color: var(--mk-muted);
    font-size: 15px;
    font-weight: 600;
}

.mk-tile__change {
    margin-top: 2px;
    color: var(--dir-color);
    font-size: 12.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mk-tile__sub {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px dashed var(--mk-line);
    color: var(--mk-muted);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mk-tile__sub b {
    color: var(--mk-ink);
    font-weight: 600;
}

.mk-tile__sub i {
    color: var(--dir-color);
    font-style: normal;
}

.mk-tile .mk-spark {
    width: 100%;
    height: 34px;
    margin-top: auto;
    padding-top: 6px;
}

/* Заготовки, пока котировки грузятся */
.mk-tile.is-loading i {
    display: block;
    width: 60%;
    height: 10px;
    margin-bottom: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(150, 180, 220, 0.07), rgba(150, 180, 220, 0.18), rgba(150, 180, 220, 0.07));
    background-size: 200% 100%;
    animation: mk-shimmer 1.4s linear infinite;
}

.mk-tile.is-loading i:nth-child(2) { width: 82%; height: 20px; }
.mk-tile.is-loading i:nth-child(3) { width: 45%; }

@keyframes mk-shimmer {
    to { background-position: -200% 0; }
}

/* ---------- Мини-график ---------- */
.mk-spark {
    display: block;
    overflow: visible;
    color: var(--dir-color);
}

.mk-spark__line {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.mk-spark__base {
    stroke: rgba(150, 180, 220, 0.35);
    stroke-width: 1;
    stroke-dasharray: 2 3;
    vector-effect: non-scaling-stroke;
}

/* ---------- Вкладки ---------- */
.mk-tabs {
    display: flex;
    gap: 2px;
    margin: 0 0 16px;
    border-bottom: 1px solid var(--mk-line);
    overflow-x: auto;
    scrollbar-width: none;
}

.mk-tabs::-webkit-scrollbar {
    display: none;
}

.mk-hero .mk-tab {
    position: relative;
    flex-shrink: 0;
    padding: 11px 14px 12px;
    color: var(--mk-muted);
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    transition: color 0.2s;
}

.mk-hero .mk-tab:hover,
.mk-hero .mk-tab[aria-selected="true"] {
    color: var(--mk-ink);
}

.mk-tab[aria-selected="true"]::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--mk-accent);
}

/* ---------- Панели ---------- */
.mk-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mk-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.mk-box {
    min-width: 0;
    padding: 16px 18px 14px;
    border: 1px solid var(--mk-line);
    border-radius: 14px;
    background: var(--mk-surface);
}

.mk-box__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 10px;
}

.mk-box__title {
    margin: 0;
    color: var(--mk-ink);
    font-family: "Inter", Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    line-height: 1.4;
    text-transform: uppercase;
}

.mk-box__sub {
    margin: 18px 0 6px;
    color: var(--mk-faint);
    font-family: "Inter", Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.mk-box__hint {
    color: var(--mk-faint);
    font-size: 12px;
}

.mk-box__foot {
    margin: 12px 0 0;
    color: var(--mk-faint);
    font-size: 12px;
    line-height: 1.5;
}

.mk-stale {
    color: var(--mk-accent);
    font-size: 11.5px;
}

.mk-empty {
    margin: 4px 0;
    color: var(--mk-muted);
    font-size: 13.5px;
}

.mk-empty--box {
    padding: 22px 18px;
    border: 1px dashed var(--mk-line);
    border-radius: 14px;
}

/* ---------- Таблицы ---------- */
.mk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
}

.mk-table th,
.mk-table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--mk-line);
    font-weight: 400;
    text-align: left;
    white-space: nowrap;
}

.mk-table thead th {
    padding-top: 0;
    color: var(--mk-faint);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.mk-table tbody tr:last-child > * {
    border-bottom: 0;
}

.mk-table .mk-num {
    text-align: right;
}

/* Название занимает всё свободное место и обрезается многоточием */
.mk-table th[scope="row"] {
    width: 100%;
    max-width: 0;
    padding-left: 0;
}

.mk-table tbody tr[data-quote] {
    cursor: pointer;
    transition: background 0.15s;
}

.mk-table tbody tr[data-quote]:hover {
    background: rgba(150, 180, 220, 0.06);
}

.mk-table td[data-dir] {
    color: var(--dir-color);
    font-weight: 600;
}

.mk-hero .mk-row {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    max-width: 100%;
    color: var(--mk-ink);
    font-weight: 600;
}

.mk-row__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mk-row__name small {
    color: var(--mk-faint);
    font-size: 11.5px;
    font-weight: 400;
}

.mk-row__code {
    flex-shrink: 0;
    color: var(--mk-faint);
    font-family: var(--mk-mono);
    font-size: 11px;
    font-weight: 500;
}

.mk-row__code--lead {
    min-width: 30px;
    color: var(--mk-accent);
    order: -1;
}

/* Полоска изменения у акций: длина — от самого большого движения в списке */
.mk-change {
    min-width: 104px;
}

.mk-bar {
    display: inline-block;
    width: calc(var(--w) * 0.36px);
    height: 6px;
    margin-right: 8px;
    border-radius: 3px;
    background: currentColor;
    opacity: 0.5;
    vertical-align: 1px;
}

.mk-seg {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--mk-line);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.22);
}

.mk-hero .mk-seg__btn {
    padding: 4px 11px;
    border-radius: 999px;
    color: var(--mk-muted);
    font-size: 12px;
    font-weight: 600;
}

.mk-hero .mk-seg__btn[aria-pressed="true"] {
    background: var(--mk-surface-2);
    color: var(--mk-ink);
    box-shadow: inset 0 0 0 1px var(--mk-line-strong);
}

/* ---------- Карточки мировых котировок ---------- */
.mk-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
    gap: 10px;
}

.mk-hero .mk-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 12px 12px 10px;
    border: 1px solid var(--mk-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--mk-ink);
    text-align: left;
    transition: border-color 0.2s, background 0.2s;
}

.mk-hero .mk-card:hover {
    border-color: var(--mk-line-strong);
    background: var(--mk-surface-2);
}

.mk-card__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.mk-card__name {
    overflow: hidden;
    font-size: 13.5px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mk-card__tag {
    flex-shrink: 0;
    color: var(--mk-faint);
    font-size: 11px;
    white-space: nowrap;
}

.mk-card__tag--code {
    font-family: var(--mk-mono);
    font-size: 10.5px;
}

.mk-card__value {
    margin-top: 6px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mk-card__change {
    color: var(--dir-color);
    font-size: 12.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.mk-card .mk-spark {
    width: 100%;
    height: 30px;
    margin-top: 8px;
}

.mk-card__state {
    margin-top: 7px;
    color: var(--mk-faint);
    font-size: 11px;
}

.mk-card__state[data-open="true"] {
    color: var(--mk-muted);
}

.mk-card__state[data-open="true"]::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--mk-up);
    vertical-align: 1px;
}

.mk-region + .mk-region {
    margin-top: 4px;
}

.mk-region .mk-box__sub {
    margin-top: 12px;
}

/* ---------- Поиск по иностранным акциям ---------- */
.mk-search {
    position: relative;
    display: flex;
    align-items: center;
    width: min(100%, 300px);
}

.mk-search svg {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--mk-faint);
    stroke-width: 1.6;
    pointer-events: none;
}

.mk-search__input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 35px;
    border: 1px solid var(--mk-line);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.25);
    color: var(--mk-ink);
    font: inherit;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s;
}

.mk-search__input::placeholder {
    color: var(--mk-faint);
}

.mk-search__input:focus {
    border-color: rgba(140, 195, 255, 0.6);
}

.mk-stocks__empty {
    padding: 10px 2px 4px;
    color: var(--mk-muted);
    font-size: 13.5px;
}

.mk-stocks__empty p {
    margin: 0 0 4px;
}

.mk-hero .mk-open-ticker {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    margin: 8px 0 8px;
    padding: 8px 15px;
    border: 1px solid var(--mk-accent);
    border-radius: 999px;
    color: var(--mk-accent);
    font-weight: 600;
}

.mk-hero .mk-open-ticker:hover {
    background: rgba(244, 195, 90, 0.1);
}

.mk-open-ticker b {
    font-family: var(--mk-mono);
}

.mk-note {
    margin: 18px 0 0;
    color: var(--mk-faint);
    font-size: 11.5px;
    line-height: 1.5;
}

/* =====================================================
   КАРТОЧКА КОТИРОВКИ
   ===================================================== */
body.mk-lock {
    overflow: hidden;
}

.mk-quote {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.mk-quote__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 5, 10, 0.62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.mk-quote__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(480px, 100%);
    padding: 22px 24px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-left: 1px solid var(--mk-line);
    background:
        radial-gradient(ellipse 90% 40% at 100% 0%, rgba(244, 195, 90, 0.07), transparent 70%),
        var(--mk-panel);
    box-shadow: -30px 0 60px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateX(28px);
    transition: transform 0.22s ease, opacity 0.22s ease;
    outline: none;
}

.mk-quote.is-open .mk-quote__backdrop {
    opacity: 1;
}

.mk-quote.is-open .mk-quote__panel {
    opacity: 1;
    transform: none;
}

.mk-quote .mk-quote__close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--mk-line);
    border-radius: 50%;
    color: var(--mk-muted);
    transition: color 0.2s, border-color 0.2s;
}

.mk-quote .mk-quote__close:hover {
    border-color: var(--mk-line-strong);
    color: var(--mk-ink);
}

.mk-quote__close svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
}

.mk-quote__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 2px 48px 10px 0;
    color: var(--mk-muted);
    font-size: 12px;
}

.mk-quote__tag {
    padding: 2px 7px;
    border: 1px solid var(--mk-line-strong);
    border-radius: 6px;
    color: var(--mk-accent);
    font-family: var(--mk-mono);
    font-size: 11px;
}

.mk-dot {
    color: var(--mk-faint);
}

.mk-quote__title {
    margin: 0 48px 12px 0;
    color: #fff;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.12;
}

.mk-quote__price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    margin: 0;
}

.mk-quote__value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.mk-quote__change {
    color: var(--dir-color);
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.mk-quote__rub {
    margin: 6px 0 0;
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
}

.mk-quote__status {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 8px 0 0;
    color: var(--mk-muted);
    font-size: 12.5px;
}

.mk-quote__status:empty {
    display: none;
}

.mk-live {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mk-faint);
}

.mk-live[data-open="true"] {
    background: var(--mk-up);
    box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.18);
}

.mk-quote__ranges {
    display: flex;
    gap: 3px;
    margin: 18px 0 12px;
    padding: 3px;
    border: 1px solid var(--mk-line);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.25);
}

.mk-quote .mk-range {
    flex: 1 1 0;
    padding: 6px 0;
    border-radius: 7px;
    color: var(--mk-muted);
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    transition: color 0.2s;
}

.mk-quote .mk-range:hover {
    color: var(--mk-ink);
}

.mk-quote .mk-range[aria-pressed="true"] {
    background: var(--mk-surface-2);
    color: var(--mk-ink);
    box-shadow: inset 0 0 0 1px var(--mk-line-strong);
}

/* ---------- График ---------- */
.mk-chart {
    position: relative;
    height: 236px;
    color: var(--dir-color);
    touch-action: pan-y;
    user-select: none;
}

.mk-chart__plot {
    position: absolute;
    inset: 0 0 24px;
    transition: opacity 0.2s;
}

.mk-chart.is-loading .mk-chart__plot {
    opacity: 0.3;
}

.mk-chart.is-loading::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    margin-top: -12px;
    background: linear-gradient(90deg, transparent, rgba(150, 180, 220, 0.5), transparent);
    background-size: 50% 100%;
    background-repeat: no-repeat;
    animation: mk-scan 1.1s ease-in-out infinite;
}

@keyframes mk-scan {
    from { background-position: -50% 0; }
    to { background-position: 150% 0; }
}

.mk-chart__plot svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.mk-chart__line {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.mk-chart__grid {
    stroke: rgba(150, 180, 220, 0.08);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.mk-chart__base {
    stroke: rgba(233, 239, 247, 0.38);
    stroke-width: 1;
    stroke-dasharray: 3 4;
    vector-effect: non-scaling-stroke;
}

.mk-chart__hi,
.mk-chart__lo {
    position: absolute;
    right: 0;
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(7, 12, 20, 0.78);
    color: var(--mk-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.mk-chart__hi { top: 0; }
.mk-chart__lo { bottom: 26px; }

.mk-chart__hi:empty,
.mk-chart__lo:empty {
    display: none;
}

.mk-chart__from,
.mk-chart__to {
    position: absolute;
    bottom: 0;
    color: var(--mk-faint);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.mk-chart__from { left: 0; }
.mk-chart__to { right: 0; }

.mk-chart__cross {
    position: absolute;
    top: 0;
    bottom: 24px;
    width: 1px;
    margin-left: -0.5px;
    background: rgba(233, 239, 247, 0.32);
    pointer-events: none;
}

.mk-chart__cross i {
    position: absolute;
    left: 50%;
    width: 9px;
    height: 9px;
    margin: -4.5px 0 0 -4.5px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(7, 12, 20, 0.9);
}

.mk-chart__tip {
    position: absolute;
    top: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    padding: 5px 9px;
    border: 1px solid var(--mk-line-strong);
    border-radius: 8px;
    background: rgba(7, 12, 20, 0.95);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
}

.mk-chart__tip b {
    color: var(--mk-ink);
    font-weight: 700;
}

.mk-chart__tip span {
    color: var(--mk-muted);
    font-size: 11px;
}

.mk-chart__msg {
    position: absolute;
    inset: 0 0 24px;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 0 24px;
    color: var(--mk-muted);
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

.mk-quote__period {
    min-height: 1.4em;
    margin: 8px 0 14px;
    color: var(--mk-muted);
    font-size: 13px;
}

.mk-quote__period b {
    color: var(--dir-color);
    font-variant-numeric: tabular-nums;
}

/* ---------- Параметры бумаги ---------- */
.mk-quote__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 18px;
    margin: 0;
}

.mk-stat {
    padding: 10px 0;
    border-top: 1px solid var(--mk-line);
}

.mk-stat--wide {
    grid-column: 1 / -1;
}

.mk-stat dt {
    margin-bottom: 3px;
    color: var(--mk-faint);
    font-size: 11.5px;
}

.mk-stat dd {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.mk-stat dd [data-dir] {
    color: var(--dir-color);
}

/* Где цена внутри диапазона: минимум — точка — максимум */
.mk-span {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.mk-span__track {
    position: relative;
    height: 4px;
    border-radius: 2px;
    background: rgba(150, 180, 220, 0.2);
}

.mk-span__track i {
    position: absolute;
    top: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: var(--mk-ink);
    box-shadow: 0 0 0 2px var(--mk-panel);
}

.mk-quote__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--mk-line);
}

.mk-quote__source {
    margin: 0;
    color: var(--mk-faint);
    font-size: 11.5px;
}

.mk-quote .mk-quote__share {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border: 1px solid var(--mk-line-strong);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    transition: background 0.2s;
}

.mk-quote .mk-quote__share:hover {
    background: var(--mk-surface-2);
}

.mk-quote__share svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
}

/* =====================================================
   АДАПТИВ
   ===================================================== */

/* Плитки не помещаются в ряд — листаются пальцем */
@media (max-width: 1180px) {
    .mk-tiles {
        display: flex;
        gap: 8px;
        margin-left: -24px;
        margin-right: -24px;
        padding: 0 24px 2px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding: 0 24px;
        scrollbar-width: none;
    }

    .mk-tiles::-webkit-scrollbar {
        display: none;
    }

    .mk-hero .mk-tile {
        flex: 0 0 164px;
        scroll-snap-align: start;
    }
}

@media (max-width: 900px) {
    .mk-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .mk-wrap {
        width: calc(100% - 32px);
        padding: 22px 0 20px;
    }

    .mk-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        margin-bottom: 18px;
    }

    .mk-title {
        font-size: 42px;
    }

    .mk-lead {
        font-size: 13.5px;
    }

    .mk-status {
        border-radius: 12px;
    }

    .mk-tiles {
        margin-left: -16px;
        margin-right: -16px;
        padding: 0 16px 2px;
        scroll-padding: 0 16px;
    }

    .mk-hero .mk-tile {
        flex-basis: 152px;
        min-height: 128px;
    }

    .mk-tile__value {
        font-size: 21px;
    }

    .mk-tabs {
        margin-left: -16px;
        margin-right: -16px;
        padding: 0 10px;
    }

    .mk-box {
        padding: 14px 14px 12px;
    }

    .mk-table {
        font-size: 13px;
    }

    .mk-table thead th {
        white-space: normal;
    }

    /* Тикер рядом с названием на узком экране не помещается */
    .mk-table .mk-row__code:not(.mk-row__code--lead) {
        display: none;
    }

    .mk-change {
        min-width: 0;
    }

    .mk-bar {
        display: none;
    }

    .mk-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .mk-search {
        width: 100%;
    }

    /* Карточка котировки выезжает снизу */
    .mk-quote__panel {
        top: auto;
        left: 0;
        width: 100%;
        max-height: 92svh;
        padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
        border-left: 0;
        border-top: 1px solid var(--mk-line);
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.5);
        transform: translateY(40px);
    }

    .mk-quote__title {
        font-size: 25px;
    }

    .mk-quote__value {
        font-size: 28px;
    }

    .mk-chart {
        height: 200px;
    }
}

/* «С начала года» есть в карточке индекса — на телефоне место отдаём названию */
@media (max-width: 480px) {
    .mk-table--index th:nth-child(4),
    .mk-table--index td:nth-child(4) {
        display: none;
    }
}

@media (max-width: 400px) {
    .mk-hero .mk-card {
        padding: 10px 10px 9px;
    }

    .mk-quote__stats {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .mk-hero *,
    .mk-quote,
    .mk-quote * {
        animation: none !important;
        transition: none !important;
    }
}
