:root {
  color-scheme: dark;
  --background: #0f0b18;
  --surface: #171122;
  --surface-raised: #21162f;
  --surface-muted: #2b203a;
  --deep-green: #19102b;
  --deep-floor: #080511;
  --text: #f5f5f7;
  --muted: #a99db8;
  --line: #3b2a51;
  --accent: #b86cff;
  --accent-dark: #9b4dff;
  --danger: #ff453a;
  --hot: #ff4fd8;
  --cyan: #38d5ff;
  --shadow: 0 18px 42px rgba(92, 37, 180, 0.26);
}

* {
  box-sizing: border-box;
}

dialog,
form,
label {
  max-width: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(184, 108, 255, 0.25), transparent 32rem),
    radial-gradient(circle at top right, rgba(56, 213, 255, 0.14), transparent 28rem),
    linear-gradient(180deg, var(--deep-green) 0%, #130c21 18rem, var(--deep-floor) 100%);
  color: var(--text);
  font-family: "PT Mono", Menlo, Monaco, "Courier New", monospace;
}

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

select {
  font-family: "PT Mono", Menlo, Monaco, "Courier New", monospace;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
  font-weight: 650;
  padding: 0 14px;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #12051f;
}

button.danger {
  width: 100%;
  border-color: rgba(255, 69, 58, 0.42);
  background: rgba(255, 69, 58, 0.14);
  color: var(--danger);
}

button:hover {
  border-color: var(--accent-dark);
}

.icon-button {
  display: inline-grid;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  place-items: center;
  border-radius: 50%;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 0;
  background: rgba(18, 10, 32, 0.82);
  padding: 18px clamp(16px, 4vw, 48px);
  backdrop-filter: blur(22px);
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  font-size: 19px;
  margin-bottom: 16px;
}

h3 {
  color: var(--muted);
  font-size: 12px;
  margin: 16px 0 8px;
  text-transform: uppercase;
}

.export-menu {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: 12px;
  z-index: 30;
}

.export-trigger {
  position: relative;
  border: 0;
  background:
    conic-gradient(var(--accent) var(--progress, 0%), rgba(255, 255, 255, 0.13) 0),
    rgba(11, 7, 18, 0.82);
  color: var(--accent);
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  font-size: 16px;
  box-shadow: 0 0 18px rgba(184, 108, 255, 0.28);
}

.export-trigger::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #0d0816;
}

.export-trigger span {
  position: relative;
  z-index: 1;
}

.export-trigger.loading span {
  color: rgba(245, 245, 247, 0.42);
}

.export-trigger.complete span {
  color: #ffffff;
}

.export-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 10;
  display: none;
  min-width: 190px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(23, 17, 34, 0.98);
  box-shadow: var(--shadow);
  padding: 8px;
}

.export-popover.visible {
  display: grid;
  gap: 8px;
}

.export-popover button {
  justify-content: start;
  text-align: left;
  width: 100%;
}

.wallet-trigger {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  z-index: 30;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(11, 7, 18, 0.82);
  color: var(--accent);
  box-shadow: 0 0 18px rgba(184, 108, 255, 0.24);
  font-size: 17px;
  line-height: 1;
  padding: 0;
}

.members-trigger {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 54px;
  z-index: 30;
  display: none;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(11, 7, 18, 0.82);
  color: var(--cyan);
  box-shadow: 0 0 18px rgba(56, 213, 255, 0.2);
  font-size: 17px;
  line-height: 1;
  padding: 0;
}

.members-trigger.visible {
  display: grid;
  place-items: center;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 38;
  display: none;
  background: rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(8px);
}

.drawer-backdrop.visible {
  display: block;
}

.wallet-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  display: grid;
  grid-auto-rows: max-content;
  gap: 16px;
  width: min(360px, 88vw);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(circle at 10% 0%, rgba(184, 108, 255, 0.26), transparent 18rem),
    linear-gradient(180deg, rgba(23, 17, 34, 0.99), rgba(11, 7, 18, 0.99));
  box-shadow: 20px 0 50px rgba(0, 0, 0, 0.44);
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-105%);
  transition: transform 0.22s ease;
  overflow-y: auto;
}

.wallet-drawer.open {
  transform: translateX(0);
}

.wallet-drawer header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.wallet-drawer header p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.wallet-drawer header h2 {
  margin: 4px 0 0;
  font-size: 21px;
  overflow-wrap: anywhere;
}

.drawer-section {
  display: grid;
  gap: 9px;
}

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

.group-card {
  display: grid;
  gap: 7px;
}

.group-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 7px;
  align-items: stretch;
}

.wallet-option {
  display: grid;
  width: 100%;
  min-height: 62px;
  justify-items: start;
  gap: 4px;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.055);
  padding: 10px 12px;
  text-align: left;
}

.wallet-option.active {
  border-color: rgba(184, 108, 255, 0.62);
  background: rgba(184, 108, 255, 0.16);
  box-shadow: 0 0 18px rgba(184, 108, 255, 0.13);
}

.wallet-option span {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.wallet-option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.group-menu-trigger {
  min-width: 36px;
  min-height: 36px;
  height: auto;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 16px;
  padding: 0;
}

.group-actions {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.group-actions.visible {
  display: grid;
}

.group-actions button {
  min-height: 34px;
  border-color: rgba(184, 108, 255, 0.24);
  background: rgba(184, 108, 255, 0.09);
  color: var(--text);
  font-size: 12px;
  padding: 0 8px;
}

.group-actions .danger-inline {
  border-color: rgba(255, 69, 58, 0.32);
  background: rgba(255, 69, 58, 0.12);
  color: var(--danger);
}

.drawer-form {
  display: grid;
  gap: 8px;
}

.account-switcher {
  display: grid;
  gap: 5px;
  max-width: min(820px, calc(100vw - 32px));
}

.account-switcher span {
  display: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.account-switcher select {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 28px;
  font-weight: 760;
  line-height: 1.1;
  padding: 0 28px 0 0;
}

.account-switcher select.hidden {
  display: none;
}

.account-switcher strong {
  display: none;
  max-width: 100%;
  color: var(--text);
  font-size: clamp(20px, 5vw, 32px);
  font-weight: 760;
  line-height: 1.08;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.account-switcher strong.visible {
  display: block;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(320px, 1fr);
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 48px) 42px;
}

.dashboard-panel {
  display: grid;
  grid-column: 1 / -1;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(34, 23, 50, 0.96), rgba(24, 18, 31, 0.96)),
    radial-gradient(circle at 65% 20%, rgba(184, 108, 255, 0.22), transparent 20rem);
  box-shadow: var(--shadow);
  padding: 20px;
}

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

.group-member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, auto);
  gap: 10px;
  align-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  padding: 9px 10px;
}

.group-member-row span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.group-member-row strong {
  overflow-wrap: anywhere;
}

.group-member-row small,
.group-member-row b {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.group-member-row select {
  min-height: 36px;
  font-size: 12px;
  padding: 7px 9px;
}

.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.dashboard-hero h2 {
  margin: 3px 0 0;
  font-size: 28px;
}

.dashboard-total {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.dashboard-total span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.dashboard-total strong {
  color: var(--hot);
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1;
}

.type-tabs,
.period-tabs {
  display: grid;
  gap: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px;
}

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

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

.type-tabs button,
.period-tabs button {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
}

.type-tabs button.active,
.period-tabs button.active {
  background: rgba(184, 108, 255, 0.18);
  color: var(--accent);
}

.dashboard-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(280px, 1fr);
  gap: 12px;
  align-items: end;
}

.person-filter {
  display: none;
}

.person-filter.visible {
  display: grid;
}

.custom-range {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.custom-range.visible {
  display: grid;
  grid-column: 1 / -1;
}

.chart-card {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 8px 0 2px;
}

.period-label {
  color: var(--text);
  font-size: 22px;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.donut-wrap {
  display: grid;
  width: min(62vw, 360px);
  aspect-ratio: 1;
  place-items: center;
}

.donut-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: min(72vw, 460px);
}

.donut-chart {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(rgba(255,255,255,0.09) 0deg 360deg);
  box-shadow:
    0 0 28px rgba(184, 108, 255, 0.22),
    inset 0 0 20px rgba(255, 255, 255, 0.04);
}

.donut-hole {
  display: grid;
  width: 58%;
  height: 58%;
  place-items: center;
  border: 7px dashed rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: #1a1323;
}

.donut-hole strong {
  font-size: clamp(25px, 5vw, 46px);
  font-weight: 500;
  white-space: nowrap;
}

.category-breakdown {
  display: grid;
  gap: 10px;
}

.category-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 64px minmax(96px, auto);
  gap: 12px;
  align-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.065);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.category-row:hover {
  border-color: rgba(184, 108, 255, 0.42);
  transform: translateY(-1px);
}

.floating-add {
  position: absolute;
  right: clamp(-10px, 2vw, 10px);
  bottom: 8%;
  display: grid;
  width: 58px;
  height: 58px;
  min-height: 58px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--hot), var(--accent));
  color: #16051f;
  box-shadow:
    0 0 28px rgba(255, 79, 216, 0.48),
    0 14px 28px rgba(0, 0, 0, 0.32);
  font-size: 32px;
  font-weight: 420;
  line-height: 1;
  padding: 0 0 5px;
}

.desktop-form {
  display: none;
}

.category-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 800;
}

.category-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.category-row span {
  color: var(--muted);
  text-align: right;
}

.category-row b {
  font-size: 18px;
  font-weight: 500;
  text-align: right;
}

.panel {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(28, 28, 30, 0.9);
  box-shadow: var(--shadow);
  padding: 18px;
}

.expense-panel,
.operations-panel {
  grid-row: span 2;
}

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

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

.field-with-action > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--text);
  padding: 10px 12px;
}

#dashboardCategoryFilter {
  min-height: 52px;
  border-color: rgba(184, 108, 255, 0.42);
  background:
    linear-gradient(180deg, rgba(61, 40, 86, 0.96), rgba(37, 26, 53, 0.96));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 18px rgba(184, 108, 255, 0.14);
  color: var(--text);
  font-size: 15px;
}

input::placeholder,
textarea::placeholder {
  color: #77777e;
}

textarea {
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.file-picker {
  position: relative;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(61, 40, 86, 0.86), rgba(37, 26, 53, 0.86));
  color: var(--text);
  padding: 14px;
}

.file-picker input {
  min-height: 48px;
  border: 0;
  padding: 0;
}

.file-picker input::file-selector-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--hot), var(--accent));
  color: #16051f;
  font: inherit;
  font-weight: 800;
  margin-right: 10px;
  padding: 0 12px;
}

.file-picker span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.total-row {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 9px 10px;
}

.totals {
  display: grid;
  gap: 8px;
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.total-row strong {
  white-space: nowrap;
}

.category-expense-list,
.operation-list {
  display: grid;
  gap: 10px;
}

.category-expense {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 24px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--text);
  padding: 10px;
  text-align: left;
}

.category-expense span {
  display: grid;
  gap: 3px;
}

.category-expense strong {
  font-size: 16px;
}

.category-expense small,
.category-expense em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.category-expense em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-expense b {
  color: var(--hot);
  font-size: 18px;
  text-align: right;
}

.operation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 12px;
  cursor: pointer;
}

.operation-item:hover {
  border-color: rgba(48, 209, 88, 0.42);
}

.operation-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.operation-main strong {
  font-size: 20px;
}

.operation-main span,
.operation-main p {
  overflow-wrap: anywhere;
}

.operation-main small {
  color: var(--muted);
}

.operation-main p {
  color: var(--muted);
  font-size: 13px;
}

.operation-photo {
  display: grid;
  width: 84px;
  height: 84px;
  place-items: center;
  border-radius: 8px;
  background: #09090a;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
}

.operation-photo img {
  width: 76px;
  height: 76px;
  border-radius: 8px;
  object-fit: cover;
}

.empty-state {
  color: var(--muted);
  padding: 8px 0;
}

.expense-dialog {
  width: min(540px, calc(100vw - 28px));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 0;
}

.expense-dialog::backdrop {
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(10px);
}

.expense-dialog article {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.expense-dialog header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-date,
dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.detail-list div {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 10px;
}

#detailPhoto {
  display: block;
  width: 100%;
  max-height: 52vh;
  border-radius: 8px;
  object-fit: contain;
  background: #09090a;
}

#detailPhoto[src=""] {
  display: none;
}

.transfer-form {
  display: grid;
  gap: 14px;
}

.transfer-form label:not(.transfer-check) {
  border: 1px solid rgba(184, 108, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(61, 40, 86, 0.72), rgba(30, 22, 44, 0.86));
  padding: 12px;
}

.transfer-form select {
  min-height: 50px;
  border-color: rgba(184, 108, 255, 0.34);
  background: rgba(12, 8, 19, 0.76);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.transfer-summary {
  border: 1px solid rgba(184, 108, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(184, 108, 255, 0.16), rgba(255, 75, 214, 0.1));
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  margin: 0;
  padding: 12px;
}

.transfer-check {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.35;
}

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

.form-dialog article {
  gap: 14px;
}

.form-dialog .form {
  grid-template-columns: 1fr 1fr;
}

.form-dialog textarea {
  min-height: 92px;
}

@media (max-width: 900px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

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

  .expense-panel,
  .operations-panel {
    grid-row: auto;
  }
}

@media (max-width: 560px) {
  body {
    background: linear-gradient(180deg, var(--deep-green) 0%, var(--deep-green) 13rem, var(--deep-floor) 13rem);
  }

  .topbar {
    gap: 14px;
    padding: 48px 12px 8px;
  }

  h1 {
    font-size: 25px;
  }

  .account-switcher select {
    font-size: 25px;
  }

  .account-switcher {
    max-width: calc(100vw - 24px);
  }

  .account-switcher strong {
    font-size: clamp(18px, 7vw, 25px);
  }

  h2 {
    font-size: 17px;
    margin-bottom: 12px;
  }

  .export-popover {
    right: 0;
    min-width: min(220px, calc(100vw - 28px));
  }

  .wallet-drawer {
    width: min(330px, 90vw);
  }

  .layout {
    gap: 12px;
    padding: 8px 10px 26px;
  }

  .dashboard-panel {
    gap: 13px;
    border-radius: 28px;
    margin: 0 -2px;
    padding: 15px;
  }

  .dashboard-hero {
    align-items: start;
  }

  .dashboard-hero h2 {
    font-size: 25px;
  }

  .dashboard-total strong {
    font-size: 30px;
  }

  .period-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    margin: 0 -4px;
    padding: 4px;
  }

  .period-tabs button {
    min-height: 38px;
    padding: 0 3px;
    font-size: 13px;
  }

  .type-tabs {
    gap: 4px;
    padding: 4px;
  }

  .type-tabs button {
    min-height: 38px;
    font-size: 13px;
  }

  .dashboard-filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }

  .dashboard-filters label {
    min-width: 0;
  }

  .period-label {
    font-size: 20px;
  }

  .donut-wrap {
    width: min(77vw, 300px);
  }

  .donut-stage {
    width: 100%;
  }

  .floating-add {
    right: 2px;
    bottom: 2%;
    width: 52px;
    height: 52px;
    min-height: 52px;
    font-size: 30px;
  }

  .donut-hole {
    width: 59%;
    height: 59%;
    border-width: 5px;
  }

  .donut-hole strong {
    font-size: 29px;
  }

  .category-row {
    grid-template-columns: 42px minmax(0, 1fr) 44px minmax(84px, auto);
    gap: 8px;
    padding: 10px;
  }

  .category-mark {
    width: 38px;
    height: 38px;
  }

  .category-row strong,
  .category-row b {
    font-size: 16px;
  }

  .panel {
    padding: 14px;
  }

  .form {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .topbar button,
  .form button.primary {
    width: 100%;
  }

  input,
  select,
  textarea,
  button {
    min-height: 46px;
  }

  .operation-item {
    grid-template-columns: minmax(0, 1fr) 72px;
    padding: 10px;
  }

  .operation-main strong {
    font-size: 19px;
  }

  .operation-photo {
    width: 72px;
    height: 72px;
  }

  .operation-photo img {
    width: 72px;
    height: 72px;
  }

  .expense-dialog {
    width: calc(100vw - 16px);
  }

  .form-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 92vh;
    inset: auto 0 0 0;
    margin: 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
    overflow: hidden;
  }

  .form-dialog article {
    max-height: 92vh;
    overflow: auto;
    padding: 16px 14px calc(18px + env(safe-area-inset-bottom));
  }

  .form-dialog header {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: -16px -14px 0;
    background: rgba(23, 17, 34, 0.96);
    padding: 14px;
    backdrop-filter: blur(16px);
  }

  .form-dialog .form {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }

  .form-dialog .field-with-action,
  .form-dialog .wide {
    grid-column: 1 / -1;
  }

  .form-dialog label {
    min-width: 0;
    gap: 6px;
    font-size: 12px;
  }

  .form-dialog input,
  .form-dialog select,
  .form-dialog textarea {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    border-radius: 10px;
    font-size: 16px;
    padding: 9px 10px;
  }

  .form-dialog textarea {
    min-height: 82px;
  }

  .form-dialog .file-picker {
    display: grid;
    gap: 8px;
    min-height: 96px;
    align-content: center;
    border-color: rgba(184, 108, 255, 0.48);
    border-radius: 14px;
    padding: 13px;
  }

  .form-dialog .file-picker input {
    min-height: 46px;
    font-size: 14px;
  }

  .form-dialog .file-picker span {
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .form-dialog button.primary {
    min-height: 50px;
    margin-top: 2px;
  }
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
