/* SUPPRA Control: design mockup styles. Light and dark themes share one set of tokens.
   Estilos de la maqueta de SUPPRA Control. Los temas claro y oscuro comparten tokens.

   Scale / Escala: text 12 · 13 · 14 · 15 · 20 · 40. Spacing 4 · 8 · 12 · 16 · 20 · 24.
   Radius 8 (small), 10 (fields), 16 (cards). Controls 40px high (32px small). */

:root {
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2fa;
  --ink: #0b1a3a;
  --muted: #56627f;
  --line: #e0e6f2;
  --brand: #1e4fd8;
  --brand-ink: #ffffff;
  --brand-soft: #e8eeff;
  --accent: #22b8f0;
  --ok: #0f7b55;
  --ok-bg: #e2f5ed;
  --warn: #8a5300;
  --warn-bg: #fff2d6;
  --err: #b3261e;
  --err-bg: #fdeae8;
  --hero-from: #0b1a3a;
  --hero-to: #1e4fd8;
  --panel-bg: #ffffff;
  --shape: #dce4f7;
  --shadow: 0 1px 2px rgba(11, 26, 58, 0.06), 0 8px 22px rgba(11, 26, 58, 0.06);
  --r-lg: 16px;
  --r-md: 10px;
  --r-sm: 8px;
  --ctl: 40px;
}

[data-theme="dark"] {
  --bg: #080d1c;
  --surface: #0f1830;
  --surface-2: #131f3f;
  --ink: #f2f5ff;
  --muted: #9aa7c7;
  --line: #1d2a4d;
  --brand: #5b8cff;
  --brand-ink: #081230;
  --brand-soft: #14224d;
  --accent: #3cc6f5;
  --ok: #4fd1a1;
  --ok-bg: #0e2b26;
  --warn: #f2b84b;
  --warn-bg: #2d2410;
  --err: #ff8a80;
  --err-bg: #331617;
  --hero-from: #0a1f66;
  --hero-to: #1a47c9;
  --panel-bg: linear-gradient(160deg, #0b1f66 0%, #0a2a8a 100%);
  --shape: rgba(120, 160, 255, 0.28);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 22px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.45;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Logo (approximation until the real file is provided) ---------- */
/* Official logos: black letters for the light theme, white letters for the dark one.
   Logos oficiales: letras negras para el tema claro, blancas para el oscuro. */
.logo { display: inline-block; line-height: 0; text-decoration: none; }
.logo img { display: block; width: 190px; height: auto; }
.logo.sm img { width: 136px; }
.logo .on-dark { display: none; }
[data-theme="dark"] .logo .on-light { display: none; }
[data-theme="dark"] .logo .on-dark { display: block; }

/* ---------- Buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--ctl); padding: 0 18px; border: 0; border-radius: var(--r-md);
  font-weight: 600; font-size: 14px; text-decoration: none; transition: transform 0.12s, filter 0.12s;
}
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary:active { transform: translateY(1px); }
.btn.primary:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }
.btn.quiet { background: var(--brand-soft); color: var(--brand); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--err); color: #fff; }
.btn.block { width: 100%; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; }
.opt { font-weight: 400; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.input {
  width: 100%; min-height: var(--ctl); padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
[data-theme="dark"] .input { background: #0c1429; }
.input::placeholder { color: var(--muted); opacity: 0.7; }
.input:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.input:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); border-color: var(--brand); }
.input-wrap { position: relative; }
.input-wrap .icon-btn { position: absolute; right: 4px; top: 4px; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border-radius: var(--r-md); }
.seg label { position: relative; flex: 1; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.seg span { display: block; padding: 7px 12px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--muted); text-align: center; white-space: nowrap; }
.seg input:checked + span { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); }
.seg input:disabled + span { opacity: 0.4; cursor: not-allowed; }
.seg.full { display: flex; width: 100%; }
.seg.full span { padding: 8px 6px; }

/* ---------- Login ---------- */
.login { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.login .input, .login .btn { min-height: 46px; }
.login-brand {
  position: relative; overflow: hidden; background: var(--panel-bg); padding: 40px 44px;
  display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--line);
}
[data-theme="dark"] .login-brand { border-right: 0; }
[data-theme="dark"] .login-brand .logo { color: #fff; }
/* The background of the posters (the products' icons), the same one the poster generator uses.
   El fondo de los posters (los íconos de los productos), el mismo del generador de posters. */
.login-brand::before { content: ""; position: absolute; inset: 0; background: url("/static/posters/bg-light.jpg") center / cover no-repeat; pointer-events: none; }
[data-theme="dark"] .login-brand::before { filter: invert(1); opacity: .14; }
.login-brand::after { content: ""; position: absolute; inset: auto 0 0 0; height: 45%; background: linear-gradient(to top, var(--panel-bg), transparent); pointer-events: none; }
.login-brand > * { position: relative; z-index: 1; }
.login-copy { position: relative; max-width: 330px; }
.login-copy h1 { font-size: 32px; line-height: 1.12; font-weight: 700; letter-spacing: -0.02em; }
.login-copy p { margin-top: 12px; font-size: 14px; color: var(--muted); }
[data-theme="dark"] .login-copy { color: #fff; }
[data-theme="dark"] .login-copy p { color: #b9c8f2; }
.login-form-side { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); position: relative; }
[data-theme="dark"] .login-form-side { background: #080d1c; }
.login-form { width: 100%; max-width: 340px; display: grid; gap: 16px; }
.login-form h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.login-form .lead { margin-top: -8px; font-size: 13px; color: var(--muted); }
.login-form .center { text-align: center; font-size: 13px; font-weight: 600; }
.login-form .note { text-align: center; font-size: 12px; color: var(--muted); }
.login .theme-btn { position: absolute; top: 16px; right: 16px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; }
.nav {
  position: sticky; top: 0; height: 100vh; padding: 20px 12px; display: flex; flex-direction: column; gap: 24px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.nav .logo { padding: 0 8px; }
.nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-md);
  color: var(--muted); font-weight: 500; text-decoration: none;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.who-wrap { margin-top: auto; position: relative; }
.nav .who { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: var(--r-md); background: var(--surface-2); font-size: 13px; text-align: left; cursor: pointer; }
.nav .who:hover { background: var(--brand-soft); }
.nav .who .who-text { margin-right: auto; }
.user-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 30; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); }
.user-menu[hidden] { display: none; }
.user-menu a { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-weight: 500; }
.user-menu a:hover { background: var(--surface-2); }
.user-menu .danger { color: var(--err); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 12px; }
.who small { display: block; color: var(--muted); font-size: 12px; line-height: 1.2; }

/* Logo mark (icon) in both themes / Ícono del logo en los dos temas */
.m-dark, [data-theme="dark"] .m-light { display: none; }
[data-theme="dark"] .m-dark { display: inline; }
/* Menu head: the wordmark has the whole width; the collapse button sits on the menu's edge
   Cabecera del menú: el logo tiene todo el ancho; el botón de contraer va en el borde */
.nav-head { display: flex; align-items: center; }
.nav-head .logo { flex: 1; min-width: 0; }
/* ".nav a" is stronger than a lone class, so the mark needs ".nav" in front to stay hidden */
.nav .nav-mark { display: none; align-items: center; justify-content: center; }
.nav-toggle {
  position: absolute; top: 22px; right: -13px; z-index: 6; width: 26px; height: 26px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); box-shadow: var(--shadow);
}
.nav-toggle:hover { background: var(--surface-2); color: var(--ink); }
.nav-toggle .i { width: 14px; height: 14px; transition: transform 0.15s; }
/* Phone-only pieces of the top bar and the drawer backdrop / Piezas del celular */
.topbar-logo { display: none; flex: none; align-items: center; }
.nav-backdrop { position: fixed; inset: 0; z-index: 49; background: rgba(8, 13, 28, 0.5); }
.nav-backdrop[hidden] { display: none; }

/* Collapsed menu, computers only / Menú contraído, solo en computador */
@media (min-width: 861px) {
  [data-nav="collapsed"] .app { grid-template-columns: 68px 1fr; }
  [data-nav="collapsed"] .nav { padding: 20px 8px; align-items: center; }
  [data-nav="collapsed"] .nav-head { justify-content: center; }
  [data-nav="collapsed"] .nav-head .logo { display: none; }
  [data-nav="collapsed"] .nav .nav-mark { display: flex; }
  [data-nav="collapsed"] .nav-mark img { height: 24px; width: auto; }
  [data-nav="collapsed"] .nav-toggle .i { transform: rotate(180deg); }
  [data-nav="collapsed"] .nav ul { width: 100%; }
  [data-nav="collapsed"] .nav a { justify-content: center; padding: 10px 0; }
  [data-nav="collapsed"] .nav-label { display: none; }
  [data-nav="collapsed"] .nav .who { justify-content: center; padding: 6px; }
  [data-nav="collapsed"] .nav .who .who-text, [data-nav="collapsed"] .nav .who > .i { display: none; }
  [data-nav="collapsed"] .user-menu { left: 0; right: auto; min-width: 190px; }
}

.main { min-width: 0; padding: 0 24px 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 0 14px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); }
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin-right: auto; }
.trm { display: flex; align-items: center; gap: 8px; padding: 3px 4px 3px 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
.trm-text { display: grid; line-height: 1.15; min-width: 0; }
.trm b { font-size: 14px; font-weight: 700; }
.trm small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.trm .src { display: none; }
.trm .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.trm .icon-btn { width: 30px; height: 30px; }
.trm .icon-btn:hover { background: var(--brand-soft); color: var(--brand); }
@media (min-width: 1180px) { .trm .src { display: inline; } }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); font-size: 13px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.err { background: var(--err-bg); color: var(--err); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner[hidden] { display: none; }
.banner svg { margin-top: 1px; }
.banner strong { font-weight: 600; }
#trmBanner:not(:empty) { margin-bottom: 12px; }

/* ---------- Quoter ---------- */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.quote-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 20px 20px; display: grid; gap: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; }
.card-head h2 { font-size: 15px; font-weight: 600; }

.group { display: grid; gap: 10px; padding-left: 14px; border-left: 3px solid var(--line); transition: border-color 0.2s; }
.group.current { border-left-color: var(--brand); }
.group.done { border-left-color: color-mix(in srgb, var(--ok) 55%, var(--line)); }
.group-head { display: flex; align-items: center; gap: 8px; }
.group-head h3 { font-size: 14px; font-weight: 600; }
.step-no { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 12px; }
.group.current .step-no { background: var(--brand); color: var(--brand-ink); }
.group.done .step-no { background: var(--ok-bg); color: var(--ok); }
.group-head .tip { margin-left: auto; font-size: 12px; color: var(--muted); }
.group.current .tip { color: var(--brand); font-weight: 500; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* Price and route are stacked: side by side the price column was too narrow for its number */
.duo { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.price-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 8px; align-items: end; }
/* the price is the main data: bigger number; its USD/COP switch sits right beside it */
.price-row > .field:first-child .input { font-size: 18px; font-weight: 600; }
.price-row .seg { height: var(--ctl); align-self: end; }
.price-row .seg span { padding: 6px 8px; font-size: 12px; }
/* the quantity is secondary: its own line, label beside a narrow box */
.price-row .qty { grid-column: 1 / -1; display: flex; flex-direction: row; align-items: center; gap: 10px; }
.price-row .qty .input { width: 5.5rem; text-align: center; }
/* The price section measures itself: if it is too narrow for the price and the switch side by
   side, the switch goes right under the price box (never squeezing the number)
   La sección mide su propio ancho: si no cabe el precio con el selector al lado, el selector baja
   justo debajo del precio (sin apretar el número) */
#step2 { container-type: inline-size; }
/* Wide enough: price, currency switch and quantity share one line, in that order */
@container (min-width: 400px) {
  .price-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .price-row .qty { grid-column: auto; }
}
@container (max-width: 250px) {
  .price-row { grid-template-columns: minmax(0, 1fr); }
  .price-row .seg { justify-self: start; }
}
.money .input { padding-left: 30px; font-weight: 600; }
/* The prefix decides the room it needs, so no field can overlap it. / El prefijo decide el espacio que necesita. */
.money[data-sym="US$"] .input { padding-left: 46px; }
.money::before { content: attr(data-sym); position: absolute; left: 12px; top: 9px; font-weight: 600; color: var(--muted); z-index: 1; font-size: 13px; }
.more > summary { cursor: pointer; font-size: 13px; color: var(--brand); font-weight: 500; width: fit-content; list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "+ "; }
.more[open] > summary::before { content: "− "; }
.more .grid-2 { margin-top: 10px; }

.extra { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); }
.extra[hidden] { display: none; }
.extra.two { grid-template-columns: 1fr auto; align-items: end; }
.extra .wide { grid-column: 1 / -1; }
.locker-info { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }

.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow);
}
.combo-list[hidden] { display: none; }
.combo-list li { padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.combo-list li:hover, .combo-list li:first-child { background: var(--brand-soft); }
.combo-list .make { color: var(--brand); font-weight: 600; }
.similar { font-size: 12px; padding: 6px 10px; border-radius: var(--r-sm); background: var(--warn-bg); color: var(--warn); display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.similar[hidden] { display: none; }

/* ---------- Result column ---------- */
.result { position: sticky; top: 68px; display: grid; gap: 12px; }
.slot { display: grid; min-height: 178px; }
.slot[hidden] { display: none; }
.price-card[hidden], .waiting[hidden], .panel[hidden] { display: none; }
.price-card {
  position: relative; overflow: hidden; padding: 18px 20px; color: #fff; border-radius: var(--r-lg);
  background: linear-gradient(155deg, var(--hero-from), var(--hero-to)); box-shadow: 0 14px 30px rgba(30, 79, 216, 0.25);
  display: grid; align-content: space-between; gap: 12px;
}
.price-card::after { content: ""; position: absolute; right: -36px; top: -44px; width: 130px; height: 130px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.16); }
.price-card .label { font-size: 12px; opacity: 0.8; }
.price-card .price { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.price-card .price small { font-size: 13px; font-weight: 500; opacity: 0.75; margin-left: 6px; letter-spacing: 0; }
.pay-split { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-split div { padding: 8px 12px; border-radius: var(--r-md); background: rgba(255, 255, 255, 0.13); }
.pay-split span { display: block; font-size: 12px; opacity: 0.8; line-height: 1.3; }
.pay-split b { font-size: 16px; font-weight: 700; }
.price-card .full { font-size: 12px; opacity: 0.85; }
.card-foot { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.margin-chip { border: 0; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 500; background: rgba(255, 255, 255, 0.16); color: #fff; }
.margin-chip:hover { background: rgba(255, 255, 255, 0.26); }
.margin-chip.custom { background: #fff; color: #1e4fd8; font-weight: 600; }
.waiting { padding: 18px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1.5px dashed var(--line); display: grid; align-content: center; gap: 10px; }
.waiting h3 { font-size: 15px; font-weight: 600; }
.waiting p { font-size: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 600; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.tablist { display: flex; gap: 4px; padding: 6px 8px 0; border-bottom: 1px solid var(--line); }
.tablist button { border: 0; background: transparent; padding: 8px 10px; font-size: 13px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tablist button[aria-selected="true"] { color: var(--brand); font-weight: 600; border-bottom-color: var(--brand); }
.tabpanel { padding: 12px 16px 14px; display: grid; gap: 8px; font-size: 13px; max-height: 210px; overflow: auto; }
.tabpanel[hidden] { display: none; }
.kv { display: flex; justify-content: space-between; gap: 12px; }
.kv span { color: var(--muted); }
.kv.total { padding-top: 6px; border-top: 1px solid var(--line); }
.kv.total span { color: var(--ink); font-weight: 600; }
.compare { display: grid; gap: 6px; }
.compare-row { position: relative; display: grid; grid-template-columns: 16px 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); border: 1.5px solid transparent; background: var(--surface-2); font-size: 13px; cursor: pointer; }
.compare-row:hover { border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.compare-row.active { border-color: var(--brand); background: var(--brand-soft); }
.compare-row input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.compare-row:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 1px; }
.compare-row .radio { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.compare-row.active .radio { border: 5px solid var(--brand); }
.compare-row .name { font-weight: 600; }
.compare-row small { color: var(--muted); font-size: 12px; font-weight: 400; }
.compare-row .gain { grid-column: 2 / -1; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.compare-row b { font-weight: 700; text-align: right; }
.compare-row .tag { font-weight: 600; color: var(--brand); font-size: 11px; }
.post { padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); white-space: pre-line; font-size: 13px; }

.save { padding: 14px 16px; display: grid; gap: 10px; }
.save-head { display: flex; align-items: center; justify-content: space-between; }
.save-head h3 { font-size: 15px; font-weight: 600; }
.new-customer { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.new-customer[hidden] { display: none; }
.order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.order-list[hidden] { display: none; }
.order-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: var(--r-sm); background: var(--surface-2); }
.order-list .total { background: var(--brand-soft); font-weight: 700; }
/* Visible confirmations / Confirmaciones visibles */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 10px; width: min(460px, calc(100vw - 32px)); pointer-events: none; }
.toast-item { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: var(--r-lg); background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 18px 40px rgba(11, 26, 58, 0.22); font-size: 14px; font-weight: 500; line-height: 1.35; pointer-events: auto; opacity: 0; transform: translateY(14px) scale(0.98); transition: opacity 0.22s ease, transform 0.22s ease; }
.toast-item.show { opacity: 1; transform: none; }
.toast-badge { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px; background: var(--ok); color: #fff; }
.toast-item.err .toast-badge { background: var(--err); }
.toast-item.info .toast-badge { background: var(--brand); }
.toast-badge .i { width: 18px; height: 18px; stroke-width: 2.6; }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.toast-close:hover { background: var(--surface-2); color: var(--ink); }
.toast-close .i { width: 16px; height: 16px; }
@media (max-width: 860px) { .toasts { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } }
@media (prefers-reduced-motion: reduce) { .toast-item { transition: opacity 0.1s; transform: none; } }

/* ---------- Shared view components / Componentes comunes de las vistas ---------- */
/* minmax(0, 1fr): the column may shrink below its content, so a wide table scrolls inside its
   card instead of pushing the whole page sideways. / La columna puede encogerse. */
.page { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search svg { position: absolute; left: 12px; top: 11px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 38px; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.filters button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; white-space: nowrap; color: var(--muted); }
.filters button small { margin-left: 4px; font-size: 12px; opacity: 0.8; }
.filters button:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; }
.card > h2, .card-title, .card-title h2, .section-head h2 { font-size: 15px; font-weight: 600; }
.card-title { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px 12px; margin-bottom: 12px; }
.card-title a { font-size: 13px; font-weight: 500; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .strong, .rowlink { font-weight: 600; color: var(--ink); text-decoration: none; }
table.data .muted, .muted { color: var(--muted); }
.mobile-list { display: none; list-style: none; margin: 0; padding: 0; gap: 8px; }
.mobile-list.always { display: grid; margin-top: 12px; }  /* a card list that is shown on every screen size */
.row-card { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: inherit; text-decoration: none; }
.row-card .title { font-weight: 600; }
.row-card .sub { color: var(--muted); font-size: 13px; }
.row-card .right { text-align: right; font-weight: 600; }
.row-card .pills { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.pill.info { background: var(--brand-soft); color: var(--brand); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
dialog.modal { border: 0; border-radius: var(--r-lg); padding: 20px; width: min(440px, calc(100% - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog.modal::backdrop { background: rgba(8, 13, 28, 0.5); }
dialog.modal form { display: grid; gap: 12px; }
dialog.modal h2 { font-size: 17px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
/* The server's question before cancelling, removing or moving money (D83): centered, with a
   warning icon and a darker backdrop, so it is read before answering. / La pregunta del servidor
   antes de cancelar, quitar o mover plata (D83): centrada, con ícono y fondo más oscuro. */
dialog.ask-dialog { width: min(460px, calc(100% - 32px)); padding: 24px; text-align: center; }
dialog.ask-dialog::backdrop { background: rgba(8, 13, 28, 0.62); }
dialog.ask-dialog .ask-icon { justify-self: center; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); }
dialog.ask-dialog .ask-icon .i { width: 26px; height: 26px; }
dialog.ask-dialog h2 { font-size: 19px; margin: 0; }
dialog.ask-dialog .note { margin: 0; line-height: 1.5; color: var(--ink); }
dialog.ask-dialog .modal-actions { justify-content: center; flex-wrap: wrap; }
dialog.ask-dialog .modal-actions .btn { min-width: 140px; justify-content: center; }
.refund-card.owed { border-color: var(--warn); }
.refund-more > summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.field.invalid .input { border-color: var(--err); }
.field .error { font-size: 12px; color: var(--err); }
.tabs button { background: transparent; border: 0; display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 11px; color: var(--muted); font-weight: 500; }
.tabs button[aria-current="page"] { color: var(--brand); font-weight: 600; }
.cta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cta { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; }
.cta small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.cta .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.cta.primary { background: linear-gradient(155deg, var(--hero-from), var(--hero-to)); border-color: transparent; color: #fff; }
.cta.primary small { color: rgba(255, 255, 255, 0.8); }
.cta.primary .ico { background: rgba(255, 255, 255, 0.16); color: #fff; }
.cta:hover { filter: brightness(1.04); }

/* Home / Inicio */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert-row { display: grid; grid-template-columns: 4px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px 10px 0; border-radius: var(--r-md); background: var(--surface-2); text-decoration: none; color: inherit; }
.alert-row::before { content: ""; align-self: stretch; border-radius: 4px; background: var(--muted); }
.alert-row.err::before { background: var(--err); }
.alert-row.warn::before { background: var(--warn); }
.alert-row.info::before { background: var(--brand); }
.alert-row .who-line { font-weight: 600; }
.alert-row .what { font-size: 12.5px; color: var(--muted); }
.alert-row .amount { text-align: right; font-weight: 700; }
.alert-row .amount small { display: block; font-weight: 500; font-size: 12px; }
.alert-row.err .amount small { color: var(--err); }
.alert-row.warn .amount small { color: var(--warn); }
.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stage { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); color: var(--ink); text-decoration: none; font-size: 13px; }
.stage b { font-size: 18px; font-weight: 700; }
.stage:hover { background: var(--brand-soft); }
.stage.zero { color: var(--muted); }
.stage.zero b { font-weight: 500; }
.kpis { display: grid; gap: 8px; }
.kpi { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi b { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.kpi.accent b { color: var(--brand); }

/* Order detail / Detalle de pedido */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand); }
.timeline { display: flex; overflow-x: auto; padding: 4px 0 2px; }
.step-t { flex: 1 0 96px; position: relative; text-align: center; font-size: 12px; color: var(--muted); padding-top: 28px; }
.step-t::before { content: ""; position: absolute; top: 9px; left: 0; right: 0; height: 2px; background: var(--line); }
.step-t:first-child::before { left: 50%; }
.step-t:last-child::before { right: 50%; }
.step-t .dot { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); display: grid; place-items: center; z-index: 1; }
.step-t.done { color: var(--ink); }
.step-t.done::before { background: var(--ok); }
.step-t.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step-t.done .dot svg { width: 12px; height: 12px; stroke-width: 3; }
.step-t.now { color: var(--brand); font-weight: 700; }
.step-t.now .dot { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.step-t small { display: block; font-weight: 400; color: var(--muted); }
.summary { position: sticky; top: 68px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.balance-box { display: grid; gap: 8px; }
.balance-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.balance-line span { color: var(--muted); }
.balance-line.big b { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.wa-box { padding: 12px; border-radius: var(--r-md); background: var(--surface-2); white-space: pre-line; font-size: 13px; }
.wa-box.pulse { animation: pulse 1.4s ease 2; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 4px var(--brand-soft); } }
.pay-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; align-items: end; margin-top: 12px; }
.pay-form .field label { font-size: 12px; }
.pay-form .btn { min-height: var(--ctl); }
.item-line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.item-line:last-child { border-bottom: 0; }
.item-line .sub { color: var(--muted); font-size: 12.5px; }
.item-line.is-cancelled .item-main { opacity: .6; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Settings / Configuración */
.settings { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 20px; align-items: start; }
.subnav { position: sticky; top: 68px; display: grid; gap: 2px; }
.subnav a { padding: 8px 12px; border-radius: var(--r-md); color: var(--muted); text-decoration: none; font-weight: 500; }
.subnav a:hover { background: var(--surface-2); color: var(--ink); }
.subnav a[aria-current="true"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sections { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
/* A wide table or long text never pushes a card past the screen (it scrolls inside).
   Una tabla ancha o un texto largo nunca empuja una tarjeta fuera de la pantalla. */
.sections > * { min-width: 0; }
.section-head { margin-bottom: 14px; }
.section-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .span { grid-column: 1 / -1; }
.pct .input { padding-right: 30px; }
.pct::after { content: "%"; position: absolute; right: 12px; top: 9px; color: var(--muted); font-weight: 600; font-size: 13px; }
.badge-review { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 11px; font-weight: 600; }
.tpl { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tpl:last-child { border-bottom: 0; }
textarea.input { min-height: 78px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.placeholders { display: flex; flex-wrap: wrap; gap: 4px; }
.placeholders code { padding: 1px 7px; border-radius: 6px; background: var(--surface-2); font-size: 12px; }
.savebar { position: sticky; bottom: 12px; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); }
.savebar[hidden] { display: none; }
.savebar .btn.ghost { color: var(--bg); border-color: rgba(255, 255, 255, 0.25); }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs-line button { border: 0; background: transparent; padding: 10px 14px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-line button[aria-selected="true"] { color: var(--brand); font-weight: 600; border-bottom-color: var(--brand); }
.profile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.login-note { margin-top: -6px; }
.kpis.cols { grid-template-columns: repeat(3, 1fr); }

/* Pagination / Paginación */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pager[hidden] { display: none; }
.pager-size { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.pager-size .input { width: auto; min-height: 32px; padding: 0 8px; border-radius: var(--r-sm); font-size: 13px; }
.pager-nav { display: inline-flex; align-items: center; gap: 4px; }
.pager-numbers { display: inline-flex; align-items: center; gap: 4px; }
.pager-nav button { min-width: 32px; height: 32px; padding: 0 8px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 500; }
.pager-nav button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pager-nav button[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 700; }
.pager-nav button:disabled { opacity: 0.4; cursor: not-allowed; }
.pager-nav .gap { padding: 0 4px; }
.pager-compact { display: none; padding: 0 8px; font-weight: 500; color: var(--ink); }

/* ---------- Mobile ---------- */
.tabs, .mobile-bar { display: none; }
@media (max-width: 1180px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 1000px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .result { position: static; }
}
@media (max-width: 860px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-brand { padding: 24px; min-height: 240px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-copy h1 { font-size: 24px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  /* the menu is a drawer that slides in from the right (thumb side), opened by the last button of the bottom bar; the top bar gets its button and the logo mark */
  .nav {
    position: fixed; z-index: 50; top: 0; bottom: 0; right: 0; width: min(300px, 86vw); height: auto; overflow-y: auto;
    transform: translateX(100%); transition: transform 0.2s ease; box-shadow: var(--shadow);
    border-right: 0; border-left: 1px solid var(--line);
  }
  .app[data-drawer="open"] .nav { transform: none; }
  .nav-toggle, .nav .nav-mark { display: none; }
  /* everything in the drawer is aligned to the right, icons on the right edge */
  .nav-head { justify-content: flex-end; }
  .nav a { flex-direction: row-reverse; justify-content: flex-start; text-align: right; }
  .nav .who { flex-direction: row-reverse; text-align: right; }
  .nav .who .who-text { margin-right: 0; margin-left: auto; text-align: right; }
  .user-menu button, .user-menu a { flex-direction: row-reverse; text-align: right; }
  .topbar-logo { display: flex; }
  .topbar-logo img { height: 26px; width: auto; }
  .topbar h1 { font-size: 18px; }
  /* the TRM chip: its two lines wrap instead of overflowing */
  .trm { padding: 8px 8px 8px 12px; white-space: normal; }
  .trm small { white-space: normal; overflow: visible; font-size: 12px; }
  .trm b { font-size: 15px; }
  .trm .icon-btn { width: 36px; height: 36px; }
  .main { padding: 0 14px 160px; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: calc(12px + env(safe-area-inset-top)) 0 12px; }
  .trm { order: 3; width: 100%; }
  .trm-text { margin-right: auto; }
  .grid-2, .duo, .new-customer, .extra { grid-template-columns: minmax(0, 1fr); }
  .extra.two { grid-template-columns: minmax(0, 1fr) auto; }
  .tabs {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .tabs a { display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 11px; color: var(--muted); text-decoration: none; font-weight: 500; }
  .tabs a[aria-current="page"] { color: var(--brand); font-weight: 600; }
  .mobile-bar {
    display: flex; align-items: center; gap: 12px; position: fixed; left: 10px; right: 10px; bottom: 64px; z-index: 20;
    padding: 8px 8px 8px 16px; border-radius: 16px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow);
  }
  .mobile-bar[hidden] { display: none; }
  .mobile-bar small { display: block; font-size: 11px; opacity: 0.7; line-height: 1.2; }
  .mobile-bar b { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
  .mobile-bar .btn { margin-left: auto; }
}
@media (max-width: 1100px) {
  .home, .detail { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
}
@media (max-width: 860px) {
  .tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .desktop-only { display: none; }
  .mobile-list { display: grid; }
  .cta-row { grid-template-columns: minmax(0, 1fr); }
  .stages { grid-template-columns: repeat(2, 1fr); }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .subnav { position: static; display: flex; overflow-x: auto; gap: 6px; }
  .subnav a { white-space: nowrap; border: 1px solid var(--line); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .pay-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pay-form .btn { grid-column: 1 / -1; }
  .search { max-width: none; }
  .kpis.cols { grid-template-columns: minmax(0, 1fr); }
  .pager-numbers { display: none; }
  .pager-compact { display: inline; }
  .pager { justify-content: space-between; }
  .pager-info { flex: 1 0 100%; }
  .pager-size { margin-left: 0; }
  .profile { grid-template-columns: auto minmax(0, 1fr); }
  .profile .btn { grid-column: 1 / -1; }
  .savebar { bottom: 74px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Order actions / Acciones del pedido */
.ask { display: flex; flex-direction: column; gap: 8px; }
.ask form { display: flex; flex-wrap: wrap; gap: 8px; }
.action-form { display: grid; gap: 10px; }
.action-form + .action-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.note { font-size: 13px; color: var(--muted); margin: 0; }
.note b { color: var(--ink); }

/* Purchase capital / Capital para compras */
.capital { display: flex; flex-wrap: wrap; align-items: end; align-content: flex-start; gap: 14px 24px; justify-content: space-between; margin-bottom: 14px; }
.capital-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, auto)); gap: 10px 28px; flex: 1 1 320px; }
.capital-figures > div { display: flex; flex-direction: column; gap: 2px; }
.capital-figures span { font-size: 12px; color: var(--muted); }
.capital-figures b { font-size: 17px; font-weight: 700; }
.capital-figures .avail b { font-size: 22px; color: var(--ok); }
.capital-figures .neg b, .note.neg { color: var(--err); }
/* Capital card: the field and its button side by side / Tarjeta del capital: campo y botón en fila */
.capital-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.capital-form .field { width: 170px; }
.capital-form .btn { min-height: var(--ctl); }
/* Inline form of Catálogo and Clientes: a grid that adapts, one column on phones
   Formulario en línea de Catálogo y Clientes: cuadrícula que se adapta, una columna en celular */
.row-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; align-items: end; }
.row-form .btn { min-height: var(--ctl); justify-content: center; }

/* Audit log / Bitácora */
.audit-filters { flex-wrap: wrap; }
.audit-filters select { width: auto; min-width: 170px; }
.nowrap { white-space: nowrap; }
/* Saved products: the quoter's picker, the list actions and the catalog tabs
   Productos guardados: el selector del cotizador, las acciones de la lista y las pestañas */
.catalog-tabs { width: fit-content; }
.saved-picker { display: grid; gap: 6px; margin-bottom: 12px; }
.saved-picker label { font-size: 13px; font-weight: 600; }
.saved-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.saved-item { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: inherit; text-decoration: none; }
.saved-item:hover { border-color: var(--brand); }
.saved-item .title { font-weight: 600; }
.saved-item .sub { color: var(--muted); font-size: 13px; }
.saved-reference { margin-top: 2px; }
.saved-origin { font-size: 12px; margin-left: 6px; }
.product-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.product-actions form { margin: 0; }
.product-card { display: grid; gap: 6px; }
.customer-row { margin-bottom: 8px; }
/* Product thumbnails and the photo fields / Miniaturas de productos y campos de foto */
.thumb { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; overflow: hidden; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-empty { display: grid; place-items: center; width: 100%; height: 100%; }
.thumb-lg { width: 96px; height: 96px; }
.with-thumb { display: flex; align-items: center; gap: 10px; }
.saved-item { grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.saved-item .thumb { grid-row: span 3; }
.item-main { display: flex; align-items: center; gap: 12px; }
.photo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.photo-preview { max-width: 160px; max-height: 160px; border-radius: var(--r-md); object-fit: cover; margin-top: 6px; }

.product-filters { align-items: center; }
.product-filters .search { flex: 1 1 260px; max-width: none; }
.product-filters select.input { width: auto; flex: 0 0 auto; }
/* Pagos: the filters in one line (search grows; medium and dates keep their size)
   Pagos: los filtros en una línea (la búsqueda crece; medio y fechas conservan su tamaño) */
.pay-filters { align-items: center; }
.pay-filters .search { flex: 1 1 260px; max-width: none; }
.pay-filters select.input, .pay-filters input[type="date"].input { width: auto; flex: 0 0 auto; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.history li { display: flex; flex-direction: column; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; padding-bottom: 0; }
.history .muted { font-size: 12px; }

/* Alerts / Alertas */
.alert-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.alert-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 13px; cursor: pointer; }
.alert-chip small { font-weight: 700; }
.alert-chip.danger { background: var(--err-bg); color: var(--err); }
.alert-chip.warn { background: var(--warn-bg); color: var(--warn); }
.alert-chip.ok { background: var(--ok-bg); color: var(--ok); }
.alert-chip[aria-pressed="true"] { border-color: currentColor; box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 25%, transparent); }
.pill.alert-danger { background: var(--err-bg); color: var(--err); }
.pill.alert-warn { background: var(--warn-bg); color: var(--warn); }
.pill.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-banner { margin-bottom: 12px; }

/* Users and sign-in / Usuarios y entrada */
.user-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.inline-form .input { width: 170px; min-height: 32px; }
.user-menu form { margin: 0; }
.user-menu form button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 0; background: transparent; font: inherit; text-align: left; cursor: pointer; border-radius: var(--r-sm); color: inherit; }
.user-menu form button.danger { color: var(--err); }
.login-form .banner { margin: 0; }

/* Settings: confirmation box under a value still to confirm / Casilla de confirmar bajo un valor pendiente */
.check { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--muted); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

/* Order detail: how the price came out / Detalle del pedido: cómo salió el precio */
.how { margin: 4px 0 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.how > summary { cursor: pointer; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--brand); }
.how-body { padding: 4px 12px 10px; display: grid; gap: 2px; }
.how-body .kv.adjusted b { color: var(--brand); }
.how-body .hint { margin-top: 6px; }
/* Quoter: manual price / Cotizador: precio manual */
.manual-price { margin: 4px 0 8px; }
.suggested { margin-top: 2px; font-size: 12px; color: var(--muted); }
.banner.loss .check { margin-top: 6px; color: inherit; font-weight: 600; }

/* Order detail: real cost and edits of a product / Detalle: costo real y ediciones de un producto */
.real-cost { margin: 4px 0 12px; padding: 8px 12px 10px; border: 1px solid var(--line); border-radius: var(--r-md); display: grid; gap: 2px; }
.rc-title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.item-edit { margin: 4px 0 8px; }
.item-edit > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--brand); padding: 4px 0; }
.item-edit .action-form { margin-top: 8px; padding-top: 0; border-top: 0; }
.cost-row { display: grid; grid-template-columns: minmax(0, 1fr) 86px; gap: 8px; align-items: end; }

/* Inicio: period selector and figures / Inicio: selector de período y cifras */
.period { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border-radius: var(--r-md); }
.period a { padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.period a[aria-current="true"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.kpi-title { margin: 12px 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi-title:first-of-type { margin-top: 10px; }
.stage-note { margin-top: 10px; font-size: 13px; color: var(--muted); }
.stage-note a { color: var(--brand); font-weight: 600; }

/* Posters: the button in each product / Posters: el botón en cada producto */
.item-actions { margin: 4px 0 8px; }

/* ---------- Phone overrides: kept LAST so they win over the base rules above ----------
   Ajustes para celular: van AL FINAL para ganarle a las reglas base de arriba (una regla
   posterior con la misma fuerza gana; por eso estos no pueden ir en medio del archivo). */
@media (max-width: 860px) {
  .row-form { grid-template-columns: minmax(0, 1fr); }
  .row-form .btn { width: 100%; }
  .capital-form .field { flex: 1 1 140px; width: auto; }
  .capital-form .btn { width: 100%; }
  .pay-filters .input, .pay-filters select.input, .pay-filters input[type="date"].input { width: 100%; flex: 1 1 100%; }
  .pay-filters .search { flex-basis: 100%; }
  .product-filters .input, .product-filters select.input { width: 100%; flex: 1 1 100%; }
  .product-filters .search { flex-basis: 100%; }
}

/* Catálogo: side menu, clean tables and floating forms / menú lateral, tablas limpias y formularios flotantes */
.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.catalog-table tbody tr { cursor: default; }
.catalog-table .actions-col { text-align: right; width: 1%; white-space: nowrap; }
.catalog-table th.actions-col { text-align: right; }
.row-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.row-actions form { margin: 0; }
.small-note { font-size: 12px; margin-top: 2px; }
/* Catalog settings: the sizes under the name on a phone (the column hides). / En celular, bajo el nombre. */
.catalog-table .phone-sizes { display: none; }
dialog.modal.wide { width: min(480px, calc(100% - 32px)); }
dialog.modal .field { display: grid; gap: 4px; }
.catalog-layout .sections { grid-template-columns: minmax(0, 1fr); }
.catalog-layout .sections > * { min-width: 0; }
.catalog-layout .sections > .note { margin: 0; }
@media (max-width: 700px) {
  .hide-phone { display: none; }
  .catalog-table .phone-sizes { display: block; margin-top: 4px; }
  .public-products-table .with-thumb .thumb { display: none; } /* room for the actions / espacio para las acciones */
  .head-row { flex-wrap: wrap; }
  .catalog-table th, .catalog-table td { padding: 9px 6px; }
  .catalog-table .small-note { display: none; }
  .row-actions { flex-wrap: wrap; }
}

/* Standard row actions: small icon buttons / Acciones de fila estándar: botones de ícono pequeños */
.act { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; }
.act:hover, .act:focus-visible { background: var(--surface-2); color: var(--ink); }
.act.brand { color: var(--brand); }
.act.danger:hover { color: var(--err); background: var(--err-bg); }
.act .i { width: 18px; height: 18px; }
.act-form { margin: 0; display: inline-flex; }
.row-actions, .product-actions { gap: 6px; }
.with-thumb .cell-sub { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.with-thumb > div { min-width: 0; }
/* Orders on a phone: a row per order, like the products list. / Pedidos en celular: una fila por pedido. */
.olist { gap: 0; }
.orow { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 14px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.olist li:last-child .orow { border-bottom: 0; }
.orow .thumb { width: 52px; height: 52px; }
.orow-main { display: grid; gap: 3px; min-width: 0; justify-items: start; }
.orow-main > b { overflow-wrap: anywhere; }
.orow-code { color: var(--brand); }
.orow-sub { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.orow-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.orow-delete { display: flex; justify-content: flex-end; padding: 0 4px 10px; }
.orow-money { display: grid; gap: 2px; justify-items: end; text-align: right; white-space: nowrap; }
.orow-money > b { font-size: 15px; }
.orow-money > span { font-size: 12px; color: var(--muted); }
.toolbar:has(> .btn) { display: flex; flex-wrap: nowrap; gap: 10px; align-items: center; justify-content: space-between; }
.toolbar:has(> .btn) > .search { flex: 1 1 0; width: auto; max-width: none; min-width: 0; }
.toolbar > .btn { flex: none; }
@media (max-width: 640px) { .toolbar > .btn .btn-label { display: none; } .toolbar > .btn { padding-inline: 14px; } }
/* A table whose first column (the name) stays put while the rest slides sideways on a phone.
   Una tabla cuya primera columna (el nombre) se queda quieta mientras el resto se desliza en celular. */
@media (max-width: 640px) {
  .swipe-table { min-width: 640px; }
  .swipe-table th:first-child, .swipe-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 6px 0 8px -6px rgba(20, 30, 60, .18); }
}
.only-phone-block, .person .cell-sub.only-phone-block { display: none; }
@media (max-width: 640px) { .only-phone-block, .person .cell-sub.only-phone-block { display: block; } .users-table td.num .only-phone-block { font-size: 11px; font-weight: 400; } }
.price-cell { white-space: nowrap; }
.price-cell .price-main { display: block; font-size: 15px; font-weight: 700; }
/* Products list: rows that read like a list on every screen, with a menu per product.
   Lista de productos: filas que se leen como lista en toda pantalla, con un menú por producto. */
.plist { list-style: none; margin: 0; padding: 0; }
.prow { display: grid; grid-template-columns: auto 64px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line, #e7e9f0); }
.prow:last-child { border-bottom: 0; }
.prow-thumb { display: block; }
.prow-main { display: grid; gap: 4px; min-width: 0; justify-items: start; }
.prow-main .rowlink { font-weight: 600; overflow-wrap: anywhere; }
.prow-sub { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.prow-price { text-align: right; white-space: nowrap; }
.prow-price .price-main { display: block; font-size: 15px; font-weight: 700; }
.prow-price .price-buy { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.pick-check { width: 20px; height: 20px; accent-color: var(--brand, #2455d6); }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 240px; padding: 6px; background: var(--surface, #fff); border: 1px solid var(--line, #e7e9f0); border-radius: 12px; box-shadow: 0 12px 32px rgba(20, 30, 60, .16); }
.menu-form { margin: 0; }
.menu-item { display: flex; width: 100%; gap: 10px; align-items: center; padding: 10px 12px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.menu-item:hover { background: var(--surface-2, #f4f6fb); }
.menu-item.danger { color: #b3261e; }
.menu-item .i { flex: none; }
.selection-bar { position: sticky; bottom: 12px; display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-top: 12px; padding: 10px 14px; background: var(--surface, #fff); border: 1px solid var(--brand, #2455d6); border-radius: 12px; box-shadow: 0 10px 28px rgba(20, 30, 60, .18); }
.selection-bar[hidden] { display: none; }
.selection-actions { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.pick-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 12px; }
.pick-item { display: grid; grid-template-columns: 64px minmax(0, 1fr) 110px 90px; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line, #e7e9f0); border-radius: 12px; }
.pick-main { display: grid; gap: 2px; min-width: 0; }
@media (max-width: 640px) {
  .prow { grid-template-columns: auto 56px minmax(0, 1fr) auto; grid-template-areas: "check thumb main menu" ". . price price"; gap: 4px 10px; }
  .prow > .pick-check { grid-area: check; }
  .prow > .prow-thumb { grid-area: thumb; }
  .prow > .prow-main { grid-area: main; }
  .prow > .menu { grid-area: menu; }
  .prow > .prow-price { grid-area: price; text-align: left; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
  .prow-price .price-buy { display: inline; margin: 0; }
  .menu-panel { right: 0; min-width: 220px; }
  .selection-bar { bottom: 84px; } /* above the phone's bottom bar / sobre la barra inferior */
  .pick-item { grid-template-columns: 56px minmax(0, 1fr); }
  .pick-item .field { grid-column: 1 / -1; }
}
.price-cell .price-buy { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--muted); }
.thumb-lg { width: 96px; height: 96px; }

/* Product photos: the gallery and the upload tile / Fotos del producto: galería y mosaico de subida */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.shot { position: relative; margin: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); aspect-ratio: 1; }
.shot > a { display: block; width: 100%; height: 100%; }
.thumb-xl { width: 100%; height: 100%; border-radius: 0; }
.cover-tag { position: absolute; left: 6px; top: 6px; padding: 2px 8px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; }
.shot-actions { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 6px; }
.shot-actions .act { background: var(--surface); width: 32px; height: 32px; }
.upload-tile { display: grid; place-items: center; border-style: dashed; background: transparent; }
.upload-label { display: grid; justify-items: center; gap: 4px; padding: 12px; text-align: center; cursor: pointer; color: var(--muted); width: 100%; height: 100%; align-content: center; }
.upload-label .i { width: 28px; height: 28px; color: var(--brand); }
.upload-label b { color: var(--ink); }
.upload-label span { font-size: 12px; }
.upload-tile:hover, .upload-tile:focus-within { border-color: var(--brand); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
dialog.modal.wide { max-height: calc(100dvh - 32px); overflow-y: auto; }

/* The quoter's photo picker: a dashed tile with an icon / El selector de foto del cotizador */
.photo-pick { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--r-md); cursor: pointer; color: var(--muted); }
.photo-pick:hover, .photo-field:focus-within .photo-pick { border-color: var(--brand); }
.photo-pick .photo-preview { width: 56px; height: 56px; margin: 0; flex: none; }
.photo-previews { display: flex; gap: 6px; flex: none; }
.photo-previews[hidden] { display: none; }
@media (max-width: 640px) { .photo-pick .photo-previews .photo-preview { width: 44px; height: 44px; } }
.photo-pick-text { display: grid; gap: 2px; justify-items: start; font-size: 12px; }
.photo-pick-text b { color: var(--ink); font-size: 13px; }
.photo-pick-text .i { width: 22px; height: 22px; color: var(--brand); }

/* Photo viewer / Visor de fotos */
dialog.lightbox { border: 0; padding: 0; background: transparent; color: #fff; max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh; overflow: hidden; }
dialog.lightbox[open] { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 16px; }
dialog.lightbox::backdrop { background: rgba(4, 8, 20, 0.86); }
dialog.lightbox figure { margin: 0; display: grid; justify-items: center; gap: 10px; min-width: 0; }
dialog.lightbox img { max-width: 100%; max-height: calc(100dvh - 120px); object-fit: contain; border-radius: var(--r-md); background: #0b1020; }
dialog.lightbox figcaption { font-size: 13px; opacity: 0.85; text-align: center; }
.lb-close, .lb-nav { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.14); color: #fff; cursor: pointer; }
.lb-close:hover, .lb-nav:hover, .lb-close:focus-visible, .lb-nav:focus-visible { background: rgba(255, 255, 255, 0.28); }
.lb-close { position: absolute; top: 14px; right: 14px; z-index: 1; }
dialog.lightbox.single .lb-nav { visibility: hidden; }
@media (max-width: 700px) {
  dialog.lightbox[open] { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto; padding: 12px; }
  .lb-nav { position: absolute; bottom: 14px; z-index: 1; }
  .lb-prev { left: 14px; }
  .lb-next { right: 14px; }
}

/* An element with the hidden attribute must never show: a rule like `display: grid` on a class would
   otherwise override it (the photo placeholders are hidden until a photo fails to load).
   Un elemento con el atributo hidden nunca debe verse: una regla como `display: grid` en una clase
   lo anularía (los marcadores de foto están ocultos hasta que una foto falla al cargar). */
[hidden] { display: none !important; }

/* The fixed catalog link: the address and its copy button on one line, the "change" action tucked away.
   El enlace fijo del catálogo: la dirección y su botón de copiar en una línea, «cambiar» escondido. */
.link-box { display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; }
.link-box .input { flex: 1; min-width: 0; font-size: 14px; }
.change-link { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.change-link summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.change-link form { margin-top: 6px; }
@media (max-width: 560px) { .link-box { flex-direction: column; align-items: stretch; } }

/* Usuarios and Mi cuenta / Usuarios y Mi cuenta */
.count-line { color: var(--muted); font-size: 13px; font-weight: 500; margin: 2px 0 10px; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person > div { min-width: 0; }
.person .avatar { flex: none; }
.person .cell-sub { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.users-table td { padding-top: 14px; padding-bottom: 14px; }
.account-layout { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 20px; align-items: start; max-width: 960px; }
.account-profile { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 28px 20px; }
.account-profile h2 { font-size: 18px; font-weight: 700; margin-top: 8px; }
.account-email { color: var(--muted); overflow-wrap: anywhere; }
.account-user b { font-weight: 600; }
.avatar.xl { width: 84px; height: 84px; font-size: 28px; }
.account-form .stack { gap: 16px; max-width: 460px; }
.form-actions { display: flex; justify-content: flex-start; margin-top: 4px; }
.rules { margin: 22px 0 0; padding: 14px 16px 14px 34px; border-radius: var(--r-md); background: var(--surface-2); color: var(--muted); font-size: 13px; line-height: 1.5; display: grid; gap: 6px; }
@media (max-width: 880px) { .account-layout { grid-template-columns: minmax(0, 1fr); } .account-profile { grid-template-columns: auto minmax(0, 1fr); justify-items: start; text-align: left; align-items: center; column-gap: 16px; padding: 18px; } .account-profile .avatar { grid-row: span 3; } .account-profile h2 { margin-top: 0; } }
.head-row > .btn { flex: none; white-space: nowrap; }
.head-row > div { min-width: 0; }
.users-table .row-actions { flex-wrap: nowrap; }
@media (max-width: 560px) {
  .users-table th, .users-table td { padding-left: 6px; padding-right: 6px; }
  .users-table .row-actions { gap: 4px; }
  .users-table .act { width: 32px; height: 32px; }
  .users-table .person { gap: 8px; }
  .users-table .avatar { width: 28px; height: 28px; font-size: 11px; }
}
.only-phone { display: none; }
@media (max-width: 560px) {
  .only-phone { display: inline-flex; margin-top: 4px; font-size: 11px; padding: 1px 8px; }
  .users-table .person .cell-sub { overflow-wrap: anywhere; }
}

/* The product code, small and easy to read aloud or copy / El código del producto, pequeño y fácil de leer */
.pcode { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; font-weight: 600; letter-spacing: 0.04em; color: var(--brand); background: var(--brand-soft); padding: 1px 7px; border-radius: 6px; white-space: nowrap; }

/* The poster screen's product search. / El buscador de productos de la pantalla de posters. */
.poster-picker { margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.poster-picker > summary { cursor: pointer; font-weight: 600; }
.poster-picker .search { margin-top: 10px; }
.saved-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.saved-row .saved-item { flex: 1 1 auto; min-width: 0; }

/* Productos: its own frame and tidy filters (search on its own row, filters below).
   Productos: su propio marco y filtros ordenados (buscador en su fila, filtros debajo). */
.products-page { display: grid; gap: 14px; align-content: start; }
.products-page > * { min-width: 0; }
.products-page .products-intro { margin: 0; }
.product-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: center; }
.product-filters .search { grid-column: 1 / -1; position: relative; }
.product-filters .search .input { width: 100%; }
.product-filters .filter-go { display: none; }
@media (max-width: 640px) {
  .product-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .product-filters select:nth-of-type(3) { grid-column: 1 / -1; }
}

/* Productos as an admin table on big screens. / Productos como tabla de administración. */
.products-table .check-col { width: 36px; }
.products-table .with-thumb { display: flex; gap: 12px; align-items: center; }
.products-table td { vertical-align: middle; }
.products-table .menu { display: inline-block; }
.bulk-form { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.bulk-form .btn { white-space: nowrap; }
.products-table td.num, .products-table th.num { white-space: nowrap; }
.products-table td:nth-child(4) { white-space: nowrap; }

/* Inicio: the two profits first thing on the screen. / Inicio: las dos ganancias, lo primero. */
.profit-hero { margin-bottom: 14px; }
.profit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.profit { display: grid; gap: 4px; padding: 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.profit > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.profit > b { font-size: 30px; line-height: 1.1; letter-spacing: -.02em; overflow-wrap: anywhere; }
.profit > small { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.profit.real { border-color: var(--ok); }
.profit.real > b { color: var(--ok); }
.profit.estimated > b { color: var(--brand); }
@media (max-width: 640px) { .profit-grid { grid-template-columns: minmax(0, 1fr); } .profit > b { font-size: 26px; } }
.profit.expenses > b { color: var(--muted); }
.profit.net { border-color: var(--brand); }
.profit.net > b { color: var(--brand); }
.profit.net.negative > b { color: var(--err); }
/* Phones: four small cards, all visible at once, most important first.
   Celular: cuatro tarjetas pequeñas, las cuatro a la vez, la más importante primero. */
@media (max-width: 640px) {
  .profit-hero { padding-bottom: 14px; }
  .profit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .profit { padding: 10px 12px; gap: 2px; }
  .profit > span { font-size: 12px; }
  .profit > b { font-size: 19px; }
  .profit > small { display: none; }
}
/* The «i» symbol of each profit card and its floating explanation.
   El símbolo «i» de cada tarjeta de ganancia y su explicación flotante. */
.profit { position: relative; }
.profit-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.info-tip { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.info-tip .i { width: 16px; height: 16px; }
.info-tip:hover, .info-tip:focus-visible, .profit.tip-open .info-tip { color: var(--brand); background: var(--brand-soft); }
.profit > .tip-box { display: none; position: absolute; z-index: 30; left: 0; top: calc(100% + 6px); width: min(300px, 86vw); padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); box-shadow: 0 12px 32px rgba(20, 30, 60, .22); font-size: 12.5px; font-weight: 400; line-height: 1.45; }
.profit.tip-open > .tip-box, .profit:has(.info-tip:hover) > .tip-box { display: block; }
.profit:nth-child(even) > .tip-box { left: auto; right: 0; }
.tip-box a { color: var(--brand); }
/* The summary: money first, then profit; one period selector. Resumen: dinero y luego ganancia. */
.group-title { margin: 14px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.money-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.profit.money > b { font-size: 26px; }
.profit.money.due { border-color: var(--warn, #d9922e); }
.profit.money.due > b { color: var(--warn, #d9922e); }
@media (max-width: 640px) {
  .group-title { margin: 10px 0 6px; }
  .money-grid { gap: 8px; }
  .profit.money > b { font-size: 16px; }
  .money-grid .profit > .tip-box { left: 0; right: auto; }
  .money-grid .profit:last-child > .tip-box { left: auto; right: 0; }
}

/* Orders and products as one organized table; on phones it slides sideways with the first column
   fixed. Pedidos y productos como una tabla ordenada; en celular se desliza con la primera columna fija. */
.orders-table .order-cell b { font-size: 14px; }
.orders-table .order-cell .cell-sub { display: block; font-size: 12.5px; color: var(--muted); }
.orders-table td, .orders-table th { white-space: nowrap; }
.orders-table td:nth-child(3) { white-space: normal; min-width: 170px; }
.products-table .with-thumb { display: flex; gap: 10px; align-items: center; }
.products-table .product-cell .pick-check { flex: none; }
.products-table td:nth-child(n+2), .products-table th:nth-child(n+2) { white-space: nowrap; }
.sel-count { font-size: 14px; }
/* "Seleccionar todos" under the count: a small text button. / Botón de texto bajo el conteo. */
.sel-info { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.sel-all { padding: 2px 0; border: 0; background: none; color: var(--brand, #2455d6); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.sel-all:hover { text-decoration: underline; }
.sel-all:focus-visible { outline: 2px solid var(--brand, #2455d6); outline-offset: 2px; border-radius: 4px; }
.selection-bar { gap: 10px; }
.selection-actions { display: inline-flex; gap: 8px; align-items: center; }
.bulk-menu > summary { display: inline-flex; gap: 6px; align-items: center; }
.bulk-menu > summary .i { width: 14px; height: 14px; }
.selection-bar .menu-panel { top: auto; bottom: calc(100% + 8px); right: 0; min-width: 230px; }
.bulk-form { display: grid; gap: 0; }
.menu-panel.floating { position: fixed; z-index: 60; }
@media (max-width: 640px) {
  .selection-bar { flex-wrap: nowrap; padding: 8px 10px; }
  .sel-count { white-space: nowrap; font-size: 13px; }
}
.selection-bar .bulk-menu { position: static; }
.selection-bar .menu-panel { left: auto; right: 0; width: min(280px, 100%); }
.products-table th:first-child, .products-table td.product-cell { min-width: 210px; }
@media (max-width: 640px) { .products-table td.product-cell { min-width: 190px; } }
.selection-bar { z-index: 40; }

/* Products table: compact. Name and price are what you see first; the rest slides sideways.
   Tabla de productos compacta: primero se ve el nombre y el precio; lo demás se desliza. */
.products-table .with-thumb { display: flex; align-items: center; gap: 10px; }
.products-table .product-name { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.products-table .product-name .rowlink { font-weight: 600; overflow-wrap: anywhere; }
.products-table .with-thumb .menu { flex: none; margin-left: auto; }
.products-table th:first-child, .products-table td.product-cell { min-width: 300px; }
@media (max-width: 640px) {
  .products-table th, .products-table td { padding: 8px 8px; font-size: 13px; }
  .products-table th:first-child, .products-table td.product-cell { min-width: 0; width: 62vw; max-width: 62vw; }
  .products-table .with-thumb { gap: 6px; }
  .products-table .with-thumb .thumb { width: 34px; height: 34px; flex: none; }
  .products-table .pick-check { width: 18px; height: 18px; }
  .products-table .product-name .rowlink { font-size: 13px; line-height: 1.25; }
  .products-table .pcode { font-size: 10.5px; padding: 1px 5px; }
  .products-table td.num { font-size: 13px; }
  .products-table .menu > summary.act { width: 30px; height: 30px; }
}
.products-table .product-name .rowlink { overflow-wrap: break-word; word-break: normal; }
@media (max-width: 640px) {
  .products-table .with-thumb .thumb { display: none; }
  .products-table th:first-child, .products-table td.product-cell { width: 54vw; max-width: 54vw; }
}
/* The row whose menu is open goes above the other sticky cells, so its panel is never covered.
   La fila con el menú abierto queda sobre las demás celdas fijas, así su panel nunca se tapa. */
.swipe-table td:first-child:has(details.menu[open]) { z-index: 70; }

/* The converter window. / La ventana de la calculadora. */
.conv { display: grid; gap: 12px; }
.conv-rates { display: flex; gap: 8px; flex-wrap: wrap; }
.conv-rates .chip { display: inline-flex; gap: 6px; align-items: center; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.conv-rates .chip[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.conv-result { margin: 0; min-height: 22px; font-size: 18px; font-weight: 700; }
