:root {
  --bg: #f4f4f6;
  --paper: #ffffff;
  --ink: #0e0e11;
  --muted: #6b6f76;
  --line: #e6e7ea;
  /* [REPLACE:THEME] brand accent extracted from the storefront (see docs/BRANDING.md);
     --accent-soft is a ~10% tint of --accent; the rgba() shadows/glows below and the
     recording-hover dark shade must be regenerated from the same accent. */
  --accent: #d0121a;          /* Sanferbike brand red */
  --accent-soft: #fdeceb;
  --dark1: #16161a;
  --dark2: #2a2a31;
  --user-bubble: #0e0e11;
  --user-ink: #ffffff;
  --tool-bg: #f7f7f8;
  --tool-line: #dcdde1;
  --error: #c2240a;
  --price: #0e0e11;
  --backdrop: #e9eaed;          /* light canvas the white app-card floats on */
  --placeholder: #9aa0a8;
  --hairline: rgba(17, 17, 20, 0.06);
  --card-shadow: 0 24px 70px rgba(17, 17, 20, 0.10), 0 4px 16px rgba(17, 17, 20, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--backdrop);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;   /* dvh tracks the *visible* viewport as mobile toolbars show/hide */
  padding: 22px;
}

/* The flip stage: a 3D-rotating card floating on the light backdrop. The
   front face is the assistant; the back face is the demo backoffice. */
.card-flip {
  width: 100%;
  max-width: 900px;
  /* 620px cap: tall enough for the hero (title + search + chips) with ~28px
     of breathing room above the eyebrow and below the search — taller caps
     just inflate those two auto-margin gaps with dead space. */
  height: min(620px, calc(100vh - 56px));
  height: min(620px, calc(100dvh - 56px));
  margin: auto;
  perspective: 2200px;
  transform-origin: bottom right;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* The backoffice (back face) keeps the same 900px max-width as the assistant
   front — the analytics content reflows to fit (see .bo-analytics-grid). */
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.5, 0, 0.2, 1);
}
body.flipped .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
/* The visible card surface; clips its own content (the protruding side tab
   lives outside it, inside the overflow-visible .card-face). */
.face-surface {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 24px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.card-back { transform: rotateY(180deg); pointer-events: none; }
body.flipped .card-back { pointer-events: auto; }
body.flipped .card-front { pointer-events: none; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.brand { display: flex; align-items: center; gap: 12px; }
/* width:auto + height keeps the source aspect ratio; flex-shrink/align-self
   stop the flex row from ever squashing or stretching the wordmark. */
.brand-icon { height: 40px; width: auto; flex-shrink: 0; align-self: center; display: block; }
.brand-wordmark { height: 18px; width: auto; flex-shrink: 0; align-self: center; display: block; }

.newchat-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 400;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 14px 8px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.newchat-btn .refresh-icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: color 0.2s, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.newchat-btn:hover {
  border-color: #cfd2d6;
  box-shadow: 0 2px 10px rgba(17, 17, 20, 0.06);
}
.newchat-btn:hover .refresh-icon { color: var(--accent); transform: rotate(-180deg); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover {
  border-color: #cfd2d6;
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(17, 17, 20, 0.06);
}

.header-actions { display: flex; align-items: center; gap: 10px; }
.lang-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}
.lang-switch button {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lang-switch button.active {
  background: var(--ink);
  color: #fff;
}
.lang-switch button:not(.active):hover { color: var(--accent); }

/* Stage = scroll region holding the welcome hero (empty state) or the chat. */
.stage {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.messages {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Show one stage child per mode. */
body.welcome .messages { display: none; }
body.chatting #welcome { display: none; }

/* ---------- Welcome hero (empty state) ---------- */
#welcome {
  min-height: 100%;
  box-sizing: border-box;
  display: flex;
  /* The hero fills the stage; auto margins inside split the layout — the
     eyebrow/title/search group floats high, the chips anchor to the bottom
     just above the powered-by footer. */
  align-items: stretch;
  justify-content: center;
  padding: 28px 28px 18px;
}
.hero-inner {
  width: 100%;
  max-width: 1184px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero-eyebrow {
  margin-top: auto;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.hero-title {
  margin: 0 0 34px;
  max-width: 760px;
  font-size: clamp(26px, 3.1vw, 38px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--ink);
}
.composer-slot { width: 100%; max-width: 620px; margin: 0 auto; }

/* Staggered entrance for the welcome hero. */
@keyframes hero-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
body.welcome .hero-eyebrow,
body.welcome .hero-title,
body.welcome .composer-slot,
body.welcome .examples {
  animation: hero-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
body.welcome .hero-title { animation-delay: 0.06s; }
body.welcome .composer-slot { animation-delay: 0.13s; }
body.welcome .examples { animation-delay: 0.2s; }
@media (prefers-reduced-motion: reduce) {
  body.welcome .hero-eyebrow,
  body.welcome .hero-title,
  body.welcome .composer-slot,
  body.welcome .examples,
  body.minimized .mini-bar { animation: none; }
}

/* Suggested-query chips: anchored to the bottom of the hero (margin-top auto),
   with a minimum gap from the search bar when vertical space runs out. */
.examples { margin-top: auto; padding-top: 26px; width: 100%; }
.examples-label {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 20px;
  font-weight: 600;
}
.chips-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 620px;
  margin: 0 auto;
}
.ex-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 1px 2px rgba(17, 17, 20, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.ex-chip:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(208, 18, 26, 0.10);
  transform: translateY(-2px);
}
.ex-icon { color: var(--accent); flex-shrink: 0; display: inline-grid; place-items: center; }
.ex-icon svg { width: 22px; height: 22px; }
.ex-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.ex-l1 { font-size: 13px; font-weight: 700; color: var(--ink); }
.ex-l2 { font-size: 12.5px; color: var(--muted); }

.msg {
  max-width: 85%;
  padding: 11px 15px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 14.5px;
}
.msg.user {
  background: var(--user-bubble);
  color: var(--user-ink);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.msg.assistant {
  background: var(--paper);
  border: 1px solid var(--line);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  white-space: normal;
}

.msg.assistant p { margin: 0 0 10px; }
.msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant strong { font-weight: 700; color: var(--ink); }
.msg.assistant ul, .msg.assistant ol { margin: 8px 0 10px; padding-left: 22px; }
.msg.assistant li { margin: 3px 0; }
.msg.assistant li > p { margin: 0; }
.msg.assistant h1, .msg.assistant h2, .msg.assistant h3, .msg.assistant h4 {
  margin: 14px 0 6px; letter-spacing: -0.01em;
}
.msg.assistant h2 { font-size: 17px; }
.msg.assistant h3 { font-size: 15.5px; }
.msg.assistant a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.msg.assistant code {
  background: var(--accent-soft); padding: 1px 5px; border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px;
}

.msg.thinking {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
}
.thinking-label {
  font-size: 12.5px;
  color: var(--muted);
}
.thinking-label:empty { display: none; }
.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.thinking-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.35;
  animation: thinking-pulse 1.1s ease-in-out infinite;
}
.thinking-dots i:nth-child(2) { animation-delay: 0.16s; }
.thinking-dots i:nth-child(3) { animation-delay: 0.32s; }
@keyframes thinking-pulse {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.msg.error {
  background: #fdecea;
  color: var(--error);
  border: 1px solid #f4b8b0;
  align-self: stretch;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  border-radius: 10px;
}

/* ---------- Product cards (rendered from search_products) ---------- */
.product-grid {
  align-self: stretch;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.product-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.product-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(208, 18, 26, 0.10);
}
.product-card .image {
  background: linear-gradient(135deg, var(--dark1) 0%, var(--dark2) 100%);
  aspect-ratio: 1.4 / 1;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.product-card .image img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.product-card .image .placeholder {
  font-size: 22px; color: #ffffff; font-weight: 800; opacity: 0.55;
}
.product-card .body {
  padding: 12px 13px 14px;
  display: flex; flex-direction: column; gap: 8px; flex: 1;
}
.product-card .name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card .meta {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.product-card .price {
  font-size: 15px;
  font-weight: 700;
  color: var(--price);
  margin-top: auto;
}
.product-card .price .range { font-weight: 500; color: var(--muted); font-size: 12px; }
.product-card .chips {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.chip {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eceef1;
  color: #3a3f47;
  font-weight: 600;
}
.chip.new { background: #e7f7ec; color: #1a7f43; }
.chip.unavailable { background: #fdecea; color: var(--error); }
.chip.sale { background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.chip.lactose { background: #eef2f7; color: #2e4a73; }
.chip.sugar { background: #faf0d8; color: #7a5a18; }
.chip.gmo { background: #e9f0fb; color: #2e4a73; }
.add-btn {
  margin-top: 4px;
  border: none;
  background: var(--ink);
  color: var(--user-ink);
  font-weight: 600;
  font-size: 12.5px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.add-btn:hover { background: var(--accent); }
.add-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Cart summary (from view_cart) ---------- */
.cart-summary {
  align-self: stretch;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}
.cart-summary .title {
  font-size: 14px; font-weight: 700; margin: 0 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.cart-summary .title .badge {
  background: var(--accent); color: var(--user-ink);
  font-size: 11px; padding: 1px 7px; border-radius: 999px; font-weight: 600;
}
.cart-summary .empty { color: var(--muted); font-style: italic; font-size: 13.5px; }
.cart-summary .items { display: flex; flex-direction: column; gap: 8px; }
.cart-summary .item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.cart-summary .item:last-of-type { border-bottom: none; }
.cart-summary .item .thumb {
  width: 44px; height: 44px; border-radius: 8px; overflow: hidden;
  background: var(--dark1);
}
.cart-summary .item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-summary .item .info { display: flex; flex-direction: column; gap: 2px; }
.cart-summary .item .iname { font-size: 13px; font-weight: 600; }
.cart-summary .item .iqty { font-size: 11.5px; color: var(--muted); }
.cart-summary .item .iprice { font-size: 13px; font-weight: 600; color: var(--price); }
.cart-summary .totals {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px;
  font-size: 13px;
}
.cart-summary .totals .row { display: flex; justify-content: space-between; }
.cart-summary .totals .row.total {
  font-weight: 700; font-size: 15px; margin-top: 4px;
}
.cart-summary .totals .row.total .v { color: var(--accent); }
.cart-summary .note { margin-top: 8px; font-size: 11.5px; color: var(--muted); font-style: italic; }

/* ---------- Order confirmation (from checkout) ---------- */
.order-card {
  align-self: stretch;
  background: linear-gradient(135deg, #fff5f6 0%, var(--accent-soft) 100%);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.order-card .title { font-weight: 800; font-size: 15px; color: var(--accent); }
.order-card .grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.order-card .k { color: var(--muted); }
.order-card .v { color: var(--ink); font-weight: 500; }
.order-card .note { font-size: 11.5px; color: var(--muted); font-style: italic; margin-top: 4px; }

/* ---------- Tool fallback (collapsible JSON) ---------- */
.tool {
  align-self: stretch;
  background: var(--tool-bg);
  border: 1px solid var(--tool-line);
  border-radius: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  overflow: hidden;
}
.tool summary {
  cursor: pointer; padding: 9px 13px; list-style: none;
  display: flex; align-items: center; gap: 8px; user-select: none;
}
.tool summary::-webkit-details-marker { display: none; }
.tool summary::before {
  content: "▸"; font-size: 10px; color: var(--muted);
  transition: transform 0.15s;
}
.tool[open] summary::before { transform: rotate(90deg); }
.tool .label { color: var(--accent); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.tool .name { color: var(--ink); font-weight: 600; }
.tool .status { font-size: 10.5px; color: var(--muted); margin-left: auto; text-transform: uppercase; letter-spacing: 0.05em; }
.tool pre {
  margin: 0; padding: 11px 13px;
  background: rgba(0,0,0,0.025);
  border-top: 1px solid var(--tool-line);
  white-space: pre-wrap; word-wrap: break-word;
  max-height: 320px; overflow-y: auto; font-size: 12px;
}
.tool .section-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 7px 13px 0;
  font-family: "Inter", system-ui, sans-serif;
}

/* ---------- Composer (big bordered box) ---------- */
.composer {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 7px 7px 24px;
  box-shadow: 0 12px 32px rgba(17, 17, 20, 0.07);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.composer:focus-within {
  border-color: #cfd2d6;
  box-shadow: 0 16px 40px rgba(17, 17, 20, 0.11);
}
#input {
  flex: 1;
  min-width: 0;
  border: none; outline: none; background: transparent;
  resize: none; font: inherit; font-size: 16px; color: var(--ink);
  line-height: 1.5;
  max-height: 120px;
  padding: 14px 0;
}
#input::placeholder { color: var(--placeholder); }

.composer-actions {
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}

.send-btn {
  width: 48px; height: 48px; flex-shrink: 0;
  display: inline-grid; place-items: center;
  background: var(--ink); color: #fff; border: none; border-radius: 50%;
  cursor: pointer; transition: background 0.15s, transform 0.1s;
}
.send-btn:hover { background: var(--accent); }
.send-btn:active { transform: scale(0.96); }
.send-btn:disabled { cursor: progress; }
.send-btn .arrow-icon { width: 22px; height: 22px; }
.send-btn.is-busy .arrow-icon { display: none; }
.send-btn.is-busy::after {
  content: ''; width: 18px; height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Voice input (in-bar mic) ---------- */
.voice-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 50%; border: none;
  background: transparent; color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.voice-btn[hidden] { display: none; }
.voice-btn:hover { background: var(--bg); color: var(--ink); }
.voice-btn:active { transform: scale(0.96); }
.voice-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.voice-btn .voice-icon { width: 21px; height: 21px; }

/* Recording — solid red pulse, click again to stop and transcribe. */
.voice-btn.is-recording {
  background: var(--accent); color: #fff;
  animation: voice-pulse 1.4s ease-in-out infinite;
}
.voice-btn.is-recording:hover { background: #a30e15; }
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(208, 18, 26, 0.45); }
  50%      { box-shadow: 0 0 0 8px rgba(208, 18, 26, 0); }
}

/* Transcribing — uploading to /transcribe, awaiting OpenAI. Spinner, disabled. */
.voice-btn.is-transcribing {
  background: var(--bg); color: var(--muted); cursor: wait; animation: none;
}
.voice-btn.is-transcribing .voice-icon { display: none; }
.voice-btn.is-transcribing::after {
  content: ''; width: 16px; height: 16px;
  border: 2.5px solid var(--line); border-top-color: var(--ink);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* ---------- Chat-mode composer dock (compact, bottom-docked) ---------- */
.composer-dock {
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
body.welcome .composer-dock { display: none; }
.composer-dock .composer {
  max-width: 920px; margin: 0 auto;
  gap: 6px;
  padding: 7px 7px 7px 20px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(17, 17, 20, 0.05);
}
.composer-dock .composer:focus-within { border-color: #cfd2d6; }
.composer-dock #input { max-height: 140px; padding: 9px 0; }
.composer-dock .voice-btn { width: 40px; height: 40px; }
.composer-dock .voice-btn .voice-icon { width: 18px; height: 18px; }
.composer-dock .send-btn { width: 44px; height: 44px; }

/* ---------- Powered-by footer ---------- */
.powered {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 14px 26px; font-size: 12.5px;
  color: var(--muted); background: var(--paper);
}
.powered .gentika-mark { height: 17px; width: auto; display: block; }
/* Real "gentika" wordmark artwork (lowercase geometric sans) sized to the
   official lockup ratio (~0.71 of the mark) next to the 17px mark. The
   negative margin tightens mark<->wordmark (~4px) without touching the flex
   gap that spaces "Powered by" from the lockup. */
.powered .gentika-wordmark { height: 13px; width: auto; display: block; margin-left: -4px; }
body.chatting .powered { display: none; }

/* ---------- Minimize → centered read-only search bar ---------- */
body.minimized .card-flip {
  opacity: 0;
  transform: scale(0.92) translateY(12px);
  pointer-events: none;
  /* Stay a centered flex item — opacity + pointer-events already hide/disable
     it. Switching to position:absolute here is not animatable and snaps the card
     horizontally (it leaves the flex flow and loses margin:auto centering),
     producing a rightward twitch before the fade. */
}
/* A non-editable pill, centered horizontally near the bottom of the backdrop
   (à la brunellocucinelli.ai), running the welcome typewriter demo. The whole
   button is clickable (and keyboard-focusable) to reopen. */
.mini-bar {
  display: flex;
  position: fixed;
  left: 50%; bottom: 48px;                 /* anchored near the bottom, à la brunellocucinelli.ai */
  transform: translateX(-50%) translateY(14px);
  width: min(540px, calc(100vw - 36px));
  align-items: center;
  gap: 8px;
  font: inherit;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 7px 7px 22px;
  box-shadow: 0 18px 44px rgba(17, 17, 20, 0.13);
  cursor: pointer;
  z-index: 60;
  /* Hidden via visibility (not display) so leaving the minimized state can
     animate: the bar sinks/fades out while the card rises back in. The
     visibility delay keeps it visible for the duration of that fade. */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: box-shadow 0.16s ease, border-color 0.16s ease,
              opacity 0.26s ease, transform 0.26s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0s linear 0.26s;
}
body.minimized .mini-bar {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  transition: box-shadow 0.16s ease, border-color 0.16s ease, visibility 0s;
  animation: mini-bar-in 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.mini-bar:hover { border-color: #cfd2d6; box-shadow: 0 22px 52px rgba(17, 17, 20, 0.17); }
.mini-bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* clips the long demo phrase; JS keeps the latest chars (the "caret") in view */
.mini-bar-textwrap { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.mini-bar-text {
  display: inline-block;
  white-space: nowrap;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  padding: 8px 0;
}
/* Decorative grey mic, a bit smaller than the arrow (the bar isn't interactive). */
.mini-bar-mic {
  flex-shrink: 0;
  display: inline-grid; place-items: center;
  color: var(--muted);
}
.mini-bar-mic svg { width: 16px; height: 16px; }
.mini-bar-arrow {
  flex-shrink: 0;
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  background: var(--bg);
  color: var(--ink);          /* arrow stays black — no hover color change */
  border-radius: 50%;
}
.mini-bar-arrow svg { width: 18px; height: 18px; }
@keyframes mini-bar-in {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  body { padding: 0; }
  .card-flip { height: 100vh; height: 100dvh; }
  .face-surface {
    border-radius: 0; box-shadow: none; border: none;
    /* Full-bleed on phones: keep the header off the notch and the composer
       off the home indicator (insets are 0 where the device has none). */
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
  }

  /* Mobile: drop the 3D flip, cross-fade the two faces instead. The rotateY
     flip is GPU-heavy on phones and, worse, iOS Safari fails to cull the
     rotated front face's protruding side-tab — it bleeds through
     mirror-reversed (the backwards "Analytics" tab). Stacking + opacity,
     driven off .flipped (not backface-visibility), sidesteps both. */
  .card-inner,
  body.flipped .card-inner { transform: none; transition: none; transform-style: flat; }
  .card-face {
    backface-visibility: visible; -webkit-backface-visibility: visible;
    transition: opacity 0.3s ease;
  }
  .card-back { transform: none; opacity: 0; }
  body.flipped .card-back { opacity: 1; }
  body.flipped .card-front { opacity: 0; }
  /* On full-width mobile the right edge is the viewport edge, so tuck the tab
     flush inside it (rounded on the left) instead of letting it run off-screen. */
  .side-tab {
    top: 50%; transform: translateY(-50%);
    left: auto; right: 0; margin-left: 0;
    border-radius: 13px 0 0 13px;
  }
  .chips-row { grid-template-columns: 1fr; max-width: none; }
  .composer { padding-left: 18px; }
  .mini-bar { padding-left: 20px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .bo-table td:nth-child(2) { max-width: 140px; }

  /* Compact header: smaller logo, icon-only "Nuova Chat" (the title/aria-label
     keep its name), slimmer IT/EN — so all three controls fit on a phone width
     instead of being clipped by the card's overflow. */
  header { padding: 14px 16px; }
  .brand { gap: 8px; }
  .brand-icon { height: 28px; }
  .brand-wordmark { height: 12px; }
  .header-actions { gap: 8px; }
  .newchat-btn { width: 34px; height: 34px; padding: 0; justify-content: center; gap: 0; }
  .newchat-btn span { display: none; }
  .lang-switch button { padding: 6px 10px; }

  /* Single-line input: long placeholders/demo queries clip at the right edge
     instead of wrapping into a tall composer that crowds the mic. */
  #input { white-space: nowrap; overflow: hidden; }
  #input::placeholder { white-space: nowrap; }

  /* The flip tab docks bottom-RIGHT on phones — keep "Powered by" on the left,
     clear of it. */
  .powered { justify-content: flex-start; padding: 12px 18px; }
}

/* ---------- Search / list / compare extras ---------- */
.grid-note {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  padding: 4px 2px;
}
.sale-price { color: var(--accent); font-weight: 700; }
.range.strike { text-decoration: line-through; opacity: 0.6; }
.list-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  align-self: stretch;
}
.list-card .title {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink);
}
.list-card .row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.list-card .row:last-child { border-bottom: none; }

/* ===================== Right-edge flip tabs ===================== */
/* "Analytics" (front) flips to the backoffice; "Assistant" (back) flips back.
   Both brand red. They sit just past the card's right edge, sticking out of
   the overflow-visible .card-face. */
.side-tab {
  position: absolute;
  top: 30%;
  left: 100%;
  margin-left: -1px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 17px 9px;
  border: none;
  cursor: pointer;
  writing-mode: vertical-rl;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: 0 13px 13px 0;
  box-shadow: 4px 6px 18px rgba(17, 17, 20, 0.16);
  z-index: 5;
  transition: filter 0.15s, padding-left 0.15s;
}
.side-tab span { display: block; transform: rotate(180deg); }

/* Discovery nudge: a spinning conic "beam" sweeps the tab border + a soft pulsing
   halo, to draw the eye to the flip tab. Inspired by unseen-spotlight's glow. */
@property --tab-beam { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.side-tab.glow { animation: tab-halo 1.8s ease-in-out infinite; }
.side-tab.glow::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from var(--tab-beam),
    transparent 0 58%, rgba(255, 255, 255, 0.85) 75%, #fff 84%,
    rgba(255, 255, 255, 0.85) 92%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: tab-beam-spin 2.2s linear infinite;
  pointer-events: none;
}
@keyframes tab-beam-spin { to { --tab-beam: 360deg; } }
@keyframes tab-halo {
  0%, 100% { box-shadow: 4px 6px 18px rgba(17, 17, 20, 0.16), 0 0 12px 1px rgba(208, 18, 26, 0.40); }
  50%      { box-shadow: 4px 6px 22px rgba(17, 17, 20, 0.20), 0 0 24px 5px rgba(208, 18, 26, 0.70); }
}
@media (prefers-reduced-motion: reduce) {
  .side-tab.glow { animation: none; box-shadow: 4px 6px 20px rgba(17, 17, 20, 0.18), 0 0 18px 3px rgba(208, 18, 26, 0.55); }
  .side-tab.glow::after { animation: none; }
}
.tab-analytics,
.tab-assistant { background: var(--accent); color: #fff; }
.tab-analytics:hover,
.tab-assistant:hover { filter: brightness(1.06); padding-left: 13px; }

/* ===================== Demo backoffice (back face) ===================== */
.bo-header {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 15px 22px; border-bottom: 1px solid var(--line);
  flex-shrink: 0; background: var(--paper);
}
.bo-brand { display: flex; align-items: center; gap: 11px; }
.bo-mark { height: 34px; width: auto; display: block; }
.bo-titles { display: flex; flex-direction: column; line-height: 1.25; }
.bo-h1 { font-size: 20px; font-weight: 800; color: var(--ink); letter-spacing: -0.01em; }
.bo-sub { font-size: 11.5px; color: var(--muted); max-width: 430px; }
.bo-head-right { display: flex; align-items: center; gap: 12px; }
.bo-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.bo-control svg { width: 15px; height: 15px; color: var(--muted); }
.bo-body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 16px 22px 22px;
  display: flex; flex-direction: column; gap: 12px;
}

/* "Mocked data" disclaimer banner */
.bo-disclaimer {
  display: flex; align-items: center; gap: 9px;
  font-size: 11.5px; line-height: 1.35; font-weight: 500;
  color: #8a5b00;
  background: #fff7e8;
  border: 1px solid #f3e1b3;
  border-radius: 10px;
  padding: 8px 13px;
}
.bo-disclaimer svg { width: 15px; height: 15px; color: #c98a00; flex-shrink: 0; }

/* KPI tiles */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 9px;
}
.kpi {
  position: relative;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 12px 12px 58px;
  display: flex; flex-direction: column; gap: 3px;
  min-height: 108px;
}
.kpi-icon {
  position: absolute;
  top: 21px;
  left: 15px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 18px;
  font-weight: 800;
}
.kpi-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Brand palette only: red (--accent), black (--ink), gray (--muted). */
.kpi-icon.violet { color: var(--accent); background: var(--accent-soft); }
.kpi-icon.green  { color: var(--ink); background: #edeef1; }
.kpi-icon.blue   { color: var(--muted); background: #eef0f2; }
.kpi-icon.orange { color: var(--accent); background: var(--accent-soft); }
.kpi-label {
  font-size: 10px; color: var(--ink);
  text-transform: none; letter-spacing: 0; line-height: 1.25;
  font-weight: 700;
}
.kpi-val { font-size: 20px; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; }
.kpi-delta { font-size: 11px; font-weight: 700; }
.kpi-delta.up { color: var(--ink); }
.kpi-delta.down { color: var(--accent); }
.kpi-delta.flat { color: var(--muted); }
.kpi-note { font-size: 10.5px; color: var(--muted); }

/* Backoffice cards */
.bo-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px;
}
.bo-card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.bo-card-title { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.bo-card-meta { font-size: 11.5px; color: var(--muted); }

.bo-analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
/* Two cards per row: the trend chart beside the attribution donut. The trend
   SVG has preserveAspectRatio="none" + non-scaling strokes, so it compresses
   to the half-width column cleanly. */

.bo-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
.bo-products-card { grid-column: 1 / -1; }
/* Knowledge gaps surfaced higher and emphasised with a soft brand-red tint. */
.bo-gaps-card { border-color: rgba(208, 18, 26, 0.35); background: linear-gradient(180deg, #fff, #f7f8ff); }
.bo-gaps-card .bo-card-title { color: var(--accent); }

.intent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.intent-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.intent-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  align-items: center;
}
.intent-list span {
  color: var(--ink);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.intent-list strong { color: var(--muted); font-size: 12px; }
.intent-list i {
  grid-column: 1 / -1;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
}

.bo-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

/* Trend chart */
.bo-trend-card { min-height: 290px; }
.bo-mini-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 7px 12px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}
.bo-legend { display: flex; gap: 18px; margin: -3px 0 8px; color: var(--muted); font-size: 11.5px; }
.bo-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bo-legend i { width: 16px; height: 2px; display: inline-block; border-radius: 999px; }
.line-blue { background: var(--accent); }
.line-green { background: var(--muted); }
.trend-chart { position: relative; height: 220px; }
.trend-svg { width: 100%; height: 190px; display: block; }
.trend-svg .grid { stroke: var(--line); stroke-width: 1; }
.series-blue { stroke: var(--accent); stroke-width: 2.2; vector-effect: non-scaling-stroke; }
.series-green { stroke: var(--muted); stroke-width: 2; vector-effect: non-scaling-stroke; }
.dot-blue { fill: var(--accent); }
.dot-green { fill: var(--muted); }
.chart-axis {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  color: var(--muted);
  font-size: 10.5px;
}
.chart-axis span { white-space: nowrap; }

.donut-wrap { display: grid; grid-template-columns: 132px 1fr; gap: 16px; align-items: center; min-height: 172px; }
.donut {
  width: 132px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0 59.3%, #2a2a31 59.3% 90.8%, #d9dde5 90.8% 100%);
  display: grid;
  place-items: center;
}
.donut > div {
  width: 82px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--paper);
  display: grid;
  place-items: center;
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--line);
}
.donut strong { font-size: 17px; color: var(--ink); }
.donut span { font-size: 11px; color: var(--muted); margin-top: -12px; }
.donut-legend { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.donut-legend span { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; row-gap: 2px; align-items: start; }
.donut-legend i { width: 9px; height: 9px; border-radius: 2px; margin-top: 3px; }
.donut-legend .direct { background: var(--accent); }
.donut-legend .assisted { background: #2a2a31; }
.donut-legend .other { background: #d9dde5; }
.donut-legend b { font-size: 12px; font-weight: 600; color: var(--ink); }
.donut-legend em { grid-column: 2; font-style: normal; font-size: 11.5px; color: var(--muted); }

.query-list,
.gap-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.query-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
/* The gaps card is a full-width banner under the KPIs, so its chips go two-up. */
.gap-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}
.query-list li,
.gap-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.query-list li:last-child,
.gap-list li:last-child { border-bottom: none; }
.query-list span,
.gap-list span { font-size: 12.2px; color: var(--ink); line-height: 1.35; }
.query-list strong,
.gap-list strong { font-size: 12px; color: var(--ink); }
.gap-list li {
  background: #fff0f0;
  border: 1px solid #fde0df;
  border-radius: 8px;
  padding: 9px 10px;
}

/* Recent-activity table */
.bo-activity-card { padding-bottom: 10px; }
.bo-table-wrap { overflow-x: auto; }
.bo-table { width: 100%; border-collapse: collapse; font-size: 12.3px; }
.bo-table th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); font-weight: 700; padding: 0 8px 9px; border-bottom: 1px solid var(--line);
}
.bo-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: middle; }
.bo-table tbody tr:last-child td { border-bottom: none; }
.bo-table td:nth-child(2) { color: var(--muted); max-width: 270px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bo-table td:nth-child(4) { color: var(--muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bo-table td:last-child { font-weight: 700; white-space: nowrap; }
.product-table td:first-child { color: var(--ink); max-width: 230px; }
.prod-cell { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.prod-cell i {
  width: 25px;
  height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: linear-gradient(180deg, #222, #4b4b52);
  color: #fff;
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
}
.prod-cell .prod-img {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 7px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  padding: 2px;
}
.prod-cell span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-cell small { display: block; color: var(--muted); font-size: 10.5px; font-weight: 400; margin-top: 1px; }
.tag-pill { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.tag-pill.rec { background: #eceef1; color: #3a3f47; }
.tag-pill.cart { background: var(--accent-soft); color: var(--accent); }
.tag-pill.ok { background: var(--ink); color: #fff; }

@media (max-width: 720px) {
  /* Stack the header: brand row, then the date/filter controls on their own
     row — side by side they overflowed past the right edge on phones. */
  .bo-header { padding: 14px 20px; flex-direction: column; align-items: stretch; gap: 10px; }
  .bo-head-right { justify-content: flex-start; }
  .side-tab {
    top: auto;
    bottom: 0;
    left: auto;
    right: 16px;
    margin-left: 0;
    transform: none;
    writing-mode: horizontal-tb;
    padding: 9px 14px;
    border-radius: 13px 13px 0 0;
  }
  .side-tab span { transform: none; }
  /* min-width:0 lets the title column shrink below its nowrap content's
     intrinsic width — without it the subtitle pushes past the card border
     instead of ellipsizing. */
  .bo-brand { min-width: 0; }
  .bo-titles { min-width: 0; }
  .bo-sub { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bo-body { padding: 16px 22px 22px; gap: 12px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Four KPIs on phones — a clean 2x2. The fifth (conversion rate) would
     dangle alone on a third row. */
  .kpi:nth-child(5) { display: none; }
  .kpi { min-width: 0; }
  .kpi-val { font-size: 19px; }
  .kpi-note { display: none; }
  .bo-analytics-grid,
  .bo-bottom-grid,
  .gap-list { grid-template-columns: 1fr; }
  .intent-list { grid-template-columns: 1fr; }
  .bo-trend-card { min-height: 0; }
  .trend-chart { height: 206px; }
  .trend-svg { height: 176px; }
  .chart-axis { font-size: 9.5px; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; text-align: left; }
  .donut-legend { width: 100%; }
  .bo-card-head { align-items: flex-start; gap: 10px; }
  .bo-card-meta { white-space: nowrap; }
  .bo-table-wrap { overflow: visible; }
  .bo-table,
  .bo-table thead,
  .bo-table tbody,
  .bo-table tr,
  .bo-table td { display: block; width: 100%; }
  .bo-table thead { display: none; }
  .bo-table tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  .bo-table tbody tr:last-child { border-bottom: none; }
  .bo-table td {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 3px 0;
    border-bottom: none;
    white-space: normal;
  }
  .bo-table .tag-pill { justify-self: start; }
  .bo-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .bo-table td:nth-child(2),
  .bo-table td:nth-child(4) {
    max-width: none;
    white-space: normal;
    overflow: visible;
  }
  .product-table td:first-child { max-width: none; }
  .prod-cell span { white-space: normal; }
}

@media (max-width: 390px) {
  .bo-body { padding-left: 16px; padding-right: 16px; }
  .bo-head-right { gap: 8px; }
  .bo-control { height: 34px; padding: 0 9px; font-size: 11px; }
  .bo-control:first-child { display: none; }
  .kpi-grid { gap: 8px; }
  .kpi { padding: 10px 10px 10px 50px; min-height: 96px; }
  .kpi-icon { left: 10px; top: 16px; width: 31px; height: 31px; }
  .kpi-val { font-size: 18px; }
  .bo-card { padding: 13px 14px; }
}

/* [REPLACE:LANG] EN-only builds add class="single-lang" on <body> to hide the
   language switch (the i18n machinery stays for a later second language). */
body.single-lang .lang-switch { display: none; }
