:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #0a1f3d;
  --muted: #687386;
  --line: #dbe1ea;
  --primary: #c79a2f;
  --primary-dark: #9a7420;
  --accent: #062b61;
  --accent-dark: #041d42;
  --danger: #b84b43;
  --shadow: 0 16px 48px rgba(154, 116, 32, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(4, 18, 42, 0.12), rgba(4, 18, 42, 0.74)),
    url("assets/graphics/splash-screen.png") center / cover no-repeat;
  animation: splashExit 0.6s ease 1.8s forwards;
}

.splash-content {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: #ffffff;
  text-align: center;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.36);
}

.splash-content img {
  width: 104px;
  height: 104px;
  border: 1px solid rgba(199, 154, 47, 0.58);
  border-radius: 8px;
  object-fit: cover;
}

.splash-content strong {
  font-size: 42px;
  line-height: 1;
}

.splash-content span {
  font-size: 15px;
  font-weight: 700;
}

@keyframes splashExit {
  to {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(4, 18, 42, 0.78) 0%, rgba(4, 18, 42, 0.58) 45%, rgba(4, 18, 42, 0.18) 100%),
    url("assets/graphics/login-background.png") center / cover no-repeat;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.54);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.30);
  backdrop-filter: blur(12px);
}

.login-logo {
  width: 130px;
  height: 130px;
  justify-self: center;
  border-radius: 8px;
  object-fit: cover;
}

.login-card h1 {
  margin: 0;
  text-align: center;
  color: var(--primary);
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-weight: 700;
  text-align: center;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #7a5a18 0%, #c79a2f 100%);
  color: #fffaf0;
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-logo {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  border: 1px solid rgba(199, 154, 47, 0.55);
  background: #ffffff;
  object-fit: cover;
}

.brand span {
  display: block;
  color: #fff4c8;
  font-size: 13px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: transparent;
  color: #fffaf0;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
}

h2 {
  font-size: 18px;
  margin-bottom: 0;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.session-badge {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff7df;
  color: #8a651a;
  font-size: 13px;
  font-weight: 800;
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  background: var(--primary);
  color: white;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.ghost-button {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.danger-button {
  background: #fff5f3;
  border-color: #f0c9c4;
  color: var(--danger);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.visual-hero,
.module-visual {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  border: 1px solid rgba(199, 154, 47, 0.32);
  border-radius: 8px;
  background: #7a5a18;
  box-shadow: var(--shadow);
}

.visual-hero::before,
.module-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(4, 18, 42, 0.78), rgba(4, 18, 42, 0.22) 58%, rgba(4, 18, 42, 0.06));
}

.dashboard-hero {
  min-height: 260px;
  background: url("assets/graphics/banner-principal.png") center / cover no-repeat;
}

.visual-hero > div {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  width: min(520px, 100%);
  padding: 30px;
  color: #ffffff;
}

.visual-hero span {
  color: #f2c866;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.visual-hero h2 {
  font-size: 28px;
  line-height: 1.15;
  text-wrap: balance;
}

.module-visual {
  min-height: 190px;
}

.savings-visual {
  background: url("assets/graphics/modulo-ahorro.png") center / cover no-repeat;
}

.credit-visual {
  background: url("assets/graphics/modulo-credito.png") center / cover no-repeat;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
}

.metric,
.panel,
.report-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  display: block;
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  margin-bottom: 12px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 14px;
  align-items: end;
}

.settings-grid {
  grid-template-columns: repeat(3, minmax(190px, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: white;
  color: var(--ink);
}

input:focus,
select:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(199, 154, 47, 0.22);
}

.form-action {
  align-self: end;
}

.calculation-box {
  min-height: 42px;
  padding: 12px;
  border-radius: 8px;
  background: #fff7df;
  color: #8a651a;
  font-weight: 700;
  font-size: 13px;
}

.calendar-box {
  grid-column: span 2;
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.calendar-day {
  display: inline-grid;
  gap: 2px;
  min-width: 98px;
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 800;
}

.calendar-day small {
  font-size: 11px;
  color: inherit;
  opacity: 0.8;
}

.calendar-day.paid {
  background: #ecfdf3;
  color: #166534;
}

.calendar-day.due {
  background: #fff1df;
  color: #8f5300;
}

.calendar-empty {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.status {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #fff7df;
  color: #8a651a;
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
}

.status.alert {
  background: #fff1df;
  color: #8f5300;
}

.activity-list,
.rules-list {
  display: grid;
  gap: 10px;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.activity-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.rules-list {
  grid-template-columns: 1fr;
  margin: 0;
}

.rules-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.rules-list dt {
  color: var(--muted);
}

.rules-list dd {
  margin: 0;
  font-weight: 800;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 16px;
}

.report-card {
  padding: 18px;
}

.report-card strong {
  display: block;
  margin-top: 10px;
  font-size: 26px;
}

.small-action {
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  padding: 0 10px;
}

.small-action:hover,
.compact-button:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.compact-button {
  min-height: 34px;
  padding: 0 12px;
}

.history-panel {
  border-color: rgba(199, 154, 47, 0.55);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metrics-grid,
  .two-column,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-hero,
  .module-visual {
    min-height: 180px;
  }

  .visual-hero > div {
    padding: 22px;
  }

  .visual-hero h2 {
    font-size: 22px;
  }

  .form-grid,
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .content,
  .sidebar {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  .nav,
  .form-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 26px;
  }
}
