:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --border: rgba(15,23,42,.1);
  --border-2: rgba(15,23,42,.18);
  --muted-bg: #f8fafc;
  --primary: #1a6fc4;
  --primary-hover: #155da0;
  --primary-light: #e8f1fb;
  --primary-light-hover: #d4e8f8;
  --success: #0c6b40;
  --success-hover: #0a5534;
  --success-bg: #d1fae5;
  --success-text: #065f46;
  --success-border: #6ee7b7;
  --danger: #c0392b;
  --danger-hover: #a12f23;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --danger-border: #fca5a5;
  --info: #0891b2;
  --info-hover: #0e7490;
  --row-hover: #f8fbff;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1420;
    --surface: #1a2235;
    --text: #e6eaf2;
    --text-2: #a3aec4;
    --text-3: #6b7893;
    --border: rgba(255,255,255,.08);
    --border-2: rgba(255,255,255,.14);
    --muted-bg: #161d2d;
    --primary: #4a9eeb;
    --primary-hover: #6db3f2;
    --primary-light: rgba(74,158,235,.16);
    --primary-light-hover: rgba(74,158,235,.26);
    --success: #34d17c;
    --success-hover: #4ade8c;
    --success-bg: rgba(52,209,124,.14);
    --success-text: #4ade8c;
    --success-border: rgba(52,209,124,.35);
    --danger: #f06262;
    --danger-hover: #f58080;
    --danger-bg: rgba(240,98,98,.14);
    --danger-text: #f58080;
    --danger-border: rgba(240,98,98,.35);
    --info: #22d3ee;
    --info-hover: #52ddf0;
    --row-hover: rgba(255,255,255,.03);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1420;
  --surface: #1a2235;
  --text: #e6eaf2;
  --text-2: #a3aec4;
  --text-3: #6b7893;
  --border: rgba(255,255,255,.08);
  --border-2: rgba(255,255,255,.14);
  --muted-bg: #161d2d;
  --primary: #4a9eeb;
  --primary-hover: #6db3f2;
  --primary-light: rgba(74,158,235,.16);
  --primary-light-hover: rgba(74,158,235,.26);
  --success: #34d17c;
  --success-hover: #4ade8c;
  --success-bg: rgba(52,209,124,.14);
  --success-text: #4ade8c;
  --success-border: rgba(52,209,124,.35);
  --danger: #f06262;
  --danger-hover: #f58080;
  --danger-bg: rgba(240,98,98,.14);
  --danger-text: #f58080;
  --danger-border: rgba(240,98,98,.35);
  --info: #22d3ee;
  --info-hover: #52ddf0;
  --row-hover: rgba(255,255,255,.03);
  color-scheme: dark;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  touch-action: manipulation;
}

/* ── Navbar ── */
.navbar {
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 500;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
}

.brand-icon {
  width: 30px;
  height: 30px;
  background: var(--primary-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--primary);
}

.navbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-nav {
  font-size: 12px;
  padding: 5px 12px;
  border: 0.5px solid var(--border-2);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background .15s;
}
.btn-nav:hover { background: var(--muted-bg); }
.btn-nav-primary {
  background: var(--primary-light);
  border-color: transparent;
  color: var(--primary);
  font-weight: 500;
}
.btn-nav-primary:hover { background: var(--primary-light-hover); }

/* Menu de usuario (navbar) */
.user-menu { position: relative; }
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border: 0.5px solid var(--border-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.user-menu-btn:hover { background: var(--muted-bg); }
.user-menu.open .user-menu-btn { border-color: var(--primary); }
.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.user-menu-caret {
  font-size: 9px;
  color: var(--text-3);
  transition: transform .15s;
}
.user-menu.open .user-menu-caret { transform: rotate(180deg); }
.user-menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(15,23,42,.16);
  padding: 6px;
  z-index: 100;
}
.user-menu.open .user-menu-dropdown { display: block; }
.user-menu-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  padding: 8px 10px 4px;
}
.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background .1s;
}
.user-menu-item:hover { background: var(--muted-bg); }
.user-menu-item-danger { color: var(--danger); }

/* ── Container ── */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 56px;
}

/* ── Alerts ── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-ok  { background: var(--success-bg); color: var(--success-text); border: 0.5px solid var(--success-border); }
.alert-err { background: var(--danger-bg); color: var(--danger-text); border: 0.5px solid var(--danger-border); }

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title { font-size: 20px; font-weight: 500; }
.page-sub   { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: 0.5px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover    { background: var(--muted-bg); }
.btn:active   { transform: scale(.98); }
.btn-primary  { background: var(--primary);  border-color: transparent; color: #fff; }
.btn-primary:hover  { background: var(--primary-hover); }
.btn-success  { background: var(--success);  border-color: transparent; color: #fff; }
.btn-success:hover  { background: var(--success-hover); }
.btn-danger   { background: var(--danger);   border-color: transparent; color: #fff; }
.btn-danger:hover   { background: var(--danger-hover); }
.btn-info     { background: var(--info);     border-color: transparent; color: #fff; }
.btn-info:hover     { background: var(--info-hover); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Metric cards ── */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.metric {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.metric-val { font-size: 22px; font-weight: 500; }
.metric-lbl {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 4px;
}

/* ── Filters ── */
.filters {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .06em;
}
select {
  padding: 6px 10px;
  border: 0.5px solid var(--border-2);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--muted-bg);
  color: var(--text);
  cursor: pointer;
}
select:focus { outline: none; border-color: var(--primary); }
.filter-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.filter-dropdown {
  position: relative;
  width: 100%;
}
.filter-toggle {
  width: 100%;
  text-align: left;
  padding: 8px 11px;
  border: 0.5px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--muted-bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.filter-menu {
  display: none;
  position: absolute;
  inset: auto 0 0 0;
  margin-top: 6px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(15,23,42,.12);
  max-height: 220px;
  overflow-y: auto;
  z-index: 10;
  padding: 10px;
}
.filter-dropdown.open .filter-menu { display: block; }
.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text);
}
.filter-option:last-child { margin-bottom: 0; }
.filter-option input { accent-color: var(--primary); }
.filter-summary { color: var(--text-2); font-size: 12px; }

/* ── Table card ── */
.table-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-2);
  border-bottom: 0.5px solid var(--border);
  background: var(--muted-bg);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--row-hover); }
.td-r { text-align: right; font-variant-numeric: tabular-nums; }
.badge-num {
  font-size: 12px;
  background: var(--muted-bg);
  border: 0.5px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
  color: var(--text-2);
  display: inline-block;
}
.action-btns { display: flex; gap: 6px; justify-content: flex-end; }

/* Empty state */
.empty-state {
  padding: 48px 0;
  text-align: center;
  color: var(--text-3);
}
.empty-state strong { display: block; color: var(--text-2); font-weight: 500; margin-bottom: 6px; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .4);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.modal-title { font-size: 16px; font-weight: 500; }
.modal-sub   { font-size: 12px; color: var(--text-2); margin-top: 3px; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}
.detail-item {
  background: var(--muted-bg);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.detail-item span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
}
.detail-item strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-top: 3px;
  color: var(--text);
}

/* ── PDF Drop Zone ── */
.pdf-drop-zone {
  background: var(--muted-bg);
  border: 2px dashed var(--primary);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 24px;
  transition: background-color 0.2s;
}
.pdf-drop-zone:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--muted-bg));
}
.pdf-drop-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
}

/* ── Form ── */
.form-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-section {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 12px 0 4px;
  margin-top: 4px;
  border-top: 0.5px solid var(--border);
}
.form-section:first-child { padding-top: 0; margin-top: 0; border-top: none; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.form-group input,
.form-group select {
  padding: 8px 11px;
  border: 0.5px solid var(--border-2);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--muted-bg);
  color: var(--text);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(26,111,196,.1);
}
.hint { font-size: 11px; color: var(--text-3); }
.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 0.5px solid var(--border);
  flex-wrap: wrap;
}

/* Error list */
.error-box {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 0.5px solid var(--danger-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 20px;
}
.error-box ul { margin: 6px 0 0 16px; }

/* ── Responsive mobile ── */
@media (max-width: 768px) {
  .navbar { height: auto; min-height: 56px; padding: 10px 16px; flex-wrap: wrap; }
  .container { padding: 20px 16px 48px; }

  .page-header { gap: 12px; }
  .page-title  { font-size: 18px; }
  .toolbar     { width: 100%; }
  .toolbar .btn { flex: 1; justify-content: center; }

  .metrics { grid-template-columns: 1fr 1fr; }

  .filters { padding: 12px; gap: 10px; }
  .filter-actions { margin-left: 0; width: 100%; }
  .filter-actions .btn { flex: 1; justify-content: center; }

  /* Mobile cards en vez de tabla */
  .table-card { border-radius: var(--radius-lg); }
  .table-card table { min-width: 0; }
  .table-card thead { display: none; }
  .table-card tbody tr {
    display: block;
    border: none;
    border-bottom: 0.5px solid var(--border);
    padding: 14px 16px;
  }
  .table-card tbody tr:last-child { border-bottom: none; }
  .table-card tbody tr:hover td { background: transparent; }
  .table-card tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border: none;
    font-size: 13px;
  }
  .table-card tbody td::before {
    content: attr(data-label);
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .06em;
    flex: 0 0 50%;
  }
  .table-card td.td-r { text-align: right; }
  .table-card td.col-actions { padding-top: 10px; }
  .table-card td.col-actions::before { display: none; }
  .action-btns { width: 100%; }
  .action-btns .btn { flex: 1; justify-content: center; }
  .hide-mobile { display: none !important; }

  .modal { border-radius: var(--radius-lg); padding: 18px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }

  .form-card { padding: 20px; }
  .form-grid  { grid-template-columns: 1fr; gap: 12px; }
  .form-actions .btn { flex: 1; justify-content: center; }
}

@media (max-width: 420px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric-val { font-size: 18px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Nuevas clases para la vista de facturas rediseñada ──
   Pegar al final de tu CSS existente.
   No modifica ninguna clase ya existente.
────────────────────────────────────────────────── */

/* Layout de página */
.pg { /* sin cambios, usa .container ya existente */ }

.pg-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.pg-title { font-size: 20px; font-weight: 500; }
.pg-sub   { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* Panel de filtros con pills */
.filters-panel {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
}

.filter-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-section-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* Dropdown de filtro (Mes / Año) */
.dropdown-filter {
  position: relative;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  border: 0.5px solid var(--border-2);
  background: var(--muted-bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color .1s;
}
.dropdown-toggle:hover { border-color: var(--primary); }
.dropdown-caret { margin-left: auto; font-size: 10px; color: var(--text-2); transition: transform .15s; }
.dropdown-filter.open .dropdown-caret { transform: rotate(180deg); }
.dropdown-filter.open .dropdown-toggle { border-color: var(--primary); }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 180px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 6px;
  display: none;
}
.dropdown-filter.open .dropdown-menu { display: block; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: background .1s;
}
.dropdown-item:hover { background: var(--muted-bg); }
.dropdown-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Tabs de orden (Reciente / Antigua) */
.order-tabs {
  display: flex;
  gap: 3px;
  background: var(--muted-bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}
.order-tab {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-2);
  border: none;
  background: transparent;
  font-family: inherit;
  transition: background .1s, color .1s;
}
.order-tab:hover { color: var(--text); }
.order-tab.active {
  background: var(--surface);
  color: var(--text);
  border: 0.5px solid var(--border);
}

/* Acciones del panel de filtros */
.filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: auto;
}
.filter-count {
  font-size: 12px;
  color: var(--text-2);
}
.filter-clear {
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: color .1s, background .1s;
}
.filter-clear:hover {
  color: var(--text);
  background: var(--muted-bg);
}

/* Utilidades de tabla */
.td-muted { color: var(--text-2); }
.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.btn-xs { padding: 4px 10px; font-size: 12px; }

/* btn-danger en modo outline (solo para filas de tabla) */
.btn.btn-danger.btn-xs {
  background: transparent;
  border: 0.5px solid var(--danger-border);
  color: var(--danger);
}
.btn.btn-danger.btn-xs:hover {
  background: var(--danger-bg);
}

/* Badge de rol de administrador */
.badge-admin {
  background: var(--primary-light);
  border-color: transparent;
  color: var(--primary);
  font-weight: 500;
}

/* ── Pantalla de login ── */
.auth-wrap {
  min-height: calc(100vh - 56px - 84px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 380px;
}
.auth-header {
  text-align: center;
  margin-bottom: 20px;
}
.auth-icon {
  width: 44px;
  height: 44px;
  font-size: 20px;
  margin: 0 auto 12px;
}
.auth-grid { grid-template-columns: 1fr; gap: 14px; }
.auth-actions { justify-content: stretch; border-top: none; padding-top: 0; margin-top: 4px; }
.auth-actions .btn { flex: 1; justify-content: center; }

/* ── Responsive móvil ── */
@media (max-width: 768px) {
  .filters-panel {
    padding: 12px;
    gap: 14px;
  }
  .filter-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }
  .dropdown-toggle { min-width: 0; width: 100%; }
  .dropdown-menu { left: 0; right: 0; min-width: 0; }
}

/* Gráfico de evolución mensual */
.chart-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 20px 10px;
  margin-bottom: 20px;
}
.chart-card-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.chart-card-hdr h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.chart-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-2);
}
.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.legend-pablo { background: var(--primary); }
.legend-manolo { background: var(--info); }
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 160px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 34px;
  height: 100%;
  justify-content: flex-end;
  flex-shrink: 0;
}
.chart-col-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
}
.chart-bar {
  width: 11px;
  border-radius: 3px 3px 0 0;
}
.chart-bar-pablo { background: var(--primary); }
.chart-bar-manolo { background: var(--info); }
.chart-col-lbl {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 6px;
  white-space: nowrap;
}
.chart-col-val {
  font-size: 9px;
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
  min-height: 12px;
  margin-bottom: 2px;
}
@media (max-width: 768px) {
  .chart-card { padding: 14px 14px 8px; }
  .chart-bars { height: 130px; }
  .chart-bars-valores { height: 150px; }
  .chart-bars-valores .chart-col { min-width: 26px; }
  .chart-bars-valores .chart-col-bars { height: 110px; }
  .chart-bars-valores { gap: 5px; }
  .chart-bars-valores .chart-bar { width: 9px; }
  .chart-col-val { font-size: 8px; }
  .chart-col-lbl { font-size: 9px; }
  .chart-col-bars { height: 110px; }
}

/* Lista de categorías de gastos (panel estilo Revolut) */
.cat-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cat-row {
  display: block;
  padding: 12px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: background .15s;
}
.cat-row:hover { background: var(--muted-bg); }
.cat-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.cat-row-name { font-size: 14px; font-weight: 500; }
.cat-row-val { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.cat-row-bar {
  height: 6px;
  background: var(--muted-bg);
  border-radius: 3px;
  overflow: hidden;
}
.cat-row-bar-fill {
  height: 100%;
  background: var(--danger);
  border-radius: 3px;
}
.cat-row-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 5px;
}

/* Lista de movimientos (detalle de categoria) */
.mov-list {
  display: flex;
  flex-direction: column;
}
.mov-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 0.5px solid var(--border);
}
.mov-row:last-child { border-bottom: none; }
.mov-row-info { min-width: 0; }
.mov-row-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mov-row-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}
.mov-row-amount {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Lista de suscripciones */
.sub-list {
  display: flex;
  flex-direction: column;
}
.sub-row {
  padding: 14px 4px;
  border-bottom: 0.5px solid var(--border);
}
.sub-row:last-child { border-bottom: none; }
.sub-row-pausada { opacity: .55; }
.sub-row-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.sub-badge {
  margin-left: 8px;
  font-size: 10px;
  padding: 1px 7px;
  vertical-align: middle;
}
.sub-row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
@media (max-width: 480px) {
  .mov-row-title, .mov-row-amount { font-size: 13px; }
  .sub-row-actions { justify-content: stretch; }
  .sub-row-actions form { flex: 1; }
  .sub-row-actions .btn { width: 100%; justify-content: center; }
}