/* Пружинные компоненты (motion.js, springselect.js): набор DesignBookmark, цвета и скругления Хасана. */

/* ——— Loading to success: кнопка отправки ——— */
.btn.ls { position: relative; overflow: hidden; white-space: nowrap; justify-content: center; }
.ls-txt { display: inline-flex; align-items: center; justify-content: center; gap: 8px; will-change: transform, opacity; }
.ls-spin {
  position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 10%, var(--on-accent) 85%, transparent 85%);
  -webkit-mask: radial-gradient(circle closest-side, transparent 66%, #000 70%); mask: radial-gradient(circle closest-side, transparent 66%, #000 70%);
  opacity: 0; pointer-events: none; will-change: transform, opacity;
}
.ls-done {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 14px;
  color: #fff; font-weight: 650; opacity: 0; pointer-events: none; white-space: nowrap; will-change: transform, opacity;
}
.ls-done svg { width: 18px; height: 18px; flex: none; }
.ls-done b { font-weight: 650; }

/* ——— Morph island: живой статус под шапкой ——— */
.mi {
  position: fixed; left: 50%; top: 72px; z-index: 70;
  width: 44px; height: 14px; border-radius: 7px; overflow: hidden; cursor: pointer;
  background: var(--mi-bg, #2A313B); color: #F4F6F8;
  box-shadow: 0 10px 30px rgba(11, 11, 11, .22);
  transform: translateX(-50%); will-change: width, height, transform, opacity;
  -webkit-tap-highlight-color: transparent;
}
.mi[hidden] { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mi { --mi-bg: #3A4350; } }
:root[data-theme="dark"] .mi { --mi-bg: #3A4350; }
.mi-c {
  position: absolute; left: 50%; top: 50%; display: flex; align-items: center; gap: 10px; width: max-content;
  opacity: 0; filter: blur(6px); transform: translate(-50%, -50%) scale(.9);
  transition: opacity .14s ease, filter .14s ease, transform .2s ease; pointer-events: none;
}
.mi-c.on { opacity: 1; filter: none; transform: translate(-50%, -50%) scale(1); transition: opacity .35s ease .09s, filter .35s ease .09s, transform .6s cubic-bezier(.16, 1, .3, 1) .09s; }
.mi-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #4ADE80; }
.mi-c.warn .mi-dot { background: #FBBF24; }
.mi-c.bad .mi-dot { background: #F87171; }
.mi-t { display: grid; gap: 1px; min-width: 0; }
.mi-t b { font-size: 14.5px; font-weight: 650; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-t small { font-size: 12.5px; line-height: 1.3; color: rgba(244, 246, 248, .72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ——— Undo button: «Вернуть порции» с убывающим кольцом ——— */
.btn.undo { gap: 8px; }
.undo-ring { position: relative; width: 20px; height: 20px; flex: none; display: grid; place-items: center; }
.undo-ring i {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(currentColor var(--undo-p, 360deg), color-mix(in srgb, currentColor 18%, transparent) 0);
  -webkit-mask: radial-gradient(circle closest-side, transparent 72%, #000 76%); mask: radial-gradient(circle closest-side, transparent 72%, #000 76%);
  animation: undo-drain var(--undo-ms, 6000ms) linear forwards;
}
.undo-ring b { font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
@property --undo-p { syntax: '<angle>'; inherits: false; initial-value: 360deg; }
@keyframes undo-drain { from { --undo-p: 360deg; } to { --undo-p: 0deg; } }
@media (prefers-reduced-motion: reduce) { .undo-ring i { animation: none; } }

/* ——— Toggle switch: во время пружины ручку двигают --kx и --kw из motion.js ——— */
.switch input + .track.sp::after,
.switch input:checked + .track.sp::after { transition: none; transform: translateX(var(--kx, 0px)); width: calc(19px + var(--kw, 0px)); border-radius: 999px; }

/* ——— Раскрытие панели «Документы» пружиной высоты ——— */
.dm-box.sp { display: block; overflow: hidden; transition: none; }

/* ——— Goo thinking: помощник думает ——— */
.ag-ai.ag-goo { position: relative; width: 64px; height: 40px; padding: 0; overflow: hidden; }
.ag-goo .goo { position: absolute; inset: 0; filter: url(#kh-goo); }
.ag-goo .goo i { position: absolute; left: 0; top: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); will-change: transform; transform: translate(19px, 15.5px); }
.ag-goo .goo i:nth-child(2) { transform: translate(32px, 15.5px); }
.ag-goo .goo i:nth-child(3) { transform: translate(45px, 15.5px); }

/* ——— Step progress: дорожка шагов в карточке заявки ———
 * Точки стоят на долях ширины (0, 1/3, 2/3, 1), линия идёт от первой точки к последней. */
.osteps { --st-done: var(--good); position: relative; display: block; height: 31px; margin: 10px 0 2px; max-width: 420px; }
.osteps::before { content: ""; position: absolute; left: 4px; right: 4px; top: 4px; height: 2px; border-radius: 1px; background: var(--line); }
.osteps .st-bar { position: absolute; left: 4px; top: 4px; height: 2px; border-radius: 1px; background: var(--st-done); width: 0; will-change: width; }
.osteps .st { position: absolute; top: 0; display: grid; gap: 5px; justify-items: center; transform: translateX(-50%); white-space: nowrap; font-size: 11.5px; line-height: 1.2; color: var(--ink-3); }
.osteps .st:first-of-type { transform: none; justify-items: start; }
.osteps .st:last-child { transform: translateX(-100%); justify-items: end; }
.osteps .st::before { content: ""; width: 10px; height: 10px; box-sizing: border-box; border-radius: 50%; background: var(--surface); border: 2px solid var(--surface-3); position: relative; z-index: 1; will-change: transform; transform: scale(var(--st-pop, 1)); }
.osteps .st.done { color: var(--ink-2); }
.osteps .st.done::before { background: var(--st-done); border-color: var(--st-done); }
.osteps .st.cur { color: var(--ink); font-weight: 600; }
.osteps .st.cur::before { border-color: var(--accent); background: var(--accent); }
.osteps .st.wait { color: var(--warning-ink); font-weight: 600; }
.osteps .st.wait::before { border-color: var(--warning); background: var(--warning); }

/* Отметки заявки текстом, без плашек: цвет несёт смысл (правило Игоря про чипы). */
.order-item .item-meta .badge { background: none; border: 0; padding: 0; border-radius: 0; font-weight: 560; }
.order-item .item-meta .badge::before { content: "·"; margin: 0 5px 0 2px; color: var(--ink-3); font-weight: 400; }
.order-item .item-meta .badge.serious { color: var(--serious-ink); }
.order-item .item-meta .badge.warning { color: var(--warning-ink); }
.order-item .item-meta .badge.off { color: var(--ink-3); }

/* ——— Spring dropdown ——— */
.ss-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; clip-path: inset(50%); }
.ss-trig {
  position: relative; display: inline-flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14.5px; text-align: left; cursor: pointer; will-change: transform; -webkit-tap-highlight-color: transparent;
}
.ss-trig:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ss-val { position: relative; flex: 1; min-width: 0; height: 22px; overflow: hidden; }
.ss-slot { position: absolute; inset: 0; display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; will-change: transform, opacity; }
.ss-chev { width: 16px; height: 16px; flex: none; color: var(--ink-3); will-change: transform; }
.ss-menu {
  position: fixed; z-index: 90; height: 0; padding: 6px; border-radius: var(--radius); overflow: hidden; box-sizing: border-box;
  background: var(--surface); box-shadow: var(--shadow-2); border: 1px solid var(--line-soft, var(--line));
  transform-origin: 50% 0; visibility: hidden; will-change: transform, height, opacity;
}
.ss-menu.up { transform-origin: 50% 100%; }
.ss-opt {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 12px; border-radius: var(--radius-sm);
  color: var(--ink); font-size: 14.5px; cursor: pointer; opacity: 0; will-change: transform, opacity; white-space: nowrap;
}
.ss-opt span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ss-tick { width: 16px; height: 16px; flex: none; color: var(--accent); }
.ss-tick path { stroke-dasharray: 22; stroke-dashoffset: 22; }
.ss-hl { position: absolute; left: 6px; right: 6px; top: 0; border-radius: var(--radius-sm); background: var(--surface-2, rgba(0, 0, 0, .05)); opacity: 0; pointer-events: none; will-change: transform, height; }

/* Кнопка списка повторяет размеры прежних полей там, где они стояли. */
.report-bar .ss-trig { flex: 1 1 200px; width: auto; min-width: 0; height: 34px; min-height: 34px; border-radius: 9px; padding: 0 8px 0 10px; font-size: 14px; }
.report-bar #report-format + .ss-trig { flex: 0 0 auto; width: auto; min-width: 86px; }
.report-bar #report-format + .ss-trig .ss-val { min-width: 44px; }
.order-tools .ss-trig { height: 32px; min-height: 32px; border-radius: 8px; padding: 0 6px 0 8px; font-size: 13px; color: var(--ink); }
/* Дорожка под строкой карточки, на всю её ширину, с теми же отступами, что у строки. */
.order-item > .osteps { align-self: stretch; margin: 4px 12px 8px; max-width: none; }
