:root {
  --bg: #ffffff; --ink: #0d0d0d; --muted: #5f5f5f; --line: #e3e3e3; --soft: #f5f5f5;
  --red: #d7141a; --red-dark: #a80e13; --black: #0d0d0d; --ok: #137a3a; --warn: #9a6200;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--soft); }
a { color: var(--red-dark); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 750; }
h3 { font-size: 1.05rem; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 40px; }
main.wide { max-width: 1200px; }
.muted { color: var(--muted); } .small { font-size: .875rem; }
.center { text-align: center; }

/* Barra superior */
.topbar { background: var(--black); color: #fff; border-bottom: 4px solid var(--red); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; letter-spacing: .02em; }
.brand img { height: 40px; width: auto; background: #fff; border-radius: 6px; padding: 2px; }
.brand small { font-weight: 500; opacity: .75; }
.topnav { display: flex; gap: 14px; align-items: center; }
.topnav a, .topnav .linklike { color: #fff; text-decoration: none; font-weight: 600; font-size: .95rem; }
.topnav .linklike { padding: 0; }
@media (max-width: 520px) { .hide-sm { display: none; } .brand span small { display: none; } }

.footer { background: var(--black); color: #cfcfcf; font-size: .875rem; padding: 24px 0; line-height: 1.8; }
.footer a { color: #fff; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 10px; border: 2px solid var(--red); background: var(--red); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; transition: background .15s; }
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.ghost { background: #fff; color: var(--black); border-color: var(--black); }
.btn.ghost:hover { background: var(--black); color: #fff; }
.btn-lg { min-height: 56px; font-size: 1.1rem; padding: 0 28px; }
.linklike { background: none; border: 0; color: var(--red-dark); text-decoration: underline; font: inherit; cursor: pointer; padding: 0; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; }
form.inline { display: inline; }

/* Tarjetas */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; box-shadow: var(--shadow); }
.card.soft { background: #fafafa; box-shadow: none; }
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.alert-card { border: 2px solid var(--red); }

/* Inicio */
.hero { background: var(--black); color: #fff; border-radius: var(--radius); padding: 36px 22px; margin-bottom: 18px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; bottom: -60px; width: 200px; height: 200px; border: 18px solid var(--red); border-radius: 50%; opacity: .9; }
.hero h1 { color: #fff; max-width: 14ch; position: relative; z-index: 1; }
.hero .lead { font-size: 1.1rem; max-width: 34ch; color: #e6e6e6; position: relative; z-index: 1; }
.hero .muted { color: #bdbdbd; position: relative; z-index: 1; } .hero .muted a { color: #fff; }
.hero .btn { position: relative; z-index: 1; margin: 8px 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--red); margin: 0 0 8px; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.step-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.step-card span { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 800; margin-bottom: 6px; }
.step-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.notices { padding-left: 20px; margin: 0; } .notices li { margin: 6px 0; }

/* Formularios */
label { display: block; font-weight: 600; margin: 0 0 14px; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 16px; padding: 12px; border: 1.5px solid #c9c9c9; border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(215,20,26,.25); border-color: var(--red); }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--red); }
input[type=file] { padding: 10px; background: var(--soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }
.hint { font-size: .875rem; color: var(--muted); margin: -8px 0 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.stack > * { margin-bottom: 12px; }
.boxed { border: 1px dashed #c9c9c9; border-radius: 10px; padding: 14px; margin-top: 14px; }
.field-title { font-weight: 600; margin: 4px 0 8px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: 1.4rem; font-weight: 800; margin-bottom: 6px; padding: 0; }
.choices { display: grid; gap: 10px; margin-bottom: 14px; }
.choices.three { grid-template-columns: repeat(3, 1fr); }
.choice { display: flex; gap: 12px; align-items: center; border: 2px solid var(--line); border-radius: 10px; padding: 14px; margin: 0; cursor: pointer; background: #fff; }
.choice:has(input:checked) { border-color: var(--red); background: #fff5f5; }
.choice small { display: block; color: var(--muted); font-weight: 400; }
.inline-form { display: flex; gap: 10px; } .inline-form select { margin: 0; }

/* Asistente por pasos */
.wizard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.progress { height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.progress-bar { height: 100%; width: 0; background: var(--red); transition: width .25s; }
.js .step { display: none; } .js .step.active { display: block; }
.no-js-hide, .wizard-nav [data-prev], .wizard-nav [data-next] { display: none; }
.js .wizard-nav [data-prev], .js .wizard-nav [data-next] { display: inline-flex; }
.js .wizard-nav [data-submit] { display: none; }
.js .wizard.last .wizard-nav [data-submit] { display: inline-flex; }
.js .wizard.last .wizard-nav [data-next] { display: none; }
.js .wizard.first .wizard-nav [data-prev] { visibility: hidden; }
.wizard-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; position: sticky; bottom: 0; background: #fff; padding: 12px 0 4px; border-top: 1px solid var(--line); }
.wizard-nav .btn { flex: 1; }
.step:not(.active) { margin-bottom: 28px; }
.form-error { background: #fff0f0; border: 1px solid var(--red); color: var(--red-dark); padding: 12px; border-radius: 10px; margin-top: 12px; font-weight: 600; }
.tips { background: #fafafa; border-left: 4px solid var(--red); padding: 12px; border-radius: 6px; margin-bottom: 14px; font-size: .95rem; }

/* Fotos guiadas */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.photo-slot { position: relative; border: 2px dashed #bdbdbd; border-radius: var(--radius); padding: 12px; margin: 0; cursor: pointer; background: #fff; font-weight: 400; display: flex; flex-direction: column; gap: 8px; }
.photo-slot:hover { border-color: var(--black); }
.photo-slot.filled { border-style: solid; border-color: var(--ok); background: #f4fbf6; }
.photo-slot.missing { border-color: var(--red); background: #fff5f5; }
.photo-slot input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.ill-wrap { background: var(--soft); border-radius: 8px; color: var(--black); display: grid; place-items: center; padding: 8px; }
.ill { width: 100%; max-width: 170px; height: auto; }
.slot-text { display: flex; flex-direction: column; font-size: .9rem; color: var(--muted); }
.slot-text strong { color: var(--ink); font-size: 1rem; }
.req { font-style: normal; font-size: .72rem; background: var(--red); color: #fff; border-radius: 4px; padding: 1px 6px; vertical-align: middle; }
.slot-status { color: var(--ok); font-weight: 700; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; } .thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }
.upload-progress { margin-top: 14px; } .upload-progress .bar { height: 10px; background: var(--soft); border-radius: 5px; overflow: hidden; }
.upload-progress .bar span { display: block; height: 100%; width: 0; background: var(--red); transition: width .2s; }
.review dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0 0 12px; } .review dt { color: var(--muted); }

/* Expediente */
.case-head { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.case-head p { margin: 0 0 6px; }
.case-number { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 800; letter-spacing: .04em; font-size: 1.6rem; }
.status-box { margin: 10px 0 14px; } .status-box p { color: var(--muted); }
.tracker { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; font-size: .72rem; text-align: center; color: var(--muted); }
.tracker li span { display: block; height: 6px; border-radius: 3px; background: var(--line); margin-bottom: 4px; }
.tracker li.done { color: var(--ink); font-weight: 700; } .tracker li.done span { background: var(--red); }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); margin: 2px 4px 2px 0; }
.badge.demo, .badge.test { background: #fff3cd; border-color: #e0b84a; color: #6b4b00; }
.badge.ok { background: #e7f6ec; border-color: #9fd3b0; color: var(--ok); }
.badge.warn { background: #fff0f0; border-color: #f2a5a7; color: var(--red-dark); }
.badge[class*="status-estimado_publicado"], .badge[class*="status-info_solicitada"] { background: var(--red); color: #fff; border-color: var(--red); }
.badge[class*="status-deposito_pagado"], .badge[class*="status-cita_confirmada"], .badge[class*="status-completado"] { background: #e7f6ec; color: var(--ok); border-color: #9fd3b0; }
.amounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.amounts div { background: var(--soft); border-radius: 10px; padding: 12px; } .amounts dt { color: var(--muted); font-size: .85rem; } .amounts dd { margin: 0; font-size: 1.5rem; font-weight: 800; }
.amounts.big dd { font-size: 2.2rem; color: var(--black); }
.quote { background: var(--soft); border-left: 4px solid var(--black); padding: 10px 12px; border-radius: 6px; white-space: pre-line; }
.ok-box { background: #e7f6ec; border: 1px solid #9fd3b0; color: #0d4f26; padding: 12px; border-radius: 10px; margin: 10px 0; }
.accept-form { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.older summary { cursor: pointer; font-weight: 600; margin-top: 10px; }
.terms { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 14px; max-height: 260px; overflow: auto; margin-bottom: 14px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.gallery a { display: block; text-decoration: none; color: var(--muted); font-size: .78rem; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; background: var(--soft); border: 1px solid var(--line); }
.plain { list-style: none; padding: 0; } .plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.callout { background: #fff8e6; border: 1px solid #e0b84a; border-radius: 10px; padding: 14px; margin: 14px 0; text-align: left; }
.copy-field { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; margin: 10px 0; }
.big-check { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 2rem; display: grid; place-items: center; margin: 0 auto 10px; }

/* Avisos */
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.flash-ok { background: #e7f6ec; border: 1px solid #9fd3b0; color: #0d4f26; }
.flash-error { background: #fff0f0; border: 1px solid #f2a5a7; color: var(--red-dark); }
.flash-info { background: #eef4ff; border: 1px solid #a9c1f0; color: #1f3d7a; }
.mode-banner { text-align: center; font-weight: 800; font-size: .85rem; letter-spacing: .04em; padding: 8px 12px; }
.mode-banner.demo { background: #ffd84d; color: #000; } .mode-banner.test { background: #ffe9a8; color: #000; }

/* Panel */
.is-admin { background: #f0f0f0; }
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.admin-head h1 { display: inline; margin-right: 10px; }
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 960px) { .admin-grid { grid-template-columns: 1fr 1fr; } }
.integrations { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 16px; }
.integrations div { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.integrations small { display: block; color: var(--muted); margin-top: 4px; }
.pill { display: inline-block; font-size: .75rem; font-weight: 800; border-radius: 999px; padding: 2px 8px; margin-left: 4px; }
.pill.on { background: var(--ok); color: #fff; } .pill.off { background: #444; color: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; } .filters input { flex: 2 1 240px; margin: 0; } .filters select { flex: 1 1 180px; margin: 0; }
.case-list { display: grid; gap: 8px; }
.case-row { display: grid; grid-template-columns: 1fr; gap: 6px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--black); border-radius: 10px; padding: 12px 14px; color: var(--ink); text-decoration: none; }
.case-row:hover { border-left-color: var(--red); }
@media (min-width: 760px) { .case-row { grid-template-columns: 1.2fr 1.2fr 1fr; align-items: center; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 10px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; margin-bottom: 8px; } .tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.req { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; } .req p { margin: 4px 0; }
.req.abierta, .req.solicitada { border-color: var(--red); }
.timeline { list-style: none; padding: 0; margin: 0; } .timeline li { border-left: 3px solid var(--line); padding: 4px 0 10px 12px; }
.timeline li.actor-cliente { border-left-color: var(--red); } .timeline li.actor-sistema { border-left-color: #999; }
code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: .85em; word-break: break-all; }
.prose p { margin: 0 0 12px; }
.is-admin .wrap { max-width: 1200px; }
