/* ORDOK — Growth System (light) */
:root {
  --bg-0: #F4FBF6;
  --bg-1: #EDF7F0;
  --bg-2: #E3F3E8;
  --bg-3: #DCFCE7;
  --surface: #FFFFFF;
  --surface-2: #F7FCF8;
  --surface-3: #EFFAF2;
  --border: rgba(11,31,20,0.09);
  --border-2: rgba(11,31,20,0.16);
  --mint: #16A34A;
  --mint-soft: rgba(34,197,94,0.14);
  --mint-glow: rgba(34,197,94,0.35);
  --aqua: #0D9488;
  --cyan: #0284C7;
  --amber: #B45309;
  --orange: #C2410C;
  --red: #DC2626;
  --green: #16A34A;
  --text-0: #0B1F14;
  --text-1: #33453A;
  --text-2: #5B6B62;
  --text-3: #85958B;
  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 22px;
  --radius-xl: 28px;
  --radius-pill: 999px;
  --shadow-soft: 0 1px 0 rgba(255,255,255,0.6) inset, 0 30px 60px -30px rgba(11,31,20,0.16);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.7) inset, 0 24px 48px -28px rgba(11,31,20,0.16), 0 0 0 1px rgba(11,31,20,0.05);
  --shadow-float: 0 1px 0 rgba(255,255,255,0.7) inset, 0 40px 80px -30px rgba(11,31,20,0.22);
  --font-sans: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  /* legacy aliases */
  --gray-txt: #5B6B62;
  --gray-bdr: rgba(11,31,20,0.12);
  --gray-bg: #EDF7F0;
  --danger: #DC2626;
  --green-dark: #16A34A;
  --green-mid: #22C55E;
  --green-lite: rgba(34,197,94,0.16);
  --green-bg: rgba(34,197,94,0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--text-0);
  background: var(--bg-0);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  font-feature-settings: 'ss01', 'ss02';
  overflow-x: hidden;
}

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

/* atmospheric background */
.atmosphere {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(34,197,94,0.10), transparent 60%),
    radial-gradient(700px 500px at 92% 8%, rgba(13,148,136,0.07), transparent 60%),
    radial-gradient(1100px 700px at 60% 110%, rgba(2,132,199,0.05), transparent 60%),
    linear-gradient(180deg, #F7FCF8 0%, #F4FBF6 45%, #ECF7EF 100%);
}
.atmosphere::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(11,31,20,0.035) 0 1px, transparent 1px),
    radial-gradient(circle at 60% 70%, rgba(11,31,20,0.035) 0 1px, transparent 1px);
  background-size: 24px 24px, 32px 32px;
  opacity: 0.5;
}

/* layout */
.app {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  padding: 22px 16px 18px;
  display: flex; flex-direction: column; gap: 18px;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.75), rgba(255,255,255,0.55) 100%),
    rgba(255,255,255,0.001);
  backdrop-filter: blur(20px);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 14px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  background:
    radial-gradient(circle at 30% 25%, rgba(34,197,94,0.55), transparent 60%),
    linear-gradient(135deg, rgba(34,197,94,0.18), rgba(13,148,136,0.05));
  border: 1px solid rgba(34,197,94,0.35);
  box-shadow: 0 0 22px -2px rgba(34,197,94,0.35), inset 0 1px 0 rgba(255,255,255,0.1);
  display: grid; place-items: center;
  color: var(--mint);
}
.brand-name {
  font-weight: 600; font-size: 17px; letter-spacing: -0.02em;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.22em;
  color: var(--text-2);
}
.nav-section-label {
  font-family: var(--font-mono);
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.22em;
  color: var(--text-3);
  padding: 4px 12px 6px;
}
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; padding-right: 2px;}
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: rgba(11,31,20,0.14); border-radius: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--text-1);
  cursor: pointer;
  font-size: 14px;
  border: 1px solid transparent;
  transition: all .22s ease;
  position: relative;
  text-decoration: none;
}
.nav-item .ic { width: 18px; height: 18px; opacity: .85; }
.nav-item:hover {
  background: var(--surface);
  color: var(--text-0);
  border-color: var(--border);
  text-decoration: none;
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(34,197,94,0.18), rgba(34,197,94,0.07));
  color: var(--mint);
  border-color: rgba(34,197,94,0.30);
  box-shadow: 0 8px 26px -10px rgba(34,197,94,0.40), inset 0 1px 0 rgba(255,255,255,0.06);
}
.nav-item.active .ic { color: var(--mint); opacity: 1; }
.nav-item .chevron {
  margin-left: auto; opacity: .5; transition: transform .2s ease;
}
.nav-item.open .chevron { transform: rotate(90deg); opacity: .9; }
.submenu {
  display: flex; flex-direction: column; gap: 2px;
  padding: 4px 0 4px 30px;
  margin-left: 14px;
  border-left: 1px dashed rgba(11,31,20,0.14);
  overflow: hidden;
}
.submenu .nav-item { padding: 8px 12px; font-size: 13px; color: var(--text-2); }
.submenu .nav-item.active {
  background: transparent;
  color: var(--mint);
  border-color: transparent;
  box-shadow: none;
}
.submenu .nav-item.active::before {
  content: ""; position: absolute; left: -30px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 12px var(--mint-glow);
}
.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(34,197,94,0.20), rgba(34,197,94,0.07));
  border: 1px solid var(--border-2);
  display: grid; place-items: center;
  font-size: 12px; color: var(--text-1);
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-footer .meta { display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-footer .meta .name { font-size: 13px; color: var(--text-0); }
.sidebar-footer .meta .role {
  font-family: var(--font-mono); font-size: 9.5px;
  color: var(--text-2); letter-spacing: 0.18em; text-transform: uppercase;
}

/* MAIN */
.main { min-width: 0; padding: 0 32px 60px; position: relative; z-index: 1; }

.topbar {
  position: sticky; top: 14px; z-index: 5;
  margin-top: 18px;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px;
  border-radius: 22px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-card);
}
.topbar-title { display: flex; flex-direction: column; }
.topbar-title .crumbs {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--text-3);
}
.topbar-title h1 {
  margin: 2px 0 0; font-size: 17px; font-weight: 600; letter-spacing: -0.02em;
}
.topbar .env {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.env-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(11,31,20,0.035);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-1);
  letter-spacing: 0.04em;
}
.env-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 10px var(--mint-glow);}
.env-chip .label { color: var(--text-3); text-transform: uppercase; font-size: 9.5px; letter-spacing: 0.16em; }
.env-chip .val { color: var(--text-0); }
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-1);
  cursor: pointer; transition: all .18s ease;
  position: relative;
}
.icon-btn:hover { color: var(--text-0); background: var(--surface-2); }
.icon-btn .dot-notif {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--mint); box-shadow: 0 0 8px var(--mint-glow);
}
.profile-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.profile-pill .avatar { width: 28px; height: 28px; font-size: 11px; }
.profile-pill .meta { display: flex; flex-direction: column; line-height: 1.25; }
.profile-pill .meta .name { font-size: 12.5px; color: var(--text-0); }
.profile-pill .meta .role { font-size: 8.5px; color: var(--text-2); font-family: var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; }

/* Page */
.page {
  margin-top: 22px;
  display: flex; flex-direction: column; gap: 20px;
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  margin-bottom: 4px;
}
.page-head h2 {
  margin: 0; font-size: 30px; font-weight: 500; letter-spacing: -0.03em;
  line-height: 1.05;
}
.page-head .h-meta {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-3); letter-spacing: 0.18em; text-transform: uppercase;
  margin-bottom: 4px;
}
.page-head p {
  margin: 8px 0 0; color: var(--text-2); font-size: 14px; max-width: 60ch;
}
.page-actions { display: flex; gap: 10px; }

/* surfaces */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-card);
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.card.glow::before {
  content: ""; position: absolute; inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(34,197,94,0.25), transparent 30%, transparent 70%, rgba(13,148,136,0.18));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  padding: 1px; pointer-events: none;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.card-head h3 {
  margin: 0; font-size: 15px; font-weight: 500;
  letter-spacing: -0.01em;
}
.card-head .h-meta {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-3); letter-spacing: 0.18em; text-transform: uppercase;
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  font: inherit; font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-0);
  transition: all .18s ease;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-2); text-decoration: none; color: var(--text-0); }
.btn.primary {
  background: linear-gradient(135deg, rgba(34,197,94,0.85), rgba(13,148,136,0.85));
  color: #FFFFFF;
  border-color: rgba(34,197,94,0.4);
  font-weight: 600;
  box-shadow: 0 12px 30px -10px rgba(34,197,94,0.45), inset 0 1px 0 rgba(255,255,255,0.4);
}
.btn.primary:hover { filter: brightness(1.05); transform: translateY(-1px); color: #FFFFFF; }
.btn.ghost { background: transparent; }
.btn.danger { color: #DC2626; border-color: rgba(220,38,38,0.25); }
.btn.danger:hover { background: rgba(220,38,38,0.08); }

/* form */
.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-3);
}
.input, .select, .textarea {
  font: inherit; font-size: 14px;
  color: var(--text-0);
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(11,31,20,0.035);
  border: 1px solid var(--border);
  transition: all .18s ease;
  outline: none;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(34,197,94,0.45);
  background: rgba(34,197,94,0.04);
  box-shadow: 0 0 0 4px rgba(34,197,94,0.08), 0 0 24px -6px rgba(34,197,94,0.25);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 96px; }

/* tags / chips / pills */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-1);
}
.chip .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.chip.mint { color: var(--mint); border-color: rgba(34,197,94,0.30); background: rgba(34,197,94,0.07); }
.chip.aqua { color: var(--aqua); border-color: rgba(13,148,136,0.30); background: rgba(13,148,136,0.07); }
.chip.cyan { color: var(--cyan); border-color: rgba(2,132,199,0.30); background: rgba(2,132,199,0.07); }
.chip.amber { color: var(--amber); border-color: rgba(180,83,9,0.30); background: rgba(180,83,9,0.07); }
.chip.orange { color: var(--orange); border-color: rgba(194,65,12,0.30); background: rgba(194,65,12,0.07); }
.chip.red { color: var(--red); border-color: rgba(220,38,38,0.30); background: rgba(220,38,38,0.07); }
.chip.muted { color: var(--text-3); }

/* tables */
.table {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.table td {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(11,31,20,0.07);
  color: var(--text-1);
  vertical-align: middle;
}
.table tr:hover td { background: rgba(11,31,20,0.02); }
.table tr:last-child td { border-bottom: none; }

/* misc */
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-2); }
.grid { display: grid; gap: 18px; }
.row { display: flex; gap: 12px; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* mobile */
.hamburger { display: none; }
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 280px;
    transform: translateX(-100%); transition: transform .3s ease; z-index: 50;
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: grid; }
  .main { padding: 0 18px 60px; }
  .topbar .env { display: none; }
}

/* animation */
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
@keyframes float-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.float-in { animation: float-in .5s ease both; }
.float-in.d1 { animation-delay: .04s; }
.float-in.d2 { animation-delay: .08s; }
.float-in.d3 { animation-delay: .12s; }
.float-in.d4 { animation-delay: .16s; }
.float-in.d5 { animation-delay: .20s; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 10px var(--mint-glow); animation: pulse-soft 2s ease-in-out infinite;}

/* KPI sparklines */
.spark { width: 100%; height: 42px; }

/* organic curve decoration */
.orb {
  position: absolute; border-radius: 50%; pointer-events: none;
  filter: blur(40px); opacity: .35;
}

/* ══════════════════════════════════════════════════
   BACKWARD-COMPATIBLE CLASSES (for existing templates)
   ══════════════════════════════════════════════════ */

/* Button aliases */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  font: inherit; font-size: 13px; cursor: pointer;
  background: linear-gradient(135deg, rgba(34,197,94,0.85), rgba(13,148,136,0.85));
  color: #FFFFFF; border: 1px solid rgba(34,197,94,0.4);
  font-weight: 600;
  box-shadow: 0 12px 30px -10px rgba(34,197,94,0.45), inset 0 1px 0 rgba(255,255,255,0.4);
  transition: all .18s ease; text-decoration: none;
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); color: #FFFFFF; text-decoration: none; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  font: inherit; font-size: 13px; cursor: pointer;
  background: transparent; color: var(--text-0);
  border: 1px solid var(--border);
  transition: all .18s ease; text-decoration: none;
}
.btn-outline:hover { background: var(--surface-2); border-color: var(--border-2); text-decoration: none; }

.btn-danger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  font: inherit; font-size: 13px; cursor: pointer;
  background: var(--surface); color: var(--red);
  border: 1px solid rgba(220,38,38,0.25);
  transition: all .18s ease; text-decoration: none;
}
.btn-danger:hover { background: rgba(220,38,38,0.08); text-decoration: none; }

.btn-warning {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  font: inherit; font-size: 13px; cursor: pointer;
  background: var(--surface); color: var(--amber);
  border: 1px solid rgba(180,83,9,0.25);
  transition: all .18s ease; text-decoration: none;
}
.btn-warning:hover { background: rgba(180,83,9,0.08); text-decoration: none; }

.btn-sm { padding: 7px 14px; font-size: 12px; }

/* <summary> estilizado como botón (toggle de <details>), sin flecha nativa */
summary.btn-outline { list-style: none; justify-content: center; }
summary.btn-outline::-webkit-details-marker,
summary.btn-outline::marker { display: none; content: ""; }

/* Badge aliases */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-1);
}
.badge-green { color: var(--mint); border-color: rgba(34,197,94,0.30); background: rgba(34,197,94,0.07); }
.badge-gray  { color: var(--text-3); background: var(--surface); border-color: var(--border); }
.badge-admin { color: var(--amber); border-color: rgba(180,83,9,0.30); background: rgba(180,83,9,0.07); }
.badge-red   { color: var(--red); border-color: rgba(220,38,38,0.30); background: rgba(220,38,38,0.07); }

/* Page title */
.page-title {
  font-size: 26px; font-weight: 500; letter-spacing: -0.03em;
  color: var(--text-0); margin-bottom: 1.25rem;
}

/* Text muted */
.text-muted { color: var(--text-2); font-size: .85rem; }

/* Alerts */
.alert {
  padding: .85rem 1.1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-size: .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-1);
}
.alert-success {
  background: rgba(34,197,94,0.06);
  border: 1px solid rgba(34,197,94,0.20);
  border-left: 4px solid var(--mint);
  color: var(--mint);
}
.alert-error {
  background: rgba(220,38,38,0.06);
  border: 1px solid rgba(220,38,38,0.20);
  border-left: 4px solid var(--red);
  color: var(--red);
}
.alert-info {
  background: rgba(2,132,199,0.06);
  border: 1px solid rgba(2,132,199,0.20);
  border-left: 4px solid var(--cyan);
  color: var(--cyan);
}

/* Form groups */
.form-group {
  display: flex; flex-direction: column; gap: 7px;
  margin-bottom: 1rem;
}
.form-group label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-3);
}

/* Inputs (global — applied to bare input/select/textarea too) */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="email"],
select,
textarea {
  font: inherit; font-size: 14px;
  color: var(--text-0);
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(11,31,20,0.035);
  border: 1px solid var(--border);
  transition: all .18s ease;
  outline: none;
  width: 100%;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="tel"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  border-color: rgba(34,197,94,0.45);
  background: rgba(34,197,94,0.04);
  box-shadow: 0 0 0 4px rgba(34,197,94,0.08), 0 0 24px -6px rgba(34,197,94,0.25);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { resize: vertical; min-height: 80px; }
label { display: block; font-size: .85rem; font-weight: 500; color: var(--text-1); margin-bottom: .3rem; }
select option { background: var(--bg-2); color: var(--text-0); }

/* Checklist items */
.check-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .75rem;
  border-radius: 10px;
  margin-bottom: .4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-1);
}
.check-item.done {
  background: rgba(34,197,94,0.06);
  border-color: rgba(34,197,94,0.20);
  color: var(--mint);
}
.check-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--mint); cursor: pointer; }

/* Table wrap */
.table-wrap { overflow-x: auto; }

/* Legacy table (bare table tags without .table class) */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  background: transparent;
}
td {
  padding: 14px 14px;
  border-bottom: 1px solid rgba(11,31,20,0.07);
  color: var(--text-1);
  vertical-align: middle;
}
tr:hover td { background: rgba(11,31,20,0.02); }
tr:last-child td { border-bottom: none; }

/* Card title */
.card-title {
  font-size: 14px; font-weight: 500; color: var(--text-1);
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem; margin-bottom: 1rem;
  letter-spacing: 0.01em;
}

/* Layout fallback */
.layout { display: flex; min-height: calc(100vh - 52px); }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
  border-top: 2px solid rgba(34,197,94,0.35);
  position: relative; overflow: hidden;
}
.stat-card .num { font-size: 2rem; font-weight: 700; color: var(--text-0); }
.stat-card .lbl { font-size: .78rem; color: var(--text-2); margin-top: .2rem; font-family: var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; }

/* Sidebar overlay */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 49;
}
.sidebar-overlay.open { display: block; }

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
  background: transparent;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-float);
  padding: 2.5rem 2rem;
  width: 100%; max-width: 380px;
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo h1 {
  font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em;
  color: var(--text-0); margin: 0;
}
.login-logo p { font-size: .85rem; color: var(--text-2); margin-top: .4rem; }

/* Helpers */
.flex  { display: flex; align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.mt-1  { margin-top: .5rem; }
.mt-2  { margin-top: 1rem; }
.mb-1  { margin-bottom: .5rem; }
.mb-2  { margin-bottom: 1rem; }
.text-right { text-align: right; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* Calendar */
.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .6rem;
}
.cal-nav-title { font-weight: 600; font-size: 1rem; color: var(--text-0); }
.cal-grid-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.2rem;
  padding: 0 0.2rem;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(78px, 1fr));
  gap: 3px;
}
.cal-head {
  text-align: center;
  font-family: var(--font-mono); font-size: .65rem; font-weight: 600;
  color: var(--text-3);
  padding: .2rem 0 .35rem;
  letter-spacing: .12em; text-transform: uppercase;
}
.cal-day {
  min-height: 60px;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: flex-start;
  padding: .3rem .4rem; gap: 2px;
  border-radius: 10px;
  font-size: .82rem; font-weight: 500;
  text-decoration: none; color: var(--text-1);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background .12s, border-color .12s;
  cursor: pointer; vertical-align: top;
}
.cal-day .cal-num { font-size: .82rem; font-weight: 600; line-height: 1.4; }
.cal-day.vacio { background: transparent; border-color: transparent; pointer-events: none; }
.cal-day.futuro { color: var(--text-3); background: rgba(11,31,20,0.02); border-color: var(--border); }
.cal-day.registrado .cal-num { color: var(--mint); font-weight: 700; }
.cal-day.hoy {
  border-color: rgba(34,197,94,0.50); border-width: 1.5px;
  box-shadow: 0 0 18px -6px var(--mint-glow);
}
.cal-day.hoy .cal-num { color: var(--mint); font-weight: 700; }
.cal-day.hoy.registrado { background: rgba(34,197,94,0.10); }
.cal-day:not(.vacio):not(.futuro):hover { background: var(--surface-2); border-color: var(--border-2); }
.cal-pill {
  font-size: .6rem; font-family: var(--font-mono);
  background: rgba(180,83,9,0.18); color: var(--amber);
  border-radius: 4px; padding: 1px 5px;
  width: 100%; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; line-height: 1.5;
  border: 1px solid rgba(180,83,9,0.20);
}
.cal-pill-done {
  background: rgba(34,197,94,0.12); color: var(--mint);
  border-color: rgba(34,197,94,0.20);
}
.cal-pill-vencida {
  background: rgba(220,38,38,0.12); color: var(--red);
  border-color: rgba(220,38,38,0.20);
}
.cal-pill-simple {
  background: rgba(2,132,199,0.10); color: var(--cyan);
  border-color: rgba(2,132,199,0.20);
}

/* Período cards */
.periodo-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .75rem;
  margin-bottom: .6rem;
  background: var(--surface);
}
.periodo-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: .5rem;
}
.periodo-fechas {
  font-size: .78rem; color: var(--text-2); margin-top: .15rem;
  font-family: var(--font-mono);
}

/* Scrollbar global */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(11,31,20,0.14); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(11,31,20,0.22); }

/* ══════════════════════════════════════════════════
   RESPONSIVE LAYOUT UTILITIES
   ══════════════════════════════════════════════════ */

/* Main "form + list" side-by-side layout */
.layout-form-list {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 1rem;
  align-items: start;
}
.layout-form-list-narrow {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1rem;
  align-items: start;
}

/* Generic 2-column grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.grid-2-sm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}

/* 4-column params grid */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .4rem;
}

/* Retiro/retorno item row: select + number + delete btn */
.retiro-item {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: .4rem;
  margin-bottom: .4rem;
  align-items: center;
}

/* ══════════════════════════════════════════════════
   MOBILE BREAKPOINT ≤ 600px
   ══════════════════════════════════════════════════ */
@media (max-width: 600px) {
  /* Main layouts stack vertically */
  .layout-form-list,
  .layout-form-list-narrow { grid-template-columns: 1fr; }

  /* 2-col grids: stack most of them */
  .grid-2 { grid-template-columns: 1fr; }

  /* Small 2-col (form field pairs): keep side by side */
  /* .grid-2-sm stays as-is */

  /* 4-col params: 2×2 */
  .grid-4 { grid-template-columns: 1fr 1fr; }

  /* Retiro item row: select full width, number + btn side by side */
  .retiro-item {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }
  .retiro-item select { grid-column: 1 / -1; }

  /* Tables: allow horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Page title smaller on mobile */
  .page-title { font-size: 1.3rem; }

  /* Cards: reduce padding */
  .card { padding: .85rem .9rem; }

  /* Topbar: hide page subtitle on very small screens */
  .topbar-sub { display: none; }
}

/* ══════════════════════════════════════════════════
   VISUAL HIERARCHY SYSTEM
   ══════════════════════════════════════════════════ */

/* --- Typography scale --- */
.h-screen {
  font-size: 28px; font-weight: 600; letter-spacing: -0.03em;
  color: var(--text-0); line-height: 1.1; margin: 0;
}
.h-block {
  font-size: 13px; font-weight: 600; letter-spacing: 0.01em;
  color: var(--text-1); margin: 0;
}
.h-label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-3);
}
.h-caption { font-size: 12px; color: var(--text-3); }

/* --- Page hero: context header above content --- */
.page-hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.page-hero .hero-left { display: flex; flex-direction: column; gap: 4px; }
.page-hero .hero-eyebrow {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--text-3);
}
.page-hero .hero-title {
  font-size: 26px; font-weight: 600; letter-spacing: -0.03em;
  color: var(--text-0); margin: 0; line-height: 1.1;
}
.page-hero .hero-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* --- Block separator (section within a card) --- */
.block-sep {
  border: none; border-top: 1px solid var(--border);
  margin: 18px 0;
}
.block-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 14px;
}
.block-head .bh-title {
  font-size: 12px; font-weight: 600; color: var(--text-2);
  letter-spacing: 0.04em; text-transform: uppercase;
  font-family: var(--font-mono);
}
.block-head .bh-action { flex-shrink: 0; }

/* --- Status block: prominent state indicator --- */
.status-block {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 16px;
}
.status-block .sb-icon {
  font-size: 22px; flex-shrink: 0; line-height: 1;
}
.status-block .sb-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.status-block .sb-label {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3);
}
.status-block .sb-value {
  font-size: 15px; font-weight: 600; color: var(--text-0);
}
.status-block.ok {
  background: rgba(34,197,94,0.06);
  border-color: rgba(34,197,94,0.2);
}
.status-block.ok .sb-value { color: var(--mint); }
.status-block.pending {
  background: rgba(180,83,9,0.06);
  border-color: rgba(180,83,9,0.2);
}
.status-block.pending .sb-value { color: var(--amber); }
.status-block.alert {
  background: rgba(220,38,38,0.06);
  border-color: rgba(220,38,38,0.2);
}
.status-block.alert .sb-value { color: var(--red); }

/* --- CTA strip: primary action area --- */
.cta-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 12px;
  background: rgba(34,197,94,0.05);
  border: 1px solid rgba(34,197,94,0.18);
  margin-bottom: 16px;
}
.cta-strip .cta-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cta-strip .cta-label {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--mint);
  opacity: 0.7;
}
.cta-strip .cta-text { font-size: 13px; font-weight: 500; color: var(--text-1); }

/* --- Stat cards: operational dashboard --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi-card {
  padding: 16px 18px;
  border-radius: var(--radius-m);
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--kpi-color, var(--mint));
  opacity: 0.5;
}
.kpi-card .kpi-num {
  font-size: 28px; font-weight: 700; color: var(--text-0);
  letter-spacing: -0.03em; line-height: 1;
}
.kpi-card .kpi-lbl {
  font-size: 11px; color: var(--text-3); margin-top: 5px;
  font-family: var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase;
}
.kpi-card .kpi-sub {
  font-size: 11px; color: var(--text-2); margin-top: 3px;
}
.kpi-card.kpi-alert { --kpi-color: var(--red); }
.kpi-card.kpi-warn  { --kpi-color: var(--amber); }
.kpi-card.kpi-ok    { --kpi-color: var(--mint); }
.kpi-card.kpi-muted { --kpi-color: var(--text-3); }

/* --- Action hierarchy: primary / secondary / danger --- */
.action-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
/* Make danger buttons less visually prominent */
.btn-danger {
  font-size: 11px !important; padding: 5px 10px !important;
  opacity: 0.6;
}
.btn-danger:hover { opacity: 1; }

/* --- Sala card header (control de sala) --- */
.sala-card-head {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.sala-card-head .sc-name {
  font-size: 18px; font-weight: 700; color: var(--text-0);
  letter-spacing: -0.02em;
}
.sala-card-head .sc-meta {
  font-size: 12px; color: var(--text-3); margin-top: 3px;
}

@media (max-width: 600px) {
  .page-hero { flex-direction: column; align-items: flex-start; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .h-screen { font-size: 22px; }
}

/* ══════════════════════════════════════════════════
   BOTTOM NAV (mobile) — 5 items, center one raised
   ══════════════════════════════════════════════════ */
.bottom-nav { display: none; }

@media (max-width: 980px) {
  .bottom-nav {
    display: flex; justify-content: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: 0 10px calc(16px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
  }
  .bottom-nav-inner {
    pointer-events: auto;
    width: 100%; max-width: 420px;
    background: rgba(255,255,255,0.86);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: 0 12px 30px -12px rgba(11,31,20,0.22);
    display: flex; align-items: flex-end; justify-content: space-between;
    padding: 8px 10px;
  }
  .bn-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 4px; min-width: 0; width: 20%;
    border-radius: 12px;
    color: var(--text-3);
    text-decoration: none;
  }
  .bn-item:hover { text-decoration: none; }
  .bn-item svg { width: 21px; height: 21px; flex-shrink: 0; }
  .bn-item span {
    display: block; max-width: 100%;
    font-size: 9.5px; font-weight: 600; letter-spacing: 0.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-align: center;
  }
  .bn-item.active { color: var(--mint); }

  .bn-center-wrap {
    display: flex; flex-direction: column; align-items: center;
    width: 20%; transform: translateY(-20px);
    text-decoration: none;
  }
  .bn-center-wrap:hover { text-decoration: none; }
  .bn-center {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(150deg, var(--mint-glow, var(--mint)), var(--mint));
    background: linear-gradient(150deg, #22C55E, #16A34A);
    box-shadow: 0 10px 22px -6px rgba(22,163,74,0.55), inset 0 1px 0 rgba(255,255,255,0.35);
    display: flex; align-items: center; justify-content: center;
    border: 4px solid var(--bg-0);
  }
  .bn-center svg { width: 23px; height: 23px; color: #fff; }
  .bn-center-label {
    font-size: 9.5px; font-weight: 700; color: var(--text-3);
    margin-top: 3px;
  }
  .bn-center.active ~ .bn-center-label { color: var(--mint); }

  /* keep content clear of the floating bar */
  .main { padding-bottom: 110px; }
}
