/* ─── Design tokens ────────────────────────────────────────────────────────── */
:root {
  --color-bg:           #fefcfb;
  --color-bg-soft:      #fbf5f1;
  --color-bg-hover:     #f5ebe4;

  --color-border:       #ead9d0;
  --color-border-strong:#d4bcaf;

  --color-text:         #1a1414;
  --color-text-soft:    #564b46;
  --color-text-mute:    #998b85;

  --color-primary:      #d8492e;
  --color-primary-hover:#b83a23;
  --color-primary-active:#9a2f1c;
  --color-primary-soft: #ffe8e2;

  --color-accent:       #1e3a5f;
  --color-accent-soft:  #e1e8f0;

  --color-success:      #16a34a;
  --color-success-soft: #dcfce7;
  --color-warning:      #ca8a04;
  --color-warning-soft: #fef3c7;
  --color-danger:       #b91c1c;
  --color-danger-soft:  #fee2e2;

  --shadow-xs: 0 1px 2px rgba(60,30,20,.05);
  --shadow-sm: 0 2px 4px rgba(60,30,20,.06);
  --shadow-md: 0 4px 12px rgba(60,30,20,.09);
  --shadow-lg: 0 12px 32px rgba(60,30,20,.14);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

/* ─── Reset base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Utilidades de texto ──────────────────────────────────────────────────── */
.text-primary { color: var(--color-primary); }
.text-soft    { color: var(--color-text-soft); }
.text-mute    { color: var(--color-text-mute); }

/* ─── Layout ───────────────────────────────────────────────────────────────── */
.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

.narrow { max-width: 440px; width: 100%; }

/* ─── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.card-pad    { padding: 28px 24px; }
.card-pad-lg { padding: 36px 32px; }

/* ─── Botones ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 12px 20px;
  min-height: 44px;
  transition: background 120ms, opacity 120ms;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); }
.btn-primary:active:not(:disabled) { background: var(--color-primary-active); }

.btn-secondary {
  background: var(--color-bg-soft);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover:not(:disabled) { background: var(--color-bg-hover); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-soft);
}
.btn-ghost:hover:not(:disabled) { background: var(--color-bg-hover); }

.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-success:hover:not(:disabled) { background: #15803d; }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #991b1b; }

.btn-lg    { padding: 14px 24px; font-size: 16px; min-height: 52px; }
.btn-tiny  { padding: 6px 12px; font-size: 13px; min-height: 32px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

/* ─── Inputs ───────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  font-size: 16px;
  line-height: 1.4;
  padding: 10px 14px;
  background: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  transition: border-color 120ms, box-shadow 120ms;
  outline: none;
  min-height: 44px;
}
.input::placeholder { color: var(--color-text-mute); }
.input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.input-lg { padding: 13px 16px; min-height: 52px; }

.form-block { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.label { font-size: 14px; font-weight: 600; color: var(--color-text); }

/* ─── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-soft);  color: var(--color-danger);  }
.badge-info    { background: var(--color-accent-soft);  color: var(--color-accent);  }
.badge-neutral { background: var(--color-bg-hover);     color: var(--color-text-soft); }

/* ─── Alertas ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
  border: 1px solid #fecaca;
}
.alert-success {
  background: var(--color-success-soft);
  color: var(--color-success);
  border: 1px solid #bbf7d0;
}
.alert-warning {
  background: var(--color-warning-soft);
  color: var(--color-warning);
  border: 1px solid #fde68a;
}

/* ─── Wizard section (.ae-section) ────────────────────────────────────────── */
.ae-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--color-border);
}
.ae-section:last-of-type { border-bottom: none; }
.ae-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 12px;
}

/* ─── Login logo ───────────────────────────────────────────────────────────── */
.login-logo {
  display: flex;
  align-items: baseline;
  margin-bottom: 24px;
}

/* ─── Código 4 dígitos (guardia login) ────────────────────────────────────── */
.codigo-inputs {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
}
.codigo-digit {
  width: 64px !important;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  padding: 12px 0;
  letter-spacing: 0;
}

/* ─── Hub cards (3-4 por rol) ──────────────────────────────────────────────── */
.hub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 24px;
}
@media (min-width: 480px) {
  .hub-grid { grid-template-columns: 1fr 1fr; }
}
.hub-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 20px;
  background: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background 120ms, box-shadow 120ms, border-color 120ms;
  text-decoration: none;
  color: var(--color-text);
  min-height: 100px;
}
.hub-card:hover {
  background: var(--color-bg-soft);
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.hub-card-icon { font-size: 28px; margin-bottom: 10px; }
.hub-card-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.hub-card-desc  { font-size: 13px; color: var(--color-text-soft); }

/* ─── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}
.topbar-brand { font-size: 18px; font-weight: 700; color: var(--color-primary); }
.topbar-user  { font-size: 14px; color: var(--color-text-soft); }
