@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
  --bg-ambient: #EAF4F4;
  --glow-mint: #B9E3DD;
  --glow-coral: #F3D6CE;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.7);
  --ink: #10302B;
  --ink-soft: #4C6863;
  --brand: #0FA98C;
  --brand-dark: #0B8570;
  --alert: #E2574C;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg-ambient);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  position: relative;
  overflow-x: hidden;
}

body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
}
body::before { width: 420px; height: 420px; background: var(--glow-mint); top: -120px; left: -100px; opacity: .55; }
body::after  { width: 380px; height: 380px; background: var(--glow-coral); bottom: -100px; right: -80px; opacity: .45; }

h1, h2, h3, .display-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 .5rem;
}

.page { display: flex; min-height: 100vh; }
.content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.content > * { width: 100%; max-width: 900px; }
.content > .wide { max-width: 100%; }
.text-center { text-align: center; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-3 { margin-top: 1rem; }

.sidebar-glass {
  width: var(--sidebar-w);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--glass-border);
}
.sidebar-brand {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 1.5rem;
  display: block;
}
.sidebar-nav { list-style: none; padding: 0; margin: 0; flex: 1; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
  display: block;
  padding: .55rem .8rem;
  border-radius: 10px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .93rem;
  transition: background .18s ease, color .18s ease;
}
.sidebar-nav a:hover { background: rgba(15, 169, 140, .12); color: var(--brand-dark); }
.sidebar-user {
  border-top: 1px solid rgba(16,48,43,.1);
  padding-top: 1rem;
  font-size: .88rem;
  color: var(--ink-soft);
}

.btn {
  display: inline-block;
  padding: .6rem 1.2rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background .18s ease, transform .12s ease;
}
.btn-block { width: 100%; text-align: center; }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; border-radius: 8px; }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn-alert { background: transparent; color: var(--alert); border: 1.5px solid var(--alert); }
.btn-alert:hover { background: var(--alert); color: #fff; }
.btn-outline { background: transparent; color: var(--ink-soft); border: 1.5px solid rgba(16,48,43,.2); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand-dark); }

.glass-card {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(16, 48, 43, 0.08);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.glass-card-header {
  background: rgba(16, 48, 43, 0.85);
  backdrop-filter: blur(10px);
  color: #fff;
  border-radius: 20px 20px 0 0;
  padding: .9rem 1.2rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: .02em;
  margin: -1.25rem -1.25rem 1.25rem;
}

.scan-portal {
  width: 100%;
  font-size: 1.3rem;
  text-align: center;
  padding: .8rem;
  background: rgba(255,255,255,.7);
  border: 2px solid rgba(15, 169, 140, .25);
  border-radius: 16px;
  color: var(--ink);
  transition: box-shadow .25s ease, border-color .25s ease;
}
.scan-portal:focus {
  outline: none;
  border-color: var(--brand);
  animation: portal-pulse 1.6s ease-in-out infinite;
}
@keyframes portal-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(15, 169, 140, .35); }
  50%      { box-shadow: 0 0 0 10px rgba(15, 169, 140, 0); }
}

.table-glass { width: 100%; border-collapse: collapse; }
.table-glass thead th {
  text-align: left;
  padding: .5rem;
  border-bottom: 1.5px solid rgba(16,48,43,.15);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.table-glass td {
  padding: .5rem;
  border-bottom: 1px solid rgba(16,48,43,.06);
  font-family: 'JetBrains Mono', monospace;
  font-size: .92rem;
}
.table-glass td:first-child { font-family: 'Inter', sans-serif; font-weight: 500; }

@keyframes item-land {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.item-landing { animation: item-land .35s ease-out; }

.total-line { text-align: right; font-family: 'Fraunces', serif; font-size: 1.4rem; margin: 1rem 0; }
.total-display { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: var(--brand-dark); }

.alert-box {
  padding: .8rem 1rem;
  border-radius: 12px;
  background: rgba(15, 169, 140, .1);
  color: var(--brand-dark);
  border: 1px solid rgba(15, 169, 140, .25);
}

@media (max-width: 768px) {
  .sidebar-glass { transform: translateX(-100%); transition: transform .25s ease; z-index: 50; }
  .sidebar-glass.open { transform: translateX(0); }
  .content { margin-left: 0; padding: 1.25rem; }
}

/* ── Tabs propios ────────────────────────────────────── */
.tabs-bar {
  display: flex;
  gap: .3rem;
  margin-bottom: 1rem;
}
.tab-btn {
  padding: .55rem 1.1rem;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .9rem;
  border-radius: 12px 12px 0 0;
  cursor: pointer;
}
.tab-btn.active {
  background: var(--glass);
  color: var(--brand-dark);
  box-shadow: 0 -2px 8px rgba(16,48,43,.06);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Buscador ────────────────────────────────────────── */
.search-input {
  width: 100%;
  padding: .6rem .9rem;
  border-radius: 12px;
  border: 1.5px solid rgba(16,48,43,.15);
  background: rgba(255,255,255,.6);
  margin-bottom: 1rem;
  font-family: 'Inter', sans-serif;
}
.search-input:focus { outline: none; border-color: var(--brand); }

.table-wrapper { max-height: 500px; overflow-y: auto; overflow-x: auto; }

/* ── Modal propio ────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16,48,43,.35);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 380px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(16,48,43,.25);
}
.modal-box-header {
  padding: 1rem 1.25rem;
  background: var(--brand);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-box-header h5 { margin: 0; font-size: 1.05rem; color: #fff; }
.modal-close { background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; }
.modal-box-body { padding: 1.25rem; }
.modal-box-body label { display: block; margin-bottom: .4rem; font-size: .88rem; color: var(--ink-soft); }
.modal-box-body input {
  width: 100%;
  padding: .6rem;
  border-radius: 10px;
  border: 1.5px solid rgba(16,48,43,.15);
}
.modal-box-footer { padding: .8rem 1.25rem 1.25rem; display: flex; justify-content: flex-end; gap: .5rem; }

/* ── Tabla genérica ──────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  padding: .6rem;
  background: rgba(16,48,43,.85);
  color: #fff;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  position: sticky;
  top: 0;
}
.data-table th:first-child { border-radius: 8px 0 0 0; }
.data-table th:last-child { border-radius: 0 8px 0 0; }
.data-table td {
  padding: .6rem;
  border-bottom: 1px solid rgba(16,48,43,.06);
  font-size: .9rem;
}
.data-table tr:hover td { background: rgba(15,169,140,.05); }

.data-table td:nth-child(3), .data-table th:nth-child(3),
.data-table td:nth-child(4), .data-table th:nth-child(4) {
  max-width: 220px;
  white-space: normal;
  word-break: break-word;
}

/* ── Formularios ─────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
.form-col-full { grid-column: 1 / -1; }
.form-group label {
  display: block;
  margin-bottom: .35rem;
  font-size: .85rem;
  color: var(--ink-soft);
  font-weight: 500;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: .6rem .8rem;
  border-radius: 10px;
  border: 1.5px solid rgba(16,48,43,.15);
  background: rgba(255,255,255,.7);
  font-family: 'Inter', sans-serif;
  font-size: .92rem;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--brand);
}

@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ── Badges de estado ────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .3rem .7rem;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
}
.badge-urgente { background: rgba(226,87,76,.15); color: var(--alert); }
.badge-proximo { background: rgba(230,181,60,.15); color: #B8860B; }
.badge-seguro  { background: rgba(15,169,140,.15); color: var(--brand-dark); }
.text-muted { color: var(--ink-soft); font-size: .9rem; }

/* ── Tarjeta de m\u00e9trica destacada ─────────────────────── */
.metric-card {
  text-align: center;
  padding: 1.5rem;
}
.metric-label {
  color: var(--ink-soft);
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .4rem;
}
.metric-value {
  font-family: 'Fraunces', serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--brand-dark);
}
.text-success { color: var(--brand-dark); font-weight: 600; }