/* ══════════════════════════════════════════
   XaludApp Admin — Layout compartido
   Incluir en todas las vistas de admin
   ══════════════════════════════════════════ */

:root {
  --ink:          #123047;
  --muted:        #567086;
  --line:         rgba(18, 48, 71, 0.10);
  --surface:      #ffffff;
  --surface-2:    #f5f9fa;
  --surface-3:    #edf4f6;
  --accent:       #0f766e;
  --accent-2:     #0891b2;
  --accent-soft:  #d7f4f0;
  --danger:       #b42318;
  --danger-soft:  #fee2e2;
  --topbar-h:     60px;
  --shadow-sm:    0 1px 4px rgba(18, 48, 71, 0.07);
  --shadow-md:    0 4px 20px rgba(18, 48, 71, 0.08);
  --r-sm:  10px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  28px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface-2);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
  transition: color 140ms ease;
}

.topbar-brand:hover { color: var(--accent); }

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.16);
  flex-shrink: 0;
}

/* ── Nav links ── */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease;
  white-space: nowrap;
}

.nav-link svg { flex-shrink: 0; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }

/* ── Topbar right ── */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-admin {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Buttons ─────────────────────────────── */
.btn {
  appearance: none;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease,
              transform 120ms ease, box-shadow 140ms ease;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px rgba(8, 145, 178, 0.22);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(8, 145, 178, 0.30);
}

.btn-primary:disabled { opacity: 0.6; cursor: wait; transform: none; }

.btn-ghost {
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
}

.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-ghost:disabled { opacity: 0.4; cursor: default; }

.btn-danger {
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
}

.btn-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.2);
}

/* ── Page layout ─────────────────────────── */
.page-content {
  padding: 32px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ── Section header ── */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.section-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 400;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Card ────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* ── Table ───────────────────────────────── */
table { width: 100%; border-collapse: collapse; }

thead {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

th {
  text-align: left;
  padding: 11px 20px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  white-space: nowrap;
}

td {
  padding: 13px 20px;
  font-size: 14px;
  border-bottom: 1px solid rgba(18, 48, 71, 0.055);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f5fbfc; }

.td-id   { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.td-date { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.td-bold { font-weight: 600; }

/* ── Table footer / pagination ── */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  gap: 12px;
  flex-wrap: wrap;
}

.page-info { font-size: 13px; color: var(--muted); }

.page-controls { display: flex; align-items: center; gap: 8px; }

.page-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  min-width: 56px;
  text-align: center;
}

/* ── Badge ───────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-teal  { background: var(--accent-soft); color: var(--accent); }
.badge-muted { background: var(--surface-3);   color: var(--muted);  }

/* ── Text input ──────────────────────────── */
.input {
  border: 1px solid #d6e4ea;
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 8px 13px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input:focus {
  border-color: rgba(8, 145, 178, 0.50);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.10);
}

/* ── Loading / empty rows ── */
.row-state td {
  text-align: center;
  padding: 52px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 768px) {
  .topbar          { padding: 0 16px; }
  .topbar-admin    { display: none; }
  .page-content    { padding: 20px 16px; }
  th, td           { padding: 10px 14px; }
}

@media (max-width: 480px) {
  .topbar-nav      { display: none; }
  .section-header  { flex-direction: column; align-items: flex-start; }
}
