/* COMPRAS 4R – V0.1 */
:root {
  --ink: #1b2330;
  --ink-2: #2a3444;
  --ink-3: #3b4658;
  --bg: #f2f1ec;
  --surface: #ffffff;
  --surface-2: #f8f7f3;
  --line: #e3e1d9;
  --line-2: #eceae3;
  --text: #1d232b;
  --muted: #5f6570;
  --faint: #8b9098;
  --accent: #1d4f8f;
  --accent-2: #163e71;
  --accent-soft: #e8eef7;
  --ok: #1e7d45;
  --ok-dot: #22a05a;
  --ok-soft: #e4f2e9;
  --warn: #8a5a00;
  --warn-dot: #e0a100;
  --warn-soft: #fbf1da;
  --bad: #b3261e;
  --bad-dot: #d63a2f;
  --bad-soft: #fbe8e6;
  --gris: #8a8f98;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(27, 35, 48, .06), 0 3px 10px rgba(27, 35, 48, .05);
  --shadow-lg: 0 10px 40px rgba(20, 26, 36, .22);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", Helvetica, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: 0; }
.num, .tab-num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }
.hide-m { display: none; }
@media (min-width: 900px) { .hide-m { display: block; } .only-m { display: none !important; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Arranque ---------- */
.boot-splash { min-height: 100vh; display: grid; place-items: center; background: var(--ink); }
.boot-mark { color: #fff; font-weight: 800; letter-spacing: .04em; font-size: 22px; }
.boot-mark span { font-weight: 600; color: #aeb8c8; margin-left: 6px; }

/* ---------- Estructura ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--ink); color: #fff;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: baseline; gap: 8px; font-weight: 800; letter-spacing: .03em; font-size: 17px; white-space: nowrap; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .ver { font-weight: 700; font-size: 12px; letter-spacing: .04em; background: #34405a; color: #dfe6f2; padding: 2px 7px; border-radius: 999px; }
.topbar .sp { flex: 1; }
.topbar .who { font-size: 13px; color: #c7cfdb; text-align: right; line-height: 1.2; }
.topbar .who b { color: #fff; font-weight: 600; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: inherit;
}
.topbar .icon-btn:hover { background: #2c3749; }
.icon-btn .dot {
  position: absolute; top: 5px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--bad-dot); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--ink);
}

.layout { flex: 1; display: flex; width: 100%; max-width: 1280px; margin: 0 auto; }
.side { display: none; }
.main { flex: 1; min-width: 0; padding: 16px 16px calc(92px + var(--safe-b)); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 4px 4px calc(4px + var(--safe-b));
}
.tabbar a, .tabbar button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 4px;
  font-size: 11px; font-weight: 600; color: var(--muted); border: 0; background: none; cursor: pointer; position: relative; text-decoration: none;
}
.tabbar a.on, .tabbar button.on { color: var(--accent); }
.tabbar .plus { display: grid; place-items: center; }
.tabbar .plus span.circle {
  width: 44px; height: 44px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; margin-top: -2px;
  box-shadow: 0 4px 12px rgba(29, 79, 143, .35);
}
.tabbar .badge { position: absolute; top: 0; left: 50%; margin-left: 6px; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .side {
    display: block; width: 232px; flex: none; padding: 18px 10px 18px 16px;
    position: sticky; top: 60px; align-self: flex-start; height: calc(100vh - 60px); overflow-y: auto;
  }
  .main { padding: 22px 24px 40px; }
  .side nav { display: flex; flex-direction: column; gap: 2px; }
  .side .sec { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; }
  .side a, .side button.link {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--ink-3);
    font-weight: 600; font-size: 14.5px; border: 0; background: none; cursor: pointer; text-align: left; text-decoration: none;
  }
  .side a:hover, .side button.link:hover { background: #e7e5de; text-decoration: none; }
  .side a.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
  .side a .badge { margin-left: auto; }
  .side .nuevo { margin: 4px 0 10px; }
}

/* ---------- Páginas ---------- */
.page { max-width: 1080px; margin: 0 auto; }
.page-h { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 2px 0 14px; }
.page-h h1 { font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
.page-h .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.page-h .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; font-size: 14px; margin-bottom: 8px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.card-b { padding: 14px 16px; }
.card-h { padding: 12px 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.card-h h2, .card-h h3 { font-size: 15px; font-weight: 700; }
.card-h .acts { margin-left: auto; display: flex; gap: 6px; }
.sec-t { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin: 18px 2px 8px; }
.stack > * + * { margin-top: 12px; }
.grid2 { display: grid; gap: 12px; }
@media (min-width: 900px) {
  .grid2 { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
}
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.sp { flex: 1; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 650; font-size: 14.5px; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--bad); border-color: #ecc8c4; }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(27, 35, 48, .06); }
.btn.sm { min-height: 34px; padding: 0 11px; font-size: 13.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.wa { background: #1f7a4a; border-color: #1f7a4a; color: #fff; }
.btn.wa:hover { background: #196640; }
.btn .spin { width: 16px; height: 16px; }

/* ---------- Formularios ---------- */
.field { display: block; }
.field + .field, .field + .row, .row + .field { margin-top: 12px; }
.field > .lbl { display: block; font-size: 13px; font-weight: 650; color: var(--ink-3); margin-bottom: 5px; }
.field > .lbl .opt { font-weight: 500; color: var(--faint); }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #d6d3c9; border-radius: 9px; background: #fff;
  font: inherit; font-size: 16px; color: var(--text); outline: none;
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.4; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29, 79, 143, .15); }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235f6570' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two > .field + .field { margin-top: 0; }
.field + .two, .two + .field, .two + .two, .two + .row, .field + .three, .three + .field, .seg + .field, .reminder + .field, .pre + .field, div + .field { margin-top: 12px; }
.two > .field, .three > .field { margin-top: 0 !important; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.monto { display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-err { background: var(--bad-soft); color: var(--bad); border-radius: 9px; padding: 9px 12px; font-size: 14px; font-weight: 550; margin-top: 12px; }

.seg { display: inline-flex; background: #e8e6df; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: 7px 12px; min-height: 36px; border-radius: 8px; font-weight: 650; font-size: 14px; color: var(--muted); cursor: pointer;
}
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg.block { display: flex; }
.seg.block button { flex: 1; }
.seg button.on.urg { color: var(--bad); }

/* ---------- Etiquetas ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: #eeece6; color: var(--ink-3); white-space: nowrap; line-height: 18px;
}
.tag.urg { background: var(--bad-soft); color: var(--bad); }
.tag.blue { background: var(--accent-soft); color: var(--accent-2); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.etapa { background: var(--ink); color: #fff; font-size: 11px; padding: 1px 7px; letter-spacing: .03em; }
.tag.pf { font-family: var(--mono); font-size: 11.5px; letter-spacing: .02em; }
.pf-DO { background: #efe9f7 !important; color: #5b3d8a !important; }
.pf-COM { background: #e5edf8 !important; color: #1d4f8f !important; }
.pf-TE { background: #e2f1ee !important; color: #1d6b5e !important; }
.pf-CO { background: #f6eedb !important; color: #7a5200 !important; }
.pf-RC { background: #f6e5e3 !important; color: #973029 !important; }
.pf-RO { background: #e4efe6 !important; color: #2c5a36 !important; }
.pf-RV { background: #f1e8e0 !important; color: #6e4424 !important; }
.pf-JO { background: #e8ebef !important; color: #465160 !important; }
.badge { display: inline-block; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad-dot); color: #fff; font-size: 11.5px; font-weight: 750; line-height: 20px; text-align: center; }

/* Semáforo: color + forma + texto, nunca solo color */
.sem { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; white-space: nowrap; }
.sem i { width: 11px; height: 11px; border-radius: 50%; flex: none; display: inline-block; }
.sem.verde { color: var(--ok); } .sem.verde i { background: var(--ok-dot); }
.sem.amarillo { color: var(--warn); } .sem.amarillo i { background: var(--warn-dot); border-radius: 2px; transform: rotate(45deg); width: 10px; height: 10px; }
.sem.rojo { color: var(--bad); } .sem.rojo i { background: var(--bad-dot); border-radius: 2px; }
.sem.gris { color: var(--gris); } .sem.gris i { background: #c3c6cc; }
.sem-bar { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.sem-bar.verde { background: var(--ok-dot); } .sem-bar.amarillo { background: var(--warn-dot); } .sem-bar.rojo { background: var(--bad-dot); } .sem-bar.gris { background: #d3d5d9; }

/* ---------- Listas de pedidos ---------- */
.plist { display: flex; flex-direction: column; gap: 8px; }
.pcard {
  display: flex; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--text); text-decoration: none; cursor: pointer;
}
.pcard:hover { border-color: #cfccc1; text-decoration: none; }
.pcard .body { flex: 1; min-width: 0; }
.pcard .l1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pcard .l1 .n { font-weight: 800; color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.pcard .l1 .obra { font-weight: 750; color: var(--ink-3); letter-spacing: .02em; }
.pcard .tit { font-size: 15.5px; font-weight: 650; margin: 3px 0 5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pcard .l3 { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pcard .l3 b { color: var(--ink-3); font-weight: 650; }
.pcard .todo { margin-top: 7px; font-size: 13.5px; font-weight: 650; color: var(--accent-2); display: flex; align-items: center; gap: 6px; }
.pcard .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.pcard .monto { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.link { cursor: pointer; }
.tbl tr.link:hover td { background: #faf9f5; }
.tbl .r { text-align: right; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Filtros ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .input { padding-left: 36px; }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.filters .grp + .grp { margin-top: 10px; }
.filters .grp > .lbl { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip {
  border: 1px solid #d6d3c9; background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px;
}
.fchip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; cursor: pointer; text-align: left; }
.stat.on { outline: 2px solid var(--ink); outline-offset: -1px; }
.stat .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
@media (max-width: 480px) { .stats { grid-template-columns: repeat(2, 1fr); } .stat { padding: 8px 12px; display: flex; align-items: center; gap: 10px; } .stat .v { font-size: 20px; } }

/* ---------- Detalle ---------- */
.head-card { padding: 16px; }
.head-card .l1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.head-card .n { font-size: 26px; font-weight: 850; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.head-card .obra { font-size: 15px; font-weight: 800; letter-spacing: .03em; color: var(--ink-3); }
.head-card .tit { font-size: 18px; font-weight: 650; margin: 8px 0 10px; }
.estado-box { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; }
.estado-box .e { font-weight: 750; font-size: 15px; }
.estado-box .r { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.estado-box .d { margin-left: auto; text-align: right; flex: none; }
.estado-box .d .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.estado-box .d .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }

.todo-card { border: 2px solid var(--accent); background: #f5f8fd; }
.todo-card .card-b { padding: 14px 16px 16px; }
.todo-card .t { font-size: 13px; font-weight: 750; color: var(--accent-2); text-transform: uppercase; letter-spacing: .06em; }
.todo-card .q { font-size: 16.5px; font-weight: 700; margin: 3px 0 12px; }
.todo-card .btns { display: flex; flex-wrap: wrap; gap: 8px; }
.reminder { display: flex; gap: 10px; background: var(--warn-soft); color: #5e4000; border-radius: 9px; padding: 9px 12px; font-size: 13.5px; margin-bottom: 12px; }
.reminder svg { flex: none; margin-top: 1px; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 7px 12px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: 1px; } .kv dd { margin-bottom: 8px; } }

.items { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.items td { padding: 8px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.items td.c { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 12px; font-weight: 650; }
.items tr:last-child td { border-bottom: 0; }

/* Recorrido del proceso */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; position: relative; padding-bottom: 14px; }
.steps li:last-child { padding-bottom: 0; }
.steps li::before { content: ""; position: absolute; left: 12px; top: 26px; bottom: 0; width: 2px; background: var(--line); }
.steps li:last-child::before { display: none; }
.steps .mk { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--line); color: var(--faint); font-size: 12px; font-weight: 800; z-index: 1; }
.steps li.done .mk { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.now .mk { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 4px rgba(29, 79, 143, .18); }
.steps li.done::before { background: #9fcfb0; }
.steps .nm { font-weight: 650; font-size: 14.5px; }
.steps li.pend .nm { color: var(--faint); font-weight: 600; }
.steps .who { font-size: 12.5px; color: var(--muted); }
.steps .dd { text-align: right; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.steps .dd b { display: block; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }

.hist { list-style: none; margin: 0; padding: 0; }
.hist li { padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.hist li:last-child { border-bottom: 0; }
.hist .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hist .meta b { color: var(--ink-3); }
.hist .txt { font-size: 14.5px; margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.hist li.coment .txt { background: var(--surface-2); border: 1px solid var(--line-2); padding: 8px 10px; border-radius: 9px; }
.files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 7px; }
.file {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; background: #fff; border: 1px solid var(--line); border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--ink-3); max-width: 100%; text-decoration: none;
}
.file:hover { border-color: #c9c5b9; text-decoration: none; }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px; }
.file .x { border: 0; background: none; padding: 0 0 0 2px; cursor: pointer; color: var(--faint); display: grid; }
.thumb { width: 64px; height: 64px; border-radius: 9px; object-fit: cover; border: 1px solid var(--line); background: #eee; }

.pago { border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 12px; }
.pago + .pago { margin-top: 8px; }
.pago .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pago .m { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; font-size: 13.5px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin-top: 6px; overflow-wrap: anywhere; }

/* ---------- Modal y hojas ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 60; background: rgba(15, 20, 28, .5);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out;
}
.modal {
  background: var(--surface); width: 100%; max-height: calc(100vh - 24px - var(--safe-t)); display: flex; flex-direction: column;
  border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg); animation: up .18s ease-out; padding-bottom: var(--safe-b);
}
.modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line-2); }
.modal-h h2 { font-size: 17px; font-weight: 750; }
.modal-h .sub { font-size: 13px; color: var(--muted); }
.modal-h .icon-btn { margin-left: auto; margin-right: -8px; color: var(--muted); }
.modal-b { padding: 14px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-f { padding: 12px 16px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-f .btn { min-width: 110px; }
@media (min-width: 700px) {
  .modal-back { align-items: center; padding: 24px; }
  .modal { max-width: 560px; border-radius: 16px; max-height: calc(100vh - 48px); padding-bottom: 0; }
  .modal.wide { max-width: 760px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }

.toasts { position: fixed; left: 0; right: 0; bottom: calc(84px + var(--safe-b)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); max-width: 520px; pointer-events: auto; animation: up .18s ease-out; }
.toast.err { background: var(--bad); }
.toast.ok { background: var(--ok); }

.banner { display: flex; gap: 12px; align-items: center; padding: 11px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-2); font-size: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.banner.warn { background: var(--warn-soft); color: #5e4000; }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner .t { flex: 1; min-width: 200px; }
.banner b { font-weight: 700; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty svg { color: #b9bcc2; margin-bottom: 8px; }
.empty h3 { font-size: 16px; color: var(--ink-3); margin-bottom: 4px; }
.loading { display: flex; justify-content: center; padding: 40px; color: var(--faint); }
.spin { width: 22px; height: 22px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- Nuevo pedido ---------- */
.obra-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .obra-grid { grid-template-columns: repeat(3, 1fr); } }
.obra-btn {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 76px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; text-align: left;
}
.obra-btn:hover { border-color: var(--accent); }
.obra-btn b { font-size: 16px; font-weight: 800; letter-spacing: .03em; }
.obra-btn span { font-size: 12.5px; color: var(--muted); }
.obra-btn.mine b::after { content: " ·"; color: var(--accent); }
.item-row { display: grid; grid-template-columns: 1fr 86px 84px 36px; gap: 6px; align-items: start; }
.item-row + .item-row { margin-top: 6px; }
.item-row .input { font-size: 15.5px; }
@media (max-width: 560px) {
  .item-row { grid-template-columns: 1fr 1fr 36px; }
  .item-row .desc { grid-column: 1 / -1; }
}
.item-h { display: grid; grid-template-columns: 1fr 86px 84px 36px; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
@media (max-width: 560px) { .item-h { display: none; } }
.del { width: 36px; height: 42px; border: 0; background: none; cursor: pointer; color: var(--faint); display: grid; place-items: center; border-radius: 8px; }
.del:hover { background: #eee; color: var(--bad); }

/* ---------- Proceso ---------- */
.flow { display: grid; gap: 14px; }
@media (min-width: 1000px) { .flow { grid-template-columns: repeat(3, 1fr); align-items: start; } }
.etapa { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.etapa-h { background: var(--ink); color: #fff; padding: 10px 14px; display: flex; align-items: baseline; gap: 8px; }
.etapa-h b { font-size: 12px; letter-spacing: .1em; color: #aeb8c8; }
.etapa-h span { font-weight: 750; font-size: 15px; }
.etapa-b { padding: 12px; }
.fstep { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.fstep .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fstep .k { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 11.5px; font-weight: 800; flex: none; }
.fstep .nm { font-weight: 700; font-size: 14.5px; }
.fstep .tx { font-size: 13px; color: var(--muted); margin-top: 5px; }
.fstep .av { font-size: 12px; color: var(--ink-3); margin-top: 6px; display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.fdec { border: 1.5px dashed #b9b5a8; border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.fdec .q { font-weight: 750; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.fdec .br { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; font-size: 12.5px; }
.fdec .br div { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.fdec .br b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.floop { border: 1px dashed #c7c3b6; border-radius: 10px; padding: 8px 10px; font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; background: #fcfbf8; }
.floop svg { flex: none; margin-top: 1px; color: var(--faint); }
.farrow { display: grid; place-items: center; height: 22px; color: #b3afa2; }
.pf-tbl td:first-child { white-space: nowrap; }
.pf-tbl ul { margin: 0; padding-left: 16px; }
.pf-tbl li + li { margin-top: 2px; }

/* ---------- Barras de tiempos ---------- */
.bar { height: 8px; background: #ecebe5; border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--ink); }
.login { width: 100%; max-width: 390px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 26px 22px 22px; }
.login .mark { font-weight: 850; font-size: 24px; letter-spacing: .03em; display: flex; align-items: baseline; gap: 8px; }
.login .mark span { font-size: 13px; font-weight: 750; background: var(--ink); color: #fff; padding: 2px 8px; border-radius: 999px; letter-spacing: .04em; }
.login .sub { color: var(--muted); font-size: 14px; margin: 4px 0 20px; }
.login .foot { text-align: center; font-size: 12px; color: var(--faint); margin-top: 18px; }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 44px; }
.pass-wrap button { position: absolute; right: 2px; top: 1px; width: 40px; height: 40px; border: 0; background: none; cursor: pointer; color: var(--faint); display: grid; place-items: center; }

/* ---------- Menú "Más" y notificaciones ---------- */
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-list a, .menu-list button {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); color: var(--text); font-weight: 600;
  width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; cursor: pointer; text-decoration: none; font-size: 15px;
}
.menu-list li:last-child a, .menu-list li:last-child button { border-bottom: 0; }
.menu-list .chev { margin-left: auto; color: var(--faint); }
.notif { display: flex; gap: 10px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line-2); cursor: pointer; width: 100%; background: none; text-align: left; }
.notif:hover { background: var(--surface-2); }
.notif .d { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }
.notif.leida .d { background: transparent; }
.notif.leida .t { color: var(--muted); }
.notif .t { font-size: 14px; }
.notif .w { font-size: 12px; color: var(--faint); margin-top: 2px; }

.wa-prev { white-space: pre-wrap; font-size: 14px; background: #eef6ef; border: 1px solid #d5e7d8; border-radius: 10px; padding: 10px 12px; font-family: var(--font); }
.cred { font-family: var(--mono); font-size: 17px; font-weight: 700; background: var(--surface-2); border: 1px dashed #c9c5b9; border-radius: 9px; padding: 10px 12px; text-align: center; letter-spacing: .02em; }
.version { border-left: 0; }
.version h3 { font-size: 16px; }
.version ul { margin: 8px 0 0; padding-left: 18px; }
.version li + li { margin-top: 3px; }
