/* TOEM · sistema visual compartido. Fuente obligatoria: Quicksand. Paleta por defecto: F · Greige y eucalipto.
   Cada empresa puede cambiar la paleta de su tienda (brand.palette) sin tocar este archivo. */
:root {
  --primary: #CCDCD7; --primary-ink: #23463F;
  --tint: #EDF2F0; --tint-ink: #2F5A52;
  --accent: #F1E5CB; --accent-ink: #6B4E14;
  --side: #F2F1EE; --side-active: #E1E8E5; --side-active-ink: #2F5A52;
  --ground: #F8F7F5; --ink: #2B2B28; --muted: #5E6573; --line: #E7E6E2; --surface: #FFFFFF;
  --danger-bg: #FDECEC; --danger-line: #F3CBC6; --danger-ink: #8A1C14;
  --ok-bg: #E6F2EC; --ok-ink: #1F5A3A; --warn-bg: #FBF0DA; --warn-ink: #6B4E14; --info-bg: #EAF1F6; --info-ink: #24496B;
  --radius: 24px; --radius-sm: 16px; --shadow: 0 6px 20px rgba(40, 40, 35, .06);
  --font: 'Quicksand', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--ground); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
a { color: var(--tint-ink); font-weight: 600; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(26px, 3vw, 34px); }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--tint-ink); outline-offset: 2px; border-radius: 8px; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .08s ease, background .15s ease; }
.btn:hover { background: var(--side); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--side-active); }
.btn-soft { background: var(--tint); border-color: var(--tint); color: var(--tint-ink); }
.btn-danger { color: var(--danger-ink); border-color: var(--danger-line); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-icon { width: 44px; padding: 0; }
.btn-block { width: 100%; }

/* Tarjetas y estructura */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card-flat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpi { display: flex; flex-direction: column; gap: 8px; }
.kpi strong { font-size: 30px; }
.kpi .dot { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; background: var(--tint); color: var(--tint-ink); }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px; border-radius: 20px; background: var(--ground); }
.item .grow { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.empty { padding: 22px; border-radius: 20px; background: var(--ground); color: var(--muted); text-align: center; }

/* Etiquetas */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--side); color: var(--ink); }
.pill-tint { background: var(--tint); color: var(--tint-ink); }
.pill-accent { background: var(--accent); color: var(--accent-ink); }
.pill-active { background: var(--side-active); color: var(--side-active-ink); }
.pill-ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill-warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill-danger { background: var(--danger-bg); color: var(--danger-ink); }
.pill-info { background: var(--info-bg); color: var(--info-ink); }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.field small { font-weight: 500; color: var(--muted); }
.input, .field input, .field select, .field textarea { min-height: 46px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid #D9D8D3; background: var(--surface); font-weight: 500; width: 100%; }
.field textarea { padding: 12px 14px; min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--tint-ink); outline-offset: 1px; }
.field [aria-invalid="true"] { border-color: var(--danger-ink); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--tint-ink); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 5px; border-radius: 20px; background: var(--side); }
.seg button { min-height: 44px; border: 0; border-radius: 15px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgba(40,40,35,.08); }
.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.strength span { height: 6px; border-radius: 99px; background: var(--line); }
.strength span.on { background: var(--tint-ink); }

/* Avisos */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 18px; font-weight: 600; }
.alert-error { background: var(--danger-bg); color: var(--danger-ink); border: 1px solid var(--danger-line); }
.alert-ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert-info { background: var(--info-bg); color: var(--info-ink); }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); }
.alert details { font-weight: 500; margin-top: 6px; }
.alert code { font-size: 12px; white-space: pre-wrap; word-break: break-word; }
#toasts { position: fixed; z-index: 50; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; width: min(560px, calc(100% - 32px)); }
.toast { padding: 14px 18px; border-radius: 18px; background: var(--ink); color: #fff; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.18); }
.toast.error { background: var(--danger-ink); }
.toast.ok { background: var(--tint-ink); }

/* Diálogos */
dialog { border: 0; padding: 0; border-radius: 28px; width: min(640px, calc(100% - 24px)); max-height: calc(100% - 24px); box-shadow: 0 24px 60px rgba(0,0,0,.2); color: var(--ink); }
dialog::backdrop { background: rgba(43, 43, 40, .35); }
.dialog-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Carga */
.loading { display: grid; place-items: center; min-height: 40vh; color: var(--muted); font-weight: 600; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--tint-ink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
