:root {
  --c1: #121F1B;
  --c2: #1A2E27;
  --beige: #DCCBB3;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f4;
  --card: #fff;
  --pad: 12px;
  --bot: 66px;
}
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--c1); line-height: 1.35;
  padding-bottom: calc(var(--bot) + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}
body:has(input:focus, select:focus, textarea:focus) .bot { display: none !important; }
body:has(input:focus, select:focus, textarea:focus) { padding-bottom: 20px !important; }

.top {
  position: sticky; top: 0; z-index: 40; background: var(--c1); color: #fff;
  padding: calc(8px + env(safe-area-inset-top, 0px)) var(--pad) 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
}
.top h1 { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.2; }
.top .sub {
  margin: 2px 0 6px; font-size: 11px; color: var(--beige); opacity: .9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.08); border-radius: 10px; padding: 6px 10px;
}
.status .badge {
  flex: 0 0 auto; min-width: 58px; text-align: center; border-radius: 8px;
  padding: 4px 6px; font-weight: 800; line-height: 1.1;
}
.status .badge b { display: block; font-size: 16px; }
.status .badge span { font-size: 9px; font-weight: 600; text-transform: uppercase; opacity: .9; }
.status.ok .badge { background: var(--ok-bg); color: var(--ok); }
.status.warn .badge { background: var(--warn-bg); color: var(--warn); }
.status.bad .badge { background: var(--bad-bg); color: var(--bad); }
.status .nums { flex: 1; min-width: 0; }
.status .nums .big { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.status .nums .small { font-size: 11px; opacity: .85; margin-top: 1px; }

.wrap { width: 100%; max-width: 480px; margin: 0 auto; padding: 10px var(--pad) 8px; }
.card {
  background: var(--card); border-radius: 14px; margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04); overflow: hidden;
}
.card > .hd {
  padding: 10px 12px 0; font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.card > .bd { padding: 10px 12px 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi { background: #f8faf9; border-radius: 10px; padding: 8px 10px; min-width: 0; }
.kpi .n { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; word-break: break-word; }
.kpi .l { font-size: 11px; color: var(--muted); margin-top: 2px; }
.msg { margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: #f0f5f3; font-size: 12px; font-weight: 500; }

.price-box { text-align: center; padding: 4px 0 2px; }
.price-box .amount { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 0; letter-spacing: -0.02em; }
.price-box .iva { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 40px;
  background: transparent; margin: 0; padding: 0; touch-action: pan-y;
}
input[type="range"]::-webkit-slider-runnable-track { height: 8px; background: #d1d9d6; border-radius: 99px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--c1); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); margin-top: -11px;
}
input[type="range"]::-moz-range-track { height: 8px; background: #d1d9d6; border-radius: 99px; border: none; }
input[type="range"]::-moz-range-thumb {
  width: 30px; height: 30px; border-radius: 50%; background: var(--c1);
  border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.field { margin-top: 8px; }
.field label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field input[type="number"], .field select, .field input[type="text"], .field input[type="date"] {
  width: 100%; height: 44px; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 0 12px; font-size: 16px; font-weight: 600; background: #fff; color: var(--c1);
  -webkit-appearance: none; appearance: none;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 18px, calc(100% - 10px) 18px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin: 8px 0; }
.chk input { width: 18px; height: 18px; }

details.acc {
  background: var(--card); border-radius: 14px; margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
details.acc > summary {
  list-style: none; cursor: pointer; padding: 12px; font-size: 14px; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center; user-select: none;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: "+"; font-size: 20px; font-weight: 400; color: var(--muted); }
details.acc[open] > summary::after { content: "−"; }
details.acc .inner { padding: 0 12px 12px; border-top: 1px solid var(--line); }

.line {
  display: flex; justify-content: space-between; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.line:last-child { border-bottom: 0; }
.line .a { flex: 1; min-width: 0; }
.line .b { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.line.total { font-weight: 800; background: #f0f5f3; margin: 0 -12px; padding: 12px; }
.line .tag { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.tag.ok { color: var(--ok); } .tag.warn { color: var(--warn); } .tag.bad { color: var(--bad); }
.line.pick { background: var(--ok-bg); margin: 0 -12px; padding: 10px 12px; }
.line.bad-bg { background: var(--bad-bg); margin: 0 -12px; padding: 10px 12px; }
.line.warn-bg { background: var(--warn-bg); margin: 0 -12px; padding: 10px 12px; }

.pros, .cons { margin: 0; padding: 0 0 0 18px; font-size: 13px; }
.pros li, .cons li { margin: 0 0 6px; color: var(--c1); }
.hint { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.hint.ok-h { color: var(--ok); font-weight: 700; margin-top: 12px; }
.hint.bad-h { color: var(--bad); font-weight: 700; margin-top: 12px; }
.center { text-align: center; margin: 8px 0 16px; }
.center a { color: var(--muted); }

.pick-list { display: flex; flex-direction: column; gap: 8px; }
.pick-list a {
  display: block; padding: 14px; border-radius: 12px; background: #f8faf9;
  border: 1.5px solid var(--line); color: var(--c1); text-decoration: none; font-weight: 700;
}
.pick-list a span { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 4px; }

.worker {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 8px; background: #fafbfa;
}
.worker .w-hd {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px; font-size: 13px; font-weight: 700;
}
.worker button.rm {
  border: none; background: var(--bad-bg); color: var(--bad);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 700;
}
.btn-full {
  margin-top: 10px; width: 100%; height: 44px; border: none; border-radius: 10px;
  background: #eef2f0; font-weight: 700; font-size: 14px; color: var(--c1);
}

.bot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #fff;
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr; gap: 5px;
  max-width: 480px; margin: 0 auto; box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
.bot button {
  height: 52px; border: none; border-radius: 10px; background: #f1f5f4; color: var(--c1);
  font-size: 11px; font-weight: 700; line-height: 1.15; padding: 4px 2px;
  cursor: pointer; touch-action: manipulation;
}
.bot button:active { background: #dbe4e1; transform: scale(0.97); }
.bot button.main { background: var(--c1); color: #fff; }
.hidden { display: none !important; }
#boot { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }
#err {
  margin: 12px var(--pad); padding: 12px; background: var(--bad-bg); color: var(--bad);
  border-radius: 12px; font-size: 13px;
}

@media (max-width: 380px) {
  .grid2 { grid-template-columns: 1fr; }
}
@media (min-width: 520px) {
  .bot {
    left: 50%; right: auto; transform: translateX(-50%); width: 100%;
    border-radius: 16px 16px 0 0;
  }
}

@media print {
  body { padding: 0; background: #fff; }
  .top, .bot, #picker, #boot, #err, .no-print, .wrap > *:not(#print-slot) { display: none !important; }
  #print-report { display: block !important; }
}
#print-report { display: none; padding: 24px; font-size: 12px; color: #111; max-width: 800px; margin: 0 auto; }
#print-report h1 { font-size: 18px; margin: 0 0 4px; color: #121F1B; }
#print-report h2 { font-size: 14px; margin: 16px 0 8px; border-bottom: 1px solid #ccc; padding-bottom: 4px; }
#print-report table { width: 100%; border-collapse: collapse; margin: 8px 0; }
#print-report th, #print-report td { border: 1px solid #ddd; padding: 6px 8px; text-align: left; }
#print-report th { background: #f3f6f5; }
#print-report .meta { color: #555; margin-bottom: 12px; }
#print-report .box {
  border: 1px solid #121F1B; border-radius: 8px; padding: 12px; margin: 12px 0; background: #f8faf9;
}
