/* Sistema de diseño: móvil primero, alto contraste, botones grandes, foco visible.
   El color de marca llega como --brand desde la plantilla base (configurable). */
:root {
  --brand: #0f6d5c;
  --brand-ink: #ffffff;
  --brand-soft: #e3f2ee;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, white);
  /* Color de marca para texto y enlaces: se oscurece para que se lea aunque la marca sea clara. */
  --brand-text: var(--brand);
  --brand-text: color-mix(in srgb, var(--brand) 62%, black);
  --ink: #16212b;
  --ink-2: #44515d;
  --muted: #6b7783;
  --line: #d7dde3;
  --bg: #f5f7f9;
  --card: #ffffff;
  --ok: #156c2f;
  --ok-bg: #e5f4e9;
  --warn: #8a5a00;
  --warn-bg: #fff3d6;
  --bad: #a3231b;
  --bad-bg: #fde8e6;
  --info: #1d4f91;
  --info-bg: #e6eefa;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --focus: 0 0 0 3px #ffbf47;
  font-size: 17px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--brand-text); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: none; box-shadow: var(--focus); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.07rem; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .86rem; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 9; }
.skip:focus { left: .5rem; }

/* ---------- estructura */
.topbar { background: var(--card); color: var(--ink); border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; flex-wrap: wrap; }
.topbar a { color: var(--ink); text-decoration: none; }
.topbar .logo img { display: block; height: 32px; width: auto; }
.topbar .logo { color: var(--brand-text); font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; margin-right: auto; }
.topbar nav { display: flex; gap: .2rem; flex-wrap: wrap; }
.topbar nav a { padding: .4rem .65rem; border-radius: 8px; font-size: .95rem; }
.topbar nav a[aria-current="page"], .topbar nav a:hover { background: var(--brand-soft); color: var(--brand-text); }
.topbar form { margin: 0; }
.topbar .linkbtn { background: none; border: 0; color: var(--ink); font: inherit; cursor: pointer; padding: .4rem .65rem; }
main { max-width: 1100px; margin: 0 auto; padding: 1rem 1rem 4rem; }
main.narrow { max-width: 620px; }
.footer { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; color: var(--muted); font-size: .86rem; }
.footer a { color: var(--muted); }

/* ---------- utilidades de layout */
.stack > * + * { margin-top: .9rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.spacer { flex: 1; }
.hide { display: none !important; }
@media (max-width: 640px) { .hide-sm { display: none !important; } }

/* ---------- tarjetas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.card h2, .card h3 { margin-top: 0; }
.card.flat { box-shadow: none; }
.card.accent { border-left: 5px solid var(--brand); }
.card.warn { border-left: 5px solid #e3a008; }
.card.bad { border-left: 5px solid var(--bad); }
.card .meta { color: var(--muted); font-size: .88rem; }
.hero { background: linear-gradient(135deg, var(--brand), #0b4f43);
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, black));
  background: var(--brand-dark, linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, black))); color: #fff; border-radius: 0 0 22px 22px; }
.hero .in { max-width: 1100px; margin: 0 auto; padding: 2.2rem 1rem 2.6rem; }
.hero h1 { font-size: 2rem; }
.hero p { font-size: 1.1rem; max-width: 38rem; opacity: .95; }

/* ---------- botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .6rem 1.15rem;
  border-radius: 10px; border: 2px solid var(--brand); background: var(--brand); color: var(--brand-ink); font: inherit;
  font-weight: 650; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn.secondary { background: #fff; color: var(--brand-text); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand-text); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { min-height: 38px; padding: .35rem .8rem; font-size: .92rem; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.hero .btn { background: #fff; color: var(--brand-text); border-color: #fff; }
/* Con portada oscura propia (BRAND_DARK_COLOR), el botón principal va en el color de marca. */
.hero-dark .hero .btn:not(.secondary) { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.hero .btn.secondary { background: transparent; color: #fff; }

/* ---------- formularios */
.field { display: block; margin-bottom: 1rem; }
.field > label, .label { display: block; font-weight: 650; margin-bottom: .3rem; }
.field .hint { color: var(--muted); font-size: .88rem; margin: .15rem 0 .35rem; }
input:not([type]), input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=datetime-local], input[type=search], input[type=url], select, textarea {
  width: 100%; min-height: 48px; padding: .6rem .75rem; border: 2px solid var(--line); border-radius: 10px; background: #fff;
  font: inherit; color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
input[aria-invalid=true] { border-color: var(--bad); }
.check { display: flex; gap: .65rem; align-items: flex-start; padding: .55rem 0; }
.check input { width: 24px; height: 24px; margin-top: .1rem; flex: none; accent-color: var(--brand); }
.choices { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; border: 2px solid var(--line); border-radius: 10px; padding: .7rem .8rem; background: #fff; cursor: pointer; min-height: 48px; }
.choice input:checked + span { border-color: var(--brand); background: var(--brand-soft); font-weight: 650; }
.choice input:focus-visible + span { box-shadow: var(--focus); }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { font-weight: 650; margin-bottom: .4rem; padding: 0; }

/* ---------- avisos y etiquetas */
.alert { border-radius: 10px; padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid transparent; }
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: #b8dfc3; }
.alert.error, .alert.bad { background: var(--bad-bg); color: var(--bad); border-color: #f5c2bd; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: #f1d48b; }
.alert.info { background: var(--info-bg); color: var(--info); border-color: #bcd0ef; }
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 650; background: #eef1f4; color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand-text); }
.chip { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: .15rem .6rem; font-size: .85rem; margin: .1rem .15rem .1rem 0; background: #fff; }

/* ---------- tablas */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f0f3f6; font-weight: 650; font-size: .85rem; color: var(--ink-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- KPIs */
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.kpi .v { font-size: 1.6rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: .86rem; }
.kpi .s { font-size: .8rem; color: var(--muted); }

/* ---------- pasos del asistente */
.steps { display: flex; gap: .35rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.steps li { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.steps li.done { background: var(--brand); }
.steps li.now { background: #6fb8a8; }

/* ---------- listas */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 3px solid var(--line); }
.timeline li { position: relative; padding: 0 0 .9rem .6rem; }
.timeline li::before { content: ""; position: absolute; left: -1.45rem; top: .45rem; width: 11px; height: 11px; border-radius: 50%; background: var(--brand); }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--brand-text); border-color: var(--brand); font-weight: 650; }
.kanban { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban .col { min-width: 230px; flex: 1; background: #eef1f4; border-radius: var(--radius); padding: .6rem; }
.kanban .col h3 { font-size: .92rem; display: flex; justify-content: space-between; }
.kanban .item { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .65rem; margin-bottom: .5rem; font-size: .92rem; }
.score { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 30px; border-radius: 8px; font-weight: 750; background: var(--brand-soft); color: var(--brand-text); }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); }
details > summary { cursor: pointer; font-weight: 650; padding: .3rem 0; }
.qr { background: #fff; padding: .5rem; display: inline-block; border-radius: 10px; border: 1px solid var(--line); }
#map { height: 280px; border-radius: var(--radius); border: 1px solid var(--line); }
.loading[aria-busy=true]::after { content: " …"; }
@media print { .topbar, .footer, .no-print { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
