@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --primary: #0ea5e9;
  --primary-strong: #0284c7;
  --accent: #f59e0b;
  --success: #16a34a;
  --danger: #ef4444;
  --surface: #ffffff;
  --surface-muted: #f5f7fb;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --sidebar: #0b1224;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
  background: #f8fafc;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.base-watermark {
  position: relative;
}
.base-watermark::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url('../logolab.png') no-repeat calc(50% + 130px) center;
  background-size: 95vmin;
  opacity: 0.03;
  pointer-events: none;
  z-index: -1;
  filter: grayscale(20%);
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; color: #0b1224; }
p { margin: 0; color: var(--muted); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* Layout general */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #0b1224 0%, #0f1d3b 100%);
  color: #e2e8f0;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: #0ea5e9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.brand-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }

.brand-text small { color: rgba(226,232,240,0.7); }

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.sidebar .item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  color: #e2e8f0;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}

.sidebar .item:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  transform: translateX(2px);
}

.sidebar .item .icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.separator {
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin: 14px 4px;
}

.logout { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: #e2e8f0;
  font-size: 0.82rem;
}

.main-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px 10px;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar .eyebrow {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.content {
  padding: 10px 28px 32px;
  position: relative;
}

/* Componentes */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.page-lead h2 { font-size: 26px; margin-bottom: 4px; }
.page-lead p { color: var(--muted); }
.muted { color: var(--muted); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.chip.success {
  background: #e9f7ec;
  border-color: #b3e0bd;
  color: #166534;
}

.chip.warning {
  background: #fff4e5;
  border-color: #fcd9a4;
  color: #b45309;
}

.card {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 14px 50px rgba(15,23,42,0.08);
  padding: 18px;
}

.card + .card { margin-top: 12px; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.card-title { font-size: 18px; margin: 0; }
.card-sub { font-size: 0.95rem; color: var(--muted); margin: 0; }

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.action-card {
  position: relative;
  padding: 18px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(14,165,233,0.08), rgba(168,85,247,0.08));
  border: 1px solid var(--border);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  color: var(--text);
}

.action-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}

.action-card .action-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #0ea5e9;
  color: #0b1224;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.action-card h3 { margin: 12px 0 6px; font-size: 18px; }
.action-card p { color: var(--muted); }

.action-card.blue { background: linear-gradient(135deg, rgba(14,165,233,0.12), rgba(37,99,235,0.08)); }
.action-card.green { background: linear-gradient(135deg, rgba(34,197,94,0.12), rgba(16,185,129,0.08)); }
.action-card.amber { background: linear-gradient(135deg, rgba(245,158,11,0.12), rgba(251,191,36,0.08)); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.16s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  border-color: #0ea5e9;
  color: #fff;
}

.btn-primary:hover { filter: brightness(0.98); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover { background: var(--surface-muted); }

.btn-danger {
  background: #fee2e2;
  border-color: #fecdd3;
  color: #b91c1c;
}

.btn-mini { padding: 6px 10px; font-size: 0.85rem; border-radius: 10px; }
.btn-full { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-weight: 600; font-size: 0.9rem; color: #111827; }

.input,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.95rem;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}

textarea { resize: vertical; min-height: 110px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px 16px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

.toolbar .search {
  flex: 1;
  display: flex;
  gap: 8px;
}

.table-wrapper {
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.93rem;
}

thead th {
  background: var(--surface-muted);
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: 0.85rem;
}

tbody tr:hover { background: #f8fafc; }

.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 0.82rem;
}

.status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.status-pill.success { background: #e9f7ec; color: #166534; }
.status-pill.danger { background: #fee2e2; color: #991b1b; }

.detalle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.detalle-card,
.detalle-view-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface-muted);
}
.detalle-card strong {
  font-size: 0.95rem;
}

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 10px;
  font-size: 0.88rem;
}

.pagination button {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 6px 10px;
  cursor: pointer;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Login */
.login-bg {
  min-height: 100vh;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  background: linear-gradient(120deg, #0ea5e9 0%, #a855f7 100%);
  padding: 42px;
  position: relative;
}

.login-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.12), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(255,255,255,0.12), transparent 26%);
  pointer-events: none;
}

.login-card {
  position: relative;
  background: #0b1224;
  color: #e2e8f0;
  padding: 28px;
  border-radius: 18px;
  max-width: 520px;
  margin: auto;
  box-shadow: 0 28px 70px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
}

.login-card h3 { margin-bottom: 6px; font-size: 24px; }
.login-card p { color: rgba(226,232,240,0.8); }
.login-card form { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.login-logo { width: 96px; margin: 0 auto 12px; display: block; }

.login-card .input {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
  color: #fff;
}

.login-card .input::placeholder { color: rgba(255,255,255,0.7); }
.login-meta { margin-top: 12px; font-size: 0.9rem; color: rgba(226,232,240,0.85); }

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.14);
}

@media (max-width: 960px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    overflow-x: auto;
  }
  .sidebar nav {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .sidebar .item { white-space: nowrap; }
  .topbar { padding: 18px 18px 6px; }
  .content { padding: 12px 18px 24px; }
}

@media (max-width: 640px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .action-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
