/* ============================================================================
 * CaseroNet v0.4 — Hoja de estilos responsive
 * Sistema: 8pt grid, sky-500 como color primario, tipografía escalada
 * ============================================================================ */
:root {
  --bg: #f8fafc;
  --bg2: #ffffff;
  --bg3: #f1f5f9;
  --border: #e2e8f0;
  --border2: #cbd5e1;
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --accent: #0ea5e9;
  --accent-dark: #0284c7;
  --accent-light: #e0f2fe;
  --accent-bg: #f0f9ff;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --purple: #7c3aed;
  --purple-bg: #faf5ff;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.06);
  --nav-w: 260px;
  --topbar-h: 56px;
  --bottomnav-h: 64px;
}
[data-theme="dark"] {
  --bg: #0b1220;
  --bg2: #111a2c;
  --bg3: #1a2438;
  --border: #1f2a44;
  --border2: #2c3a5a;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #64748b;
  --accent-light: #0c4a6e;
  --accent-bg: #082f49;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 15px; margin: 0 0 10px; font-weight: 600; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; }
p  { margin: 0 0 8px; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
input, select, textarea {
  font-family: inherit; font-size: 14px;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ---------- Login (sin cambios grandes) ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 32px;
}
.login-card .logo {
  font-size: 28px; text-align: center; margin-bottom: 4px;
  font-weight: 800; letter-spacing: -0.02em;
}
.login-card .sub {
  text-align: center; color: var(--text2);
  font-size: 13px; margin-bottom: 24px;
}

/* ============================================================================
 * LAYOUT PRINCIPAL — responsive shell
 * ============================================================================ */
.app-shell {
  min-height: 100vh;
  padding-top: var(--topbar-h);
  padding-bottom: var(--bottomnav-h);
}
@media (min-width: 1024px) {
  .app-shell { padding-left: var(--nav-w); padding-bottom: 0; }
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 12px; gap: 8px;
}
@media (min-width: 1024px) { .topbar { padding: 0 20px; } }

.topbar .burger {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: none; background: transparent;
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text);
}
.topbar .burger:hover { background: var(--bg3); }
@media (min-width: 1024px) { .topbar .burger { display: none; } }

.topbar .brand {
  display: flex; align-items: center; gap: 10px;
  margin-right: 16px;
}
.topbar .brand .logo-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 15px;
  box-shadow: var(--shadow-sm);
}
.topbar .brand .name { font-weight: 800; font-size: 15px; letter-spacing: -0.02em; }
.topbar .brand .ver { font-size: 10px; color: var(--text3); line-height: 1; }
@media (max-width: 640px) {
  .topbar .brand .name, .topbar .brand .ver { display: none; }
}

.topbar .search-btn {
  flex: 1; max-width: 480px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3);
  border: none; border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 13px;
  color: var(--text2); cursor: pointer;
  transition: background .15s;
}
.topbar .search-btn:hover { background: var(--border); }
.topbar .search-btn .kbd {
  margin-left: auto;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px; font-family: monospace;
}
@media (max-width: 767px) {
  .topbar .search-btn span:not(.kbd) { display: none; }
  .topbar .search-btn { flex: 0; padding: 8px; }
  .topbar .search-btn .kbd { display: none; }
}

.topbar .actions {
  margin-left: auto;
  display: flex; align-items: center; gap: 4px;
}
.topbar .icon-btn {
  position: relative;
  width: 36px; height: 36px;
  background: transparent; border: none;
  border-radius: var(--radius-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
}
.topbar .icon-btn:hover { background: var(--bg3); }
.topbar .icon-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%;
  border: 2px solid var(--bg2);
}
.topbar .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-light); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  border: none; cursor: pointer; margin-left: 4px;
}
.topbar .avatar:hover { background: var(--accent); color: white; }

/* ---------- Sidebar / drawer ---------- */
.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 35;
  width: var(--nav-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 8px;
  transform: translateX(-100%);
  transition: transform .2s ease;
}
.sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
@media (min-width: 1024px) { .sidebar { transform: translateX(0); } }

.sidebar-overlay {
  display: none;
  position: fixed; top: var(--topbar-h); left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.4);
  z-index: 34;
}
.sidebar-overlay.on { display: block; }
@media (min-width: 1024px) { .sidebar-overlay { display: none !important; } }

.nav-group { margin-bottom: 16px; }
.nav-group .grp-title {
  font-size: 10px; font-weight: 700;
  color: var(--text3);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 12px; margin-bottom: 2px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--text2); font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.on {
  background: var(--accent-bg);
  color: var(--accent-dark);
  font-weight: 600;
}
.nav-item .ic { width: 18px; text-align: center; }

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  height: var(--bottomnav-h);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
@media (min-width: 1024px) { .bottomnav { display: none; } }
.bottomnav .item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  background: transparent; border: none;
  color: var(--text3);
  font-size: 10px; font-weight: 600;
  cursor: pointer;
  padding: 4px;
}
.bottomnav .item.on { color: var(--accent-dark); }
.bottomnav .item .ic { font-size: 20px; line-height: 1; }

/* ---------- Main content ---------- */
.main-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px;
}
@media (min-width: 640px) { .main-wrap { padding: 24px; } }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text3);
  margin-bottom: 12px;
  overflow-x: auto; white-space: nowrap;
}
.breadcrumb .crumb {
  background: none; border: none;
  color: var(--text3); font-size: 12px; cursor: pointer;
  padding: 0;
}
.breadcrumb .crumb:hover { color: var(--text); }
.breadcrumb .crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.breadcrumb .sep { color: var(--text3); }

/* ---------- Page header ---------- */
.pg-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.pg-header .title h1 { margin: 0 0 2px; }
.pg-header .title .sub { color: var(--text2); font-size: 13px; margin: 0; }
.pg-header .actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
@media (min-width: 640px) { .card { padding: 20px; } }
.card + .card { margin-top: 12px; }
.card.compact { padding: 12px; }
.card.hover { cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.card.hover:hover { border-color: var(--accent); box-shadow: var(--shadow); }

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

/* ---------- KPI grid ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
@media (min-width: 1024px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; } }
.kpi {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.kpi .lbl {
  font-size: 10px; font-weight: 700;
  color: var(--text3);
  letter-spacing: .06em; text-transform: uppercase;
  margin-bottom: 4px;
  display: flex; justify-content: space-between; align-items: center;
}
.kpi .val {
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.kpi .val.green  { color: var(--success); }
.kpi .val.red    { color: var(--danger); }
.kpi .val.accent { color: var(--accent); }
.kpi .sub {
  font-size: 12px; color: var(--text2);
  margin-top: 4px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg3); }
.btn.btnp {
  background: var(--accent); border-color: var(--accent);
  color: white;
}
.btn.btnp:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.btns { background: transparent; border-color: var(--border); }
.btn.btnd { background: var(--danger); border-color: var(--danger); color: white; }
.btn.btnd:hover { background: #b91c1c; border-color: #b91c1c; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn-inline {
  background: transparent; border: none; cursor: pointer;
  padding: 6px; border-radius: 6px;
  color: var(--text3);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn-inline:hover { background: var(--bg3); color: var(--accent); }
.icon-btn-inline.danger:hover { color: var(--danger); }

/* ---------- Sistema de iconos SVG (Lucide) ---------- */
.ic-svg {
  display: inline-block; vertical-align: middle;
  flex-shrink: 0; stroke: currentColor;
}
.ic-svg + span, .ic-svg + * { margin-left: 6px; }

/* Contenedor tipo "avatar" para iconos en KPIs y headers (estilo demo) */
.icon-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
}
.icon-badge.lg { width: 48px; height: 48px; border-radius: 12px; }
.icon-badge.sky {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: white;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,.05);
}
.icon-badge.slate { background: #f1f5f9; color: #64748b; }
.icon-badge.green { background: #dcfce7; color: #166534; }
.icon-badge.amber { background: #fef3c7; color: #b45309; }
.icon-badge.red   { background: #fee2e2; color: #b91c1c; }
.icon-badge.blue  { background: #dbeafe; color: #1d4ed8; }

/* KPI estilo demo (icono a la izquierda, contenido a la derecha) */
.kpi-lucide {
  display: flex; align-items: flex-start; gap: 10px;
}
.kpi-lucide .kpi-icon { flex-shrink: 0; margin-top: 2px; }
.kpi-lucide .kpi-body { flex: 1; min-width: 0; }
.kpi-lucide .lbl { display: flex; align-items: center; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text3); font-weight: 600; }
.kpi-lucide .val { font-size: 22px; font-weight: 700; line-height: 1.1; margin-top: 4px; }
.kpi-lucide .val.green { color: #16a34a; }
.kpi-lucide .val.red   { color: #dc2626; }
.kpi-lucide .sub { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* ---------- Botones-link discretos ---------- */
.link-add {
  background: transparent; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 6px; border-radius: 6px;
  color: var(--accent); font-size: 13px; font-weight: 600;
}
.link-add:hover { background: var(--bg3); }
/* Enlace inquilino dentro de tarjeta de habitación */
.tenant-link {
  background: transparent; border: none; cursor: pointer;
  color: var(--accent); font-weight: 500; padding: 0;
  font-size: inherit;
}
.tenant-link:hover { text-decoration: underline; }

/* ---------- Badges ---------- */
.bdg {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  font-size: 11px; font-weight: 600;
  border-radius: 6px;
  background: var(--bg3); color: var(--text2);
  white-space: nowrap;
}
.bdg.g { background: #dcfce7; color: #166534; }
.bdg.r { background: #fee2e2; color: #991b1b; }
.bdg.o { background: #fed7aa; color: #9a3412; }
.bdg.b { background: #dbeafe; color: #1e40af; }
.bdg.p { background: #e9d5ff; color: #6b21a8; }
.bdg.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; }

/* ---------- Alerts ---------- */
.alert {
  display: flex; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 10px;
}
.alert .alert-body { flex: 1; }
.alert .alert-cta {
  background: none; border: none;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.alert.red   { background: var(--danger-bg);  color: #991b1b; }
.alert.amber { background: var(--warn-bg);    color: #92400e; }
.alert.blue  { background: #eff6ff;           color: #1e40af; }
.alert.green { background: var(--success-bg); color: #166534; }
.alert.purple{ background: var(--purple-bg);  color: #6b21a8; }
.alert .alert-cta { color: inherit; }

.info-box {
  background: var(--accent-bg);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

.err {
  background: var(--danger-bg); color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 10px;
}
.ok {
  background: var(--success-bg); color: var(--success);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 10px;
}
.muted { color: var(--text2); font-size: 13px; }

/* ---------- Tabs ---------- */
.tabs {
  border-bottom: 1px solid var(--border);
  margin: 0 -16px 16px;
  overflow-x: auto; white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 640px) { .tabs { margin: 0 0 16px; } }
.tabs-inner {
  display: inline-flex; padding: 0 16px;
}
@media (min-width: 640px) { .tabs-inner { padding: 0; } }
.tab {
  background: transparent; border: none;
  padding: 10px 14px;
  font-size: 13px; font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.on {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ---------- Grid helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 640px) { .grid-4 { grid-template-columns: repeat(4, 1fr); gap: 10px; } }

/* ---------- Fields (form-like) ---------- */
.field-list {
  display: grid; gap: 12px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px) { .field-list { grid-template-columns: repeat(3, 1fr); } }
.field {
  min-width: 0;
}
.field .lbl {
  font-size: 10px; font-weight: 700;
  color: var(--text3);
  letter-spacing: .06em; text-transform: uppercase;
  margin-bottom: 2px;
}
.field .val {
  font-size: 14px; font-weight: 500;
  word-wrap: break-word;
}
.field input, .field select { width: 100%; }

/* ---------- Address block ---------- */
.address-block {
  background: var(--accent-bg);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex; gap: 10px;
  align-items: flex-start; flex-wrap: wrap;
}
.address-block .txt {
  flex: 1; min-width: 200px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}
.address-block .copy-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg2);
  border: 1px solid var(--accent-light);
  color: var(--accent-dark);
  padding: 4px 10px;
  font-size: 11px; font-weight: 600;
  border-radius: 6px;
  cursor: pointer; flex-shrink: 0;
}
.address-block .copy-btn:hover { background: var(--accent-light); }
.address-block .copy-btn.copied { background: var(--success-bg); color: var(--success); border-color: transparent; }

/* ---------- Tables (with mobile card fallback) ---------- */
.table-wrap {
  overflow-x: auto;
  margin: 0 -16px;
}
@media (min-width: 640px) { .table-wrap { margin: 0; } }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 500px;
}
@media (min-width: 640px) { table.data { min-width: 0; } }
table.data thead th {
  text-align: left;
  padding: 10px 8px;
  font-size: 10px; font-weight: 700;
  color: var(--text3);
  letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
table.data tbody td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data .right { text-align: right; }
table.data .center { text-align: center; }
table.data .mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
table.data td:first-child, table.data th:first-child { padding-left: 16px; }
table.data td:last-child, table.data th:last-child { padding-right: 16px; }
@media (min-width: 640px) {
  table.data td:first-child, table.data th:first-child { padding-left: 8px; }
  table.data td:last-child, table.data th:last-child { padding-right: 8px; }
}

/* Card list (equivalente móvil de tabla) */
.card-list { display: flex; flex-direction: column; gap: 8px; }
.card-list .row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.card-list .row.hover { cursor: pointer; }
.card-list .row.hover:hover { border-color: var(--accent); }
.card-list .row .title {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.card-list .row .title .name { font-weight: 600; }
.card-list .row .meta {
  font-size: 12px; color: var(--text2);
  display: flex; gap: 8px; flex-wrap: wrap;
}

/* ---------- Property/Room icons ---------- */
.entity-header {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.entity-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 22px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.entity-header .info { flex: 1; min-width: 0; }
.entity-header .info h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.entity-header .info .loc { font-size: 13px; color: var(--text2); margin-top: 2px; }

/* ---------- Metric box (small stats) ---------- */
.metric {
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.metric .lbl {
  font-size: 10px; font-weight: 700;
  color: var(--text3);
  letter-spacing: .06em; text-transform: uppercase;
}
.metric .val { font-size: 17px; font-weight: 700; margin-top: 2px; }
.metric .val.green  { color: var(--success); }
.metric .val.amber  { color: var(--warn); }
.metric .val.red    { color: var(--danger); }
.metric .val.accent { color: var(--accent); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 40px 20px;
}
.empty .ic {
  width: 56px; height: 56px;
  background: var(--bg3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 24px;
  color: var(--text3);
}
.empty p { color: var(--text2); font-size: 13px; margin: 0; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  z-index: 90;
  background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--bg2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h2 { margin: 0 0 16px; font-size: 17px; }
.modal .form-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 20px;
}

/* ---------- Dropdown (notifications, avatar) ---------- */
.dropdown {
  position: absolute; top: calc(var(--topbar-h) - 6px); right: 12px;
  z-index: 45;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 320px; max-width: calc(100vw - 24px);
  overflow: hidden;
}
.dropdown .head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; font-size: 13px;
}
.dropdown .body { max-height: 320px; overflow-y: auto; }
.dropdown .body button {
  width: 100%; text-align: left;
  background: transparent; border: none;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex; gap: 8px; align-items: flex-start;
}
.dropdown .body button:last-child { border-bottom: none; }
.dropdown .body button:hover { background: var(--bg3); }
.dropdown .body .n-dot {
  width: 6px; height: 6px; border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.dropdown .body .n-text { font-size: 13px; color: var(--text); }

/* Legacy aliases (compatibilidad con antiguo CSS) */
.g4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 1024px) { .g4 { grid-template-columns: repeat(4, 1fr); gap: 12px; } }
.inf-lbl { font-size: 10px; font-weight: 700; color: var(--text3); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.inf-val { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.pn { color: var(--warn); }
.bi { background: #dbeafe; color: #1e40af; }
.bg { background: #dcfce7; color: #166534; }

/* ---------- Toggle switches ---------- */
.toggle-sw { background: none; border: none; padding: 0; cursor: pointer; }
.sw-track {
  display: inline-block;
  width: 44px; height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  transition: background .15s;
}
.sw-track.on { background: var(--accent); }
.sw-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  transition: left .15s;
}
.sw-track.on .sw-thumb { left: 22px; }

/* ---------- Sparklines (mini gráficos SVG) ---------- */
.sparkline {
  width: 60px; height: 20px;
  vertical-align: middle;
  margin-left: 6px;
}
.sparkline path { fill: none; stroke-width: 1.5; }
.sparkline.green path { stroke: var(--success); }
.sparkline.red path   { stroke: var(--danger); }
.sparkline.accent path{ stroke: var(--accent); }

/* ---------- Fin row (dashboard financiero) ---------- */
.fin-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 0;
  font-size: 13px;
}
.fin-row .lbl-t { color: var(--text2); }
.fin-row .val-t { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 600; }
.fin-row.bold { font-weight: 700; font-size: 14px; padding: 8px 0; }
.fin-row.bold .lbl-t { color: var(--text); }
.fin-row.negative .val-t { color: var(--danger); }
.fin-row.muted .val-t { color: var(--text3); font-weight: 500; }

/* ---------- Filter bar ---------- */
.filter-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
@media (min-width: 640px) {
  .filter-bar { grid-template-columns: 2fr 1fr 1fr; }
}
.filter-search {
  position: relative;
}
.filter-search input {
  width: 100%;
  padding-left: 32px;
}
.filter-search .ico {
  position: absolute;
  left: 10px; top: 9px;
  color: var(--text3);
}

/* ---------- Timeline (calendar events) ---------- */
.timeline-item {
  display: flex; gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: center;
}
.timeline-item + .timeline-item { margin-top: 8px; }
.timeline-bar {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  flex-shrink: 0;
}
.timeline-bar.high   { background: var(--danger); }
.timeline-bar.medium { background: var(--warn); }
.timeline-bar.low    { background: var(--accent); }
.timeline-date {
  width: 64px; flex-shrink: 0;
  font-family: monospace;
}
.timeline-date .d { font-weight: 700; font-size: 13px; }
.timeline-date .r { font-size: 11px; color: var(--text3); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-body .t { font-weight: 500; font-size: 13px; }
.timeline-body .s { font-size: 11px; color: var(--text3); text-transform: capitalize; }

/* ---------- Celdas del historial de pagos ---------- */
.pay-cell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  background: var(--bg2);
  border-radius: 6px;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: all .12s;
  color: var(--text3);
}
.pay-cell:hover { border-color: var(--accent); }
.pay-cell.pagado, .pay-cell.paid { background: #dcfce7; color: #166534; border-color: transparent; }
.pay-cell.parcial, .pay-cell.partial { background: #fed7aa; color: #9a3412; border-color: transparent; }
.pay-cell.anulado, .pay-cell.void { background: var(--bg3); color: var(--text3); border-color: transparent; }
.pay-cell.pendiente { background: transparent; color: var(--text3); }

/* ---------- Owner selector (top bar) ---------- */
.owner-sel {
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--bg2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  max-width: 140px;
  font-family: inherit;
}
.owner-sel:hover { background: var(--bg3); }
@media (max-width: 767px) { .owner-sel { display: none; } }

/* ---------- Ejemplo badge ---------- */
.demo-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
  border: 1px solid #fbbf24;
  color: #92400e;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.demo-banner .ic { flex-shrink: 0; }

/* ============================================================================
 * v0.7 — CSS que faltaba desde v0.6.1. Estas clases se usaban en decenas de
 * modales (formularios de gastos, tickets, inquilinos, pagos, documentos)
 * pero nunca se definieron, así que llevaban 3 releases renderizando sin
 * estilo: inputs apilados sin grid, botones de acción sin alinear.
 * ============================================================================ */

/* ---------- Formularios dentro de modal: grid de 2 columnas ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 4px;
}
@media (min-width: 480px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
.form-grid > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-grid label {
  font-size: 12px; font-weight: 600; color: var(--text2);
}
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%;
}
.form-grid textarea { resize: vertical; min-height: 60px; }
/* Campo que ocupa las 2 columnas del grid */
.form-grid .col-2 { grid-column: 1 / -1; }
@media (max-width: 479px) {
  .form-grid .col-2 { grid-column: 1; }
}

/* ---------- Fila de botones al pie de un modal (openModal) ---------- */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}
@media (max-width: 479px) {
  /* En pantallas muy estrechas, los botones ocupan todo el ancho y se apilan */
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

/* ---------- Sistema de modal "viejo" (creación directa por DOM) ----------
   Usado en modalSupplyConfig, modalInviteOwner, modalEditOwner. Coexiste con
   openModal(); se unifica visualmente con el mismo radius/shadow/tokens. */
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close {
  background: transparent; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--text3);
  padding: 4px 8px; border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--bg3); color: var(--text); }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px 18px;
  flex-wrap: wrap;
}
@media (max-width: 479px) {
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }
}

/* ---------- Filas de gasto (tab Gastos, v0.6.1) ---------- */
.expense-row { transition: background .1s; }
.expense-row:hover { background: var(--bg3); }
.expense-actions { opacity: .4; transition: opacity .15s; }
.expense-row:hover .expense-actions { opacity: 1; }
@media (max-width: 767px) {
  /* En touch no hay :hover fiable — mostrar siempre las acciones */
  .expense-actions { opacity: 1; }
}

/* ---------- Banner informativo genérico (azul) ---------- */
.info-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-light);
  color: var(--accent-dark);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}

/* ---------- Utilidad: ocultar en móvil ---------- */
.hidden-sm { display: none; }
@media (min-width: 640px) { .hidden-sm { display: initial; } }
