.topbar__brand,
.avatar,
.icon-button,
.action-icon,
.transaction-icon,
.metric-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.topbar__brand {
  width: 38px;
  height: 38px;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-radius: var(--radius-md);
}

.topbar__brand svg {
  width: 19px;
  height: 19px;
}

.avatar {
  width: 34px;
  height: 34px;
  color: var(--color-muted);
  background: var(--color-avatar);
  border-radius: 50%;
  font-size: 10px;
  font-weight: var(--weight-bold);
}

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--color-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.icon-button:hover {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

.icon-button--surface {
  background: var(--color-surface-soft);
  border: 1px solid var(--color-line);
}

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

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

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.section-heading h2 {
  color: var(--color-ink);
  font-size: var(--font-base);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
}

.text-button {
  padding: 6px 2px;
  color: var(--color-primary);
  background: transparent;
  border: 0;
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  min-height: 26px;
  padding: 5px 9px;
  border-radius: var(--radius-pill);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}

.badge--hero {
  color: #ffffff;
  background: var(--color-hero-soft);
}

.badge--success {
  color: var(--color-success-text);
  background: var(--color-success-soft);
}

.progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  background: var(--color-progress-track);
  border-radius: var(--radius-pill);
}

.progress__bar {
  display: block;
  height: 100%;
  background: var(--color-primary);
  border-radius: inherit;
}

.nav-item,
.nav-create {
  border: 0;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav-item {
  min-width: 0;
  height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--color-muted);
  background: transparent;
  border-radius: var(--radius-md);
  font-size: 10px;
  font-weight: var(--weight-medium);
}

.nav-item svg {
  width: 19px;
  height: 19px;
}

.nav-item.active {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

.nav-create {
  align-self: center;
  justify-self: center;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--color-primary);
  border-radius: 50%;
  box-shadow: 0 10px 24px rgba(0, 117, 222, 0.25);
}

.nav-create:hover {
  background: var(--color-primary-pressed);
}

.nav-create svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.2;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  z-index: var(--z-toast);
  max-width: 398px;
  min-height: 44px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 10px 14px;
  color: var(--color-text);
  background: var(--color-toast);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.button--primary {
  color: #ffffff;
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.button--primary:hover {
  background: var(--color-primary-pressed);
}

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

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: var(--weight-semibold);
}

.status-badge--paid,
.status-badge--completed {
  color: var(--color-success-text);
  background: var(--color-success-soft);
}

.status-badge--pending {
  color: var(--color-warning-text);
  background: var(--color-warning-soft);
}

.status-badge--planned {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

.filter-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  min-height: 36px;
  flex: 0 0 auto;
  padding: 0 13px;
  color: var(--color-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}

.filter-chip.active {
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-color: var(--color-filter-border);
}

.empty-state {
  padding: 38px 24px;
  text-align: center;
}

.empty-state svg {
  width: 28px;
  height: 28px;
  margin: 0 auto 12px;
  color: var(--color-faint);
}

.empty-state h3 {
  color: var(--color-ink);
  font-size: var(--font-md);
}

.empty-state p {
  margin-top: 6px;
  color: var(--color-muted);
  font-size: var(--font-sm);
  line-height: 1.5;
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  visibility: hidden;
  background: var(--color-overlay);
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sheet-overlay.show {
  visibility: visible;
  opacity: 1;
}

.entry-sheet {
  width: min(92vw, 420px);
  max-width: 430px;
  max-height: min(86dvh, 720px);
  overflow-y: auto;
  padding: 10px 20px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease;
}

.sheet-overlay.show .entry-sheet {
  transform: translateY(0) scale(1);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 16px;
  background: var(--color-sheet-handle);
  border-radius: var(--radius-pill);
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.sheet-header h2 {
  margin-top: 3px;
  color: var(--color-ink);
  font-size: var(--font-xl);
  letter-spacing: -0.03em;
}

.type-selector {
  padding: 0;
  margin: 0 0 var(--space-4);
  border: 0;
}

.type-selector legend,
.field > span {
  display: block;
  margin-bottom: 7px;
  color: var(--color-muted);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}

.type-selector > div {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

.conditional-field[hidden] {
  display: none;
}

.type-option {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--color-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.15;
  text-align: center;
}

.type-option.active {
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-color: var(--color-control-border);
}

.type-option svg {
  width: 16px;
  height: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4) var(--space-3);
}

.field {
  min-width: 0;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 11px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-xs);
  font-size: var(--font-md);
}

.field textarea {
  min-height: 72px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--color-primary);
  outline: 2px solid rgba(0, 117, 222, 0.14);
}

.field-error {
  display: block;
  min-height: 14px;
  margin-top: 4px;
  color: var(--color-danger);
  font-size: 10px;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: var(--space-2);
  margin-top: var(--space-5);
}
