:root {
  --brand-1: #0d9488;
  --brand-2: #10b981;
  --brand-3: #06b6d4;
  --accent-violet: #7c3aed;
  --accent-orange: #f97316;
  --accent-pink:   #ec4899;
  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-300: #cbd5e1;
  --ink-100: #f1f5f9;
  --bg-soft: #f5fbfa;

  --brand-grad:   linear-gradient(135deg, var(--brand-1) 0%, var(--brand-3) 100%);
  --state-ok:     linear-gradient(135deg, #10b981, #059669);
  --state-warn:   linear-gradient(135deg, #f59e0b, #f97316);
  --state-bad:    linear-gradient(135deg, #ef4444, #dc2626);
  --state-info:   linear-gradient(135deg, #6366f1, #06b6d4);
  --grad-violet:  linear-gradient(135deg, #7c3aed, #c026d3);
}

* { -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  background: var(--bg-soft);
  color: var(--ink-900);
}

/* ===== Login ===== */
.login-wrap {
  min-height: 100vh;
  margin: 0;
  background: var(--brand-grad);
  position: relative;
  overflow: hidden;
}
.login-wrap::before, .login-wrap::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.12); filter: blur(40px); pointer-events: none;
}
.login-wrap::before { width: 320px; height: 320px; top: -80px; left: -80px; }
.login-wrap::after  { width: 380px; height: 380px; bottom: -120px; right: -100px; }

.login-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  position: relative;
  z-index: 1;
}
@media (min-width: 992px) {
  .login-split { grid-template-columns: 1.05fr 1fr; }
}

.login-hero {
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}
.login-hero img {
  max-width: 100%;
  max-height: calc(100vh - 4rem);
  width: auto; height: auto;
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(2,44,40,.45);
}

.login-form {
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem 1.25rem 2rem;
}

.login-card {
  width: 100%; max-width: 430px; border: 0; border-radius: 22px;
  box-shadow: 0 25px 70px rgba(2,44,40,.35);
}
.login-card .card-body { padding: 2.5rem 2rem; }
.login-card .icon-box {
  width: 76px; height: 76px; border-radius: 22px;
  background: var(--brand-grad);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2.2rem; margin: 0 auto 1.1rem;
  box-shadow: 0 14px 30px rgba(13,148,136,.4);
}
@media (max-width: 480px) {
  .login-card .card-body { padding: 1.75rem 1.25rem; }
}

/* ===== Navbar ===== */
.navbar-brand-grad {
  background: var(--brand-grad);
  box-shadow: 0 4px 20px rgba(13,148,136,.25);
}
.navbar-brand-grad .navbar-brand {
  display: inline-flex; align-items: center; gap: .65rem;
  font-weight: 700; letter-spacing: .2px;
}
.navbar-brand-grad .brand-ico {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,.22);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
}
.navbar-brand-grad .nav-link { font-weight: 500; opacity: .9; transition: opacity .15s; }
.navbar-brand-grad .nav-link:hover, .navbar-brand-grad .nav-link.active { opacity: 1; }
.navbar-brand-grad .badge { background: rgba(255,255,255,.95) !important; color: var(--brand-1) !important; }

/* ===== Buttons ===== */
.btn-primary {
  background: var(--brand-grad);
  border: 0;
  color: #fff;
  box-shadow: 0 6px 18px rgba(13,148,136,.3);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background: var(--brand-grad);
  filter: brightness(.95);
  box-shadow: 0 8px 22px rgba(13,148,136,.42);
  color: #fff;
}
.btn-outline-primary { border-color: var(--brand-1); color: var(--brand-1); }
.btn-outline-primary:hover { background: var(--brand-1); border-color: var(--brand-1); color: #fff; }
.btn-outline-success { border-color: var(--brand-2); color: var(--brand-2); }
.btn-outline-success:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }

/* ===== Cards & forms ===== */
.card { border: 0; border-radius: 16px; box-shadow: 0 2px 10px rgba(15,23,42,.06); }
.card-header.bg-white { border-bottom: 1px solid var(--ink-100); border-radius: 16px 16px 0 0 !important; }
.form-control, .form-select { border-radius: 10px; border-color: var(--ink-300); }
.form-control:focus, .form-select:focus {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 .2rem rgba(13,148,136,.18);
}
.form-label { font-weight: 600; color: var(--ink-700); font-size: .9rem; }
.input-group-text { background: #fff; border-color: var(--ink-300); color: var(--brand-1); }

/* ===== Stat cards ===== */
.stat-card {
  border: 0; border-radius: 16px; color: #fff;
  position: relative; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
  box-shadow: 0 8px 24px rgba(15,23,42,.12);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(15,23,42,.18); }
.stat-card .card-body { padding: 1.25rem; position: relative; z-index: 1; }
.stat-card .stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .8px; opacity: .9; font-weight: 600; }
.stat-card .stat-value { font-size: 2.25rem; font-weight: 700; line-height: 1.1; margin-top: .25rem; }
.stat-card .stat-icon {
  position: absolute; top: 50%; right: 1rem; transform: translateY(-50%);
  font-size: 3.25rem; opacity: .25; line-height: 1;
}
.stat-total { background: var(--brand-grad); }
.stat-warn  { background: var(--state-warn); }
.stat-bad   { background: var(--state-bad); }
.stat-ok    { background: var(--state-ok); }

/* ===== Tables ===== */
.table thead th {
  background: var(--ink-100);
  color: var(--ink-700);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 700;
  border: 0;
}
.table tbody td { vertical-align: middle; }
.table-hover tbody tr:hover { background-color: rgba(13,148,136,.04); }

/* ===== Badges ===== */
.badge-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem .75rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; letter-spacing: .3px;
  color: #fff;
}
.badge-ok    { background: var(--state-ok); }
.badge-warn  { background: var(--state-warn); color: #fff; }
.badge-bad   { background: var(--state-bad); }
.badge-info  { background: var(--state-info); }
.badge-violet{ background: var(--grad-violet); }
.badge-soft  { background: var(--ink-100); color: var(--ink-700); }

/* ===== Section hero ===== */
.section-hero {
  height: 6px; border-radius: 6px 6px 0 0;
  background: var(--brand-grad); margin-bottom: 1rem;
}

/* ===== Mobile: tablas como tarjetas ===== */
@media (max-width: 767.98px) {
  .table-cards { background: transparent !important; }
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr {
    background: #fff;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    margin-bottom: .85rem;
    box-shadow: 0 2px 10px rgba(15,23,42,.07);
    border-left: 4px solid var(--brand-1);
  }
  .table-cards tr:hover { background: #fff; }
  .table-cards td {
    display: flex; justify-content: space-between; align-items: center;
    padding: .4rem 0; border: 0; gap: 1rem;
    text-align: right;
  }
  .table-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--ink-500);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .6px;
    text-align: left;
    flex-shrink: 0;
  }
  .table-cards td.cell-title {
    font-size: 1.05rem; font-weight: 700; color: var(--ink-900);
    padding-bottom: .6rem; margin-bottom: .35rem;
    border-bottom: 1px solid var(--ink-100);
    display: flex; justify-content: space-between; align-items: center;
  }
  .table-cards td.cell-title::before { content: ""; }
  .table-cards td.actions {
    justify-content: flex-end;
    padding-top: .75rem; margin-top: .5rem;
    border-top: 1px solid var(--ink-100);
    gap: .5rem;
  }
  .table-cards td.actions::before { content: ""; }
  .table-cards td.actions .btn { min-width: 42px; min-height: 38px; }
  .table-cards td.actions form { display: inline; }
}

/* ===== Modal QR ===== */
@media (max-width: 575.98px) {
  .modal-dialog { margin: 0; max-width: 100%; height: 100%; }
  .modal-content { border-radius: 0; min-height: 100vh; }
}
#qrCanvas { min-height: 260px; display: flex; align-items: center; justify-content: center; }
#qrCanvas canvas, #qrCanvas img { border-radius: 12px; box-shadow: 0 6px 18px rgba(15,23,42,.12); }

/* ===== Misc ===== */
.alert { border-radius: 12px; border: 0; box-shadow: 0 2px 8px rgba(15,23,42,.05); }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger  { background: #fef2f2; color: #991b1b; }
footer { color: var(--ink-500); }
code { color: var(--brand-1); background: rgba(13,148,136,.08); padding: 1px 6px; border-radius: 6px; }
