/* Примеры дашбордов и карты (/demo/...): Components/Pages/Demo */

/* ───────── дашборды ───────── */
.dfd-page { padding: 4px 4px 16px; color: #1f2937; }
.dfd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dfd-title { font-size: 1.45rem; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.dfd-meta { color: #6b7280; font-size: 0.85rem; margin-top: 2px; }
.dfd-demo-flag { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: #8a5a00; background: #fff6e0; border: 1px solid #f5dfa8; border-radius: 999px; padding: 4px 10px; }
.dfd-demo-flag .rzi { font-size: 16px; }

.dfd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.dfd-kpi { background: #fff; border: 1px solid #e8eaee; border-radius: 12px; padding: 12px 14px 10px; display: flex; flex-direction: column; min-width: 0; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.dfd-kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.dfd-kpi-title { font-size: 0.8rem; color: #6b7280; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dfd-kpi-badge { font-size: 0.68rem; font-weight: 600; color: #4b5563; background: #f1f3f6; border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.dfd-kpi-value { font-size: 1.6rem; font-weight: 650; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.dfd-kpi-unit { font-size: 0.78rem; font-weight: 500; color: #6b7280; margin-left: 4px; }
.dfd-kpi-delta { display: flex; align-items: center; gap: 2px; font-size: 0.78rem; font-weight: 600; margin-top: 2px; }
.dfd-kpi-delta .rzi { font-size: 15px; }
.dfd-kpi-delta.good { color: #0a7d32; }
.dfd-kpi-delta.bad { color: #c03434; }
.dfd-kpi-spark { width: 100%; height: 36px; margin-top: 6px; }
.dfd-kpi-spark .line { fill: none; stroke: #2a78d6; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.dfd-kpi-spark .area { fill: rgba(42,120,214,.08); }
.dfd-kpi-spark .end { fill: #2a78d6; }
.dfd-kpi-note { font-size: 0.72rem; color: #9ca3af; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dfd-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.dfd-card { background: #fff; border: 1px solid #e8eaee; border-radius: 12px; padding: 14px 16px 10px; min-width: 0; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.dfd-card.span-4 { grid-column: span 4; }
.dfd-card.span-5 { grid-column: span 5; }
.dfd-card.span-6 { grid-column: span 6; }
.dfd-card.span-7 { grid-column: span 7; }
.dfd-card.span-8 { grid-column: span 8; }
.dfd-card.span-12 { grid-column: span 12; }
@media (max-width: 1280px) { .dfd-card[class*="span-"] { grid-column: span 6; } }
@media (max-width: 900px) { .dfd-card[class*="span-"] { grid-column: span 12; } }
.dfd-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.dfd-card-title { font-size: 1rem; font-weight: 620; margin: 0; }
.dfd-card-sub { color: #6b7280; font-size: 0.8rem; margin-top: 2px; }
.dfd-tag { font-size: 0.72rem; color: #4b5563; background: #f1f3f6; border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.dfd-insight { display: flex; gap: 6px; align-items: flex-start; margin: 10px 0 4px; padding: 7px 10px; background: #f3f7fd; border-radius: 8px; font-size: 0.8rem; color: #1e3a5f; }
.dfd-insight .rzi { font-size: 16px; color: #2a78d6; margin-top: 1px; }
.dfd-chart { width: 100%; margin-top: 8px; }

/* ───────── палитра дашбордов: фирменная (по умолчанию) / контрастная ───────── */
.dfd-page { --dfd-accent: #0F766E; --dfd-accent-soft: rgba(15,118,110,.08); --dfd-insight-bg: #f1f6f5; --dfd-insight-ink: #1f3d3a; }
.dfd-page[data-palette="contrast"] { --dfd-accent: #2a78d6; --dfd-accent-soft: rgba(42,120,214,.08); --dfd-insight-bg: #f3f7fd; --dfd-insight-ink: #1e3a5f; }
.dfd-kpi-spark .line { stroke: var(--dfd-accent); }
.dfd-kpi-spark .area { fill: var(--dfd-accent-soft); }
.dfd-kpi-spark .end { fill: var(--dfd-accent); }
.dfd-insight { background: var(--dfd-insight-bg); color: var(--dfd-insight-ink); }
.dfd-insight .rzi { color: var(--dfd-accent); }
.dfd-head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dfd-palette { display: inline-flex; background: #f1f3f6; border-radius: 999px; padding: 3px; gap: 2px; }
.dfd-palette button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: #4b5563; font-size: 0.78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.dfd-palette button.on { background: #fff; color: #1f2937; box-shadow: 0 1px 3px rgba(16,24,40,.12); }
.dfd-palette .dots { width: 26px; height: 8px; border-radius: 4px; }
.dfd-palette .dots.brand { background: linear-gradient(90deg, #334155 0 20%, #0F766E 20% 40%, #C26D4F 40% 60%, #7C6AA6 60% 80%, #7D9273 80%); }
.dfd-palette .dots.contrast { background: linear-gradient(90deg, #2a78d6 0 20%, #eb6834 20% 40%, #1baf7a 40% 60%, #eda100 60% 80%, #e87ba4 80%); }

/* ───────── карта (светлая, фирменные цвета) ───────── */
.dfm-wrap { position: relative; height: calc(100dvh - 130px); min-height: 560px; border-radius: 12px; overflow: hidden; background: #e7eef5; border: 1px solid #e2e8f0; }
.dfm-map { position: absolute; inset: 0; isolation: isolate; } /* подписи глобуса остаются под панелями */
.dfm-panel { position: absolute; top: 12px; background: rgba(255,255,255,.95); backdrop-filter: blur(6px); border: 1px solid #e2e8f0; border-radius: 12px; color: #1f2937; padding: 12px 14px; font-size: 0.82rem; box-shadow: 0 6px 20px rgba(15,23,42,.10); }
.dfm-controls { left: 12px; width: 250px; }
.dfm-info { right: 12px; width: 300px; max-height: calc(100% - 24px); overflow-y: auto; }
.dfm-title { font-size: 1rem; font-weight: 650; color: #334155; }
.dfm-demo { display: flex; align-items: center; gap: 4px; color: #8a5a00; font-size: 0.72rem; margin: 2px 0 10px; }
.dfm-demo .rzi { font-size: 14px; }
.dfm-seg { display: flex; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 9px; padding: 3px; gap: 3px; }
.dfm-seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 0; background: transparent; color: #64748b; padding: 6px 4px; border-radius: 6px; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.dfm-seg button .rzi { font-size: 17px; }
.dfm-seg button.on { background: #334155; color: #fff; }
.dfm-seg-sm button { font-size: 0.74rem; padding: 5px 2px; }
.dfm-label { color: #64748b; font-size: 0.74rem; text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 6px; }
.dfm-label b { color: #1f2937; font-size: 0.9rem; text-transform: none; }
.dfm-range { width: 100%; accent-color: #0F766E; }
.dfm-range-ticks { display: flex; justify-content: space-between; color: #94a3b8; font-size: 0.68rem; padding: 0 2px; }
.dfm-check { display: flex; align-items: center; gap: 8px; margin: 5px 0; cursor: pointer; }
.dfm-check input { accent-color: #0F766E; width: 15px; height: 15px; }
.dfm-legend { border-top: 1px solid #e2e8f0; margin-top: 10px; padding-top: 8px; color: #64748b; font-size: 0.74rem; line-height: 1.9; }
.dfm-legend .sym { display: inline-block; width: 11px; height: 11px; background: #64748b; vertical-align: -1px; margin-right: 4px; }
.dfm-legend .sym.tri { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.dfm-legend .sym.circ { border-radius: 50%; margin-left: 8px; }
.dfm-legend .ln { display: inline-block; width: 20px; height: 3px; border-radius: 2px; vertical-align: 3px; margin-right: 6px; }
.dfm-legend .ln.dash { background: repeating-linear-gradient(90deg, #7C6AA6 0 6px, transparent 6px 9px); }
.dfm-panel .sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin: 0 4px 0 0; flex: none; }
.dfm-panel .sw.hollow { background: #fff; box-shadow: inset 0 0 0 1.5px #7C6AA6; }
.dfm-legend .sw { margin-left: 6px; }
.dfm-legend .sw:first-child { margin-left: 0; }
.dfm-panel .sw.round { border-radius: 50%; }
.dfm-info-title { font-weight: 650; margin: 4px 0 8px; font-size: 0.86rem; color: #334155; }
.dfm-info-title:not(:first-child) { margin-top: 14px; }
.dfm-bar { display: grid; grid-template-columns: 96px 1fr 44px; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 6px; cursor: pointer; }
.dfm-bar:hover, .dfm-item:hover { background: #f1f5f9; }
.dfm-bar .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dfm-bar .track { height: 7px; background: #eef2f6; border-radius: 4px; overflow: hidden; }
.dfm-bar .fill { display: block; height: 100%; border-radius: 4px; }
.dfm-bar b { text-align: right; font-variant-numeric: tabular-nums; }
.dfm-item { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 6px; cursor: pointer; }
.dfm-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dfm-item b { font-variant-numeric: tabular-nums; }
.dfm-muted { color: #64748b; font-size: 0.76rem; }
.dfm-hint { display: flex; gap: 6px; align-items: center; color: #64748b; font-size: 0.74rem; margin-top: 14px; border-top: 1px solid #e2e8f0; padding-top: 8px; }
.dfm-hint .rzi { font-size: 16px; }
.dfm-risk { font-size: 0.68rem; font-weight: 700; border-radius: 4px; padding: 1px 6px; text-transform: uppercase; letter-spacing: .03em; flex: none; }
.dfm-risk.high { background: rgba(163,65,107,.12); color: #A3416B; }
.dfm-risk.mid { background: rgba(194,109,79,.14); color: #9a4f35; }
.dfm-risk.low { background: rgba(15,118,110,.12); color: #0F766E; }
.dfm-close { position: absolute; top: 8px; right: 8px; border: 0; background: transparent; color: #64748b; cursor: pointer; padding: 2px; }
.dfm-kicker { color: #0F766E; font-size: 0.7rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.dfm-card-title { font-size: 1.15rem; font-weight: 650; margin: 2px 24px 2px 0; color: #1f2937; }
.dfm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; margin: 12px 0; }
.dfm-stats > div { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 7px 9px; display: flex; flex-direction: column; }
.dfm-stats span { color: #64748b; font-size: 0.7rem; }
.dfm-stats b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.dfm-stats em { font-style: normal; color: #64748b; font-size: 0.68rem; }
.dfm-status { display: flex; align-items: center; gap: 4px; }
.dfm-note { color: #475569; line-height: 1.45; margin-top: 8px; }
.dfm-sub { color: #64748b; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 6px; }
.dfm-years { display: flex; align-items: flex-end; gap: 6px; height: 96px; }
.dfm-years .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; cursor: pointer; border-radius: 4px; }
.dfm-years .col .bar { width: 70%; border-radius: 3px 3px 0 0; opacity: .45; min-height: 2px; }
.dfm-years .col.cur .bar { opacity: 1; }
.dfm-years .col .val { font-size: 0.64rem; color: #64748b; }
.dfm-years .col .yr { font-size: 0.68rem; color: #94a3b8; margin-top: 2px; }
.dfm-years .col.cur .yr { color: #1f2937; font-weight: 700; }
@media (max-width: 900px) {
    .dfm-info { top: auto; bottom: 12px; width: calc(100% - 24px); max-height: 40%; }
}

/* ───────── карта: вкладки «Карта / Глобус» ───────── */
.dfm-tabs { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 3px; padding: 3px; background: rgba(255,255,255,.95); border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 6px 20px rgba(15,23,42,.10); z-index: 2; }
.dfm-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: #64748b; padding: 6px 14px; border-radius: 7px; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.dfm-tabs button .rzi { font-size: 18px; }
.dfm-tabs button.on { background: #334155; color: #fff; }
.dfm-globe { background: #f6f8fb; }
.dfm-globe-hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: 16px; display: flex; align-items: center; gap: 6px; max-width: 320px; color: #64748b; font-size: 0.76rem; background: rgba(255,255,255,.9); border: 1px solid #e2e8f0; border-radius: 8px; padding: 6px 10px; }
.dfm-globe-hint .rzi { font-size: 18px; color: #0F766E; }
/* Подписи точек глобуса — HTML поверх WebGL: положение и прозрачность каждый кадр задаёт tickGlobeLabels */
.dfm-globe-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.dfm-glabel { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 11px; font-weight: 600; color: #1f2937; background: rgba(255,255,255,.88);
    border: 1px solid #e2e8f0; border-radius: 4px; padding: 1px 5px; opacity: 0; will-change: transform, opacity; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.dfm-glabel em { font-style: normal; font-weight: 500; color: #64748b; margin-left: 2px; }
.dfm-glabel.choke { border-color: rgba(163,65,107,.35); }
.dfm-glabel.choke em { color: #A3416B; }

/* ───────── витрина: карусель ───────── */
.dfc { padding-top: 4px; }
.dfc-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.dfc-btn, .dft-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid #e2e8f0; background: #fff; color: #334155; border-radius: 8px; padding: 4px 10px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.dfc-btn .rzi, .dft-btn .rzi { font-size: 18px; }
.dfc-hint { color: #94a3b8; font-size: 0.78rem; }
.dfc-btn:disabled { cursor: progress; opacity: 0.7; }
.dfc-spin { animation: dfc-spin 1s linear infinite; }
@keyframes dfc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dfc-spin { animation: none; } }
.dfc-ticker, .dfc-row { overflow: hidden; position: relative; -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.dfc-ticker { background: #334155; border-radius: 10px; padding: 8px 0; margin-bottom: 14px; }
.dfc-track { display: flex; width: max-content; animation: dfc-scroll 150s linear infinite; }
.dfc-track > * { margin-right: 14px; }  /* отступ у каждого элемента, а не gap: тогда половина ленты — ровно одна копия */
.dfc-track.reverse { animation-direction: reverse; }
.dfc-track.dfc-fast { animation-duration: 60s; }
.dfc-track.dfc-fast > * { margin-right: 36px; }
.dfc-row:hover .dfc-track, .dfc-ticker:hover .dfc-track, .dfc.paused .dfc-track { animation-play-state: paused; }
@keyframes dfc-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.dfc-tick { color: #e2e8f0; font-size: 0.85rem; white-space: nowrap; }
.dfc-tick b { color: #fff; margin-right: 4px; }
.dfc-tick em { font-style: normal; color: #94a3b8; font-size: 0.75rem; margin-right: 6px; }
.dfc-tick .good { color: #6fd0c4; }
.dfc-tick .bad { color: #f0a58b; }
.dfc-tick .flat { color: #94a3b8; }
a.dfc-news { color: #e2e8f0; text-decoration: none; cursor: pointer; }
a.dfc-news:hover, a.dfc-news:focus-visible { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.dfc-news b { color: #6fd0c4; font-weight: 650; margin-right: 6px; }
.dfc-news.important b::before { content: "● "; color: #f0a58b; }
.dfc-thesis { color: #b6c2d1; }
.dfc-ticker-wait { color: #94a3b8; font-size: 0.85rem; padding-left: 18px; -webkit-mask-image: none; mask-image: none; }
.dfc-row-head { display: flex; align-items: center; gap: 6px; font-weight: 650; color: #334155; margin: 6px 0 8px; }
.dfc-row-head .rzi { font-size: 20px; color: #0F766E; }
.dfc-row { padding: 2px 0 12px; }
.dfc-item { flex: none; }
.dfc-chart { width: 460px; }
.dfc-chart .dfd-card { height: 100%; }
.dfc-kpi { width: 220px; display: flex; }
.dfc-kpi .dfd-kpi { width: 100%; justify-content: center; }
.dfc-kpi .dfd-kpi-value { font-size: 2rem; }
.dfc-kpi .dfd-kpi-spark { height: 70px; margin-top: 14px; }
@media (prefers-reduced-motion: reduce) { .dfc-track { animation: none; } .dfc-row, .dfc-ticker { overflow-x: auto; } }

/* ───────── витрина: облако тегов ───────── */
.dft { padding-top: 4px; }
.dft-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.dft-crumbs { display: flex; align-items: center; gap: 2px; font-size: 0.95rem; }
.dft-crumbs .rzi { color: #94a3b8; font-size: 18px; }
.dft-crumb { border: 0; background: transparent; color: #0F766E; font-weight: 600; padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.dft-crumb:hover { background: #f1f5f9; }
.dft-crumb.last { color: #1f2937; cursor: default; }
.dft-actions { display: flex; align-items: center; gap: 10px; }
.dft-order { width: 340px; }
.dft-stage { position: relative; height: calc(100dvh - 300px); min-height: 480px; background: #fff; border: 1px solid #e8eaee; border-radius: 12px; overflow: hidden; }
.dft-chart { position: absolute; inset: 0; transition: opacity .35s; }
.dft-stage.idle .dft-chart { opacity: 0; }
.dft-cloud { position: absolute; inset: 0; pointer-events: none; transition: opacity .3s; }
.dft-stage.no-cloud .dft-cloud { opacity: 0; }
.dft-stage.no-cloud .dft-tag { pointer-events: none !important; }
.dft-sphere { position: absolute; inset: 0; --r: 200px; }
/* Под тегами ничего нет; белый ореол у букв — чтобы теги читались поверх линий графика */
.dft-tag { position: absolute; left: 50%; top: 50%; white-space: nowrap; border: 0; background: transparent; color: var(--tag); font-weight: 650; line-height: 1.15;
    text-shadow: 0 0 2px #fff, 0 0 6px #fff, 0 0 10px rgba(255,255,255,.9);
    padding: 2px 8px; border-radius: 8px; cursor: pointer; will-change: transform, filter, opacity; transform: translate(-50%, -50%); }
.dft-tag:hover { background: color-mix(in srgb, var(--tag) 12%, rgba(255,255,255,.85)); box-shadow: 0 4px 14px rgba(15,23,42,.12); }
.dft-tag.on { background: var(--tag); color: #fff; text-shadow: none; }
.dft-prompt { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); color: #94a3b8; font-size: 0.85rem; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.dft-prompt.small { top: auto; bottom: 14px; font-size: 0.74rem; text-transform: none; letter-spacing: 0; background: rgba(255,255,255,.85); border-radius: 6px; padding: 2px 8px; }
@media (max-width: 900px) { .dft-order { width: auto; } }
