/* Sistema de proveedores Dos Bocas. Una columna tipo libreta; números grandes primero, detalle después. */
:root {
  --bg: #f3f1ec; --paper: #fffdf8; --ink: #1d2a2a; --muted: #5f6b69; --line: #dcd7cc;
  --accent: #0f5c57; --accent-soft: #d9ebe8; --on-accent: #fffdf8;
  --ok: #1f7a3a; --ok-soft: #ddf0e2; --warn: #a15c00; --warn-soft: #fbecd2; --bad: #b3261e; --bad-soft: #f8dedb;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121817; --paper: #1a2221; --ink: #e7ece9; --muted: #9aa6a3; --line: #2e3a38;
    --accent: #5cc2b6; --accent-soft: #173a37; --on-accent: #0d1514;
    --ok: #6fd08c; --ok-soft: #183324; --warn: #f0b357; --warn-soft: #3a2a12; --bad: #ff8a80; --bad-soft: #3d1c1a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
[hidden] { display: none !important; }

header.top { position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.in { max-width: 920px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 10px; }
.brand h1 { font: 800 21px/1.1 var(--display); margin: 0; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 12px; }
nav { display: flex; gap: 2px; overflow-x: auto; margin-top: 6px; scrollbar-width: none; }
nav a { flex: none; padding: 9px 12px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; }
nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
main.in { padding-block: 20px 64px; display: flex; flex-direction: column; gap: 20px; }

h2 { font: 800 26px/1.15 var(--display); margin: 0; text-wrap: balance; }
h3 { font: 600 12px/1.3 var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; }
p { margin: 0; max-width: 65ch; }
.lead { color: var(--muted); }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tile.ok { border-top-color: var(--ok); } .tile.warn { border-top-color: var(--warn); } .tile.bad { border-top-color: var(--bad); }
.big { font: 800 27px/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.tile .sub { font-size: 13px; color: var(--muted); }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.hero { background: var(--accent); color: var(--on-accent); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.hero h3 { color: inherit; opacity: .85; }
.hero .big { font-size: 38px; }
.hero .sub { opacity: .9; font-size: 14px; }

.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.n { background: var(--accent-soft); color: var(--accent); }
.pill.gris { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.anulada td { color: var(--muted); text-decoration: line-through; }
.tbl tr.clic { cursor: pointer; }
.tbl tr.clic:hover td { background: var(--accent-soft); }

.lista { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.lista-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.lista-h b { font: 800 17px/1.2 var(--display); }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .who { font-weight: 600; overflow-wrap: anywhere; }
.item .meta { font-size: 12px; color: var(--muted); }
.item .acciones { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.item.hecho { opacity: .55; }

button, .btn { font: 600 14px var(--body); border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); padding: 10px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; }
button.primary, .btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
button.peligro { color: var(--bad); border-color: var(--bad); }
button.chico { min-height: 34px; padding: 6px 10px; font-size: 13px; }
button.link { border: 0; background: none; padding: 4px 6px; min-height: 0; color: var(--accent); font-size: 13px; }
button:hover { filter: brightness(1.04); } button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

form.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
label { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
input, select, textarea { font: 500 16px var(--body); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); width: 100%; min-width: 0; }
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }
.full { grid-column: 1 / -1; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--bg); color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.note { font-size: 14px; border-radius: 10px; padding: 10px 12px; background: var(--accent-soft); }
.note.warn { background: var(--warn-soft); } .note.bad { background: var(--bad-soft); } .note.ok { background: var(--ok-soft); }
.meter { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); border-radius: 99px; width: 0; }
.meter i.warn { background: var(--warn); } .meter i.bad { background: var(--bad); }
.barra-ant { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--line); }
.barra-ant i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.c0 { background: var(--ok); } .c1 { background: #6aa84f; } .c2 { background: var(--warn); } .c3 { background: #d0723a; } .c4 { background: var(--bad); }
svg text { fill: var(--muted); font: 11px var(--body); }

.mov { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.mov:last-child { border-bottom: 0; }
.mov time { font-size: 12px; color: var(--muted); white-space: nowrap; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; max-width: min(92vw, 520px); z-index: 20; font-size: 14px; box-shadow: 0 6px 24px rgb(0 0 0 / .25); }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); padding: 18px; width: min(92vw, 460px); }
dialog::backdrop { background: rgb(0 0 0 / .4); }
.vacio { text-align: center; color: var(--muted); padding: 24px 12px; }
.solo-impresion { display: none; }

@media print {
  header.top, nav, .no-imprimir, button, .toast { display: none !important; }
  body { background: #fff; color: #000; font-size: 11px; }
  .card, .lista { border: 0; padding: 0; }
  .solo-impresion { display: block; }
  main.in { padding: 0; }
}
@media (prefers-reduced-motion: no-preference) { .item, .tile { transition: opacity .2s; } }
