:root {
  --ink: #0b1a20;
  --ink-2: #10282f;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e4e9ee;
  --line-strong: #d3dce4;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --brand: #0f766e;
  --brand-600: #0d9488;
  --brand-700: #0b5f59;
  --brand-50: #eefbf7;
  --brand-100: #d7f4ec;
  --amber: #b45309;
  --danger: #dc2626;
  --danger-50: #fef2f2;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.28);
  --shadow-lg: 0 30px 70px -30px rgba(6, 20, 24, 0.55);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 105% -8%, #e9f5f2 0%, rgba(233, 245, 242, 0) 62%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  flex: none;
}

.hidden {
  display: none !important;
}

.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;
}

:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- Botones */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.06s ease,
    box-shadow 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  pointer-events: none;
}

.btn--primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(15, 118, 110, 0.75);
}

.btn--primary:hover {
  background: var(--brand-700);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text-2);
}

.btn--ghost:hover {
  background: var(--surface-2);
  border-color: #c3cfd9;
}

.btn--soft {
  background: var(--brand-50);
  color: var(--brand-700);
}

.btn--soft:hover {
  background: var(--brand-100);
}

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--danger-ghost {
  background: var(--danger-50);
  color: var(--danger);
}

.btn--lg {
  height: 46px;
  font-size: 14.5px;
  border-radius: 11px;
}

.btn--sm {
  height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
}

.btn--block {
  width: 100%;
}

.btn.is-loading {
  position: relative;
  color: transparent !important;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn--ghost.is-loading::after,
.btn--soft.is-loading::after {
  border-color: rgba(15, 23, 42, 0.2);
  border-top-color: var(--brand);
}

.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--brand);
  font-weight: 650;
  font-size: inherit;
}

.link:hover {
  text-decoration: underline;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background: #eef2f5;
  color: var(--text);
}

.icon-btn--round {
  border-radius: 50%;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text-2);
}

.icon-btn--round:hover {
  border-color: var(--line-strong);
}

.icon-btn--danger:hover {
  background: var(--danger-50);
  color: var(--danger);
}

/* ------------------------------------------------------------------ Brand */

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: none;
  padding: 4px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08), 0 8px 18px -12px rgba(6, 20, 24, 0.65);
  overflow: hidden;
}

.brand__mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand__text {
  display: flex;
  flex-direction: column;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: #f8fafc;
}

.brand__text small {
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #7c9aa0;
  margin-top: 3px;
}

.brand--lg .brand__mark {
  width: 58px;
  height: 58px;
  padding: 6px;
  border-radius: 16px;
}

.brand--lg .brand__text {
  font-size: 19px;
  letter-spacing: -0.025em;
}

.brand--lg .brand__text small {
  font-size: 10.5px;
  letter-spacing: 0.07em;
}

.brand--light .brand__mark {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 12px 26px -16px rgba(0, 0, 0, 0.95);
}

/* ------------------------------------------------------------------- Boot */

.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: #fbfcfd;
}

.boot__logo {
  width: 64px;
  height: 64px;
  padding: 5px;
  border-radius: 18px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 0 0 1px var(--line), 0 18px 40px -26px rgba(15, 23, 42, 0.5);
}

.boot__spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #cfe7e3;
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* -------------------------------------------------------------- Auth page */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  min-height: 100vh;
}

.auth__art {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 44px 56px;
  overflow: hidden;
  color: #e8f1f2;
  text-align: center;
  background:
    radial-gradient(620px 420px at 8% 0%, rgba(20, 184, 166, 0.32), transparent 62%),
    radial-gradient(520px 420px at 96% 76%, rgba(56, 189, 248, 0.16), transparent 66%),
    linear-gradient(158deg, #081418 0%, #0c2429 54%, #0a2026 100%);
}

.auth__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 540px;
  margin: auto 0;
}

.auth__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 136px;
  height: 136px;
  padding: 12px;
  border-radius: 30px;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.14),
    0 40px 80px -40px rgba(0, 0, 0, 0.9);
}

.auth__logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth__eyebrow {
  display: inline-block;
  margin-bottom: 16px;
  padding: 5px 11px;
  border: 1px solid rgba(45, 212, 191, 0.24);
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.1);
  color: #7ee0d2;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.auth__center .auth__eyebrow {
  margin-top: 30px;
  margin-bottom: 14px;
}

.auth__center h1 {
  font-size: clamp(42px, 4.6vw, 66px);
  line-height: 1.02;
  letter-spacing: -0.04em;
  font-weight: 700;
  color: #f6fbfa;
}

.auth__center p {
  margin-top: 18px;
  max-width: 430px;
  font-size: 15px;
  line-height: 1.65;
  color: #a9c1c6;
}

.auth__legal {
  font-size: 11.5px;
  color: #5f7c82;
}

.auth__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 40px 32px;
}

.auth__mobile-brand {
  display: none;
  align-items: center;
  gap: 12px;
}

.auth__mobile-logo {
  width: 54px;
  height: 54px;
  padding: 4px;
  border-radius: 14px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
}

.auth__mobile-text {
  display: flex;
  flex-direction: column;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
}

.auth__mobile-text small {
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth__card {
  width: min(400px, 100%);
}

.auth__card-head {
  margin-bottom: 26px;
}

.auth__card-head h2 {
  font-size: 26px;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.auth__card-head p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13.5px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth__switch {
  margin-top: 22px;
  font-size: 13px;
  color: var(--muted);
}

.auth__note {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted-2);
}

/* ---------------------------------------------------------------- Form UI */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.005em;
}

.field__label b {
  color: var(--brand);
  font-weight: 700;
}

.field__hint {
  font-size: 11px;
  color: var(--muted-2);
}

.field input,
.field textarea {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a8b4c0;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.14);
}

.field input[type="date"] {
  padding-right: 8px;
}

.money-input {
  position: relative;
  display: flex;
  align-items: center;
}

.money-input__sign {
  position: absolute;
  left: 12px;
  font-size: 13px;
  color: var(--muted-2);
  pointer-events: none;
}

.money-input input {
  padding-left: 25px;
  font-variant-numeric: tabular-nums;
}

.form-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--danger-50);
  color: #b91c1c;
  font-size: 12.5px;
  line-height: 1.45;
  border: 1px solid #fecaca;
}

.type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: -4px;
}

.type-chip {
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
  transition: all 0.12s ease;
}

.type-chip:hover {
  border-color: var(--brand-100);
  background: var(--brand-50);
  color: var(--brand-700);
}

.type-chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* --------------------------------------------------------------- Auth grid */

@media (max-width: 980px) {
  .auth {
    grid-template-columns: 1fr;
  }

  .auth__art {
    display: none;
  }

  .auth__panel {
    min-height: 100vh;
    padding: 32px 20px;
    background:
      radial-gradient(700px 380px at 50% -10%, #e2f3ef 0%, rgba(226, 243, 239, 0) 70%);
  }

  .auth__mobile-brand {
    display: flex;
  }
}

/* ------------------------------------------------------------------- App */

.app {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 26px;
  height: 100vh;
  padding: 24px 18px;
  color: #cfe0e3;
  background:
    radial-gradient(420px 300px at 20% 0%, rgba(20, 184, 166, 0.16), transparent 65%),
    linear-gradient(180deg, #0a1a20, #0b2026 70%, #09191e);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar .brand {
  padding: 0 6px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #9fb6bb;
  font-size: 13px;
  font-weight: 550;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav__item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e8f1f2;
}

.nav__item.is-active {
  background: rgba(20, 184, 166, 0.14);
  color: #eafffb;
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.16);
}

.nav__item.is-active svg {
  color: #2dd4bf;
}

.sidebar__spacer {
  flex: 1;
}

.sidebar__tip {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #8fa8ad;
}

.sidebar__tip b {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5e7d83;
}

kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  font-family: inherit;
  font-size: 10.5px;
  text-align: center;
  color: #cfe0e3;
}

.sidebar__foot {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 4px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(145deg, #134e4a, #0f766e);
  color: #d1faf3;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.userbox__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.userbox__text strong {
  font-size: 12.5px;
  font-weight: 600;
  color: #e8f1f2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.userbox__text small {
  font-size: 10.5px;
  color: #6f8d93;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar .btn--ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: #a9c1c6;
}

.sidebar .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 30px 40px;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 76px;
  margin: 0 -30px;
  padding: 14px 30px;
  background: rgba(244, 246, 248, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(228, 233, 238, 0.9);
}

.topbar__brand {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.topbar__brand .brand__mark {
  width: 32px;
  height: 32px;
  padding: 3px;
  border-radius: 9px;
}

.month-switch {
  display: flex;
  align-items: center;
  gap: 12px;
}

.month-switch__label {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 148px;
  line-height: 1.25;
}

.month-switch__label strong {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.month-switch__label small {
  font-size: 11px;
  color: var(--muted);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
}

.mobile-nav {
  display: none;
}

/* ------------------------------------------------------------------ Views */

.view {
  padding-top: 22px;
  animation: fade 0.22s ease;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

/* ------------------------------------------------------------------ Stats */

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 20px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.stat__label {
  font-size: 11.5px;
  font-weight: 550;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.stat__value {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat__meta {
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat--hero {
  grid-column: span 2;
  justify-content: center;
  gap: 6px;
  border: 0;
  color: #eafffb;
  background:
    radial-gradient(320px 180px at 90% 0%, rgba(45, 212, 191, 0.26), transparent 70%),
    linear-gradient(140deg, #0c2b2c 0%, #0e3b38 55%, #0b2c2b 100%);
  box-shadow: 0 18px 36px -26px rgba(8, 47, 46, 0.9);
}

.stat--hero .stat__label {
  color: #8fd3c9;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat--hero .stat__value {
  font-size: 30px;
  line-height: 1.05;
  color: #fff;
}

.stat--hero .stat__meta {
  color: #7fb3ac;
}

.stat__delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
}

.stat__delta--up {
  color: #6ee7b7;
}

.stat__delta--down {
  color: #fca5a5;
}

/* ------------------------------------------------------------- Table card */

.table-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.table-card__head h2 {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.table-card__head p {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 270px;
  max-width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search:focus-within {
  border-color: var(--brand-600);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.search input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 12.5px;
  color: var(--text);
  min-width: 0;
}

.search input:focus {
  outline: none;
}

.search input::-webkit-search-cancel-button {
  cursor: pointer;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 330px);
  min-height: 120px;
}

.ledger {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}

.ledger thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 14px;
  background: #f8fafb;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
}

.ledger th.col-money {
  text-align: right;
}

.ledger th.col-actions {
  width: 82px;
}

.ledger tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #eef2f5;
  vertical-align: middle;
}

.ledger tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.ledger tbody tr:hover {
  background: #f9fcfb;
}

.ledger tbody tr:last-child td {
  border-bottom: 0;
}

.ledger .col-date {
  width: 74px;
}

.ledger .col-oc {
  width: 92px;
}

.ledger .col-money {
  width: 112px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ledger .col-actions {
  width: 82px;
  text-align: right;
}

.date-badge {
  display: flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}

.date-badge b {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.date-badge span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.oc {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-2);
  letter-spacing: -0.02em;
}

.client {
  font-weight: 650;
  color: var(--text);
  line-height: 1.3;
}

.sub {
  margin-top: 1px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.work-detail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  line-height: 1.35;
}

.work-detail__text {
  color: var(--text-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-transform: lowercase;
}

.chip--instalacion {
  background: #e4f7f1;
  color: #0f766e;
}

.chip--soporte {
  background: #e8f0fe;
  color: #1d4ed8;
}

.chip--montaje {
  background: #f2ecfd;
  color: #6d28d9;
}

.chip--retiro {
  background: #fff3e2;
  color: #b45309;
}

.chip--cambio {
  background: #fdebf4;
  color: #be185d;
}

.chip--levantamiento {
  background: #eef2f6;
  color: #475569;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-2);
}

.num--muted {
  color: #b6c2cd;
}

.num--total {
  color: var(--text);
  font-weight: 700;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.ledger tbody tr:hover .row-actions,
.ledger tbody tr:focus-within .row-actions {
  opacity: 1;
}

@media (hover: none) {
  .row-actions {
    opacity: 1;
  }
}

.note-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 4px;
  border-radius: 50%;
  background: #fff7ed;
  color: #c2410c;
  font-size: 9px;
  font-weight: 700;
  vertical-align: 1px;
}

.entries-mobile {
  display: none;
  padding: 12px;
  gap: 10px;
}

.entry-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.entry-card__top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.entry-card__top .date-badge {
  margin-right: auto;
}

.entry-card__total {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.entry-card__costs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  color: var(--muted);
}

.entry-card__costs b {
  color: var(--text-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.entry-card__note {
  padding: 7px 9px;
  border-radius: 7px;
  background: #fff8ee;
  color: #9a5b16;
  font-size: 11px;
  line-height: 1.45;
}

.entry-card__actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 58px 24px;
  text-align: center;
}

.empty__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand);
}

.empty h3 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.empty p {
  max-width: 330px;
  font-size: 12.5px;
  color: var(--muted);
}

.empty .btn {
  margin-top: 8px;
}

/* --------------------------------------------------------------- Historial */

.history {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 13px;
}

.history-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.history-card:hover {
  border-color: #cbd8e2;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.history-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-card__top strong {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-transform: capitalize;
}

.history-card__total {
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.history-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
}

.history-card__actions {
  display: flex;
  gap: 7px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.history-card.is-current {
  border-color: #b9e6dd;
  background: linear-gradient(180deg, #f4fdfa, #fff 60%);
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 10.5px;
  font-weight: 650;
}

.badge--brand {
  background: var(--brand-50);
  color: var(--brand-700);
}

/* ----------------------------------------------------------------- Dialog */

.dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

.dialog::backdrop {
  background: rgba(7, 20, 24, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.dialog__form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}

.dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog__head h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.dialog__head p {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
}

.dialog__body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 24px;
  overflow-y: auto;
  min-height: 0;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-section h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.grid {
  display: grid;
  gap: 12px;
}

.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.total-preview {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #cdeae3;
  border-radius: 12px;
  background: linear-gradient(120deg, #f1fcf9, #f8fdfc);
}

.total-preview__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-700);
}

.total-preview__value {
  margin-left: auto;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--brand-700);
}

.total-preview__detail {
  font-size: 10.5px;
  color: #6b9c94;
}

.dialog__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: #fcfdfd;
  border-radius: 0 0 18px 18px;
}

.dialog__foot-right {
  display: flex;
  gap: 8px;
}

/* ----------------------------------------------------------------- Toasts */

.toasts {
  position: fixed;
  bottom: 22px;
  left: 50%;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 24px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 15px;
  border-radius: 10px;
  background: #0f2a2c;
  color: #eafffb;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 18px 40px -20px rgba(4, 20, 22, 0.8);
  animation: toast-in 0.22s ease;
  pointer-events: auto;
}

.toast svg {
  color: #5eead4;
}

.toast--error {
  background: #7f1d1d;
  color: #fef2f2;
}

.toast--error svg {
  color: #fecaca;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

/* ------------------------------------------------------------- Responsive */

@media (max-width: 1250px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat--hero {
    grid-column: span 2;
  }
}

@media (max-width: 1200px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar__brand {
    display: flex;
  }

  .main {
    padding: 0 20px 90px;
  }

  .topbar {
    margin: 0 -20px;
    padding: 12px 20px;
  }

  .mobile-nav {
    display: flex;
    gap: 4px;
    margin: 14px 0 0;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #eef2f5;
  }

  .mobile-nav__item {
    flex: 1;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
  }

  .mobile-nav__item.is-active {
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow-sm);
  }

  .table-wrap {
    max-height: none;
  }
}

@media (max-width: 860px) {
  .ledger {
    display: none;
  }

  .table-wrap {
    display: none;
  }

  .entries-mobile:not(.hidden) {
    display: flex;
    flex-direction: column;
  }

  .table-card__head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .search {
    width: 100%;
  }

  .row-actions {
    opacity: 1;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat--hero {
    grid-column: span 2;
  }

  .stat__value {
    font-size: 17px;
  }

  .stat--hero .stat__value {
    font-size: 27px;
  }

  .grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    height: 100vh;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    margin: 0;
  }

  .dialog__form {
    max-height: 100vh;
    max-height: 100dvh;
    height: 100%;
  }

  .dialog__foot {
    border-radius: 0;
  }

  .dialog__body {
    padding: 18px;
  }

  .dialog__head,
  .dialog__foot {
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 0 14px 90px;
  }

  .topbar {
    margin: 0 -14px;
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .topbar__brand {
    display: flex;
  }

  .topbar__brand > span:last-child {
    display: none;
  }

  .month-switch {
    gap: 8px;
  }

  .month-switch__label {
    min-width: 112px;
  }

  .month-switch__label strong {
    font-size: 14px;
  }

  .topbar__actions {
    gap: 6px;
  }

  .topbar__actions .btn {
    padding: 0 12px;
  }

  .topbar__actions .btn__text {
    display: none;
  }

  .topbar__actions .btn--primary {
    width: 40px;
    padding: 0;
  }

  #today-btn {
    display: none;
  }

  .view {
    padding-top: 16px;
  }

  .stats {
    gap: 9px;
  }

  .stat {
    padding: 13px 14px;
  }

  .stat__value {
    font-size: 15.5px;
  }

  .stat--hero .stat__value {
    font-size: 24px;
  }

  .table-card__head {
    padding: 14px;
  }

  .grid--2,
  .grid--3 {
    grid-template-columns: 1fr;
  }

  .dialog__foot {
    flex-wrap: wrap;
  }

  .dialog__foot-right {
    margin-left: auto;
  }

  #entry-save-new {
    display: none;
  }

  .toasts {
    bottom: 14px;
    width: max-content;
    max-width: calc(100vw - 24px);
  }

  .toast {
    width: auto;
  }
}

@media (max-width: 420px) {
  .month-switch__label {
    min-width: 96px;
  }

  .month-switch__label small {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
