/* Glow Korean design system (docs/design/DESIGN.md). Mobile-first, no build step.
   The CSP is style-src 'self': every style lives here, never in a style attribute. */

/* ------------------------------------------------------------------ fonts (SIL OFL,
   self-hosted: static/fonts/<family>/OFL.txt; variable woff2, latin subset) */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/static/fonts/montserrat/montserrat-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Mulish";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("/static/fonts/mulish/mulish-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------------ tokens */
:root {
  --cream: #F3EEE4;      /* page ground */
  --surface: #FFFFFF;    /* cards, header, nav */
  --ink: #49362D;        /* text, primary buttons, main bars */
  --ink-hover: #2E211B;
  --ink-2: #6F6056;      /* secondary text (≥4.5:1 on white and cream) */
  --ink-3: #8A7B70;      /* inactive nav icons; input borders (≥3:1) */
  --line: #E6DED1;
  --line-soft: #F0E9DD;
  --sand: #E9DFCF;       /* neutral pill */
  --good: #2F6B4F;
  --good-bg: #DCEFE4;
  --warn: #9C2F48;
  --warn-bg: #F7E1E6;
  --info: #24577E;       /* text */
  --info-bar: #2E6A99;   /* bars */
  --info-bg: #DDEBF6;
  --web: #B07A52;
  --on-ink-2: #EADFD3;   /* secondary text on ink */

  --font-display: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Mulish", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-card: 18px;
  --r-control: 12px;
  --r-pill: 999px;
  --tap: 44px;
  --gap: 16px;
  --tabbar-h: 64px;

  color-scheme: light;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-body);
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; }
h1 { font-weight: 300; font-size: 30px; margin: 0 0 12px; }
h2 { font-weight: 600; font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 8px; }
a { color: var(--ink); }
a:hover { color: var(--ink-hover); }
:focus-visible { outline: 3px solid var(--info-bar); outline-offset: 2px; }
main:focus { outline: none; }
code { font-size: 0.9em; overflow-wrap: anywhere; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -100px; z-index: 50;
  background: var(--surface); padding: 10px 14px; border-radius: var(--r-control);
}
.skip-link:focus { top: 8px; }

/* ------------------------------------------------------------------ app bar */
.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: calc(14px + env(safe-area-inset-top)) 20px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-height: var(--tap);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.5px;
  line-height: 0.95;
  text-decoration: none;
  color: var(--ink);
}
.appbar-end { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px 12px; }
.who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.who-name { font-family: var(--font-display); font-weight: 500; font-size: 13px; }
.who-role { font-size: 12px; color: var(--ink-2); }
.logout { margin: 0; }

/* Inventory (SPEC §2.2 G1). */
.filter-links { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 var(--gap); }
/* Product names wrap between words (row links break anywhere, for long URLs). */
.product-card .row-link { word-break: normal; overflow-wrap: anywhere; }
.actions-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 var(--gap); }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-size: 14px; }
.scan-form { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: end; }
.scan-form label { grid-column: 1 / -1; margin: 0; }
.count-lines > li { border-bottom: 1px solid var(--line-soft); padding: 10px 0; }
.count-line { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 0; }
.count-name { grid-column: 1 / -1; font-size: 14px; font-weight: 600; }
.count-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); margin: 0; }
.count-line .alert { grid-column: 1 / -1; }

/* Area switcher (owner, admin) and the read-only label, under the header (SPEC §8). */
.areabar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  padding: 4px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.areas-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.area-link {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 12px;
  border-radius: var(--r-pill); font-size: 14px; font-weight: 500; color: var(--ink-2); text-decoration: none;
}
.area-link:hover { color: var(--ink); }
/* Not colour alone: the current area is bold and underlined. */
.area-link[aria-current=true] { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }

/* ------------------------------------------------------------------ layout */
.container { max-width: 640px; margin: 0 auto; padding: 18px 16px 24px; }
.page-head { margin-bottom: var(--gap); }
.page-head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.page-title { margin: 0; font-size: 30px; font-weight: 300; line-height: 1.1; }
.page-note { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
.section-title { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack > .section-title { margin: 0; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.cols { display: grid; gap: var(--gap); margin-bottom: var(--gap); }
.cols > .card { margin-bottom: 0; }
.card-grid, .list-cards, .chat-list, .bars, .rows {
  list-style: none; margin: 0; padding: 0;
}
.card-grid { display: grid; gap: var(--gap); margin-bottom: var(--gap); }
.list-cards { display: flex; flex-direction: column; gap: 10px; }
.footnote { font-size: 12px; color: var(--ink-2); line-height: 1.5; margin: var(--gap) 0 0; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface);
  border-radius: var(--r-card);
  padding: 16px;
  margin-bottom: var(--gap);
}
.card-grid .card, .list-cards .card, .chat-list .card { margin-bottom: 0; }
.card-text { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin: 0; }
.card-note { font-size: 12px; color: var(--ink-2); line-height: 1.5; margin: 8px 0 0; }
.narrow { max-width: 420px; margin: 24px auto; }
.eyebrow { font-size: 12px; font-weight: 700; color: var(--ink-2); margin: 0; }

.empty { padding: 20px 16px; }
.empty-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; margin: 0 0 4px; }
.empty-text, .empty-inline { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin: 0; }

/* ------------------------------------------------------------------ pills */
.pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  background: var(--sand);
  color: var(--ink);
}
.pill-lg { font-size: 12px; padding: 6px 10px; }
.pill-sand { background: var(--sand); color: var(--ink); }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-ink { background: var(--ink); color: var(--surface); }

/* ------------------------------------------------------------------ forms & buttons */
label { display: block; font-weight: 700; font-size: 13px; margin: 12px 0 4px; }
.stack-sm label { margin: 0; }
input[type=email], input[type=password], input[type=text], input[type=search] {
  width: 100%;
  min-height: 48px;
  font: 400 16px/1.3 var(--font-body); /* 16px prevents iOS zoom on focus */
  padding: 0 14px;
  border: 1px solid var(--ink-3);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
}
input[aria-invalid=true] { border-color: var(--warn); border-width: 2px; }
.hint { font-size: 12px; color: var(--ink-2); margin: 0; }

button, .btn {
  display: block;
  width: 100%;
  min-height: var(--tap);
  margin-top: 16px;
  padding: 10px 16px;
  font: 700 14px/1.2 var(--font-body);
  border: 0;
  border-radius: var(--r-control);
  background: var(--ink);
  color: var(--surface);
  cursor: pointer;
  text-align: center;
}
button:hover, .btn:hover { background: var(--ink-hover); }
.btn { margin-top: 0; }
a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.btn-inline { width: auto; min-width: 110px; padding: 8px 14px; }
.btn-lg { min-height: 48px; font-size: 15px; }
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--ink-3);
}
.btn-secondary:hover { background: var(--cream); }
.btn-link, button.link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: var(--tap);
  min-height: var(--tap);
  margin: 0;
  padding: 0 4px;
  background: none;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-link:hover, button.link:hover { background: none; color: inherit; }
.actions { display: flex; gap: 10px; }
.actions > .btn { flex: 1; }

.alert {
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 600;
  border-radius: var(--r-control);
  padding: 10px 12px;
  margin: 0;
}
.alert-card { background: var(--warn-bg); color: var(--warn); }
.notice { background: var(--sand); }
.muted { color: var(--ink-2); font-size: 14px; }
.qr { display: block; margin: 12px auto; background: #fff; border-radius: 8px; max-width: 100%; height: auto; }
.secret { display: block; word-break: break-all; padding: 8px; background: var(--cream); border-radius: 6px; }
.secret-inline { margin-left: 8px; padding: 2px 6px; background: var(--cream); border-radius: 6px; font-weight: 600; }
.steps { padding-left: 20px; }
ul.plain { padding-left: 18px; margin: 0 0 8px; }

/* ------------------------------------------------------------------ KPIs & trends */
.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: var(--gap);
}
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 14px; margin: 0; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.kpi-value { font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1.15; }
.kpi-note { font-size: 12px; color: var(--ink-2); }
.trend { font-size: 12px; font-weight: 700; }
.trend-good { color: var(--good); }
.trend-bad { color: var(--warn); }

/* ------------------------------------------------------------------ call to action */
.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tap);
  margin-bottom: var(--gap);
  padding: 14px 16px;
  border-radius: var(--r-card);
  background: var(--ink);
  color: var(--surface);
  text-decoration: none;
}
.cta:hover { background: var(--ink-hover); color: var(--surface); }
.cta-text { display: flex; flex-direction: column; gap: 2px; }
.cta-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.cta-note { font-size: 12px; color: var(--on-ink-2); }
.cta-icon { flex-shrink: 0; }

/* ------------------------------------------------------------------ bars (inline SVG) */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; flex-direction: column; gap: 6px; }
.bar-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.bar-label { font-weight: 600; }
.bar-value { color: var(--ink-2); white-space: nowrap; }
.bar { display: block; width: 100%; height: 8px; }
.bar-track { fill: var(--cream); }
.bar-ink { fill: var(--ink); }
.bar-good { fill: var(--good); }
.bar-info { fill: var(--info-bar); }
.bar-web { fill: var(--web); }

/* ------------------------------------------------------------------ media rows */
.media-row { display: flex; align-items: center; gap: 12px; padding: 14px; }
.thumb {
  display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: 14px;
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
}
.thumb-warn, .avatar-warn { background: var(--warn-bg); }
.thumb-info, .avatar-info { background: var(--info-bg); }
.thumb-good, .avatar-good { background: var(--good-bg); }
.avatar-sand { background: var(--sand); }
.media-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.media-title { font-size: 14px; font-weight: 600; line-height: 1.25; }
.media-meta { font-size: 12px; color: var(--ink-2); }
.media-num { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.num { font-family: var(--font-display); font-weight: 600; font-size: 15px; white-space: nowrap; }
.num-label { font-size: 11px; color: var(--ink-2); }

/* ------------------------------------------------------------------ ads */
.ad { display: flex; flex-direction: column; gap: 12px; }
.ad-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ad-who { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ad-name { font-family: var(--font-body); font-size: 14px; font-weight: 600; line-height: 1.25; margin: 0; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.metric { display: flex; flex-direction: column; gap: 2px; }
.metric dt { font-size: 11px; color: var(--ink-2); }
.metric dd { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.ad .card-note { margin: 0; }

/* ------------------------------------------------------------------ proposals & outcomes */
.proposal { display: flex; flex-direction: column; gap: 10px; }
.proposal-title { font-size: 16px; font-weight: 600; line-height: 1.3; margin: 0; }
.proposal-why { font-size: 13px; line-height: 1.5; margin: 0; }
.outcome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-radius: var(--r-control);
  padding: 4px 8px 4px 12px;
}
.outcome-stack { flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; }
.outcome-text { font-size: 13px; font-weight: 700; }
.outcome-note { font-size: 12px; }
.outcome-good { background: var(--good-bg); color: var(--good); }
.outcome-warn { background: var(--warn-bg); color: var(--warn); }

/* ------------------------------------------------------------------ rows & link box */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  border-top: 1px solid var(--line-soft);
}
.row-label { font-size: 14px; font-weight: 600; }
.row-meta { font-size: 12px; color: var(--ink-2); text-align: right; }
.row-link { color: var(--ink); text-underline-offset: 2px; min-height: var(--tap); display: inline-flex; align-items: center; word-break: break-all; }
.row-issue { flex-direction: column; align-items: flex-start; gap: 2px; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stack-xs { display: flex; flex-direction: column; gap: 4px; }
.stack-xs label { margin: 0; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* Grid items default to min-width: auto; date inputs would push the page wider than a phone. */
.field-pair > * { min-width: 0; }
.link-list { list-style: none; margin: 0; padding: 0; }
input[type=date], input[type=time] {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  font: 400 16px/1.3 var(--font-body);
  padding: 0 12px;
  border: 1px solid var(--ink-3);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
}
.row-meta-left { text-align: left; font-size: 13px; }
input[type=file] {
  width: 100%;
  min-height: var(--tap);
  font: 400 14px/1.3 var(--font-body);
  padding: 10px 12px;
  border: 1px dashed var(--ink-3);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
}
input[type=file]::file-selector-button {
  font: 700 13px/1.2 var(--font-body);
  margin-right: 10px;
  padding: 8px 12px;
  border: 1px solid var(--ink-3);
  border-radius: var(--r-control);
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
}
.linkbox {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--cream);
  border-radius: var(--r-control);
  padding: 12px;
}
.linkbox-code { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.linkbox-url { font-size: 15px; font-weight: 700; word-break: break-all; }
.linkbox .btn { margin-top: 6px; }

/* "Ahora promocionamos" (fixed bio link, SPEC §6.7) */
.promo {
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  padding: 12px;
}
.promo-title { font-size: 14px; font-weight: 700; }
.promo-meta, .choice-meta { font-size: 12px; color: var(--ink-2); }
.promo-change > summary { list-style: none; display: flex; align-items: center; justify-content: center; }
.promo-change > summary::-webkit-details-marker { display: none; }
.promo-change[open] > summary { margin-bottom: 10px; }
.choices { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap);
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  font-weight: 400;
  cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--ink); background: var(--cream); }
.choice input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); flex: none; }
.choice-text { display: flex; flex-direction: column; gap: 2px; }
.choice-title { font-size: 14px; font-weight: 600; }

/* ------------------------------------------------------------------ tab bar (owner) */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
}
.tabbar-list {
  display: grid;
  /* One row whatever the number of tabs (/gerencia has six from B3). */
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 640px;
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  border-radius: var(--r-control);
  text-decoration: none;
  color: var(--ink-2);
}
.tab-icon { color: var(--ink-3); }
.tab-label { font-size: 11px; font-weight: 500; max-width: 100%; overflow-wrap: anywhere; text-align: center; }
.tab:hover { color: var(--ink); }
.tab[aria-current=page] { color: var(--ink); }
.tab[aria-current=page] .tab-icon { color: var(--ink); }
.tab[aria-current=page] .tab-label { font-weight: 700; }
/* Not colour alone: the current tab also gets a bar. */
.tab[aria-current=page]::before {
  content: "";
  position: absolute;
  top: -6px; left: 30%; right: 30%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--ink);
}
.tab-badge-slot { position: absolute; top: 2px; left: calc(50% + 6px); }
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--warn); color: var(--surface);
  font-size: 11px; font-weight: 700;
}
body.has-tabbar .container { padding-bottom: calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); }

/* ------------------------------------------------------------------ ventas */
.ventas-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); align-items: start; }
.ventas-grid > .card { margin-bottom: 0; }
.chat-list { display: flex; flex-direction: column; gap: 14px; }
.chat { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.chat-head { display: flex; align-items: center; gap: 10px; }
.avatar {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 50%;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
}
.chat-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.chat-name { font-family: var(--font-body); font-size: 14px; font-weight: 700; margin: 0; }
.chat-meta { font-size: 12px; color: var(--ink-2); }
.chat-last { font-size: 13px; line-height: 1.45; margin: 0; }

/* ------------------------------------------------------------------ "Vendida" sheet */
dialog.sheet {
  width: 100%;
  max-width: 480px;
  margin: auto auto 0;
  padding: 22px 20px calc(28px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  color: var(--ink);
}
dialog.sheet::backdrop { background: rgba(46, 33, 27, 0.45); }
dialog.sheet[open] { display: flex; flex-direction: column; gap: 14px; }
.sheet-meta { font-size: 12px; font-weight: 700; color: var(--ink-2); margin: 0; }
.sheet-title { font-family: var(--font-display); font-weight: 500; font-size: 20px; line-height: 1.25; margin: 0 0 10px; }
.sheet-text { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin: 0 0 14px; }
#vendida-body .alert { margin-bottom: 12px; }
.sheet-cancel { margin: 0; }

/* ------------------------------------------------------------------ desktop */
@media (min-width: 900px) {
  .container { max-width: 1080px; padding: 28px 24px 40px; }
  /* Header content lines up with the 1080px content column. */
  .appbar { padding-inline: max(24px, calc((100% - 1080px) / 2 + 24px)); }

  /* The bottom bar becomes a top bar under the header. */
  .tabbar {
    position: sticky;
    top: 0;
    bottom: auto;
    border-top: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 24px;
  }
  .tabbar-list { display: flex; gap: 4px; max-width: 1080px; }
  .tab { flex-direction: row; gap: 8px; min-height: 52px; padding: 0 14px; border-radius: 0; }
  .tab-label { font-size: 14px; }
  .tab[aria-current=page]::before { top: auto; bottom: 0; left: 10px; right: 10px; border-radius: 3px 3px 0 0; }
  .tab-badge-slot { position: static; }
  body.has-tabbar .container { padding-bottom: 40px; }

  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
  .ventas-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .chat-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }

  dialog.sheet { margin: auto; border-radius: 24px; padding-bottom: 28px; }
}

/* ------------------------------------------------------------------ public pages */
.prose ul { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.6; color: var(--ink); }
.prose h2 { margin-top: 8px; }

/* ------------------------------------------------------------------ /ventas real mode */
.origin-form { display: flex; flex-direction: column; gap: 6px; }
.origin-form label { margin: 0; }
.origin-row { display: flex; gap: 8px; }
select.control {
  width: 100%;
  min-height: 48px;
  font: 400 16px/1.3 var(--font-body);
  padding: 0 10px;
  border: 1px solid var(--ink-3);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
}
.nowrap { white-space: nowrap; }
.choices legend { font-weight: 700; font-size: 13px; margin: 12px 0 4px; padding: 0; }
.chat-ai { margin: 6px 0 0; }
.chat-ai .chat-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chat-ai-stage { font-size: 12px; color: var(--ink-2); }
.chat-ai-summary { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }
.toast { margin: 8px 0 0; padding: 10px 14px; border-radius: var(--r-control); background: var(--good-bg); color: var(--good); font-weight: 700; font-size: 14px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-actions .btn { margin-top: 0; width: auto; }
.pending-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pending-form label { margin: 0; }
.pending-form .btn { margin-top: 4px; }
.origin-row select {
  flex: 1;
  min-height: var(--tap);
  font: 400 15px/1.3 var(--font-body);
  padding: 0 10px;
  border: 1px solid var(--ink-3);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
}
.outcome-lost { background: var(--sand); color: var(--ink); }
.suggestion { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }

/* Money (SPEC §2.2 G2): the month's result as a statement, amounts right-aligned. */
.statement { display: flex; flex-direction: column; margin: 0; }
.statement-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.statement-row dt { margin: 0; }
.statement-row dd { margin: 0; font-family: var(--font-display); font-weight: 600; white-space: nowrap; }
.statement-total { border-bottom: 2px solid var(--line); }
.statement-total dt, .statement-total dd { font-weight: 700; }
.statement-note { display: block; font-size: 12px; font-weight: 400; color: var(--ink-2); }
.restock-group + .restock-group, .restock-group + .money-detail, .money-detail + .restock-group { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.money-detail > summary { cursor: pointer; font-size: 13px; color: var(--ink-2); min-height: var(--tap); display: flex; align-items: center; }
.money-form { display: grid; gap: 8px; }
.money-form label { margin: 0; }
.receipt-photo { display: block; max-width: 100%; height: auto; border-radius: var(--r-control); border: 1px solid var(--line); }

/* ------------------------------------------------------------------ follow-up (SPEC §2.2 G3) */
/* /gerencia on phones: Conteo, Marketing and Equipo live under "Más"; from 900 px all show. */
.tabbar-list > .tab-wide { display: none; }
.tab-under-more { color: var(--ink); }
.tab-under-more .tab-icon { color: var(--ink); }
.tab-under-more .tab-label { font-weight: 700; }
.tab-under-more::before {
  content: "";
  position: absolute;
  top: -6px; left: 30%; right: 30%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--ink);
}
@media (min-width: 900px) {
  .tabbar-list > .tab-wide { display: block; }
  .tabbar-list > .tab-narrow { display: none; }
}
/* The product picker of a sale. */
.picker { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 0; padding: 0; border: 0; min-width: 0; }
.picker legend { font-weight: 700; font-size: 13px; margin: 0 0 4px; padding: 0; }
.item-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.item-rows:empty { display: none; }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.item-name { font-size: 14px; overflow-wrap: anywhere; }
select.control-qty { min-height: var(--tap); }
.picker-add { display: flex; flex-direction: column; gap: 6px; }
.picker-field label { margin: 0 0 4px; }
.picker-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.picker-results { display: flex; flex-direction: column; gap: 4px; }
.picker-results .hint { margin: 0; }
.picker-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.btn-chip { width: auto; min-height: var(--tap); margin: 0; padding: 6px 12px; font-size: 13px; text-align: left; white-space: normal; }
/* Recontact outcomes: one tap each. */
.recontact { gap: 6px; }
.outcomes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.outcomes-label { flex-basis: 100%; font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.outcomes .btn-link { min-height: var(--tap); }
/* Duration review rows and type forms. */
.duration-form { display: grid; gap: 8px; margin-top: 8px; }
.duration-form label { margin: 0; }
.size-pair { display: grid; grid-template-columns: minmax(0, 1fr) 8rem; gap: 8px; }
input[type=search] { -webkit-appearance: none; appearance: none; }
.picker-input .btn { margin-top: 0; }

/* Intake note (SPEC §2.2 G4): printed or saved as PDF from the browser. */
.note-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.note-table th, .note-table td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.note-table .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.note-scroll { overflow-x: auto; }
.note-code { display: block; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
@media print {
  .appbar, .areabar, .tabbar, .filter-links, .no-print, .skip-link { display: none !important; }
  body, .card { background: #fff !important; box-shadow: none !important; }
  .container { max-width: none; padding: 0; }
  .note-scroll { overflow: visible; }
}
