/* llega.sv · panel de administración */
:root {
  --brand: #5B21B6;
  --brand-600: #6D28D9;
  --brand-50: #F3EEFF;
  --brand-ink: #FFFFFF;
  --bg: #F6F5FA;
  --surface: #FFFFFF;
  --surface-2: #F9F8FC;
  --border: #E5E3EE;
  --text: #1F1B2D;
  --muted: #6B6880;
  --danger: #DC2626;
  --danger-bg: #FEE2E2;
  --warn: #B45309;
  --warn-bg: #FEF3C7;
  --ok: #047857;
  --ok-bg: #D1FAE5;
  --info: #1D4ED8;
  --info-bg: #DBEAFE;
  --neutral-bg: #EEEDF3;
  --shadow: 0 1px 2px rgba(20, 10, 50, .06), 0 4px 16px rgba(20, 10, 50, .05);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 236px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Gráficos (validados con dataviz/validate_palette: claro sobre blanco, oscuro sobre #1A2233) */
  --chart-1: #5B21B6; --chart-2: #0284C7; --chart-warn: #D97706;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #7C3AED; --brand-600: #8B5CF6; --brand-50: #2A1F4A; --brand-ink: #FFFFFF;
    --bg: #111827; --surface: #1A2233; --surface-2: #1F2937; --border: #2E3A4E;
    --text: #F3F4F6; --muted: #9CA3AF;
    --danger: #F87171; --danger-bg: #3B1219; --warn: #FBBF24; --warn-bg: #3A2A0A;
    --ok: #34D399; --ok-bg: #0B3326; --info: #93C5FD; --info-bg: #172554; --neutral-bg: #273244;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25);
    --chart-1: #8B5CF6; --chart-2: #0891B2; --chart-warn: #D97706;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #7C3AED; --brand-600: #8B5CF6; --brand-50: #2A1F4A; --brand-ink: #FFFFFF;
  --bg: #111827; --surface: #1A2233; --surface-2: #1F2937; --border: #2E3A4E;
  --text: #F3F4F6; --muted: #9CA3AF;
  --danger: #F87171; --danger-bg: #3B1219; --warn: #FBBF24; --warn-bg: #3A2A0A;
  --ok: #34D399; --ok-bg: #0B3326; --info: #93C5FD; --info-bg: #172554; --neutral-bg: #273244;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25);
  --chart-1: #8B5CF6; --chart-2: #0891B2; --chart-warn: #D97706;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.45;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 .6rem; }
code, .mono { font-family: var(--mono); font-size: .88em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.boot { padding: 3rem; text-align: center; color: var(--muted); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: #111827; color: #E5E7EB; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 1rem .75rem; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem 1rem; font-weight: 700; font-size: 1.1rem; color: #fff; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: #5B21B6; display: grid; place-items: center; font-weight: 800; }
.brand small { display: block; font-weight: 500; font-size: .72rem; color: #9CA3AF; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 8px;
  color: #D1D5DB; text-decoration: none; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: #5B21B6; color: #fff; }
.nav .ico { width: 1.2rem; text-align: center; opacity: .9; }
.nav .count { margin-left: auto; background: #DC2626; color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; font-weight: 700; }
.sidebar-foot { margin-top: auto; padding-top: 1rem; display: flex; flex-direction: column; gap: .4rem; font-size: .85rem; color: #9CA3AF; }
.sidebar-foot .btn { width: 100%; justify-content: center; }
.sidebar .btn.ghost { color: #E5E7EB; border-color: #374151; }
.sidebar .btn.ghost:hover { background: rgba(255,255,255,.06); }

.topbar { display: none; }
.scrim { display: none; }
.main { min-width: 0; padding: 1.5rem 2rem 3rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }
.backlink { display: inline-block; margin-bottom: .5rem; text-decoration: none; font-size: .9rem; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.4);
  }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
  .topbar {
    display: flex; align-items: center; gap: .6rem; position: sticky; top: 0; z-index: 30;
    background: #111827; color: #fff; padding: .6rem 1rem; padding-top: max(.6rem, env(safe-area-inset-top));
  }
  .topbar .title { font-weight: 700; flex: 1; }
  .topbar button { background: transparent; border: 0; color: #fff; font-size: 1.35rem; padding: .2rem .4rem; cursor: pointer; }
  .main { padding: 1rem 1rem 3rem; }
}

/* ---------- Cards, grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.card + .card { margin-top: 1rem; }
.card-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head .spacer { flex: 1; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 1rem; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
a.kpi:hover { border-color: var(--brand-600); }
.kpi .label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; margin-top: .15rem; }
.kpi .sub { font-size: .78rem; color: var(--muted); }
.kpi.warn { border-color: var(--warn); background: var(--warn-bg); }
.kpi.warn .value { color: var(--warn); }
.kpi.danger { border-color: var(--danger); background: var(--danger-bg); }
.kpi.danger .value { color: var(--danger); }
.kpi.ok .value { color: var(--ok); }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.5rem 0 .6rem; font-weight: 600; }

/* Alerts */
.alert { display: flex; gap: .75rem; align-items: flex-start; border-radius: var(--radius); padding: .85rem 1rem; border: 1px solid; margin-bottom: .75rem; }
.alert { flex-wrap: wrap; }
.alert .alert-body { flex: 1 1 220px; min-width: 0; }
.alert strong { display: block; }
.alert.danger { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.alert.danger.pulse { animation: pulse 1.6s ease-in-out infinite; }
.alert.warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.alert.info { background: var(--info-bg); border-color: var(--info); color: var(--info); }
.alert .btn { flex-shrink: 0; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.35); } 50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); } }
@media (prefers-reduced-motion: reduce) { .alert.danger.pulse { animation: none; } }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: .5rem .85rem; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none;
  min-height: 38px;
}
.btn:hover { border-color: var(--brand-600); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-600); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-outline { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: .3rem .6rem; font-size: .82rem; min-height: 30px; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .8rem; }
.field label, .label-text { font-size: .85rem; font-weight: 600; }
.field .hint { font-size: .78rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .5rem .65rem; min-height: 38px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 1px; }
input[type="checkbox"] { width: auto; min-height: 0; }
.check { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-error { color: var(--danger); font-size: .88rem; margin: .3rem 0 .6rem; }

.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 200px; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand-600); border-bottom-color: var(--brand-600); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: .55rem .6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--surface-2); }
table.data tr.row-warn td { background: var(--warn-bg); }
table.data tr.row-danger td { background: var(--danger-bg); }
table.data td .sub { display: block; color: var(--muted); font-size: .8rem; }
@media (max-width: 720px) {
  table.data.responsive thead { display: none; }
  table.data.responsive, table.data.responsive tbody, table.data.responsive tr, table.data.responsive td { display: block; width: 100%; }
  table.data.responsive tr { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: .6rem; padding: .35rem .2rem; background: var(--surface); }
  table.data.responsive td { border: 0; padding: .3rem .6rem; display: flex; gap: .75rem; justify-content: space-between; text-align: right; }
  table.data.responsive td::before { content: attr(data-label); font-weight: 600; color: var(--muted); font-size: .78rem; text-align: left; flex-shrink: 0; max-width: 40%; }
  table.data.responsive td > .cell { min-width: 0; overflow-wrap: anywhere; }
  table.data.responsive .badge { white-space: normal; }
  table.data.responsive td.actions { justify-content: flex-end; }
  table.data.responsive td.actions::before { content: none; }
}

/* Badges */
.badge { font-family: var(--font); display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: var(--brand-50); color: var(--brand-600); }

/* Definition lists */
dl.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: .4rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .85rem; }
dl.kv dd { margin: 0; word-break: break-word; }

/* Photos */
.photo { width: 160px; height: 160px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); display: block; }
.photo-doc { max-width: 100%; max-height: 360px; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; background: var(--surface-2); }
.photo-missing { width: 160px; height: 160px; border-radius: var(--radius); border: 1px dashed var(--border); display: grid; place-items: center; color: var(--muted); font-size: .8rem; text-align: center; padding: .5rem; }
.profile { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.profile .info { flex: 1; min-width: 240px; }

/* Vehicle queue */
.queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.queue .card { margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.queue .card .btn-row { margin-top: auto; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 .9rem .6rem; }
.timeline li::before { content: ""; position: absolute; left: -1.43rem; top: .3rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-600); border: 2px solid var(--surface); }
.timeline li.danger::before { background: var(--danger); }
.timeline li.muted-dot::before { background: var(--muted); }
.timeline .t-head { font-weight: 600; }
.timeline .t-time { color: var(--muted); font-size: .8rem; }
.timeline .t-data { font-size: .82rem; color: var(--muted); word-break: break-word; }

.map { height: 380px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; background: var(--surface-2); }
@media (max-width: 720px) { .map { height: 300px; } }
.legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .8rem; color: var(--muted); margin-top: .5rem; }
.legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: .3rem; }

/* States */
.state { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.state.error { color: var(--danger); }
.state .btn { margin-top: .75rem; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--brand-600); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toasts */
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; max-width: min(380px, calc(100vw - 2rem)); }
.toast { background: #1F2937; color: #fff; padding: .7rem 1rem; border-radius: var(--radius-sm); box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: .9rem; border-left: 4px solid var(--brand-600); }
.toast.error { border-left-color: #F87171; }
.toast.ok { border-left-color: #34D399; }

/* Dialog */
dialog.modal { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; width: min(520px, calc(100vw - 2rem)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.modal::backdrop { background: rgba(17, 24, 39, .55); }
dialog.modal form { padding: 1.1rem 1.2rem; }
dialog.modal .modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(1200px 600px at 10% -10%, rgba(91,33,182,.35), transparent), var(--bg); }
.login-card { width: min(400px, 100%); }
.login-card .brand { color: var(--text); padding: 0 0 1rem; }
.login-card .brand small { color: var(--muted); }
.login-card .brand-mark { color: #fff; }

/* Fares */
.calc-result { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-top: .6rem; }
.calc-result .kpi .value { font-size: 1.4rem; }
.fare-table input { min-width: 80px; max-width: 110px; }
.fare-table td { vertical-align: middle; }

.pager { display: flex; justify-content: center; margin-top: 1rem; }
.divider { height: 1px; background: var(--border); margin: 1rem 0; }

@media (max-width: 480px) {
  dl.kv { grid-template-columns: 1fr; gap: 0; }
  dl.kv dt { margin-top: .5rem; font-size: .78rem; }
}

/* Identidades */
.id-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; align-items: start; }
.id-photo .photo-missing { width: 100%; height: 160px; }

/* Mercados: mapa para elegir el centro */
.map.map-picker { height: 260px; cursor: crosshair; }
dialog.modal.wide { width: min(720px, calc(100vw - 2rem)); }
.center-pin { border-radius: 50%; background: #5B21B6; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); box-sizing: border-box; }

/* v1.2 ------------------------------------------------------------------ */
.nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #6B7280; padding: .8rem .7rem .25rem; font-weight: 700; }

/* Markdown (documentos legales) */
.md { line-height: 1.6; max-width: 72ch; overflow-wrap: anywhere; }
.md h2 { font-size: 1.25rem; margin: 1.2rem 0 .5rem; }
.md h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
.md h4, .md h5, .md h6 { font-size: .95rem; margin: .8rem 0 .3rem; }
.md p, .md ul, .md ol, .md blockquote, .md pre { margin: 0 0 .7rem; }
.md ul, .md ol { padding-left: 1.4rem; }
.md blockquote { border-left: 3px solid var(--border); padding-left: .8rem; color: var(--muted); }
.md pre { background: var(--surface-2); padding: .7rem; border-radius: var(--radius-sm); overflow-x: auto; }
.md code { background: var(--surface-2); padding: 0 .25rem; border-radius: 4px; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.md-editor { min-height: 460px; font-family: var(--mono); font-size: .85rem; line-height: 1.5; }
.md-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.md-preview { max-height: 560px; overflow: auto; margin: 0; }
.md-tabs { display: none; }
@media (max-width: 900px) {
  .md-split { grid-template-columns: 1fr; }
  .md-tabs { display: flex; }
  .md-split[data-tab="edit"] .md-pane-preview, .md-split[data-tab="preview"] .md-pane-edit { display: none; }
  .md-editor { min-height: 360px; }
}

/* Selfies: comparación lado a lado */
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 200px)); gap: 1rem; }
.compare figure { margin: 0; }
.compare figcaption { font-size: .8rem; color: var(--muted); margin-top: .3rem; text-align: center; }
.compare .photo, .compare .photo-missing { width: 100%; height: auto; aspect-ratio: 1; }
@media (max-width: 480px) { .compare { grid-template-columns: 1fr 1fr; gap: .5rem; } }

/* Semáforo de plazos */
.light { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.light .sub { flex-basis: 100%; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.green { background: #16A34A; } .dot.amber { background: #D97706; } .dot.red { background: #DC2626; } .dot.gray { background: #9CA3AF; }

/* Gráficos SVG */
.chart { margin: 0; }
.chart-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-bottom: .5rem; }
.chart-head figcaption { font-weight: 700; }
.chart-head .spacer { flex: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .8rem; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bg-c1, .chart-svg .fill-c1 { background: var(--chart-1); fill: var(--chart-1); }
.bg-c2, .chart-svg .fill-c2 { background: var(--chart-2); fill: var(--chart-2); }
.bg-cw, .chart-svg .fill-cw { background: var(--chart-warn); fill: var(--chart-warn); }
.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-axis { stroke: var(--border); stroke-width: 1; }
.chart-tick { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-hit { fill: transparent; cursor: pointer; outline: none; }
.chart-bar { transition: opacity .1s; }
.chart-svg:hover .chart-bar:not(.active) { opacity: .55; }
.chart-tip { position: absolute; top: 0; z-index: 5; min-width: 150px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: .5rem .65rem; font-size: .8rem; pointer-events: none; }
.chart-tip-title { font-weight: 700; margin-bottom: .2rem; }
.chart-tip-row { display: flex; align-items: center; gap: .4rem; }
.chart-tip-row strong { margin-left: auto; }
.chart-tip-row.total { border-top: 1px solid var(--border); margin-top: .25rem; padding-top: .25rem; }

/* v1.3: precio, cambios y cobro */
.card.card-danger { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger) inset, var(--shadow); }
.price-flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: .5rem .75rem; }
.price-step { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .8rem; min-width: 130px; flex: 0 1 auto; }
.price-step .label { font-size: .78rem; color: var(--muted); }
.price-step .value { font-size: 1.3rem; font-weight: 700; }
.price-step .sub { font-size: .78rem; color: var(--muted); max-width: 220px; overflow-wrap: anywhere; }
.price-flow .arrow { align-self: center; color: var(--muted); font-size: 1.2rem; }
.decl-grid { gap: .75rem; }
.decl { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .8rem; background: var(--surface-2); }
.decl .decl-status { font-weight: 700; margin: .15rem 0; }
.decl.decl-bad { border-color: var(--danger); background: var(--danger-bg); }
.decl.decl-bad .decl-status { color: var(--danger); }
.flags { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .25rem; }
@media (max-width: 720px) { table.data.responsive .flags { justify-content: flex-end; } }

/* v1.4: operador, áreas por categoría, configuración */
.nav a.nav-cta { background: #16A34A; color: #fff; font-weight: 700; margin: .15rem 0 .35rem; }
.nav a.nav-cta:hover { background: #15803D; }
.nav a.nav-cta.active { background: #15803D; box-shadow: inset 0 0 0 2px #fff3; }
.topbar .topbar-cta { background: #16A34A; border-color: #16A34A; color: #fff; }
.btn.big { min-height: 48px; padding: .7rem 1.2rem; font-size: 1.02rem; }
.kpi.kpi-cta { background: #16A34A; border-color: #16A34A; color: #fff; }
.kpi.kpi-cta .label, .kpi.kpi-cta .sub { color: #ECFDF5; }
.kpi.kpi-cta .value { font-size: 1.3rem; }

.op-layout { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 1rem; align-items: start; }
.op-form .card { margin: 0 0 .75rem; }
.op-form h2 { font-size: 1rem; }
.op-mapcol { position: sticky; top: 1rem; }
.op-map { height: calc(100vh - 140px); min-height: 360px; }
.op-quote .btn.big { width: 100%; justify-content: center; margin-top: .6rem; }
@media (max-width: 900px) {
  .op-layout { grid-template-columns: 1fr; }
  .op-mapcol { position: static; }
  .op-map { height: 280px; min-height: 0; }
}
.seg-row { display: flex; align-items: center; gap: .4rem; margin-bottom: .5rem; flex-wrap: wrap; }
.seg { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: .35rem .8rem; font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer; min-height: 34px; }
.seg.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.point-box { display: flex; align-items: center; gap: .5rem; justify-content: space-between; background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: .5rem .7rem; margin-bottom: .6rem; min-height: 44px; }
.point-addr { overflow-wrap: anywhere; }
.place-results { display: flex; flex-direction: column; gap: 2px; margin-top: .3rem; }
.place-item { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .65rem; font: inherit; color: var(--text); cursor: pointer; min-height: 40px; }
.place-item:hover, .place-item:focus-visible { border-color: var(--brand-600); }
.cat-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; margin-top: .5rem; }
.cat-option { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; border: 2px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--radius-sm); padding: .55rem .7rem; font: inherit; cursor: pointer; text-align: left; min-height: 64px; }
.cat-option.selected { border-color: var(--brand-600); background: var(--brand-50); }
.cat-option:disabled { opacity: .55; cursor: not-allowed; }
.cat-name { font-weight: 600; font-size: .88rem; }
.cat-price { font-size: 1.2rem; font-weight: 700; }
.cat-why { font-size: .72rem; color: var(--muted); }
.pin { border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.5); box-sizing: border-box; }
.pin-pickup { background: #16A34A; }
.pin-dropoff { background: #5B21B6; }
.plate { font-family: var(--mono); font-weight: 700; border: 2px solid var(--text); border-radius: 4px; padding: 0 .35rem; letter-spacing: .05em; }
.pin-code { font-family: var(--mono); font-size: 1.3rem; font-weight: 800; letter-spacing: .2em; }
.big-kv dd { font-size: 1.02rem; }
.op-banner { font-size: 1.02rem; }
.ph-field { display: flex; gap: .4rem; }
.ph-field .ph-country { width: auto; max-width: 9.5rem; flex: 0 0 auto; }
.ph-field .ph-number { flex: 1; min-width: 0; font-size: 1.05rem; letter-spacing: .02em; }

.area-grid { grid-template-columns: minmax(280px, 380px) 1fr; }
@media (max-width: 900px) { .area-grid { grid-template-columns: 1fr; } }
.area-map { height: 520px; cursor: crosshair; }
@media (max-width: 720px) { .area-map { height: 360px; } }
.area-map.area-disabled { cursor: grab; }
.area-tools { margin-top: .6rem; }
.vertex { background: #fff; border: 3px solid #D97706; border-radius: 50%; box-sizing: border-box; cursor: move; }
.vertex.vertex-first { background: #D97706; border-color: #fff; box-shadow: 0 0 0 2px #D97706; cursor: pointer; }
details.rural { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .8rem; margin: .4rem 0 .8rem; }
details.rural summary { cursor: pointer; font-weight: 600; padding: .2rem 0; }
details.rural[open] summary { margin-bottom: .6rem; }
.shortcuts { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .8rem; }
.phone-mock { border: 1px solid var(--border); border-radius: 18px; padding: 1rem; max-width: 320px; background: var(--surface-2); }
.pm-title { font-weight: 700; margin-bottom: .3rem; }
