:root {
  --navy: #0f2a4a;
  --navy-2: #173a63;
  --amber: #f59e0b;
  --amber-d: #d97706;
  --ink: #16202c;
  --muted: #5d6b7c;
  --line: #e2e7ee;
  --bg: #ffffff;
  --bg-alt: #f4f6f9;
  --ok: #15803d;
  --ok-bg: #ecfdf3;
  --err: #b42318;
  --err-bg: #fef3f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 56, .06), 0 4px 16px rgba(16, 32, 56, .06);
  --head: 'Archivo', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
h1, h2, h3, h4 { font-family: var(--head); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--navy-2); }
a:hover { color: var(--amber-d); }
img { max-width: 100%; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { margin-bottom: .35em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font: 600 1rem/1 'Inter', sans-serif; padding: .85em 1.3em; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--amber); border-color: var(--amber); color: #1b1300; }
.btn-primary:hover { background: var(--amber-d); border-color: var(--amber-d); color: #1b1300; }
.btn-light { background: #fff; border-color: #fff; color: var(--navy); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.45); color: #fff; }
.btn-ghost:hover { border-color: #fff; color: #fff; }
.btn-outline { background: transparent; border-color: var(--navy-2); color: var(--navy-2); }
.btn-outline:hover { background: var(--navy-2); color: #fff; }
.btn-sm { padding: .5em .9em; font-size: .9rem; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--navy-2); cursor: pointer; text-decoration: underline; }
.danger { color: var(--err); }

/* Header */
.site-header, .admin-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 800 1.3rem var(--head); }
.brand:hover { color: #fff; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a, .admin-nav a { color: #d6e0ee; text-decoration: none; padding: .5em .8em; border-radius: 8px; font-weight: 500; }
.nav a:hover, .nav a.active, .admin-nav a:hover, .admin-nav a.active { color: #fff; background: rgba(255,255,255,.1); }
.nav a.nav-cta { background: var(--amber); color: #1b1300; margin-left: 6px; }
.nav a.nav-cta:hover { background: var(--amber-d); }
.nav-toggle { display: none; }
@media (max-width: 820px) {
  .header-inner > .nav { display: none; }
  .nav-toggle { display: block; }
  .nav-toggle summary {
    list-style: none; cursor: pointer; padding: .5em .9em; border: 1px solid rgba(255,255,255,.35);
    border-radius: 8px; font-weight: 600;
  }
  .nav-toggle summary::-webkit-details-marker { display: none; }
  .nav-toggle .nav {
    position: absolute; left: 0; right: 0; top: 64px; background: var(--navy);
    flex-direction: column; align-items: stretch; padding: 8px 16px 16px; box-shadow: 0 10px 20px rgba(0,0,0,.2);
  }
  .nav-toggle .nav a.nav-cta { margin: 6px 0 0; text-align: center; }
}

/* Hero */
.hero {
  background:
    radial-gradient(1000px 400px at 85% -10%, rgba(245,158,11,.25), transparent 60%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff; padding: clamp(48px, 9vw, 110px) 0 clamp(56px, 9vw, 100px);
}
.hero-inner { max-width: 820px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .8rem; font-weight: 600; color: var(--amber); margin-bottom: 1em; }
.lead { font-size: 1.12rem; color: inherit; opacity: .9; max-width: 640px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 470px); gap: clamp(28px, 5vw, 56px); align-items: center; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: 1fr; } }

/* Vehicle search builder */
.bx-card { background: #fff; color: var(--ink); border-radius: var(--radius); box-shadow: 0 20px 50px rgba(3, 12, 26, .35); overflow: hidden; }
.bx-card h2 { font-size: 1.1rem; text-transform: uppercase; letter-spacing: .05em; margin: 0; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.bx-card-page { box-shadow: var(--shadow); border: 1px solid var(--line); margin-bottom: 36px; }
.buscador { padding: 4px 20px 20px; }
.buscador label, .buscador .lbl { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 5px; }
.buscador select, .buscador input { padding: .55em .7em; background: #f7f9fb; }
.bx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.bx-span { grid-column: 1 / -1; }
.bx-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; color: var(--muted); font-size: .9rem; }
@media (max-width: 420px) { .bx-grid { grid-template-columns: 1fr; } }
.bx-or { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; color: var(--muted); font: 700 .9rem var(--head); letter-spacing: .1em; }
.bx-or::before, .bx-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.buscador .hint { font-size: .82rem; color: var(--muted); margin: 5px 0 0; }
.bx-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
@media (max-width: 420px) { .bx-actions { grid-template-columns: 1fr; } }
.bx-send { margin: 12px 0 0; font-size: .92rem; text-align: center; color: var(--muted); }
.bx-send a { font-weight: 600; }

/* Sections */
.section { padding: clamp(44px, 7vw, 80px) 0; }
.section-alt { background: var(--bg-alt); }
.section-title { margin-bottom: 1em; }
.page-head { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; padding: clamp(36px, 6vw, 64px) 0; }
.page-head .lead { margin-bottom: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.cards-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card p { color: var(--muted); }
.card a { font-weight: 600; text-decoration: none; }
.card-link { display: block; text-decoration: none; color: var(--ink); transition: border-color .15s; }
.card-link:hover { border-color: var(--amber); color: var(--ink); }
.card-icon {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 14px;
  background: var(--navy); color: var(--amber); font: 800 1.2rem var(--head);
}
.price-line { color: var(--ink) !important; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; counter-reset: s; }
.steps li { counter-increment: s; background: #fff; border-radius: var(--radius); padding: 22px; border: 1px solid var(--line); }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--amber); color: #1b1300; font: 800 1rem var(--head); margin-bottom: 12px; }
.steps p { color: var(--muted); margin: 0; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 56px); align-items: start; }
.split-form { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
@media (max-width: 820px) { .split, .split-form { grid-template-columns: 1fr; } }

.cta { background: var(--navy); color: #fff; padding: clamp(40px, 6vw, 64px) 0; }
.cta-inner { text-align: center; }
.cta p { opacity: .85; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1em; }
.table th, .table td { padding: .75em 1em; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { background: var(--bg-alt); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.table.compact td { padding: .5em .8em; }
.table th.num, .table td.num { text-align: right; }
.table-scroll { overflow-x: auto; }

/* Forms */
label { display: block; font-weight: 600; font-size: .92rem; margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; font: inherit; padding: .7em .85em; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(23,58,99,.15); }
textarea { resize: vertical; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
label.check input { width: auto; margin-top: .3em; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 20px; }
.panel > .btn, .panel form > .btn { margin-top: 16px; }
.panel h2 { font-size: 1.2rem; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row-2 { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -9999px; }

.quote { margin-top: 20px; border-top: 1px dashed var(--line); padding-top: 14px; }
.quote-row { display: flex; justify-content: space-between; gap: 12px; padding: .35em 0; }
.quote-row span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.quote-total { font: 800 1.25rem var(--head); border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.quote .btn { margin-top: 8px; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #b7ebc9; }
.alert-error { background: var(--err-bg); color: var(--err); border: 1px solid #fecdca; }
.page-head .alert { margin-top: 18px; }
.notice { background: #fff8eb; border: 1px solid #fde3b0; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 32px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }

.checklist { padding-left: 0; list-style: none; }
.checklist li { padding-left: 28px; position: relative; margin-bottom: .6em; }
.checklist li::before { content: '✓'; position: absolute; left: 0; top: 0; color: var(--amber-d); font-weight: 800; }

.contact-list li { display: grid; grid-template-columns: 100px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.contact-list span { color: var(--muted); font-size: .9rem; }

/* Conversation */
.thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.bubble { max-width: 85%; border-radius: 14px; padding: 12px 16px; }
.bubble-client { background: var(--bg-alt); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble-admin { background: var(--navy); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble-meta { font-size: .8rem; opacity: .7; margin-bottom: 4px; }
.bubble-body { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Footer */
.site-footer { background: #0a1d34; color: #b9c6d8; padding: 48px 0 20px; }
.site-footer a { color: #e6edf6; }
.site-footer h4 { color: #fff; font-size: 1rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
.brand-foot { font: 800 1.3rem var(--head); color: #fff; display: block; margin-bottom: 8px; }
.footer-legal { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid rgba(255,255,255,.1); margin-top: 32px; padding-top: 16px; font-size: .85rem; }
.footer-legal a { color: #7f93ad; }
.site-footer .muted { color: #8ea0b8; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } .footer-legal { flex-direction: column; } }

.wa-float {
  position: fixed; right: 18px; bottom: 18px; width: 58px; height: 58px; border-radius: 50%;
  background: #25d366; color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 30;
}
.wa-float:hover { color: #fff; transform: scale(1.05); }

/* ---------- Admin ---------- */
body.admin { background: var(--bg-alt); }
.admin-nav { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.admin-nav form { margin: 0; }
.admin-nav .linklike { color: #d6e0ee; text-decoration: none; padding: .5em .8em; }
.admin-main { padding-top: 28px; padding-bottom: 48px; }
.admin-title { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.admin-title h1 { font-size: 1.8rem; margin: 0; }
.badge { display: inline-block; background: var(--amber); color: #1b1300; border-radius: 999px; padding: 0 .5em; font-size: .78rem; font-weight: 700; }
.segmented { display: inline-flex; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.segmented a { padding: .4em .8em; border-radius: 7px; text-decoration: none; color: var(--muted); font-size: .9rem; font-weight: 500; }
.segmented a.active { background: var(--navy); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.stat span { color: var(--muted); font-size: .88rem; }
.stat strong { font: 800 2.1rem var(--head); margin: 4px 0; }
.stat small { color: var(--muted); }
.stat-link:hover { border-color: var(--amber); color: var(--ink); }
.bars { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 2px; align-items: end; height: 180px; border-bottom: 1px solid var(--line); }
.bar { height: 100%; display: flex; align-items: flex-end; }
.bar-fill { width: 100%; background: var(--navy-2); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar:hover .bar-fill { background: var(--amber); }
.bars-axis { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 820px) { .grid-2, .grid-side { grid-template-columns: 1fr; } }

.msg-list { list-style: none; margin: 0; padding: 0; }
.msg-item { display: block; padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.msg-list li:last-child .msg-item { border-bottom: 0; }
.msg-item:hover { background: var(--bg-alt); color: var(--ink); }
.msg-item.is-new strong::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); margin-right: 8px; vertical-align: middle; }
.msg-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.msg-date { margin-left: auto; font-size: .85rem; }
.msg-snippet { color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.tag { font-size: .75rem; font-weight: 600; padding: .15em .6em; border-radius: 999px; }
.tag-nuevo { background: #fff4db; color: #92400e; }
.tag-respondido { background: var(--ok-bg); color: var(--ok); }
.tag-cerrado { background: var(--bg-alt); color: var(--muted); }

.details dt { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 12px; }
.details dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.copy { font-size: .85rem; }
.stack { display: grid; gap: 8px; margin: 18px 0; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { width: 100%; margin-bottom: 0; }
.inline-form select { flex: 1; width: auto; }
.danger-zone { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }

.edit-table td { padding: .4em .5em; }
.edit-table input { padding: .45em .6em; }
.edit-table .w-num { min-width: 90px; }
.edit-table td:first-child input, .edit-table td:nth-child(2) input { min-width: 170px; }
.edit-table input[type=checkbox] { width: auto; }
.edit-table .actions { white-space: nowrap; }
.edit-table .actions form { display: inline-block; margin: 0 4px; }
.new-row td { background: #fffbf2; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-end { grid-column: 1 / -1; margin-top: 16px; }

.login-box { max-width: 400px; margin: 10vh auto 0; }
.login-box h1 { font-size: 1.6rem; }
.login-box .btn { margin-top: 20px; }

.brand-name { text-transform: uppercase; letter-spacing: .02em; }
.brand-accent { color: var(--amber); }
