/* dash.css — «жива головна» Tariscope (js/dash.js), як у Порталі 2.2 (css/portal-dash.css + css/portal-widgets.css Порталу).
   Рух — лише transform / opacity / rotate і висота тіла (grid-template-rows 1fr ↔ 0fr); вимикач анімацій (fx-off) і системне
   «менше руху» лишають усе робочим, але без руху. Наведення — лише для миші (@media (hover: hover)). */

/* ── Сітка: 12 колонок; планшет — 6; телефон — 2 (картки на всю ширину, плитки по дві) ── */
.dash-grid { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; grid-auto-flow: row dense; }
.dash-w { position: relative; min-width: 0; grid-column: span var(--dw, 6); }
@media (max-width: 1023px) { .dash-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; } .dash-w { grid-column: span var(--dwt, 6); } }
@media (max-width: 640px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } .dash-w { grid-column: 1 / -1; } }

/* ── Картка ── */
.dash-panel { position: relative; isolation: isolate; height: 100%; box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden; padding: 20px 22px;
  border-radius: 20px; background: #fff; border: 1px solid rgba(148, 163, 184, .22); box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 28px -16px rgba(76, 29, 149, .18);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), box-shadow .28s ease, padding .42s cubic-bezier(.2, .8, .2, 1); }
html.dark .dash-panel { background: #1f2937; border-color: rgba(148, 163, 184, .12); box-shadow: 0 10px 28px -16px rgba(0, 0, 0, .7); }
.dash-glow { position: absolute; inset: 0; z-index: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s ease;
  background: radial-gradient(340px circle at var(--gx, 50%) var(--gy, 0px), rgba(167, 139, 250, .15), transparent 62%); }
@media (hover: hover) {
  .dash-w:not(.dash-mini):hover > .dash-panel { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 20px 44px -18px rgba(76, 29, 149, .32); }
  html.dark .dash-w:not(.dash-mini):hover > .dash-panel { box-shadow: 0 20px 44px -18px rgba(0, 0, 0, .85); }
  .dash-panel:hover > .dash-glow { opacity: 1; }
  .dash-w:hover .dash-ico { transform: scale(1.08) rotate(-4deg); }
}

/* ── Шапка: плитка-значок, назва, посилання, кнопка згортання ── */
.dash-head { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: 16px; transition: margin-bottom .42s cubic-bezier(.2, .8, .2, 1); }
.dash-ico { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; transition: transform .3s cubic-bezier(.3, 1.5, .5, 1); }
.dash-ico > svg { width: 18px; height: 18px; }
.dash-title { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.dark .dash-title { color: #f9fafb; }
.dash-extra { flex: none; display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dash-extra a { color: #6d28d9; font-weight: 600; text-decoration: none; }
.dash-extra a:hover { text-decoration: underline; }
html.dark .dash-extra a { color: #c4b5fd; }
.dw-badge { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff; background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 6px 14px -6px rgba(217, 119, 6, .7); }
.dash-peek { display: none; }
.dash-toggle { flex: none; width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border-radius: 50%; cursor: pointer; opacity: .55;
  border: 1px solid rgba(148, 163, 184, .35); background: rgba(255, 255, 255, .6); color: #6b7280; transition: opacity .2s ease, background-color .2s ease, color .2s ease, transform .2s ease; }
.dash-toggle svg { width: 16px; height: 16px; }
html.dark .dash-toggle { border-color: rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .06); color: #9ca3af; }
.dash-w:hover .dash-toggle, .dash-mini .dash-toggle, .dash-toggle:focus-visible { opacity: 1; }
@media (hover: hover) { .dash-toggle:hover { background: rgba(139, 92, 246, .16); color: #7c3aed; transform: scale(1.08); } html.dark .dash-toggle:hover { color: #c4b5fd; } }
@media (hover: none) { .dash-toggle { opacity: 1; } }

/* ── Тіло: плавне згортання без вимірювання висоти ── */
.dash-body { position: relative; z-index: 1; flex: 1 1 auto; min-height: 0; display: grid; grid-template-rows: 1fr; transition: grid-template-rows .42s cubic-bezier(.2, .8, .2, 1), opacity .3s ease; }
.dash-body-in { min-height: 0; min-width: 0; }

/* ── Згорнутий віджет — мала плитка з живим підсумком ── */
.dash-w.dash-mini { grid-column: span 3; align-self: start; cursor: pointer; }
@media (max-width: 640px) { .dash-w.dash-mini { grid-column: span 1; } }
.dash-mini > .dash-panel { min-height: 92px; padding: 14px 14px 14px 16px; }
.dash-mini .dash-head { flex-wrap: wrap; row-gap: 8px; column-gap: 10px; margin-bottom: 0; }
.dash-mini .dash-ico { width: 30px; height: 30px; border-radius: 10px; }
.dash-mini .dash-ico > svg { width: 16px; height: 16px; }
.dash-mini .dash-title { flex: 1 1 0; font-size: 13px; font-weight: 600; color: #6b7280; }
html.dark .dash-mini .dash-title { color: #9ca3af; }
.dash-mini .dash-extra { display: none; }
.dash-mini .dash-toggle { width: 26px; height: 26px; }
.dash-mini .dash-body { grid-template-rows: 0fr; opacity: 0; }
.dash-mini .dash-body-in { overflow: hidden; }
.dash-mini .dash-peek { display: block; order: 5; flex: 0 0 100%; min-width: 0; padding: 0 2px; font-size: 14px; font-weight: 700; line-height: 1.25; color: #111827;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
html.dark .dash-mini .dash-peek { color: #f3f4f6; }
.dash-mini .dash-peek[data-kind="count"] { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.dash-mini .dash-peek.dash-peek-hot { color: #b91c1c; }
html.dark .dash-mini .dash-peek.dash-peek-hot { color: #f87171; }
.dash-mini .dash-peek:empty::after { content: 'згорнуто'; font-size: 12px; font-weight: 500; color: #6b7280; }

/* ── Рядок над сіткою: «Налаштувати»; у режимі налаштування — підказка, «Скинути», «Готово» ── */
.dash-bar { position: relative; z-index: 30; display: none; align-items: center; justify-content: flex-end; gap: 10px; min-height: 34px; }   /* видно лише в режимі налаштування; вхід — плитка в шапці розділу */
.dash-bar.is-on { display: flex; }
.dash-bar-l, .dash-bar [data-bar="reset"], .dash-bar [data-bar="done"] { display: none; }
.dash-b { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border: 0; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 600; line-height: 1;
  white-space: nowrap; cursor: pointer; transition: background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease; }
.dash-b svg { width: 16px; height: 16px; flex: none; }
.dash-b-open { background: #f3f4f6; color: #4b5563; box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .45); }
html.dark .dash-b-open { background: rgba(55, 65, 81, .6); color: #d1d5db; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
@media (hover: hover) {
  .dash-b-open:hover { color: #6d28d9; background: #fff; box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .55), 0 6px 16px -8px rgba(109, 40, 217, .45); }
  .dash-b-open:hover svg { animation: dashNudge .5s ease; }
  html.dark .dash-b-open:hover { color: #ddd6fe; background: rgba(139, 92, 246, .16); box-shadow: inset 0 0 0 1px rgba(167, 139, 250, .55); }
  .dash-b-main:hover { transform: translateY(-1px); }
  .dash-b-ghost:hover { color: #b91c1c; box-shadow: inset 0 0 0 1px rgba(239, 68, 68, .6); }
  html.dark .dash-b-ghost:hover { color: #fca5a5; }
}
.dash-b-main { color: #fff; background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: 0 8px 18px -8px rgba(109, 40, 217, .7); }
.dash-b-ghost { background: #f3f4f6; color: #374151; box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .5); }
html.dark .dash-b-ghost { background: rgba(55, 65, 81, .6); color: #e5e7eb; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }
.dash-bar.is-on { position: sticky; top: 10px; margin: 0 0 16px; padding: 10px 12px 10px 18px; border-radius: 18px; background: rgba(255, 255, 255, .92);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, .28), 0 16px 40px -18px rgba(76, 29, 149, .45); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); animation: dashBarIn .32s cubic-bezier(.2, .9, .3, 1.15) both; }
html.dark .dash-bar.is-on { background: rgba(17, 24, 39, .9); box-shadow: 0 0 0 1px rgba(167, 139, 250, .3), 0 16px 40px -18px rgba(0, 0, 0, .8); }
.dash-bar.is-on .dash-bar-l { display: grid; gap: 2px; margin-right: auto; min-width: 0; }
.dash-bar-l b { font-size: 14px; font-weight: 700; color: #111827; } .dash-bar-l span { font-size: 12.5px; color: #4b5563; }
html.dark .dash-bar-l b { color: #f9fafb; } html.dark .dash-bar-l span { color: #9ca3af; }
.dash-bar.is-on [data-bar="reset"], .dash-bar.is-on [data-bar="done"] { display: inline-flex; }
@media (max-width: 640px) { .dash-bar-l span { display: none; } .dash-bar.is-on { padding-left: 14px; } }

/* ── Режим налаштування: картки погойдуються (rotate, щоб не заважати переїздам), вміст прикрито «вуаллю» — тягнути можна за будь-яке місце ── */
.dash-veil, .dash-ctl, .dash-grip, .dash-ruler, .dash-size, .dash-guides { display: none; }
.dash-edit > .dash-w { z-index: 1; animation: dashWiggle 1.1s ease-in-out infinite alternate; }
.dash-edit > .dash-w:nth-child(2n) { animation-direction: alternate-reverse; animation-duration: 1.3s; }
.dash-edit > .dash-w:nth-child(3n) { animation-duration: .95s; }
.dash-edit > .dash-w > .dash-panel { outline: 2px dashed rgba(139, 92, 246, .42); outline-offset: 3px; transform: none !important; }
.dash-edit > .dash-w:hover > .dash-panel { outline-color: rgba(139, 92, 246, .85); }
.dash-edit > .dash-w:hover { z-index: 3; }
.dash-edit .dash-veil { display: block; position: absolute; inset: 0; z-index: 20; border-radius: 20px; cursor: grab; touch-action: pan-y; }
.dash-edit .dash-toggle { visibility: hidden; }
.dash-edit .dash-ctl { display: flex; position: absolute; top: -13px; right: 16px; z-index: 22; gap: 6px; }
.dash-c { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: #fff; color: #4b5563; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .08), 0 6px 14px -4px rgba(15, 23, 42, .35); transition: transform .16s ease, background-color .16s ease, color .16s ease; }
.dash-c svg { width: 15px; height: 15px; }
@media (hover: hover) { .dash-c:hover { transform: scale(1.12); background: #7c3aed; color: #fff; } .dash-c-x:hover { background: #ef4444; } }
html.dark .dash-c { background: #374151; color: #e5e7eb; box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 6px 14px -4px rgba(0, 0, 0, .7); }
/* ручка на правому краї: тягнемо — картка прилипає до колонок */
.dash-edit .dash-grip { display: block; position: absolute; top: 50%; right: -12px; z-index: 22; width: 24px; height: 72px; margin-top: -36px; cursor: ew-resize; touch-action: none; }
.dash-grip i { position: absolute; left: 8px; top: 10px; bottom: 10px; width: 8px; border-radius: 4px; background: #8b5cf6; box-shadow: 0 0 0 3px #fff, 0 6px 14px -2px rgba(76, 29, 149, .55); transition: transform .16s ease, background-color .16s ease; }
html.dark .dash-grip i { box-shadow: 0 0 0 3px #111827, 0 6px 14px -2px rgba(0, 0, 0, .8); }
.dash-grip:hover i, .dash-resize > .dash-grip i { transform: scaleX(1.35) scaleY(1.08); background: #6d28d9; }
/* «лінійка» ширини внизу картки: шість кроків, натиснутий — поточний */
.dash-edit .dash-ruler { display: flex; position: absolute; left: 50%; bottom: -12px; z-index: 22; transform: translateX(-50%); align-items: flex-end; gap: 4px; padding: 5px 8px; border-radius: 999px; background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .08), 0 6px 14px -4px rgba(15, 23, 42, .35); opacity: 0; transition: opacity .16s ease; }
.dash-edit > .dash-w:hover > .dash-ruler, .dash-edit > .dash-resize > .dash-ruler { opacity: 1; }
html.dark .dash-edit .dash-ruler { background: #374151; box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 6px 14px -4px rgba(0, 0, 0, .7); }
.dash-ruler button { width: calc(var(--n) * 2.4px + 4px); height: 12px; padding: 0; border: 0; border-radius: 4px; background: #d1d5db; cursor: pointer; transition: background-color .15s ease, transform .15s ease; }
.dash-ruler button:hover:not(:disabled) { background: #a78bfa; transform: scaleY(1.25); } .dash-ruler button.is-on { background: #7c3aed; } .dash-ruler button:disabled { opacity: .35; cursor: not-allowed; }
html.dark .dash-ruler button { background: #6b7280; } html.dark .dash-ruler button.is-on { background: #a78bfa; }
.dash-edit > .dash-mini > .dash-grip, .dash-edit > .dash-mini > .dash-ruler { display: none; }
@media (max-width: 640px) { .dash-edit .dash-grip, .dash-edit .dash-ruler { display: none; } }
/* підпис ширини під час розтягування й напрямні колонок */
.dash-resize > .dash-size { display: block; position: absolute; left: 50%; top: 50%; z-index: 23; transform: translate(-50%, -50%); padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  white-space: nowrap; color: #fff; background: rgba(76, 29, 149, .92); box-shadow: 0 10px 24px -8px rgba(76, 29, 149, .7); pointer-events: none; }
.dash-resize > .dash-panel { outline-style: solid !important; outline-color: #7c3aed !important; }
.dash-edit > .dash-resize { animation: none; z-index: 4; }
.dash-resizing > .dash-guides { display: grid; position: absolute; inset: 0; z-index: 0; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; pointer-events: none; }
.dash-guides i { border-radius: 12px; background: rgba(139, 92, 246, .07); box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .2); }
@media (max-width: 1023px) { .dash-resizing > .dash-guides { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; } .dash-guides i:nth-child(n+7) { display: none; } }
.dash-resizing { user-select: none; -webkit-user-select: none; }

/* ── Перетягування: на місці картки — пунктирний «слід», сама картка піднімається й трохи нахиляється ── */
.dash-grid .dash-ghost { opacity: .32; animation: none; }
.dash-grid .dash-ghost > .dash-panel { outline: 2px dashed #7c3aed !important; outline-offset: 4px; }
.dash-grid .dash-chosen > .dash-panel { box-shadow: 0 24px 60px rgba(76, 29, 149, .35) !important; }
.dash-w.dash-drag { animation: none !important; rotate: 1.4deg; opacity: .96 !important; cursor: grabbing; z-index: 60; }
.dash-w.dash-drag > .dash-panel { box-shadow: 0 34px 70px -18px rgba(76, 29, 149, .6) !important; outline: 0 !important; }
.dash-w.dash-drag > .dash-ctl, .dash-w.dash-drag > .dash-grip, .dash-w.dash-drag > .dash-ruler { display: none !important; }
.dash-dragging .dash-veil { cursor: grabbing; }
.dash-new > .dash-panel { animation: dashGlow 1.5s ease-out both; }

/* ── Полиця схованих віджетів (унизу, лише в режимі налаштування) ── */
.dash-shelf { position: fixed; left: 50%; bottom: 18px; z-index: 45; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 20px; color: #e5e7eb;
  background: rgba(17, 24, 39, .93); box-shadow: 0 0 0 1px rgba(167, 139, 250, .25), 0 22px 54px -14px rgba(0, 0, 0, .65); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  animation: dashShelfIn .38s cubic-bezier(.2, .9, .3, 1.15) both; }
.dash-shelf-t { flex: none; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #c4b5fd; }
.dash-shelf-none { font-size: 13px; color: #9ca3af; }
.dash-shelf-list { display: flex; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; } .dash-shelf-list::-webkit-scrollbar { display: none; }
.dash-chip { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 6px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .08); color: #f3f4f6;
  font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: background-color .16s ease, transform .16s ease; }
@media (hover: hover) { .dash-chip:hover { background: rgba(139, 92, 246, .5); transform: translateY(-2px); } }
.dash-chip .dash-ico { width: 26px; height: 26px; border-radius: 8px; } .dash-chip .dash-ico > svg { width: 15px; height: 15px; }
.dash-chip i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, .14); } .dash-chip i svg { width: 12px; height: 12px; }
html.dash-editing #main-content { padding-bottom: 96px; }

@keyframes dashWiggle { from { rotate: -.2deg; } to { rotate: .2deg; } }
@keyframes dashNudge { 0%, 100% { transform: none; } 40% { transform: rotate(-14deg) scale(1.1); } 70% { transform: rotate(10deg); } }
@keyframes dashBarIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes dashShelfIn { from { opacity: 0; transform: translate(-50%, 26px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes dashGlow { 0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, .75); } 100% { box-shadow: 0 0 0 22px rgba(139, 92, 246, 0); } }

/* ══════ Вміст віджетів: спільні цеглинки — плитка числа, рядок списку, смужка ══════ */
/* плитка числа: колір живе в тлі, число — темне; сітка сама перекладається під ширину картки */
.dw-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; }
/* чотири плитки: у ряд, коли картка ширша за 640 px, інакше 2 × 2 — «три й одна в хвості» не буває (як у Порталі) */
.dw-stats[data-n="4"] { grid-template-columns: repeat(auto-fit, minmax(max(140px, calc(50% - 5px - max(0px, 100% - 640px) * 999)), 1fr)); }
/* вміст розкладається за шириною САМОГО віджета (@container), а не екрана: той самий віджет буває на третину й на всю ширину (гайдбук 8.1) */
.dash-body-in { container: dw / inline-size; }
/* (вузький віджет — правило в кінці файла: має стояти ПІСЛЯ .dw-v, інакше та його перебиває) */
.dw-stat { position: relative; display: grid; align-content: start; gap: 4px; min-width: 0; padding: 13px 14px 12px; border-radius: 16px; overflow: hidden; text-align: left; text-decoration: none; color: inherit;
  font: inherit; border: 0; --t: 139, 92, 246; background: rgba(var(--t), .07); box-shadow: inset 0 0 0 1px rgba(var(--t), .14); transition: transform .2s ease, box-shadow .2s ease; }
.dw-stat::after { content: ''; position: absolute; right: -22px; top: -22px; width: 72px; height: 72px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--t), .28), rgba(var(--t), 0) 70%); pointer-events: none; }
html.dark .dw-stat { background: rgba(var(--t), .12); box-shadow: inset 0 0 0 1px rgba(var(--t), .22); }
@media (hover: hover) { a.dw-stat:hover, button.dw-stat:hover { cursor: pointer; transform: translateY(-2px); box-shadow: inset 0 0 0 1px rgba(var(--t), .32), 0 12px 24px -14px rgba(var(--t), .6); } }
.dw-stat[data-t="blue"] { --t: 59, 130, 246; } .dw-stat[data-t="green"] { --t: 34, 197, 94; } .dw-stat[data-t="amber"] { --t: 245, 158, 11; } .dw-stat[data-t="red"] { --t: 239, 68, 68; }
.dw-stat[data-t="indigo"] { --t: 99, 102, 241; } .dw-stat[data-t="sky"] { --t: 14, 165, 233; } .dw-stat[data-t="slate"] { --t: 100, 116, 139; } .dw-stat[data-t="orange"] { --t: 249, 115, 22; } .dw-stat[data-t="pink"] { --t: 236, 72, 153; }
.dw-l { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #4b5563; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.dark .dw-l { color: #9ca3af; }
.dw-v { font-size: 24px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; color: #111827; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.dark .dw-v { color: #f9fafb; }
.dw-v small { margin-left: 3px; font-size: 13px; font-weight: 600; letter-spacing: 0; color: #6b7280; } html.dark .dw-v small { color: #9ca3af; }
.dw-s { font-size: 12px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } html.dark .dw-s { color: #9ca3af; }
.dw-up { color: #1a7d47 !important; } html.dark .dw-up { color: #4ade80 !important; }
.dw-down { color: #b91c1c !important; } html.dark .dw-down { color: #f87171 !important; }
/* велике число з порівнянням (пульс) */
.dw-big { font-size: 30px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; color: #111827; font-variant-numeric: tabular-nums; } html.dark .dw-big { color: #f9fafb; }
.dw-delta { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; color: #4b5563; } html.dark .dw-delta { color: #9ca3af; }
.dw-delta b { display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px; border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dw-delta b.dw-up { background: rgba(34, 197, 94, .12); } .dw-delta b.dw-down { background: rgba(239, 68, 68, .12); }
/* смужки (тарифи, прогрес) */
.dw-bars { display: grid; gap: 10px; }
.dw-bar-h { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; font-size: 12.5px; color: #374151; } html.dark .dw-bar-h { color: #d1d5db; }
.dw-bar-h span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .dw-bar-h b { flex: none; font-variant-numeric: tabular-nums; }
.dw-track { height: 8px; border-radius: 999px; background: rgba(148, 163, 184, .2); overflow: hidden; }
.dw-fill { height: 100%; width: var(--p, 0%); border-radius: inherit; background: linear-gradient(90deg, #a78bfa, #7c3aed); animation: dwFill .9s cubic-bezier(.2, .8, .2, 1) both; }
.dw-fill[data-t="green"] { background: linear-gradient(90deg, #4ade80, #16a34a); } .dw-fill[data-t="amber"] { background: linear-gradient(90deg, #fbbf24, #d97706); } .dw-fill[data-t="red"] { background: linear-gradient(90deg, #f87171, #dc2626); }
.dw-fill[data-t="blue"] { background: linear-gradient(90deg, #60a5fa, #2563eb); } .dw-fill[data-t="pink"] { background: linear-gradient(90deg, #f472b6, #db2777); } .dw-fill[data-t="indigo"] { background: linear-gradient(90deg, #818cf8, #4f46e5); }
.dw-note { margin-top: 6px; font-size: 12px; color: #6b7280; } html.dark .dw-note { color: #9ca3af; }
/* графік-«хвиля» і стовпчики */
.dw-chart { display: block; width: 100%; height: 72px; margin-top: 12px; overflow: visible; }
.dw-months { display: flex; justify-content: space-between; margin-top: 4px; font-size: 10.5px; color: #6b7280; } html.dark .dw-months { color: #9ca3af; }
.dw-legend { display: flex; gap: 12px; margin-top: 10px; font-size: 12px; color: #4b5563; } html.dark .dw-legend { color: #9ca3af; }
.dw-legend i { display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 3px; vertical-align: -1px; }
.dw-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; text-align: center; }
.dw-trio .dw-v { font-size: 26px; } .dw-trio .dw-s { margin-top: 2px; }
/* рядки списку: дзвінки, оплати, номери на АТС */
.dw-list { display: flex; flex-direction: column; margin: -6px -10px; }
.dw-row { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; box-sizing: border-box; padding: 9px 10px; border: 0; border-radius: 12px; background: none; font: inherit; font-size: 13.5px;
  color: #374151; text-align: left; cursor: pointer; transition: background-color .15s ease; }
html.dark .dw-row { color: #e5e7eb; }
@media (hover: hover) { .dw-row:hover { background: rgba(139, 92, 246, .07); } html.dark .dw-row:hover { background: rgba(139, 92, 246, .14); } }
.dw-row-ic { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; font-size: 15px; --t: 139, 92, 246; background: rgba(var(--t), .12); color: rgb(var(--t)); }
.dw-row-ic[data-t="green"] { --t: 22, 163, 74; } .dw-row-ic[data-t="red"] { --t: 220, 38, 38; } .dw-row-ic[data-t="blue"] { --t: 37, 99, 235; } .dw-row-ic[data-t="amber"] { --t: 217, 119, 6; }
.dw-row-ic svg { width: 16px; height: 16px; }
.dw-row-m { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; }
.dw-row-t { font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } html.dark .dw-row-t { color: #f3f4f6; }
.dw-row-s { font-size: 12px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; } html.dark .dw-row-s { color: #9ca3af; }
.dw-row-v { flex: none; font-weight: 700; color: #111827; font-variant-numeric: tabular-nums; text-align: right; } html.dark .dw-row-v { color: #f3f4f6; }
.dw-row-v small { display: block; font-size: 11.5px; font-weight: 500; color: #6b7280; } html.dark .dw-row-v small { color: #9ca3af; }
.dw-ok { flex: none; height: 32px; padding: 0 12px; border: 0; border-radius: 10px; font: inherit; font-size: 12.5px; font-weight: 700; color: #166534; background: #dcfce7; box-shadow: inset 0 0 0 1px #86efac; cursor: pointer; }
html.dark .dw-ok { color: #bbf7d0; background: rgba(22, 101, 52, .35); box-shadow: inset 0 0 0 1px rgba(74, 222, 128, .35); }
@media (hover: hover) { .dw-ok:hover { background: #bbf7d0; } html.dark .dw-ok:hover { background: rgba(22, 101, 52, .55); } }
.dw-empty { display: grid; place-items: center; gap: 4px; padding: 18px 8px; text-align: center; font-size: 13px; color: #6b7280; } html.dark .dw-empty { color: #9ca3af; }
.dw-empty b { font-size: 26px; }
@keyframes dwFill { from { width: 0; } }

/* ── «Менше руху» (системне або вимикач у профілі) ── */
@media (prefers-reduced-motion: reduce) {
  .dash-edit > .dash-w, .dash-bar.is-on, .dash-shelf, .dash-new > .dash-panel, .dash-b-open:hover svg, .dw-fill { animation: none !important; }
  .dash-w.dash-drag { rotate: none; }
  .dash-panel, .dash-body, .dash-head, .dash-ico { transition: none !important; }
}
html.fx-off .dash-edit > .dash-w, html.fx-off .dash-bar.is-on, html.fx-off .dash-shelf, html.fx-off .dash-new > .dash-panel, html.fx-off .dash-b-open:hover svg, html.fx-off .dw-fill { animation: none !important; }
html.fx-off .dash-w.dash-drag { rotate: none; }
html.fx-off .dash-panel, html.fx-off .dash-body, html.fx-off .dash-head, html.fx-off .dash-ico { transition: none !important; }

/* ── Заготовка, поки дані віджета їдуть (кожен віджет вантажить своє) ── */
.dw-skel { display: grid; gap: 10px; }
.dw-skel i { display: block; height: 14px; border-radius: 8px; background: linear-gradient(90deg, rgba(148, 163, 184, .16) 25%, rgba(148, 163, 184, .32) 50%, rgba(148, 163, 184, .16) 75%); background-size: 200% 100%; animation: dwShimmer 1.3s ease-in-out infinite; }
.dw-skel i:nth-child(1) { height: 30px; width: 46%; } .dw-skel i:nth-child(2) { width: 88%; } .dw-skel i:nth-child(3) { width: 72%; } .dw-skel i:nth-child(4) { width: 80%; }
@keyframes dwShimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .dw-skel i { animation: none; } }
html.fx-off .dw-skel i { animation: none; }
.dw-err button { margin-top: 4px; padding: 6px 12px; border: 1px solid #d1d5db; border-radius: 8px; background: #f3f4f6; color: #374151; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
html.dark .dw-err button { border-color: #4b5563; background: rgba(55, 65, 81, .6); color: #e5e7eb; }

/* ── Картка показника з ціллю (гайдбук 8.2): пояснення й «i» → велике число й позначка стану → смуга з рискою цілі → дрібні числа ── */
.dw-kpi-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: -6px; font-size: 12.5px; color: #4b5563; } html.dark .dw-kpi-h { color: #9ca3af; }
.dw-info { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; font-style: normal; line-height: 1; color: #6b7280; cursor: help;
  box-shadow: inset 0 0 0 1px rgba(107, 114, 128, .55); }
.dw-info:hover, .dw-info:focus-visible { color: #6d28d9; box-shadow: inset 0 0 0 1px rgba(124, 58, 237, .7); outline: none; }
html.dark .dw-info { color: #9ca3af; box-shadow: inset 0 0 0 1px rgba(156, 163, 175, .45); } html.dark .dw-info:hover { color: #ddd6fe; box-shadow: inset 0 0 0 1px rgba(196, 181, 253, .7); }
.dw-kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; margin: 10px 0 12px; }
.dw-kv > b { font-size: 30px; line-height: 1.05; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: #111827; white-space: nowrap; }
.dw-kv > b small { font-size: 15px; font-weight: 600; letter-spacing: 0; color: #6b7280; }
html.dark .dw-kv > b { color: #f9fafb; } html.dark .dw-kv > b small { color: #9ca3af; }
.dw-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap;
  --c: 75, 85, 99; color: rgb(var(--c)); background: rgba(var(--c), .11); }
.dw-chip > i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dw-chip[data-tone="ok"] { --c: 4, 120, 87; } .dw-chip[data-tone="warn"] { --c: 180, 83, 9; } .dw-chip[data-tone="bad"] { --c: 185, 28, 28; }
html.dark .dw-chip { --c: 203, 213, 225; background: rgba(var(--c), .14); }
html.dark .dw-chip[data-tone="ok"] { --c: 110, 231, 183; } html.dark .dw-chip[data-tone="warn"] { --c: 252, 211, 77; } html.dark .dw-chip[data-tone="bad"] { --c: 252, 165, 165; }
.dw-meter { position: relative; display: block; height: 8px; border-radius: 4px; background: rgba(148, 163, 184, .28); --c: 148, 163, 184; }
.dw-meter > i { display: block; width: var(--v, 0%); height: 100%; border-radius: 4px; background: rgb(var(--c)); animation: dwFill .9s cubic-bezier(.2, .8, .2, 1) both; }
.dw-meter > u { position: absolute; left: var(--t, 80%); top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: #374151; }
html.dark .dw-meter > u { background: #e5e7eb; }
.dw-meter[data-tone="ok"] { --c: 16, 185, 129; } .dw-meter[data-tone="warn"] { --c: 245, 158, 11; } .dw-meter[data-tone="bad"] { --c: 239, 68, 68; }
.dw-facts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 14px; margin-top: 10px; font-size: 12.5px; line-height: 1.5; color: #6b7280; }
.dw-facts > span { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.dw-facts b { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: #111827; }
html.dark .dw-facts { color: #9ca3af; } html.dark .dw-facts b { color: #f3f4f6; }
.dw-hint { flex: 1 1 100%; font-style: normal; font-size: 12.5px; line-height: 1.4; }
@media (prefers-reduced-motion: reduce) { .dw-meter > i { animation: none; } }
html.fx-off .dw-meter > i { animation: none; }

/* вузький віджет (до 380 px) — менші числа, «грн» переходить під число, а не обрізається. Стоїть останнім: перебиває .dw-v та .dw-kv вище */
@container dw (max-width: 380px) { .dw-v { font-size: 20px; white-space: normal; overflow: visible; } .dw-v small { display: inline-block; font-size: 12px; white-space: nowrap; } .dw-big, .dw-kv > b { font-size: 26px; } }
