:root {
  color-scheme: dark;
}

:root.zn-light {
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100dvh;
  margin: 0;
  background: var(--zn-bg);
  color: var(--zn-ink);
  font-family: var(--zn-font-sans);
  font-size: var(--zn-text-base);
  line-height: var(--zn-leading-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--zn-accent);
}

svg {
  display: block;
}

:focus-visible {
  outline: 2px solid var(--zn-accent);
  outline-offset: 2px;
}

::selection {
  background: var(--zn-accent-soft);
  color: var(--zn-ink);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--zn-radius-md);
  background: var(--zn-accent);
  color: var(--zn-accent-ink);
  text-decoration: none;
  transition: top var(--zn-dur-fast) var(--zn-ease);
}

.skip-link:focus {
  top: 16px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--zn-sidebar) minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: var(--zn-space-md);
  height: 100dvh;
  padding: 20px 16px;
  overflow-y: auto;
  background: var(--zn-bg-2);
  border-right: 1px solid var(--zn-line);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 12px;
  color: var(--zn-ink);
  font-size: var(--zn-text-lg);
  font-weight: var(--zn-weight-semibold);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  background: var(--zn-accent);
  color: var(--zn-accent-ink);
  font-family: var(--zn-font-mono);
  font-size: 20px;
  font-weight: var(--zn-weight-bold);
}

.sidebar-nav {
  display: grid;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: var(--zn-radius-md);
  color: var(--zn-ink-2);
  font-size: var(--zn-text-base);
  text-decoration: none;
  transition: background var(--zn-dur-fast) var(--zn-ease), color var(--zn-dur-fast) var(--zn-ease);
}

.nav-link:hover {
  background: var(--zn-surface-2);
  color: var(--zn-ink);
}

.nav-link.is-active {
  background: var(--zn-accent-soft);
  color: var(--zn-accent);
  font-weight: var(--zn-weight-semibold);
}

.zn-light .nav-link.is-active {
  color: var(--zn-accent-700);
}

.nav-link svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.sidebar-footer {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding: 12px 12px 4px;
  border-top: 1px solid var(--zn-line);
}

.sidebar-footer-title {
  font-family: var(--zn-font-mono);
  font-size: var(--zn-text-xs);
  letter-spacing: var(--zn-tracking-label);
  text-transform: uppercase;
  color: var(--zn-ink-3);
}

.sidebar-footer-text {
  font-size: var(--zn-text-sm);
  color: var(--zn-ink-2);
}

.version {
  margin-top: 4px;
  font-family: var(--zn-font-mono);
  font-size: var(--zn-text-xs);
  color: var(--zn-ink-3);
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mobile-header {
  display: none;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--zn-ink);
  font-weight: var(--zn-weight-semibold);
  text-decoration: none;
}

.mobile-brand .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 18px;
}

.view {
  width: 100%;
  max-width: var(--zn-container-wide);
  margin: 0 auto;
  padding: 32px;
}

.view:focus {
  outline: none;
}

.tabbar {
  display: none;
}

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

.page-title {
  margin: 0;
  font-size: var(--zn-text-3xl);
  font-weight: var(--zn-weight-semibold);
  line-height: var(--zn-leading-tight);
  letter-spacing: var(--zn-tracking-tight);
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--zn-ink-2);
  font-size: var(--zn-text-base);
}

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

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

.card {
  padding: 16px;
  background: var(--zn-surface);
  border: 1px solid var(--zn-line);
  border-radius: var(--zn-radius-lg);
  box-shadow: var(--zn-shadow-1);
}

.card-label {
  font-family: var(--zn-font-mono);
  font-size: var(--zn-text-xs);
  letter-spacing: var(--zn-tracking-label);
  text-transform: uppercase;
  color: var(--zn-ink-3);
}

.card-value {
  margin-top: 8px;
  font-family: var(--zn-font-mono);
  font-size: var(--zn-text-2xl);
  font-weight: var(--zn-weight-semibold);
  font-variant-numeric: tabular-nums;
}

.card-hint {
  margin-top: 4px;
  font-size: var(--zn-text-sm);
  color: var(--zn-ink-2);
}

.section {
  margin-bottom: 24px;
}

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

.section-title {
  margin: 0;
  font-size: var(--zn-text-xl);
  font-weight: var(--zn-weight-semibold);
}

.section-card {
  overflow: hidden;
  background: var(--zn-surface);
  border: 1px solid var(--zn-line);
  border-radius: var(--zn-radius-lg);
}

.section-card .settings-row:last-child,
.section-card .info-row:last-child {
  border-bottom: none;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--zn-line);
}

.settings-row-text {
  min-width: 0;
}

.settings-row-title {
  font-weight: var(--zn-weight-medium);
}

.settings-row-hint {
  margin-top: 2px;
  font-size: var(--zn-text-sm);
  color: var(--zn-ink-2);
}

.settings-row-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

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

.field {
  display: grid;
  align-content: start;
  gap: 6px;
}

.field-label {
  font-size: var(--zn-text-sm);
  color: var(--zn-ink-2);
}

.field-hint {
  font-size: var(--zn-text-xs);
  color: var(--zn-ink-3);
}

.input,
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: var(--zn-control-height);
  padding: 8px 12px;
  background: var(--zn-surface-2);
  border: 1px solid var(--zn-line-2);
  border-radius: var(--zn-radius-md);
  color: var(--zn-ink);
}

.input:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--zn-accent);
  box-shadow: var(--zn-focus);
}

.input-narrow {
  max-width: 120px;
}

.switch {
  position: relative;
  width: 56px;
  height: 48px;
  flex: none;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.switch::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 10px;
  width: 48px;
  height: 28px;
  border: 1px solid var(--zn-line-2);
  border-radius: var(--zn-radius-pill);
  background: var(--zn-surface-3);
  transition: background var(--zn-dur-fast) var(--zn-ease), border-color var(--zn-dur-fast) var(--zn-ease);
}

.switch::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 14px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--zn-ink-3);
  transition: transform var(--zn-dur-fast) var(--zn-ease), background var(--zn-dur-fast) var(--zn-ease);
}

.switch[aria-checked="true"]::before {
  background: var(--zn-accent-soft);
  border-color: var(--zn-accent);
}

.switch[aria-checked="true"]::after {
  transform: translateX(20px);
  background: var(--zn-accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--zn-control-height);
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--zn-radius-md);
  font-size: var(--zn-text-base);
  font-weight: var(--zn-weight-medium);
  text-decoration: none;
  transition: background var(--zn-dur-fast) var(--zn-ease), border-color var(--zn-dur-fast) var(--zn-ease), color var(--zn-dur-fast) var(--zn-ease);
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.btn-primary {
  background: var(--zn-accent);
  border-color: var(--zn-accent);
  color: var(--zn-accent-ink);
}

.btn-primary:hover:not(:disabled) {
  background: var(--zn-accent-600);
  border-color: var(--zn-accent-600);
}

.btn-secondary {
  background: var(--zn-surface-2);
  border-color: var(--zn-line-2);
  color: var(--zn-ink);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--zn-surface-3);
}

.btn-ghost {
  background: transparent;
  border-color: var(--zn-line);
  color: var(--zn-ink);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--zn-surface-2);
}

.btn-danger {
  background: transparent;
  border-color: var(--zn-danger);
  color: var(--zn-danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--zn-surface-2);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--zn-radius-md);
  background: transparent;
  color: var(--zn-ink-2);
}

.icon-button:hover {
  background: var(--zn-surface-2);
  color: var(--zn-ink);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.quick-links {
  display: grid;
  gap: 8px;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 16px;
  background: var(--zn-surface);
  border: 1px solid var(--zn-line);
  border-radius: var(--zn-radius-lg);
  color: var(--zn-ink);
  text-decoration: none;
  transition: background var(--zn-dur-fast) var(--zn-ease), border-color var(--zn-dur-fast) var(--zn-ease);
}

.quick-link:hover {
  background: var(--zn-surface-2);
  border-color: var(--zn-line-2);
}

.quick-link-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 10px;
  background: var(--zn-accent-soft);
  color: var(--zn-accent);
}

.quick-link-icon svg {
  width: 22px;
  height: 22px;
}

.quick-link-text {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.quick-link-title {
  font-weight: var(--zn-weight-semibold);
}

.quick-link-hint {
  font-size: var(--zn-text-sm);
  color: var(--zn-ink-2);
}

.quick-link > svg {
  color: var(--zn-ink-3);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
  background: var(--zn-surface);
  border: 1px solid var(--zn-line);
  border-radius: var(--zn-radius-lg);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--zn-accent-soft);
  color: var(--zn-accent);
}

.empty-icon svg {
  width: 28px;
  height: 28px;
}

.empty-title {
  margin: 4px 0 0;
  font-size: var(--zn-text-xl);
}

.empty-text {
  max-width: 440px;
  margin: 0;
  color: var(--zn-ink-2);
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.list {
  display: grid;
  overflow: hidden;
  background: var(--zn-surface);
  border: 1px solid var(--zn-line);
  border-radius: var(--zn-radius-lg);
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--zn-line);
  color: var(--zn-ink);
  text-decoration: none;
}

.list-row:last-child {
  border-bottom: none;
}

.list-row:hover {
  background: var(--zn-surface-2);
}

.list-row-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 9px;
  background: var(--zn-surface-2);
  color: var(--zn-ink-2);
}

.list-row-icon svg {
  width: 20px;
  height: 20px;
}

.list-row-main {
  flex: 1;
  min-width: 0;
}

.list-row-title {
  font-weight: var(--zn-weight-medium);
}

.list-row-hint {
  font-size: var(--zn-text-sm);
  color: var(--zn-ink-2);
}

.list-row-chevron {
  color: var(--zn-ink-3);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: var(--zn-radius-pill);
  background: var(--zn-surface-2);
  color: var(--zn-ink-2);
  font-size: var(--zn-text-xs);
  font-weight: var(--zn-weight-medium);
}

.badge-accent {
  background: var(--zn-accent-soft);
  color: var(--zn-accent);
}

.badge-ok {
  color: var(--zn-ok);
}

.badge-warn {
  color: var(--zn-warn);
}

.badge-danger {
  color: var(--zn-danger);
}

.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--zn-surface);
  border: 1px solid var(--zn-line);
  border-radius: var(--zn-radius-lg);
}

.callout-icon {
  flex: none;
  color: var(--zn-warn);
}

.callout-title {
  font-weight: var(--zn-weight-semibold);
}

.callout-text {
  margin-top: 2px;
  font-size: var(--zn-text-sm);
  color: var(--zn-ink-2);
}

.info-grid {
  display: grid;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--zn-line);
}

.info-label {
  color: var(--zn-ink-2);
}

.info-value {
  font-family: var(--zn-font-mono);
  text-align: right;
}

.muted {
  color: var(--zn-ink-2);
}

.mono {
  font-family: var(--zn-font-mono);
}

.text-ok {
  color: var(--zn-ok);
}

.text-warn {
  color: var(--zn-warn);
}

.text-danger {
  color: var(--zn-danger);
}

.hidden,
[hidden] {
  display: none !important;
}

.toast-root {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 70;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  background: var(--zn-surface-2);
  border: 1px solid var(--zn-line-2);
  border-radius: var(--zn-radius-md);
  box-shadow: var(--zn-shadow-2);
  pointer-events: auto;
}

.toast-icon {
  flex: none;
  margin-top: 1px;
  color: var(--zn-ink-2);
}

.toast-icon svg {
  width: 20px;
  height: 20px;
}

.toast-success .toast-icon {
  color: var(--zn-ok);
}

.toast-error .toast-icon {
  color: var(--zn-danger);
}

.toast-message {
  flex: 1;
  min-width: 0;
  font-size: var(--zn-text-sm);
}

.toast-action {
  min-height: 32px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--zn-accent);
  font-size: var(--zn-text-sm);
  font-weight: var(--zn-weight-semibold);
}

.toast-close {
  width: 32px;
  height: 32px;
  min-height: 32px;
  flex: none;
}

.toast-close svg {
  width: 18px;
  height: 18px;
}

dialog.dialog {
  width: min(420px, calc(100% - 32px));
  padding: 0;
  color: var(--zn-ink);
  background: var(--zn-surface);
  border: 1px solid var(--zn-line);
  border-radius: var(--zn-radius-lg);
  box-shadow: var(--zn-shadow-3);
}

dialog.dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.dialog-body {
  padding: 24px 24px 8px;
}

.dialog-title {
  margin: 0;
  font-size: var(--zn-text-xl);
  font-weight: var(--zn-weight-semibold);
}

.dialog-text {
  margin: 8px 0 0;
  color: var(--zn-ink-2);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 24px 24px;
}

.noscript {
  padding: 24px;
}

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

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--zn-surface-2);
  border: 1px solid var(--zn-line);
  border-radius: var(--zn-radius-pill);
}

.segmented-button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--zn-radius-pill);
  background: transparent;
  color: var(--zn-ink-2);
  font-weight: var(--zn-weight-medium);
}

.segmented-button.is-active {
  background: var(--zn-accent-soft);
  color: var(--zn-accent);
}

.zn-light .segmented-button.is-active {
  color: var(--zn-accent-700);
}

.category-actions,
.operation-actions {
  display: flex;
  gap: 2px;
  flex: none;
}

.category-row-child {
  padding-left: 56px;
}

.account-title-row,
.operation-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.account-balance {
  font-family: var(--zn-font-mono);
  font-weight: var(--zn-weight-semibold);
  text-align: right;
  white-space: nowrap;
}

.operation-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 9px;
}

.operation-icon-income {
  background: var(--zn-accent-soft);
  color: var(--zn-ok);
}

.operation-icon-expense {
  background: var(--zn-surface-2);
  color: var(--zn-danger);
}

.operation-icon-transfer {
  background: var(--zn-surface-2);
  color: var(--zn-ink-2);
}

.operation-icon-credit_payment {
  background: var(--zn-surface-2);
  color: var(--zn-warn);
}

.operation-date {
  font-family: var(--zn-font-mono);
  font-size: var(--zn-text-xs);
  color: var(--zn-ink-3);
}

.operation-amount {
  font-family: var(--zn-font-mono);
  font-weight: var(--zn-weight-semibold);
  white-space: nowrap;
}

.plan-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: var(--zn-surface);
  border: 1px solid var(--zn-line);
  border-radius: var(--zn-radius-lg);
}

.plan-month-title {
  font-size: var(--zn-text-xl);
  font-weight: var(--zn-weight-semibold);
  text-align: center;
}

.plan-amounts {
  display: grid;
  gap: 2px;
  justify-items: end;
  flex: none;
}

.plan-amount {
  font-family: var(--zn-font-mono);
  font-weight: var(--zn-weight-semibold);
  white-space: nowrap;
}

.plan-fact {
  font-size: var(--zn-text-xs);
  color: var(--zn-ink-2);
  white-space: nowrap;
}

.plan-balances {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 20px;
  flex: none;
}

.plan-balance {
  display: grid;
  gap: 2px;
  justify-items: end;
  font-size: var(--zn-text-xs);
  color: var(--zn-ink-2);
  white-space: nowrap;
}

.plan-balance-value {
  font-family: var(--zn-font-mono);
  font-weight: var(--zn-weight-semibold);
  color: var(--zn-ink);
}

.plan-balance-value.text-danger {
  color: var(--zn-danger);
}

.plan-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.plan-execute {
  min-height: var(--zn-control-height);
  padding: 0 12px;
}

.plan-execute svg {
  width: 16px;
  height: 16px;
}

.balance-result {
  padding: 16px;
  background: var(--zn-surface-2);
  border: 1px solid var(--zn-line);
  border-radius: var(--zn-radius-md);
}

.balance-result-value {
  margin-top: 6px;
  font-family: var(--zn-font-mono);
  font-size: var(--zn-text-2xl);
  font-weight: var(--zn-weight-semibold);
  font-variant-numeric: tabular-nums;
}

.balance-result-hint {
  margin-top: 4px;
  font-size: var(--zn-text-sm);
  color: var(--zn-ink-2);
}

.chart {
  display: grid;
  gap: 12px;
}

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

.chart-grid-line {
  stroke: var(--zn-line);
  stroke-width: 1;
}

.chart-zero-line {
  stroke: var(--zn-line-2);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.chart-area {
  fill: var(--zn-accent-soft);
  stroke: none;
}

.chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line-actual {
  stroke: var(--zn-accent);
  stroke-width: 2.5;
}

.chart-line-forecast {
  stroke: var(--zn-steel);
  stroke-width: 2;
  stroke-dasharray: 6 6;
}

.chart-dot {
  fill: var(--zn-accent);
}

.chart-x-axis {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2.78%;
  color: var(--zn-ink-3);
  font-family: var(--zn-font-mono);
  font-size: var(--zn-text-xs);
}

.chart-bar-labels {
  display: grid;
  gap: 4px;
  padding: 0 2.78%;
  color: var(--zn-ink-3);
  font-family: var(--zn-font-mono);
  font-size: var(--zn-text-xs);
  text-align: center;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--zn-ink-2);
  font-size: var(--zn-text-sm);
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-swatch {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
}

.chart-swatch-dashed {
  height: 0;
  border-top: 3px dashed var(--zn-steel);
}

.chart-empty {
  padding: 24px;
  color: var(--zn-ink-2);
  font-size: var(--zn-text-sm);
  background: var(--zn-surface-2);
  border-radius: var(--zn-radius-md);
}

.report-breakdown {
  display: grid;
  gap: 14px;
}

.breakdown-row {
  display: grid;
  gap: 6px;
}

.breakdown-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.breakdown-name {
  font-weight: var(--zn-weight-medium);
}

.breakdown-amount {
  font-family: var(--zn-font-mono);
  font-weight: var(--zn-weight-semibold);
  white-space: nowrap;
}

.breakdown-track {
  height: 8px;
  overflow: hidden;
  background: var(--zn-surface-2);
  border-radius: var(--zn-radius-pill);
}

.breakdown-fill {
  height: 100%;
  border-radius: var(--zn-radius-pill);
  background: var(--zn-steel);
  transition: width var(--zn-dur-base) var(--zn-ease);
}

.breakdown-fill-income {
  background: var(--zn-accent);
}

.breakdown-fill-expense {
  background: var(--zn-steel);
}

.breakdown-share {
  font-family: var(--zn-font-mono);
  font-size: var(--zn-text-xs);
  color: var(--zn-ink-3);
}

.report-values {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.report-value {
  display: grid;
  gap: 2px;
}

.report-value-label {
  font-size: var(--zn-text-xs);
  color: var(--zn-ink-3);
}

.report-value-number {
  font-family: var(--zn-font-mono);
  font-size: var(--zn-text-sm);
  font-weight: var(--zn-weight-medium);
}

.form-fields {
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 12px;
}

.form-section {
  display: grid;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--zn-line);
}

.form-section-title {
  font-family: var(--zn-font-mono);
  font-size: var(--zn-text-xs);
  letter-spacing: var(--zn-tracking-label);
  text-transform: uppercase;
  color: var(--zn-ink-3);
}

.form-error {
  padding: 10px 12px;
  border: 1px solid var(--zn-danger);
  border-radius: var(--zn-radius-md);
  color: var(--zn-danger);
  font-size: var(--zn-text-sm);
}

.dialog-form .dialog-body {
  max-height: min(70vh, 640px);
  overflow-y: auto;
}

@media (min-width: 900px) and (max-width: 1240px) {
  .view {
    padding: 24px;
  }
}

@media (max-width: 899px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 0 16px;
    background: var(--zn-bg);
    border-bottom: 1px solid var(--zn-line);
  }

  .view {
    padding: 20px 16px calc(88px + env(safe-area-inset-bottom));
  }

  .tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--zn-bg-2);
    border-top: 1px solid var(--zn-line);
  }

  .tab-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
    color: var(--zn-ink-3);
    font-size: 11px;
    text-decoration: none;
  }

  .tab-link.is-active {
    color: var(--zn-accent);
  }

  .tab-link svg {
    width: 22px;
    height: 22px;
  }

  .btn {
    min-height: var(--zn-control-mobile);
  }

  .icon-button {
    width: 48px;
    height: 48px;
  }

  .toast-root {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 599px) {
  .form-row {
    grid-template-columns: 1fr;
  }

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

  .segmented {
    display: flex;
    width: 100%;
  }

  .segmented-button {
    flex: 1;
  }

  .category-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    grid-template-areas:
      "icon main"
      ". actions";
    row-gap: 8px;
    align-items: center;
  }

  .category-row .list-row-icon {
    grid-area: icon;
  }

  .category-row .list-row-main {
    grid-area: main;
  }

  .category-row .category-actions {
    grid-area: actions;
    justify-self: end;
  }

  .category-row-child {
    padding-left: 40px;
  }

  .operation-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    grid-template-areas:
      "icon main main"
      "icon amount actions";
    row-gap: 8px;
    align-items: center;
  }

  .operation-row .operation-icon {
    grid-area: icon;
  }

  .operation-row .list-row-main {
    grid-area: main;
  }

  .operation-row .operation-amount {
    grid-area: amount;
  }

  .operation-row .operation-actions {
    grid-area: actions;
    justify-self: end;
  }

  .plan-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    grid-template-areas:
      "icon main"
      "icon amounts"
      "icon balances"
      "icon actions";
    row-gap: 8px;
    align-items: center;
  }

  .plan-row .operation-icon {
    grid-area: icon;
  }

  .plan-row .list-row-main {
    grid-area: main;
  }

  .plan-row .plan-amounts {
    grid-area: amounts;
    display: flex;
    gap: 8px;
    justify-items: start;
    align-items: baseline;
  }

  .plan-row .plan-balances {
    grid-area: balances;
    justify-self: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px 24px;
  }

  .plan-row .plan-actions {
    grid-area: actions;
    justify-self: end;
    flex-wrap: wrap;
  }

  .account-row {
    gap: 8px;
  }

  .account-balance {
    font-size: var(--zn-text-sm);
  }

  .account-row .list-row-chevron {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
