:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #f8faf8;
  --surface-strong: #eef3ef;
  --text: #17231b;
  --text-soft: #637067;
  --text-faint: #89948d;
  --line: #dfe7e1;
  --line-strong: #cdd8d0;
  --primary: #176b4d;
  --primary-strong: #0e523a;
  --primary-soft: #e6f3ed;
  --accent: #c69b4b;
  --success: #147a51;
  --success-soft: #e6f5ee;
  --warning: #a5660b;
  --warning-soft: #fff3da;
  --danger: #b63c42;
  --danger-soft: #fcebed;
  --info: #356a92;
  --info-soft: #eaf3f9;
  --shadow-xs: 0 1px 2px rgba(17, 39, 27, 0.05);
  --shadow-sm: 0 8px 26px rgba(17, 39, 27, 0.07);
  --shadow-lg: 0 24px 70px rgba(17, 39, 27, 0.16);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 78px;
  --content-max: 1440px;
  --transition: 180ms ease;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

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

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 100% 0, rgba(23, 107, 77, 0.06), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.menu-open {
  overflow: hidden;
}

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

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-strong);
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

:focus-visible {
  outline: 3px solid rgba(23, 107, 77, 0.28);
  outline-offset: 2px;
}

::selection {
  background: rgba(23, 107, 77, 0.18);
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  display: flex;
  width: min(86vw, var(--sidebar-width));
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
  padding: 24px 16px calc(24px + var(--safe-bottom));
  background: #102b20;
  color: #f4f8f5;
  box-shadow: var(--shadow-lg);
  transform: translateX(-105%);
  transition: transform 220ms ease;
}

.menu-open .sidebar,
.sidebar.is-open {
  transform: translateX(0);
}

.sidebar::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 10% 0, rgba(198, 155, 75, 0.16), transparent 15rem),
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.08));
  content: "";
  pointer-events: none;
}

.sidebar-brand {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  color: #fff;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.sidebar-brand:hover {
  color: #fff;
}

.sidebar-brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #efd9a7;
}

.sidebar-brand-label,
.nav-link-label,
.sidebar-logout-label {
  white-space: nowrap;
}

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

.sidebar-label {
  margin: 10px 12px 4px;
  color: rgba(236, 245, 239, 0.48);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(244, 248, 245, 0.72);
  font-weight: 620;
  transition:
    background var(--transition),
    color var(--transition),
    transform var(--transition);
}

.nav-link svg,
.nav-link .icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  opacity: 0.82;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-link.active,
.nav-link.is-active,
.nav-link[aria-current="page"] {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-link.active svg,
.nav-link.is-active svg,
.nav-link[aria-current="page"] svg {
  color: #efd9a7;
  opacity: 1;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(244, 248, 245, 0.62);
  font-size: 13px;
}

.sidebar-logout-icon {
  display: none;
  font-size: 19px;
  line-height: 1;
}

.main {
  min-width: 0;
  padding: 0 16px calc(88px + var(--safe-bottom));
}

.main > .content,
.main-content {
  width: min(100%, var(--content-max));
  margin-inline: auto;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-inline: -16px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(205, 216, 208, 0.75);
  background: rgba(245, 247, 244, 0.88);
  backdrop-filter: blur(16px);
}

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

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

.sidebar-collapse-toggle {
  display: none;
}

.page-title {
  min-width: 0;
  margin: 24px 0 18px;
}

.page-title h1,
.page-title > :first-child {
  margin-bottom: 4px;
  color: var(--text);
  font-size: clamp(25px, 5vw, 38px);
  font-weight: 780;
  letter-spacing: -0.04em;
  line-height: 1.12;
}

.page-title p,
.page-title .subtitle {
  max-width: 68ch;
  margin-bottom: 0;
  color: var(--text-soft);
}

.page-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

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

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

.card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.card--soft,
.card.soft {
  background: var(--surface-soft);
  box-shadow: none;
}

.card--accent,
.card.accent {
  border-color: rgba(23, 107, 77, 0.2);
  background: linear-gradient(145deg, #fff, var(--primary-soft));
}

.card-header,
.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-header {
  margin-bottom: 16px;
}

.card-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 730;
  letter-spacing: -0.015em;
}

.card-subtitle,
.muted {
  color: var(--text-soft);
}

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

.stat {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.stat::after {
  position: absolute;
  width: 88px;
  height: 88px;
  top: -46px;
  right: -38px;
  border-radius: 50%;
  background: var(--primary-soft);
  content: "";
}

.stat-label {
  margin-bottom: 9px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.stat-value {
  margin: 0;
  font-size: clamp(22px, 6vw, 31px);
  font-weight: 790;
  letter-spacing: -0.045em;
  line-height: 1.15;
}

.stat-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  color: var(--text-soft);
  font-size: 12px;
}

.amount {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.amount.positive,
.amount--positive {
  color: var(--success);
}

.amount.negative,
.amount--negative {
  color: var(--danger);
}

.amount.large,
.amount--large {
  font-size: clamp(24px, 7vw, 40px);
  font-weight: 800;
}

.badge {
  display: inline-flex;
  width: fit-content;
  min-height: 25px;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 720;
  line-height: 1.25;
}

.badge-success,
.badge--success,
.badge.success {
  border-color: rgba(20, 122, 81, 0.12);
  background: var(--success-soft);
  color: var(--success);
}

.badge-warning,
.badge--warning,
.badge.warning {
  border-color: rgba(165, 102, 11, 0.12);
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-danger,
.badge--danger,
.badge.danger {
  border-color: rgba(182, 60, 66, 0.12);
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-muted,
.badge--muted,
.badge.muted {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text-soft);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 690;
  line-height: 1.2;
  text-align: center;
  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    color var(--transition),
    transform var(--transition);
  user-select: none;
}

.button:hover {
  color: inherit;
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

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

.button-primary,
.button--primary,
.button.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 7px 18px rgba(23, 107, 77, 0.2);
}

.button-primary:hover,
.button--primary:hover,
.button.primary:hover {
  background: var(--primary-strong);
  color: #fff;
}

.button-secondary,
.button--secondary,
.button.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover,
.button--secondary:hover,
.button.secondary:hover {
  border-color: #adc0b2;
  background: var(--surface-soft);
}

.button-danger,
.button--danger,
.button.danger {
  background: var(--danger);
  color: #fff;
}

.button-danger:hover,
.button--danger:hover,
.button.danger:hover {
  background: #982f35;
  color: #fff;
}

.button-ghost,
.button--ghost,
.button.ghost {
  background: transparent;
  color: var(--text-soft);
}

.button-ghost:hover,
.button--ghost:hover,
.button.ghost:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.button-small,
.button--small,
.button-sm {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 12px;
}

.button-icon,
.button--icon {
  width: 42px;
  padding: 0;
}

.button-block,
.button--block {
  width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.field > label,
.field-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 680;
}

.field-hint,
.field-error {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
}

.field-error {
  color: var(--danger);
}

.input,
.select,
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 1px 1px rgba(17, 39, 27, 0.025);
  font-variant-numeric: tabular-nums;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

.select,
.field select {
  padding-right: 36px;
}

.field textarea,
textarea.input {
  min-height: 112px;
  resize: vertical;
}

.input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-faint);
  opacity: 1;
}

.input:hover,
.select:hover,
.field input:not([type="checkbox"]):not([type="radio"]):hover,
.field select:hover,
.field textarea:hover {
  border-color: #b5c4b9;
}

.input:focus,
.select:focus,
.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(23, 107, 77, 0.1);
}

.input[aria-invalid="true"],
.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(182, 60, 66, 0.08);
}

.input:disabled,
.select:disabled,
.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  background: var(--surface-strong);
  color: var(--text-soft);
  cursor: not-allowed;
}

.input-prefix,
.input-suffix {
  position: relative;
}

.input-prefix > span,
.input-suffix > span {
  position: absolute;
  z-index: 1;
  top: 50%;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
  pointer-events: none;
  transform: translateY(-50%);
}

.input-prefix > span {
  left: 13px;
}

.input-prefix > .input,
.input-prefix > input {
  padding-left: 40px;
}

.input-suffix > span {
  right: 13px;
}

.input-suffix > .input,
.input-suffix > input {
  padding-right: 42px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
}

.check-row input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.table th {
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr {
  transition: background var(--transition);
}

.table tbody tr:hover {
  background: #fafcfb;
}

.table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

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

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.entry:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
  transform: translateY(-1px);
}

.entry-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-weight: 690;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  color: var(--text-soft);
  font-size: 12px;
}

.entry-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 6px;
  padding-top: 3px;
}

.progress {
  position: relative;
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress > span,
.progress-bar {
  display: block;
  width: var(--progress, 0%);
  min-width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #2c9670);
  transition: width 500ms ease;
}

.progress.warning > span,
.progress--warning > span {
  background: linear-gradient(90deg, #c47b13, #e0ac45);
}

.progress.danger > span,
.progress--danger > span {
  background: linear-gradient(90deg, var(--danger), #df6f73);
}

.chart {
  position: relative;
  min-height: 220px;
  padding: 16px 6px 0;
}

.bars {
  display: flex;
  height: 190px;
  align-items: flex-end;
  justify-content: space-around;
  gap: 7px;
  padding: 10px 4px 26px;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 44px,
    rgba(205, 216, 208, 0.55) 45px
  );
}

.bar {
  position: relative;
  width: min(34px, 9%);
  height: max(3px, var(--value, 0%));
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #2c9670, var(--primary));
  transition:
    height 500ms ease,
    filter var(--transition),
    transform var(--transition);
}

.bar:hover {
  filter: brightness(1.06);
  transform: scaleX(1.05);
}

.bar::after {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  color: var(--text-soft);
  content: attr(data-label);
  font-size: 10px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.bar[data-value]::before {
  position: absolute;
  z-index: 2;
  bottom: calc(100% + 7px);
  left: 50%;
  padding: 4px 6px;
  border-radius: 7px;
  background: var(--text);
  color: #fff;
  content: attr(data-value);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: var(--transition);
  white-space: nowrap;
}

.bar[data-value]:hover::before,
.bar[data-value]:focus::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 15% 15%, rgba(198, 155, 75, 0.16), transparent 22rem),
    radial-gradient(circle at 85% 85%, rgba(23, 107, 77, 0.18), transparent 28rem),
    #edf2ee;
}

.login-card {
  width: min(100%, 430px);
  padding: clamp(24px, 7vw, 40px);
  border: 1px solid rgba(205, 216, 208, 0.9);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.login-card h1 {
  margin-bottom: 7px;
  font-size: clamp(27px, 8vw, 36px);
  letter-spacing: -0.045em;
}

.login-card > p {
  margin-bottom: 24px;
  color: var(--text-soft);
}

.alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 42px 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  transition:
    opacity var(--transition),
    transform var(--transition),
    margin var(--transition),
    padding var(--transition);
}

.alert-success,
.alert.success {
  border-color: rgba(20, 122, 81, 0.18);
  background: var(--success-soft);
  color: #0e6542;
}

.alert-warning,
.alert.warning {
  border-color: rgba(165, 102, 11, 0.18);
  background: var(--warning-soft);
  color: #815007;
}

.alert-danger,
.alert.danger,
.alert-error {
  border-color: rgba(182, 60, 66, 0.18);
  background: var(--danger-soft);
  color: #912e34;
}

.alert-info,
.alert.info {
  border-color: rgba(53, 106, 146, 0.16);
  background: var(--info-soft);
  color: #285674;
}

.alert.is-hiding {
  opacity: 0;
  transform: translateY(-5px);
}

.alert-close,
.alert [data-alert-close] {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: currentColor;
  cursor: pointer;
  opacity: 0.65;
  place-items: center;
}

.alert-close:hover,
.alert [data-alert-close]:hover {
  background: rgba(0, 0, 0, 0.05);
  opacity: 1;
}

.month-nav {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 7px;
  width: min(100%, 360px);
}

.month-nav-label,
.month-nav > strong {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-nav .button {
  padding-inline: 0;
}

.mobile-nav {
  position: fixed;
  z-index: 40;
  right: 10px;
  bottom: calc(10px + var(--safe-bottom));
  left: 10px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  padding: 6px;
  border: 1px solid rgba(205, 216, 208, 0.82);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 40px rgba(17, 39, 27, 0.14);
  backdrop-filter: blur(16px);
}

.mobile-nav .nav-link {
  min-height: 48px;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 5px 4px;
  border-radius: 11px;
  color: var(--text-soft);
  font-size: 10px;
}

.mobile-nav .nav-link svg,
.mobile-nav .nav-link .icon {
  width: 19px;
  height: 19px;
}

.mobile-nav .nav-link.active,
.mobile-nav .nav-link.is-active,
.mobile-nav .nav-link[aria-current="page"] {
  background: var(--primary-soft);
  box-shadow: none;
  color: var(--primary);
}

.empty-state {
  display: grid;
  min-height: 230px;
  place-items: center;
  align-content: center;
  padding: 34px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--text-soft);
  text-align: center;
}

.empty-state-icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 13px;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  place-items: center;
}

.empty-state h2,
.empty-state h3 {
  margin-bottom: 5px;
  color: var(--text);
  font-size: 17px;
}

.empty-state p {
  max-width: 48ch;
  margin-bottom: 17px;
}

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  padding: 18px;
  overflow-y: auto;
  background: rgba(8, 25, 17, 0.56);
  opacity: 0;
  pointer-events: none;
  place-items: center;
  transition: opacity var(--transition);
  backdrop-filter: blur(5px);
}

.modal[open],
.modal.is-open,
.modal[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

dialog.modal {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border: 0;
}

dialog.modal::backdrop {
  background: rgba(8, 25, 17, 0.56);
  backdrop-filter: blur(5px);
}

.modal-card,
.modal-content {
  width: min(100%, 560px);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.985);
  transition: transform 220ms ease;
}

.modal[open] .modal-card,
.modal.is-open .modal-card,
.modal[aria-hidden="false"] .modal-card,
.modal[open] .modal-content,
.modal.is-open .modal-content,
.modal[aria-hidden="false"] .modal-content {
  transform: translateY(0) scale(1);
}

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

.modal-header {
  margin-bottom: 18px;
}

.modal-footer {
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.details,
details {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.details + .details,
details + details {
  margin-top: 8px;
}

.details > summary,
details > summary {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 680;
  list-style: none;
}

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

.details > summary::after,
details > summary::after {
  content: "+";
  color: var(--primary);
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  transition: transform var(--transition);
}

.details[open] > summary::after,
details[open] > summary::after {
  transform: rotate(45deg);
}

.details-body,
.details > :not(summary),
details > :not(summary) {
  margin-right: 14px;
  margin-left: 14px;
}

.details-body,
.details > :last-child,
details > :last-child {
  margin-bottom: 14px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.text-right {
  text-align: right;
}

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

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

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

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

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

  .entry-actions {
    grid-column: auto;
    grid-row: 1 / span 2;
    justify-content: flex-end;
  }
}

@media (min-width: 760px) {
  .main {
    padding-right: 24px;
    padding-bottom: 38px;
    padding-left: 24px;
  }

  .topbar {
    margin-inline: -24px;
    padding-inline: 24px;
  }

  .card {
    padding: 21px;
  }

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

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

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

  .mobile-nav {
    display: none;
  }
}

@media (min-width: 1024px) {
  body.menu-open {
    overflow: auto;
  }

  .app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    transition: grid-template-columns 220ms ease;
  }

  .sidebar {
    position: sticky;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    box-shadow: none;
    transform: none;
    transition:
      width 220ms ease,
      padding 220ms ease;
  }

  .sidebar-collapse-toggle {
    display: inline-flex;
  }

  html.sidebar-collapsed .app-shell {
    grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
  }

  html.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    gap: 18px;
    padding-right: 10px;
    padding-left: 10px;
  }

  html.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding-right: 0;
    padding-left: 0;
  }

  html.sidebar-collapsed .sidebar-brand-label,
  html.sidebar-collapsed .nav-link-label,
  html.sidebar-collapsed .sidebar-label,
  html.sidebar-collapsed .sidebar-footer-user,
  html.sidebar-collapsed .sidebar-logout-label {
    display: none;
  }

  html.sidebar-collapsed .sidebar-nav {
    justify-items: stretch;
  }

  html.sidebar-collapsed .nav-link {
    justify-content: center;
    gap: 0;
    padding-right: 0;
    padding-left: 0;
  }

  html.sidebar-collapsed .nav-link .icon {
    display: grid;
    place-items: center;
  }

  html.sidebar-collapsed .sidebar-footer {
    display: grid;
    justify-items: center;
    padding-right: 0;
    padding-left: 0;
  }

  html.sidebar-collapsed .sidebar-footer form {
    display: grid;
    width: 100%;
    justify-items: center;
  }

  html.sidebar-collapsed .sidebar-logout {
    width: 46px;
    padding-right: 0;
    padding-left: 0;
  }

  html.sidebar-collapsed .sidebar-logout-icon {
    display: inline;
  }

  .main {
    padding-right: clamp(28px, 4vw, 56px);
    padding-left: clamp(28px, 4vw, 56px);
  }

  .topbar {
    margin-right: clamp(-56px, -4vw, -28px);
    margin-left: clamp(-56px, -4vw, -28px);
    padding-right: clamp(28px, 4vw, 56px);
    padding-left: clamp(28px, 4vw, 56px);
  }

  [data-menu-toggle] {
    display: none !important;
  }

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

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

@media (max-width: 759px) {
  .hide-mobile {
    display: none !important;
  }

  .table-responsive-cards .table {
    min-width: 0;
  }

  .table-responsive-cards thead {
    display: none;
  }

  .table-responsive-cards tbody,
  .table-responsive-cards tr,
  .table-responsive-cards td {
    display: block;
    width: 100%;
  }

  .table-responsive-cards tr {
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
  }

  .table-responsive-cards tr:last-child {
    border-bottom: 0;
  }

  .table-responsive-cards td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 5px 0;
    border: 0;
    text-align: right;
  }

  .table-responsive-cards td::before {
    color: var(--text-soft);
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
  }
}

@media (min-width: 760px) {
  .show-mobile {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .mobile-nav,
  .button,
  [data-menu-toggle] {
    display: none !important;
  }

  .app-shell,
  .main {
    display: block;
    padding: 0;
  }

  .card,
  .stat,
  .table-wrap {
    break-inside: avoid;
    box-shadow: none;
  }
}

/* Responsive and interaction hardening for finance forms. */
.amount {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.entry-actions {
  grid-column: 1 / -1;
  grid-row: auto;
  flex-wrap: wrap;
}

.entry-actions form,
.inline-conversion {
  max-width: 100%;
}

.entry-editor {
  width: 100%;
  grid-column: 1 / -1;
  margin-top: 4px;
  background: var(--surface-soft);
}

.entry-editor > summary {
  min-height: 38px;
  color: var(--primary);
  font-size: 12px;
}

.entry-editor > form {
  padding-top: 4px;
  padding-bottom: 14px;
}

form.is-submitting {
  cursor: wait;
}

form.is-submitting .button[type="submit"] {
  opacity: 0.68;
}

[data-conversion-field][hidden] {
  display: none !important;
}

@media (min-width: 560px) {
  .entry-actions {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-content: flex-start;
  }
}

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

@media (min-width: 1200px) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
