/* Shineray gestión - tema oscuro premium */
:root {
  --bg: #0a0d14;
  --panel: #11151f;
  --panel-2: #161b28;
  --ink: #e7ebf3;
  --text: #e7ebf3;
  --muted: #8b94a7;
  --line: #222837;
  --line-soft: #1a2030;
  --blue: #5b8cff;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, 0.12);
  --green: #34d399;
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --red: #f87171;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --orange: #fbbf24;
  --warn: #fbbf24;
  --violet: #a78bfa;
  --cyan: #22d3ee;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 6px 18px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(1100px 480px at 18% -8%, rgba(91, 140, 255, 0.09), transparent 60%),
    radial-gradient(900px 420px at 95% 0%, rgba(167, 139, 250, 0.06), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 14px;
}

h1 { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -0.02em; }
h2 { margin-top: 0; font-size: 17px; letter-spacing: -0.01em; }
p { color: var(--muted); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3245; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #38425a; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 256px;
  padding: 22px 16px;
  background: rgba(13, 16, 24, 0.92);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 0 6px; }
.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  font-size: 17px;
  background: linear-gradient(135deg, #4f7dff, #8b5cf6);
  box-shadow: 0 8px 22px rgba(79, 125, 255, 0.35);
}
.brand strong { display: block; font-size: 16px; letter-spacing: -0.01em; }
.brand small { color: var(--muted); font-size: 11px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section {
  margin: 14px 6px 6px;
  color: #5a6377;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.nav-section:first-child { margin-top: 4px; }
.side-nav a {
  position: relative;
  min-height: 36px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #9aa3b8;
  font-weight: 600;
  border-radius: 9px;
  text-decoration: none;
  font-size: 13px;
  transition: background 0.12s ease, color 0.12s ease;
}
.side-nav a svg { width: 16px; height: 16px; flex: 0 0 16px; stroke: currentColor; opacity: 0.85; }
.side-nav a span {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 10px;
  background: var(--panel-2);
  color: var(--blue);
}
.side-nav a:hover { background: rgba(255, 255, 255, 0.04); color: var(--ink); }
.side-nav a.active {
  background: var(--accent-soft);
  color: #cdddff;
}
.side-nav a.active:before {
  content: "";
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--blue);
}
.side-nav a.active span { background: var(--blue); color: white; }

.sidebar-form { margin-top: auto; }
.sidebar-form button {
  width: 100%;
  background: transparent;
  color: #9aa3b8;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}
.sidebar-form button:hover { background: var(--danger-soft); color: var(--red); border-color: rgba(248, 113, 113, 0.35); }

.sync-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  text-align: center;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
}
.sync-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  border-radius: 14px;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, #4f7dff, #22d3ee);
}
.sync-card p { color: var(--muted); font-size: 12px; }
.sync-card a {
  display: block;
  padding: 10px;
  border-radius: 9px;
  background: var(--blue);
  color: #0a0d14;
  font-weight: 800;
  text-decoration: none;
}

/* Topbar móvil */
.mobile-topbar { display: none; }

.main {
  margin-left: 256px;
  padding: 28px 30px 40px;
}

/* ===== Cabeceras de página ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.topbar h1 { font-size: 27px; }
.topbar p { margin: 8px 0 0; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.date-pill,
.search-box {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}
.date-pill { display: inline-flex; align-items: center; padding: 0 16px; color: #aeb7cb; font-weight: 700; text-decoration: none; }
.date-pill:hover { border-color: var(--blue); color: var(--ink); }
.search-box { width: 280px; display: flex; overflow: hidden; }
.search-box input { min-width: 0; flex: 1; border: 0; border-radius: 0; padding: 0 14px; outline: none; background: transparent; color: var(--ink); }
.search-box button { border: 0; border-radius: 0; background: transparent; padding: 0 14px; color: var(--blue); font-weight: 800; box-shadow: none; }

/* ===== Tarjetas métricas (dashboard) ===== */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.metric-grid .metric-card {
  position: relative;
  min-height: 148px;
  overflow: hidden;
  padding: 18px;
  text-align: center;
  border-radius: 14px;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.metric-card.blue   { background: linear-gradient(160deg, rgba(91, 140, 255, 0.20), rgba(91, 140, 255, 0.03) 65%), var(--panel); border: 1px solid rgba(91, 140, 255, 0.28); }
.metric-card.green  { background: linear-gradient(160deg, rgba(52, 211, 153, 0.18), rgba(52, 211, 153, 0.03) 65%), var(--panel); border: 1px solid rgba(52, 211, 153, 0.26); }
.metric-card.violet { background: linear-gradient(160deg, rgba(167, 139, 250, 0.18), rgba(167, 139, 250, 0.03) 65%), var(--panel); border: 1px solid rgba(167, 139, 250, 0.26); }
.metric-card.orange { background: linear-gradient(160deg, rgba(251, 191, 36, 0.16), rgba(251, 191, 36, 0.03) 65%), var(--panel); border: 1px solid rgba(251, 191, 36, 0.24); }
.metric-card.red    { background: linear-gradient(160deg, rgba(248, 113, 113, 0.18), rgba(248, 113, 113, 0.03) 65%), var(--panel); border: 1px solid rgba(248, 113, 113, 0.26); }
.metric-icon {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-weight: 900;
  font-size: 13px;
}
.metric-card.blue .metric-icon   { background: rgba(91, 140, 255, 0.16); color: var(--blue); }
.metric-card.green .metric-icon  { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.metric-card.violet .metric-icon { background: rgba(167, 139, 250, 0.15); color: var(--violet); }
.metric-card.orange .metric-icon { background: rgba(251, 191, 36, 0.14); color: var(--orange); }
.metric-card.red .metric-icon    { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.metric-grid .metric-card span { display: block; margin-top: 12px; font-weight: 700; color: var(--muted); font-size: 13px; }
.metric-grid .metric-card small { display: block; opacity: 0.75; color: var(--muted); margin-top: 2px; font-size: 11px; }
.metric-grid .metric-card strong { display: block; margin-top: 12px; font-size: 24px; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.sparkline,
.sparkline:before,
.sparkline:after {
  position: absolute;
  right: -10px;
  bottom: 16px;
  width: 120px;
  height: 42px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  transform: rotate(-14deg);
}
.metric-card.blue .sparkline, .metric-card.blue .sparkline:before, .metric-card.blue .sparkline:after { border-bottom-color: rgba(91, 140, 255, 0.45); }
.metric-card.green .sparkline, .metric-card.green .sparkline:before, .metric-card.green .sparkline:after { border-bottom-color: rgba(52, 211, 153, 0.45); }
.metric-card.violet .sparkline, .metric-card.violet .sparkline:before, .metric-card.violet .sparkline:after { border-bottom-color: rgba(167, 139, 250, 0.45); }
.sparkline:before,
.sparkline:after { content: ""; right: 34px; bottom: -7px; width: 50px; height: 24px; }
.sparkline:after { right: 84px; bottom: 0; width: 40px; }
.bar-spark { position: absolute; right: 16px; bottom: 16px; display: flex; align-items: end; gap: 6px; }
.bar-spark i { width: 7px; height: 16px; border-radius: 3px 3px 0 0; background: rgba(251, 191, 36, 0.35); }
.bar-spark i:nth-child(2) { height: 26px; }
.bar-spark i:nth-child(3) { height: 36px; }
.bar-spark i:nth-child(4) { height: 46px; background: rgba(251, 191, 36, 0.55); }
.bar-spark i:nth-child(5) { height: 58px; background: rgba(251, 191, 36, 0.75); }
.ring-spark {
  position: absolute;
  right: 20px;
  bottom: 18px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 9px solid rgba(248, 113, 113, 0.18);
  border-top-color: var(--red);
}

/* ===== Grilla de contenido del dashboard ===== */
.content-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}
.content-grid .panel { grid-column: span 4; }
.cash-panel { grid-column: span 4; }
.side-column { grid-column: span 3; display: flex; flex-direction: column; gap: 16px; }
.content-grid .wide-panel { grid-column: span 6; }
.content-grid .capital-panel { grid-column: span 6; }
.content-grid .activity-panel { grid-column: span 12; order: 99; }
.small-panel { grid-column: auto; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.panel-head div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head a,
.count {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}
.panel-head a:hover { border-color: var(--blue); background: var(--accent-soft); }
.panel-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 900;
}
.blue-soft { background: var(--accent-soft); color: var(--blue); }
.green-soft { background: var(--success-soft); color: var(--green); }
.red-soft { background: var(--danger-soft); color: var(--red); }
.violet-soft { background: rgba(167, 139, 250, 0.12); color: var(--violet); }

.cash-summary { display: grid; grid-template-columns: 1fr 116px; gap: 16px; align-items: center; }
.cash-summary small,
.three-stat small,
.capital-grid small,
.footer-stats small { display: block; color: var(--muted); font-size: 12px; }
.cash-summary strong,
.three-stat strong { display: block; margin-top: 6px; font-size: 18px; font-variant-numeric: tabular-nums; }
.donut {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: conic-gradient(var(--blue) 0 100%);
  position: relative;
}
.donut:after { content: ""; position: absolute; inset: 26px; border-radius: 50%; background: var(--panel); }
.cash-summary ul { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 12px; }
.cash-summary li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; }
.cash-summary li span { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); }
.cash-summary li a { color: inherit; text-decoration: none; font-weight: 700; }
.cash-summary li a:hover { color: var(--blue); }
.cash-summary li strong { font-variant-numeric: tabular-nums; }

.three-stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }

/* Barras del dashboard */
.bar-list.graph { display: grid; gap: 11px; margin-bottom: 16px; }
.bar-list.graph .bar-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.bar-list.graph .bar-row span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; color: var(--muted); }
.bar-list.graph .bar-row div { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.bar-list.graph .bar-row i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4f7dff, #7da4ff); }
.bar-list.graph.red-bars i { background: linear-gradient(90deg, #ef4444, #fb8a8a); }
.bar-list.graph .bar-row strong { font-size: 12px; font-variant-numeric: tabular-nums; }

.preview-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 12px; }
.preview-table th { padding: 9px 4px; color: #707a90; text-align: left; border-bottom: 1px solid var(--line); text-transform: none; letter-spacing: 0; }
.preview-table td { padding: 10px 4px; border-bottom: 1px solid var(--line-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.preview-table a { color: #8fb0ff; text-decoration: none; }
.compact td,
.compact th { padding-top: 7px; padding-bottom: 7px; }
.good-text { color: var(--green); }
.bad-text { color: var(--red); }

.alert-row {
  min-height: 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 700;
  font-size: 12.5px;
  text-decoration: none;
  color: inherit;
}
.alert-row span { color: var(--muted); font-size: 11px; font-weight: 500; }
.alert-row.danger  { background: var(--danger-soft); color: #fca5a5; border-color: rgba(248, 113, 113, 0.25); }
.alert-row.warning { background: rgba(251, 146, 60, 0.10); color: #fdba74; border-color: rgba(251, 146, 60, 0.22); }
.alert-row.amber   { background: rgba(251, 191, 36, 0.08); color: #fcd34d; border-color: rgba(251, 191, 36, 0.20); }
.alert-row.info    { background: var(--accent-soft); color: #a9c4ff; border-color: rgba(91, 140, 255, 0.25); }

.activity-list { display: grid; gap: 12px; }
.activity-list a { display: grid; grid-template-columns: 10px 1fr; column-gap: 10px; align-items: start; text-decoration: none; color: inherit; }
.activity-list a > span { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--success-soft); }
.activity-list strong { font-size: 13px; }
.activity-list small { grid-column: 2; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-list a:hover strong { color: var(--blue); }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.quick-grid a {
  min-height: 52px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--blue);
  background: var(--accent-soft);
  font-weight: 800;
  font-size: 12px;
  text-decoration: none;
  transition: transform 0.1s ease, border-color 0.1s ease;
}
.quick-grid a:hover { transform: translateY(-1px); border-color: currentColor; }
.quick-grid a:nth-child(2),
.quick-grid a:nth-child(6) { color: var(--green); background: var(--success-soft); }
.quick-grid a:nth-child(3) { color: var(--violet); background: rgba(167, 139, 250, 0.10); }
.quick-grid a:nth-child(4) { color: var(--orange); background: rgba(251, 191, 36, 0.08); }

.dividend-bars { display: grid; gap: 14px; }
.dividend-bars label { display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 6px; font-weight: 700; color: var(--ink); font-size: 13px; }
.dividend-bars > div > span { display: block; height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.dividend-bars i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8b5cf6, #b794ff); }
.footer-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.footer-stats div,
.capital-grid div {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
}
.footer-stats strong,
.capital-grid strong { display: block; margin-top: 8px; font-size: 17px; font-variant-numeric: tabular-nums; }
.capital-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.area-line { display: block; height: 40px; margin-top: 14px; border-bottom: 2px solid var(--blue); border-radius: 50%; opacity: 0.7; }
.green-line { border-bottom-color: var(--green); }
.red-line { border-bottom-color: var(--red); }

/* ===== Tarjetas y paneles generales ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-soft);
}

.card { padding: 18px; }
.card span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.card strong { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.panel { padding: 18px; overflow: auto; }

.panel-warning { border-color: rgba(251, 146, 60, 0.30); background: rgba(251, 146, 60, 0.05); }
.panel-warning h2 { color: #fdba74; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* ===== Tablas ===== */
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  text-align: left;
  color: #707a90;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:hover td { background: rgba(255, 255, 255, 0.025); }
td a { color: #8fb0ff; font-weight: 600; text-decoration: none; }
td a:hover { color: var(--blue); text-decoration: underline; }
.click-row { cursor: pointer; }
.opening-row td { background: var(--panel-2); font-weight: 700; }

.positive { color: var(--success); font-weight: 700; }
.negative { color: var(--danger); font-weight: 700; }

/* ===== Formularios ===== */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 14px; }
.inline-actions {
  display: grid;
  grid-template-columns: 145px minmax(130px, 1fr) 110px auto;
  gap: 8px;
  align-items: center;
  min-width: 520px;
}
.inline-actions input,
.inline-actions select { min-height: 36px; padding: 7px 9px; }

.check-action-cell { min-width: 330px; }
.check-collect-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 8px;
  align-items: center;
  max-width: 360px;
}
.check-collect-form input,
.check-collect-form select,
.check-collect-form button { min-height: 34px; padding: 6px 8px; font-size: 12px; }
.check-collect-form button { justify-content: center; }

.uppercase-cell { text-transform: uppercase; }

label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 600; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 12px;
  background: #0d111a;
  color: var(--ink);
  font: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input::placeholder, textarea::placeholder { color: #5a6377; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.18);
}
input[type="date"] { color-scheme: dark; }
select option { background: var(--panel); color: var(--ink); }
textarea { min-height: 90px; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #6b97ff, #4f7dff);
  color: #f5f8ff;
  border: 0;
  border-radius: 9px;
  padding: 10px 16px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(79, 125, 255, 0.25), 0 1px 0 rgba(255, 255, 255, 0.15) inset;
  transition: filter 0.1s ease, transform 0.1s ease;
}
button:hover, .button:hover { filter: brightness(1.1); }
button:active, .button:active { transform: translateY(1px); }

.icon-button { width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 24px; line-height: 1; }

.button.secondary, button.secondary { background: var(--panel-2); color: #aeb7cb; box-shadow: none; border: 1px solid var(--line); }
.button.secondary:hover, button.secondary:hover { color: var(--ink); border-color: #38425a; }
button.danger { background: linear-gradient(180deg, #f87171, #ef4444); box-shadow: 0 6px 18px rgba(239, 68, 68, 0.25); }

.actions, .toolbar, .inline-form { display: flex; gap: 10px; align-items: center; }

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
}
.segmented a { color: var(--muted); padding: 9px 12px; text-decoration: none; font-weight: 700; }
.segmented a.active { background: var(--blue); color: #0a0d14; }

.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
}
.toolbar input { max-width: 420px; }

.pill { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.pill.warn { background: rgba(251, 191, 36, 0.14); color: #fcd34d; }
.pill.info { background: var(--accent-soft); color: #a9c4ff; }
.pill.success { background: var(--success-soft); color: #6ee7b7; }
.pill.danger { background: var(--danger-soft); color: #fca5a5; }

.pill-action { margin-left: 6px; padding: 4px 9px; font-size: 11px; border-radius: 999px; }

.check { flex-direction: row; align-items: center; gap: 8px; }
.check input { width: auto; }
input[type="checkbox"] { accent-color: var(--blue); }

.messages { margin-bottom: 14px; }
.flash {
  padding: 12px 14px;
  border-radius: 11px;
  margin-bottom: 8px;
  background: var(--accent-soft);
  color: #a9c4ff;
  border: 1px solid rgba(91, 140, 255, 0.25);
  font-weight: 600;
}
.flash.error { background: var(--danger-soft); color: #fca5a5; border-color: rgba(248, 113, 113, 0.3); }
.flash.success { background: var(--success-soft); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.3); }
.flash.warning { background: rgba(251, 191, 36, 0.10); color: #fcd34d; border-color: rgba(251, 191, 36, 0.25); }

/* ===== Dashboard mensual y vistas heredadas ===== */
.dashboard-shell { display: flex; flex-direction: column; gap: 16px; }
.dashboard-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.dashboard-header h1 { font-size: 26px; }
.dashboard-header p { margin: 6px 0 0; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.period-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}
.period-form { display: flex; align-items: center; gap: 8px; }
.period-form input { min-width: 142px; height: 38px; }
.period-form button,
.nav-button { height: 38px; border-radius: 8px; }
.nav-button {
  display: inline-flex;
  width: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  box-shadow: none;
}
.nav-button:hover { border-color: var(--blue); }

.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 14px; }

.metric-card,
.data-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-soft);
}
.metric-card { padding: 16px; min-height: 116px; }
.metric-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 10px; }
.metric-card strong { display: block; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.metric-card small { display: block; color: var(--muted); margin-top: 10px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-12 { grid-column: span 12; }

.data-card { padding: 16px; overflow: auto; }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-header h2 { margin: 0; font-size: 15px; }
.card-header p { margin: 4px 0 0; font-size: 12px; }

.modern-table th { font-size: 10.5px; }
.modern-table th,
.modern-table td { padding: 9px 6px; }

.bar-list { display: grid; gap: 14px; }
.bar-list.compact { gap: 16px; }
.bar-row-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.bar-row-label span { color: var(--ink); font-weight: 700; }
.bar-row-label strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; overflow: hidden; background: var(--panel-2); border-radius: 999px; }
.bar-fill { height: 100%; border-radius: inherit; }
.bar-positive { background: linear-gradient(90deg, #10b981, #4ade80); }
.bar-accent { background: linear-gradient(90deg, #4f7dff, #7da4ff); }
.bar-negative { background: linear-gradient(90deg, #ef4444, #fb8a8a); }

.column-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  align-items: end;
  gap: 18px;
  min-height: 330px;
  padding: 18px 6px 4px;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(to top, rgba(139, 148, 167, 0.10) 1px, transparent 1px) 0 34px / 100% 64px;
}
.column-item { display: grid; grid-template-rows: auto 230px auto; gap: 9px; min-width: 0; }
.column-value { min-height: 18px; text-align: center; font-size: 12px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.column-track {
  position: relative;
  display: flex;
  align-items: end;
  height: 230px;
  border-radius: 12px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px rgba(139, 148, 167, 0.14);
  overflow: hidden;
}
.column-fill { width: 100%; min-height: 4px; border-radius: 12px 12px 0 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.column-income { background: linear-gradient(180deg, #4ade80 0%, #10b981 100%); }
.column-expense { background: linear-gradient(180deg, #fb8a8a 0%, #ef4444 100%); }
.column-label {
  min-height: 34px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.stat-list,
.account-list { display: grid; gap: 10px; }
.dividend-total { margin-top: 16px; padding-top: 4px; border-top: 1px solid var(--line); }
.stat-list div,
.account-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.stat-list div:last-child,
.account-list a:last-child { border-bottom: 0; }
.stat-list span,
.account-list span { color: var(--muted); font-weight: 600; }
.stat-list strong { font-variant-numeric: tabular-nums; }
.account-list a { color: var(--ink); text-decoration: none; }
.account-list a:hover span { color: var(--blue); }

.view-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}
.view-tabs a { color: var(--muted); padding: 8px 12px; border-radius: 8px; text-decoration: none; font-weight: 700; }
.view-tabs a.active { background: var(--accent-soft); color: #cdddff; }

.delete-form { margin-top: 16px; }

/* ===== Carga inteligente ===== */
.big-textarea {
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.smart-edit-table input,
.smart-edit-table select { min-width: 120px; padding: 7px 8px; font-size: 12px; }
.smart-edit-table input[type="checkbox"] { min-width: auto; width: 18px; height: 18px; }
.smart-edit-table .smart-wide-input { min-width: 220px; }
.smart-edit-table td:last-child { min-width: 220px; max-width: 320px; }

.conf-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.conf-high { background: var(--success-soft); color: #6ee7b7; }
.conf-mid { background: rgba(251, 191, 36, 0.14); color: #fcd34d; }
.conf-low { background: var(--danger-soft); color: #fca5a5; }

.dup-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: var(--danger-soft);
  color: #fca5a5;
}
.duplicate-row td { background: rgba(248, 113, 113, 0.05); }

.confirm-box {
  margin-top: 18px;
  background: var(--success-soft);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.muted { color: var(--muted); font-size: 12px; }

.resolver-dialog {
  width: min(920px, 92vw);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.resolver-dialog::backdrop { background: rgba(4, 6, 10, 0.7); backdrop-filter: blur(2px); }
.resolver-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin: 12px 0;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
  align-items: end;
  background: var(--panel-2);
}
.suggestion { margin-top: 6px; color: #6ee7b7; font-size: 13px; }

.pdf-dialog { width: min(980px, 95vw); }
.pdf-frame { width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

code { background: var(--panel-2); border: 1px solid var(--line-soft); padding: 3px 6px; border-radius: 6px; font-size: 12px; }

/* ===== Login ===== */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: min(380px, 100%); }
.login-brand {
  display: block;
  color: var(--ink);
  margin-bottom: 18px;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}
.login-brand span { font-size: 13px; font-weight: 500; color: var(--muted); }
.login-box .form-card,
.form-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ===== Responsive ===== */
@media (max-width: 1500px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .content-grid .panel,
  .cash-panel { grid-column: span 4; }
  .side-column { grid-column: span 4; }
  .content-grid .wide-panel,
  .content-grid .capital-panel { grid-column: span 6; }
  .content-grid .activity-panel { grid-column: span 12; }
}

@media (max-width: 1000px) {
  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(13, 16, 24, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line-soft);
  }
  .mobile-topbar .brand strong { font-size: 15px; }
  .menu-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    display: grid;
    place-items: center;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--ink);
    font-size: 18px;
    box-shadow: none;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    width: 272px;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 16px; }
  .topbar,
  .top-actions { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .cards, .grid-2, .form-grid, .kpi-grid, .dashboard-grid,
  .metric-grid, .content-grid, .cash-summary, .capital-grid, .footer-stats {
    grid-template-columns: 1fr;
  }
  .span-4, .span-5, .span-6, .span-7, .span-12 { grid-column: span 1; }
  .content-grid .panel, .cash-panel, .side-column,
  .content-grid .wide-panel, .content-grid .capital-panel { grid-column: span 1; }
  .dashboard-header, .period-card { align-items: stretch; flex-direction: column; }
  .period-card, .period-form { width: 100%; }
  .page-header { align-items: start; flex-direction: column; }
}
