* {
  box-sizing: border-box;
}

body {
  --action-btn-height: 36px;
  --action-btn-font-size: 0.95rem;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f5f5;
  color: #222;
  margin: 0;
  padding: 2rem;
  position: relative;
}

.container {
  max-width: 720px;
  margin: 2rem auto;
  padding: 2rem;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.splash-page .container {
  background: rgba(24, 26, 30, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.splash {
  max-width: 840px;
}

body:not(.splash-page)::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("/assets/codito-splash.png") center/cover no-repeat;
  opacity: 0.08;
  filter: blur(8px);
  transform: scale(1.05);
  z-index: 0;
  pointer-events: none;
}

body:not(.splash-page) .container,
body:not(.splash-page) .top-bar,
body:not(.splash-page) .menu-wrapper,
body:not(.splash-page) .scroll-top {
  position: relative;
}

body:not(.splash-page) .container {
  z-index: 1;
}

body:not(.splash-page) .top-bar {
  z-index: 60;
}

body:not(.splash-page) .scroll-top {
  z-index: 50;
}

body.splash-page .menu-wrapper,
body.splash-page .scroll-top {
  display: none;
}

.splash-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.splash-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.splash-brand-centered {
  justify-content: center;
  text-align: center;
  width: 100%;
}

.login-actions {
  margin-top: 1.25rem;
}

.login-google-block {
  display: grid;
  gap: 0.5rem;
  max-width: 320px;
}

.splash-brand-centered .login-google-block {
  margin: 0 auto;
}

.splash-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: 1px solid rgba(120, 130, 150, 0.35);
  background: rgba(20, 22, 26, 0.85);
  color: #8ab4ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.9rem;
}

.splash-title {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.01em;
}

.splash-subtitle {
  margin: 0.35rem 0 0 0;
  color: #8e9096;
}

.splash-art-frame {
  border-radius: 18px;
  border: 1px dashed rgba(120, 130, 150, 0.35);
  padding: 1rem;
  background: rgba(20, 22, 26, 0.06);
}

.splash-art-image {
  width: 88%;
  height: auto;
  display: block;
  border-radius: 14px;
  object-fit: cover;
  margin: 0 auto;
}

@media (max-width: 720px) {
  .splash-hero {
    grid-template-columns: 1fr;
  }

  .splash-brand {
    justify-content: center;
    text-align: center;
    flex-direction: column;
  }

  .splash-brand-centered {
    align-items: center;
  }
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 720px;
  margin: 0 auto;
  padding: 0.5rem 0;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.lang-switch select {
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
}

form {
  margin: 0;
}

input {
  display: block;
  width: 100%;
  margin: 0 0 0.75rem 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  font-size: 1rem;
}

textarea {
  display: block;
  width: 100%;
  margin: 0 0 0.75rem 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
}

select {
  display: block;
  width: 100%;
  margin: 0 0 0.75rem 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  font-size: 1rem;
  background: #ffffff;
}

.field {
  margin-bottom: 0.75rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0.75rem 1rem;
}

.field.half {
  grid-column: span 6;
}

.field.third {
  grid-column: span 4;
}

.field.quarter {
  grid-column: span 3;
}

.field.three-quarters {
  grid-column: span 9;
}

.field.two-thirds {
  grid-column: span 8;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  color: #555555;
  margin-bottom: 0.25rem;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.field-row input {
  margin-bottom: 0;
}

.field-row select {
  margin-bottom: 0;
}

.combo {
  position: relative;
  width: 100%;
}

.combo-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  z-index: 20;
  display: none;
}

.combo-dropdown.open {
  display: block;
}

.combo-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

.combo-option:hover,
.combo-option.active {
  background: #eef3ff;
}

.combo-flag {
  font-size: 1rem;
}

.combo-label {
  flex: 1;
  font-size: 0.95rem;
  color: #222;
}

.combo-code {
  font-weight: 600;
  color: #2f6fed;
}
.field-error {
  min-height: 1rem;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: #a40000;
}

.field-ok {
  display: none;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e8f6ec;
  color: #1b5e20;
  border: 1px solid #b7e1c0;
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(27, 94, 32, 0.15);
}

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .field.half,
  .field.third,
  .field.two-thirds {
    grid-column: span 1;
  }
}

@media (max-width: 480px) {
  .form-grid {
    display: block;
  }

  .field {
    width: 100%;
  }

  .field-row {
    flex-direction: column;
    align-items: stretch;
  }

  .field-row .field-ok {
    align-self: flex-end;
    margin-top: 0.35rem;
  }
}

button {
  padding: 0.6rem 0.9rem;
  border: 0;
  border-radius: 6px;
  background: #2f6fed;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

button:hover {
  background: #275fd0;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

h1,
h2 {
  margin: 0 0 1rem 0;
}

h3.section-title {
  margin: 1.5rem 0 0.75rem 0;
}

a {
  display: inline-block;
  margin: 0.75rem 0.5rem 0 0;
  color: #2f6fed;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul {
  list-style: none;
  padding: 0;
}

li {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin: 0.5rem 0;
}

[data-testid="widget-users"] h2 {
  margin-top: 0;
}

[data-testid="user-row"] {
  padding: 0;
}

.user-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 0.5rem;
  align-items: start;
  padding: 0.5rem 0.75rem;
}

.user-icon {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  background: #eef3ff;
  border: 1px solid #d6e0ff;
  border-radius: 50%;
  font-size: 1rem;
}

.user-meta {
  display: grid;
  gap: 0.25rem;
}

.user-meta strong {
  font-size: 1.05rem;
}

.user-meta span {
  color: #555555;
  font-size: 0.95rem;
}

.phone-display {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.phone-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: #eef3ff;
  color: #2f6fed;
  border: 1px solid #d6e0ff;
}

.nav-links {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.container > section {
  margin-top: 1.5rem;
}

.container > section:first-of-type {
  margin-top: 1rem;
}

.collapsible-body {
  transition: max-height 200ms ease, opacity 200ms ease;
}

.collapsible-body.is-collapsed {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.collapse-toggle {
  margin-left: auto;
}

.menu-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
  z-index: 30;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(120, 130, 150, 0.3);
  background: rgba(20, 22, 26, 0.85);
  color: #8ab4ff;
  cursor: pointer;
}

.menu-icon {
  width: 18px;
  height: 2px;
  background: currentColor;
  position: relative;
  display: inline-block;
  border-radius: 999px;
}

.menu-icon::before,
.menu-icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
}

.menu-icon::before {
  top: -6px;
}

.menu-icon::after {
  top: 6px;
}

.menu-panel {
  position: absolute;
  top: 0;
  left: 52px;
  min-width: 220px;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(20, 22, 26, 0.95);
  border: 1px solid rgba(120, 130, 150, 0.25);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
  display: none;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 40;
}

.scroll-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(120, 130, 150, 0.35);
  background: rgba(20, 22, 26, 0.9);
  color: #8ab4ff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 10;
}

.scroll-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-top span {
  font-size: 1.1rem;
  line-height: 1;
}

.reports-line-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 0.75rem;
  align-items: end;
  height: 180px;
  padding: 0.5rem 0;
}

.reports-line-col {
  display: grid;
  gap: 0.4rem;
  text-align: center;
  color: #9aa0a6;
  font-size: 0.75rem;
}

.reports-line-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.35rem;
  height: 140px;
}

.reports-line-bar {
  width: 10px;
  border-radius: 999px;
}

.reports-line-bar.income {
  background: #4c7dff;
}

.reports-line-bar.expense {
  background: #f6c15b;
}

.reports-donut {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 1rem auto 0.5rem;
  background: conic-gradient(#4c7dff 0 60%, #ffb54a 60% 85%, #f6c15b 85% 100%);
}

.reports-donut-center {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #1e1e1e;
  display: grid;
  place-items: center;
  color: #eaeaea;
}

.reports-bars {
  display: grid;
  gap: 0.75rem;
}

.reports-bar-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 0.75rem;
  align-items: center;
}

.reports-bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.reports-bar-fill {
  display: block;
  height: 100%;
  background: #4c7dff;
  border-radius: 999px;
}

.reports-bar-value {
  font-weight: 700;
}

.reports-stack-bar {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
}

.reports-stack-primary {
  background: #4c7dff;
}

.reports-stack-reserve {
  background: #f6c15b;
}

.reports-stack-values {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-top: 0.5rem;
}

.menu-wrapper.open .menu-panel {
  display: flex;
}

.menu-panel a {
  color: #8ab4ff;
  font-weight: 600;
  text-decoration: none;
}

.menu-panel a:hover {
  color: #c2d6ff;
}

.widget-actions {
  margin-top: 0.5rem;
}

.widget-actions a {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  font-size: var(--action-btn-font-size);
  border-radius: 6px;
  background: #2f6fed;
  color: #ffffff;
  text-decoration: none;
  min-height: var(--action-btn-height);
  line-height: 1;
}

.widget-actions a:hover {
  background: #275fd0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  margin-left: 0.5rem;
  padding: 0 6px;
  border-radius: 999px;
  background: #ffffff;
  color: #2f6fed;
  font-size: 0.75rem;
  font-weight: 700;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 0.35rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  background: #eef3ff;
  color: #2f6fed;
  border: 1px solid #d6e0ff;
  cursor: help;
  position: relative;
}

.info-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #ffffff;
  color: #222;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  transform-origin: bottom center;
}

.info-icon::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #ffffff transparent transparent transparent;
  opacity: 0;
  transition: opacity 150ms ease;
}

.info-icon:hover::after,
.info-icon:hover::before,
.info-icon.active::after,
.info-icon.active::before {
  opacity: 1;
}

.info-icon:hover::after,
.info-icon.active::after {
  transform: translateX(-50%) translateY(-2px) scale(1);
}

.info-icon.closing::after,
.info-icon.closing::before {
  opacity: 0;
}

@media (max-width: 720px) {
  .info-icon::after {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(2px) scale(0.98);
    max-width: 70vw;
    white-space: normal;
    word-break: break-all;
  }

  .info-icon:hover::after,
  .info-icon.active::after {
    transform: translateX(0) translateY(-2px) scale(1);
  }

  .info-icon.closing::after,
  .info-icon.closing::before {
    opacity: 0;
  }

  .payment-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .payment-meta {
    text-align: left;
  }

  .budget-summary {
    grid-template-columns: 1fr;
  }

  .income-form {
    grid-template-columns: 1fr;
  }

  .income-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    padding: 1rem;
  }

  .container {
    padding: 1.25rem;
    margin: 1rem auto;
  }

  .top-bar {
    padding: 0.25rem 0;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .lang-switch {
    width: 100%;
    justify-content: flex-end;
  }

  .nav-links a,
  .widget-actions a,
  .view-toggle button,
  .form-actions button,
  .form-actions a,
  .income-item button {
    width: 100%;
    text-align: center;
  }

  .view-toggle {
    flex-direction: column;
  }

  .month-filter {
    flex-direction: column;
    align-items: stretch;
  }

  .month-filter select {
    max-width: 100%;
  }

  .field-row {
    flex-direction: column;
    align-items: stretch;
  }

  .field-ok {
    align-self: flex-end;
  }

  .combo-dropdown {
    max-height: 240px;
  }

  .payment-actions {
    flex-direction: column;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  h3.section-title {
    font-size: 1rem;
  }

  input,
  select,
  button,
  .ghost,
  .widget-actions a {
    font-size: 1rem;
  }

  .chart-card {
    padding: 0.85rem;
  }

  .payment-item,
  .income-item {
    padding: 0.6rem 0.75rem;
  }

  .nav-links {
    gap: 0.5rem;
  }
}

@media (max-width: 720px) {
  .payment-actions button {
    width: 100%;
  }

  .user-row {
    grid-template-columns: 1fr;
  }

  .user-icon {
    margin-bottom: 0.25rem;
  }

  .modal {
    max-height: 85vh;
    overflow-y: auto;
  }
}

.view-toggle {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem 0;
}

.tab-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab-button {
  background: #eef3ff;
  color: #2f6fed;
  border: 1px solid #d6e0ff;
}

.tab-button.active {
  background: #2f6fed;
  color: #ffffff;
  border-color: #2f6fed;
}

.tab-panel.is-hidden {
  display: none;
}

.view-toggle button {
  background: #eef3ff;
  color: #2f6fed;
  border: 1px solid #d6e0ff;
}

.view-toggle button.active {
  background: #2f6fed;
  color: #ffffff;
  border-color: #2f6fed;
}

[data-view-mode="compact"] .user-meta span {
  display: none;
}

[data-view-mode="compact"] .user-meta span:nth-of-type(1) {
  display: inline;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.mode-badge {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: #eef3ff;
  border: 1px solid #d6e0ff;
  color: #2f6fed;
  font-size: 0.85rem;
  font-weight: 600;
}

.details {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.details strong {
  display: inline-block;
  width: 130px;
}

.payment-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.payment-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
}

.payment-actions {
  display: flex;
  gap: 0.5rem;
}


.chart-card {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  background: #ffffff;
}

.chart-card [data-testid="chart-updated"] {
  opacity: 0.7;
  transition: opacity 800ms ease;
}

.chart-card [data-testid="chart-updated"].fade-out {
  opacity: 0.3;
}

.month-filter {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 1rem 0;
}

.month-filter select {
  max-width: 200px;
}

.month-filter select option[data-current="true"] {
  font-weight: 700;
}

.ghost {
  background: transparent;
  border: 1px solid #cfcfcf;
  color: #2f6fed;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
}

.ghost:hover {
  border-color: #2f6fed;
}

.chart-bar {
  display: flex;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: #f0f0f0;
  margin: 0.75rem 0 1rem 0;
}

.chart-paid {
  background: #2f6fed;
}

.chart-pending {
  background: #ffb54a;
}

.chart-legend {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.budget-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.budget-ok {
  color: #1b5e20;
}

.budget-warn {
  color: #a40000;
}

.income-form {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.6fr auto;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.income-form input[data-testid="income-source"] {
  max-width: none;
}

.income-form input,
.income-form select {
  margin-bottom: 0;
}

.income-form button {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  font-size: var(--action-btn-font-size);
  border-radius: 6px;
  line-height: 1;
  min-height: var(--action-btn-height);
}

.income-form button[data-testid="add-income"] {
  padding: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.income-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.income-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin: 0.5rem 0;
  background: #ffffff;
}

.income-filter {
  display: flex;
  justify-content: flex-end;
  margin: 0.35rem 0 0.75rem;
}

.budget-breakdown {
  margin: 0.5rem 0 0.75rem;
}

.budget-breakdown-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #f0f0f0;
  border: 1px solid #e0e0e0;
}

.budget-breakdown-primary {
  background: #2f6fed;
}

.budget-breakdown-reserve {
  background: #ffb54a;
}

.budget-breakdown-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.income-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.income-tag.primary {
  background: #eef3ff;
  color: #2f6fed;
  border-color: #d6e0ff;
}

.income-tag.reserve {
  background: #fff4cc;
  color: #8a6d00;
  border-color: #ffe7a3;
}

.income-actions {
  display: inline-flex;
  gap: 0.35rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--action-btn-height);
  height: var(--action-btn-height);
  border-radius: 8px;
  border: 1px solid rgba(120, 130, 150, 0.35);
  background: rgba(20, 22, 26, 0.02);
  color: #2f6fed;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  position: relative;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 22, 26, 0.95);
  color: #f0f3f8;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 20;
}

.icon-btn[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(20, 22, 26, 0.95) transparent transparent transparent;
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
  z-index: 20;
}

.icon-btn[data-tooltip]:hover::after,
.icon-btn[data-tooltip]:focus-visible::after,
.icon-btn[data-tooltip]:hover::before,
.icon-btn[data-tooltip]:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

.add-income-btn {
  border-color: rgba(47, 111, 237, 0.35);
  background: rgba(47, 111, 237, 0.08);
}

.add-income-btn:hover {
  background: rgba(47, 111, 237, 0.14);
}

  .icon-btn.danger {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.35);
  }

  .icon-btn.success {
    color: #9ae6b4;
    border-color: rgba(61, 220, 132, 0.4);
    background: rgba(61, 220, 132, 0.12);
  }

.icon-btn.success {
  color: #1b5e20;
  border-color: rgba(61, 220, 132, 0.45);
  background: rgba(61, 220, 132, 0.08);
}

.icon-btn:hover {
  background: rgba(47, 111, 237, 0.08);
}

  .icon-btn.danger:hover {
    background: rgba(255, 107, 107, 0.12);
  }

  .icon-btn.success:hover {
    background: rgba(61, 220, 132, 0.2);
  }

.icon-btn.success:hover {
  background: rgba(61, 220, 132, 0.18);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  transition: opacity 180ms ease;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  width: min(520px, 92vw);
  padding: 1rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: transform 200ms ease, opacity 200ms ease;
}

.modal-backdrop.is-open {
  opacity: 1;
}

.modal-backdrop.is-open .modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.modal-backdrop:not([hidden]) {
  opacity: 1;
}

.modal-backdrop:not([hidden]) .modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.modal-backdrop.is-closing {
  opacity: 0;
}

.modal-backdrop.is-closing .modal {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.button-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 0.4rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

button.danger .button-spinner {
  border-color: rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal-body {
  display: grid;
  gap: 0.5rem;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 17, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  z-index: 3;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-overlay-content {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  background: rgba(20, 22, 26, 0.9);
  color: #ffffff;
  font-weight: 600;
}

.modal {
  position: relative;
}

.budget-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #ffe6e6;
  color: #a40000;
  border: 1px solid #f0b3b3;
}

.budget-badge[hidden] {
  display: none;
}

.reserve-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #fff4cc;
  color: #8a6d00;
  border: 1px solid #ffe7a3;
}

.reserve-badge[hidden] {
  display: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.paid {
  background: #2f6fed;
}

.legend-dot.pending {
  background: #ffb54a;
}
.payment-meta {
  display: grid;
  gap: 0.25rem;
  text-align: right;
}

.toolbar-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.table-scroll {
  overflow: auto;
  border: 1px solid #2a2f3a;
  border-radius: 12px;
  background: #1b1f24;
  overflow-x: hidden;
}

.grid-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
  font-size: 0.92rem;
}

.grid-table th,
.grid-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid #2a2f3a;
  text-align: left;
  white-space: nowrap;
}

.grid-table th:nth-child(3),
.grid-table td:nth-child(3) {
  width: 42px;
  min-width: 42px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  text-align: center;
}

.grid-table th:nth-child(2),
.grid-table td:nth-child(2) {
  width: 120px;
  min-width: 120px;
  white-space: normal;
  word-break: break-word;
}

.grid-table th:nth-child(1),
.grid-table td:nth-child(1) {
  width: 260px;
  min-width: 260px;
  max-width: 300px;
  white-space: normal;
  line-height: 1.2;
  word-break: break-word;
}

.grid-table th:nth-child(4),
.grid-table td:nth-child(4) {
  width: 130px;
  min-width: 130px;
  white-space: normal;
}

.grid-table th:nth-child(5),
.grid-table td:nth-child(5) {
  width: 130px;
  min-width: 130px;
  white-space: normal;
}

.grid-table thead th {
  position: sticky;
  top: 0;
  background: #20262f;
  z-index: 1;
  font-weight: 700;
  color: #e6e8ec;
}

.grid-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.grid-table tbody tr:hover {
  background: rgba(70, 120, 255, 0.12);
}

.grid-row {
  cursor: pointer;
}

.grid-row .ghost {
  pointer-events: none;
}

.grid-row.has-reference {
  position: relative;
}

.grid-row.has-reference::after {
  content: attr(data-reference);
  position: fixed;
  left: var(--tooltip-x, 50%);
  top: var(--tooltip-y, 50%);
  transform: translate(12px, 12px);
  background: rgba(20, 22, 26, 0.96);
  color: #f0f3f8;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(120, 130, 150, 0.25);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  max-width: min(520px, 80vw);
  font-size: 0.85rem;
  line-height: 1.3;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 160ms ease, transform 160ms ease;
}

.grid-row.has-reference:hover::after,
.grid-row.has-reference.tooltip-open::after {
  opacity: 1;
  transform: translate(12px, 12px);
}

.ref-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.4rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6fa3ff;
  box-shadow: 0 0 0 2px rgba(111, 163, 255, 0.2);
  vertical-align: middle;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.status-dot.paid {
  background: #3ddc84;
  border-color: rgba(61, 220, 132, 0.5);
}

.status-dot.pending {
  background: #f6c15b;
  border-color: rgba(246, 193, 91, 0.55);
}

.grid-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.orientation-hint {
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(120, 130, 150, 0.25);
  background: rgba(20, 22, 26, 0.85);
  color: #cfd6e6;
  font-size: 0.85rem;
}

.legend-items {
  display: inline-flex;
  gap: 0.75rem;
  align-items: center;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.filter-toggle input {
  accent-color: #6fa3ff;
}

.totals-panel {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid #2a2f3a;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 0.5rem;
}

.totals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 700;
}

.totals-row .amount {
  white-space: nowrap;
  min-width: 220px;
  text-align: right;
}

.diff-positive {
  color: #3ddc84;
}

.diff-negative {
  color: #ff6b6b;
}

.diff-icon {
  display: inline-block;
  margin-right: 0.35rem;
  font-size: 0.9rem;
  vertical-align: middle;
}

.late-date {
  color: #ff6b6b;
  font-weight: 700;
}

.late-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 107, 107, 0.16);
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.35);
}

.detail-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.75rem;
  padding: 0.35rem 0;
}

.detail-actions {
  margin: 0.5rem 0 0.25rem;
}

.grid-edit {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.modal.is-editing .detail-actions {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-row .ghost {
    width: 100%;
    text-align: center;
  }

  .filter-toggle {
    justify-content: flex-start;
  }

  .grid-table {
    min-width: 0;
  }

  .grid-table thead {
    display: none;
  }

  .grid-table,
  .grid-table tbody,
  .grid-table tr,
  .grid-table td {
    display: block;
    width: 100%;
  }

  .grid-table tr {
    margin: 0.75rem 0;
    border: 1px solid #2a2f3a;
    border-radius: 12px;
    padding: 0.4rem 0.2rem;
    background: rgba(18, 20, 24, 0.9);
  }

  .grid-table td {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border: none;
    word-break: break-word;
  }

  .grid-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #b7bcc6;
  }

  .grid-table td .amount {
    white-space: nowrap;
    display: inline-block;
  }

  .grid-total-row td {
    font-size: 0.9rem;
  }

  .grid-row.has-reference::after {
    left: 50%;
    max-width: 90vw;
  }
}

@media (max-width: 1024px) {
  .grid-table {
    font-size: 0.9rem;
  }
}

.payment-errors {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid #f0b3b3;
  background: #ffe6e6;
  color: #a40000;
}

.payment-errors ul {
  margin: 0;
  padding-left: 1.25rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.pill.pending {
  background: #fff4cc;
  color: #8a6d00;
  border: 1px solid #ffe7a3;
}

.pill.paid {
  background: #e8f6ec;
  color: #1b5e20;
  border: 1px solid #b7e1c0;
}

.muted {
  color: #666666;
  font-size: 0.9rem;
}
.no-results {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px dashed #cfcfcf;
  border-radius: 6px;
  color: #666666;
}

.form-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.toast {
  margin: 0 0 1rem 0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
}

.toast-success {
  background: #e8f6ec;
  color: #1b5e20;
  border-color: #b7e1c0;
}

.toast-error {
  background: #ffe6e6;
  color: #a40000;
  border-color: #f0b3b3;
}

.inline-success {
  background: #e8f6ec;
  color: #1b5e20;
  border: 1px solid #b7e1c0;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.error {
  background: #ffe6e6;
  color: #a40000;
  border: 1px solid #f0b3b3;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

@media (prefers-color-scheme: dark) {
  body {
    background: #121212;
    color: #eaeaea;
  }

  .container {
    background: #1e1e1e;
    border-color: #2a2a2a;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  }

  input {
    background: #1a1a1a;
    color: #eaeaea;
    border-color: #333333;
  }

  textarea {
    background: #1a1a1a;
    color: #eaeaea;
    border-color: #333333;
  }

  select {
    background: #1a1a1a;
    color: #eaeaea;
    border-color: #333333;
  }

  .lang-switch select {
    background: #1a1a1a;
    color: #eaeaea;
    border-color: #333333;
  }

  .combo-dropdown {
    background: #1e1e1e;
    border-color: #2a2a2a;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  }

  .combo-option:hover,
  .combo-option.active {
    background: #1b2744;
  }

  .combo-label {
    color: #eaeaea;
  }

  .combo-code {
    color: #8ab4ff;
  }
  .field-error {
    color: #ffb3b3;
  }

  .field-label {
    color: #c7c7c7;
  }

  .field-ok {
    background: #1b2a1f;
    color: #9ae6b4;
    border-color: #2d4a37;
    box-shadow: 0 2px 6px rgba(154, 230, 180, 0.15);
  }

  button {
    background: #4c7dff;
  }

  button:hover {
    background: #3e6be0;
  }

  a {
    color: #8ab4ff;
  }

  li {
    background: #1e1e1e;
    border-color: #2a2a2a;
  }

  .user-icon {
    background: #1b2744;
    border-color: #24345a;
  }

  .user-meta span {
    color: #c7c7c7;
  }

  .phone-badge {
    background: #1b2744;
    border-color: #24345a;
    color: #8ab4ff;
  }

  .mode-badge {
    background: #1b2744;
    border-color: #24345a;
    color: #8ab4ff;
  }

  .widget-actions a {
    background: #4c7dff;
  }

  .widget-actions a:hover {
    background: #3e6be0;
  }

  .badge {
    background: #1b2744;
    color: #8ab4ff;
  }

  .info-icon {
    background: #1b2744;
    color: #8ab4ff;
    border-color: #24345a;
  }

  .info-icon::after {
    background: #1e1e1e;
    color: #eaeaea;
    border-color: #2a2a2a;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  }

  .info-icon::before {
    border-color: #1e1e1e transparent transparent transparent;
  }

  .view-toggle button {
    background: #1b2744;
    color: #8ab4ff;
    border-color: #24345a;
  }

  .view-toggle button.active {
    background: #4c7dff;
    color: #ffffff;
    border-color: #4c7dff;
  }

  .tab-button {
    background: #1b2744;
    color: #8ab4ff;
    border-color: #24345a;
  }

  .tab-button.active {
    background: #4c7dff;
    color: #ffffff;
    border-color: #4c7dff;
  }

  .toast-success {
    background: #1b2a1f;
    color: #9ae6b4;
    border-color: #2d4a37;
  }

  .toast-error {
    background: #3a1a1a;
    color: #ffb3b3;
    border-color: #5a2a2a;
  }

  .payment-item {
    background: #1e1e1e;
    border-color: #2a2a2a;
  }

  .chart-card {
    background: #1e1e1e;
    border-color: #2a2a2a;
  }

  .budget-ok {
    color: #9ae6b4;
  }

  .budget-warn {
    color: #ffb3b3;
  }

  .income-item {
    background: #1e1e1e;
    border-color: #2a2a2a;
  }

  .modal {
    background: #1e1e1e;
    border-color: #2a2a2a;
  }
  .budget-badge {
    background: #3a1a1a;
    color: #ffb3b3;
    border-color: #5a2a2a;
  }

  .reserve-badge {
    background: #3a2f12;
    color: #ffd36b;
    border-color: #5a4a1f;
  }

  .ghost {
    border-color: #2a2a2a;
    color: #8ab4ff;
  }

  .ghost:hover {
    border-color: #4c7dff;
  }

  .chart-bar {
    background: #2a2a2a;
  }

  .chart-paid {
    background: #4c7dff;
  }

  .chart-pending {
    background: #d9a34a;
  }

  .scroll-top {
    background: rgba(20, 22, 26, 0.95);
    border-color: rgba(120, 130, 150, 0.35);
    color: #8ab4ff;
  }

  .reports-donut-center {
    background: #1e1e1e;
    color: #eaeaea;
  }

  .reports-bar-track {
    background: rgba(255, 255, 255, 0.08);
  }

  .reports-stack-bar {
    background: rgba(255, 255, 255, 0.08);
  }

  .budget-breakdown-bar {
    background: #2a2a2a;
    border-color: #2a2a2a;
  }

  .payment-errors {
    background: #3a1a1a;
    color: #ffb3b3;
    border-color: #5a2a2a;
  }

  .pill.pending {
    background: #3a2f12;
    color: #ffd36b;
    border-color: #5a4a1f;
  }

  .pill.paid {
    background: #1b2a1f;
    color: #9ae6b4;
    border-color: #2d4a37;
  }

  .income-tag.primary {
    background: #1b2744;
    color: #8ab4ff;
    border-color: #24345a;
  }

  .income-tag.reserve {
    background: #3a2f12;
    color: #ffd36b;
    border-color: #5a4a1f;
  }

  .muted {
    color: #bdbdbd;
  }

  .inline-success {
    background: #1b2a1f;
    color: #9ae6b4;
    border-color: #2d4a37;
  }

  .no-results {
    border-color: #333333;
    color: #bdbdbd;
  }

  .error {
    background: #3a1a1a;
    color: #ffb3b3;
    border-color: #5a2a2a;
  }
}
