:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #16202e;
  --muted: #5d6b7e;
  --line: #dde3ea;
  --brand: #101d34;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --ok: #157f3c;
  --warn-bg: #fff4d6;
  --warn-ink: #7a5300;
  --danger: #b42318;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input, select, textarea { font-family: inherit; font-size: 15px; }
[hidden] { display: none !important; }

/* --- Encabezado --- */
.top {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: var(--brand); color: #fff;
}
.top .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.top .brand img { width: 32px; height: 32px; }
.top .brand small { display: block; font-weight: 400; opacity: .75; font-size: 12px; }
.top nav { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.top nav button {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
.top nav button.on, .top nav button:hover { background: rgba(255,255,255,.12); }
.top .who { font-size: 13px; opacity: .85; margin-right: 6px; }

.banner {
  background: var(--warn-bg); color: var(--warn-ink); padding: 8px 20px;
  font-size: 14px; border-bottom: 1px solid #f0d58a;
}

/* --- Cotizador --- */
main { padding: 20px; max-width: 1400px; margin: 0 auto; }
.layout { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 20px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.card h3 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

label.field { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
label.field > span { display: block; margin-bottom: 4px; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
select:disabled { background: #f1f3f6; color: #98a2b3; }
.divider { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; max-height: 420px; overflow: auto; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list button {
  width: 100%; text-align: left; background: #fff; border: 0; padding: 9px 12px; cursor: pointer; color: var(--ink);
}
.list button:hover { background: var(--accent-soft); }
.list button.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.list small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.error { color: var(--danger); font-size: 14px; margin: 8px 0 0; }

.quote-empty { color: var(--muted); text-align: center; padding: 60px 20px; }
.quote-head { display: flex; gap: 16px; align-items: flex-start; }
.quote-head img { width: 180px; max-width: 40%; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; background: #f1f3f6; }
.quote-head .ttl { flex: 1; min-width: 0; }
.quote-head .ttl .brand-line { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.quote-head .ttl h2 { font-size: 20px; margin: 4px 0; }
.quote-head .ttl .codia { color: var(--muted); font-size: 13px; }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 16px; }
.figure { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.figure .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.figure .val { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.figure .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.figure.main { border-color: var(--accent); background: var(--accent-soft); }

table.prices { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.prices th, table.prices td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.prices td.num, table.prices th.num { text-align: right; }
table.prices tbody tr { cursor: pointer; }
table.prices tbody tr:hover { background: #f6f8fb; }
table.prices tbody tr.on { background: var(--accent-soft); font-weight: 600; }

.adjust { display: grid; grid-template-columns: 140px 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px;
  padding: 8px 14px; cursor: pointer;
}
.btn:hover { background: #f6f8fb; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .55; cursor: default; }

.features { columns: 2 260px; column-gap: 24px; }
.features section { break-inside: avoid; margin-bottom: 12px; }
.features h4 { margin: 0 0 4px; font-size: 13px; }
.features dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 13px; }
.features dt { color: var(--muted); }
.features dd { margin: 0; text-align: right; }

.source { margin-top: 16px; font-size: 12px; color: var(--muted); }
.usage { font-size: 12px; color: var(--muted); margin-top: 10px; }

.field-title { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.scroll-x { overflow-x: auto; }
.card.spaced { margin-top: 20px; }
.dialog-title { margin-top: 0; font-size: 18px; }

/* --- Administración --- */
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users th, table.users td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.users td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eef1f5; }
.pill.ok { background: #e3f4e8; color: var(--ok); }
.pill.off { background: #fde8e7; color: var(--danger); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions .btn { padding: 4px 10px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.notice { background: #e3f4e8; color: var(--ok); border-radius: 8px; padding: 10px 12px; margin-top: 12px; font-size: 14px; word-break: break-all; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; max-width: 420px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(16, 29, 52, .45); }

/* --- Login --- */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--brand); }
.login-card { background: #fff; border-radius: 14px; padding: 28px; width: 100%; max-width: 380px; }
.login-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.login-card .brand img { width: 40px; height: 40px; }
.login-card .brand small { display: block; color: var(--muted); }
.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-card p { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.login-card .btn { width: 100%; padding: 10px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .adjust { grid-template-columns: 1fr; }
  .quote-head { flex-direction: column; }
  .quote-head img { width: 100%; max-width: 100%; }
  main { padding: 16px; }
  .top { padding: 10px 16px; }
  .top .who { display: none; }
  .top .brand small { display: none; }
  .top nav button { padding: 6px 10px; }
  table.users { font-size: 13px; }
  .hide-sm { display: none; }
}

@media print {
  .top, .banner, .no-print, .layout > .picker { display: none !important; }
  body, main { background: #fff; padding: 0; }
  .layout { display: block; }
  .card { border: 0; padding: 0; }
  table.prices tbody tr { cursor: auto; }
}
