:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #f0f3f5;
  --ink: #17212b;
  --muted: #657180;
  --line: #dbe2e7;
  --accent: #147a70;
  --accent-dark: #0f625b;
  --accent-soft: #e8f4f2;
  --danger: #b42318;
  --income: #b42318;
  --expense: #087443;
  --balance: #2563eb;
  --neutral: #596678;
  --transfer: #8a5a14;
  --system: #0e7490;
  --shadow: 0 12px 34px rgba(23, 33, 43, 0.07);
  --shadow-soft: 0 3px 14px rgba(23, 33, 43, 0.055);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

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

button,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(20, 122, 112, 0.2);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #17212b;
  color: white;
  padding: 28px 20px;
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #f2c65a;
  color: #17212b;
  font-weight: 800;
}

.brand h1,
.brand p,
.page-header h2,
.page-header p,
.panel h2,
.summary-band p {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
}

.brand p {
  color: #b8c4cf;
  font-size: 13px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c3ced7;
  cursor: pointer;
  padding: 12px 14px;
  text-align: left;
}

.nav-tab.active,
.nav-tab:hover {
  background: rgba(255, 255, 255, 0.115);
  color: white;
}

.workspace {
  padding: 28px;
  overflow: auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
}

.summary-band {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
  padding: 28px;
  border-radius: 8px;
  border: 1px solid rgba(219, 226, 231, 0.85);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

#total-disposable {
  display: block;
  margin-top: 8px;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1;
}

.summary-meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.summary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(86px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.summary-action-button {
  min-height: 40px;
  border: 1px solid rgba(20, 122, 112, 0.28);
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  padding: 8px 14px;
}

.summary-action-button:active {
  transform: translateY(1px);
}

.summary-action-button:hover {
  border-color: rgba(20, 122, 112, 0.5);
  background: var(--accent-soft);
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(340px, 1.1fr);
  gap: 18px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.full-panel {
  margin-top: 18px;
}

.quick-entry-panel {
  max-width: none;
}

.empty-ledger-onboarding {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 18px;
  border: 1px solid #cfe0df;
  border-radius: 8px;
  background: #f4faf9;
}

.empty-ledger-onboarding strong {
  font-size: 17px;
}

.empty-ledger-onboarding p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.panel h2,
.page-header h2 {
  font-size: 20px;
  line-height: 1.25;
}

.page-total {
  display: grid;
  justify-items: end;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.page-total strong {
  color: var(--balance);
  font-size: 20px;
  line-height: 1.1;
}

.icon-button,
.plain-button,
.primary-button,
.segment {
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 22px;
}

.plain-button {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.compact-link {
  min-height: 0;
  padding: 0;
  text-align: right;
}

.danger-link {
  color: var(--income);
}

.account-list,
.transaction-list {
  display: grid;
  gap: 10px;
}

.account-group {
  display: grid;
  gap: 8px;
}

.account-group + .account-group {
  margin-top: 8px;
}

.account-group-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  padding: 12px 14px;
  text-align: left;
  box-shadow: 0 1px 5px rgba(23, 33, 43, 0.035);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.account-group-header:hover {
  border-color: #c8d4db;
  background: #fcfdfd;
  box-shadow: var(--shadow-soft);
}

.account-group-toggle {
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  transition: transform 160ms ease;
}

.account-group.is-expanded .account-group-toggle {
  transform: rotate(180deg);
}

.account-group-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.account-group-name {
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

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

.account-group-total {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  color: var(--balance);
  font-size: 15px;
  white-space: nowrap;
}

.account-group-total span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.account-group-list {
  display: grid;
  overflow: hidden;
  gap: 0;
  margin-left: 30px;
  border: 1px solid #dce5ea;
  border-radius: 8px;
  background: #f7f9fa;
}

.filters-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.transaction-filter-panel > summary {
  display: none;
}

.search-filter {
  grid-column: span 2;
  min-width: 0;
}

.filter-reset {
  min-height: 42px;
  justify-self: stretch;
}

.backup-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.cloud-sync {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.cloud-heading {
  display: grid;
  gap: 3px;
}

.cloud-heading strong {
  font-size: 16px;
}

.cloud-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.cloud-reset-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.06);
}

.cloud-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.backup-import-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
}

.day-group {
  display: grid;
  gap: 10px;
}

.day-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8ec;
  background: #f3f6f8;
}

.day-summary div {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
}

.summary-income,
.summary-expense {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  font-weight: 800;
}

.summary-income {
  background: rgba(180, 35, 24, 0.1);
  color: var(--income);
}

.summary-expense {
  background: rgba(8, 116, 67, 0.1);
  color: var(--expense);
}

.transaction-item,
.account-row {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(23, 33, 43, 0.035);
}

.transaction-item {
  border-left-width: 3px;
}

.transaction-item.transaction-income {
  border-left-color: rgba(180, 35, 24, 0.58);
}

.transaction-item.transaction-expense {
  border-left-color: rgba(8, 116, 67, 0.58);
}

.transaction-item.transaction-neutral {
  border-left-color: rgba(138, 90, 20, 0.58);
}

.transaction-item.transaction-system {
  border-left-color: rgba(14, 116, 144, 0.58);
}

.account-item {
  position: relative;
  overflow: hidden;
  min-height: 62px;
  border: 0;
  border-radius: 0;
  background: transparent;
  touch-action: pan-y;
}

.account-item + .account-item {
  border-top: 1px solid #dbe5ec;
}

.account-item.is-disabled {
  background: rgba(226, 232, 240, 0.55);
  color: var(--muted);
}

.account-swipe-content {
  position: relative;
  min-height: 62px;
  padding: 10px 12px;
  background: inherit;
}

.account-main,
.transaction-main,
.account-row-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.account-main {
  align-items: flex-start;
}

.transaction-main > div:first-child {
  min-width: 0;
}

.account-balance-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.account-menu-button {
  min-width: 56px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
}

.account-menu-button:hover {
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.35);
}

.account-actions {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 44px;
  border-top: 1px solid #dbe5ec;
}

.account-item.actions-open .account-actions {
  display: grid;
}

.account-item.is-compact-actions .account-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  color: white;
  cursor: pointer;
  font-weight: 800;
}

.adjust-button {
  background: var(--balance);
}

.pause-button {
  background: #64748b;
}

.enable-button {
  background: var(--expense);
}

.delete-button {
  background: var(--income);
}

.account-name,
.transaction-title {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.account-name {
  font-size: 14px;
}

.transaction-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.transaction-type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  padding: 6px 9px;
}

.transaction-type-income {
  background: rgba(180, 35, 24, 0.1);
  color: var(--income);
}

.transaction-type-expense {
  background: rgba(8, 116, 67, 0.1);
  color: var(--expense);
}

.transaction-type-neutral {
  background: rgba(138, 90, 20, 0.11);
  color: var(--transfer);
}

.transaction-type-system {
  background: rgba(14, 116, 144, 0.1);
  color: var(--system);
}

.account-meta,
.transaction-meta {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.transaction-extra-detail {
  display: grid;
  gap: 2px;
  color: var(--system);
  font-size: 13px;
  font-weight: 500;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.cash-advance-summary {
  display: block;
  color: var(--system);
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
}

.cash-advance-summary.is-warning {
  color: var(--income);
}

.transaction-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.transaction-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  margin-left: auto;
}

.transaction-edit-button {
  min-width: 56px;
  min-height: 40px;
  border: 1px solid rgba(20, 122, 112, 0.28);
  border-radius: 8px;
  background: white;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 9px;
  transition: border-color 160ms ease, background 160ms ease;
}

.transaction-edit-button:hover {
  border-color: rgba(20, 122, 112, 0.52);
  background: var(--accent-soft);
}

.after-balance {
  color: var(--balance);
  font-size: 13px;
  font-weight: 800;
}

.amount-balance {
  color: var(--system);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.amount-positive {
  color: var(--income);
  font-weight: 800;
}

.amount-negative {
  color: var(--expense);
  font-weight: 800;
}

.amount-neutral {
  color: var(--neutral);
  font-weight: 800;
}

.entry-form,
.account-form {
  display: grid;
  gap: 14px;
}

.form-row,
.account-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-form {
  display: grid;
}

.form-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.type-manager {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.inline-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.inline-control .plain-button {
  min-width: 104px;
  min-height: 44px;
  border: 1px solid rgba(20, 122, 112, 0.24);
  border-radius: 8px;
  background: var(--accent-soft);
  padding: 9px 13px;
}

.inline-control .plain-button:hover {
  border-color: rgba(20, 122, 112, 0.46);
  background: #deefec;
}

.type-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.type-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.type-row + .type-row {
  border-top: 1px solid var(--line);
}

.type-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.type-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-top: 3px;
}

.type-delete-button {
  min-width: 72px;
  min-height: 40px;
  border: 1px solid rgba(180, 35, 24, 0.2);
  border-radius: 8px;
  background: rgba(180, 35, 24, 0.055);
  color: var(--danger);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
}

.type-row-actions {
  display: flex;
  gap: 8px;
}

.type-edit-button {
  min-width: 72px;
  min-height: 40px;
  border: 1px solid rgba(20, 122, 112, 0.24);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
}

.type-delete-button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.55;
  border-color: var(--line);
  background: var(--surface-2);
}

.form-row {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 16px;
  padding: 10px 12px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input:hover,
select:hover {
  border-color: #becbd3;
}

input:focus,
select:focus {
  border-color: rgba(20, 122, 112, 0.72);
  box-shadow: 0 0 0 3px rgba(20, 122, 112, 0.11);
  outline: none;
}

input[readonly] {
  cursor: pointer;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: end;
  justify-content: center;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(2px);
}

.modal-backdrop.is-stacked {
  z-index: 40;
}

.modal-sheet {
  width: min(760px, 100%);
  border-radius: 20px 20px 0 0;
  background: white;
  box-shadow: var(--shadow);
  overflow: hidden;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
}

.edit-modal-sheet {
  width: min(680px, 100%);
}

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

.modal-header h2 {
  margin: 0;
  font-size: 17px;
  text-align: center;
}

.modal-header-split {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-link-button {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
  padding: 4px 0;
  text-align: left;
}

.modal-link-button-strong {
  text-align: right;
  color: var(--accent);
}

.wheel-picker {
  position: relative;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
  gap: 4px;
  padding: 20px 16px 12px;
  height: 280px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.96), rgba(247,249,251,0.96));
  overflow: hidden;
}

.wheel-highlight {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 50%;
  height: 54px;
  transform: translateY(-50%);
  border-top: 1px solid rgba(24, 32, 42, 0.08);
  border-bottom: 1px solid rgba(24, 32, 42, 0.08);
  background: rgba(255, 255, 255, 0.92);
  pointer-events: none;
}

.wheel-column {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0 2px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.wheel-column::-webkit-scrollbar {
  display: none;
}

.wheel-spacer {
  flex: 0 0 auto;
  pointer-events: none;
}

.wheel-option {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #a6b0bb;
  font-size: 17px;
  font-weight: 500;
  text-align: center;
  scroll-snap-align: center;
  flex: 0 0 48px;
  -webkit-tap-highlight-color: transparent;
  transition: color 140ms ease, transform 140ms ease;
  appearance: none;
  -webkit-appearance: none;
}

.wheel-option.is-selected {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.modal-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 16px 16px;
  margin-top: 0;
}

.edit-transaction-form {
  max-height: min(72vh, 680px);
  overflow-y: auto;
  padding: 18px;
}

.edit-type-line {
  width: fit-content;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  padding: 6px 10px;
}

.edit-delete-button {
  justify-self: start;
  margin-top: 4px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 24px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border-radius: 8px;
  background: var(--surface-2);
}

.segment {
  min-height: 40px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.segment.active {
  background: white;
  color: var(--accent-dark);
  box-shadow: 0 2px 9px rgba(20, 30, 40, 0.08);
}

.primary-button {
  min-height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(20, 122, 112, 0.18);
  transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.primary-button:hover {
  background: var(--accent-dark);
  box-shadow: 0 5px 14px rgba(20, 122, 112, 0.22);
}

.primary-button:active {
  transform: translateY(1px);
}

.hidden {
  display: none;
}

.tag {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-auto-rows: max-content;
    align-content: start;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  }

  .brand {
    margin-bottom: 10px;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, 1fr);
  }

  .nav-tab {
    text-align: center;
    min-height: 44px;
    padding: 10px 8px;
  }

  .workspace {
    padding: 14px 16px 24px;
  }

  .summary-band,
  .panel-header,
  .page-header {
    align-items: start;
  }

  .page-total {
    justify-items: start;
  }

  .summary-band,
  .panel-grid,
  .form-row,
  .account-form {
    grid-template-columns: 1fr;
  }

  .inline-control {
    grid-template-columns: minmax(0, 1fr) 104px;
  }

  .summary-band {
    display: grid;
  }

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

  .compact-link {
    text-align: left;
  }

  .segmented {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  .segment {
    min-width: 0;
    padding-inline: 3px;
    font-size: 12px;
  }

  .filters-bar,
  .day-summary {
    grid-template-columns: 1fr;
  }

  .filters-bar {
    align-items: stretch;
  }

  .search-filter {
    grid-column: auto;
  }

  .filter-reset {
    justify-self: stretch;
  }

  .transaction-main {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .transaction-main > [class^="amount-"] {
    justify-self: start;
  }

  .transaction-side-detail {
    min-width: 0;
    text-align: left;
  }

  .transaction-footer {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: end;
  }

  .account-group-header {
    align-items: start;
  }

  .account-group-list {
    margin-left: 18px;
  }

  .datetime-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-actions {
    display: grid;
  }

  .day-summary div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .summary-income,
  .summary-expense {
    justify-content: center;
  }

  .backup-actions {
    display: grid;
  }

  .type-edit-button,
  .type-delete-button,
  .plain-button,
  .backup-import-button {
    min-height: 44px;
  }

  .day-summary {
    display: grid;
  }
}

@media (max-width: 700px) {
  .transaction-filter-panel {
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f9fa;
  }

  .transaction-filter-panel > summary {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    list-style: none;
  }

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

  .transaction-filter-panel > summary::after {
    content: "展开";
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
  }

  .transaction-filter-panel[open] > summary::after {
    content: "收起";
  }

  .transaction-filter-panel > summary span {
    flex: 1;
    color: var(--muted);
    font-size: 11px;
    text-align: right;
  }

  .transaction-filter-panel .filters-bar {
    margin: 0;
    padding: 0 12px 12px;
  }

  .summary-band {
    padding: 20px;
  }

  #total-disposable {
    font-size: 38px;
  }

  .panel {
    padding: 16px;
  }

  .page-header {
    margin-bottom: 14px;
  }

  .account-group-header {
    padding: 12px;
  }

  .account-group-total {
    gap: 4px;
    font-size: 14px;
  }

  .account-group-total span {
    font-size: 10px;
  }

  .transaction-item {
    padding: 13px 12px;
  }

  .transaction-title {
    line-height: 1.45;
  }
}
