:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --bg: #f1f4f6;
  --panel: #ffffff;
  --panel-soft: #f5f8fb;
  --text: #172033;
  --muted: #667085;
  --line: #d7dee8;
  --soft-line: #edf1f5;
  --blue: #2457c5;
  --blue-soft: #e8f0ff;
  --green: #078260;
  --green-soft: #e4f5ec;
  --red: #c43f31;
  --red-soft: #fff0ec;
  --amber: #a76b13;
  --amber-soft: #fff5da;
  --navy: #142033;
  --navy-2: #1c2c45;
  --shadow: 0 18px 42px rgba(23, 32, 51, 0.12);
  --shadow-soft: 0 8px 20px rgba(23, 32, 51, 0.07);
  --work-panel-height: 660px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(36, 87, 197, 0.12) 0, rgba(7, 130, 96, 0.08) 34%, rgba(244, 241, 234, 0.95) 100%),
    linear-gradient(180deg, #eef4ff 0, #f4f6f2 360px, #f2eee6 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(20, 32, 51, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 32, 51, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, #000 0, transparent 72%);
}

body.login-required .filters,
body.login-required main {
  display: none;
}

body.login-required #closeAuthModalBtn {
  display: none;
}

button,
input,
select {
  font: inherit;
}

input[type="hidden"] {
  display: none;
}

.account-filter-select {
  display: none;
}

button {
  height: 32px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 650;
  box-shadow: 0 7px 16px rgba(29, 95, 209, 0.14);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
}

button.ghost {
  background: #fff;
  color: var(--blue);
  box-shadow: none;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

button.compact {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.button-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

button.danger-text {
  border-color: #f1c6bc;
  color: var(--red);
  background: #fff;
}

.danger-note {
  margin: 0;
  border: 1px solid #f1c6bc;
  border-radius: 7px;
  background: var(--red-soft);
  color: var(--red);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
}

input,
select {
  width: 100%;
  min-width: 0;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
  color: var(--text);
  padding: 0 10px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus {
  border-color: #8db8ff;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.account-picker {
  position: relative;
}

.account-picker input {
  padding-right: 32px;
}

.account-picker-toggle {
  position: absolute;
  top: 4px;
  right: 6px;
  z-index: 2;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #667085;
  padding: 0;
  box-shadow: none;
  font-size: 15px;
  line-height: 1;
  font-size: 14px;
}

.account-picker-toggle:hover {
  background: #eef3f8;
  color: var(--text);
  filter: none;
  transform: none;
}

.account-picker-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 80;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  padding: 4px;
}

.account-picker-dropdown button {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  padding: 0 8px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  box-shadow: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-picker-dropdown button.selected {
  color: var(--blue);
  font-weight: 700;
}

.account-picker-dropdown button span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-check {
  width: 14px;
  flex: 0 0 14px;
  color: var(--blue);
  text-align: center;
  font-weight: 800;
}

.account-picker-dropdown button:hover {
  background: var(--blue-soft);
  filter: none;
  transform: none;
}

.account-picker-empty {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

select.scrollable-account-select {
  overflow-y: auto;
}

select.scrollable-account-select[size]:not([size="1"]) {
  height: auto;
  max-height: 238px;
  position: relative;
  z-index: 5;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  font-size: 15px;
  letter-spacing: 0;
}

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

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 2vw, 24px) 30px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(36, 87, 197, 0.36), rgba(7, 130, 96, 0.18)),
    linear-gradient(180deg, var(--navy-2), var(--navy));
  padding: 14px 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.topbar h1 {
  color: #fff;
}

#subtitle {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.toolbar,
.panel-title,
.panel-actions,
.actions,
.list-actions,
.budget-head,
.budget-foot {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar,
.actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar {
  gap: 6px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.78);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

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

.nav-link.active {
  border-color: rgba(255, 255, 255, 0.72);
  background: #fff;
  color: var(--navy);
}

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

.filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.filters label,
.entry-form label,
.transaction-filters label,
.modal-fields label {
  color: #5c6678;
}

.main-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.section-stack {
  display: grid;
  min-width: 0;
  gap: 16px;
}

.left-stack {
  align-content: start;
  grid-template-rows: var(--work-panel-height) var(--work-panel-height);
  overflow: visible;
}

.right-stack {
  align-content: start;
  grid-template-rows: var(--work-panel-height) var(--work-panel-height);
}

.left-top-group {
  grid-template-rows: 240px minmax(0, 1fr);
  height: 100%;
  overflow: visible;
}

.left-stack > .panel,
.left-top-group > .panel,
.right-stack > .panel {
  min-height: 0;
  height: 100%;
}

.single-page {
  grid-template-columns: 1fr;
}

.summary-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.account-overview-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  align-items: stretch;
  gap: 16px;
}

.account-page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid #dde5ef;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.account-page-search {
  width: min(320px, 100%);
  height: 32px;
  flex: 1 1 260px;
}

.metric,
.panel {
  border: 1px solid #dde5ef;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  padding: 14px 16px 14px 18px;
  border-color: #dce5ef;
  background: linear-gradient(180deg, #ffffff 0, #f7fafc 100%);
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  height: auto;
  background: var(--blue);
}

.metric:nth-child(1)::before {
  background: var(--green);
}

.metric:nth-child(1) {
  background: linear-gradient(135deg, #ffffff 0, var(--green-soft) 150%);
}

.metric:nth-child(2)::before {
  background: var(--red);
}

.metric:nth-child(2) {
  background: linear-gradient(135deg, #ffffff 0, var(--red-soft) 150%);
}

.metric:nth-child(3)::before {
  background: var(--amber);
}

.metric:nth-child(3) {
  background: linear-gradient(135deg, #ffffff 0, var(--amber-soft) 150%);
}

.metric:nth-child(4)::before {
  background: var(--blue);
}

.metric:nth-child(4) {
  background: linear-gradient(135deg, #ffffff 0, var(--blue-soft) 150%);
}

.metric span,
.metric small,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.metric span {
  font-size: 14px;
  font-weight: 750;
  color: #26354d;
}

.metric strong {
  display: block;
  margin: 8px 0 4px;
  font-size: clamp(19px, 1.55vw, 25px);
  line-height: 1.1;
}

.panel {
  position: relative;
  overflow: hidden;
  padding: 14px;
  background: #fff;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--blue), rgba(7, 130, 96, 0.72));
}

.panel-title {
  justify-content: space-between;
  margin-bottom: 12px;
  min-height: 26px;
  padding-top: 2px;
}

.panel-title h2 {
  color: #172033;
  font-size: 16px;
  font-weight: 750;
}

.wide-panel {
  min-width: 0;
}

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

.entry-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  z-index: 20;
  overflow: visible;
}

.entry-panel .account-picker-dropdown {
  z-index: 200;
  max-height: 428px;
  overflow-y: auto;
}

.entry-panel .entry-form {
  align-content: start;
}

.entry-panel .panel-title h2 {
  font-size: 13px;
}

.entry-panel .panel-actions button {
  font-size: 11px;
}

.entry-form label {
  font-size: 11px;
}

.entry-form input,
.entry-form select {
  height: 32px;
  font-size: 11px;
}

.entry-form input::placeholder {
  font-size: 11px;
}

.entry-form .account-picker-toggle {
  font-size: 10px;
}

.entry-form .account-picker-dropdown button,
.entry-form .account-picker-empty {
  font-size: 11px;
}

.entry-form button[type="submit"] {
  align-self: start;
  margin-top: 22px;
  font-size: 12px;
}

.wide {
  grid-column: span 2;
}

.transactions-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.transactions-panel .table-wrap {
  min-height: 0;
}

.transactions-panel table {
  min-width: 780px;
  table-layout: fixed;
}

.transactions-panel th,
.transactions-panel td {
  padding: 8px 6px;
}

.transactions-panel .date-col {
  width: 88px;
}

.transactions-panel .category-col {
  width: 98px;
}

.transactions-panel .account-col {
  width: 118px;
}

.transactions-panel .operator-col {
  width: 68px;
}

.transactions-panel .counterparty-col {
  width: 104px;
}

.transactions-panel .note-col {
  width: 108px;
}

.transactions-panel .amount-col,
.transactions-panel .balance-col {
  width: 88px;
}

.transactions-panel .action-col {
  width: 56px;
}

.transactions-panel .account-cell {
  min-width: 0;
}

.expense-panel::before {
  background: linear-gradient(90deg, var(--red), rgba(196, 63, 49, 0.18));
}

.income-panel::before {
  background: linear-gradient(90deg, var(--green), rgba(7, 130, 96, 0.18));
}

.entry-panel::before {
  background: linear-gradient(90deg, var(--blue), rgba(36, 87, 197, 0.18));
}

.chart-list {
  min-height: 0;
  overflow: auto;
}

.chart-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 8px 10px;
}

.chart-panel .panel-title {
  min-height: 20px;
  margin-bottom: 4px;
  padding-top: 0;
}

.chart-panel .panel-title h2,
.chart-panel .muted {
  font-size: 11px;
}

.chart-panel .chart-list {
  gap: 0;
}

.transaction-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(104px, 1fr)) 58px 58px minmax(150px, 0.9fr);
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fafc 0, #f1f5f9 100%);
  padding: 10px;
}

.transaction-filters button {
  height: 32px;
  min-width: 0;
  padding: 0 8px;
}

.filter-summary {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fff;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.filter-summary.income {
  color: var(--green);
}

.filter-summary.expense {
  color: var(--red);
}

.table-wrap {
  overflow: auto;
  border: 1px solid #dfe6ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 30px;
  margin-top: 10px;
}

.pagination span {
  color: var(--muted);
  font-size: 12px;
}

.pagination .active-page {
  background: var(--blue);
  color: #fff;
}

.pagination button {
  min-width: 30px;
}

table {
  width: 100%;
  min-width: 1140px;
  border-collapse: collapse;
  font-size: 12px;
}

.date-col {
  width: 104px;
}

.type-col {
  width: 78px;
}

.category-col {
  width: 120px;
}

.account-col {
  width: 220px;
}

.operator-col {
  width: 96px;
}

.counterparty-col {
  width: 140px;
}

.note-col {
  width: 180px;
}

.amount-col {
  width: 126px;
}

.balance-col {
  width: 126px;
}

.action-col {
  width: 76px;
}

th,
td {
  height: 38px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
  vertical-align: middle;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #eaf0f7;
  color: #2c3a4f;
  font-size: 12px;
  z-index: 1;
  font-weight: 700;
}

tbody tr:nth-child(even):not(.blank-row) {
  background: #f9fbfd;
}

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

.num {
  text-align: right;
  white-space: nowrap;
}

.account-cell {
  min-width: 200px;
  white-space: nowrap;
}

.action-cell {
  text-align: center;
  white-space: nowrap;
}

tbody tr:hover:not(.blank-row) {
  background: #edf5ff;
}

.blank-row td {
  height: 38px;
  color: transparent;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.income-color {
  color: var(--green);
}

.expense-color {
  color: var(--red);
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  border: 1px solid transparent;
}

.pill.income {
  background: var(--green-soft);
  color: var(--green);
  border-color: rgba(7, 130, 96, 0.2);
}

.pill.expense {
  background: var(--red-soft);
  color: var(--red);
  border-color: rgba(196, 63, 49, 0.2);
}

.stack-list,
.budget-list,
.chart-list,
.log-list {
  display: grid;
  gap: 10px;
}

.list-item,
.budget-item {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff 0, #fbfcfe 100%);
}

.list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(28, 39, 58, 0.06);
}

.list-item:hover {
  border-color: #cbd7e6;
  box-shadow: 0 12px 28px rgba(28, 39, 58, 0.09);
}

.account-fields {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.account-fields div {
  min-width: 0;
  border-radius: 7px;
  background: #f8fafc;
  padding: 7px 8px;
}

.account-fields span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.account-fields strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.list-item strong,
.list-item span {
  display: block;
}

.list-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.list-actions b {
  white-space: nowrap;
}

.list-actions {
  align-self: stretch;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
}

.list-actions button {
  width: 58px;
}

.budget-head {
  justify-content: space-between;
  margin-bottom: 0;
}

.budget-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-scroll-list {
  grid-template-columns: 1fr;
  grid-auto-rows: minmax(34px, 1fr);
  gap: 6px;
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding-right: 2px;
}

.category-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  z-index: 1;
}

.category-scroll-list .budget-item {
  min-width: 0;
  min-height: 0;
  padding: 6px;
  font-size: 12px;
}

.category-scroll-list .budget-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
}

.category-scroll-list .budget-item:not(.blank-category-item):hover {
  border-color: #cbd7e6;
  background: #f8fbff;
}

.category-scroll-list .pill,
.category-scroll-list button.compact {
  height: 20px;
  font-size: 11px;
}

.category-scroll-list button.compact {
  width: 44px;
  padding: 0 6px;
}

.blank-category-item {
  color: transparent;
  background: #fbfcfe;
}

.budget-foot {
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.chart-row {
  display: grid;
  grid-template-columns: 78px 1fr 100px;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  min-height: 16px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.chart-row div {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.chart-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.chart-row.expense i {
  background: var(--red);
}

.chart-row b {
  text-align: right;
  font-weight: 700;
}

.chart-row.income b {
  color: var(--green);
}

.chart-row.expense b {
  color: var(--red);
}

.empty {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 24px 0;
  color: var(--muted);
  text-align: center;
}

.log-list {
  max-height: 360px;
  overflow: auto;
  padding-right: 2px;
}

.log-page-list {
  max-height: calc(100vh - 190px);
  min-height: 420px;
}

.account-page-list {
  grid-template-columns: 1fr;
  gap: 0;
}

.account-list-panel {
  overflow: visible;
}

.account-list-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 52px minmax(150px, 1.2fr) minmax(130px, 1fr) minmax(150px, 1fr) minmax(120px, 0.9fr) 110px minmax(120px, 0.9fr) 104px;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--line);
  background: #eef4fb;
  color: #26354d;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 750;
}

.account-page-list .list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  align-items: center;
  gap: 10px;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  border-radius: 0;
  padding: 9px 10px;
  box-shadow: none;
}

.account-page-list .list-item:last-child {
  border-bottom-right-radius: 8px;
  border-bottom-left-radius: 8px;
}

.account-page-list .account-fields {
  display: grid;
  grid-template-columns: 52px minmax(150px, 1.2fr) minmax(130px, 1fr) minmax(150px, 1fr) minmax(120px, 0.9fr) 110px minmax(120px, 0.9fr);
  gap: 10px;
  align-items: center;
}

.account-page-list .account-fields strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.account-page-list .list-actions {
  align-self: center;
  flex-direction: row;
  gap: 6px;
}

.account-page-list .list-actions button {
  width: 46px;
}

.log-item {
  display: grid;
  grid-template-columns: 168px 96px 110px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0, #fbfcfe 100%);
  padding: 9px 11px;
  font-size: 12px;
}

.log-item:hover {
  border-color: #cbd7e6;
  background: #f8fbff;
}

.log-item time {
  color: var(--muted);
  font-size: 11px;
}

.log-item strong {
  color: #22304a;
  font-size: 12px;
}

.log-item b {
  min-width: 0;
  color: var(--blue);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.log-item span {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
}

.modal[hidden],
.toast[hidden] {
  display: none;
}

.modal-card {
  width: min(480px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.modal-fields {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-fields input,
.modal-fields select {
  height: 34px;
}

.modal-fields input[type="file"] {
  height: auto;
  padding: 6px 10px;
}

.invoice-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcfe;
  padding: 8px 10px;
  font-size: 12px;
}

.invoice-field span {
  color: var(--muted);
  font-weight: 700;
}

.invoice-field em {
  color: var(--muted);
  font-style: normal;
}

.invoice-link {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.inline-check input {
  width: auto;
  height: auto;
}

.modal-actions {
  display: flex;
  justify-content: flex-start;
  padding-top: 4px;
}

.confirm-card {
  display: grid;
  gap: 12px;
}

.confirm-card p {
  color: var(--muted);
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 36px));
  border-radius: 8px;
  background: #172033;
  color: #fff;
  padding: 11px 14px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.25);
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 260px;
}

.auth-user {
  display: grid;
  gap: 2px;
  min-width: 96px;
  color: #fff;
  text-align: right;
}

.auth-user strong {
  font-size: 13px;
}

.auth-user span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
}

.readonly-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.82);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 650;
}

.readonly-mode .requires-write,
.readonly-mode .entry-form button[type="submit"] {
  opacity: 0.48;
}

.auth-card {
  width: min(420px, calc(100vw - 28px));
  border: 1px solid rgba(36, 87, 197, 0.16);
  padding: 20px;
}

.auth-card .panel-title {
  margin-bottom: 14px;
}

.auth-card .panel-title h2 {
  font-size: 20px;
}

.auth-card .modal-fields {
  gap: 12px;
}

.auth-card .modal-fields label {
  gap: 7px;
  color: #475467;
  font-size: 12px;
}

.auth-card .modal-fields input {
  height: 38px;
  border-radius: 8px;
  background: #fff;
}

.auth-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.auth-actions #authSubmitBtn {
  height: 36px;
  border-radius: 8px;
}

.auth-switch-btn {
  width: auto;
  min-width: 88px;
  height: 36px;
  border-color: transparent;
  background: transparent;
  padding: 0 6px;
  box-shadow: none;
}

.user-review-list {
  display: grid;
  gap: 8px;
  max-height: min(520px, 68vh);
  overflow: auto;
  padding-right: 2px;
}

.user-review-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(320px, auto);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 10px;
}

.user-review-item strong,
.user-review-item span {
  display: block;
}

.user-review-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.user-review-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

@media (max-width: 1080px) {
  .filters,
  .summary-grid,
  .transaction-filters {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .left-stack,
  .right-stack {
    grid-template-rows: auto;
  }

  .left-top-group,
  .left-stack > .panel,
  .left-top-group > .panel,
  .right-stack > .panel {
    height: auto;
  }

  .account-page-list {
    grid-template-columns: 1fr;
  }

  .account-overview-row {
    grid-template-columns: 1fr;
  }

  .account-page-actions {
    justify-content: flex-start;
  }

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

  .toolbar,
  .auth-panel {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .topbar {
    display: grid;
  }

  .toolbar button,
  .toolbar .nav-link,
  .filters,
  .summary-grid,
  .entry-form,
  .transaction-filters {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .panel-title,
  .panel-actions {
    align-items: stretch;
    justify-content: stretch;
  }

  .toolbar .nav-link,
  .toolbar button,
  .panel-actions button,
  .account-page-actions button,
  .auth-panel button {
    width: 100%;
  }

  .auth-panel {
    display: grid;
    min-width: 0;
  }

  .filters,
  .summary-grid {
    display: grid;
  }

  .wide {
    grid-column: auto;
  }

  .list-item {
    align-items: flex-start;
    display: grid;
  }

  .list-actions {
    flex-direction: row;
  }

  .account-fields {
    grid-template-columns: 1fr;
  }

  .account-page-list .list-item {
    grid-template-columns: 1fr;
  }

  .account-list-header {
    display: none;
  }

  .account-page-list .account-fields {
    grid-template-columns: 1fr;
  }

  .account-page-list .account-fields strong::before {
    content: attr(data-label);
    display: inline-block;
    width: 64px;
    margin-right: 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }

  .auth-switch-btn {
    width: 100%;
  }

  .chart-row {
    grid-template-columns: 76px 1fr;
  }

  .chart-row b {
    grid-column: 2;
    text-align: left;
  }

  .log-item {
    grid-template-columns: 1fr;
  }

  .user-review-item {
    grid-template-columns: 1fr;
  }

  .user-review-actions {
    justify-content: flex-start;
  }

  .log-item span {
    white-space: normal;
  }
}
