:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --ink: #071329;
  --muted: #62708a;
  --line: #d9e2ee;
  --green: #00a879;
  --green-soft: #dcfae8;
  --red: #ef2b2d;
  --red-soft: #fff0f0;
  --amber: #c26000;
  --amber-soft: #fff3d5;
  --blue: #1b62b9;
  --blue-soft: #edf5ff;
  --violet-soft: #f1e4ff;
  --sidebar: #0b1424;
  --sidebar-line: #1e2d45;
  --shadow: 0 14px 32px rgba(7, 19, 41, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 14px 10px;
  background: var(--sidebar);
  color: #fff;
}

.sidebar-collapse-button {
  position: absolute;
  top: 12px;
  right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  gap: 3px;
  width: 32px;
  height: 32px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  cursor: pointer;
}

.sidebar-collapse-button span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.sidebar-collapse-button:hover {
  border-color: #2c68c8;
  background: rgba(44, 104, 200, 0.26);
}

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

.app-shell.sidebar-collapsed .sidebar {
  padding: 14px 8px;
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
  padding: 44px 0 22px;
}

.app-shell.sidebar-collapsed .brand > div,
.app-shell.sidebar-collapsed .quick-actions {
  display: none;
}

.app-shell.sidebar-collapsed .nav-list {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.app-shell.sidebar-collapsed .nav-button {
  justify-content: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
  gap: 0;
  transform: translateX(2px);
}

.app-shell.sidebar-collapsed .nav-icon {
  flex-basis: 22px;
  width: 22px;
  height: 22px;
  font-size: 15px;
}

.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .settings-nav-arrow,
.app-shell.sidebar-collapsed .settings-subnav,
.app-shell.sidebar-collapsed .settings-nav-group::before {
  display: none;
}

.app-shell.sidebar-collapsed .settings-nav-group {
  margin-top: 8px;
  padding-left: 0;
  width: 100%;
  justify-items: center;
}

.app-shell.sidebar-collapsed .sidebar-collapse-button {
  right: 20px;
  border-color: #2c68c8;
  background: #122d58;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
}

.brand-mark img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.brand small,
.eyebrow,
.panel-head span,
.muted {
  color: var(--muted);
}

.brand small {
  display: block;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}

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

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  border: 1px solid var(--sidebar-line);
  border-radius: 9px;
  padding: 0 12px;
  text-align: left;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  font-size: 14px;
  font-weight: 700;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  color: #9fb5d2;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.nav-label {
  min-width: 0;
}

.nav-button.is-active,
.nav-button:hover {
  color: #fff;
  border-color: #2c68c8;
  background: #122d58;
}

.nav-button.is-active .nav-icon,
.nav-button:hover .nav-icon {
  color: #fff;
}

.settings-nav-group {
  position: relative;
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding-left: 10px;
}

.settings-nav-group::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 999px;
  background: #2c68c8;
  opacity: 0.75;
}

.nav-button-settings {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 38px;
}

.nav-button-settings .settings-nav-arrow {
  margin-left: auto;
}

.settings-nav-arrow {
  color: rgba(255, 255, 255, 0.68);
  font-size: 18px;
  line-height: 1;
  transition: transform 160ms ease, color 160ms ease;
}

.settings-nav-group.is-open .settings-nav-arrow {
  transform: rotate(-90deg);
  color: #fff;
}

.settings-subnav {
  display: none;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  text-align: left;
  color: rgba(255, 255, 255, 0.62);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
  font-weight: 600;
}

.settings-nav-group.is-open .settings-subnav {
  display: block;
}

.settings-subnav:hover {
  color: #fff;
  background: rgba(44, 104, 200, 0.18);
}

.settings-subnav.is-active {
  color: #fff;
  background: #153766;
}

.quick-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: 10px;
  padding: 16px 10px 18px;
  border-top: 1px solid var(--sidebar-line);
}

.quick-actions span {
  color: #93a4bf;
  font-size: 11px;
  text-transform: uppercase;
}

.quick-button {
  min-height: 40px;
  border-radius: 9px;
  padding: 0 14px;
  color: #fff;
  font-weight: 800;
}

.quick-button.is-run {
  border: 1px solid #0fac72;
  background: #073f33;
}

.quick-button.is-stop {
  border: 1px solid #c13b4a;
  background: #3c1020;
}

.content {
  min-width: 0;
  padding: 24px 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.top-actions,
.section-toolbar,
.dialog-actions,
.summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.top-actions {
  justify-content: flex-end;
}

.top-actions select {
  width: 220px;
}

.top-actions .primary-button {
  width: auto;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  background: #122d58;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 560;
  line-height: 1.25;
  min-height: 44px;
  padding: 10px 12px;
}

input::placeholder,
textarea::placeholder {
  color: #7d8aa0;
  opacity: 1;
  font-weight: 560;
  transition: opacity 0.12s ease;
}

input:focus::placeholder,
textarea:focus::placeholder {
  opacity: 0;
}

#operationForm input[name="returnRate"],
#operationForm input[name="payerRate"],
#operationForm input[name="cashlessIncomeSourceRate"],
#operationForm input[name="invoiceLegalEntity"] {
  border-color: #d8e2ef;
  background: #f4f7fb;
  color: #54627a;
}

#operationForm input[name="returnRate"]:focus,
#operationForm input[name="payerRate"]:focus,
#operationForm input[name="cashlessIncomeSourceRate"]:focus,
#operationForm input[name="invoiceLegalEntity"]:focus {
  border-color: #b9c9de;
  background: #fff;
  color: var(--ink);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button,
.floating-action {
  border: 0;
  border-radius: 9px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 700;
}

.primary-button {
  background: #0c8066;
  color: #fff;
}

.secondary-button {
  background: #10213a;
  color: #fff;
}

.ghost-button {
  background: var(--surface-soft);
  color: var(--ink);
}

.danger-button {
  background: #c92831;
  color: #fff;
}

.icon-button {
  width: 44px;
  padding: 0;
  background: var(--surface-soft);
}

#closeDialog {
  font-size: 16px;
  line-height: 1;
}

.drawer-close-button {
  width: 50px;
  min-height: 50px;
  font-size: 22px;
  line-height: 1;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.metric-grid,
.card-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric,
.panel,
.entity-card,
.report-card,
.return-card,
.settings-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 104px;
  padding: 14px;
}

.metric > span {
  font-size: 15px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 20px;
  color: #b84f00;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.metric-subline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  line-height: 1.45;
}

.metric-subline b {
  color: var(--text);
  white-space: nowrap;
}

.metric-subline.is-margin-cash b {
  color: #0b8a63;
}

.metric-subline.is-margin-done b {
  color: #0b8a63;
}

.metric-subline.is-margin-wait b {
  color: #b42318;
}

.metric.good {
  background: var(--green-soft);
}

.metric.warn {
  background: var(--amber-soft);
}

.metric.bad {
  background: var(--red-soft);
}

.margin-action-stack {
  position: fixed;
  z-index: 90;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 10px;
  width: min(620px, calc(100vw - 44px));
}

.margin-action-toast {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid #cde4d8;
  border-radius: 13px;
  background: #f7fffb;
  box-shadow: 0 22px 60px rgba(7, 19, 41, 0.18);
}

.margin-action-toast b {
  display: block;
  margin-bottom: 3px;
  color: #07543f;
  font-size: 15px;
}

.margin-action-toast span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.margin-action-toast .margin-action-detail {
  margin-bottom: 3px;
  color: #33415c;
}

.margin-action-toast .margin-action-detail strong {
  color: #0d1b34;
  font-weight: 800;
}

.margin-action-toast .primary-button,
.margin-action-toast .ghost-button {
  min-height: 38px;
  white-space: nowrap;
}

.metric.info {
  background: var(--blue-soft);
}

.metric:nth-child(3n) {
  background: var(--violet-soft);
}

.alert-banner {
  display: grid;
  gap: 6px;
  margin-bottom: 20px;
  padding: 14px 18px;
  border-left: 4px solid var(--red);
  background: var(--red-soft);
  color: var(--ink);
}

.alert-banner span {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.6fr) minmax(270px, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.panel {
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.calendar-week {
  display: grid;
  gap: 8px;
}

.calendar-weeks {
  display: grid;
  gap: 10px;
}

.calendar-week + .calendar-week {
  margin-top: 0;
}

.calendar-week-toggle {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  color: var(--ink);
  text-align: left;
}

.calendar-week-toggle strong {
  font-size: 14px;
  line-height: 1.2;
}

.calendar-week-toggle > span:last-child {
  justify-self: end;
  min-width: 104px;
  padding: 6px 10px;
  border: 1px solid #d5deea;
  border-radius: 999px;
  background: #e8eef6;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.calendar-week-plus {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #eaf2ff;
  color: #163b73;
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
}

.calendar-week.is-closed .calendar-week-toggle {
  background: #f3f7fc;
}

.calendar-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.day-card {
  min-height: 118px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fbff;
}

.day-card.has-returns {
  background: #f6fbff;
}

.day-card.is-overdue {
  background: var(--red-soft);
}

.day-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.day-card-head strong {
  min-width: 0;
  font-size: 14px;
  line-height: 1.25;
}

.day-card-head .badge {
  justify-self: end;
  max-width: none;
  text-align: right;
  white-space: nowrap;
}

.day-card-breakdown {
  display: grid;
  gap: 3px;
  margin-top: 8px;
}

.mini-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  line-height: 1.2;
}

.mini-line span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-line b {
  font-weight: 600;
  padding-right: 10px;
  white-space: nowrap;
}

.activity-list,
.card-list {
  display: grid;
  gap: 8px;
}

.activity-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  background: var(--surface-soft);
}

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

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

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

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.operation-filter-shell {
  margin: 12px 0 18px;
}

.operation-filter-toggle {
  display: none;
}

.operation-filter-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 32px rgba(7, 19, 41, 0.06);
}

.operation-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.operation-filter-group-period {
  flex: 1;
}

.operation-filter-panel select,
.operation-filter-panel input {
  min-height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #f8fbff;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.operation-filter-panel select {
  min-width: 132px;
}

.operation-filter-panel input {
  flex: 1;
  min-width: 260px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

#operationsView table {
  min-width: 1260px;
}

#operationsView td,
#operationsView .inline-edit {
  font-weight: 400;
}

#operationsView td b,
#operationsView .calc-money-green {
  font-weight: 400;
}

#operationsView td.cashless-col-margin,
#operationsView td.cashless-col-margin .inline-edit,
#operationsView .calc-money-green {
  color: #007a3d;
}

#operationsView td:nth-child(3),
#operationsView .cashless-col-amount,
#operationsView .cashless-col-counterpartyAmount,
#operationsView .cashless-col-payerAmount,
#operationsView .cashless-col-margin {
  white-space: nowrap;
}

#operationsView td:first-child {
  min-width: 58px;
  white-space: nowrap;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  font-size: 12px;
  color: #385173;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
  background: #eaf2fb;
  border-bottom-color: #bfd2ea;
}

#operationsView th.cashless-col-date,
#operationsView th.cashless-col-plannedReturnDate {
  width: 68px;
}

#operationsView td.cashless-col-date,
#operationsView td.cashless-col-plannedReturnDate {
  width: 68px;
  white-space: nowrap;
}

#operationsView th.cashless-col-invoiceLegalEntity {
  width: 168px;
}

#operationsView th.cashless-col-counterpartyId,
#operationsView th.cashless-col-payerId,
#operationsView td.cashless-col-counterpartyId,
#operationsView td.cashless-col-payerId {
  width: 112px;
}

#operationsView th.cashless-col-counterpartyAmount,
#operationsView th.cashless-col-payerAmount,
#operationsView th.cashless-col-margin,
#operationsView td.cashless-col-counterpartyAmount,
#operationsView td.cashless-col-payerAmount,
#operationsView td.cashless-col-margin {
  width: 92px;
}

#operationsView th.cashless-col-invoiceNumber,
#operationsView td.cashless-col-invoiceNumber {
  width: 150px;
}

tbody tr {
  cursor: default;
}

tbody tr:hover {
  background: #edf5ff;
}

tbody tr:nth-child(even) {
  background: #f6f8fb;
}

tbody tr:nth-child(even):hover {
  background: #edf4fb;
}

.table-filter-row input {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  font-size: 12px;
  border-radius: 8px;
  background: #fff;
}

.inline-edit {
  display: inline-block;
  min-width: 54px;
  min-height: 28px;
  padding: 4px 6px;
  border-radius: 7px;
  outline: 0;
  cursor: text;
  caret-color: var(--ink);
}

.inline-edit:focus {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(12, 128, 102, 0.24);
}

.inline-date-edit {
  position: relative;
  display: inline-grid;
  align-items: center;
  min-width: 58px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 7px;
  cursor: pointer;
}

.inline-date-edit span {
  pointer-events: none;
  white-space: nowrap;
}

.inline-date-edit input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.inline-date-edit:focus-within {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(12, 128, 102, 0.24);
}

.inline-entity-select {
  width: 98px;
  min-height: 24px;
  padding: 3px 9px;
  border: 0;
  border-radius: 999px;
  color: var(--badge-text-color) !important;
  -webkit-text-fill-color: var(--badge-text-color);
  appearance: none;
  -webkit-appearance: none;
  font-weight: 600;
  font-size: 12px;
  text-align: center;
  background-color: var(--badge-color);
  background-image: none !important;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-entity-select option {
  color: var(--badge-text-color);
  background: var(--badge-color);
}

.payment-status-select {
  width: 122px;
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 4px 20px 4px 14px;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

#operationsView .payment-status-select {
  width: 104px;
  min-height: 25px;
  padding: 3px 10px;
  appearance: none;
  -webkit-appearance: none;
  background-image: none !important;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
}

#operationsView .payment-status-select::-ms-expand {
  display: none;
}

.payment-status-select.is-paid {
  color: #07543f;
  background: #dff6e9;
}

.payment-status-select.is-unpaid {
  color: #8b4f08;
  background: #fff0cf;
}

.operation-row-actions {
  width: 40px;
  min-width: 40px;
  text-align: center;
}

.operation-status-footer {
  display: none;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}

.entity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  min-width: 86px;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--badge-text-color) !important;
  -webkit-text-fill-color: var(--badge-text-color);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  background: var(--badge-color);
}

.entity-badge + .entity-badge {
  margin-left: 3px;
}

.operation-link-note {
  display: block;
  margin-top: 5px;
  line-height: 1.25;
}

.returns-table-panel {
  margin: 12px 0;
}

.compact-table {
  min-width: 760px;
}

.compact-table td,
.compact-table th {
  white-space: nowrap;
}

.compact-table td:not(:first-child),
.compact-table th:not(:first-child) {
  text-align: right;
}

.total-row {
  background: #f6f8fb;
  font-weight: 800;
}

.money-positive {
  color: #005bd3;
  font-weight: 800;
}

.money-negative {
  color: var(--red);
  font-weight: 800;
}

.share-cell {
  display: inline-flex;
  min-width: 52px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 8px;
  background: #dbeafe;
  color: #1557b0;
  font-weight: 800;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: 9px;
  background: var(--surface-soft);
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
}

.segmented button.is-active {
  background: #fff;
  box-shadow: 0 4px 12px rgba(23, 33, 31, 0.08);
}

.section-toolbar {
  justify-content: space-between;
  margin-bottom: 12px;
}

.entity-card,
.report-card,
.return-card,
.settings-panel {
  padding: 18px;
}

.entity-card h3,
.report-card h3,
.return-card h3 {
  margin-bottom: 10px;
  font-size: 17px;
}

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

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.return-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  align-items: start;
  gap: 14px;
}

.settings-switcher {
  display: none;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 10px;
  background: var(--surface-soft);
}

.settings-switcher button {
  flex: 1;
  min-width: max-content;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.settings-switcher button.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(23, 33, 31, 0.08);
}

.settings-select-label {
  display: none;
  margin-bottom: 12px;
}

.settings-panel {
  display: grid;
  min-width: 0;
  gap: 14px;
  align-content: start;
}

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

.mini-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
}

.directory-list {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.directory-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.directory-item.is-editing {
  grid-template-columns: 1fr;
}

.directory-item-simple {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.directory-item > div {
  min-width: 0;
}

.directory-item.is-dragging {
  opacity: 0.72;
  border-color: #5794e8;
  background: #f3f8ff;
  box-shadow: 0 12px 26px rgba(27, 98, 185, 0.16);
  transform: scale(1.01);
}

.directory-item.is-drop-target {
  border-color: #79a7e8;
  background: #f0f6ff;
}

.directory-item.is-drop-target::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: -5px;
  height: 3px;
  border-radius: 999px;
  background: #1b62b9;
}

.directory-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.directory-item strong {
  color: #b84f00;
  white-space: nowrap;
}

.directory-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 8px;
}

.drag-handle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #f7f9fc;
  color: #9ca8ba;
  cursor: grab;
  font-size: 15px;
  line-height: 1;
}

.directory-item.is-dragging .drag-handle,
.drag-handle:hover {
  background: #e8f1ff;
  color: #4574b8;
}

.drag-handle:active {
  cursor: grabbing;
}

.directory-edit-button {
  width: 34px;
  min-height: 34px;
  border-radius: 8px;
  background: #f7f9fc;
  color: #8b98aa;
  font-size: 17px;
  line-height: 1;
  transform: rotate(92deg);
}

.directory-edit-button:hover {
  background: #eef2f7;
  color: #657286;
}

.directory-delete-button {
  width: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff5f5;
  color: #c85b63;
  line-height: 1;
}

.directory-delete-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.directory-delete-button:hover {
  background: #ffe9e9;
  color: #b7212b;
}

.directory-edit-form {
  display: grid;
  gap: 10px;
}

.directory-edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field-hint {
  color: #8b98aa;
  font-size: 12px;
  font-weight: 600;
}

#confirmWalletDeleteDialog {
  inset: 50% auto auto 50%;
  width: min(460px, calc(100% - 28px));
  height: fit-content;
  max-height: calc(100vh - 28px);
  margin: 0;
  overflow: visible;
  transform: translate(-50%, -50%);
}

.confirm-card {
  width: 100%;
  max-width: none;
}

.confirm-message {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.subdirectory {
  display: grid;
  gap: 12px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.subdirectory h3 {
  margin-bottom: 0;
  font-size: 16px;
}

input[type="date"] {
  cursor: pointer;
}

dialog {
  width: min(860px, calc(100% - 24px));
  box-sizing: border-box;
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

dialog::backdrop {
  background: rgba(23, 33, 31, 0.45);
}

#operationDialog {
  margin-top: 32px;
  margin-bottom: 32px;
  max-height: calc(100dvh - 64px);
  overflow: auto;
}

.dialog-card {
  box-sizing: border-box;
  overflow-x: hidden;
  padding: 18px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

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

.scenario-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.scenario-card {
  display: grid;
  gap: 10px;
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  text-align: left;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(7, 19, 41, 0.06);
}

.scenario-card span {
  font-size: 20px;
  font-weight: 850;
  line-height: 1.18;
}

.scenario-card b {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.scenario-card-green {
  border-color: #07936d;
  background: linear-gradient(180deg, #f8fffb 0%, #eaf9f0 100%);
}

.scenario-card-green span {
  color: #07543f;
}

.scenario-card-orange {
  border-color: #e6b96f;
  background: linear-gradient(180deg, #fffdf8 0%, #fff2df 100%);
}

.scenario-card-orange span {
  color: #8b4f08;
}

.scenario-card-blue {
  border-color: #4d8fd7;
  background: linear-gradient(180deg, #f8fbff 0%, #eaf4ff 100%);
}

.scenario-card-blue span {
  color: #175f9c;
}

.operation-form-choosing .operation-template,
.operation-form-choosing .dialog-actions {
  display: none;
}

.operation-form-counterparty-payment .operation-status-footer {
  display: flex;
}

.operation-form-beznal .scenario-picker,
.operation-form-object .scenario-picker,
.operation-form-cashless-income .scenario-picker,
.operation-form-transfer .scenario-picker {
  display: none;
}

.operation-form-beznal .operation-section-secondary,
.operation-form-beznal .operation-section-blue,
.operation-form-beznal .operation-section-transfer,
.operation-form-beznal .operation-divider,
.operation-form-object .operation-section-primary,
.operation-form-object .operation-section-blue,
.operation-form-object .operation-section-transfer,
.operation-form-object .operation-divider,
.operation-form-cashless-income .operation-section-primary,
.operation-form-cashless-income .operation-section-secondary,
.operation-form-cashless-income .operation-section-transfer,
.operation-form-cashless-income .operation-divider,
.operation-form-transfer .operation-section-primary,
.operation-form-transfer .operation-section-secondary,
.operation-form-transfer .operation-section-blue,
.operation-form-transfer .operation-divider,
.operation-form-object .operation-divider {
  display: none;
}

.operation-form-object .dialog-actions .primary-button {
  background: #d98216;
}

.operation-form-cashless-income .dialog-actions .primary-button {
  background: #0c8066;
}

.operation-form-transfer .dialog-actions .primary-button {
  background: #1769b5;
}

.operation-template {
  display: grid;
  gap: 16px;
}

.operation-section {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.operation-section-primary {
  border-color: #07936d;
  background: linear-gradient(180deg, #fbfffd 0%, #ffffff 100%);
}

.operation-section-secondary {
  border-color: #f0cf9e;
  background: #fffdf8;
}

.operation-section-blue {
  border-color: #07936d;
  background: linear-gradient(180deg, #fbfffd 0%, #ffffff 100%);
}

.operation-section-transfer {
  border-color: #4d8fd7;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.operation-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.operation-section-head h3 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.2;
}

.operation-section-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
}

.operation-mode-groups {
  display: grid;
  gap: 10px;
  padding: 10px 10px 16px;
  margin-bottom: 14px;
  border: 1px solid rgba(86, 112, 147, 0.18);
  border-radius: 13px;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7fc 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

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

.operation-mode-group-after {
  padding: 10px;
  border: 1px solid #d8e4f2;
  border-radius: 12px;
  background: #f6f9fd;
}

.operation-mode-group-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.operation-mode-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  background: transparent;
}

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

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

.operation-mode {
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 1px solid #c3d0e1;
  border-radius: 10px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  color: #263653;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.28;
  text-align: center;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), 0 4px 12px rgba(33, 57, 89, 0.06);
}

.operation-mode.is-active {
  background: #0f8a6b;
  color: #fff;
}

.operation-mode-soft.is-active {
  background: #1769b5;
  color: #fff;
}

.general-expense-field {
  display: none;
}

.operation-expense-general .general-expense-field {
  display: grid;
}

.operation-expense-general .object-expense-field {
  display: none;
}

.cash-return-field {
  display: none;
}

.operation-form-return .cash-return-field {
  display: grid;
}

.operation-form-return .cash-return-margin-hidden {
  display: none;
}

.cash-return-margin-info {
  align-self: end;
  gap: 8px;
  padding: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.cash-return-margin-info strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  background: #def8e8;
  color: #008044;
  font-size: 16px;
  font-weight: 800;
}

.source-return-field {
  display: none;
}

.operation-form-source-return .source-return-field {
  display: grid;
}

.margin-claim-field,
.payer-return-field {
  display: none;
}

.operation-form-margin-claim .margin-claim-field,
.operation-form-payer-return .payer-return-field {
  display: grid;
}

.operation-form-return .counterparty-payment-field {
  display: none;
}

.operation-form-source-return .counterparty-payment-only,
.operation-form-source-return .beznal-counterparty-field,
.operation-form-source-return [name="cashlessIncomeOperationId"],
.operation-form-margin-claim .counterparty-payment-only,
.operation-form-margin-claim .beznal-counterparty-field,
.operation-form-margin-claim .cash-return-field,
.operation-form-margin-claim .source-return-field,
.operation-form-margin-claim [name="cashlessIncomeOperationId"],
.operation-form-payer-return .counterparty-payment-only,
.operation-form-payer-return .beznal-counterparty-field,
.operation-form-payer-return .cash-return-field,
.operation-form-payer-return .source-return-field,
.operation-form-payer-return [name="cashlessIncomeOperationId"] {
  display: none;
}

.operation-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

.operation-fields label {
  min-width: 0;
}

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

.money-input-shell {
  position: relative;
  display: block;
}

.money-input-shell input {
  width: 100%;
  padding-right: 34px;
}

.select-native-hidden {
  display: none;
}

.select-mirror-shell {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.select-mirror-button {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfdae8;
  border-radius: 8px;
  padding: 0 34px 0 12px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-mirror-button::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #0b1630;
  border-bottom: 2px solid #0b1630;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.select-mirror-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: min(390px, calc(100vh - 120px));
  overflow: auto;
  border: 1px solid #c9d6e6;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(23, 35, 58, 0.18);
}

.select-mirror-menu button {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 0;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 560;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
}

.select-mirror-menu button:hover,
.select-mirror-menu button.is-active {
  background: #eaf3ff;
}

.money-input-suffix {
  position: absolute;
  top: 50%;
  right: 12px;
  color: #7f8da3;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  transform: translateY(-50%);
}

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

.operation-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.operation-divider::before,
.operation-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

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

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

.calc-preview {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
}

.calc-money-green {
  color: #0f8a4d;
}

.mini-action-button {
  margin-top: 8px;
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  background: #0f8a6b;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.dialog-actions {
  justify-content: space-between;
  margin-top: 14px;
}

.confirm-card .dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.confirm-card .dialog-actions .ghost-button,
.confirm-card .dialog-actions .danger-button {
  min-width: 112px;
}

.floating-action {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 28px;
  box-shadow: 0 16px 30px rgba(31, 122, 83, 0.35);
}

.mobile-menu-toggle,
.mobile-menu-backdrop {
  display: none;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(7, 19, 41, 0.42);
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 21;
  width: min(470px, 100%);
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 180ms ease;
  box-shadow: -24px 0 48px rgba(7, 19, 41, 0.18);
}

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

.drawer-card {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #377df0;
  color: #fff;
  font-weight: 800;
}

.drawer-body {
  overflow-y: auto;
  padding: 22px 24px;
}

.drawer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-field span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.drawer-message,
.drawer-note {
  margin-top: 22px;
}

.drawer-note {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fbff;
}

.drawer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
}

@media (max-width: 1080px) {
  .metric-grid,
  .card-grid,
  .report-grid,
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .app-shell.sidebar-collapsed {
    display: block;
  }

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

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 30;
    width: min(312px, calc(100vw - 54px));
    height: 100vh;
    padding: 14px 10px 18px;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    transform: translateX(-105%);
    transition: transform 180ms ease;
    overflow-y: auto;
  }

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

  .app-shell.sidebar-collapsed .brand {
    justify-content: flex-start;
    padding: 0 26px 28px;
  }

  .app-shell.sidebar-collapsed .brand > div {
    display: block;
  }

  .app-shell.sidebar-collapsed .nav-list,
  .app-shell.sidebar-collapsed .quick-actions {
    display: grid;
  }

  .app-shell.sidebar-collapsed .nav-label,
  .app-shell.sidebar-collapsed .settings-nav-arrow {
    display: inline;
  }

  .app-shell.sidebar-collapsed .settings-nav-group::before {
    display: block;
  }

  .app-shell.sidebar-collapsed .nav-button {
    justify-content: flex-start;
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
  }

  .mobile-menu-toggle {
    position: fixed;
    left: 12px;
    top: 12px;
    z-index: 18;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 10px 26px rgba(7, 19, 41, 0.12);
    font-size: 20px;
    font-weight: 800;
  }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 29;
    display: block;
    background: rgba(7, 19, 41, 0.42);
  }

  .mobile-menu-backdrop[hidden] {
    display: none;
  }

  .quick-actions {
    position: static;
    display: grid;
    margin-top: 18px;
    padding: 16px 0 0;
  }

  .nav-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .settings-nav-group {
    display: grid;
    padding-left: 10px;
  }

  .settings-nav-group::before {
    display: block;
  }

  .settings-subnav {
    text-align: left;
  }

  .settings-nav-arrow {
    display: inline;
  }

  .nav-button-settings {
    justify-content: space-between;
  }

  .nav-button {
    min-height: 42px;
    padding: 0 12px;
    text-align: left;
    font-size: 15px;
  }

  .content {
    padding: 72px 12px 88px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions select {
    flex: 0 0 132px;
  }

  .top-actions button {
    flex: 1;
    min-width: 0;
    padding: 0 10px;
    white-space: nowrap;
  }

  .top-actions #openOperation {
    font-size: 0;
  }

  .top-actions #openOperation::before {
    content: "+ Операция";
    font-size: 13px;
    font-weight: 800;
  }

  .operation-filter-shell {
    margin: 10px 0 14px;
  }

  .operation-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
    font-weight: 750;
    box-shadow: 0 10px 24px rgba(7, 19, 41, 0.08);
  }

  .operation-filter-toggle b {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #edf5ff;
    color: var(--blue);
    font-size: 18px;
    line-height: 1;
  }

  .operation-filter-panel {
    display: none;
    margin-top: 8px;
    padding: 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .operation-filter-panel.is-open {
    display: flex;
  }

  .operation-filter-group,
  .operation-filter-group-period {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .operation-filter-panel select,
  .operation-filter-panel input {
    width: 100%;
    min-width: 0;
  }

  .user-badge {
    width: 100%;
    justify-content: center;
  }

  h1 {
    font-size: 26px;
  }

  .metric-grid,
  .card-grid,
  .report-grid,
  .settings-grid,
  .calendar-strip,
  .form-grid,
  .operation-fields,
  .operation-fields-compact {
    grid-template-columns: 1fr;
  }

  .operation-section {
    padding: 14px;
  }

  .scenario-picker {
    grid-template-columns: 1fr;
  }

  .scenario-card {
    min-height: 116px;
    padding: 16px;
  }

  .scenario-card span {
    font-size: 18px;
  }

  .operation-section-primary .operation-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px 16px;
  }

  .operation-fields label {
    min-width: 0;
  }

  .operation-fields input[type="date"] {
    min-width: 0;
  }

  #operationForm .operation-date-field {
    overflow: hidden;
  }

  #operationForm .operation-date-field input[type="date"] {
    inline-size: 100%;
    max-width: 100%;
    padding-left: 9px;
    padding-right: 5px;
    font-size: 13px;
  }

  #operationForm .operation-date-field input[type="date"]::-webkit-calendar-picker-indicator {
    width: 15px;
    height: 15px;
    margin-left: -7px;
    padding: 0;
  }

  .operation-section-secondary .operation-fields {
    grid-template-columns: 1fr;
  }

  .operation-section-blue .operation-fields {
    grid-template-columns: 1fr;
  }

  .operation-section-head {
    display: grid;
    gap: 10px;
  }

  .operation-section-head h3 {
    font-size: 19px;
  }

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

  .operation-mode {
    min-height: 58px;
    border: 1px solid #ccd7e6;
    border-radius: 9px;
    padding: 8px 6px;
    font-size: 13px;
  }

  input[data-money-input] {
    font-size: 15px;
    font-weight: 650;
  }

  #operationForm .select-mirror-button {
    min-height: 40px;
    padding-right: 30px;
    padding-left: 10px;
    font-size: 13px;
    font-weight: 650;
  }

  #operationForm .select-mirror-button::after {
    right: 11px;
  }

  .select-mirror-menu {
    max-height: min(320px, calc(100dvh - 170px));
  }

  #operationForm input,
  #operationForm textarea {
    font-size: 13px;
  }

  #operationForm input::placeholder,
  #operationForm textarea::placeholder {
    font-size: 13px;
  }

  #operationForm .payment-status-select {
    width: 124px;
    min-height: 30px;
    padding: 4px 20px 4px 14px;
    font-size: 12px;
    font-weight: 700;
  }

  .settings-switcher {
    display: none;
  }

  .settings-select-label {
    display: grid;
    position: sticky;
    top: 8px;
    z-index: 4;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .metric {
    min-height: 108px;
  }

  .margin-action-stack {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
  }

  .margin-action-toast {
    grid-template-columns: 1fr 1fr;
  }

  .margin-action-toast > div {
    grid-column: 1 / -1;
  }

  .margin-action-toast .primary-button,
  .margin-action-toast .ghost-button {
    width: 100%;
    padding: 0 10px;
    font-size: 13px;
  }

  .floating-action {
    display: block;
    z-index: 18;
    right: 18px;
    bottom: 18px;
  }

  dialog {
    width: calc(100% - 28px);
    max-width: calc(100% - 28px);
    inline-size: calc(100dvw - 28px);
    max-inline-size: calc(100dvw - 28px);
    height: fit-content;
    max-height: calc(100dvh - max(56px, calc(env(safe-area-inset-top, 0px) + 28px)) - max(22px, calc(env(safe-area-inset-bottom, 0px) + 14px)));
    margin: max(28px, calc(env(safe-area-inset-top, 0px) + 18px)) auto max(22px, calc(env(safe-area-inset-bottom, 0px) + 14px));
    border-radius: 12px;
    overflow: hidden;
  }

  #confirmWalletDeleteDialog {
    inset: 50% auto auto 50%;
    width: calc(100% - 28px);
    max-width: 420px;
    height: fit-content;
    max-height: calc(100vh - 28px);
    margin: 0;
    border-radius: 12px;
    transform: translate(-50%, -50%);
  }

  .dialog-card {
    height: auto;
    max-height: calc(100dvh - max(56px, calc(env(safe-area-inset-top, 0px) + 28px)) - max(22px, calc(env(safe-area-inset-bottom, 0px) + 14px)));
    scrollbar-gutter: stable;
    overflow-y: auto;
    padding-top: 20px;
  }

  #operationDialog {
    max-height: calc(100dvh - max(56px, calc(env(safe-area-inset-top, 0px) + 28px)) - max(22px, calc(env(safe-area-inset-bottom, 0px) + 14px)));
    overflow: hidden;
    overscroll-behavior: contain;
  }

  #operationDialog .dialog-card {
    max-height: calc(100dvh - max(56px, calc(env(safe-area-inset-top, 0px) + 28px)) - max(22px, calc(env(safe-area-inset-bottom, 0px) + 14px)));
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .confirm-card {
    height: auto;
    overflow: visible;
  }

  .return-card {
    grid-template-columns: 1fr;
  }
}

body {
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 650;
}

h2 {
  font-size: 17px;
  line-height: 1.25;
  font-weight: 650;
}

.nav-button {
  font-weight: 600;
  line-height: 1.15;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button,
.floating-action,
.quick-button,
.settings-switcher button {
  font-weight: 600;
}

.user-badge,
.badge,
.total-row,
.money-positive,
.money-negative,
.share-cell,
.avatar,
.drawer-field span {
  font-weight: 650;
}

.metric strong {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 650;
}

.metric small,
.mini-line,
.alert-banner span {
  line-height: 1.35;
}

th {
  line-height: 1.25;
  font-weight: 800;
  text-transform: none;
}

td {
  font-size: 14px;
  line-height: 1.35;
}

.eyebrow,
.quick-actions span,
.drawer-field span {
  text-transform: none;
  font-weight: 600;
  line-height: 1.25;
}

label {
  font-size: 12.5px;
  line-height: 1.3;
  font-weight: 600;
}

.entity-card h3,
.report-card h3,
.return-card h3,
.subdirectory h3 {
  font-size: 16px;
  line-height: 1.25;
  font-weight: 650;
}

@media (max-width: 760px) {
  h1 {
    font-size: 22px;
    line-height: 1.2;
  }

  .nav-button {
    font-size: 12.5px;
    font-weight: 600;
  }
}
