/* Sistema Maestro CONTIPARTS — sistema de diseño.
   Colores de los archivos oficiales de marca (SVG): rojo #C4161C, negro
   #231F20, amarillo #FFC20E, gris #F1F1F2. El amarillo es solo acento.
   Principios: legible antes que decorativo; cada estado usa texto + icono +
   color; animaciones cortas que explican el cambio (y se desactivan si la
   persona pidió menos movimiento). */

:root {
  --brand-red: #C4161C;
  --brand-red-hover: #A81319;
  --brand-red-soft: #FDEEEE;
  --brand-red-tint: rgba(196, 22, 28, 0.08);
  --brand-ink: #231F20;
  --brand-ink-2: #37302F;
  --brand-yellow: #FFC20E;
  --brand-gray: #F1F1F2;

  --bg: #F4F4F5;
  --surface: #FFFFFF;
  --surface-alt: #FAFAFA;
  --surface-sunk: #F0EFF0;
  --border: #E5E3E5;
  --border-strong: #CDCACD;
  --text: #1E1A1B;
  --text-muted: #5F595B;
  --text-faint: #8C8689;

  --ok: #177A4A;
  --ok-soft: #E6F4EC;
  --warn-text: #7F5300;
  --warn-soft: #FFF4D6;
  --danger: #B3141A;
  --danger-soft: #FDECEC;
  --info: #1E5DB8;
  --info-soft: #EAF1FC;
  --neutral-soft: #EFEEF0;

  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(20, 16, 17, 0.06);
  --shadow: 0 1px 2px rgba(20, 16, 17, 0.05), 0 6px 16px -6px rgba(20, 16, 17, 0.08);
  --shadow-lg: 0 18px 40px -12px rgba(20, 16, 17, 0.25), 0 4px 10px rgba(20, 16, 17, 0.06);
  --focus: 0 0 0 3px rgba(196, 22, 28, 0.25);

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --fast: 0.15s;
  --slow: 0.35s;

  --font-display: "Bahnschrift", "DIN Alternate", "Barlow Semi Condensed", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --sidebar-w: 244px;
}

/* ---------- Transiciones entre páginas (navegadores que las soportan) ---------- */
@view-transition { navigation: auto; }
.sidebar { view-transition-name: sidebar; }
::view-transition-group(sidebar) { animation: none; }
::view-transition-old(root) { animation: vt-out 0.14s var(--ease) both; }
::view-transition-new(root) { animation: vt-in 0.28s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand-red); text-decoration: none; transition: color var(--fast) var(--ease); }
a:hover { color: var(--brand-red-hover); text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
::selection { background: rgba(196, 22, 28, 0.18); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.005em; margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.08rem; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 0.98rem; }
p { margin: 0 0 8px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 0.86em; }
.tiny { font-size: 0.76rem; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 0.9em; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 30px; height: 30px; stroke-width: 1.5; }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #231F20 0%, #1B1718 100%);
  color: #EDEBEC;
  padding: 18px 12px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.sidebar .brand { display: block; padding: 2px 8px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 6px; }
.sidebar .brand img { width: 100%; max-width: 190px; height: auto; display: block; }
.nav { flex: 1 1 auto; }
.nav-section { margin: 16px 0 4px; padding: 0 10px; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase; color: #8F898B; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 10px; margin: 1px 0; border-radius: 8px;
  color: #DCD8D9; font-weight: 500; font-size: 0.93rem;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
  position: relative;
}
.nav a .icon { opacity: 0.8; transition: opacity var(--fast); }
.nav a:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.nav a:hover .icon { opacity: 1; }
.nav a:active { transform: scale(0.98); }
.nav a[aria-current="page"] { background: rgba(196,22,28,0.2); color: #fff; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-red); }
.nav a[aria-current="page"] .icon { opacity: 1; color: #FF6B70; }
.nav .badge { margin-left: auto; }
.sidebar-foot { margin-top: 14px; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,0.08); font-size: 0.82rem; color: #BDB8BA; }
.sidebar-foot .me { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.sidebar-foot .me .who { line-height: 1.25; min-width: 0; }
.sidebar-foot .me .who strong { color: #fff; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot a { color: #EDEBEC; }
.sidebar-foot .foot-links { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.sidebar-foot button { background: none; border: 0; color: #EDEBEC; padding: 0; cursor: pointer; font: inherit; display: inline-flex; gap: 6px; align-items: center; }
.sidebar-foot button:hover, .sidebar-foot a:hover { color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 28px; min-height: 56px;
  background: rgba(255,255,255,0.86); backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 15;
}
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar .crumbs { font-size: 0.86rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumbs a { color: var(--text-muted); }
.topbar .crumbs a:hover { color: var(--brand-red); }
.topbar .company { font-size: 0.84rem; color: var(--text-muted); display: flex; gap: 10px; align-items: center; }
.topbar .search-mini { display: flex; align-items: center; gap: 6px; background: var(--surface-sunk); border: 1px solid transparent; border-radius: 999px; padding: 0 12px; height: 34px; min-width: 240px; transition: border-color var(--fast), background var(--fast), box-shadow var(--fast); }
.topbar .search-mini:focus-within { background: #fff; border-color: var(--brand-red); box-shadow: var(--focus); }
.topbar .search-mini input { border: 0; background: transparent; min-height: 0; height: 32px; padding: 0; box-shadow: none; }
.topbar .search-mini input:focus { box-shadow: none; }
.menu-toggle { display: none; background: none; border: 0; padding: 6px; color: var(--text); cursor: pointer; border-radius: 8px; }
.content { padding: 24px 28px 64px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brand-red); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.page-head p { margin: 6px 0 0; color: var(--text-muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Entrada escalonada del contenido de la página. */
.content > * { animation: rise 0.42s var(--ease) backwards; }
.content > *:nth-child(2) { animation-delay: 0.04s; }
.content > *:nth-child(3) { animation-delay: 0.08s; }
.content > *:nth-child(4) { animation-delay: 0.12s; }
.content > *:nth-child(5) { animation-delay: 0.16s; }
.content > *:nth-child(n+6) { animation-delay: 0.2s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { 0% { transform: scale(0.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(196,22,28,0.45); } 100% { box-shadow: 0 0 0 10px rgba(196,22,28,0); } }
@keyframes shimmer { 100% { background-position: -200% 0; } }
@keyframes slide-up { from { transform: translateY(100%); } }
@keyframes flash-ok { 0% { background: var(--ok-soft); } 100% { background: transparent; } }

/* ---------- Tarjetas y paneles ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-head .sub { font-size: 0.84rem; color: var(--text-muted); font-weight: 400; }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-alt); }
.grid { display: grid; gap: 18px; align-items: start; }
.grid > .panel + .panel { margin-top: 0; }
.grid > *, .split > * { min-width: 0; }
input[type=file] { max-width: 100%; font: inherit; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.panel + .grid, .grid + .panel, .grid + .split, .split + .panel, .alert + .grid, .grid + .grid, .split + .split, .panel + .split, .alert + .panel, .alert + .split, .tabs + .grid { margin-top: 18px; }

.metric {
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  display: block; color: var(--text); box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), border-color var(--fast);
}
a.metric:hover { border-color: var(--border-strong); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.metric .label { font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 8px; align-items: center; font-weight: 500; }
.metric .label .icon { color: var(--text-faint); }
.metric .value { font-family: var(--font-display); font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 4px; line-height: 1.1; }
.metric .hint { font-size: 0.78rem; color: var(--text-faint); margin-top: 2px; }
.metric.is-alert { border-left: 4px solid var(--brand-red); }
.metric.is-warn { border-left: 4px solid var(--brand-yellow); }
.metric.is-ok { border-left: 4px solid var(--ok); }
.metric.is-dark { background: var(--brand-ink); color: #fff; border-color: var(--brand-ink); }
.metric.is-dark .label, .metric.is-dark .hint { color: #BEB8BA; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
dl.facts dt { color: var(--text-muted); }
dl.facts dd { margin: 0; min-width: 0; }

/* Tarjetas navegables (conteos, licitaciones, clientes). */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 10px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  color: var(--text); position: relative;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), border-color var(--fast);
}
a.card:hover { text-decoration: none; color: var(--text); transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
a.card:active { transform: translateY(-1px); }
.card .card-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; line-height: 1.25; }
.card .card-meta { font-size: 0.82rem; color: var(--text-muted); display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; }
.card .card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 0.82rem; color: var(--text-muted); }
.card.is-live { border-color: rgba(196,22,28,0.35); box-shadow: 0 0 0 3px rgba(196,22,28,0.06), var(--shadow-sm); }

/* ---------- Progreso, insignias y avatares ---------- */
.progress { height: 8px; background: var(--surface-sunk); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-red), #E0474C); border-radius: inherit; width: 0; transition: width 0.8s var(--ease); }
.progress.ok > span { background: linear-gradient(90deg, #178A52, #2DB36F); }
.progress.thin { height: 5px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: var(--brand-red); color: #fff; font-variant-numeric: tabular-nums; }
.badge.soft { background: var(--neutral-soft); color: var(--text); }
.badge.dark { background: var(--brand-ink); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; color: #fff; background: var(--brand-red); flex: none; letter-spacing: 0.02em; }
.avatar.sm { width: 26px; height: 26px; font-size: 0.68rem; }
.avatar.lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar.c1 { background: #C4161C; } .avatar.c2 { background: #231F20; } .avatar.c3 { background: #1E5DB8; }
.avatar.c4 { background: #177A4A; } .avatar.c5 { background: #8A4FBF; } .avatar.c6 { background: #C26A00; }
.avatars { display: inline-flex; }
.avatars .avatar { border: 2px solid #fff; margin-left: -8px; }
.avatars .avatar:first-child { margin-left: 0; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-red); animation: ring 1.6s var(--ease) infinite; flex: none; }
.live-dot.ok { background: var(--ok); animation: none; }
.live-dot.idle { background: var(--text-faint); animation: none; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.data th, table.data td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data thead th { position: sticky; top: 0; background: var(--surface-alt); font-weight: 600; font-size: 0.76rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
table.data tbody tr { transition: background var(--fast); }
table.data tbody tr:hover { background: #FAF9FA; }
table.data td.sku { font-family: var(--font-mono); font-size: 0.84rem; white-space: nowrap; }
table.data td.sku div { font-family: var(--font-body); white-space: normal; }
table.data tr.is-total td { font-weight: 600; background: var(--surface-alt); }
table.data tr.is-new td { animation: flash-ok 1.6s var(--ease); }
table.data a.row-link { color: var(--text); font-weight: 600; }
table.data a.row-link:hover { color: var(--brand-red); }
.messages + .page-head { margin-top: 0; }
.empty { padding: 36px 16px; text-align: center; color: var(--text-muted); }
.empty-state { padding: 44px 20px; text-align: center; color: var(--text-muted); display: grid; justify-items: center; gap: 8px; }
.results .empty-state { background: #fff; border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 28px 16px; }
.empty-state > .icon { width: 44px; height: 44px; stroke-width: 1.3; color: var(--border-strong); }
.empty-state strong { color: var(--text); font-size: 1.02rem; }

/* ---------- Estados (texto + icono + color) ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--text); line-height: 1.3; }
.chip .icon { width: 13px; height: 13px; vertical-align: 0; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn-text); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.dark { background: var(--brand-ink); color: #fff; }
.chip.red { background: var(--brand-red); color: #fff; }
.chip.outline { background: transparent; border: 1px solid var(--border-strong); }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label, .field .label { font-weight: 600; font-size: 0.85rem; }
.field .help { font-size: 0.79rem; color: var(--text-muted); }
.field .error, .errorlist { color: var(--danger); font-size: 0.84rem; margin: 0; padding: 0; list-style: none; }
input[type=text], input[type=number], input[type=search], input[type=password], input[type=date], input[type=datetime-local], input[type=email], input[type=tel], input[type=url], input:not([type]), select, textarea {
  font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 11px; min-height: 40px; width: 100%;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
input:hover, select:hover, textarea:hover { border-color: #B5B1B4; }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-red); box-shadow: var(--focus); }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--danger); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235F595B' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
select[multiple] { background-image: none; padding-right: 11px; min-height: 120px; }
.check { display: flex; gap: 9px; align-items: center; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-red); flex: none; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand-red); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 14px; }
legend { font-weight: 600; padding: 0 6px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 160px; }
.filters .grow { flex: 1 1 260px; }
.lines-table input, .lines-table select { min-height: 34px; padding: 6px 8px; }

/* Casillas como tarjetas seleccionables (zonas, personas, roles). */
.pick-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.pick {
  position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius); background: #fff; cursor: pointer;
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast), transform var(--fast) var(--ease);
}
.pick:hover { border-color: var(--border-strong); }
.pick:active { transform: scale(0.99); }
.pick input { margin-top: 2px; width: 18px; height: 18px; flex: none; }
.pick .pick-title { display: block; font-weight: 600; line-height: 1.3; }
.pick .pick-sub { display: block; font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.pick:has(input:checked) { border-color: var(--brand-red); background: var(--brand-red-soft); box-shadow: 0 0 0 3px var(--brand-red-tint); }
.pick:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
.pick[data-new-zone] { border-style: dashed; cursor: default; }
.pick[data-new-zone] > .stack { width: 100%; gap: 8px; }
.pick[data-new-zone] .row { flex-wrap: nowrap; }
.pick[data-new-zone] input { flex: 1 1 auto; min-width: 0; min-height: 36px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 600; font-size: 0.9rem; line-height: 1.2;
  padding: 8px 15px; min-height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: #fff; color: var(--text); cursor: pointer;
  text-decoration: none; white-space: nowrap; position: relative;
  transition: background var(--fast) var(--ease), border-color var(--fast), box-shadow var(--fast), transform 0.08s var(--ease), color var(--fast);
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-alt); border-color: #B9B5B8; text-decoration: none; color: var(--text); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { background: var(--brand-red); border-color: var(--brand-red); color: #fff; box-shadow: 0 1px 2px rgba(196,22,28,0.3), inset 0 1px 0 rgba(255,255,255,0.12); }
.btn-primary:hover { background: var(--brand-red-hover); border-color: var(--brand-red-hover); color: #fff; }
.btn-dark { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.btn-dark:hover { background: #3A3435; border-color: #3A3435; color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #12663D; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-sunk); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: #E9B9BB; }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 5px 11px; min-height: 32px; font-size: 0.82rem; }
.btn-lg { width: 100%; min-height: 56px; font-size: 1.06rem; border-radius: var(--radius); }
.btn-xl { min-height: 64px; font-size: 1.1rem; padding: 12px 22px; border-radius: var(--radius); }
.btn-icon { padding: 0; width: 40px; }
.btn[disabled], .btn.is-busy { opacity: 0.55; cursor: not-allowed; }
.btn.is-busy::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-link { background: none; border: 0; color: var(--brand-red); padding: 0; min-height: 0; font-weight: 600; cursor: pointer; font: inherit; }
.btn-link:hover { text-decoration: underline; }

/* ---------- Mensajes y avisos ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 15px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.alert > .icon { margin-top: 1px; }
.alert.success { border-color: #BFE0CC; background: var(--ok-soft); color: #11492D; }
.alert.error { border-color: #EDBDBF; background: var(--danger-soft); color: #7D0E12; }
.alert.warning { border-color: #F2DB92; background: var(--warn-soft); color: #5C4000; }
.alert.info { background: var(--info-soft); border-color: #C9DAF4; color: #173F7A; }
.messages .alert { animation: rise 0.35s var(--ease) backwards; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 60; pointer-events: none; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: var(--radius);
  background: var(--brand-ink); color: #fff; box-shadow: var(--shadow-lg); font-weight: 500;
  animation: toast-in 0.35s var(--ease-spring) both;
}
.toast.ok .icon { color: #4ADE80; }
.toast.error { background: #7D0E12; }
.toast.leaving { animation: toast-out 0.25s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 7px; align-items: center; transition: color var(--fast), border-color var(--fast); }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); border-color: var(--brand-red); }

.seg-tabs { display: inline-flex; background: var(--surface-sunk); padding: 3px; border-radius: 999px; gap: 2px; }
.seg-tabs a, .seg-tabs button { padding: 6px 14px; border-radius: 999px; color: var(--text-muted); font-weight: 600; font-size: 0.85rem; border: 0; background: none; cursor: pointer; font-family: inherit; transition: background var(--fast), color var(--fast), box-shadow var(--fast); }
.seg-tabs a:hover, .seg-tabs button:hover { text-decoration: none; color: var(--text); }
.seg-tabs [aria-current="page"], .seg-tabs [aria-pressed="true"] { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

.stepper { display: flex; list-style: none; padding: 0; margin: 0 0 18px; flex-wrap: wrap; gap: 6px; }
.stepper li { font-size: 0.8rem; padding: 6px 12px 6px 10px; background: var(--neutral-soft); color: var(--text-muted); border-radius: 999px; display: inline-flex; gap: 6px; align-items: center; }
.stepper li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.stepper li.done { background: var(--ok-soft); color: var(--ok); }
.stepper li.current { background: var(--brand-ink); color: #fff; font-weight: 600; }
.stepper li.current::before { opacity: 1; background: var(--brand-yellow); }

/* ---------- Línea de tiempo (bitácoras) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding: 0 0 16px 44px; }
.timeline li .t-icon { position: absolute; left: 4px; top: 0; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--border-strong); display: flex; align-items: center; justify-content: center; }
.timeline li .t-icon .icon { width: 12px; height: 12px; }
.timeline li.is-key .t-icon { border-color: var(--brand-red); color: var(--brand-red); }
.timeline .t-meta { font-size: 0.78rem; color: var(--text-faint); }

/* ---------- Tablero kanban (licitaciones) ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; scroll-snap-type: x proximity; }
.kanban-col { background: var(--surface-sunk); border-radius: var(--radius-lg); padding: 10px; min-height: 120px; scroll-snap-align: start; }
.kanban-col > header { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font-weight: 700; font-size: 0.84rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kanban-col .card { margin-bottom: 10px; padding: 14px; }
.kanban-col .card:last-child { margin-bottom: 0; }

/* ---------- Ingreso ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 500px); background: #fff; }
.login-brand {
  background: radial-gradient(120% 90% at 10% 0%, #D72026 0%, #C4161C 45%, #8E0F14 100%);
  color: #fff; padding: 52px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.login-brand::after { content: ""; position: absolute; right: -140px; bottom: -140px; width: 460px; height: 460px; border-radius: 50%; border: 60px solid rgba(255,255,255,0.06); }
.login-brand img { width: min(440px, 100%); height: auto; position: relative; z-index: 1; animation: rise 0.6s var(--ease) backwards; }
.login-brand p { max-width: 460px; opacity: 0.93; position: relative; z-index: 1; font-size: 1.02rem; }
.login-form { background: var(--surface); display: flex; align-items: center; justify-content: center; padding: 40px 32px; }
.login-form form { width: 100%; max-width: 350px; display: grid; gap: 16px; animation: rise 0.5s 0.1s var(--ease) backwards; }

/* ---------- Inventario en vivo: captura móvil ---------- */
.capture { max-width: 720px; margin: 0 auto; }
.capture-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.capture-head h1 { font-size: 1.3rem; }
.sync { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 999px; background: var(--neutral-soft); font-size: 0.84rem; font-weight: 500; transition: background var(--slow) var(--ease), color var(--slow); }
.sync.pending { background: var(--warn-soft); color: var(--warn-text); }
.sync.ok { background: var(--ok-soft); color: var(--ok); }
.capture .sync { border-radius: var(--radius); }
.big-buttons { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.big-buttons button, .big-buttons a { min-height: 64px; font-size: 1rem; }

.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(130px, 45%), 1fr)); gap: 10px; }
.zone-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; min-height: 84px; text-align: left;
  border: 1.5px solid var(--border); border-radius: var(--radius); background: #fff; cursor: pointer; font: inherit; color: var(--text);
  transition: border-color var(--fast), transform var(--fast) var(--ease), box-shadow var(--fast), background var(--fast);
}
.zone-btn:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.zone-btn:active { transform: scale(0.98); }
.zone-btn .z-name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; line-height: 1.2; }
.zone-btn .z-sub { font-size: 0.78rem; color: var(--text-muted); }
.zone-btn .z-count { margin-top: auto; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); display: flex; gap: 5px; align-items: center; }
.zone-btn[aria-pressed="true"] { border-color: var(--brand-red); background: var(--brand-red-soft); box-shadow: 0 0 0 3px var(--brand-red-tint); }
.zone-btn.add { border-style: dashed; color: var(--text-muted); align-items: center; justify-content: center; }

.zone-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--brand-ink); color: #fff; border-radius: var(--radius); margin-bottom: 12px; position: sticky; top: 64px; z-index: 6; box-shadow: var(--shadow); }
.zone-bar .zb-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: #BEB8BA; }
.zone-bar .zb-name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.zone-bar .btn { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.18); color: #fff; box-shadow: none; }
.zone-bar .btn:hover { background: rgba(255,255,255,0.18); }

.search-hero { position: relative; }
.search-hero .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.search-hero input { min-height: 52px; font-size: 1.06rem; padding-left: 44px; border-radius: var(--radius); }

.chip-filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chip-filters::-webkit-scrollbar { display: none; }
.fchip {
  flex: none; display: inline-flex; gap: 6px; align-items: center; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: #fff; font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--text);
  cursor: pointer; white-space: nowrap; transition: background var(--fast), border-color var(--fast), color var(--fast), transform 0.08s;
}
.fchip:hover { border-color: #B0ACAF; }
.fchip:active { transform: scale(0.97); }
.fchip .n { font-size: 0.72rem; color: var(--text-faint); font-weight: 600; }
.fchip[aria-pressed="true"] { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.fchip[aria-pressed="true"] .n { color: #BEB8BA; }
.filter-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin: 12px 0 6px; display: flex; justify-content: space-between; align-items: center; }

.results { display: grid; gap: 8px; margin-top: 12px; }
.result {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font: inherit; color: var(--text);
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast) var(--ease);
  animation: rise 0.3s var(--ease) backwards;
}
.result:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.result:active { transform: scale(0.99); }
.result .r-main { flex: 1 1 auto; min-width: 0; }
.result .r-name { font-weight: 600; font-size: 1rem; line-height: 1.3; }
.result .r-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.result .r-code { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-faint); }
.result .r-count { flex: none; text-align: center; min-width: 54px; }
.result .r-count strong { display: block; font-family: var(--font-display); font-size: 1.3rem; line-height: 1; color: var(--ok); }
.result .r-count span { font-size: 0.7rem; color: var(--text-faint); }
.result .r-go { color: var(--text-faint); flex: none; }
.results-more { text-align: center; font-size: 0.84rem; color: var(--text-muted); padding: 6px; }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(20,16,17,0.45); z-index: 40; animation: fade 0.2s var(--ease) both; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(560px, 100%); max-height: 92vh; overflow-y: auto;
  background: #fff; border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); z-index: 41; padding: 10px 20px 20px;
  animation: sheet-in 0.36s var(--ease) both;
}
@keyframes sheet-in { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
.sheet .grabber { width: 44px; height: 5px; border-radius: 999px; background: var(--border-strong); margin: 0 auto 12px; }
.sheet .s-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; line-height: 1.25; }
.sheet .s-sub { color: var(--text-muted); font-size: 0.86rem; margin-top: 2px; }
.sheet .s-where { display: inline-flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 0.82rem; font-weight: 600; background: var(--neutral-soft); padding: 4px 10px; border-radius: 999px; }
.qty-stepper { display: grid; grid-template-columns: 64px 1fr 64px; gap: 10px; margin: 18px 0 14px; }
.qty-stepper button { height: 64px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: #fff; cursor: pointer; font-size: 1.6rem; color: var(--text); display: flex; align-items: center; justify-content: center; transition: background var(--fast), transform 0.08s; }
.qty-stepper button:hover { background: var(--surface-alt); }
.qty-stepper button:active { transform: scale(0.95); background: var(--surface-sunk); }
.qty-input { font-family: var(--font-display); font-size: 2.2rem !important; font-weight: 600; text-align: center; min-height: 64px !important; font-variant-numeric: tabular-nums; border-radius: var(--radius) !important; }
.quick-qty { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.quick-qty button { flex: 1 1 0; min-width: 48px; padding: 8px 0; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-alt); font: inherit; font-weight: 600; cursor: pointer; }
.quick-qty button:hover { border-color: var(--border-strong); background: #fff; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { padding: 11px 6px; text-align: center; font-weight: 600; cursor: pointer; border-right: 1px solid var(--border); transition: background var(--fast), color var(--fast); font-size: 0.9rem; }
.segmented label:last-of-type { border-right: 0; }
.segmented input:checked + label { background: var(--brand-ink); color: #fff; }
.segmented input:focus-visible + label { box-shadow: inset var(--focus); }
.result-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; max-height: 320px; overflow-y: auto; }
.result-list button { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: #fff; padding: 12px; font: inherit; cursor: pointer; }
.result-list button:hover, .result-list button:focus-visible { background: var(--surface-alt); }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1 1 auto; }
.btn-dark .muted { color: #D6D2D4; }
.sticky-bottom { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(255,255,255,0), #fff 30%); padding: 14px 0 4px; }

.counted-list { list-style: none; margin: 0; padding: 0; }
.counted-list li { display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.counted-list li:last-child { border-bottom: 0; }
.counted-list li.is-new { animation: flash-ok 1.8s var(--ease); }
.counted-list .c-qty { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.counted-list .c-main { flex: 1 1 auto; min-width: 0; }
.counted-list .c-name { font-weight: 600; line-height: 1.3; }
.counted-list .c-sub { font-size: 0.78rem; color: var(--text-muted); }

/* Tablero en vivo */
.feed { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow-y: auto; }
.feed li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.feed li.is-new { animation: flash-ok 2s var(--ease); }
.feed .f-main { flex: 1 1 auto; min-width: 0; font-size: 0.9rem; }
.feed .f-time { font-size: 0.75rem; color: var(--text-faint); white-space: nowrap; }
.zone-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; display: grid; gap: 8px; }
.zone-card .zc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.zone-card .zc-name { font-weight: 700; font-family: var(--font-display); font-size: 1.02rem; }
.zone-card .zc-stats { display: flex; gap: 14px; font-size: 0.82rem; color: var(--text-muted); }
.zone-card .zc-stats strong { color: var(--text); font-variant-numeric: tabular-nums; }
.big-number { font-family: var(--font-display); font-size: 2.6rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }

/* Hero de bienvenida */
.hero {
  border-radius: var(--radius-lg); padding: 24px 26px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(120% 140% at 0% 0%, #3A3334 0%, #231F20 55%, #171314 100%);
  box-shadow: var(--shadow);
}
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; border: 36px solid rgba(196,22,28,0.35); }
.hero h1 { font-size: 1.7rem; position: relative; z-index: 1; }
.hero p { color: #CFCACC; position: relative; z-index: 1; margin-top: 6px; }
.hero .actions { margin-top: 16px; position: relative; z-index: 1; }
.hero .btn { box-shadow: none; }
.hero .btn:not(.btn-primary) { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); color: #fff; }
.hero .btn:not(.btn-primary):hover { background: rgba(255,255,255,0.18); }

.quick-links { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.quick-link {
  display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--radius); background: #fff; border: 1px solid var(--border);
  color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast), border-color var(--fast);
}
.quick-link:hover { text-decoration: none; color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.quick-link .ql-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--brand-red-soft); color: var(--brand-red); flex: none; }
.quick-link .ql-sub { display: block; font-size: 0.78rem; font-weight: 400; color: var(--text-muted); }

.skeleton { background: linear-gradient(90deg, var(--surface-sunk) 25%, #F7F6F7 50%, var(--surface-sunk) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: var(--radius-sm); min-height: 16px; }

/* ---------- Detalles plegables, barra de inicio y animaciones de datos ---------- */
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details.panel > summary.panel-head::after {
  content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-faint); border-bottom: 2px solid var(--text-faint);
  transform: rotate(45deg); transition: transform var(--fast) var(--ease); margin-left: auto;
}
details.panel[open] > summary.panel-head::after { transform: rotate(225deg); }
details.panel:not([open]) > summary.panel-head { border-bottom: 0; }
details.panel + .start-bar, .panel + .start-bar { margin-top: 18px; }
.start-bar {
  position: sticky; bottom: 12px; z-index: 5; display: flex; gap: 16px; align-items: center; justify-content: space-between;
  padding: 14px 18px; margin-top: 18px; background: rgba(255,255,255,0.94); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.start-bar .small { max-width: 520px; }
.live-dot.white { background: #fff; animation: none; }
.skel-chip { width: 92px; height: 34px; border-radius: 999px; flex: none; }
.skel-result { height: 62px; border-radius: var(--radius); }
.fchip.more { border-style: dashed; color: var(--text-muted); }
.bump { animation: bump 0.55s var(--ease); display: inline-block; }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.08); color: var(--brand-red); } 100% { transform: scale(1); } }
.metric.is-dark .bump { color: #fff; }
.badge.dark { vertical-align: 1px; }
.pill-note { display: inline-flex; gap: 6px; align-items: center; font-size: 0.8rem; color: var(--text-muted); }
.secret-box { font-family: var(--font-mono); font-size: 1.35rem; letter-spacing: 0.06em; padding: 14px 18px; border-radius: var(--radius); background: var(--brand-ink); color: #fff; text-align: center; user-select: all; }

@media (max-width: 900px) {
  .start-bar { flex-direction: column; align-items: stretch; bottom: 8px; padding: 10px; gap: 8px; }
  .start-bar .small { display: none; }
  .start-bar .btn-xl { width: 100%; min-height: 54px; font-size: 1.02rem; white-space: normal; }
  .page-head .seg-tabs { max-width: 100%; overflow-x: auto; }
  .page-head .actions { width: 100%; }
  .page-head .actions > .btn, .page-head .actions > form { flex: 1 1 100%; }
  .page-head .actions > form > .btn { width: 100%; }
  .page-head .actions .btn { white-space: normal; }
}
.seg-tabs a, .seg-tabs button { white-space: nowrap; }

/* ---------- Licitaciones ---------- */
.text-danger { color: var(--danger); }
.w-qty { width: 76px !important; min-width: 0; }
.urgent { color: var(--brand-red); font-weight: 700; }
.kanban-empty { padding: 18px 8px; text-align: center; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); }
.kanban-col.is-over { background: var(--brand-red-soft); box-shadow: inset 0 0 0 2px rgba(196,22,28,0.35); }
.tender-card { cursor: grab; }
.tender-card.is-dragging { opacity: 0.45; transform: rotate(1.5deg) scale(0.98); }
.tender-card .card-title { font-size: 0.98rem; }
.tender-countdown { font-size: 1.35rem !important; line-height: 1.25; }
.counted-list li.doc-group { background: var(--surface-alt); padding: 8px 16px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.counted-list li.is-done .c-name { text-decoration: line-through; color: var(--text-faint); }
.counted-list .ql-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--surface-sunk); color: var(--text-muted); flex: none; }
.task-check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-strong); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; color: transparent; transition: all var(--fast) var(--ease); flex: none; }
.task-check:hover { border-color: var(--ok); color: var(--ok); }
.task-check.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.task-check .icon { width: 14px; height: 14px; }

/* ---------- Ficha de llanta ---------- */
.facts.guide { grid-template-columns: minmax(110px, max-content) 1fr; gap: 10px 18px; }
.facts.guide dt { font-weight: 600; color: var(--text); }
.facts.guide dd { color: var(--text-muted); }

/* ---------- Tablero gerencial ---------- */
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr minmax(90px, auto); gap: 12px; align-items: center; }
.bar-row .progress { height: 10px; }
@media (max-width: 600px) { .bar-row { grid-template-columns: 70px 1fr; } .bar-row > :last-child { grid-column: 2; } }

/* ---------- Adaptación a teléfono ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar .search-mini { min-width: 0; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; transform: translateX(-100%); transition: transform 0.28s var(--ease); z-index: 30; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(20,16,17,0.4); z-index: 25; animation: fade 0.2s both; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 8px 14px; }
  .topbar .search-mini, .topbar .company .hide-mobile { display: none; }
  .content { padding: 16px 14px 56px; }
  .grid-2, .grid-3, .grid-4, .split, .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .grid-4.keep-2, .grid-3.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 26px 22px 22px; gap: 18px; }
  .login-brand img { width: min(300px, 90%); }
  .login-brand::after { display: none; }
  table.data th, table.data td { padding: 9px 10px; }
  .hide-mobile { display: none; }
  h1 { font-size: 1.35rem; }
  .page-head { margin-bottom: 14px; }
  .zone-bar { top: 56px; }
  .metric { padding: 12px 13px; }
  .metric .label { font-size: 0.74rem; gap: 6px; overflow-wrap: anywhere; }
  .metric .value { font-size: 1.6rem; }
  .toasts { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  .quick-links { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .quick-link { padding: 12px; gap: 10px; font-size: 0.9rem; align-items: flex-start; flex-direction: column; }
  .quick-link .ql-icon { width: 36px; height: 36px; }
  .quick-link .ql-sub { font-size: 0.74rem; }
  .hero { padding: 20px 18px; }
  .hero h1 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

@media print {
  .sidebar, .topbar, .actions, .no-print, .toasts { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  .content > * { animation: none; }
  .panel { box-shadow: none; }
}
