/* ============================================
   RNG BILLS — Hoja de estilos
   Paleta: violeta editorial sobre papel lila
   ============================================ */

:root {
  --bg: #F1ECF5;
  --bg-card: #FBF7FC;
  --bg-card-2: #F5EFF7;
  --ink: #1B0E33;
  --ink-soft: #5B4A78;
  --ink-faint: #8C82A3;
  --accent: #7E3F9C;
  --accent-soft: #E4D3EE;
  --green: #3F6B5C;
  --green-soft: #D2E1DA;
  --red: #8B2D4F;
  --red-soft: #EDD3DC;
  --line: #DCD3E2;
  --line-soft: #E8E0EE;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image: radial-gradient(circle at 1px 1px, rgba(27,14,51,0.05) 1px, transparent 0);
  background-size: 28px 28px;
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; }

/* ============ LAYOUT ============ */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
  background: var(--ink);
  color: var(--bg);
  padding: 32px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.logo-block {
  margin-bottom: 40px;
  padding: 0 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.logo-block:hover { opacity: 0.85; }
.logo-block:active { opacity: 0.7; }
.logo {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 144;
  font-weight: 500;
  font-size: 30px;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 6px;
}
.logo em { font-style: italic; font-weight: 400; color: var(--accent); }
.tagline {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--sidebar-text-soft);
  font-weight: 500;
  line-height: 1.5;
}
.nav-section { margin-bottom: 24px; }
.nav-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--sidebar-text-faint);
  margin-bottom: 8px;
  padding-left: 10px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  color: var(--sidebar-text);
  border-radius: 4px;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 1px;
  transition: all 0.15s;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--bg); }
.nav-item.active { background: var(--accent); color: var(--bg); }
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.9; }

.sidebar-foot {
  margin-top: auto;
  padding: 16px 10px 4px;
  border-top: 1px solid var(--sidebar-line);
}
.who { display: flex; align-items: center; gap: 10px; }
.who-info { flex: 1; min-width: 0; }
.who-info .who-name,
.who-info .who-role {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.who-logout {
  background: transparent;
  border: 1px solid var(--sidebar-line);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--sidebar-text-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.who-logout:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
  border-color: var(--sidebar-text-faint);
}
.who-logout:active {
  transform: scale(0.95);
}
.avatar {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  color: var(--bg);
  font-size: 13px;
}
.who-name { font-size: 13px; font-weight: 600; color: var(--bg); }
.who-role {
  font-size: 9.5px;
  color: var(--sidebar-text-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ============ CONTENT ============ */
.content { padding: 40px 56px 80px; max-width: 1400px; }

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
  gap: 24px;
}

.breadcrumb {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  margin-bottom: 12px;
  font-weight: 600;
}

.page-title {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 144;
  font-weight: 500;
  font-size: 52px;
  line-height: 1;
  letter-spacing: -0.035em;
}
.page-title em { font-style: italic; font-weight: 400; color: var(--accent); }

.page-meta { text-align: right; flex-shrink: 0; }
.page-meta .date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

/* ============ BUTTONS ============ */
.btn {
  background: var(--ink);
  color: var(--bg);
  border: none;
  padding: 11px 18px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.btn:hover { background: var(--accent); transform: translateY(-1px); }

.btn-secondary {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: all 0.15s;
}
.btn-secondary:hover { color: var(--ink); border-color: var(--ink); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red-soft);
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.btn-danger:hover { background: var(--red); color: var(--bg); border-color: var(--red); }

.btn-icon {
  background: transparent;
  border: none;
  padding: 6px;
  color: var(--ink-faint);
  border-radius: 3px;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
}
.btn-icon:hover { color: var(--accent); background: var(--bg-card-2); }
.btn-icon.danger:hover { color: var(--red); background: var(--red-soft); }

/* ============ HERO STATS ============ */
.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 56px;
}
.hero-block { background: var(--bg-card); padding: 32px 36px; position: relative; }
.hero-block.total { background: var(--ink); color: var(--bg); }

.hero-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  margin-bottom: 14px;
  font-weight: 600;
}
.hero-block.total .hero-label { color: var(--sidebar-text-soft); }

.hero-value {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 144;
  font-weight: 500;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.025em;
  font-feature-settings: 'tnum';
}
.hero-block.total .hero-value { font-size: 52px; }
.hero-value .currency {
  font-size: 16px;
  color: var(--ink-faint);
  font-weight: 400;
  margin-right: 6px;
  font-style: italic;
}
.hero-block.total .hero-value .currency { color: var(--sidebar-text-soft); }
.hero-block.income .hero-value { color: var(--green); }
.hero-block.expense .hero-value { color: var(--accent); }

.hero-delta { margin-top: 14px; font-size: 12px; color: var(--ink-faint); }
.hero-block.total .hero-delta { color: var(--sidebar-text-soft); }
.hero-delta strong { color: var(--ink); font-weight: 600; }
.hero-block.total .hero-delta strong { color: var(--bg); }
.delta-up { color: var(--green); }
.delta-down { color: var(--red); }

.hero-corner {
  position: absolute;
  top: 18px;
  right: 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.hero-block.total .hero-corner { color: var(--sidebar-text-soft); }

.ribbon {
  position: absolute;
  bottom: 24px;
  right: 28px;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--sidebar-text-soft);
}

/* ============ SECTIONS ============ */
.section { margin-bottom: 48px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 14px;
}
.section-title {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 144;
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.025em;
}
.section-title em { font-style: italic; color: var(--accent); font-weight: 400; }
.section-link {
  color: var(--ink-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 600;
  transition: color 0.15s;
  background: none;
  border: none;
}
.section-link:hover { color: var(--accent); }

/* ============ ACCOUNT CARDS ============ */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.account-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 22px 22px 20px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.account-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
  transform: translateX(-100%);
  transition: transform 0.2s;
}
.account-card:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -12px rgba(27,14,51,0.22);
}
.account-card:hover::before { transform: translateX(0); }

.account-type {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  margin-bottom: 10px;
  font-weight: 600;
}
.account-name {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 19px;
  margin-bottom: 18px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.account-balance {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.account-balance .cur {
  font-size: 12px;
  color: var(--ink-faint);
  margin-right: 4px;
  font-weight: 400;
}
.account-card.credit .account-balance,
.account-card.negative .account-balance { color: var(--red); }

.account-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 11px;
  color: var(--ink-faint);
}
.account-owner-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  background: var(--bg-card-2);
  padding: 2px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.account-card.add {
  border-style: dashed;
  border-color: var(--line);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  text-align: center;
  min-height: 130px;
}
.account-card.add:hover { color: var(--accent); border-color: var(--accent); }
.account-card.add::before { display: none; }
.account-card.add svg { width: 24px; height: 24px; margin-bottom: 8px; }
.account-card.add span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
}

/* ============ PANEL / SPLIT ============ */
.split { display: grid; grid-template-columns: 1.45fr 1fr; gap: 32px; }
.panel { background: var(--bg-card); border: 1px solid var(--line); }
.panel-head {
  padding: 20px 28px 16px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.panel-title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.015em;
}
.panel-sub {
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
}

.empty {
  padding: 40px 28px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 13px;
}
.empty .big {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

/* ============ TX LIST ============ */
.tx-list { padding: 8px 0; }
.tx-row {
  display: grid;
  grid-template-columns: 70px 1fr auto auto;
  gap: 18px;
  padding: 14px 28px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s;
}
.tx-row:last-child { border-bottom: none; }
.tx-row:hover { background: var(--bg-card-2); }

.tx-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-faint);
  line-height: 1.3;
}
.tx-date .day {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  display: block;
  letter-spacing: -0.02em;
}
.tx-date .month {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 9px;
}

.tx-main { min-width: 0; }
.tx-desc {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tx-notes {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 4px;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tx-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.tx-badge.fixed {
  background: var(--accent-soft);
  color: var(--accent);
}
.tx-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--ink-faint);
  flex-wrap: wrap;
}
.tx-cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 2px 9px 2px 8px;
  background: var(--bg-card-2);
  border: 1px solid var(--line-soft);
  border-radius: 100px;
  color: var(--ink-soft);
  font-weight: 500;
}
.tx-cat-tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); }
.tx-account {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tx-amount {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 15px;
  text-align: right;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.tx-amount.income { color: var(--green); }
.tx-amount.expense { color: var(--ink); }
.tx-amount .sign { font-weight: 400; opacity: 0.7; margin-right: 1px; }

.tx-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.tx-row:hover .tx-actions { opacity: 1; }
.tx-actions svg { width: 14px; height: 14px; }

/* ============ DONUT / CATEGORY CHART ============ */
.cat-chart-wrap {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.donut { width: 200px; height: 200px; margin: 8px 0 24px; position: relative; }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.donut-center .label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  font-weight: 600;
  margin-bottom: 4px;
}
.donut-center .value {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1;
}

.cat-list {
  width: 100%;
  border-top: 1px solid var(--line-soft);
  padding-top: 16px;
}
.cat-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
}
.cat-row + .cat-row { border-top: 1px dotted var(--line); }
.cat-dot { width: 10px; height: 10px; border-radius: 2px; }
.cat-name { font-weight: 500; font-size: 13.5px; }
.cat-pct {
  color: var(--ink-faint);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  margin-left: 6px;
}
.cat-amount {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}

/* ============ FILTERS ============ */
.filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}
.filters-bar .search { flex: 1; min-width: 200px; position: relative; }
.filters-bar input,
.filters-bar select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  border-radius: 3px;
}
.filters-bar select { min-width: 140px; }
.filters-bar input[type=date] {
  min-width: 130px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.filters-bar input:focus,
.filters-bar select:focus { outline: none; border-color: var(--accent); }

.results-count {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-faint);
  margin-bottom: 16px;
  font-weight: 600;
}
.results-count strong { color: var(--ink); }

/* ============ CATEGORIES PAGE ============ */
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.cat-col h3 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.cat-col h3 em { color: var(--accent); font-style: italic; }
.cat-card-list { display: flex; flex-direction: column; gap: 8px; }
.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 14px;
  align-items: center;
  transition: all 0.15s;
}
.cat-card:hover { border-color: var(--ink); }
.cat-color-block { width: 28px; height: 28px; border-radius: 4px; }
.cat-info-name { font-weight: 600; font-size: 14px; }
.cat-info-meta { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }
.cat-spent {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 14px;
  text-align: right;
}
.cat-card-actions { display: flex; gap: 2px; }

/* ============ BUDGET ============ */
.budget-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}
.budget-stat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 22px 24px;
}
.budget-stat .l {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  margin-bottom: 10px;
  font-weight: 600;
}
.budget-stat .v {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.02em;
}
.budget-stat.over .v { color: var(--red); }
.budget-stat.ok .v { color: var(--green); }

.budget-list { background: var(--bg-card); border: 1px solid var(--line); }
.budget-row {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}
.budget-row:last-child { border-bottom: none; }
.budget-row-name {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
}
.budget-row-name .dot { width: 10px; height: 10px; border-radius: 2px; }
.budget-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.budget-meta .num { color: var(--ink); font-weight: 600; }
.budget-meta .over { color: var(--red); }

.progress {
  height: 6px;
  background: var(--line-soft);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.5s;
}
.progress-fill.over { background: var(--red); }
.progress-fill.ok { background: var(--green); }

/* ============ SETTINGS ============ */
.settings-grid {
  column-count: 2;
  column-gap: 24px;
}
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 28px 30px;
  break-inside: avoid;
  margin-bottom: 24px;
  display: inline-block;
  width: 100%;
}
.settings-card h3 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.settings-card p { font-size: 13px; color: var(--ink-soft); margin-bottom: 18px; }
.settings-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-card-2);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
}
.member-item .ma {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  color: var(--bg);
  font-size: 12px;
}
.member-item .mn { font-weight: 600; font-size: 13px; }
.member-item .mr {
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ============ REPORTS ============ */
.legend {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  color: var(--ink-soft);
}
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-item .swatch { width: 10px; height: 10px; border-radius: 2px; }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27,14,51,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease-out; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--ink);
  padding: 36px;
  width: 480px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px -20px rgba(27,14,51,0.4);
  animation: slideUp 0.25s ease-out;
}
.modal.wide { width: 600px; }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}
.modal-title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 30px;
  margin-bottom: 4px;
  letter-spacing: -0.025em;
  line-height: 1;
}
.modal-title em { font-style: italic; color: var(--accent); font-weight: 400; }
.modal-subtitle { color: var(--ink-soft); font-size: 13px; margin-bottom: 24px; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-weight: 600;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  border-radius: 3px;
  transition: border-color 0.15s;
}
.field textarea { resize: vertical; min-height: 60px; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card);
}
.field-hint { font-size: 11px; color: var(--ink-faint); margin-top: 4px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--line);
  margin-bottom: 18px;
  border-radius: 3px;
  overflow: hidden;
}
.type-toggle button {
  background: var(--bg);
  border: none;
  padding: 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-soft);
  font-weight: 600;
  transition: all 0.15s;
}
.type-toggle button:hover { background: var(--bg-card-2); }
.type-toggle button.active.income { background: var(--green-soft); color: var(--green); }
.type-toggle button.active.expense { background: var(--accent-soft); color: var(--accent); }
.type-toggle button + button { border-left: 1px solid var(--line); }

.color-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.color-swatch {
  aspect-ratio: 1;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
}
.color-swatch.selected { border-color: var(--ink); transform: scale(1.1); }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  justify-content: space-between;
  align-items: center;
}
.modal-actions .right { display: flex; gap: 10px; }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--ink);
  color: var(--bg);
  padding: 14px 20px;
  border-radius: 4px;
  font-size: 13px;
  z-index: 200;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  border-left: 3px solid var(--accent);
  max-width: 400px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-left-color: var(--red); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .app { grid-template-columns: 200px 1fr; }
  .content { padding: 32px 32px 80px; }
  .hero { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .page-title { font-size: 38px; }
  .cat-grid,
  .budget-summary { grid-template-columns: 1fr; }
  .settings-grid { column-count: 1; }
}

@media (max-width: 700px) {
  /* === HEADER MÓVIL VISIBLE === */
  .mobile-header { display: flex !important; }
  .sidebar-backdrop { display: block; }

  /* === LAYOUT === */
  body { padding-top: 56px; /* dejar espacio para mobile-header fixed */ }
  .app { grid-template-columns: 1fr; }

  /* === SIDEBAR COMO DRAWER === */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    flex-direction: column;
    flex-wrap: nowrap;
    padding: 24px 20px;
    box-shadow: 0 0 40px rgba(0,0,0,0.3);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-foot { display: block; }
  .nav-section { margin-bottom: 18px; flex: none; min-width: auto; }
  .nav-item {
    padding: 12px 14px;
    font-size: 15px;
  }

  /* === LOGO BLOCK en sidebar === */
  .logo-block {
    margin-bottom: 24px;
    padding-top: 12px;
  }

  /* === CONTENIDO === */
  .content { padding: 20px 16px 100px; }
  .header { flex-direction: column; align-items: flex-start; }
  .page-meta { text-align: left; width: 100%; margin-top: 12px; }

  /* === HERO STATS — 1 columna en lugar de 3 === */
  .hero { grid-template-columns: 1fr !important; gap: 12px; }
  .hero-block { padding: 20px 22px; }
  .hero-value { font-size: 32px !important; }
  .page-title { font-size: 32px !important; }

  /* === BOTONES MÁS GRANDES PARA TAP === */
  .btn, .btn-secondary, .btn-danger {
    padding: 12px 16px;
    font-size: 14px;
    min-height: 44px;  /* iOS recomendación: 44px mínimo */
  }
  .btn-icon {
    min-width: 40px;
    min-height: 40px;
  }

  /* === FILTROS de movimientos en columna === */
  .filters-bar {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }

  /* === FORMULARIOS en modal === */
  .row-2 { grid-template-columns: 1fr !important; }
  .modal-box {
    width: 95vw;
    max-width: 95vw;
    padding: 24px 20px;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* === MOVIMIENTOS — ajustar grid === */
  .tx-row {
    grid-template-columns: 50px 1fr auto;
    gap: 10px;
    padding: 12px;
  }
  .tx-actions { display: none; }
  .tx-row .tx-amount { font-size: 14px; }

  /* === TABLAS Y LISTAS === */
  .panel { padding: 0; }
  .accounts-grid { grid-template-columns: 1fr; }

  /* === REPORTES === */
  .reports-grid { grid-template-columns: 1fr; }
}

/* ============ MOBILE HEADER (oculto en desktop) ============ */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--ink);
  color: var(--bg);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 150;
  border-bottom: 1px solid var(--sidebar-line);
}
.mobile-menu-btn {
  background: transparent;
  border: none;
  color: var(--bg);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.mobile-menu-btn:hover { background: var(--sidebar-hover); }
.mobile-menu-btn:active { background: var(--sidebar-line); }
.mobile-menu-btn svg { width: 22px; height: 22px; }

.mobile-logo {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.025em;
  cursor: pointer;
  color: var(--bg);
  user-select: none;
}
.mobile-logo em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.mobile-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 15px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.mobile-avatar:active { transform: scale(0.92); }

/* ============ BACKDROP DEL DRAWER ============ */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 180;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* ============ MENÚ DE USUARIO MÓVIL ============ */
.mobile-user-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 250;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 64px 12px 12px;
}
.mobile-user-menu.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}
.mobile-user-menu-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-width: 240px;
  max-width: 90vw;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  animation: slideDown 0.2s ease;
}
@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.mobile-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 14px;
}
.mobile-user-info .avatar {
  width: 44px;
  height: 44px;
  font-size: 16px;
}
.mobile-user-info .who-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}
.mobile-user-info .who-role {
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.mobile-user-logout {
  width: 100%;
  background: var(--red-soft);
  color: var(--red);
  border: none;
  padding: 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s;
}
.mobile-user-logout:hover { opacity: 0.85; }
.mobile-user-logout:active { transform: scale(0.98); }

/* ============ OBLIGATIONS PAGE ============ */
.obl-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.4fr;
  gap: 16px;
  margin-bottom: 32px;
}
.obl-stat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.obl-stat-icon {
  font-size: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card-2);
}
.obl-stat.ok    .obl-stat-icon { background: var(--green-soft); }
.obl-stat.warn  .obl-stat-icon { background: #FAEED1; }
.obl-stat.bad   .obl-stat-icon { background: var(--red-soft); }
.obl-stat-num {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.obl-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-faint);
  font-weight: 600;
  margin-top: 2px;
}
.obl-stat-label strong {
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.obl-stat.total {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  align-items: flex-start;
}
.obl-stat.total .obl-stat-label { color: var(--sidebar-text-soft); }
.obl-stat.total .obl-stat-label strong { color: var(--bg); }
.obl-stat-amount {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 4px 0;
}

/* Group by category */
.obl-group {
  background: var(--bg-card);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.obl-group-head {
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-card-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.obl-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.015em;
}
.obl-group-title .dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.obl-group-total {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

.obl-list { padding: 4px 0; }
.obl-row {
  display: grid;
  grid-template-columns: 56px 1fr auto 40px;
  gap: 16px;
  padding: 14px 24px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s;
}
.obl-row:last-child { border-bottom: none; }
.obl-row:hover { background: var(--bg-card-2); }
.obl-row.paid    { background: rgba(63,107,92,0.04); }
.obl-row.paid:hover { background: rgba(63,107,92,0.08); }
.obl-row.unpaid  .obl-name { text-decoration: line-through; opacity: 0.5; }

.obl-status-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--bg);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  cursor: pointer;
}
.obl-status-btn:hover { transform: scale(1.05); border-color: var(--ink); }
.obl-status-btn.paid    { background: var(--green-soft); border-color: var(--green); }
.obl-status-btn.pending { background: #FAEED1; border-color: #C19142; }
.obl-status-btn.unpaid  { background: var(--red-soft); border-color: var(--red); }
.obl-status-btn.partial { background: #FAEED1; border-color: #C19142; }

.obl-info { min-width: 0; }
.obl-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.obl-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-faint);
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.obl-holder {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  background: var(--bg-card-2);
  padding: 2px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.obl-account {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.obl-note { font-style: italic; }

.obl-installment {
  margin-top: 8px;
  max-width: 360px;
}
.obl-installment-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-faint);
}
.obl-installment-meta strong { color: var(--ink); font-family: 'JetBrains Mono', monospace; }
.obl-installment-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-soft);
  font-style: italic;
}

.obl-amount {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.obl-actions { display: flex; gap: 2px; }

@media (max-width: 1100px) {
  .obl-summary { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .obl-summary { grid-template-columns: 1fr; }
  .obl-row { grid-template-columns: 50px 1fr auto; }
  .obl-actions { display: none; }
}

/* ============ CSV IMPORT WIZARD ============ */
.csv-drop {
  border: 2px dashed var(--line);
  border-radius: 6px;
  padding: 28px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--ink-soft);
  background: var(--bg);
}
.csv-drop:hover, .csv-drop.over {
  border-color: var(--accent);
  background: var(--bg-card-2);
  color: var(--ink);
}
.csv-drop svg { color: var(--ink-faint); margin-bottom: 12px; }
.csv-drop strong { color: var(--ink); }
.csv-drop-hint {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 6px;
}

.csv-preview-wrap {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.csv-preview-label {
  padding: 10px 14px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  background: var(--bg-card-2);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.csv-preview {
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  border-collapse: collapse;
}
.csv-preview th, .csv-preview td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.csv-preview th {
  background: var(--bg-card-2);
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.csv-preview .col-date  { background: rgba(63,107,92,0.08); }
.csv-preview .col-desc  { background: rgba(126,63,156,0.06); }
.csv-preview .col-amt   { background: rgba(199,122,75,0.08); text-align: right; }
.csv-preview tbody tr:hover { background: var(--bg-card-2); }

.csv-bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.csv-rows-wrap {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.csv-row {
  display: grid;
  grid-template-columns: 24px 90px 1fr 160px 110px;
  gap: 10px;
  padding: 8px 12px;
  align-items: center;
  font-size: 13px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s;
}
.csv-row:last-child { border-bottom: none; }
.csv-row:hover { background: var(--bg-card-2); }
.csv-row.excluded { opacity: 0.35; }
.csv-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }
.csv-row-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-faint);
}
.csv-row-desc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.csv-row select {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg-card);
}
.csv-row-amt {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-align: right;
  font-size: 13px;
}
.csv-row-amt.income { color: var(--green); }
.csv-row-amt.expense { color: var(--red); }

.csv-skipped {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--red-soft);
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}
.csv-skipped summary {
  font-weight: 600;
  color: var(--red);
}

@media (max-width: 700px) {
  .csv-row { grid-template-columns: 20px 1fr 100px; }
  .csv-row-desc, .csv-row select { grid-column: span 1; }
  .csv-row select { grid-column: 2 / 3; font-size: 11px; }
}

/* ============ THEMES UI ============ */
.theme-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.theme-mode-toggle button {
  background: var(--bg);
  border: none;
  padding: 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-soft);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
}
.theme-mode-toggle button:hover { background: var(--bg-card-2); }
.theme-mode-toggle button.active {
  background: var(--ink);
  color: var(--bg);
}
.theme-mode-toggle button + button { border-left: 1px solid var(--line); }

.theme-palettes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 700px) {
  .theme-palettes { grid-template-columns: 1fr; }
}
.theme-palette {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  position: relative;
}
.theme-palette:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}
.theme-palette.active {
  border-color: var(--accent);
  border-width: 2px;
  padding: 13px 15px;
  background: var(--accent-soft);
}
.theme-swatches {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.theme-swatches span {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.06);
}
.theme-info { flex: 1; min-width: 0; }
.theme-name {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.015em;
  margin-bottom: 2px;
}
.theme-desc {
  font-size: 11px;
  color: var(--ink-faint);
}
.theme-check {
  color: var(--accent);
  flex-shrink: 0;
}

/* ============ LOGO PREVIEW & SIDEBAR LOGO ============ */
.logo-img {
  max-width: 100%;
  max-height: 56px;
  object-fit: contain;
  display: block;
  margin-bottom: 8px;
}
.logo-preview {
  background: var(--ink);
  border-radius: 6px;
  padding: 24px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
}
.logo-preview img {
  max-width: 100%;
  max-height: 60px;
  object-fit: contain;
}
.logo-preview-text {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.03em;
  color: var(--bg);
  line-height: 1;
}
.logo-preview-text em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

/* ============ AUTH STATUS ============ */
.auth-status {
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-status.enabled {
  background: var(--green-soft);
  color: var(--green);
}
.auth-status.disabled {
  background: var(--bg-card-2);
  color: var(--ink-faint);
  border: 1px dashed var(--line);
}

.pwd-error {
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
  min-height: 18px;
  margin-top: 4px;
}

/* ============ LOCK SCREEN ============ */
.lock-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.06) 1px, transparent 0);
  background-size: 28px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  animation: fadeIn 0.3s ease-out;
}

.lock-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 460px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px -20px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
}

.lock-header {
  padding: 32px 32px 20px;
  background: var(--ink);
  color: var(--bg);
  text-align: center;
}
.lock-logo {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 144;
  font-weight: 500;
  font-size: 38px;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 6px;
}
.lock-logo em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}
.lock-logo-img {
  max-height: 70px;
  max-width: 100%;
  margin: 0 auto 8px;
  display: block;
}
.lock-tagline {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
}

.lock-content {
  padding: 28px 32px 24px;
}
.lock-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}
.lock-title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.025em;
  line-height: 1;
  margin-bottom: 22px;
}
.lock-title em {
  font-style: italic;
  color: var(--accent);
}

.lock-members {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lock-member {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  text-align: left;
}
.lock-member:hover {
  border-color: var(--accent);
  background: var(--bg-card-2);
  transform: translateX(2px);
}
.lock-avatar {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  color: var(--bg);
  font-size: 16px;
  flex-shrink: 0;
}
.lock-avatar.lg {
  width: 48px;
  height: 48px;
  font-size: 18px;
}
.lock-member-info { flex: 1; min-width: 0; }
.lock-member-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 2px;
}
.lock-member-role {
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.lock-icon { color: var(--ink-faint); }

.lock-divider {
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  font-weight: 600;
  margin: 18px 0 12px;
  position: relative;
}
.lock-divider::before,
.lock-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: var(--line);
}
.lock-divider::before { left: 0; }
.lock-divider::after { right: 0; }

.lock-open-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lock-open-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.lock-open-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.lock-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  animation: slideUp 0.2s ease-out;
}
.lock-form-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.lock-form input[type=password] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  border-radius: 4px;
  margin-bottom: 6px;
}
.lock-form input[type=password]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card);
}
.lock-error {
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
  min-height: 18px;
  margin-bottom: 8px;
}
.lock-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  margin-bottom: 16px;
}
.lock-remember input { width: 16px; height: 16px; cursor: pointer; }
.lock-submit {
  width: 100%;
  justify-content: center;
  padding: 13px;
}

.lock-foot {
  padding: 14px 32px;
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  font-weight: 600;
  border-top: 1px solid var(--line-soft);
}

@media (max-width: 500px) {
  .lock-card { width: 100%; }
  .lock-header { padding: 24px 20px 16px; }
  .lock-content { padding: 22px 20px 20px; }
  .lock-foot { padding: 12px 20px; }
}

/* ============ PASSWORD FORM ============ */
.pwd-input-wrap {
  position: relative;
}
.pwd-input-wrap input {
  padding-right: 40px;
}
.pwd-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 6px;
  color: var(--ink-faint);
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.pwd-toggle:hover { color: var(--accent); }
.pwd-toggle.active { color: var(--accent); }

.pwd-strength {
  margin-top: 8px;
}
.pwd-strength-bar {
  height: 4px;
  background: var(--line-soft);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 6px;
}
.pwd-strength-fill {
  height: 100%;
  width: 0%;
  background: var(--ink-faint);
  transition: all 0.25s ease;
  border-radius: 100px;
}
.pwd-strength-fill.weak   { background: #C84A4A; }
.pwd-strength-fill.fair   { background: #D89A3A; }
.pwd-strength-fill.good   { background: #6B9A4A; }
.pwd-strength-fill.strong { background: var(--green); }

.pwd-strength-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-faint);
}
.pwd-strength-label.weak   { color: #C84A4A; }
.pwd-strength-label.fair   { color: #B8821F; }
.pwd-strength-label.good   { color: #5A8540; }
.pwd-strength-label.strong { color: var(--green); }

.pwd-checks {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}
.pwd-check {
  font-size: 11.5px;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}
.pwd-check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 11px;
  font-weight: bold;
  color: var(--ink-faint);
  transition: color 0.2s;
}
.pwd-check.ok {
  color: var(--green);
}
.pwd-check.ok .pwd-check-icon {
  color: var(--green);
}

.pwd-match {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  min-height: 16px;
}
.pwd-match.ok { color: var(--green); }
.pwd-match.err { color: var(--red); }

@media (max-width: 500px) {
  .pwd-checks { grid-template-columns: 1fr; }
}

/* ============ LOCK SCREEN — formulario de login ============ */
.lock-form-main {
  display: block;
}
.lock-form-main .field {
  margin-bottom: 14px;
}
.lock-form-main .field label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  font-weight: 600;
  margin-bottom: 6px;
}
.lock-form-main input[type=text],
.lock-form-main input[type=password] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  border-radius: 4px;
}
.lock-form-main input[type=text]:focus,
.lock-form-main input[type=password]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card);
}
.lock-form-main .pwd-input-wrap input { padding-right: 40px; }

.lock-hint {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.7;
}
.lock-hint strong {
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.lock-hint code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--bg-card);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--ink);
  font-weight: 600;
}

/* Etiquetas auxiliares en formularios */
.field-required {
  display: inline-block;
  font-size: 10px;
  color: var(--red);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}
.field-hint-inline {
  display: inline-block;
  font-size: 10px;
  color: var(--ink-faint);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
  font-style: italic;
}

/* ============ LOADING SCREEN ============ */
.app-loading {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}
.app-loading-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.app-loading-logo {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 36px;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1;
}
.app-loading-logo em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}
.app-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.app-loading-msg {
  font-size: 13px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
}
.app-loading-error {
  font-size: 14px;
  color: var(--red);
  font-weight: 600;
  max-width: 320px;
}
