:root {
  --bg: #f4f6f9;
  --bg-alt: #edf2f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #d6deea;
  --text: #0f172a;
  --muted: #334155;
  --accent: #0f4c81;
  --accent-strong: #0a3b64;
  --danger: #991b1b;
  --warning: #92400e;
  --success: #166534;
  --radius: 3px;
  --space-1: 0.35rem;
  --space-2: 0.6rem;
  --space-3: 0.9rem;
  --space-4: 1.2rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: "IBM Plex Sans", "Trebuchet MS", sans-serif;
  background:
    linear-gradient(140deg, rgba(15, 76, 129, 0.07), transparent 45%),
    repeating-linear-gradient(0deg, var(--bg), var(--bg) 28px, var(--bg-alt) 29px, var(--bg-alt) 30px);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Sora", "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: #0d1b29;
  color: #fff;
  padding: 0.65rem 0.85rem;
}

.skip-link:focus {
  left: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
}

.sidebar {
  background: #112c46;
  color: #dce7f0;
  border-right: 1px solid #2a445b;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: start;
}

.brand h1 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.brand p {
  color: #c1d0dd;
  font-size: 0.88rem;
}

.nav,
.drawer-nav {
  display: grid;
  gap: 0.35rem;
}

.nav-link,
.drawer-link {
  text-decoration: none;
  border: 1px solid #315571;
  padding: 0.58rem 0.65rem;
  border-radius: var(--radius);
  color: #dce7f0;
  background: transparent;
}

.nav-link:hover,
.drawer-link:hover {
  border-color: #4d6f8d;
}

.nav-link.is-active,
.drawer-link.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sidebar-note {
  margin-top: auto;
  color: #bccad7;
  font-size: 0.83rem;
}

.auth-state-label {
  color: #c8d7e5;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

.auth-state-email {
  margin-top: 0.22rem;
  color: #c1d0dd;
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.sidebar-auth-actions {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.4rem;
}

.auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.44rem 0.62rem;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.auth-button--logout {
  color: #0a3b64;
  background: #e5f0fb;
  border-color: #9fc2e8;
}

.auth-button--logout:hover {
  color: #0a3b64;
  background: #d8e8f9;
  border-color: #8fb5df;
}

.auth-button--login {
  color: #fff;
  background: var(--accent);
  border-color: #3f6ea1;
}

.auth-button--login:hover {
  background: var(--accent-strong);
  border-color: #4e7cad;
}

.main-content {
  padding: var(--space-3);
  min-height: 100vh;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--space-2);
}

#today-label {
  color: var(--muted);
  margin-top: 0.15rem;
  font-size: 0.88rem;
}

.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.42rem 0.68rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.page-body {
  margin-top: var(--space-3);
  display: grid;
  gap: var(--space-3);
}

.surface {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.surface h3,
.surface h4 {
  margin-bottom: var(--space-2);
}

.help-text {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-2);
}

.cards-4,
.cards-3,
.cards-2 {
  display: grid;
  gap: var(--space-2);
}

.cards-4 {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

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

.cards-2 {
  grid-template-columns: repeat(2, minmax(160px, 1fr));
}

.metric-card {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: var(--radius);
  padding: 0.7rem;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.metric-card strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.18rem;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  gap: var(--space-2);
  align-items: end;
}

.history-filter-dropdown {
  margin-bottom: 0.45rem;
  max-width: 100%;
}

.history-filter-toggle {
  width: min(220px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0.42rem 0.56rem;
  text-align: left;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  cursor: pointer;
  font-weight: 600;
}

.history-filter-toggle::after {
  content: 'v';
  color: var(--muted);
  transition: transform 140ms ease;
}

.history-filter-toggle[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.history-filter-panel {
  margin-top: 0.35rem;
  border: 1px solid #d3dee7;
  border-radius: calc(var(--radius) + 1px);
  background: linear-gradient(180deg, #f9fcff 0%, #f4f8fb 100%);
  padding: 0.55rem;
}

.history-filter-panel[hidden] {
  display: none !important;
}

.history-filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(112px, 1fr));
  gap: 0.5rem 0.55rem;
  align-items: end;
  margin-bottom: 0;
}

.history-filter-grid .history-filter-search {
  grid-column: span 2;
}

.history-category-field {
  grid-column: span 1;
  width: 100%;
  max-width: 230px;
}

.history-filter-check {
  min-height: 2.1rem;
  padding-bottom: 0.12rem;
}

.history-category-picker {
  position: relative;
}

.history-category-trigger {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.58rem;
  text-align: left;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  cursor: pointer;
}

.history-category-trigger::after {
  content: 'v';
  color: var(--muted);
  transition: transform 140ms ease;
}

.history-category-trigger[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.history-category-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.22rem);
  z-index: 50;
  border: 1px solid #c2d1dc;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.24rem;
  max-height: 14rem;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: grid;
  gap: 0.24rem;
  box-shadow: 0 10px 18px rgba(15, 30, 45, 0.08);
}

.history-category-menu[hidden] {
  display: none !important;
}

.history-category-option {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  text-align: left;
  padding: 0.3rem 0.42rem;
  cursor: pointer;
}

.history-category-option::after {
  content: '';
  margin-left: auto;
}

.history-category-option:hover {
  background: var(--surface-soft);
}

.history-category-option.is-active {
  border-color: #9fbcd8;
  background: #f0f7ff;
  color: #123f6d;
}

.history-category-option.is-active::after {
  content: 'v';
  color: #1a5e96;
  font-size: 0.72rem;
  font-weight: 700;
}

.history-category-empty {
  margin: 0;
  padding: 0.3rem 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.history-filter-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto auto;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.15rem;
  padding-top: 0.45rem;
  border-top: 1px solid #d8e2ea;
}

.history-filter-save {
  display: grid;
  grid-template-columns: minmax(140px, 220px) auto;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.history-filter-save input {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

#history-filter-save {
  justify-self: start;
  min-width: 0;
  width: fit-content;
  padding: 0.36rem 0.52rem;
}

.history-saved-filter-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
}

.history-saved-filter-picker {
  position: relative;
  min-width: 170px;
  max-width: 220px;
  width: 100%;
}

.history-saved-filter-trigger {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0.38rem 0.54rem;
  text-align: left;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  cursor: pointer;
}

.history-saved-filter-trigger::after {
  content: 'v';
  color: var(--muted);
  transition: transform 140ms ease;
}

.history-saved-filter-trigger[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.history-saved-filter-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.78;
}

.history-saved-filter-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.22rem);
  z-index: 52;
  border: 1px solid #c2d1dc;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.24rem;
  max-height: 13rem;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: grid;
  gap: 0.18rem;
  box-shadow: 0 10px 18px rgba(15, 30, 45, 0.08);
}

.history-saved-filter-menu[hidden] {
  display: none !important;
}

.history-saved-filter-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.history-saved-filter-option.is-active {
  border-color: #9fbcd8;
  background: #f0f7ff;
}

.history-saved-filter-load {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0.3rem 0.42rem;
  cursor: pointer;
  min-width: 0;
  width: 100%;
}

.history-saved-filter-load span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-saved-filter-option.is-active .history-saved-filter-load {
  color: #123f6d;
  font-weight: 600;
}

.history-saved-filter-delete {
  border: 0;
  background: transparent;
  color: #991b1b;
  font-weight: 700;
  line-height: 1;
  padding: 0.2rem 0.44rem;
  border-radius: var(--radius);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, background-color 120ms ease;
}

.history-saved-filter-option:hover .history-saved-filter-delete,
.history-saved-filter-option:focus-within .history-saved-filter-delete {
  opacity: 1;
  pointer-events: auto;
}

.history-saved-filter-delete:hover {
  background: #fff1ef;
}

@media (hover: none) {
  .history-saved-filter-delete {
    opacity: 1;
    pointer-events: auto;
  }
}

.history-filter-actions > .btn-neutral {
  white-space: nowrap;
}

.history-filter-summary {
  margin-top: 0.15rem;
  margin-bottom: 0.3rem;
  font-size: 0.84rem;
}

.history-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.history-filter-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.14rem 0.34rem;
  font-size: 0.75rem;
}

.history-filter-chip-muted {
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  gap: var(--space-2);
  align-items: end;
}

.form-grid.compact {
  grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
}

.field {
  display: grid;
  gap: 0.32rem;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 0.45rem 0.58rem;
}

textarea {
  min-height: 115px;
  width: 100%;
  resize: vertical;
}

input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2rem;
}

.btn-accent,
.btn-neutral,
.btn-delete,
.btn-warning {
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0.45rem 0.68rem;
}

.btn-accent {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-neutral {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.btn-neutral:hover {
  background: var(--surface-soft);
}

.btn-delete {
  border: 1px solid #d5a6a1;
  background: #fff1ef;
  color: #7d2219;
}

.btn-delete:hover {
  background: #fce7e4;
}

.btn-warning {
  border: 1px solid #d6b999;
  background: #fff6ea;
  color: #7e4a11;
}

.btn-warning:hover {
  background: #ffeed5;
}

.stack {
  display: grid;
  gap: var(--space-2);
}

.split-2,
.split-3 {
  display: grid;
  gap: var(--space-2);
}

.split-2 {
  grid-template-columns: 1.25fr 1fr;
}

.split-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

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


table {
  width: 100%;
  border-collapse: collapse;
}

.all-bills-table {
  table-layout: fixed;
  width: 100%;
}

.all-bills-table thead th,
.all-bills-table tbody td {
  padding: 0.45rem;
}

.all-bills-table thead th:nth-child(-n+5),
.all-bills-table tbody td:nth-child(-n+5) {
  width: calc((100% - 14rem) / 5);
}

.all-bills-table thead th:nth-child(6),
.all-bills-table tbody td:nth-child(6) {
  width: 8rem;
  text-align: center;
}

.all-bills-table thead th:nth-child(7),
.all-bills-table tbody td:nth-child(7) {
  width: 6rem;
  text-align: center;
}

.all-bills-table .actions-col,
.all-bills-table .actions-cell {
  width: 6rem;
}

thead th {
  text-align: left;
  color: var(--muted);
  font-size: 0.83rem;
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0.3rem;
}

tbody td {
  border-bottom: 1px solid #e2e8ed;
  padding: 0.45rem 0.3rem;
  vertical-align: top;
}

.text-right {
  text-align: right;
}

.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.15rem 0.35rem;
  font-size: 0.78rem;
}

.badge.overdue {
  border-color: #e5a8a2;
  background: #fff3f2;
  color: #8a2b22;
}

.badge.due-soon {
  border-color: #e7c096;
  background: #fff6ea;
  color: #8f4f07;
}

.badge.upcoming {
  border-color: #a8c8e9;
  background: #f0f7ff;
  color: #104b84;
}

.badge.scheduled {
  border-color: #c3d6e4;
  background: #f4f9fd;
  color: #295476;
}

.badge.paid {
  border-color: #a8d2c3;
  background: #eef9f4;
  color: #0f664f;
}

.projection-bars {
  display: grid;
  gap: 0.45rem;
}

.projection-item {
  display: grid;
  gap: 0.28rem;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: var(--radius);
  padding: 0.48rem;
}

.projection-row {
  display: grid;
  grid-template-columns: 75px 1fr 84px;
  align-items: center;
  gap: 0.45rem;
}

.track {
  height: 8px;
  background: #e5edf2;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
}

.fill {
  position: absolute;
  inset: 0 auto 0 0;
}

.fill.income {
  background: #2f6f9f;
}

.fill.expense {
  background: #b94f45;
}

.projection-net {
  text-align: right;
  font-weight: 600;
}

.projection-net.negative {
  color: var(--danger);
}

.projection-net.positive {
  color: var(--success);
}

.order-list,
.simple-list {
  margin: 0;
  padding-left: 1.05rem;
  display: grid;
  gap: 0.35rem;
}

.simple-list {
  padding-left: 0;
  list-style: none;
}

.list-item {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: var(--radius);
  padding: 0.45rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.kbd {
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  padding: 0.05rem 0.3rem;
  font-size: 0.78rem;
  background: #fff;
}

.mobile-drawer {
  position: fixed;
  inset: 0;
  background: rgba(6, 14, 22, 0.72);
  z-index: 200;
}

.drawer-nav {
  height: 100%;
  width: min(320px, 85vw);
  background: #112c46;
  border-right: 1px solid #315571;
  padding: var(--space-3);
}

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

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
.nav-link:focus-visible,
.drawer-link:focus-visible,
.auth-button:focus-visible {
  outline: 3px solid #0f4c81;
  outline-offset: 1px;
}

@media (max-width: 1150px) {
  .cards-4 {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .form-grid,
  .form-grid.compact,
  .control-grid,
  .history-filter-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .history-filter-grid .history-filter-search,
  .history-filter-actions {
    grid-column: span 2;
  }

  .history-filter-actions {
    grid-template-columns: 1fr auto;
  }

  .history-filter-save {
    grid-column: span 2;
    grid-template-columns: minmax(150px, 1fr) auto;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    display: none;
  }

  .menu-toggle {
    display: inline-block;
  }

  .split-2,
  .split-3,
  .cards-3,
  .cards-2 {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: var(--space-2);
    height: auto;
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .history-filter-grid {
    grid-template-columns: 1fr;
  }

  .history-filter-grid .history-filter-search,
  .history-filter-actions,
  .history-category-field {
    grid-column: auto;
  }

  .history-category-field {
    max-width: 100%;
  }

  .history-filter-toggle {
    width: 100%;
  }

  .history-filter-panel {
    padding: 0.5rem;
  }

  .history-filter-save {
    width: 100%;
    grid-template-columns: 1fr auto;
  }

  .history-filter-save input {
    max-width: none;
  }

  .history-saved-filter-wrap {
    width: 100%;
  }

  .history-saved-filter-picker {
    width: 100%;
    max-width: none;
  }

  .history-saved-filter-menu {
    max-height: 11rem;
  }

  .history-filter-actions {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .history-filter-actions > .btn-neutral {
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.positive {
  color: var(--success);
}

.negative {
  color: var(--danger);
}

.max-search {
  max-width: 320px;
  margin-bottom: 0.6rem;
}

.mt-2 {
  margin-top: 0.7rem;
}
.mt-half {
  margin-top: 0.5rem;
}

.actions-col {
  text-align: center;
}

.actions-cell {
  width: 1%;
  white-space: nowrap;
  text-align: center;
  overflow: visible;
}

.actions-trigger {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition: background 140ms ease;
}

.actions-trigger:hover {
  border-color: var(--line);
  background: var(--surface-soft);
  box-shadow: none;
}

.actions-trigger[aria-expanded="true"] {
  border-color: var(--line);
  background: var(--surface-soft);
  box-shadow: none;
}

.actions-dots {
  display: inline-block;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.actions-popover {
  position: fixed;
  z-index: 900;
  min-width: 11rem;
  max-width: min(16rem, calc(100vw - 1rem));
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
  padding: 0.2rem;
  display: grid;
  gap: 0.2rem;
}

.actions-popover[hidden] {
  display: none !important;
}

.action-menu-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  padding: 0.45rem 0.58rem;
  font-size: 0.9rem;
  line-height: 1.2;
  cursor: pointer;
}

.action-menu-item:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

.action-menu-item.action-danger {
  border-color: var(--line);
  background: var(--surface);
  color: #7d2219;
}

.action-menu-item.action-danger:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}



.planner-result-shell {
  background:
    linear-gradient(145deg, rgba(15, 76, 129, 0.08), transparent 45%),
    var(--surface);
}

.planner-dashboard {
  display: grid;
  gap: var(--space-2);
}

.planner-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.planner-inline-help {
  margin-top: 0.2rem;
  margin-bottom: 0;
}

.planner-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.25rem 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  width: fit-content;
}

.planner-pill.neutral {
  background: #f1f6fa;
  color: #24465f;
  border-color: #bcd0dd;
}

.planner-pill.ahead {
  background: #eef9f4;
  color: #0f664f;
  border-color: #a8d2c3;
}

.planner-pill.behind {
  background: #fff3f2;
  color: #8a2b22;
  border-color: #e5a8a2;
}

.planner-pill.on-track {
  background: #f0f7ff;
  color: #104b84;
  border-color: #a8c8e9;
}

.planner-analytics-grid {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.planner-analytic-card {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: var(--radius);
  padding: 0.65rem;
  display: grid;
  gap: 0.38rem;
}

.planner-chart {
  width: 100%;
}

.planner-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.planner-chart-donut svg {
  max-width: 184px;
  margin-inline: auto;
}

.planner-chart-trend svg {
  max-width: 460px;
  margin-inline: auto;
}

.planner-chart-number {
  font-family: 'Sora', 'Segoe UI', sans-serif;
  font-size: 10px;
  fill: #133245;
}

.planner-chart-caption {
  font-size: 8px;
  fill: #4a6275;
}

.planner-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.32rem;
}

.planner-legend li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.84rem;
}

.planner-legend-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.planner-swatch {
  width: 0.72rem;
  height: 0.72rem;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  display: inline-block;
}

.planner-grid-line {
  stroke: #d3dfe7;
  stroke-width: 1;
}

.planner-trend-line {
  fill: none;
  stroke: #0f4c81;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.planner-trend-point {
  fill: #0f4c81;
  stroke: #ffffff;
  stroke-width: 1.5;
}

.planner-line-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.planner-compare-grid {
  display: grid;
  gap: 0.4rem;
}

.planner-compare-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 0.26rem 0.45rem;
  align-items: center;
  font-size: 0.86rem;
}

.planner-compare-row .planner-bar {
  grid-column: 1 / -1;
}

.planner-bar {
  height: 8px;
  border-radius: 10px;
  overflow: hidden;
  background: #dce6ed;
}

.planner-bar-fill {
  display: block;
  height: 100%;
  background: #0f4c81;
}

.planner-bar-fill.alt {
  background: #b94f45;
}

.planner-progress-stack {
  display: grid;
  gap: 0.24rem;
}

.planner-progress-row {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.8rem;
}

.planner-progress-track {
  height: 8px;
  border-radius: 10px;
  overflow: hidden;
  background: #dce6ed;
}

.planner-progress-fill {
  display: block;
  height: 100%;
}

.planner-progress-fill.expected {
  background: #0f4c81;
}

.planner-progress-fill.actual {
  background: #b94f45;
}


.planner-pace-chart {
  display: grid;
  gap: 0.2rem;
  margin-top: 0.12rem;
}

.planner-pace-chart svg {
  width: 100%;
  max-width: 360px;
  height: auto;
  display: block;
  margin-inline: auto;
}

.planner-pace-axis {
  stroke: #ccd9e2;
  stroke-width: 2;
}

.planner-pace-center {
  stroke: #7a8ea0;
  stroke-width: 1.25;
  stroke-dasharray: 3 3;
}

.planner-pace-delta {
  fill: #0f4c81;
}

.planner-pace-delta.ahead {
  fill: #166534;
}

.planner-pace-delta.behind {
  fill: #991b1b;
}

.planner-pace-delta.on-track {
  fill: #0f4c81;
}

.planner-pace-point {
  fill: #0f4c81;
  stroke: #ffffff;
  stroke-width: 1;
}

.planner-pace-point.ahead {
  fill: #166534;
}

.planner-pace-point.behind {
  fill: #991b1b;
}

.planner-pace-point.on-track {
  fill: #0f4c81;
}

.planner-pace-label {
  fill: #4f6678;
  font-size: 8px;
  font-family: "IBM Plex Sans", "Trebuchet MS", sans-serif;
}

.planner-pace-caption {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.planner-note {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: #8a2b22;
}

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

  .planner-line-meta {
    grid-template-columns: 1fr;
  }
}


.planner-result-shell {
  padding: var(--space-2);
}

.planner-dashboard .metric-card {
  padding: 0.55rem;
}

.planner-dashboard .metric-card strong {
  font-size: 1.03rem;
}

.planner-dashboard .metric-card span {
  font-size: 0.79rem;
}

.planner-pill-sm {
  padding: 0.14rem 0.34rem;
  font-size: 0.72rem;
}

.planner-bills-ledger {
  padding: 0.6rem;
  display: grid;
  gap: 0.45rem;
}

.planner-bills-ledger h4 {
  margin-bottom: 0.2rem;
}

.planner-bills-ledger .help-text {
  margin-bottom: 0.15rem;
  font-size: 0.8rem;
}

.planner-month-stack {
  display: grid;
  gap: 0.35rem;
}

.planner-month-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.planner-month-block > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.45rem 0.52rem;
}

.planner-month-block > summary::-webkit-details-marker {
  display: none;
}

.planner-month-title {
  font-family: "Sora", "Segoe UI", sans-serif;
  font-size: 0.88rem;
  color: #14364b;
}

.planner-month-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  flex-wrap: wrap;
}



.planner-month-meta > span {
  border: 1px solid #cfdae3;
  border-radius: 999px;
  background: #f4f8fb;
  color: #2a495e;
  padding: 0.14rem 0.42rem;
  font-size: 0.72rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}


.planner-ledger-overall-meta {
  justify-content: flex-start;
  margin-top: -0.06rem;
  margin-bottom: 0.08rem;
}
.planner-month-table-wrap {
  overflow-x: auto;
  border-top: 1px solid #d4dee6;
}

.planner-month-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.79rem;
}

.planner-month-table thead th {
  background: #edf3f8;
  color: #24465f;
  font-weight: 600;
  text-align: left;
  padding: 0.32rem 0.42rem;
  border-bottom: 1px solid #d5dfe8;
}

.planner-month-table tbody td {
  padding: 0.3rem 0.42rem;
  border-bottom: 1px solid #e3ebf2;
}

.planner-month-table tbody tr:last-child td {
  border-bottom: none;
}

.planner-month-empty {
  margin: 0;
  padding: 0.45rem 0.52rem 0.52rem;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 980px) {
  .planner-month-block > summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .planner-month-meta {
    justify-content: flex-start;
  }
}

.planner-month-table thead th:nth-child(1),
.planner-month-table tbody td:nth-child(1) {
  width: 22%;
}

.planner-month-table thead th:nth-child(2),
.planner-month-table tbody td:nth-child(2) {
  width: 14%;
}

.planner-month-table thead th:nth-child(3),
.planner-month-table tbody td:nth-child(3),
.planner-month-table thead th:nth-child(4),
.planner-month-table tbody td:nth-child(4),
.planner-month-table thead th:nth-child(5),
.planner-month-table tbody td:nth-child(5),
.planner-month-table thead th:nth-child(6),
.planner-month-table tbody td:nth-child(6),
.planner-month-table thead th:nth-child(7),
.planner-month-table tbody td:nth-child(7) {
  width: 11%;
}

.planner-month-table thead th:nth-child(8),
.planner-month-table tbody td:nth-child(8) {
  width: 9%;
}

.planner-month-table thead th.text-right {
  text-align: right;
}

.planner-month-table tbody td:first-child,
.planner-month-table tbody td:nth-child(2) {
  overflow-wrap: anywhere;
}

.planner-month-table .text-right {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

























