/* ============================================================
   Моя печать — Liquid Glass for a 3D-printing workshop.
   Glass is reserved for the control layer (tab bar, top bar,
   toolbar buttons, sheets, toasts). Content sits on calm
   frosted surfaces underneath.
   Targets: iPhone 16 Pro Max (440×956) and MacBook 13" (~1280–1470 wide).
   ============================================================ */

:root {
  color-scheme: light dark;

  /* palette */
  --mist: #E8EDF3;
  --ink: #151923;
  --ink-2: rgba(21, 25, 35, .62);
  --ink-3: rgba(21, 25, 35, .38);
  --cobalt: #2F6BFF;
  --cobalt-soft: rgba(47, 107, 255, .12);
  --green: #1FAF6B;
  --amber: #F5A524;
  --red: #F0475C;
  --violet: #7B61FF;

  /* surfaces */
  --surface: rgba(255, 255, 255, .80);
  --surface-strong: rgba(255, 255, 255, .94);
  --hairline: rgba(21, 25, 35, .08);
  --field: rgba(118, 128, 150, .12);

  /* glass */
  --glass-tint: rgba(255, 255, 255, .22);
  --glass-tint-strong: rgba(255, 255, 255, .55);
  --glass-rim: rgba(255, 255, 255, .85);
  --glass-rim-low: rgba(255, 255, 255, .18);
  --glass-shadow: 0 12px 32px -12px rgba(18, 28, 56, .28), 0 2px 6px -2px rgba(18, 28, 56, .10);
  --glass-blur: 16px;

  /* backdrop blobs (overwritten from spool colours) */
  --blob-1: #2EC4B6;
  --blob-2: #FF5D8F;
  --blob-3: #FFC93C;
  --blob-4: #7B61FF;

  /* type */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* radii — concentric: outer = inner + padding */
  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;

  /* motion */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-move: cubic-bezier(0.645, 0.045, 0.355, 1);
  --ease-swap: cubic-bezier(0.2, 0, 0, 1);
  --d-micro: 140ms;
  --d-ui: 220ms;
  --d-sheet: 320ms;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 66px;
  --gutter: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --mist: #0F1320;
    --ink: #EEF1F7;
    --ink-2: rgba(238, 241, 247, .64);
    --ink-3: rgba(238, 241, 247, .38);
    --cobalt: #5B8CFF;
    --cobalt-soft: rgba(91, 140, 255, .18);
    --surface: rgba(30, 35, 50, .78);
    --surface-strong: rgba(36, 42, 60, .96);
    --hairline: rgba(255, 255, 255, .08);
    --field: rgba(255, 255, 255, .08);
    --glass-tint: rgba(40, 46, 66, .32);
    --glass-tint-strong: rgba(48, 56, 80, .62);
    --glass-rim: rgba(255, 255, 255, .38);
    --glass-rim-low: rgba(255, 255, 255, .06);
    --glass-shadow: 0 14px 36px -12px rgba(0, 0, 0, .6), 0 2px 6px -2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--mist);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- backdrop */

.backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute;
  width: 70vmax; height: 70vmax;
  border-radius: 50%;
  opacity: .55;
  transition: background 1.2s ease;
  animation: drift 48s var(--ease-move) infinite alternate;
}
.blob-1 { top: -30vmax; left: -22vmax; background: radial-gradient(closest-side, var(--blob-1), transparent); }
.blob-2 { top: 10vh; right: -34vmax; background: radial-gradient(closest-side, var(--blob-2), transparent); animation-duration: 56s; animation-delay: -12s; }
.blob-3 { bottom: -38vmax; left: -10vmax; background: radial-gradient(closest-side, var(--blob-3), transparent); animation-duration: 62s; animation-delay: -30s; }
.blob-4 { bottom: -20vmax; right: -30vmax; background: radial-gradient(closest-side, var(--blob-4), transparent); animation-duration: 52s; animation-delay: -6s; }
@media (prefers-color-scheme: dark) { .blob { opacity: .32; } .layers { opacity: .12; } }
.layers {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, transparent 0 3px, rgba(255, 255, 255, .16) 3px 4px);
  mix-blend-mode: overlay;
  opacity: .5;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); }
}
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; transition: none; }
}

/* ---------------------------------------------------------------- glass material */

.glass {
  position: relative;
  isolation: isolate;
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(190%) brightness(1.04);
  backdrop-filter: blur(var(--glass-blur)) saturate(190%) brightness(1.04);
  box-shadow:
    inset 0 1px 0 0 var(--glass-rim),
    inset 0 -1px 0 0 var(--glass-rim-low),
    inset 0 0 0 .5px var(--glass-rim-low),
    var(--glass-shadow);
}
/* specular rim: brighter on the top-left and bottom-right, like light wrapping a lens */
.glass::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255,255,255,.95), rgba(255,255,255,.12) 32%, rgba(255,255,255,0) 55%, rgba(255,255,255,.45) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
  z-index: 1;
}
/* moving highlight that follows the finger / pointer */
.glass::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(120px circle at var(--mx, 30%) var(--my, 0%), rgba(255,255,255,.38), transparent 70%);
  opacity: var(--glow, .55);
  transition: opacity var(--d-ui) ease;
  pointer-events: none;
  z-index: 1;
}
@media (prefers-color-scheme: dark) {
  .glass::before { background: linear-gradient(140deg, rgba(255,255,255,.55), rgba(255,255,255,.06) 32%, rgba(255,255,255,0) 55%, rgba(255,255,255,.22) 100%); }
  .glass::after { background: radial-gradient(120px circle at var(--mx, 30%) var(--my, 0%), rgba(255,255,255,.16), transparent 70%); }
}
.glass > * { position: relative; z-index: 2; }

/* round toolbar button, iOS 26 style */
.gbtn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  color: var(--ink);
  transition: scale var(--d-micro) var(--ease-out);
}
.gbtn:active { scale: .96; }
.gbtn.primary { background: var(--cobalt); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 10px 24px -10px rgba(47,107,255,.7); }
.gbtn.primary::before, .gbtn.primary::after { display: none; }
.gpill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 44px; padding: 0 16px;
  border-radius: 22px;
  font-weight: 600; font-size: 15px;
  transition: scale var(--d-micro) var(--ease-out);
}
.gpill:active { scale: .96; }

/* ---------------------------------------------------------------- app shell */

.app { position: relative; z-index: 1; min-height: 100dvh; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-top) + 6px) var(--gutter) 6px;
}
.topbar-glass {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, var(--mist) 0%, color-mix(in srgb, var(--mist) 70%, transparent) 60%, transparent);
  opacity: 0;
  transition: opacity var(--d-ui) ease;
  -webkit-mask: linear-gradient(#000 70%, transparent);
  mask: linear-gradient(#000 70%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.topbar.scrolled .topbar-glass { opacity: 1; }
.topbar-row { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 48px; gap: 8px; }
.topbar-lead { display: flex; gap: 8px; justify-self: start; }
.topbar-trail { display: flex; gap: 8px; justify-self: end; }
.topbar-title {
  font-weight: 600; font-size: 17px; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw;
  opacity: 0; translate: 0 6px;
  transition: opacity var(--d-ui) var(--ease-out), translate var(--d-ui) var(--ease-out);
}
.topbar.scrolled .topbar-title { opacity: 1; translate: 0 0; }

.view {
  position: relative;
  padding: 0 var(--gutter) calc(var(--tabbar-h) + var(--safe-bottom) + 40px);
  max-width: 720px;
  margin: 0 auto;
  outline: none;
}

.largetitle {
  font-family: var(--font-round);
  font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em;
  margin: 2px 0 4px;
  text-wrap: balance;
}
.subtitle { color: var(--ink-2); font-size: 15px; margin: 0 0 18px; }

/* ---------------------------------------------------------------- tab bar */

.tabbar {
  position: fixed; z-index: 30;
  left: 50%; translate: -50% 0;
  bottom: calc(var(--safe-bottom) + 10px);
  width: min(420px, calc(100% - 24px));
  height: var(--tabbar-h);
  border-radius: 33px;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 4px;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 29px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
  color: var(--ink-2);
  transition: color var(--d-ui) ease;
}
.tab svg { width: 25px; height: 25px; pointer-events: none; }
.tab { -webkit-user-drag: none; }
.tab.active { color: var(--cobalt); }
.tab-lens {
  position: absolute; z-index: 1;
  top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / 5);
  border-radius: 29px;
  background: var(--glass-tint-strong);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 0 0 .5px rgba(255,255,255,.35), 0 4px 14px -6px rgba(18,28,56,.25);
  transform: translateX(var(--lens-x, 0px)) scale(var(--lens-s, 1));
  transition: transform 420ms var(--ease-out), background-color var(--d-ui) ease;
  pointer-events: none;
}
.tabbar.dragging .tab-lens {
  transition: transform 90ms linear;
  --lens-s: 1.16;
  background: rgba(255,255,255,.18);
}
@media (prefers-color-scheme: dark) {
  .tab-lens { box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 0 0 .5px rgba(255,255,255,.12), 0 4px 14px -6px rgba(0,0,0,.5); }
}
@media (prefers-reduced-motion: reduce) {
  .tab-lens, .tabbar.dragging .tab-lens { transition: none; }
}

/* ---------------------------------------------------------------- sections & surfaces */

.section { margin: 26px 0 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 4px 8px; }
.section-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.section-head a, .section-head button { font-size: 15px; color: var(--cobalt); font-weight: 500; }

.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 8px 24px -16px rgba(18,28,56,.25);
}
@media (prefers-color-scheme: dark) { .card { box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 8px 24px -16px rgba(0,0,0,.6); } }
.card-pad { padding: 16px; }

.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 10px 14px 10px 16px;
  position: relative;
  transition: background-color var(--d-micro) ease;
}
.row + .row::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px;
  border-top: .5px solid var(--hairline);
}
a.row:active, button.row:active { background: var(--field); }
button.row { width: 100%; text-align: left; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--ink-2); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.row-price { font-weight: 600; font-variant-numeric: tabular-nums; }
.row .chev { width: 16px; height: 16px; color: var(--ink-3); }
.card > .row:first-child { border-top-left-radius: var(--r-lg); border-top-right-radius: var(--r-lg); }
.card > .row:last-child { border-bottom-left-radius: var(--r-lg); border-bottom-right-radius: var(--r-lg); }

.thumb {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  object-fit: cover; background: var(--field);
  outline: 1px solid rgba(0,0,0,.06); outline-offset: -1px;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--font-round); font-weight: 700; font-size: 15px; color: #fff;
}

/* status dot & badges */
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--field); color: var(--ink-2);
}
.badge.red { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.badge.amber { background: color-mix(in srgb, var(--amber) 18%, transparent); color: color-mix(in srgb, var(--amber) 70%, var(--ink)); }
.badge.green { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.badge.blue { background: var(--cobalt-soft); color: var(--cobalt); }

.s-lead { --c: #8E97A8; } .s-quoted { --c: var(--violet); } .s-approved { --c: var(--cobalt); }
.s-printing { --c: var(--amber); } .s-ready { --c: var(--green); } .s-done { --c: #5E6B80; } .s-cancelled { --c: var(--red); }
.dot[class*="s-"] { background: var(--c); }

/* ---------------------------------------------------------------- dashboard */

.money {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.money-main { grid-column: 1 / -1; padding: 18px 18px 16px; }
.money-label { color: var(--ink-2); font-size: 14px; font-weight: 500; }
.money-big {
  font-family: var(--font-round); font-weight: 700; font-size: 44px; line-height: 1.05; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; margin: 4px 0 2px;
}
.money-mid { font-family: var(--font-round); font-weight: 700; font-size: 24px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.money-note { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.money-tile { padding: 14px 16px; }

.pipeline { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 4px; }
.pipeline::-webkit-scrollbar { display: none; }
.stage {
  flex: none; min-width: 92px;
  padding: 10px 14px 12px; border-radius: 18px;
  background: var(--surface);
  transition: scale var(--d-micro) var(--ease-out);
}
.stage:active { scale: .96; }
.stage-n { font-family: var(--font-round); font-weight: 700; font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stage-l { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.stage-l .dot { width: 8px; height: 8px; }

.due { font-size: 12.5px; font-weight: 600; }
.due.over { color: var(--red); }
.due.today { color: color-mix(in srgb, var(--amber) 75%, var(--ink)); }
.due.soon { color: var(--cobalt); }

.alerts .row svg { color: var(--amber); }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick a {
  display: flex; flex-direction: column; gap: 8px; padding: 14px;
  border-radius: 18px; background: var(--surface); font-weight: 600; font-size: 14.5px;
  transition: scale var(--d-micro) var(--ease-out);
}
.quick a:active { scale: .96; }
.quick svg { color: var(--cobalt); }

/* one orchestrated entrance: dashboard blocks, once per session */
.enter > * {
  opacity: 0; transform: translateY(12px); filter: blur(4px);
  animation: rise 420ms var(--ease-out) forwards;
}
.enter > *:nth-child(2) { animation-delay: 70ms; }
.enter > *:nth-child(3) { animation-delay: 140ms; }
.enter > *:nth-child(4) { animation-delay: 210ms; }
.enter > *:nth-child(5) { animation-delay: 280ms; }
.enter > *:nth-child(n+6) { animation-delay: 330ms; }
@keyframes rise { to { opacity: 1; transform: none; filter: blur(0); } }
@media (prefers-reduced-motion: reduce) {
  .enter > * { animation: none; opacity: 1; transform: none; filter: none; }
}

/* ---------------------------------------------------------------- controls */

.segmented {
  position: relative;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 3px; border-radius: 14px;
  background: var(--field);
}
.segmented button {
  position: relative; z-index: 1;
  height: 34px; border-radius: 11px;
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  transition: color var(--d-ui) ease;
}
.segmented button[aria-pressed="true"] { color: var(--ink); }
.seg-thumb {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px;
  border-radius: 11px;
  background: var(--surface-strong);
  box-shadow: 0 3px 10px -4px rgba(18,28,56,.3), inset 0 .5px 0 rgba(255,255,255,.8);
  transition: transform 340ms var(--ease-out), width 340ms var(--ease-out);
}
@media (prefers-reduced-motion: reduce) { .seg-thumb { transition: none; } }

.search {
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 14px; border-radius: 22px;
  background: var(--field);
  margin: 4px 0 14px;
}
.search svg { width: 18px; height: 18px; color: var(--ink-3); }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; min-width: 0; }
.search input::placeholder { color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 20px; border-radius: 25px;
  font-weight: 600; font-size: 16px;
  background: var(--cobalt); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 10px 24px -12px rgba(47,107,255,.8);
  transition: scale var(--d-micro) var(--ease-out), opacity var(--d-micro) ease;
}
.btn:active { scale: .96; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.block { width: 100%; }
.btn.soft { background: var(--cobalt-soft); color: var(--cobalt); box-shadow: none; }
.btn.plain { background: var(--field); color: var(--ink); box-shadow: none; }
.btn.danger { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); box-shadow: none; }
.btn svg { width: 20px; height: 20px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.action {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 4px 10px; border-radius: 18px;
  background: var(--surface); font-size: 12px; font-weight: 600; color: var(--ink);
  transition: scale var(--d-micro) var(--ease-out);
}
.action:active { scale: .96; }
.action svg { color: var(--cobalt); width: 24px; height: 24px; }

/* forms */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; align-content: start; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); padding-left: 4px; }
.input, .select, .textarea {
  width: 100%; min-height: 48px;
  padding: 12px 14px; border-radius: var(--r-md);
  border: 0; outline: none;
  background: var(--field);
  font-size: 16px;
  transition: box-shadow var(--d-micro) ease;
}
.input:focus, .select:focus, .textarea:focus { box-shadow: 0 0 0 2px var(--cobalt); }
.textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 44px; }
.input-suffix i { position: absolute; right: 14px; top: 50%; translate: 0 -50%; font-style: normal; color: var(--ink-3); font-size: 15px; pointer-events: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 18px;
  background: var(--field); font-size: 14px; font-weight: 600; color: var(--ink-2);
  transition: background-color var(--d-micro) ease, color var(--d-micro) ease, scale var(--d-micro) var(--ease-out);
}
.chip:active { scale: .96; }
.chip[aria-pressed="true"] { background: var(--cobalt); color: #fff; }

.stepper { display: inline-flex; align-items: center; gap: 2px; background: var(--field); border-radius: 18px; padding: 2px; }
.stepper button { width: 34px; height: 32px; border-radius: 16px; display: grid; place-items: center; transition: scale var(--d-micro) var(--ease-out); }
.stepper button:active { scale: .9; background: var(--surface-strong); }
.stepper svg { width: 18px; height: 18px; }
.stepper b { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; font-size: 15px; }

/* ---------------------------------------------------------------- order detail */

.status-track { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; }
.status-track::-webkit-scrollbar { display: none; }
.status-step {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 18px;
  background: var(--surface); font-size: 14px; font-weight: 600; color: var(--ink-2);
  transition: background-color var(--d-ui) ease, color var(--d-ui) ease, scale var(--d-micro) var(--ease-out);
}
.status-step:active { scale: .96; }
.status-step .dot { background: var(--c); opacity: .5; transition: opacity var(--d-ui) ease; }
.status-step.passed .dot { opacity: 1; }
.status-step.current { background: var(--c); color: #fff; }
.status-step.current .dot { background: #fff; opacity: 1; }

.facts { display: grid; grid-template-columns: 1fr 1fr; }
.fact { padding: 12px 16px; position: relative; }
.fact:nth-child(n+3)::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--hairline); }
.fact:nth-child(even)::after { content: ""; position: absolute; top: 12px; bottom: 12px; left: 0; border-left: .5px solid var(--hairline); }
.fact-l { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.fact-v { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.fact-v.pos { color: var(--green); }
.fact-v.neg { color: var(--red); }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--field); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; outline: 1px solid rgba(0,0,0,.06); outline-offset: -1px; border-radius: inherit; }
.photo .badge { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.45); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.photo-add { display: grid; place-items: center; align-content: center; gap: 4px; color: var(--cobalt); font-size: 12.5px; font-weight: 600; border: 1.5px dashed color-mix(in srgb, var(--cobalt) 40%, transparent); background: transparent; }

.timeline { list-style: none; margin: 0; padding: 4px 0; }
.timeline li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 8px 16px; }
.timeline .tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); margin: 7px 0 0 5px; }
.timeline .tl-dot.status { background: var(--cobalt); }
.timeline .tl-dot.payment { background: var(--green); }
.timeline .tl-dot.failure { background: var(--red); }
.timeline .tl-dot.stock { background: var(--amber); }
.timeline .tl-text { font-size: 14.5px; }
.timeline .tl-time { font-size: 12px; color: var(--ink-3); margin-top: 1px; }

.notes { white-space: pre-wrap; font-size: 15px; line-height: 1.5; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }

/* ---------------------------------------------------------------- calculator */

.price-hero { padding: 20px 18px 16px; text-align: left; }
.price-hero .money-big { font-size: 52px; }
.price-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.price-meta b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.bars { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; margin: 14px 0 10px; background: var(--field); }
.bars i { display: block; height: 100%; transition: flex-grow var(--d-ui) var(--ease-move); flex-basis: 0; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 13.5px; }
.legend div { display: flex; align-items: center; gap: 6px; }
.legend .dot { width: 8px; height: 8px; }
.legend b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.time-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* floating price capsule above the tab bar (phones only) */
.calc-float {
  position: fixed; z-index: 25;
  left: 50%; bottom: calc(var(--safe-bottom) + var(--tabbar-h) + 20px);
  display: inline-flex; align-items: baseline; gap: 10px;
  height: 48px; padding: 0 20px; border-radius: 24px;
  font-size: 14px; color: var(--ink-2); font-weight: 600;
  opacity: 0; transform: translate(-50%, 12px) scale(.96);
  pointer-events: none;
  transition: opacity var(--d-ui) var(--ease-out), transform var(--d-ui) var(--ease-out);
}
.calc-float { align-items: center; }
.calc-float b { font-family: var(--font-round); font-size: 22px; color: var(--ink); letter-spacing: -.02em; }
.calc-float.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .calc-float { transition: none; } }

/* ---------------------------------------------------------------- stock */

.spools { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spool {
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  border-radius: var(--r-lg); background: var(--surface); text-align: left;
  transition: scale var(--d-micro) var(--ease-out);
}
.spool:active { scale: .97; }
.spool.empty { opacity: .55; }
.ring {
  --p: 50; --col: #888;
  width: 64px; height: 64px; border-radius: 50%;
  background: conic-gradient(var(--col) calc(var(--p) * 1%), var(--field) 0);
  display: grid; place-items: center;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(21, 25, 35, .10);
}
@media (prefers-color-scheme: dark) { .ring { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); } }
.ring::after { content: ""; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-strong); box-shadow: inset 0 1px 3px rgba(0,0,0,.12); }
.spool-name { font-weight: 650; font-size: 15px; line-height: 1.25; }
.spool-sub { color: var(--ink-2); font-size: 13px; }
.spool-g { font-family: var(--font-round); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 3px; background: var(--field); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.meter i.warn { background: var(--amber); }
.meter i.bad { background: var(--red); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: scale var(--d-micro) var(--ease-out); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--mist), 0 0 0 4px var(--cobalt); }
.swatch:active { scale: .92; }

/* ---------------------------------------------------------------- empty state */

.empty-state { padding: 36px 20px; text-align: center; }
.empty-state svg { width: 44px; height: 44px; color: var(--ink-3); stroke-width: 1.3; }
.empty-state h3 { margin: 10px 0 4px; font-size: 18px; }
.empty-state p { margin: 0 auto 16px; color: var(--ink-2); max-width: 30ch; font-size: 15px; }

/* ---------------------------------------------------------------- sheets */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 14, 26, .32);
  opacity: 0;
  transition: opacity var(--d-sheet) var(--ease-drawer);
}
.sheet {
  position: fixed; z-index: 51;
  left: 0; right: 0; bottom: 0;
  max-height: calc(100dvh - var(--safe-top) - 24px);
  display: flex; flex-direction: column;
  border-radius: 30px 30px 0 0;
  background: var(--surface-strong);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 -20px 50px -20px rgba(10,14,26,.35);
  transform: translateY(100%);
  transition: transform var(--d-sheet) var(--ease-drawer);
  will-change: transform;
}
.sheet.open { transform: translateY(var(--drag, 0px)); }
.sheet-backdrop.open { opacity: 1; }
.sheet.dragging { transition: none; }
.sheet.closing { transition-duration: 240ms; }
.sheet-backdrop.closing { transition-duration: 240ms; }
.sheet-grab { padding: 8px 0 2px; display: grid; place-items: center; touch-action: none; cursor: grab; }
.sheet-grab i { width: 38px; height: 5px; border-radius: 3px; background: var(--ink-3); opacity: .6; }
.sheet-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 2px 12px 8px; touch-action: none; }
.sheet-head h3 { margin: 0; text-align: center; font-size: 17px; font-weight: 650; }
.sheet-head .gbtn { width: 36px; height: 36px; background: var(--field); }
.sheet-head .gbtn svg { width: 18px; height: 18px; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 18px calc(var(--safe-bottom) + 20px); overscroll-behavior: contain; }
@media (prefers-color-scheme: dark) { .sheet { box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 -20px 50px -20px rgba(0,0,0,.6); } }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-backdrop { transition: none; } }

.photo-viewer { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.92); display: grid; place-items: center; opacity: 0; transition: opacity var(--d-ui) var(--ease-out); }
.photo-viewer.open { opacity: 1; }
.photo-viewer img { max-width: 100%; max-height: 82dvh; object-fit: contain; }
.photo-viewer .pv-bar { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 18px); display: flex; justify-content: center; gap: 12px; }
.photo-viewer .gpill { color: #fff; }

/* ---------------------------------------------------------------- toast */

.toast-host { position: fixed; z-index: 70; top: calc(var(--safe-top) + 10px); left: 0; right: 0; display: grid; justify-items: center; pointer-events: none; }
.toast {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 22px;
  font-weight: 600; font-size: 15px;
  opacity: 0; transform: translateY(-14px) scale(.96);
  transition: opacity var(--d-ui) var(--ease-out), transform var(--d-ui) var(--ease-out);
}
.toast.show { opacity: 1; transform: none; }
.toast.hide { opacity: 0; transform: translateY(-12px); transition-duration: 160ms; }
.toast svg { width: 18px; height: 18px; color: var(--green); }
.toast.error svg { color: var(--red); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------------------------------------------------------------- push transition */

.view.push-in { animation: push-in 300ms var(--ease-out); }
.view.pop-in { animation: pop-in 260ms var(--ease-out); }
.view.fade-in { animation: fade-in 160ms ease-out; }
@keyframes push-in { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .view.push-in, .view.pop-in, .view.fade-in { animation: none; } }

/* ---------------------------------------------------------------- login */

.login { position: relative; z-index: 2; min-height: 100dvh; display: grid; place-items: center; padding: 24px var(--gutter) calc(var(--safe-bottom) + 24px); }
.login-card { width: min(400px, 100%); padding: 28px 22px 22px; border-radius: 32px; }
.login-mark { width: 64px; height: 64px; border-radius: 15px; display: block; margin-bottom: 18px; object-fit: cover; box-shadow: 0 8px 20px -8px rgba(47,107,255,.6), inset 0 0 0 .5px rgba(255,255,255,.4); }
.login h1 { font-family: var(--font-round); font-size: 30px; line-height: 1.1; letter-spacing: -.02em; margin: 0 0 6px; }
.login p { margin: 0 0 20px; color: var(--ink-2); }
.login .input { background: var(--glass-tint-strong); }
.login-error { color: var(--red); font-size: 14px; min-height: 20px; margin: 8px 0 4px; }
.shake { animation: shake 360ms var(--ease-move); }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }

.skeleton { height: 64px; border-radius: var(--r-lg); background: var(--surface); opacity: .6; margin-top: 10px; }

/* ================================================================
   MacBook 13" and wider: glass rail on the left, two-column content,
   sheets become centred dialogs.
   ================================================================ */
@media (min-width: 960px) {
  :root { --gutter: 32px; }
  .app { padding-left: 120px; }
  .view { max-width: 1120px; padding-bottom: 60px; }
  .topbar { max-width: 1120px; margin: 0 auto; }
  .largetitle { font-size: 40px; }

  .tabbar {
    left: 20px; top: 50%; bottom: auto;
    translate: 0 -50%;
    width: 84px; height: auto;
    grid-template-columns: 1fr; grid-auto-rows: 74px;
    border-radius: 34px; padding: 5px;
  }
  .tab { border-radius: 29px; font-size: 11px; }
  .tab-lens {
    top: 5px; left: 5px; right: 5px; bottom: auto;
    width: auto; height: 74px;
    transform: translateY(var(--lens-y, 0px)) scale(var(--lens-s, 1));
  }
  .tab:hover { color: var(--ink); }
  .tab.active:hover { color: var(--cobalt); }

  .desk-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 0 28px; align-items: start; }
  .desk-2 > .section:first-child, .desk-2 > div > .section:first-child { margin-top: 26px; }
  .money { grid-template-columns: repeat(3, 1fr); }
  .money-main { grid-column: 1 / -1; }
  .spools { grid-template-columns: repeat(4, 1fr); }
  .photos { grid-template-columns: repeat(4, 1fr); }
  .actions { grid-template-columns: repeat(4, 1fr); }
  .list-cols { columns: 2; column-gap: 20px; }

  .sheet {
    left: 50%; right: auto; top: 50%; bottom: auto;
    width: min(560px, calc(100vw - 80px));
    max-height: min(820px, calc(100dvh - 80px));
    border-radius: 30px;
    transform: translate(-50%, calc(-50% + 24px)) scale(.97);
    opacity: 0;
    transition: transform 260ms var(--ease-out), opacity 200ms var(--ease-out);
  }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; }
  .sheet.closing { transition-duration: 160ms; }
  .sheet-grab { display: none; }
  .calc-float { display: none; }
  .sheet-head { padding-top: 14px; }
  .sheet-body { padding-bottom: 22px; }

  @media (hover: hover) and (pointer: fine) {
    a.row:hover, button.row:hover { background: var(--field); }
    .stage:hover, .quick a:hover, .action:hover, .spool:hover { background: var(--surface-strong); }
  }
}
