/*
  Vyruchai design tokens — Bento UI
  Soft tile grid × Ozon-blue accent
*/

:root,
html[data-theme="light"] {
  --accent: #005bff;
  --accent-hover: #0046d4;
  --accent-pressed: #003bb3;
  --accent-soft: rgba(0, 91, 255, 0.1);
  --accent-glow: rgba(0, 91, 255, 0.22);
  --ink: #0b1728;
  --ink-muted: #5b6b82;
  --ink-faint: #8a98ae;
  --line: rgba(11, 35, 70, 0.07);
  --line-strong: rgba(11, 35, 70, 0.12);
  --surface: #ffffff;
  --surface-2: #f3f6fb;
  --surface-3: #e8eef8;
  --surface-ink: #0f172a;
  --surface-ink-muted: rgba(255, 255, 255, 0.62);
  --danger: #e11d48;
  --danger-soft: #fff1f4;
  --success: #0f9f6e;
  --success-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --shadow: 0 18px 48px rgba(15, 40, 90, 0.1);
  --shadow-sm: 0 8px 24px rgba(15, 40, 90, 0.06);
  --radius: 28px;
  --radius-sm: 18px;
  --radius-xs: 14px;
  --radius-tile: 28px;
  --header-h: 76px;
  --content-w: 1040px;
  --sidebar-w: 268px;
  --header-w: 960px;
  --bento-gap: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --font: "Onest", sans-serif;
  --bg-base: #e9eef8;
  --bg-glow-a: #c5dbff;
  --bg-glow-b: #dde7ff;
  --login-brand: #ffffff;
  --login-ink: #d7e4ff;
  --chrome: rgba(255, 255, 255, 0.78);
  --ink-on-accent: #ffffff;
  --scrim: color-mix(in srgb, #0f172a 46%, transparent);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 140ms;
  --dur: 200ms;
  --dur-slow: 320ms;
}

html[data-theme="dark"] {
  --accent: #4b93ff;
  --accent-hover: #6aa5ff;
  --accent-pressed: #3d82eb;
  --accent-soft: rgba(75, 147, 255, 0.14);
  --accent-glow: rgba(75, 147, 255, 0.28);
  --ink: #e8eef9;
  --ink-muted: #9aabc4;
  --ink-faint: #6e809c;
  --line: rgba(180, 205, 255, 0.08);
  --line-strong: rgba(180, 205, 255, 0.16);
  --surface: #141e30;
  --surface-2: #0c1422;
  --surface-3: #1a263c;
  --surface-ink: #08101c;
  --surface-ink-muted: rgba(232, 238, 249, 0.58);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.12);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.32);
  --bg-base: #070d18;
  --bg-glow-a: #14305c;
  --bg-glow-b: #0d1c38;
  --login-brand: #ffffff;
  --login-ink: #c9d7f5;
  --chrome: rgba(12, 18, 30, 0.72);
  --ink-on-accent: #ffffff;
  --scrim: color-mix(in srgb, #020617 55%, transparent);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(920px 520px at 8% -10%, var(--bg-glow-a) 0%, transparent 58%),
    radial-gradient(780px 460px at 96% 4%, var(--bg-glow-b) 0%, transparent 52%),
    radial-gradient(640px 380px at 50% 100%, color-mix(in srgb, var(--accent) 12%, transparent) 0%, transparent 60%),
    linear-gradient(165deg, var(--bg-base) 0%, var(--surface-2) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

/* ——— Shell ——— */

.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--bento-gap);
  padding: var(--bento-gap);
}

.app-sidebar {
  width: var(--sidebar-w);
  min-height: calc(100dvh - (var(--bento-gap) * 2));
  position: sticky;
  top: var(--bento-gap);
  align-self: start;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--space-5);
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-tile);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px) saturate(1.1);
  box-shadow: var(--shadow-sm);
  transition: width var(--dur) var(--ease), padding var(--dur) var(--ease);
}

.app-sidebar.is-collapsed {
  width: 92px;
  padding: var(--space-4) 14px;
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.sidebar-brand {
  min-width: 0;
}

.sidebar-brand .brand-name {
  font-size: 20px;
}

.app-sidebar.is-collapsed .brand-name,
.app-sidebar.is-collapsed .sidebar-link-text,
.app-sidebar.is-collapsed .sidebar-section-label,
.app-sidebar.is-collapsed .sidebar-account-copy {
  display: none;
}

.app-sidebar.is-collapsed .sidebar-brand-row {
  flex-direction: column;
  gap: 10px;
}

.app-sidebar.is-collapsed .sidebar-toggle {
  width: 44px;
  height: 44px;
  margin-inline: auto;
}

.app-sidebar.is-collapsed .sidebar-nav,
.app-sidebar.is-collapsed .sidebar-footer {
  justify-items: center;
}

.app-sidebar.is-collapsed .sidebar-link,
.app-sidebar.is-collapsed .sidebar-link-button {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  justify-content: center;
  gap: 0;
  border-radius: 14px;
  aspect-ratio: 1;
}

.app-sidebar.is-collapsed .sidebar-account {
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
  border-radius: 14px;
}

.app-sidebar.is-collapsed .sidebar-account-avatar {
  width: 32px;
  height: 32px;
}

.icon-btn.sidebar-drawer-close,
.icon-btn.topbar-menu-btn {
  display: none;
}

.sidebar-nav,
.sidebar-footer {
  display: grid;
  gap: 6px;
  align-content: start;
}

.sidebar-footer {
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  gap: 10px;
}

.sidebar-section-label {
  margin: 0 0 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.sidebar-link,
.sidebar-link-button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  text-decoration: none;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 16px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
  box-sizing: border-box;
}

.sidebar-link:hover,
.sidebar-link-button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-link.active {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

.sidebar-link.active .sidebar-link-icon {
  color: inherit;
}

.sidebar-link-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: inherit;
}

.sidebar-link-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-theme-btn .theme-icon-sun,
.topbar-theme-btn .theme-icon-moon {
  display: none;
}

html:not([data-theme="dark"]) .topbar-theme-btn .theme-icon-moon { display: grid; }
html[data-theme="dark"] .topbar-theme-btn .theme-icon-sun { display: grid; }

.sidebar-account {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-decoration: none;
  color: inherit;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}

.sidebar-account:hover {
  background: var(--accent-soft);
  border-color: transparent;
}

.sidebar-account-avatar {
  width: 40px;
  height: 40px;
}

.sidebar-account-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sidebar-account-name {
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
}

.sidebar-backdrop {
  display: none;
}

.app-main-column {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: var(--bento-gap);
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 72px;
  padding: 10px 6px 4px;
}

.topbar-leading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-copy {
  min-width: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent-hover), var(--accent) 55%, var(--accent-pressed));
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 10px 22px var(--accent-glow);
  flex: 0 0 auto;
}

.brand-logo {
  display: grid;
  place-items: center;
  color: var(--accent);
  line-height: 0;
}

.brand-logo svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-mark .brand-logo {
  width: 26px;
  height: 26px;
  color: #fff;
}

.brand-logo-standalone {
  width: 48px;
  height: 48px;
  color: var(--accent);
}

.brand-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-muted);
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
  padding: 0;
}

.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.icon-btn:active {
  transform: scale(0.96);
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-icon-fill svg {
  fill: currentColor;
  stroke: none;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 260px;
  min-height: 48px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}

.profile-chip:hover {
  background: var(--accent-soft);
  border-color: transparent;
}

.profile-chip-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chip-caret {
  width: 16px;
  height: 16px;
  color: var(--ink-faint);
  display: grid;
  place-items: center;
}

.profile-chip-caret svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.avatar {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--line);
}

.avatar-lg {
  width: 72px;
  height: 72px;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}

.avatar-lg.avatar-fallback {
  font-size: 20px;
}

/* City chip — date-picker style */
.city-chip {
  position: relative;
  z-index: 30;
}

.city-chip-trigger {
  appearance: none;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  min-height: 48px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}

.city-chip-trigger:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.city-chip-trigger:disabled {
  opacity: 0.65;
  cursor: wait;
}

.city-chip-icon,
.city-chip-caret {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: var(--accent);
  flex: 0 0 auto;
}

.city-chip-icon svg,
.city-chip-caret svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.city-chip-icon svg {
  fill: color-mix(in srgb, var(--accent) 18%, transparent);
}

.city-chip-label {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city-chip.is-open .city-chip-caret {
  transform: rotate(180deg);
}

.city-chip-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  margin: 0;
  padding: 8px;
  list-style: none;
  min-width: 240px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: combo-in var(--dur) var(--ease);
}

.city-chip-dismiss {
  z-index: 35;
}

.app-main {
  min-width: 0;
  padding: 0 2px var(--space-4);
}

.app-page {
  width: min(var(--content-w), 100%);
  margin: 0;
  display: grid;
  gap: var(--bento-gap);
  animation: rise var(--dur-slow) var(--ease);
}

.app-page:has(.workbench),
.app-page:has(.analytics-root) {
  width: 100%;
  max-width: none;
}

.page-title {
  margin: 0;
  font-size: clamp(28px, 3.6vw, 38px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.45;
  max-width: 42ch;
}

/* ——— Panel / Bento tile ——— */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-tile);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: var(--shadow-sm);
}

.panel-ink {
  border-color: transparent;
  background: linear-gradient(155deg, var(--surface-ink) 0%, color-mix(in srgb, var(--accent-pressed) 55%, #050b16) 100%);
  color: #fff;
  box-shadow: 0 18px 40px var(--accent-glow);
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--bento-gap);
  align-items: start;
}

.bento-span-12 { grid-column: span 12; }
.bento-span-8 { grid-column: span 8; }
.bento-span-7 { grid-column: span 7; }
.bento-span-6 { grid-column: span 6; }
.bento-span-5 { grid-column: span 5; }
.bento-span-4 { grid-column: span 4; }

/* ——— Login ——— */

.login-layout,
.login-screen {
  min-height: 100dvh;
}

.login-screen {
  position: relative;
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vw, 72px);
  overflow: hidden;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(125deg, rgba(0, 18, 55, 0.72) 0%, rgba(0, 50, 130, 0.34) 45%, rgba(0, 91, 255, 0.42) 100%),
    linear-gradient(165deg, #001029 0%, #002f96 50%, #005bff 100%);
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(42px);
  opacity: 0.55;
  animation: login-glow 9s ease-in-out infinite alternate;
  will-change: transform, filter;
}

.login-orb-a {
  width: min(52vw, 420px);
  height: min(52vw, 420px);
  top: -8%;
  right: -6%;
  background: #5ea1ff;
}

.login-orb-b {
  width: min(40vw, 320px);
  height: min(40vw, 320px);
  bottom: 8%;
  left: -8%;
  background: #1a56d6;
  animation-delay: -3s;
}

.login-content {
  position: relative;
  z-index: 1;
  max-width: 520px;
  width: min(520px, 100%);
  display: grid;
  gap: 14px;
  padding: clamp(28px, 5vw, 40px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-tile);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(22px) saturate(1.2);
  box-shadow: 0 24px 60px rgba(0, 16, 64, 0.28);
  animation: rise 0.5s var(--ease);
}

.login-brand {
  margin: 0;
  font-size: clamp(36px, 8vw, 56px);
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 0.92;
  color: var(--login-brand);
  text-shadow: 0 16px 48px rgba(0, 16, 64, 0.35);
}

.login-brand-row {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 18px);
}

.brand-logo-login {
  width: clamp(48px, 9vw, 72px);
  height: clamp(48px, 9vw, 72px);
  color: #fff;
  flex: 0 0 auto;
  filter: drop-shadow(0 10px 24px rgba(0, 16, 64, 0.35));
}

.login-headline {
  margin: 0;
  font-size: clamp(22px, 3.4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  max-width: 18ch;
}

.login-lead {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--login-ink);
  max-width: 34ch;
}

.login-error {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: #fecdd3;
  max-width: 34ch;
}

.btn-login {
  width: fit-content;
  min-width: 240px;
  margin-top: 10px;
}

.btn-arrow {
  font-size: 18px;
  line-height: 1;
  transition: transform var(--dur) var(--ease);
}

.btn-login:hover .btn-arrow {
  transform: translateX(3px);
}

/* ——— Workbench ——— */

.workbench {
  display: grid;
  gap: var(--bento-gap);
}

.workbench.bento-grid {
  align-items: stretch;
}

.search-panel {
  position: relative;
  z-index: 10;
  padding: var(--space-6);
  align-self: stretch;
  height: 100%;
}

.search-panel.is-open {
  z-index: 60;
  /* backdrop-filter creates a clipping containing block in WebKit */
  overflow: visible;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 8%, transparent) 0%, transparent 42%),
    var(--surface);
}

.search-bento {
  padding: 0;
  overflow: visible;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 8%, transparent) 0%, transparent 42%),
    color-mix(in srgb, var(--surface) 94%, transparent);
}

.search-bento-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--line);
}

.search-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.search-heading {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 24px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.search-bento-note {
  margin: 0;
  max-width: 16ch;
  text-align: right;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.search-bento .sku-catalog-hint {
  margin: var(--space-4) var(--space-5) 0;
}

.search-bento-form {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.search-bento-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.search-field-tile {
  display: grid;
  gap: 10px;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  position: relative;
  z-index: 1;
  overflow: visible;
}

.search-panel.is-open .search-field-tile:has(.combo.is-open) {
  z-index: 2;
}

.search-bento-cta {
  display: flex;
  justify-content: stretch;
}

.btn-search-cta {
  width: 100%;
  min-width: 0;
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 28px var(--accent-glow);
}

.result-aside-tile {
  display: grid;
  gap: var(--space-3);
  align-content: start;
  height: 100%;
  min-height: 100%;
  padding: var(--space-5);
}

.result-aside-tile .result-kicker {
  margin: 0;
}

.result-aside-tile .result-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.result-column {
  display: grid;
  min-width: 0;
  min-height: 100%;
  align-self: stretch;
}

.result-stack {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: var(--bento-gap);
  min-height: 100%;
  height: 100%;
}



.search-panel-head {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--line);
}

.city-control {
  position: relative;
  z-index: 20;
  display: grid;
  gap: var(--space-2);
}

.city-control.is-open {
  z-index: 50;
}

.city-control-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

.city-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.section-lead {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.empty-state {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: var(--space-3) 0 var(--space-2);
}

.empty-state .btn {
  margin-top: 6px;
}

.empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 2px;
}

.empty-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ——— Settings ——— */

.settings-root.bento-grid {
  align-items: start;
  max-width: 720px;
  gap: var(--space-4);
}

.settings-panel {
  position: relative;
  z-index: 1;
  padding: var(--space-5) var(--space-6);
  animation: rise var(--dur-slow) var(--ease);
}

.settings-panel.is-open {
  z-index: 40;
  overflow: visible;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--surface);
}

.settings-skel-profile {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-4);
  align-items: center;
}

.settings-profile {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-4) var(--space-5);
  align-items: center;
}

.settings-profile-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.settings-profile-name {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 24px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.settings-profile-email,
.settings-profile-hint {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}

.settings-profile-hint {
  color: var(--ink-faint);
}

.settings-row-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.settings-row-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.settings-row-head-aside {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.settings-panel .form-grid {
  gap: 12px;
}

@media (min-width: 640px) {
  .settings-panel .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .settings-panel .form-grid > .field:first-child {
    grid-column: 1 / -1;
  }
}

.credential-block {
  display: grid;
  gap: 6px;
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
}

.menu-wrap {
  position: relative;
  justify-self: end;
}

.menu-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 2px;
}

.menu-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: block;
  width: 100%;
}

.menu-item:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
}

.menu-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.menu-item-danger {
  color: var(--danger);
}

.menu-item-danger:hover:not(:disabled) {
  background: var(--danger-soft);
  color: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: var(--scrim);
}

.settings-root > .modal-backdrop {
  grid-column: 1 / -1;
}

.modal-card {
  width: min(100%, 420px);
  padding: var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius-tile);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.modal-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.settings-row-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.settings-actions {
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.theme-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-3);
}

.theme-option {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 16px;
  min-height: 40px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}

.theme-option:hover {
  color: var(--accent);
}

.theme-option.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.credential-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.credential-meta {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* ——— Status ——— */

.status-pill,
.status-chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  min-height: 32px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill,
.badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-pill.is-busy,
.badge.is-busy {
  color: var(--warn);
  background: var(--warn-soft);
}

.status-pill.is-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-pill.is-ok::before,
.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
}

.status-pill.is-busy::before,
.badge.is-busy::before {
  animation: pulse 1s ease-in-out infinite;
}

.status-chip.is-ready {
  background: var(--success-soft);
  color: var(--success);
}

.status-chip.is-needed {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-chip.is-idle {
  background: var(--surface-3);
  color: var(--ink-muted);
}

/* ——— Forms ——— */

.label,
.field-label {
  display: block;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}

.form-grid {
  display: grid;
  gap: 14px;
}

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

.field-head .label {
  margin: 0;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-3);
}

.segmented-option {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  min-height: 32px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}

.segmented-option:hover:not(:disabled) {
  color: var(--accent);
}

.segmented-option.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.segmented-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sku-catalog-hint {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.banner-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.banner-link:hover {
  text-decoration: underline;
}

.combo {
  position: relative;
}

.combo.is-open {
  z-index: 70;
}

.combo-input,
.field-input {
  width: 100%;
  min-height: 48px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background-color: var(--surface-2);
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background-color var(--dur-fast);
}

.combo-input {
  padding-right: 44px;
  font-weight: 600;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23005BFF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.5 L6 8 L9.5 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 12px;
  cursor: pointer;
  caret-color: transparent;
  user-select: none;
}

html[data-theme="dark"] .combo-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%234b93ff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.5 L6 8 L9.5 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 12px;
}

.field-input {
  font-weight: 500;
}

.field-input.is-masked {
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}

.combo-input:focus,
.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  background-color: var(--surface);
}

.combo-input:disabled,
.field-input:disabled {
  opacity: 0.55;
  cursor: wait;
}

.combo-input::placeholder,
.field-input::placeholder {
  color: var(--ink-faint);
  font-weight: 500;
}

.combo-list {
  display: none;
  position: absolute;
  z-index: 80;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  transform-origin: top center;
  animation: combo-in var(--dur) var(--ease);
}

.combo.is-open .combo-list {
  display: block;
}

.combo-dismiss {
  appearance: none;
  -webkit-appearance: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  background-color: transparent;
  box-shadow: none;
  opacity: 0;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.combo-list.product-list {
  max-height: min(340px, 42vh);
}

.combo-option {
  padding: 10px 12px;
  min-height: 44px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background var(--dur-fast), color var(--dur-fast);
}

.combo-option:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.combo-option.is-selected {
  background: var(--accent-soft);
}

.combo-option.product-option {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
}

.combo-option.product-option:hover {
  color: inherit;
}

.product-thumb {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--line);
}

.product-thumb.is-empty {
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
}

.product-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.product-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-sku {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.combo-empty {
  padding: 12px;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
}

/* ——— Buttons ——— */

.actions {
  display: flex;
}

.actions.settings-actions {
  margin-top: 20px;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  transition: background var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast), color var(--dur-fast);
  text-decoration: none;
}

.btn-primary {
  flex: 1;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 24px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  background: var(--accent-pressed);
  transform: translateY(0);
}

.btn-inline {
  flex: 0 0 auto;
  width: fit-content;
}

.btn-secondary,
.btn-ghost {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-muted);
}

.btn-secondary:hover:not(:disabled),
.btn-ghost:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 12px 24px color-mix(in srgb, var(--danger) 28%, transparent);
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(0.92);
  transform: translateY(-1px);
}

.btn-danger:active:not(:disabled) {
  filter: brightness(0.86);
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ——— Result (Bento) ——— */

.result-position-tile,
.result-meta-tile,
.result-idle-tile,
.result-loading-tile,
.result-error-tile {
  padding: var(--space-6);
  animation: result-in var(--dur-slow) var(--ease);
  min-height: 0;
}

.result-position-tile {
  display: grid;
  align-content: center;
  gap: var(--space-2);
  height: 100%;
  animation: position-pop 0.45s var(--ease);
}

.result-meta-tile {
  display: grid;
  align-content: center;
  gap: var(--space-2);
  height: 100%;
}

.result-idle-tile,
.result-loading-tile,
.result-error-tile {
  display: grid;
  gap: var(--space-3);
  align-content: start;
}

.position-num {
  font-size: clamp(48px, 8vw, 64px);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.position-caption {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--surface-ink-muted);
}

.result-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-kicker-on-ink {
  color: color-mix(in srgb, #fff 72%, var(--accent-hover));
}

.result-title {
  margin: 0;
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.2;
  word-break: break-word;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.tag-label {
  color: var(--ink-muted);
}

.tag-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
  font-variant-numeric: tabular-nums;
}

.desc-block {
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.desc-block.is-empty {
  opacity: 0.72;
}

.desc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 14px 16px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: background var(--dur-fast);
}

.desc-block.is-empty .desc-head {
  cursor: default;
}

.desc-head:hover:not(:disabled) {
  background: var(--accent-soft);
}

.desc-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.desc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.desc-chevron {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  transition: transform var(--dur) var(--ease);
}

.desc-chevron svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.desc-block.is-open .desc-chevron {
  transform: rotate(180deg);
}

.desc-preview,
.desc-text,
.desc-empty {
  margin: 0;
  padding: 0 16px 14px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.desc-preview {
  color: var(--ink-muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.desc-text {
  padding-bottom: 16px;
  color: var(--ink);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  animation: rise var(--dur) var(--ease);
}

.desc-empty {
  color: var(--ink-muted);
}

/* ——— Feedback ——— */

.banner,
.error,
.success {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  animation: rise var(--dur) var(--ease);
}

.banner-error,
.error {
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
  color: var(--danger);
}

.banner-success,
.success {
  background: var(--success-soft);
  border: 1px solid color-mix(in srgb, var(--success) 28%, transparent);
  color: var(--success);
}

.banner-info {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  color: var(--ink);
}

.hint {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 500;
}

.hint a {
  color: var(--accent);
  font-weight: 600;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner.dark {
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
}

.city-loader {
  display: none;
  align-items: center;
}

.city-loader.is-on {
  display: inline-flex;
}

/* ——— Motion ——— */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  50% { opacity: 0.45; }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes combo-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes result-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes position-pop {
  from {
    opacity: 0;
    transform: scale(0.86);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes login-glow {
  from { transform: translateY(0) scale(1); filter: saturate(1) brightness(1); }
  to { transform: translateY(-10px) scale(1.04); filter: saturate(1.1) brightness(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}


/* ——— Skeleton / empty ——— */

.skeleton-stack {
  display: grid;
  gap: var(--space-3);
  width: 100%;
}

.skeleton {
  display: block;
  border-radius: var(--radius-xs);
  background: linear-gradient(
    90deg,
    var(--surface-3) 0%,
    color-mix(in srgb, var(--surface) 70%, var(--surface-3)) 50%,
    var(--surface-3) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-line {
  height: 14px;
  width: 100%;
}

.skeleton-line-lg {
  height: 22px;
  width: 70%;
}

.skeleton-line-sm {
  width: 45%;
}

.skeleton-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.city-chip-error {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 41;
  margin: 0;
  max-width: 240px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-xs);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.combo-option.is-active {
  background: var(--accent-soft);
}

.empty-state-panel {
  padding: var(--space-6);
  display: grid;
  gap: var(--space-3);
  justify-items: start;
}

.bento-metric {
  font-variant-numeric: tabular-nums;
}

.btn-search-cta {
  border-radius: var(--radius-sm);
}

.app-sidebar:focus {
  outline: none;
}

.app-sidebar:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar-backdrop {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

/* ——— Responsive ——— */

@media (max-width: 980px) {
  .result-column,
  .bento-span-4,
  .bento-span-5,
  .bento-span-6,
  .bento-span-7,
  .bento-span-8,
  .bento-span-12 {
    grid-column: span 12;
  }

  .result-stack {
    grid-template-rows: auto auto;
    height: auto;
    min-height: 0;
  }

  .result-position-tile,
  .result-meta-tile {
    height: auto;
    min-height: 140px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 90;
    width: min(320px, 88vw);
    min-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
    padding: var(--space-5);
  }

  .app-sidebar.is-collapsed {
    width: min(320px, 88vw);
    padding: var(--space-5);
  }

  .app-sidebar.is-collapsed .brand-name,
  .app-sidebar.is-collapsed .sidebar-link-text,
  .app-sidebar.is-collapsed .sidebar-section-label,
  .app-sidebar.is-collapsed .sidebar-account-copy {
    display: initial;
  }

  .app-sidebar.is-collapsed .sidebar-account-copy {
    display: grid;
  }

  .app-sidebar.is-collapsed .sidebar-brand-row {
    flex-direction: row;
  }

  .app-sidebar.is-collapsed .sidebar-nav,
  .app-sidebar.is-collapsed .sidebar-footer {
    justify-items: stretch;
  }

  .app-sidebar.is-collapsed .sidebar-link,
  .app-sidebar.is-collapsed .sidebar-link-button,
  .app-sidebar.is-collapsed .sidebar-account {
    width: 100%;
    height: auto;
    min-height: 46px;
    padding: 0 12px;
    justify-content: flex-start;
    gap: 12px;
    aspect-ratio: auto;
  }

  .app-sidebar.is-collapsed .sidebar-account {
    padding: 10px;
  }

  .app-sidebar.is-drawer-open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: none;
  }

  .icon-btn.sidebar-drawer-close,
  .icon-btn.topbar-menu-btn {
    display: inline-grid;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 85;
    background: var(--scrim);
    backdrop-filter: blur(2px);
  }

  .app-topbar {
    min-height: 0;
    padding: 4px 2px 0;
    gap: 12px;
  }

  .topbar-leading {
    flex: 1;
    min-width: 0;
  }

  .page-title {
    font-size: clamp(24px, 7vw, 32px);
  }

  .page-subtitle {
    display: none;
  }

  .city-chip-label {
    max-width: 110px;
  }

  .search-bento-head {
    flex-direction: column;
    align-items: start;
    padding: 20px 18px 16px;
  }

  .search-bento-note {
    text-align: left;
    max-width: none;
  }

  .search-bento-form {
    padding: 16px 18px 18px;
  }

  .search-bento-cta {
    justify-content: stretch;
  }

  .btn-search-cta {
    width: 100%;
    min-width: 0;
  }

  .search-panel,
  .settings-panel,
  .result-position-tile,
  .result-meta-tile,
  .result-aside-tile {
    padding: 18px;
  }

  .search-bento {
    padding: 0;
  }

  .settings-root.bento-grid {
    max-width: none;
  }

  .settings-profile {
    grid-template-columns: auto 1fr auto;
    gap: var(--space-3);
  }

  .settings-profile .menu-wrap {
    align-self: start;
  }

  .settings-panel {
    padding: 18px;
  }
}

@media (max-width: 560px) {
  .settings-row-head {
    flex-direction: column;
  }

  .login-screen {
    text-align: center;
  }

  .login-content {
    justify-items: center;
  }

  .login-headline,
  .login-lead {
    max-width: 28ch;
  }

  .btn-login {
    width: 100%;
  }

  .city-chip-trigger {
    padding: 0 12px 0 10px;
  }
}

/* ——— Analytics ——— */

.analytics-root.bento-grid {
  align-items: stretch;
}

.analytics-catalog-panel,
.analytics-detail-panel,
.analytics-chart-panel {
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.analytics-detail-panel {
  grid-column: span 7;
}

.analytics-catalog-panel {
  grid-column: span 5;
}

.analytics-detail-empty {
  flex: 1;
  display: grid;
  align-content: center;
}

.analytics-detail-panel > .analytics-tracked-list,
.analytics-catalog-panel > .analytics-product-grid {
  flex: 1;
  min-height: 0;
}

.analytics-chart-panel {
  grid-column: span 12;
  overflow: visible;
}

.analytics-custom-interval {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.analytics-chart-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: var(--space-3);
  position: relative;
  z-index: 20;
}

.analytics-chart-head-title {
  flex: 0 1 auto;
  min-width: 0;
}

.analytics-chart-title {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 28px);
}

.analytics-chart-meta {
  margin: 0;
  flex: 0 0 auto;
  text-align: right;
  white-space: nowrap;
}

.analytics-chart-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--space-4);
  overflow: visible;
  position: relative;
  z-index: 25;
}

.analytics-chart-segmented {
  flex: 0 0 auto;
}

.analytics-filter-chip {
  position: relative;
  z-index: 30;
  flex: 0 0 auto;
}

.analytics-filter-chip.is-open {
  z-index: 120;
}

.analytics-filter-trigger {
  min-width: 148px;
  min-height: 40px;
  padding-top: 0;
  padding-bottom: 0;
}

.analytics-filter-dismiss {
  z-index: 115;
}

.analytics-multiselect-menu {
  left: 0;
  right: auto;
  min-width: 240px;
  z-index: 130;
}

.analytics-chart-custom-range {
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  gap: 10px;
  margin: calc(var(--space-3) * -1) 0 var(--space-4);
}

.analytics-chart-filter {
  min-width: 0;
  flex: 0 0 auto;
  display: grid;
  gap: 6px;
}

.analytics-chart-filter .field-input {
  min-height: 40px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.analytics-chart-filter .label {
  margin: 0;
}

.analytics-chart-empty {
  margin-bottom: var(--space-4);
  padding: var(--space-4) 0;
}

.analytics-multiselect-item {
  list-style: none;
}

.analytics-multiselect-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.analytics-multiselect-option:hover {
  background: var(--surface-2);
}

.analytics-multiselect-option input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.analytics-panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.analytics-product-grid {
  display: grid;
  gap: 10px;
  max-height: min(70vh, 720px);
  overflow: auto;
  padding-right: 4px;
}

.analytics-product-card {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: inherit;
  text-align: left;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}

.analytics-product-card:hover,
.analytics-product-card.is-selected {
  background: var(--accent-soft);
  border-color: transparent;
}

.analytics-product-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--line);
}

.analytics-product-thumb.is-empty {
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
}

.analytics-product-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.analytics-product-name {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.analytics-product-sku {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.analytics-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: var(--space-4);
}

.analytics-tracked-list {
  display: grid;
  gap: 8px;
  margin-bottom: var(--space-5);
}

.analytics-tracked-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.analytics-tracked-row.is-selected {
  border-color: var(--line);
  background: var(--surface-2);
}

.analytics-tracked-main {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font: inherit;
  min-width: 0;
}

.analytics-tracked-main:hover {
  background: var(--accent-soft);
}

.analytics-tracked-query {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-tracked-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
}

.analytics-chart-wrap {
  border-top: 1px solid var(--line);
  padding-top: var(--space-4);
}

.analytics-chart-canvas-host {
  height: 360px;
  position: relative;
  z-index: 0;
}

@media (max-width: 980px) {
  .analytics-catalog-panel,
  .analytics-detail-panel,
  .analytics-chart-panel {
    grid-column: span 12;
  }

  .analytics-add-form {
    grid-template-columns: 1fr;
  }

  .analytics-custom-interval {
    grid-template-columns: 1fr;
  }

  .analytics-chart-head {
    flex-wrap: wrap;
    align-items: start;
  }

  .analytics-chart-meta {
    text-align: left;
  }

  .analytics-chart-toolbar {
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding-bottom: 4px;
  }

  .analytics-chart-custom-range {
    flex-wrap: wrap;
  }

  .analytics-filter-trigger,
  .analytics-chart-filter {
    flex: 0 0 auto;
  }
}

/* ——— Product instructions ——— */

.instructions-root.bento-grid {
  align-items: stretch;
}

.instructions-editor-panel,
.instructions-side-panel,
.instructions-catalog-panel {
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.instructions-editor-panel {
  grid-column: span 7;
}

.instructions-side-panel {
  grid-column: span 5;
}

.instructions-catalog-panel {
  grid-column: span 12;
}

.instructions-catalog-panel > .analytics-product-grid {
  max-height: min(48vh, 520px);
}

.instructions-filter {
  margin-bottom: var(--space-3);
}

.analytics-product-sku .status-chip {
  min-height: 22px;
  padding: 2px 8px;
  font-size: 11px;
}

.instruction-editor {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.instruction-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.instruction-tool {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.instruction-tool:hover:not(:disabled),
.instruction-tool:focus-visible {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.instruction-tool:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.instruction-editor-body {
  min-height: 240px;
  max-height: min(52vh, 520px);
  overflow: auto;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  outline: none;
}

.instruction-editor-body:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.instruction-editor-body:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-faint);
}

            .instruction-editor-body h2,
.instruction-public-body h2 {
  margin: 0 0 0.6em;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.instruction-editor-body h3,
.instruction-public-body h3 {
  margin: 0 0 0.5em;
  font-size: 1.05rem;
}

.instruction-editor-body p,
.instruction-editor-body div,
.instruction-public-body p,
.instruction-public-body div {
  margin: 0 0 0.75em;
}

.instruction-editor-body ul,
.instruction-editor-body ol,
.instruction-public-body ul,
.instruction-public-body ol {
  margin: 0 0 0.85em;
  padding-left: 1.2em;
}

.instructions-editor-actions,
.instructions-qr-actions {
  gap: 10px;
  flex-wrap: wrap;
}

.instruction-qr {
  width: min(240px, 100%);
  height: auto;
  aspect-ratio: 1;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px;
  border: 1px solid var(--line);
}

.instruction-public-url {
  margin: var(--space-3) 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  word-break: break-all;
}

.instruction-public-layout {
  min-height: 100dvh;
  display: grid;
  justify-items: center;
}

.instruction-public {
  width: min(720px, 100%);
  padding: clamp(20px, 4vw, 40px) var(--space-4) var(--space-8);
  display: grid;
  gap: var(--space-4);
}

.instruction-public-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.instruction-public-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 22px;
}

.instruction-public-logo {
  width: 36px;
  height: 36px;
  color: var(--accent);
}

.instruction-public-card {
  padding: var(--space-6);
  display: grid;
  gap: var(--space-4);
}

.instruction-public-product {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--space-4);
  align-items: center;
}

.instruction-public-photo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface-3);
}

.instruction-public-title {
  margin: 0;
  font-size: clamp(22px, 4vw, 32px);
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.instruction-public-ozon {
  display: inline-flex;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.instruction-public-ozon:hover,
.instruction-public-ozon:focus-visible {
  text-decoration: underline;
}

.instruction-public-body {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
}

.instruction-public-made {
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.instruction-public-made a {
  color: var(--ink-muted);
  text-decoration: none;
}

.instruction-public-made a:hover,
.instruction-public-made a:focus-visible {
  color: var(--accent);
}

@media (max-width: 980px) {
  .instructions-editor-panel,
  .instructions-side-panel,
  .instructions-catalog-panel {
    grid-column: span 12;
  }

  .instruction-public-product {
    grid-template-columns: 56px 1fr;
  }

  .instruction-public-photo {
    width: 56px;
    height: 56px;
  }
}


