.transactions-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 28px 72px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.transactions-page .mobile-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

section {
  margin-bottom: 32px;
}

.page-context-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--accent2);
  font-weight: 500;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.kpi-row .summary-card {
  min-height: 120px;
}

.summary-card {
  background: linear-gradient(
    180deg,
    var(--card-bg) 0%,
    rgba(99, 102, 241, 0.02) 100%
  );
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.summary-label {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.summary-value {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 6px;
}

.tax-hero {
  background: linear-gradient(
    180deg,
    var(--card-bg) 0%,
    rgba(99, 102, 241, 0.05) 100%
  );
  border-radius: 22px;
  padding: 40px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tax-hero-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.tax-hero-value {
  font-size: 2.6rem;
  font-weight: 800;
  margin-top: 8px;
}

.transactions-card {
  background: linear-gradient(
    180deg,
    var(--card-bg) 0%,
    rgba(99, 102, 241, 0.015) 100%
  );
  border-radius: 22px;
  padding: 34px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.transactions-card .mobile-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ledger-toolbar input,
.ledger-toolbar select {
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 0 16px;
  background: var(--input-bg);
  color: var(--text-primary);
}

.btn-primary-pill {
  background: linear-gradient(135deg, var(--primary) 0%, #4338CA 100%);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.transactions-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 14px;
}

.transactions-table tr {
  background: var(--bg-surface);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.transactions-table td {
  padding: 14px 16px;
}

.transactions-table td .table-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-tag {
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 700;
  font-size: 0.72rem;
}

.status-income {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.status-expense {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.table-actions button {
  min-width: 110px;
}

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

.btn-table-secondary {
  background: var(--bg-surface, var(--card-bg));
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
  font-size: 0.78rem;
}

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

.ledger-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.transactions-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  width: 100%;
}

.transactions-controls input {
  flex: 1;
  min-width: 240px;
}

.transactions-controls select {
  min-width: 180px;
}

.transactions-controls .btn-primary-pill {
  margin-left: auto;
}

.ledger-toolbar input,
.ledger-toolbar select {
  min-width: 220px;
  flex: 1;
}

.table-wrapper {
  margin-top: 20px;
}

.table-wrapper h3 {
  margin-bottom: 16px;
  font-size: 1.2rem;
  color: var(--text-main);
}

.transactions-table th {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: none;
}

.transactions-table tbody tr {
  border-bottom: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.transactions-table tbody tr:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.transactions-table td {
  border: none;
  background: transparent;
}

.badge-wrap {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.badge-income {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 700;
  font-size: 0.72rem;
}

.badge-expense {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 700;
  font-size: 0.72rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding-bottom: 40px;
}

section {
  margin-bottom: 20px;
}

.sidebar {
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    #f8fafc 100%
  );
  border-right: 1px solid var(--border);
}

form {
  margin-top: 20px;
}

.tx-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-soft, 0 10px 25px rgba(0, 0, 0, 0.08));
}

.tx-card-title {
  margin: 0 0 12px;
  font-weight: 600;
}

.tx-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tx-actions {
  margin-top: 16px;
  display: flex;
}

.tx-actions button {
  width: auto;
}

.tx-card label {
  display: block;
  margin-bottom: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.tx-card select,
.tx-card input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.tx-card select option {
  background: var(--input-bg);
  color: var(--text-primary);
}

.transactions-page .form-field {
  display: flex;
  flex-direction: column;
  gap: 4px !important;
}

.transactions-page .entry-grid {
  row-gap: 6px !important;
}

.transactions-page .tx-card {
  gap: 8px !important;
}

.transactions-page label,
.transactions-page .form-label {
  margin-bottom: 0 !important;
  line-height: 1.1 !important;
}

.transactions-page .form-control,
.transactions-page input,
.transactions-page select {
  margin-top: 0 !important;
}

.transactions-page .form-field {
  margin-bottom: 0 !important;
}

.transactions-page label + input,
.transactions-page label + select,
.transactions-page label + textarea {
  margin-top: 0 !important;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field-full {
  grid-column: 1 / -1;
}

.form-label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.form-control {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px;
  background: var(--input-bg);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  font-size: 1rem;
}

.transactions-card input:focus,
.transactions-card select:focus,
.tx-card input:focus,
.tx-card select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.15);
}

#txType {
  margin-bottom: 18px;
  font-weight: 600;
}

.tx-field {
  margin-bottom: 0;
}

.tx-submit {
  margin-top: 18px;
}

.tx-submit button {
  width: 100%;
}


.slot-spin {
  animation: slotSpin var(--slot-duration, 0.5s) ease-in-out forwards;
}

@keyframes slotSpin {
  0% {
    transform: translateY(80%) scaleY(0.4);
    opacity: 0;
  }
  55% {
    transform: translateY(-15%) scaleY(1.05);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scaleY(1);
    opacity: 1;
  }
}

.modal-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tx-type-pill,
.tx-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  margin-right: 8px;
  opacity: 0.85;
}

.tx-income {
  border-left: 3px solid rgba(34, 197, 94, 0.35);
  background: transparent;
}

.tx-expense {
  border-left: 3px solid rgba(248, 113, 113, 0.35);
  background: transparent;
}

.tx-income .tx-type-pill,
.tx-income .tx-pill {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #065f46;
}

.tx-expense .tx-type-pill,
.tx-expense .tx-pill {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: #7f1d1d;
}

.tx-clip {
  margin-left: 6px;
  opacity: 0.8;
}

.tx-type-row {
  display: flex;
  gap: 18px;
  margin: 12px 0;
}

.tx-type-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}

.tx-type-row input {
  accent-color: var(--accent, #2563eb);
}

.tx-note-indicator {
  margin-left: 6px;
  font-size: 0.95rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

table th,
table td {
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

tbody tr:last-child {
  border-bottom: none;
}

.small-note {
  font-size: 13px;
  color: var(--ink2);
  margin-top: 6px;
}

.error-text {
  color: #f87171;
  font-size: 12px;
  min-height: 18px;
  margin-top: 8px;
}

.placeholder {
  text-align: center;
  opacity: 0.7;
}

.tax-hero {
  margin-top: 0;
  margin-bottom: 16px;
  padding: 22px;
}

.tax-amount {
  font-size: 2rem;
  font-weight: 700;
  margin: 8px 0;
}

.tax-subline {
  font-size: 0.9rem;
  opacity: 0.9;
}

.tax-hero.upsell button {
  margin-top: 12px;
}

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

.ytd-card {
  background: var(--bg-card, rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 16px;
}

@media (max-width: 768px) {
  main {
    padding-left: 14px;
    padding-right: 14px;
  }

  section {
    padding: 18px;
  }

  .kpi-row {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .ledger-toolbar {
    justify-content: stretch;
  }

  .transactions-controls {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .tx-card {
    padding: 16px;
  }

  button {
    min-height: 44px;
  }

  .transactions-controls input,
  .transactions-controls select {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 16px;
  }

  nav a {
    font-size: 13px;
    padding: 5px 6px;
  }

  section {
    padding: 16px;
    border-radius: 12px;
  }

  form > * {
    margin-bottom: 14px;
  }

  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  thead,
  tbody,
  tr {
    width: max-content;
  }

  input[type="date"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
  }

  form,
  fieldset,
  div {
    max-width: 100%;
    overflow-x: hidden;
  }

  .stats-bar {
    flex-direction: column;
  }

  .stats-bar .stat-card {
    width: 100%;
  }

  .transactions-table {
    border-spacing: 0;
  }

  .transactions-table th {
    display: none;
  }

  .transactions-table tbody tr {
    display: block;
    margin-bottom: 16px;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 14px;
    box-shadow: var(--shadow-sm);
  }

  .transactions-table tbody td {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 0;
  }

  .transactions-table tbody td:last-child {
    border-bottom: none;
  }

  .transactions-table tbody td span {
    display: inline-block;
  }
}
.txn-entry-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.txn-intent-btn {
  flex: 1;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.income-intent {
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
}

.expense-intent {
  background: linear-gradient(135deg, #6366F1, #4338CA);
  color: white;
}

.btn-add-transaction-primary {
  background: linear-gradient(135deg, var(--primary), #4338CA);
  border-radius: 999px;
  padding: 14px 26px;
  font-size: 0.95rem;
  box-shadow: var(--shadow-md);
}

.transaction-entry-card {
  background: linear-gradient(
    180deg,
    var(--card-bg) 0%,
    rgba(99, 102, 241, 0.02) 100%
  );
  border-radius: 22px;
  padding: 24px 28px;
}

.txn-card-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 0;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  row-gap: 12px;
  column-gap: 14px;
  margin-top: 0;
}

.transaction-entry-card .tx-actions {
  justify-content: center;
}

.transaction-entry-card .tx-actions button {
  width: auto;
  padding: 10px 26px;
  min-width: 140px;
  align-self: center;
}

.txn-type-select {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  height: 0;
  width: 0;
  overflow: hidden;
}

.txn-type-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
@media (max-width: 900px) {
  .entry-grid {
    grid-template-columns: 1fr;
  }
}

body {
  background: var(--surface2);
}

.app-shell {
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  min-height: calc(100vh - 56px);
}

.app-sidebar {
  width: 200px;
  background: var(--surface);
  border-right: 0.5px solid var(--border);
  padding: 20px 12px;
  flex: 0 0 200px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink3);
  text-transform: uppercase;
  padding: 12px 8px 6px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink2);
  text-decoration: none;
}

.sidebar-link:hover {
  background: var(--surface2);
  color: var(--ink);
  text-decoration: none;
}

.sidebar-link.is-active {
  background: transparent;
  color: var(--accent2);
  font-weight: 600;
}

.sidebar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.sidebar-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e24b4a;
  margin-left: auto;
}

.app-content {
  flex: 1;
  padding: 24px;
  background: var(--surface2);
}

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

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.scope-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.scope-select-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink3);
}

.scope-select {
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.scope-select:focus {
  outline: none;
}

.page-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}

.page-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink3);
}

.page-add-button {
  padding: 7px 12px;
  border: none;
  border-radius: 7px;
  background: var(--accent2);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}

.page-add-button:disabled,
.toolbar-add-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: none;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink3);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.stat-value-income {
  color: var(--green);
}

.stat-value-expense {
  color: var(--red);
}

/* Color-coded left border makes card type scannable at a glance */
.stat-card:has(.stat-label-income) {
  border-left: 3px solid var(--green);
}

.stat-card:has(.stat-label-expense) {
  border-left: 3px solid var(--red);
}

.stat-delta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink3);
}

.stat-delta-positive {
  color: var(--green);
}

.tax-banner {
  background: var(--accent);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  border: none;
  box-shadow: none;
}

.tax-banner-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tax-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
}

.tax-banner-label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}

.tax-banner-amount {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #fff;
}

.tax-banner-note {
  margin-top: 2px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

.tax-banner-side {
  text-align: right;
  line-height: 1.6;
}

.tax-side-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.tax-side-value {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
}

.tax-side-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
}

.tax-upsell-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.transactions-panel {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: none;
  padding: 0;
}

.recurring-panel {
  margin-top: 20px;
}

.recurring-toolbar {
  align-items: center;
}

.recurring-subtitle {
  margin-top: 2px;
}

.recurring-drawer-card {
  border-top: 0.5px solid var(--border);
}

.recurring-actions {
  gap: 10px;
}

.recurring-table-wrapper {
  margin-top: 0;
}

.recurring-table tbody td:first-child {
  min-width: 220px;
}

.recurring-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recurring-primary {
  font-weight: 500;
  color: var(--ink);
}

.recurring-secondary {
  font-size: 11px;
  color: var(--ink3);
}

.recurring-actions-cell {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  color: var(--accent2);
  background: var(--accent-light);
}

.transactions-toolbar {
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.transactions-panel-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-right: auto;
}

.toolbar-search {
  position: relative;
}

.toolbar-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--ink3);
}

.toolbar-search-icon svg,
.toolbar-filter-icon svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display: block;
}

.toolbar-search input {
  width: 180px;
  padding: 6px 10px 6px 28px;
  border: 0.5px solid var(--border2);
  border-radius: 7px;
  font-size: 12px;
  background: var(--surface2);
  min-width: 0;
}

.toolbar-filter-button,
.toolbar-select {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 0.5px solid var(--border2);
  border-radius: 7px;
  font-size: 12px;
  color: var(--ink2);
  background: var(--surface2);
}

.toolbar-add-button {
  padding: 7px 12px;
  background: var(--accent2);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
}

.transaction-drawer-card {
  padding: 20px 16px;
  border-bottom: 0.5px solid var(--border);
}

.transaction-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.drawer-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
}

.txn-entry-selector {
  display: flex;
  gap: 8px;
}

.txn-intent-btn {
  border-radius: 20px;
  padding: 5px 11px;
  border: 0.5px solid var(--border2);
  background: var(--surface);
  color: var(--ink2);
  font-size: 12px;
  font-weight: 500;
}

.txn-intent-btn.is-active,
.txn-intent-btn:hover {
  background: var(--accent-light);
  color: var(--accent2);
}

.transaction-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

.transaction-advanced-details {
  margin-top: 14px;
  border: 1px solid var(--border2);
  border-radius: 16px;
  background: var(--surface2);
  padding: 12px 14px 4px;
}

.transaction-advanced-details > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
}

.transaction-advanced-details > summary::-webkit-details-marker {
  display: none;
}

.transaction-advanced-grid {
  margin-top: 12px;
}

.small-note {
  font-size: 12px;
  color: var(--ink3);
  margin-top: 8px;
}

.error-text {
  color: var(--red);
  font-size: 12px;
  min-height: 18px;
  margin-top: 8px;
}

.tx-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.drawer-submit {
  padding: 8px 16px;
}

.receipt-upload-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.receipt-upload-button {
  padding: 8px 14px;
  border: 0.5px solid var(--border2);
  border-radius: 7px;
  background: var(--surface2);
  color: var(--ink2);
  font-size: 12px;
  font-weight: 500;
}

.receipt-upload-name {
  font-size: 12px;
  color: var(--ink3);
}

.receipt-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.table-wrapper {
  margin-top: 0;
}

.transactions-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
}

.transactions-table thead th {
  background: var(--surface2);
}

.transactions-table .col-date {
  width: 90px;
}

.transactions-table .col-description {
  width: 200px;
}

.transactions-table .col-account {
  width: 100px;
}

.transactions-table .col-category {
  width: 110px;
}

.transactions-table .col-receipt {
  width: 80px;
}

.transactions-table .col-status {
  width: 96px;
}

.transactions-table .col-amount {
  width: 100px;
  text-align: right;
}

.transactions-table .col-actions {
  width: 110px;
  text-align: right;
}

.transactions-table tbody tr:hover {
  background: var(--surface2);
  transform: none;
  box-shadow: none;
}

.transactions-table td {
  font-size: 13px;
  vertical-align: middle;
  background: transparent;
}

.transactions-table td:last-child,
.transactions-table th:last-child,
.transactions-table td.amount-cell,
.transactions-table th.col-amount {
  text-align: right;
}

.date-cell {
  font-size: 12px;
  color: var(--ink2);
}

.description-primary {
  font-weight: 500;
  color: var(--ink);
}

.description-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--ink3);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tx-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--surface2);
  color: var(--ink2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.tx-meta-badge.fx,
.tx-meta-badge.tax {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent2);
}

.tx-meta-badge.capital {
  background: rgba(245, 158, 11, 0.14);
  color: #92400e;
}

.tx-meta-badge.split,
.tx-meta-badge.needs_review,
.tx-meta-badge.locked {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.tx-meta-badge.matched,
.tx-meta-badge.ready {
  background: rgba(16, 185, 129, 0.12);
  color: var(--green);
}

.business-scope-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  margin-right: 6px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.account-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--ink3);
}

.account-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border2);
}

.category-pill {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.category-pill.tone-consulting {
  background: #e8f0fb;
  color: #1a3a5c;
}

.category-pill.tone-green {
  background: #eaf5ef;
  color: #1a5c35;
}

.category-pill.tone-travel {
  background: #fefce8;
  color: #7a4f0a;
}

.category-pill.tone-office {
  background: #faf0fb;
  color: #5c1a5a;
}

.category-pill.tone-marketing {
  background: #fef2f2;
  color: #8a1c1c;
}

.category-pill.tone-default {
  background: var(--surface2);
  color: var(--ink2);
}

.receipt-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.receipt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.receipt-status.attached {
  color: var(--green);
}

.receipt-status.attached .receipt-dot {
  background: var(--green);
}

.receipt-status.none {
  color: var(--ink3);
}

.receipt-status.none .receipt-dot {
  background: var(--border2);
}

.status-toggle-button {
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  border: 0.5px solid transparent;
}

.status-pending {
  color: var(--ink2);
  background: var(--surface2);
  border-color: var(--border2);
}

.status-cleared {
  color: var(--green);
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
}

.status-toggle-button:hover .status-pending,
.status-toggle-button:hover .status-cleared {
  transform: translateY(-1px);
}

.status-toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink2);
  cursor: pointer;
}

.status-toggle-row input {
  width: 14px;
  height: 14px;
}

.amount-positive {
  font-weight: 500;
  color: var(--green);
}

.amount-negative {
  font-weight: 500;
  color: var(--red);
}

.actions-cell {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.action-button {
  padding: 4px 8px;
  border: 0.5px solid var(--border2);
  border-radius: 5px;
  font-size: 11px;
  color: var(--ink2);
  background: none;
}

.action-button:hover {
  background: var(--surface2);
}

.action-button.delete:hover {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red);
}

.transaction-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 35, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.transaction-modal.hidden {
  display: none;
}

.danger-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 440px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 20px 60px rgba(15, 25, 35, 0.18);
}

.danger-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--red-bg);
  color: var(--red);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 20px;
  font-weight: 500;
}

.danger-modal h3 {
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 8px;
}

.danger-modal p {
  font-size: 14px;
  color: var(--ink2);
  line-height: 1.6;
}

.danger-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

.modal-cancel {
  padding: 8px 16px;
  border: 0.5px solid var(--border2);
  border-radius: 7px;
  font-size: 13px;
  color: var(--ink2);
  background: var(--surface);
}

.modal-delete {
  padding: 8px 16px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
}

@media (max-width: 1024px) {
  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 0.5px solid var(--border);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    padding: 14px 16px;
  }

  .sidebar-nav {
    min-width: 0;
  }

  .tax-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .tax-banner-side {
    text-align: left;
  }

  .transaction-form-grid {
    grid-template-columns: 1fr;
    row-gap: 14px;
  }
}

@media (max-width: 640px) {
  .app-topbar {
    padding: 10px 12px;
    align-items: flex-start;
    gap: 10px;
  }

  .topbar-left {
    width: 100%;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
  }

  .topbar-brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar-brand-text {
    font-size: 14px;
  }

  .user-pill {
    margin-left: auto;
    max-width: 44vw;
  }

  .user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-content {
    padding: 14px 12px 20px;
  }

  .app-sidebar {
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 12px;
  }

  .sidebar-section-label {
    padding: 0 0 4px;
  }

  .sidebar-link {
    padding: 10px 8px;
    font-size: 12px;
    border-radius: 10px;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }

  .page-title {
    font-size: 22px;
  }

  .page-subtitle {
    font-size: 12px;
  }

  .page-header-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .scope-select-wrap {
    width: 100%;
    justify-content: space-between;
    padding: 9px 12px;
  }

  .scope-select {
    flex: 1 1 auto;
    text-align: right;
  }

  .page-add-button {
    width: 100%;
    min-height: 44px;
    font-size: 13px;
  }

  .stats-row {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 14px 16px;
  }

  .stat-value {
    font-size: 20px;
  }

  .transactions-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 8px;
  }

  .transactions-panel-title {
    margin-right: 0;
  }

  .toolbar-search input,
  .toolbar-select,
  .toolbar-filter-button,
  .toolbar-add-button {
    width: 100%;
  }

  .toolbar-search input {
    width: 100%;
  }

  .tax-banner {
    padding: 14px 16px;
    gap: 12px;
  }

  .tax-banner-main {
    align-items: flex-start;
  }

  .tax-banner-amount {
    font-size: 18px;
  }

  .transactions-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .onboarding-tour-card {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    padding: 16px 16px 14px;
  }
}

@media (max-width: 520px) {
  .app-topbar {
    padding: 10px 10px 12px;
  }

  .user-pill {
    max-width: 100%;
  }

  .app-sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar-nav {
    gap: 6px;
  }

  .sidebar-link {
    justify-content: flex-start;
  }

  .page-title {
    font-size: 20px;
  }

  .page-context-note {
    font-size: 11px;
  }

  .transactions-panel,
  .tax-upsell-card,
  .tax-banner {
    border-radius: 16px;
  }

  .transaction-drawer-card,
  .recurring-drawer-card {
    padding: 16px 12px;
  }

  .transaction-drawer-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .txn-entry-selector {
    width: 100%;
  }

  .txn-intent-btn {
    flex: 1 1 0;
  }

  .transactions-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .transactions-table thead th {
    font-size: 10px;
    padding: 8px 6px;
  }

  .transactions-table td {
    font-size: 12px;
    padding: 10px 8px;
  }

  .onboarding-tour-card {
    padding: 14px 14px 12px;
  }

  .onboarding-tour-card h3 {
    font-size: 1rem;
  }

  .onboarding-tour-card p,
  .onboarding-tour-card li {
    font-size: 13px;
  }
}

/* Payer / 1099 fields — hidden by default, shown for income intent */
.income-only-field {
  display: none;
}
.transaction-modal[data-intent="income"] .income-only-field {
  display: block;
}
