/* base.css — tokens y componentes compartidos por web, portal y panel */

:root {
  --ink: #000;
  --text: #1C1C1C;
  --muted: #6B6B6B;
  --soft: #8E8E8B;
  --line: #E8E8E6;
  --line-2: #D6D6D2;
  --surface: #F5F5F3;
  --surface-2: #EDEDEA;
  --paper: #FFF;
  --brand: #F07F0B;
  --brand-soft: #FFF1E2;
  --focus: #F07F0B;

  --font: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 22px;
  --r-xl: 30px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand); color: #000; }
[hidden] { display: none !important; }

h1, h2, h3, h4 { margin: 0; color: var(--ink); font-weight: 700; font-stretch: 108%; letter-spacing: -.02em; line-height: 1.1; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--paper); color: var(--ink);
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #262626; border-color: #262626; color: #fff; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #000; }
.btn-brand:hover { background: #E07200; border-color: #E07200; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface); border-color: transparent; }
.btn-danger { color: #B42318; }
.btn-danger:hover { border-color: #B42318; background: #FEF3F2; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-lg { min-height: 54px; padding: 0 28px; font-size: 16px; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }
.btn-icon.btn-sm { width: 34px; min-height: 34px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.link { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.link:hover { text-decoration-color: var(--ink); }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 14px; font-weight: 600; color: var(--text); }
.hint { font-size: 13px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--paper);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { padding: 12px 14px; min-height: 110px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
.input-sm, .select.input-sm { min-height: 38px; font-size: 14px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.span-all { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

/* Insignias */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: #F1F1EF; color: #4A4D52;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-blue { background: #EEF2FE; color: #2348C9; }
.badge-amber { background: #FFF4DE; color: #8A5300; }
.badge-orange { background: #FFEEDD; color: #A84D00; }
.badge-violet { background: #F2EDFE; color: #6237C8; }
.badge-green { background: #E6F5EE; color: #0B7049; }
.badge-red { background: #FDECEC; color: #B42318; }
.badge-gray { background: #F1F1EF; color: #4A4D52; }
.badge-plain::before { display: none; }

/* Tarjetas */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-pad { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 17px; font-stretch: 100%; letter-spacing: -.01em; }
.card-body { padding: 20px 24px; }

/* Alertas */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); font-size: 15px; background: var(--surface); }
.alert-ok { background: #E6F5EE; color: #0B5A3C; }
.alert-error { background: #FDECEC; color: #8F1D16; }
.alert-info { background: #EEF2FE; color: #1F3D9E; }
.flash-stack { display: flex; flex-direction: column; gap: 8px; }

/* Tablas */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFAF9; }
.table .row-link { text-decoration: none; font-weight: 600; color: var(--ink); }
.table .row-link:hover { text-decoration: underline; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Diálogos */
dialog.modal {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 0; border-radius: var(--r-lg); box-shadow: 0 24px 80px rgba(0, 0, 0, .22); color: var(--text);
}
dialog.modal.wide { width: min(880px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10, 10, 10, .38); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 20px; }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #FCFCFB; }

/* Varios */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); color: var(--ink);
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }
.avatar-brand { background: var(--brand); color: #000; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ink); border-radius: inherit; }
.empty { padding: 48px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.empty h3 { font-size: 18px; color: var(--ink); font-stretch: 100%; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); display: inline-block; flex: none; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ico { flex: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
