:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #e6e8ee;
  --text: #0f172a;
  --muted: #475569;
  --muted-2: #94a3b8;
  --accent: #2563eb;
  --accent-blue: #2563eb;
  --accent-green: #16a34a;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-neutral: #94a3b8;
  --surface-variant: #f8fafc;
  --primary-container: #eef2ff;
  --gradient-card: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
}

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

.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.month-input {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
}

.month-input:focus {
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(30, 136, 229, 0.35);
  outline-offset: 1px;
}

.icon-btn {
  border: none;
  background: var(--card);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.icon-btn:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

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

.local-status {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-variant);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.local-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
}

.local-text {
  white-space: nowrap;
}

.local-device {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-2);
  background: #fff;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 999px;
}

.local-tooltip {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #111827;
  color: #fff;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  width: 220px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 10;
}

.local-status:hover .local-tooltip,
.local-status:focus .local-tooltip,
.local-status:active .local-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.local-tooltip-title {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 4px;
}

.local-tooltip-body {
  font-size: 12px;
  color: #e5e7eb;
}

.modal-footer-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.toggle input {
  accent-color: var(--accent-blue);
}

.toggle.small {
  font-size: 12px;
}

.primary-btn,
.ghost-btn,
.tab-btn {
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  background: #fff;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}

.ghost-btn:disabled,
.primary-btn:disabled,
.btn-small:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ghost-btn {
  background: transparent;
  color: var(--accent);
}

.ghost-btn:hover {
  background: rgba(30, 136, 229, 0.08);
}

.primary-btn {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.primary-btn:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.view.hidden {
  display: none;
}

.card {
  background: var(--card);
  border: none;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.compact-card {
  padding: 12px;
}

.compact-card .card-title {
  margin-bottom: 8px;
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 12px;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  margin-top: 24px;
  font-size: 14px;
  font-weight: 700;
}

.section-title::after {
  content: "";
  display: block;
  height: 1px;
  background: rgba(226, 232, 240, 0.7);
  margin-top: 8px;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.hero-primary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.hero-metric {
  display: grid;
  gap: 6px;
}

.hero-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
}

.hero-value {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
}

.hero-side {
  display: grid;
  gap: 12px;
}

.hero-mini {
  display: grid;
  gap: 4px;
}

.hero-mini-value {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
}

.hero-caption {
  font-size: 11px;
  color: var(--muted-2);
}

.hero-subline {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.hero-subline span {
  font-weight: 600;
  color: var(--text);
}

.link-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.cash-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hero-right {
  display: grid;
  gap: 12px;
}

.cash-block {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.cash-block label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cash-input {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-variant);
  border-radius: 10px;
  padding: 6px 10px;
  flex: 1;
}

.cash-prefix {
  font-size: 16px;
  color: var(--muted-2);
  font-weight: 600;
}

.cash-block input {
  border: none;
  background: transparent;
  font-family: inherit;
  text-align: right;
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.cash-block input:focus {
  outline: none;
}

.cash-caption {
  font-size: 11px;
  color: var(--muted-2);
}

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

.cash-remaining {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.status-box {
  border-radius: 10px;
  padding: 12px;
  border: none;
  background: var(--surface-variant);
}

.status-main {
  font-size: 14px;
  font-weight: 700;
}

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

.status-box.free {
  background: rgba(22, 163, 74, 0.12);
}

.row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.col {
  display: grid;
  gap: 16px;
}

.col-8 {
  grid-column: span 8;
}

.col-4 {
  grid-column: span 4;
}

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

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.review-metric {
  background: var(--surface-variant);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}

.review-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

.review-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

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

.assistant-box {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-variant);
  display: grid;
  gap: 10px;
}

.assistant-pill {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  background: var(--surface-variant);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-link {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.btn-link:hover {
  text-decoration: underline;
}

.assistant-panel.collapsed {
  display: none;
}

.assistant-panel {
  display: grid;
  gap: 8px;
}

.assistant-connection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.assistant-connection.hidden {
  display: none;
}

.assistant-connection-text {
  display: grid;
  gap: 2px;
}

.assistant-connection-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.assistant-connection-action {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ghost-btn.danger {
  border-color: rgba(239, 68, 68, 0.4);
  color: #b91c1c;
}

.ghost-btn.danger:hover {
  border-color: rgba(239, 68, 68, 0.7);
  background: rgba(239, 68, 68, 0.08);
}

.assistant-capabilities {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  display: grid;
  gap: 6px;
}

.cap-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

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

.cap-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cap-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--primary-container);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.assistant-card.collapsed {
  padding: 12px;
}

.assistant-card.collapsed .card-title,
.assistant-card.collapsed #nudges-list,
.assistant-card.collapsed .assistant-panel {
  display: none;
}

.assistant-card.collapsed .assistant-pill {
  margin-top: 0;
}

.assistant-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

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

.assistant-personal {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  display: grid;
  gap: 6px;
}

.assistant-greeting {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.assistant-name-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  font-weight: 700;
}

.assistant-name-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.assistant-name-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  background: #fff;
}

.assistant-name-hint {
  font-size: 11px;
  color: var(--muted);
}

.assistant-card.active {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.08);
}

.assistant-input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  resize: vertical;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.05);
  min-height: 86px;
  line-height: 1.35;
}

.assistant-actions {
  display: flex;
  justify-content: flex-end;
}

.assistant-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.assistant-actions-row.hidden {
  display: none;
}

.assistant-status {
  min-height: 18px;
  font-size: 12px;
  color: var(--muted);
}

.assistant-thread {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.assistant-log {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: grid;
  gap: 6px;
}

.assistant-log-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

.assistant-log-list {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
  padding-right: 4px;
}

.assistant-log-row {
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border);
  display: grid;
  gap: 4px;
}

.assistant-log-row.ok {
  border-left: 3px solid #16a34a;
}

.assistant-log-row.error {
  border-left: 3px solid #dc2626;
}

.assistant-log-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.assistant-log-meta {
  font-size: 11px;
  color: var(--muted);
}

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

.assistant-clear {
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  justify-self: flex-start;
}

.assistant-clear:hover {
  color: var(--text);
  border-color: var(--text);
}

.assistant-message {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--card);
  display: grid;
  gap: 6px;
  line-height: 1.35;
}

.assistant-message.user {
  background: var(--primary-container);
  border-color: rgba(37, 99, 235, 0.25);
}

.assistant-message .assistant-meta {
  font-size: 11px;
  color: var(--muted);
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-radius: 10px;
  border: none;
  background: var(--card);
  gap: 12px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  font-size: 13px;
  position: relative;
}

.urgent-amount {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  min-width: 90px;
  text-align: right;
}

.activity-item {
  animation: slideIn 0.18s ease-out;
}

.list-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  background: #f8fafc;
}

.list-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent-neutral);
}

.list-item.overdue::before {
  background: var(--accent-red);
}

.list-item.due-soon::before {
  background: var(--accent-amber);
}

.list-item .title {
  font-weight: 600;
}

.title {
  font-weight: 600;
}

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.meta a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.meta a:hover {
  text-decoration: underline;
}

.list-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.btn-small {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.btn-pill {
  border-radius: 999px;
  padding: 0 12px;
  height: 32px;
  border: none;
  box-shadow: none;
  background: #eef2ff;
  color: var(--accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}

.btn-pill.primary {
  background: var(--accent);
  color: #fff;
}

.btn-pill:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-pill:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-small:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.piggy-list {
  display: grid;
  gap: 10px;
}

.piggy-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr 1.4fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.piggy-row:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

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

.piggy-progress {
  height: 8px;
  background: rgba(30, 136, 229, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.piggy-progress > span {
  display: block;
  height: 100%;
}

.piggy-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.piggy-actions input {
  width: 90px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.05);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-pill.ready {
  color: var(--accent-green);
  background: rgba(46, 125, 50, 0.12);
  border-color: rgba(46, 125, 50, 0.35);
}

.status-pill.on_track {
  color: var(--accent-blue);
  background: rgba(30, 136, 229, 0.12);
  border-color: rgba(30, 136, 229, 0.35);
}

.status-pill.behind {
  color: var(--accent-amber);
  background: rgba(249, 168, 37, 0.18);
  border-color: rgba(249, 168, 37, 0.35);
}

.status-pill.due {
  color: var(--accent-red);
  background: rgba(211, 47, 47, 0.12);
  border-color: rgba(211, 47, 47, 0.35);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  padding: 6px 0 2px;
}

.search-input {
  flex: 1 1 200px;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 7px 10px;
  font-family: inherit;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.05);
}

.search-input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.filter-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-variant);
  border-radius: 999px;
  padding: 4px 6px;
}

.filter-group > span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: none;
  background: #fff;
  color: var(--text);
}

.select {
  border-radius: 8px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: inherit;
}

.select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.items-list {
  display: grid;
  gap: 6px;
}

.item-row {
  display: grid;
  grid-template-columns: 90px 1.6fr 110px 110px 1.2fr 240px 44px;
  gap: 10px;
  align-items: center;
  padding: 9px 12px 9px 16px;
  border-radius: 10px;
  border: none;
  background: var(--card);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
  position: relative;
  min-height: 52px;
  font-size: 13px;
}

.item-row:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  background: #f8fafc;
}

.item-row.row-flash {
  background: rgba(37, 99, 235, 0.12);
}

.item-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent-neutral);
}

.item-row.state-overdue::before {
  background: var(--accent-red);
}

.item-row.state-due-soon::before {
  background: var(--accent-amber);
}

.item-row.state-partial::before {
  background: var(--accent-blue);
}

.item-row.state-paid::before {
  background: var(--accent-green);
}

.status-pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background 0.2s ease, color 0.2s ease;
}

.status-cell {
  display: flex;
  align-items: center;
}

.status-pending {
  background: #e2e8f0;
  color: #334155;
}

.status-partial {
  background: rgba(37, 99, 235, 0.18);
  color: #1d4ed8;
}

.status-paid {
  background: rgba(22, 163, 74, 0.2);
  color: #15803d;
}

.status-skipped {
  background: rgba(148, 163, 184, 0.25);
  color: #475569;
}

.item-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-main .name {
  font-weight: 600;
  font-size: 14px;
}

.item-main .meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-due,
.item-amount {
  text-align: right;
  font-weight: 600;
  color: var(--text);
}

.badge {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.note-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
  display: inline-block;
}

.inline-input {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 8px;
  font-family: inherit;
  text-align: right;
  width: 100%;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.05);
  height: 32px;
}

.inline-input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.payment-inline {
  display: flex;
  gap: 6px;
  align-items: center;
}

.payment-inline span {
  font-size: 12px;
  color: var(--muted-2);
  font-weight: 600;
}

.progress-wrap {
  display: grid;
  gap: 6px;
}

.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: var(--accent-blue);
  transition: width 0.2s ease;
}

.item-row.state-paid .progress-bar span {
  background: var(--accent-green);
}

.item-row.state-partial .progress-bar span {
  background: var(--accent-blue);
}

.item-row.state-overdue .progress-bar span {
  background: var(--accent-red);
}

.item-row.state-due-soon .progress-bar span {
  background: var(--accent-amber);
}

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

.progress-sub {
  font-size: 11px;
  color: var(--muted-2);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions .payment-inline {
  gap: 6px;
}

.row-actions .inline-input {
  width: 86px;
}

.kebab {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.kebab-wrap {
  display: flex;
  justify-content: flex-end;
}

.kebab:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.zero-state {
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}

.zero-card {
  background: var(--card);
  border: none;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.zero-title {
  font-size: 18px;
  font-weight: 600;
}

.zero-sub {
  font-size: 13px;
  color: var(--muted);
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.template-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  background: var(--card);
  border: none;
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.template-form input {
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 6px 8px;
  font-family: inherit;
}

.templates-list {
  display: grid;
  gap: 8px;
}

.template-row {
  display: grid;
  grid-template-columns: 40px 90px 90px 1.2fr 1fr 110px 90px 90px 1fr 1fr 120px 170px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.template-row:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.template-row input,
.template-row .select {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 6px 8px;
  font-family: inherit;
}

.template-row .actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.template-actions {
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.form-error {
  margin-bottom: 12px;
  color: var(--accent-red);
  font-size: 13px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.4);
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal-content {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  width: min(520px, 90vw);
  border: 1px solid var(--border);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

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

.modal-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.modal-body {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.intake-text {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-family: inherit;
}

.intake-results {
  display: grid;
  gap: 8px;
}

.intake-row {
  display: grid;
  grid-template-columns: 30px 1.2fr 1fr 110px 80px 80px 80px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.intake-row input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: inherit;
}

.file-input {
  position: relative;
  overflow: hidden;
}

.file-input input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

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

  .col-8,
  .col-4 {
    grid-column: span 12;
  }

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

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

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

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .month-nav {
    width: 100%;
    justify-content: space-between;
  }
}
