:root {
  --bg: #f4f6fa; --card: #fff; --ink: #1c2434; --muted: #6b7689; --line: #e3e7ee;
  --brand: #0f766e; --brand-dark: #0b5a54; --accent: #f97316; --danger: #dc2626; --ok: #16a34a;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 "Segoe UI", system-ui, sans-serif; color: var(--ink); background: var(--bg); }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 12px; }
a { color: var(--brand); }
[hidden] { display: none !important; }

/* layout */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #12202f; color: #cbd5e1; padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
.side .logo { color: #fff; font-size: 19px; font-weight: 700; padding: 4px 10px 16px; }
.side .logo span { color: var(--accent); }
.side a { color: inherit; text-decoration: none; padding: 9px 10px; border-radius: 8px; display: flex; gap: 10px; align-items: center; }
.side a:hover { background: #1d3044; }
.side a.on { background: var(--brand); color: #fff; }
.side .who { margin-top: auto; padding: 10px; font-size: 12px; border-top: 1px solid #263a50; }
.side .who b { display: block; color: #fff; font-size: 13px; }
.side .who button { margin-top: 8px; width: 100%; }
main { padding: 24px 28px 60px; min-width: 0; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head .sp { flex: 1; }

/* pieces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .val { font-size: 24px; font-weight: 700; margin-top: 2px; }
.kpi .sub { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.neg { color: var(--danger); }
.pos { color: var(--ok); }
.mt { margin-top: 14px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 12px; border-radius: 8px; cursor: pointer; }
button:hover { border-color: #b9c2d0; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--brand-dark); }
button.danger { color: var(--danger); }
button.sm { padding: 3px 8px; font-size: 12px; }
button.ghost { background: transparent; border-color: transparent; color: inherit; }
.side button.ghost { border-color: #33495f; }

input, select, textarea { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid #cfd6e0; border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #99d5cf; border-color: var(--brand); }
input[type=checkbox] { width: auto; }
label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; }
label.check { display: flex; align-items: center; gap: 6px; padding-top: 22px; }
label.check > input { margin: 0; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form.c6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.form .full { grid-column: 1 / -1; }
.form .s2 { grid-column: span 2; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f8fafc; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.acts { white-space: nowrap; text-align: right; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; background: #eef1f5; color: #475569; }
.tag.warn { background: #fef3c7; color: #92400e; }
.tag.bad { background: #fee2e2; color: #991b1b; }
.tag.good { background: #dcfce7; color: #166534; }
.bar { height: 8px; background: #e8ecf2; border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.statusrow { display: flex; gap: 6px; flex-wrap: wrap; }
.statusrow button { border-radius: 99px; font-size: 12px; padding: 4px 11px; }
.statusrow button.on { color: #fff; border-color: transparent; font-weight: 600; }

/* breakdown rows */
.brk { display: grid; grid-template-columns: 150px 1fr 90px; gap: 10px; align-items: center; padding: 5px 0; }
.brk .n { text-align: right; font-variant-numeric: tabular-nums; }
.brk.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 9px; font-weight: 700; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: center; justify-content: center; padding: 16px 12px; z-index: 20; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 900px; }
.modal header { display: flex; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal header h2 { margin: 0; flex: 1; font-size: 17px; }
.modal .mbody { padding: 18px 20px; overflow-y: auto; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.section { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 20px 0 8px; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fafbfd; }
.item .line { font-size: 12px; color: var(--muted); margin-top: 8px; }
.summary { background: #f0fdfa; border: 1px solid #99d5cf; border-radius: 10px; padding: 12px 14px; }
.summary .row { display: flex; justify-content: space-between; padding: 2px 0; }
.summary .row.big { font-size: 17px; font-weight: 700; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal .dow { background: #f8fafc; padding: 6px 8px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.cal .day { background: #fff; min-height: 104px; padding: 5px; }
.cal .day.out { background: #f8fafc; }
.cal .day.today .dn { background: var(--brand); color: #fff; }
.cal .dn { display: inline-block; min-width: 22px; text-align: center; border-radius: 99px; font-size: 12px; font-weight: 600; padding: 1px 5px; }
.cal .ev { display: block; width: 100%; text-align: left; border: 0; color: #fff; border-radius: 5px; padding: 2px 6px; margin-top: 3px; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #12202f, #0f766e); }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login h1 { margin-bottom: 4px; }
.login form { display: grid; gap: 12px; margin-top: 18px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #12202f; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 50; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.toast.err { background: var(--danger); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; align-items: center; }
  .side .logo { padding: 0 10px; }
  .side a { white-space: nowrap; }
  .side .who { margin: 0; border: 0; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
  .side .who button { margin: 0; width: auto; }
  main { padding: 16px 14px 50px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr 1fr; }
  .form, .form.c3, .form.c4, .form.c6 { grid-template-columns: 1fr 1fr; }
  .cal .day { min-height: 70px; }
}
@media (max-width: 560px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .brk { grid-template-columns: 110px 1fr 80px; }
}

details > summary { cursor: pointer; font-size: 12px; color: var(--brand); font-weight: 600; margin: 8px 0 6px; }
label .tag { font-weight: 600; margin-left: 4px; }

/* ---- mejoras de experiencia ---- */
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mt8 { margin-top: 8px; }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
main > .section { margin: 22px 0 8px; }

.side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 14px 10px 4px; }
.side a em { margin-left: auto; background: var(--accent); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }

.modal { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal footer { align-items: center; background: #fafbfd; border-radius: 0 0 14px 14px; }
.modal footer .fleft { flex: 1; min-width: 0; }
#osum { display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; }
#osum .big { font-size: 18px; }

.step { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; margin: 22px 0 10px; }
.step:first-of-type { margin-top: 0; }
.step span { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 13px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border-radius: 99px; padding: 5px 13px; background: #fff; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.chip em { font-style: normal; opacity: .7; margin-left: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; border-radius: 0; }
.seg button.on { background: var(--ink); color: #fff; }
button.next { border-color: var(--brand); color: var(--brand); font-weight: 600; white-space: nowrap; }
button.next:hover { background: var(--brand); color: #fff; }

.irow { display: grid; grid-template-columns: minmax(0, 1fr) 100px 130px 110px 36px; gap: 10px; align-items: end; }
.irow .isub { padding-bottom: 8px; text-align: right; }
.irow .isub span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.imeta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.imeta .line { margin: 0; flex: 1; font-size: 13px; }
.imeta label.check { padding: 0; font-size: 13px; color: var(--ink); font-weight: 400; }
.item .line:empty { display: none; }
details > summary { font-size: 13px; margin: 10px 0 8px; }

.stepper { display: flex; gap: 4px; flex-wrap: wrap; }
.stepper button { flex: 1; display: flex; align-items: center; gap: 6px; justify-content: center; border-radius: 8px; padding: 8px 6px; color: var(--muted); white-space: nowrap; }
.stepper button i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; background: #e3e7ee; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.stepper .done { color: var(--brand); border-color: #99d5cf; background: #f0fdfa; }
.stepper .done i { background: var(--brand); color: #fff; }
.stepper .cur { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.stepper .cur i { background: #fff; color: var(--brand); }
.nextbar { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.nextbar .sp { flex: 1; }
.nextbar .primary { padding: 9px 18px; font-size: 15px; }
.notice { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.notice.good { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.notice.bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.board { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: #e9edf3; border-radius: 10px; padding: 8px; display: grid; gap: 8px; }
.colh { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; padding: 2px 4px; }
.colh i { width: 9px; height: 9px; border-radius: 50%; }
.colh em { margin-left: auto; font-style: normal; color: var(--muted); }
.colempty { color: var(--muted); font-size: 12px; text-align: center; padding: 14px 0; }
.kcard { background: #fff; border-radius: 8px; padding: 10px; cursor: pointer; display: grid; gap: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.kcard:hover { box-shadow: 0 3px 10px rgba(0, 0, 0, .14); }
.krow { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }

.tile { text-align: left; cursor: pointer; padding: 14px 16px; }
.tile:hover { border-color: var(--brand); }
.tile .val { font-size: 28px; font-weight: 700; color: var(--brand); line-height: 1.1; }
.tile.zero .val { color: #b6beca; }
.tile .lbl { color: var(--muted); font-weight: 600; }
.guide { border-color: #99d5cf; background: #f0fdfa; margin-bottom: 4px; }
.todo { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid #cdebe7; }
.todo > div { flex: 1; }
.todo i { font-style: normal; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--brand); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.todo.done i { background: var(--brand); color: #fff; }
.todo.done b { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.empty.big { padding: 48px 20px; display: grid; gap: 6px; justify-items: center; }
.empty.big .ico { font-size: 40px; }
.empty.big b { font-size: 17px; color: var(--ink); }

.cal .day { cursor: pointer; position: relative; }
.cal .day:hover { background: #f0fdfa; }
.cal .day .plus { position: absolute; top: 4px; right: 8px; color: var(--brand); font-weight: 700; opacity: 0; }
.cal .day:hover .plus { opacity: 1; }

@media (max-width: 900px) {
  .side .grp { display: none; }
  .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .irow { grid-template-columns: minmax(0, 1fr) 80px 110px 36px; }
  .irow .isub { display: none; }
  .stepper button { flex: 1 1 30%; }
}

/* filamentos multicolor */
.fils { grid-column: 1 / -1; }
.fillbl { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.filrow { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 110px 36px; gap: 8px; margin-bottom: 6px; }
@media (max-width: 560px) { .filrow { grid-template-columns: 1fr 1fr; } }

/* compras: distinguir cada ítem */
#prows { counter-reset: prow; }
.prow { counter-increment: prow; border-left: 4px solid var(--brand); }
.prow::before { content: "Ítem " counter(prow); display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); margin-bottom: 6px; }
.sdet { margin-top: 8px; }
.sdet:empty { display: none; }
.tag.cat { background: #ccfbf1; color: #0f5e57; font-weight: 600; }
.pitem + .pitem { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }

/* ---- compras: una tarjeta por compra ---- */
a.btn { text-decoration: none; display: inline-block; }
.sup { display: flex; align-items: center; gap: 10px; }
.sup b { display: block; }
.sico { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 8px; background: #eef1f5; font-size: 15px; }
.sico.dot { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #cfd6e0; }
.pcard { padding: 0; margin-bottom: 14px; overflow: hidden; }
.phead { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: #fafbfd; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pdate { width: 54px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 5px 0; flex: none; }
.pdate b { display: block; font-size: 19px; line-height: 1.1; }
.pdate span { font-size: 10.5px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.pinfo { flex: 1; min-width: 160px; }
.pinfo > b { font-size: 15px; }
.pacts { display: flex; align-items: center; gap: 4px; }
.ptotal { text-align: right; min-width: 110px; }
.ptotal span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.ptotal b { font-size: 19px; }
.pitems td { padding: 10px 18px; }
.pitems td.num { width: 1%; padding-left: 28px; }
.prow::before, .sdet .tag.cat { letter-spacing: 0; }

/* compras desplegables */
.btn.sm { padding: 3px 8px; font-size: 12px; }
summary.phead { cursor: pointer; list-style: none; border-bottom: 0; }
summary.phead::-webkit-details-marker { display: none; }
summary.phead:hover { background: #f1f5f9; }
details.pcard[open] > summary.phead { border-bottom: 1px solid var(--line); }
.chev { font-size: 22px; line-height: 1; color: var(--muted); transition: transform .15s; width: 14px; text-align: center; }
details[open] > summary .chev { transform: rotate(90deg); }
.pinfo { min-width: 0; }
.pprev { display: flex; align-items: center; margin: 3px 0 2px; min-width: 0; }
.pprev .sico { width: 18px; height: 18px; font-size: 11px; margin-right: -4px; border-radius: 50%; }
.pprev span { margin-left: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.pcard[open] .pprev { display: none; }
details.pcard > summary.phead { color: var(--ink); font-weight: 400; font-size: inherit; margin: 0; }
.pdate b { color: var(--ink); }

/* compra de filamentos en bloque */
.fblock { border-left: 4px solid var(--accent); background: #fffaf5; }
.fbhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.fbhead b { font-size: 15px; }
.fbhead .sp { flex: 1; }
.frow { display: grid; grid-template-columns: minmax(0, 1fr) 110px 130px 36px; gap: 8px; align-items: center; margin-bottom: 6px; }
.fbcols { margin: 14px 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.fcolor { display: flex; align-items: center; gap: 8px; }
.frhint { grid-column: 1 / -1; font-size: 12px; margin: -2px 0 2px 38px; }
.frhint:empty { display: none; }
#fblocks:empty + #prows:empty + .chips { margin-top: 0; }
#prows:not(:empty) { margin-top: 4px; }
.prow::before { content: "Otro insumo"; }

/* filamentos: renglón compacto con tono elegible */
.frow { grid-template-columns: 30px minmax(0, 1fr) auto 100px 120px 36px; }
.fbcols { margin: 14px 0 4px; }
.sico.pick { cursor: pointer; position: relative; overflow: hidden; }
.sico.pick:hover { box-shadow: 0 0 0 2px var(--accent); }
.sico.pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.frtag { white-space: nowrap; }
.fbfoot { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; font-size: 12px; }
.fbfoot .sp { flex: 1; }
.fbfoot .fbsum { font-size: 14px; }
input[type=color].hexpick { height: 38px; padding: 3px; cursor: pointer; }
@media (max-width: 700px) { .frow { grid-template-columns: 30px minmax(0, 1fr) 70px 90px 30px; } .frtag, .fbcols span:nth-child(3) { display: none; } }

/* historial de stock agrupado */
details.hist > summary { display: flex; align-items: baseline; gap: 12px; cursor: pointer; list-style: none; color: var(--ink); font-weight: 400; font-size: inherit; margin: 0; }
details.hist > summary::-webkit-details-marker, .hgroup > summary::-webkit-details-marker { display: none; }
details.hist > summary h2 { margin: 0; }
details.hist[open] > summary { margin-bottom: 10px; }
.hgroup { border-top: 1px solid #eef1f5; }
.hgroup > summary { display: flex; align-items: center; gap: 12px; padding: 10px 4px; cursor: pointer; list-style: none; color: var(--ink); font-weight: 400; font-size: inherit; margin: 0; flex-wrap: wrap; }
.hgroup > summary:hover { background: #f8fafc; }
.hgroup > summary .sp { flex: 1; }
.hgroup table { margin: 0 0 10px 30px; width: calc(100% - 30px); }
.hgroup td { padding: 5px 10px; color: #475569; }

.sup { min-width: 190px; }

/* pestañas */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; background: transparent; padding: 10px 16px; margin-bottom: -2px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs button:hover { background: #e9edf3; color: var(--ink); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); background: #fff; }
.tabs em { font-style: normal; font-weight: 400; background: #e3e7ee; color: #475569; border-radius: 99px; padding: 1px 8px; font-size: 12px; margin-left: 4px; }
.tabs i { font-style: normal; background: var(--danger); color: #fff; border-radius: 99px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }
.tabbody { border-top-left-radius: 0; border-top: 0; }
tfoot td { color: var(--muted); font-weight: 600; }

.tag { white-space: nowrap; }

/* buscador de filamentos */
.filrow { grid-template-columns: minmax(0, 1fr) 110px 36px; align-items: center; }
.fpick { position: relative; display: flex; align-items: center; gap: 8px; }
.fmenu { position: absolute; top: calc(100% + 4px); left: 36px; right: 0; z-index: 15; background: #fff; border: 1px solid #cfd6e0; border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .18); padding: 4px; max-height: 320px; overflow-y: auto; }
.fopt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; border-radius: 7px; padding: 7px 8px; background: transparent; }
.fopt:hover, .fopt.hi { background: #f0fdfa; }
.fopt > span:nth-child(2) { flex: 1; min-width: 0; }
.fopt b, .fopt small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fopt small { color: var(--muted); font-size: 12px; }
.fopt.add { color: var(--brand); font-weight: 600; border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; margin-top: 4px; padding-top: 9px; }
.fnote { padding: 8px 10px; color: var(--muted); font-size: 12px; }
@media (max-width: 560px) { .filrow { grid-template-columns: minmax(0, 1fr) 80px 30px; } }

/* tiempo en horas y minutos */
.tpick { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.tpick input { min-width: 0; }
.tpick span { color: var(--muted); font-weight: 400; font-size: 13px; }

/* empaque elegido de las compras */
.packs { grid-column: 1 / -1; }
.packrow .sico { background: #fff3e6; }

details.more > summary { margin: 12px 0 8px; }

/* jerarquía: el título de cada bloque pesa más que los nombres de sus filas */
h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.card > .head h2, details.hist > summary h2 { font-size: 18px; }
td b, .sup b, .pinfo > b, .kcard b, .hgroup b, .fopt b { font-weight: 600; }
td { font-size: 14px; }
.modal h2 { font-size: 17px; }

/* ---- repaso general de experiencia ---- */
.side { overflow-y: auto; }
.board { grid-template-columns: repeat(6, minmax(150px, 1fr)); }
tr:hover > td { background: #fafbfd; }
.hgroup tr:hover > td, .pitems tr:hover > td { background: transparent; }
.tabpage { padding-top: 16px; }
.flow { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; }
.flow > i { font-style: normal; font-size: 26px; font-weight: 700; color: var(--muted); align-self: center; }
.fstep { flex: 1; min-width: 180px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.fstep span { display: block; color: var(--muted); font-weight: 600; font-size: 13px; }
.fstep b { display: block; font-size: 28px; line-height: 1.2; margin: 2px 0; }
.fstep small { color: var(--muted); }
.fstep.win { background: #f0fdfa; border-color: #99d5cf; }
.fstep.win b { color: var(--brand); }
.fstep.win b.neg { color: var(--danger); }
.who2 { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid #eef1f5; }
.who2:first-of-type { border-top: 0; }
.who2 span { font-weight: 600; }
.who2 small { margin-left: 8px; color: var(--muted); font-weight: 400; }
.who2 b { font-size: 20px; }
.tile .lbl { font-size: 13px; }

/* canje / publicidad */
.tag.gift { background: #fae8ff; color: #86198f; font-weight: 600; }
.notice.gift { background: #fdf4ff; border-color: #f0abfc; color: #701a75; }
label.giftbox { margin-top: 18px; padding: 10px 12px; border: 1px dashed #e9a8f5; border-radius: 10px; background: #fdf4ff; color: var(--ink); font-size: 14px; font-weight: 400; cursor: pointer; }
label.giftbox input { margin-right: 4px; }

/* envío por Shalom */
.pinbox { display: flex; gap: 6px; margin-top: 4px; }
.pinbox input { letter-spacing: .25em; font-weight: 700; font-size: 16px; text-align: center; min-width: 0; }
.pinbox button { white-space: nowrap; font-weight: 400; color: var(--ink); }
details.shal { border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; background: #fafbfd; }
details.shal > summary { color: var(--ink); font-size: 14px; font-weight: 600; margin: 0; padding: 12px 0; }
details.shal[open] { padding-bottom: 14px; }
.shbtns { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }

/* inspiración */
.igrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.icard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.iimg { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; border-radius: 0; background: #eef1f5; cursor: zoom-in; overflow: hidden; }
.iimg img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.iimg:hover img { transform: scale(1.04); }
.iimg.none { display: grid; place-items: center; font-size: 34px; cursor: default; }
.ibody { padding: 12px; display: grid; gap: 6px; flex: 1; align-content: start; }
.ibody .tag { justify-self: start; }
.inote { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.iacts { display: flex; align-items: center; gap: 2px; margin-top: 4px; font-size: 13px; }
.iacts .sp { flex: 1; }
.iprev { max-width: 100%; max-height: 240px; border-radius: 8px; display: block; }
.iprevs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.iprevs:empty { display: none; }
.iprevs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.modal-bg.zoom { cursor: zoom-out; background: rgba(15, 23, 42, .85); }
.modal-bg.zoom figure { margin: 0; text-align: center; }
.modal-bg.zoom img { max-width: 92vw; max-height: 84vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.modal-bg.zoom figcaption { color: #fff; margin-top: 10px; }

.ilink { font-size: 13px; justify-self: start; }
.iacts button { white-space: nowrap; }
.iacts .sp { order: 1; }
.iacts button:first-of-type { order: 0; margin-left: -8px; }
.iacts button:not(:first-of-type) { order: 2; }

/* sin X: cerrar es un botón con texto y quitar/eliminar es siempre un tachito */
.modal header [data-close] { color: var(--muted); font-size: 13px; border-color: var(--line); }
.modal header [data-close]:hover { color: var(--ink); }
