:root {
  --bg: #ffffff; --soft: #f3f4f6; --line: #e5e7eb; --text: #111317; --muted: #6b7280;
  --green: #15803d; --green-bg: #e8f6ec; --yellow: #8a6100; --yellow-bg: #fdf3d7; --yellow-line: #f0c44c;
  --red: #c0262d; --red-bg: #fde8e8; --blue: #1d4ed8; --blue-bg: #e6eefc; --black: #111317;
  --radius: 14px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.error { color: var(--red); margin: 8px 0 0; }
.green { color: var(--green); } .red { color: var(--red); } .grey { color: var(--muted); }
h1 { font-size: 28px; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 17px; margin: 22px 0 10px; }

/* entrar */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--soft); }
.login-box { width: 100%; max-width: 340px; background: #fff; border-radius: 20px; padding: 28px 24px; text-align: center;
  box-shadow: 0 6px 30px rgba(0,0,0,.06); }
.login-logo { width: 72px; height: 72px; border-radius: 18px; }
.login-box h1 { margin: 12px 0 4px; }
.login-box input { width: 100%; margin-top: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 16px; }
.login-box button { width: 100%; margin-top: 14px; padding: 13px; border: 0; border-radius: 12px; background: var(--black);
  color: #fff; font-weight: 600; }

/* estructura */
.layout { min-height: 100vh; }
.side, .right { display: none; }
.main { padding: 18px 16px calc(84px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 16px; gap: 12px; }
.icon-btn { border: 0; background: none; padding: 6px; position: relative; color: var(--text); }
.icon-btn svg, .tab svg, .side-nav svg { width: 24px; height: 24px; }
.dot { position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 11px; line-height: 18px; font-weight: 700; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line); padding: 6px 0 calc(6px + var(--safe-b));
  backdrop-filter: blur(8px); z-index: 5; }
.tab { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px;
  color: var(--muted); padding: 4px 0; }
.tab.on { color: var(--text); font-weight: 600; }

/* piezas */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tile { background: var(--soft); border-radius: var(--radius); padding: 14px 16px; }
.tile small { color: var(--muted); font-size: 14px; display: block; }
.tile b { font-size: 26px; display: block; margin-top: 2px; letter-spacing: -0.02em; }
.tile i { font-style: normal; font-size: 13px; color: var(--green); }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; background: #fff; }
button.card { display: block; width: 100%; text-align: left; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-title { font-weight: 700; font-size: 17px; }
.card-sub { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.yellow { background: var(--yellow-bg); color: var(--yellow); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.blue { background: var(--blue-bg); color: var(--blue); }
.pill.grey { background: var(--soft); color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -16px 12px; padding-left: 16px;
  padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 0; background: var(--soft); border-radius: 999px; padding: 8px 14px; white-space: nowrap; font-size: 15px; }
.chip.on { background: var(--black); color: #fff; font-weight: 600; }
.chip.small { padding: 6px 12px; font-size: 14px; }
.note { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.model-img { width: 54px; height: 54px; object-fit: contain; border-radius: 10px; background: var(--soft); flex: none; }
.sizes { margin-top: 10px; display: grid; grid-template-columns: auto 1fr auto; column-gap: 14px; row-gap: 6px;
  font-variant-numeric: tabular-nums; }
.sizes .t { font-weight: 700; }
.sizes .t small { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-left: 3px; }
.sizes .g { text-align: right; font-weight: 600; }
.extra { margin-top: 10px; font-size: 14px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }
.order.urgent { border-color: var(--yellow-line); box-shadow: 0 0 0 1px var(--yellow-line) inset; }
.order.late { border-color: #f3a3a6; box-shadow: 0 0 0 1px #f3a3a6 inset; }
.bar { height: 6px; background: var(--soft); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.bar.warn span { background: #e0a100; } .bar.bad span { background: var(--red); }
.route-line { padding: 4px 0; }
.alert { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.alert:last-child { border-bottom: 0; }
.alert-ico { width: 22px; flex: none; text-align: center; }
.alert b { display: block; font-size: 15px; }
.alert span { color: var(--muted); font-size: 14px; }
.search { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; margin-bottom: 12px; }
.updated { font-size: 12.5px; color: var(--muted); text-align: center; margin: 14px 0 0; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 14px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table td.model b { display: block; } .table td.model small { color: var(--muted); }
.table .g { font-weight: 700; }

/* PC */
@media (min-width: 1000px) {
  .layout { display: grid; grid-template-columns: 250px 1fr 340px; background: var(--bg); }
  .tabbar { display: none; }
  .side { display: block; background: #f7f8fa; border-right: 1px solid var(--line); padding: 22px 14px; position: sticky;
    top: 0; height: 100vh; overflow-y: auto; }
  .right { display: block; border-left: 1px solid var(--line); padding: 24px 18px; position: sticky; top: 0; height: 100vh;
    overflow-y: auto; }
  .main { max-width: none; margin: 0; padding: 26px 30px 40px; }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; padding: 0 8px 18px; }
  .brand img { width: 30px; height: 30px; border-radius: 8px; }
  .side-nav button, .side-row { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none;
    padding: 9px 12px; border-radius: 10px; text-align: left; font-size: 15.5px; }
  .side-nav button.on { background: var(--black); color: #fff; }
  .side-row { justify-content: space-between; padding: 7px 12px; }
  .side-row.on { background: #eaecef; font-weight: 600; }
  .side-row span { color: var(--muted); font-size: 14px; }
  .side-title { text-transform: uppercase; font-size: 12px; letter-spacing: .06em; color: var(--muted); font-weight: 600;
    padding: 20px 12px 6px; }
  .side-out { margin: 24px 12px 0; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 14px;
    font-size: 14px; color: var(--muted); }
  .tiles.four { grid-template-columns: repeat(4, 1fr); }
  .grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
  .grid-cards .card { margin: 0; }
  .right h2 { margin-top: 0; display: flex; justify-content: space-between; align-items: center; }
  .mobile-only { display: none !important; }
}
@media (max-width: 999px) { .pc-only { display: none !important; } }
.mhead { display: flex; gap: 12px; align-items: flex-start; }
.mhead .model-img { width: 64px; height: 64px; }
.mtext { min-width: 0; flex: 1; }
.mtext .card-title { font-size: 16.5px; line-height: 1.25; }
.mtext .pill { margin-top: 6px; }
.table td { white-space: nowrap; }
.table td.model { white-space: normal; min-width: 220px; }
.right .order .card-sub b { white-space: nowrap; }
