/* ROVEX · sistema base (tokens, botones, formularios, avisos) */
:root {
  --ink: #121212;
  --ink-2: #44443f;
  --muted: #6a6a64;
  --line: #e6e4df;
  --line-strong: #c9c6bf;
  --tile: #f4f4f3;
  --paper: #ffffff;
  --orange: #ff5f20;
  --orange-press: #e84e10;
  --orange-ink: #b93a00;
  --orange-soft: #fff1ea;
  --ok: #167a3e;
  --ok-soft: #e8f6ee;
  --warn: #9a5b00;
  --warn-soft: #fff4de;
  --bad: #b3261e;
  --bad-soft: #fdecea;
  --wa: #128c4a;

  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --radius: 12px;
  --radius-sm: 8px;
  --gutter: clamp(16px, 3.5vw, 56px);
  --maxw: 1680px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font: 400 1rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; text-wrap: balance; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 1.5px solid transparent; border-radius: var(--radius);
  font-weight: 600; font-size: 0.9375rem; line-height: 1; text-decoration: none; white-space: nowrap;
  background: var(--orange); color: var(--ink);
  transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-line { background: #fff; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-danger { background: #fff; border-color: #e6b8b4; color: var(--bad); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 0.875rem; border-radius: 10px; }
.btn-block { width: 100%; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { background: var(--orange-press); }
  .btn-dark:hover:not(:disabled) { background: #2b2b2b; }
  .btn-line:hover:not(:disabled), .btn-ghost:hover:not(:disabled) { background: var(--tile); }
  .btn-danger:hover:not(:disabled) { background: var(--bad-soft); }
  .btn-wa:hover:not(:disabled) { background: #0e7a3f; }
}
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: transparent;
  transition: transform 160ms var(--ease-out), background-color 160ms ease; touch-action: manipulation;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 22px; height: 22px; }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--tile); } }

/* Formularios */
.field { display: grid; gap: 6px; }
.field > label, .field > .lbl { font-size: 0.875rem; font-weight: 600; }
.field .hint { font-size: 0.8125rem; color: var(--muted); }
.field .err { font-size: 0.8125rem; color: var(--bad); font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 0 14px;
  background: #fff; border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  font-size: 1rem; transition: border-color 160ms ease, box-shadow 160ms ease;
}
textarea.input { padding: 12px 14px; min-height: 96px; resize: vertical; }
.input::placeholder { color: #6c6c65; }
.input:hover { border-color: #9d9a92; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(18, 18, 18, 0.12); }
.input[aria-invalid="true"] { border-color: var(--bad); }
select.input { appearance: none; padding-right: 40px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23121212' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }

/* Etiquetas de estado */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; background: var(--tile); color: var(--ink-2); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.brand { background: var(--orange-soft); color: var(--orange-ink); }
.tag.dark { background: var(--ink); color: #fff; }

/* Aviso flotante */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: var(--radius);
  background: var(--ink); color: #fff; font-size: 0.9375rem; font-weight: 500;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--bad); }

/* Caja de mensaje en línea */
.notice { padding: 12px 14px; border-radius: var(--radius); background: var(--tile); font-size: 0.9375rem; }
.notice.error { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }

.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
