@font-face {
  font-family: "Manrope";
  src: url("../assets/type/Manrope-VariableFont_wght.ttf") format("truetype");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Onest";
  src: url("../assets/type/Onest-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --blue: #2253f4;
  --green: #18d62b;
  --bad: #ff5a7a;
  --ink: #1d2028;
  --muted: #6e6f75;
  --line: rgba(29, 32, 40, .12);
  --soft: #f6f6f4;
  --paper: #ffffff;
  --buff: #f4f2ed;
  --font-ui: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-title: "Onest", var(--font-ui);
}

* { box-sizing: border-box; }

html {
  width: 100%;
  min-height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 300;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  border-radius: 0;
  overflow: visible;
  background: var(--paper);
  box-shadow: none;
}

.carbon-header {
  min-height: 128px;
  padding: 22px 24px 0;
  background: var(--blue);
  color: white;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
  border-radius: 0;
}

.header-brand {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 26px;
}

.brandmark {
  width: min(220px, 32vw);
  max-height: 64px;
  align-self: center;
  object-fit: contain;
  object-position: left center;
}

.studio-mark {
  width: min(110px, 16vw);
  max-height: 54px;
  object-fit: contain;
  object-position: right top;
}

.toolbar {
  display: flex;
  gap: 14px;
  align-items: end;
  padding: 14px 0 18px;
  overflow-x: auto;
  border-top: 1px solid rgba(255, 255, 255, .14);
  scrollbar-width: none;
}

.toolbar::-webkit-scrollbar { display: none; }

.tool-btn {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .82);
  min-width: 68px;
  padding: 8px 10px;
  display: grid;
  justify-items: center;
  gap: 6px;
  border-radius: 14px;
}

.tool-btn.is-active {
  color: white;
  background: rgba(255, 255, 255, .09);
}

.tool-btn .icon,
.tool-btn svg {
  width: 24px;
  height: 24px;
  display: block;
  fill: currentColor;
}

.tool-btn span:last-child {
  font-size: .82rem;
  white-space: nowrap;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.app-main {
  padding: 42px;
}

.view {
  display: none;
}

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

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 28px;
  position: sticky;
  top: 128px;
  z-index: 12;
  padding: 16px 0 14px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
}

.page-title.compact {
  align-items: start;
  display: block;
}

.page-title p,
.kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 1rem;
}

h1,
h2 {
  font-family: var(--font-title);
  letter-spacing: 0;
  font-weight: 400;
letter-spacing: -0.025em;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 3.1vw, 3.3rem);
  line-height: 1;
  font-weight: 400;
}

h2 {
  margin: 0;
  font-size: clamp(1.2rem, 1.55vw, 1.65rem);
  line-height: 1.08;
  font-weight: 400;
color:var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.metric-card,
.panel {
  background: rgba(247, 247, 245, .82);
  border: none !impoprtant;
  border-radius: 16px;
}

.metric-card {
  min-height: 132px;
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 7px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-size: .98rem;
}

.metric-card strong {
  color: var(--blue);
  font-size: clamp(1.8rem, 2.7vw, 2.7rem);
  line-height: .95;
  letter-spacing: -0.025em;
}

.dashboard-grid,
.tax-grid,
.receipt-grid,
.entry-layout {
  display: grid;
  gap: 22px;
}

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

.dashboard-grid .tax-panel {
  grid-column: span 3;
}

.dashboard-grid [data-dashboard-card="checklist"] {
  grid-column: span 1;
}

.tax-grid,
.receipt-grid,
.entry-layout {
  grid-template-columns: minmax(300px, .85fr) minmax(0, 1.5fr);
}

.panel {
  padding: 30px;
}

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

.donut-wrap {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  margin-top: 28px;
}

.dashboard-donut-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.mini-donut-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  justify-items: center;
  text-align: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .64);
}

.donut {
  width: 240px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: conic-gradient(var(--blue) calc(var(--pct) * 1%), #e4e5e7 0);
  position: relative;
}

.mini-donut-card .donut {
  width: 205px;
}

.split-donut {
  background: conic-gradient(var(--green) calc(var(--income) * 1%), var(--bad) 0);
}

.reserve-donut {
  background: conic-gradient(var(--green) calc(var(--pct) * 1%), #e4e5e7 0);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 34px;
  border-radius: inherit;
  background: var(--paper);
}

.mini-donut-card .donut::after {
  inset: 32px;
}

.donut span,
.donut small {
  position: relative;
  z-index: 1;
  display: block;
  text-align: center;
}

.donut span {
  color: var(--blue);
  font-size: 2.9rem;
  font-weight: 640;
  line-height: .9;
}

.mini-donut-card .donut span {
  font-size: 2.24rem;
}

.donut small {
  margin-top: 7px;
  color: var(--muted);
  font-size: .8rem;
}

.tax-copy p,
.quiet,
.modal-note {
  color: var(--muted);
  line-height: 1.45;
}

.tax-copy h3,
.settings-section h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
  font-weight: 570;
}

.overview-feed-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.compact-panel {
  min-height: 248px;
  padding: 22px;
}

.compact-panel .panel-head {
  margin-bottom: 14px;
}

.compact-panel h2 {
  font-size: 1.18rem;
}

[data-dashboard-card] {
  cursor: grab;
}

[data-dashboard-card]:active {
  cursor: grabbing;
}

[data-dashboard-card].is-dragging {
  opacity: .48;
  transform: scale(.99);
}

[data-dashboard-card].is-drop-target {
  outline: 2px solid rgba(34, 83, 244, .35);
  outline-offset: 4px;
}

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

.compact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 50px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.compact-row:last-child {
  border-bottom: 0;
}

.compact-row > div {
  min-width: 0;
}

.compact-row strong {
  font-size: .98rem;
  font-weight: 620;
}

.compact-row small {
  color: var(--muted);
  font-size: .86rem;
}

.compact-row em {
  color: var(--blue);
  font-style: normal;
  font-weight: 650;
  white-space: nowrap;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.compact-row.action-note {
  grid-template-columns: 1fr;
  align-items: start;
  gap: 6px;
  padding: 14px 0;
}

.compact-row.action-note em {
  justify-self: stretch;
  white-space: normal;
  color: var(--ink);
  font-size: .96rem;
  font-weight: 380;
  line-height: 1.42;
  letter-spacing: -.01em;
}

.cashflow-bars {
  display: grid;
  gap: 12px;
}

.cash-bar {
  display: grid;
  gap: 8px;
}

.cash-bar span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  min-width: 0;
}

.cash-bar span em {
  white-space: nowrap;
}

.cash-bar i {
  display: block;
  height: 14px;
  border-radius: 999px;
  background: #e4e5e7;
  overflow: hidden;
}

.cash-bar i::before {
  content: "";
  display: block;
  height: 100%;
  width: calc(var(--pct) * 1%);
  background: var(--green);
}

.cash-bar.out i::before {
  background: var(--bad);
}

.pill-btn,
.primary-btn,
.icon-btn,
.status-pill {
  border-radius: 999px;
  min-height: 48px;
  padding: 10px 22px;
  border: 1px solid rgba(34, 83, 244, .35);
  background: transparent;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary-btn {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.primary-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.primary-btn.mini {
  min-height: 42px;
  padding: 8px 16px;
  font-size: .95rem;
}

.status-pill {
  min-height: 38px;
  color: var(--muted);
  border-color: var(--line);
}

.status-pill.mini {
  min-height: 34px;
  padding: 5px 11px;
  font-size: .84rem;
}

.checklist {
  display: grid;
  gap: 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.checklist li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 1.05rem;
}

.checklist span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
}

.entry-form {
  display: grid;
  gap: 16px;
  align-content: start;
}

label {
  display: grid;
  gap: 8px;
  color: #a8aec7;
}

input,
select,
textarea {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 16px;
  color: var(--ink);
  background: var(--paper);
  outline: none;
  font-weight: 300;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(34, 83, 244, .55);
}

.records-list,
.receipt-list,
.breakdown-list,
.status-stack {
  display: grid;
  gap: 12px;
}

.record-row,
.receipt-row,
.breakdown-row,
.status-stack div {
  min-height: 58px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

button.record-row {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.record-row.is-selected {
  border-color: rgba(34, 83, 244, .48);
  box-shadow: inset 0 0 0 1px rgba(34, 83, 244, .22);
}

.invoice-row {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.fy-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 14px;
}

.fy-pill {
  appearance: none;
  border: 1px solid var(--input);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .95rem;
  padding: 8px 14px;
  cursor: pointer;
}

.fy-pill.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--paper);
}

.invoice-row.needs-chase {
  border-color: rgba(255, 90, 122, .42);
  background: rgba(255, 90, 122, .045);
}

.invoice-state {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .88rem;
  white-space: nowrap;
}

.invoice-state.good {
  color: var(--green);
  border-color: rgba(24, 214, 43, .35);
}

.invoice-state.warn {
  color: #d08b00;
  border-color: rgba(208, 139, 0, .32);
}

.invoice-state.bad {
  color: var(--bad);
  border-color: rgba(255, 90, 122, .38);
}

input[type="file"]::file-selector-button {
  border: 1px solid rgba(34, 83, 244, .35);
  border-radius: 999px;
  background: transparent;
  color: var(--blue);
  font: inherit;
  padding: 8px 14px;
  margin-right: 12px;
  cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
  border: 1px solid rgba(34, 83, 244, .35);
  border-radius: 999px;
  background: transparent;
  color: var(--blue);
  font: inherit;
  padding: 8px 14px;
  margin-right: 12px;
  cursor: pointer;
}

.invoice-money {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.invoice-money small {
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
}

.record-row strong,
.receipt-row strong,
.breakdown-row strong,
.status-stack strong {
  font-weight: 560;
}

.record-row small,
.receipt-row small,
.breakdown-row small,
.status-stack span {
  color: var(--muted);
}

.income-amount { color: var(--green); }
.expense-amount,
.bad-amount { color: var(--bad); }
.tax-amount { color: var(--blue); }

.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: end;
}

.pill-btn.mini {
  min-height: 36px;
  padding: 6px 14px;
  font-size: .9rem;
}

.capture-card {
  text-align: center;
  display: grid;
  place-items: center;
  gap: 18px;
}

.capture-icon {
  width: 94px;
  height: 94px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: rgba(34, 83, 244, .08);
  color: var(--blue);
}

.capture-icon svg {
  width: 44px;
  fill: currentColor;
}

.receipt-actions,
.bank-actions,
.bank-sidebar-actions,
.modal-actions,
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 3rem;
}

.bank-actions {
  align-items: end;
  justify-content: start;
  margin-top: 18px;
}

.bank-sidebar-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.inline-filter {
  min-width: min(260px, 100%);
}

.banking-layout {
  display: grid;
  grid-template-columns: minmax(360px, .48fr) minmax(0, 1.52fr);
  gap: 22px;
  align-items: start;
}

.bank-accounts-panel,
.bank-statement-panel {
  min-width: 0;
}

.statement-controls,
.statement-search {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.statement-controls {
  justify-content: flex-end;
}

.round-add-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border: 1px solid var(--blue);
  border-radius: 999px;
  background: var(--blue);
  color: white;
  display: inline-grid;
  place-items: center;
  font-size: 1.12rem;
  line-height: 1;
  font-weight: 360;
  padding: 0;
  translate: 0 0;
}

.panel-actions .round-add-btn,
.panel-head .round-add-btn {
  align-self: center;
}

.statement-tabs {
  display: flex;
  gap: 24px;
  align-items: center;
  margin: -4px -30px 18px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.statement-tab {
  min-height: 48px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 520;
  padding: 0 0 12px;
  white-space: nowrap;
}

.statement-tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--blue);
}

.statement-search {
  margin: 16px 0 8px;
  justify-content: space-between;
}

.statement-search label {
  width: min(560px, 100%);
}

.statement-flow-summary {
  display: grid;
  grid-template-columns: 44px auto auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
}

.statement-flow-summary span:not(.statement-flow-donut) {
  display: grid;
  gap: 1px;
  min-width: 94px;
}

.statement-flow-summary strong {
  color: var(--blue);
  font-weight: 520;
}

.statement-flow-summary small {
  color: var(--muted);
  font-size: .72rem;
}

.account-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin: 22px 0 16px;
}

.bank-accounts-panel {
  padding: 24px;
}

.bank-accounts-panel .panel-head {
  align-items: flex-start;
  margin-bottom: 14px;
}

.bank-accounts-panel .status-pill {
  font-size: .9rem;
  white-space: nowrap;
}

.bank-accounts-panel .quiet {
  font-size: .96rem;
  line-height: 1.48;
}

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

.bank-accounts-panel .bank-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.bank-accounts-panel .bank-actions .primary-btn {
  grid-column: 1 / -1;
  width: fit-content;
  opacity: .55;
}

.bank-accounts-panel .account-form .primary-btn {
  grid-column: 1 / -1;
  width: fit-content;
}

.account-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.account-card,
.contact-card,
.client-preview {
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .72);
  display: grid;
  gap: 4px;
}

.bank-account-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  min-height: 168px;
  padding: 18px;
  border-radius: 22px;
  background:var(--buff);
}

.bank-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.bank-head-actions .round-add-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  font-size: 1.08rem;
}

.bank-account-card span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.bank-account-card .bank-card-top strong {
  color: var(--blue);
}

.bank-account-card.is-selected {
  border: 2px solid var(--blue);
}

.bank-card-top {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.bank-card-flow {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  margin-top: 12px;
  color: var(--muted);
  font-size: .9rem;
}

.bank-card-identity {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.bank-logo-wrap {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
}

.bank-logo-wrap img {
  width: 76%;
  height: 76%;
  object-fit: contain;
}

.bank-card-balance {
  align-self: start;
  color: var(--blue);
  font-size: clamp(1.05rem, 1.35vw, 1.35rem);
  font-weight: 520;
  text-align: right;
  white-space: nowrap;
}

.mini-flow-donut,
.statement-flow-donut {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: conic-gradient(var(--green) calc(var(--pct) * 1%), var(--bad) 0);
  -webkit-mask: radial-gradient(circle at center, transparent 48%, #000 50%);
  mask: radial-gradient(circle at center, transparent 48%, #000 50%);
}

.statement-flow-donut {
  width: 44px;
  height: 44px;
}

.bank-card-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
  margin-top: 8px;
  color: var(--muted);
}

.bank-card-details small {
  display: grid;
  gap: 1px;
  min-width: 0;
  font-size: .75rem;
}

.bank-card-details strong {
  color: var(--ink);
  font-weight: 460;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manual-transaction-form {
  display: grid;
  grid-template-columns: minmax(130px, .9fr) minmax(128px, .75fr) minmax(220px, 1.35fr) minmax(110px, .65fr) minmax(110px, .65fr) auto auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  margin: 0 0 14px;
  border: 1px solid rgba(29, 32, 40, .08);
  border-radius: 18px;
  background: rgba(246, 246, 244, .58);
}

.manual-transaction-form label {
  min-width: 0;
}

.evidence-picker {
  align-self: end;
  justify-content: center;
}

.statement-table {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: white;
}

.statement-row {
  display: grid;
  grid-template-columns: 42px 82px minmax(250px, 1.65fr) minmax(160px, .85fr) minmax(96px, .5fr) 132px;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.statement-row:last-child {
  border-bottom: 0;
}

.statement-head {
  background: rgba(246, 246, 244, .86);
  color: var(--muted);
  font-weight: 560;
  min-height: 48px;
}

.statement-row.needs-review {
  background: rgba(255, 255, 255, .88);
}

.statement-row.for-approval {
  background: rgba(34, 83, 244, .035);
}

.statement-row.is-posted {
  background: rgba(246, 246, 244, .52);
}

.statement-status {
  width: max-content;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: .78rem;
  font-weight: 560;
}

.statement-status.good {
  color: #39862d;
  border-color: rgba(57, 134, 45, .28);
  background: rgba(57, 134, 45, .08);
}

.statement-status.warn {
  color: var(--bad);
  border-color: rgba(255, 90, 122, .28);
  background: rgba(255, 90, 122, .06);
}

.statement-status.info {
  color: var(--blue);
  border-color: rgba(34, 83, 244, .3);
  background: rgba(34, 83, 244, .07);
}

.statement-post-cell,
.statement-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.statement-icon-btn,
.statement-icon-static {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  padding: 0;
}

.statement-icon-btn {
  cursor: pointer;
}

.statement-icon-btn:hover {
  background: rgba(34, 83, 244, .07);
}

.statement-icon-btn svg,
.statement-icon-static svg {
  width: 20px;
  height: 20px;
}

.statement-date {
  color: var(--ink);
  font-size: .94rem;
  font-weight: 420;
}

.statement-desc {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.statement-desc strong {
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statement-desc small {
  color: var(--muted);
}

.statement-desc .evidence-note {
  color: var(--blue);
}

.statement-category {
  color: var(--muted);
  font-size: .9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statement-cell-input {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .72);
}

.statement-row select {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
}

.money-in,
.statement-value.income-amount {
  color: var(--green);
  font-weight: 560;
  text-align: right;
}

.money-out,
.statement-value.expense-amount {
  color: var(--bad);
  font-weight: 560;
  text-align: right;
}

.statement-value {
  white-space: nowrap;
}

.pill-btn.danger {
  color: var(--bad);
  border-color: rgba(255, 90, 122, .38);
  background: rgba(255, 90, 122, .06);
}

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

.client-preview {
  min-height: 96px;
  align-content: center;
}

.client-preview span,
.client-preview small,
.contact-card small,
.contact-card p {
  color: var(--muted);
}

.contact-card p {
  margin: 0;
  line-height: 1.35;
}

.contact-card .row-actions {
  margin-top: 8px;
}

.account-card strong,
.contact-card strong,
.client-preview strong {
  font-weight: 560;
}

.account-card small {
  color: var(--muted);
}

.account-card:not(.bank-account-card) span {
  color: var(--blue);
  font-size: 1.45rem;
  font-weight: 650;
}

.invoice-workspace {
  display: grid;
  grid-template-columns: minmax(300px, .62fr) minmax(520px, 1fr);
  gap: 22px;
  align-items: start;
}

.invoice-workspace-list {
  grid-template-columns: minmax(0, 1fr);
}

.invoice-workspace .table-panel {
  grid-column: 1 / -1;
}

.invoice-live-panel {
  min-height: 680px;
}

.invoice-pipeline-panel {
  min-height: 560px;
}

.inline-preview {
  max-height: 690px;
  padding: 14px;
}

.inline-preview .invoice-doc {
  transform-origin: top center;
}

.mobile-copy,
.mobile-capture {
  display: none;
}

.settings-modal,
.invoice-modal {
  border: 0;
  background: transparent;
  padding: 0;
  width: min(1180px, calc(100% - 28px));
  overflow: visible;
}

.settings-modal::backdrop,
.invoice-modal::backdrop {
  background: rgba(229, 232, 236, .78);
  backdrop-filter: blur(10px);
}

.settings-card,
.invoice-modal-card {
  background: var(--paper);
  border-radius: 28px;
  padding: 32px;
  box-shadow: 0 28px 90px rgba(20, 33, 54, .2);
}

.setup-modal .invoice-modal-card,
.item-modal-card {
  overflow: visible;
}

.compact-modal-card {
  max-width: 760px;
  margin: auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.settings-head-actions {
  display: flex;
  align-items: start;
  gap: 14px;
}

.settings-head-actions label {
  min-width: 180px;
}

.icon-btn {
  min-width: 52px;
  padding: 0;
  font-size: 1.7rem;
height: 52px;
}

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

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

.invoice-editor-bar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin: 0 0 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(246, 246, 244, .68);
}

.invoice-status-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.invoice-status-pill {
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid var(--muted);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 460;
}

.invoice-status-pill.is-active {
  border-color: var(--green);
  color: var(--green);
}

.invoice-status-pill.is-paid {
  background: var(--green);
  color: var(--paper);
}

.add-invoice-item-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
}

.settings-section,
.settings-wide {
  grid-column: 1 / -1;
}

.settings-section {
  margin-top: 14px;
  padding: 18px 18px 16px;
  border: 1px solid rgba(29, 32, 40, .08);
  border-radius: 18px;
  background: rgba(246, 246, 244, .72);
}

.settings-section:first-child {
  margin-top: 0;
}

.settings-section small {
  display: block;
  color: var(--muted);
  line-height: 1.4;
}

.settings-section-feature {
  border-color: rgba(34, 83, 244, .18);
  background: rgba(34, 83, 244, .055);
}

.is-hidden {
  display: none !important;
}

.email-preview-card {
  width: min(960px, calc(100vw - 28px));
  margin: 0 auto;
}

.email-preview-card label {
  display: grid;
  gap: 8px;
  color: rgba(110, 111, 117, .78);
  margin-bottom: 16px;
}

.email-preview-frame {
  margin-top: 8px;
  max-height: min(54vh, 620px);
  overflow: auto;
  border-radius: 22px;
  background: #f5f7fb;
  border: 1px solid rgba(29, 32, 40, .08);
  padding: 18px;
}

.invoice-preview {
  max-height: min(68vh, 820px);
  overflow: auto;
  padding: 22px;
  border-radius: 24px;
  background: #f5f7fb;
}

@media print {
  body * {
    visibility: hidden;
  }

  .invoice-doc,
  .invoice-doc * {
    visibility: visible;
  }

  .invoice-doc {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    box-shadow: none;
  }
}

.invoice-doc {
  width: min(980px, 100%);
  margin: 0 auto;
  border: 1px solid #e6e8ef;
  border-radius: 4px;
  background: white;
  color: var(--ink);
  font-family: Helvetica, Arial, sans-serif;
  padding: 52px 50px 46px;
}

.invoice-doc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 52px;
  padding: 0;
  margin-bottom: 60px;
  background: white;
  color: #111;
}

.invoice-doc-head p {
  margin: 0 0 8px;
  color: #666;
  line-height: 1.22;
}

.invoice-company {
  width: min(360px, 50%);
  color: #666;
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  line-height: 1.22;
}

.invoice-logo-frame {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: 190px;
  min-height: 132px;
}

.invoice-logo {
  display: block;
  width: 180px;
  height: 128px;
  max-width: 180px;
  max-height: 128px;
  object-fit: contain;
  object-position: left top;
}

.invoice-logo-invert {
  filter: invert(1);
}

.invoice-doc-head strong {
  display: block;
  color: #666;
  font-size: clamp(1.1rem, 1.6vw, 1.45rem);
  margin-bottom: 2px;
}

.invoice-doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 52px;
  padding: 0;
  margin-bottom: 42px;
}

.invoice-doc-grid span,
.invoice-doc-grid p,
.invoice-doc footer {
  color: #666;
}

.invoice-client {
  color: #666;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.22;
}

.invoice-client strong {
  display: block;
  color: #666;
}

.invoice-meta {
  color: #000;
}

.invoice-meta h2 {
  margin: 0 0 18px;
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  font-weight: 600;
  line-height: 1.1;
}

.invoice-meta strong {
  display: block;
  margin-bottom: 16px;
  font-size: clamp(1.15rem, 1.8vw, 1.55rem);
  line-height: 1.1;
}

.invoice-meta p {
  margin: 0;
  color: #666;
  font-size: clamp(1rem, 1.55vw, 1.3rem);
}

.invoice-table {
  width: 100%;
  margin: 0 0 56px;
  border-collapse: collapse;
  color: #666;
  font-size: clamp(.95rem, 1.3vw, 1.15rem);
}

.invoice-table th,
.invoice-table td {
  padding: 14px 10px;
  border-bottom: 1px solid #ddd;
  text-align: left;
  vertical-align: top;
}

.invoice-table thead th {
  background: var(--invoice-accent, #ffed00);
  color: #000;
  border-bottom: 0;
}

.invoice-table th:last-child,
.invoice-table td:last-child {
  text-align: right;
}

.invoice-table th:nth-last-child(2),
.invoice-table td:nth-last-child(2) {
  text-align: right;
}

.invoice-table td:nth-last-child(-n + 2) {
  color: #666;
  font-weight: 700;
}

.invoice-table tfoot th {
  background: #f3f3f1;
  border-bottom: 0;
  color: #000;
  font-size: clamp(1.1rem, 1.7vw, 1.55rem);
  font-weight: 700;
}

.invoice-doc-note {
  margin: 0 0 58px;
  padding: 0;
  background: transparent;
  color: #666;
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  line-height: 1.35;
}

.invoice-doc-note strong {
  display: block;
  margin-bottom: 18px;
  color: #666;
  font-size: clamp(1.15rem, 1.6vw, 1.45rem);
}

.invoice-doc-note p {
  margin: 0;
  color: #666;
}

.invoice-doc footer {
  padding: 0;
  max-width: 760px;
  color: #666;
  font-size: .82rem;
  line-height: 1.45;
}

.empty {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}


@media (max-width: 1240px) {
  .dashboard-grid,
  .overview-feed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid .tax-panel,
  .dashboard-grid [data-dashboard-card="checklist"] {
    grid-column: span 1;
  }

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

  .mini-donut-card {
    grid-template-columns: 205px minmax(0, 1fr);
    justify-items: start;
    text-align: left;
  }
}

@media (max-width: 980px) {
  .app-shell {
    width: 100%;
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
  }

  .carbon-header {
    min-height: 132px;
    border-radius: 0;
  }

  .page-title {
    top: 132px;
  }

  .brandmark {
    width: min(250px, 56vw);
  }

  .app-main {
    padding: 28px 18px 44px;
  }

  .metric-grid,
  .dashboard-grid,
  .dashboard-donut-grid,
  .overview-feed-grid,
  .tax-grid,
  .receipt-grid,
  .entry-layout,
  .invoice-workspace,
  .account-form,
  .manual-transaction-form,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 128px;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .mini-donut-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .tax-copy {
    text-align: center;
  }

  .dashboard-grid .tax-panel,
  .dashboard-grid [data-dashboard-card="checklist"] {
    grid-column: auto;
  }

  .mini-donut-card .donut {
    width: 188px;
  }

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

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

  .statement-controls {
    grid-template-columns: 1fr;
  }

  .statement-row {
    grid-template-columns: 34px 116px 140px minmax(280px, 1.2fr) minmax(300px, .9fr) 112px 112px minmax(270px, auto);
  }

  .invoice-workspace .table-panel {
    grid-column: auto;
  }

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

  .desktop-copy,
  .desktop-upload {
    display: none;
  }

  .mobile-copy,
  .mobile-capture {
    display: inline-flex;
  }
}

@media (max-width: 560px) {
  .carbon-header {
    min-height: 154px;
    padding: 14px 14px 0;
  }

  .header-brand {
    gap: 14px;
  }

  .studio-mark {
    width: 86px;
  }

  .page-title {
    top: 154px;
  }

  .toolbar {
    gap: 10px;
    padding-bottom: 18px;
    scroll-snap-type: x mandatory;
  }

  .tool-btn {
    min-width: 68px;
    scroll-snap-align: start;
  }

  .panel,
  .settings-card {
    padding: 22px;
    border-radius: 22px;
  }

  .settings-head-actions {
    width: 100%;
    justify-content: space-between;
  }

  .settings-head-actions label {
    min-width: 0;
    flex: 1;
  }

  .page-title {
    align-items: start;
    display: block;
  }

  .record-row,
  .receipt-row,
  .breakdown-row,
  .invoice-row {
    grid-template-columns: 1fr;
  }

  .invoice-state {
    width: max-content;
  }

  .invoice-doc-head,
  .invoice-doc-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .invoice-doc {
    padding: 28px 22px;
  }

  .invoice-company {
    width: 100%;
  }

  .row-actions {
    justify-content: start;
  }
}



/* Ldgr Phase 2/3b refinements */
.panel-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

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

.form-modalized > .table-panel {
  grid-column: 1 / -1;
}

.modal-entry-form {
  display: grid;
  gap: 16px;
  align-content: start;
}

.form-modal .invoice-modal-card {
  max-height: min(86vh, 820px);
  overflow: auto;
}

.settings-modal {
  max-height: calc(100vh - 28px);
}

.settings-card {
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.settings-grid {
  align-items: stretch;
}

.settings-grid label:not(.is-hidden) {
  border-radius: 18px;
  background: rgba(255, 255, 255, .54);
}

.settings-section:not(.is-hidden) {
  padding: 18px;
  border: 1px solid rgba(34, 83, 244, .14);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(34, 83, 244, .06), rgba(255, 255, 255, .72));
}

.settings-section-feature:not(.is-hidden) {
  background: linear-gradient(135deg, rgba(1, 135, 105, .08), rgba(255, 255, 255, .72));
}

.statement-flow-summary .flow-income strong,
.cash-bar.in span em {
  color: var(--green);
}

.statement-flow-summary .flow-spend strong,
.cash-bar.out span em {
  color: var(--bad);
}

.hmrc-rollup {
  gap: 12px;
}

.hmrc-breakdown-row {
  border-color: rgba(198, 86, 0, .26);
  background: #fff8e8;
  grid-template-columns: minmax(0, 1fr) auto;
}

.hmrc-row-copy {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.hmrc-box-chip {
  min-width: 58px;
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 4px 9px;
  border: 1px solid rgba(198, 86, 0, .48);
  border-radius: 8px;
  color: #b04700;
  background: #fffdf7;
  font-weight: 620;
  font-size: .78rem;
}

.hmrc-box-chip.is-muted {
  border-color: rgba(1, 135, 105, .35);
  color: var(--green);
}

.transaction-context.is-hidden,
.is-hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .settings-card,
  .form-modal .invoice-modal-card {
    max-height: calc(100vh - 24px);
    padding: 22px;
  }

  .hmrc-row-copy {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* Phase 2/3c settings organisation */
.settings-grid-organised {
  display: block;
}

.settings-panel {
  display: grid;
  gap: 16px;
}

.settings-card-group {
  border: 1px solid rgba(29, 32, 40, .08);
  border-radius: 22px;
  background: rgba(255, 255, 255, .62);
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .78);
}

.settings-card-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(29, 32, 40, .08);
}

.settings-card-group-head h4 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
}

.settings-card-group-head .kicker {
  margin: 0;
}

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

.settings-group-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-group-grid label {
  min-width: 0;
}

.settings-card {
  max-height: min(86vh, 920px);
  overflow: auto;
}

@media (max-width: 820px) {
  .settings-group-grid,
  .settings-group-grid.two-col {
    grid-template-columns: 1fr;
  }

  .settings-card-group-head {
    display: block;
  }
}


/* Phase 2/3d refinement: calmer grouped settings, simple action copy, current FY title */
.page-title h1 {
  margin: 2px 0 0;
  font-family: var(--font-title);
  font-size: clamp(1.7rem, 2.6vw, 2.6rem);
  line-height: .96;
  letter-spacing: -.025em;
  font-weight: 300;
}

.settings-grid-organised label:not(.is-hidden) {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.settings-grid-organised .settings-section:not(.is-hidden) {
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(1, 135, 105, .08), rgba(255, 255, 255, .78));
}

.settings-card-group {
  border: 0;
  border-left: 4px solid rgba(34, 83, 244, .22);
  border-radius: 0;
  background: transparent;
  padding: 8px 0 4px 18px;
  box-shadow: none;
}

.settings-card-group-head {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(29, 32, 40, .08);
}

.settings-group-grid {
  gap: 16px 20px;
}

.compact-row.action-note em {
  justify-self: stretch;
  white-space: normal;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  line-height: 1.35;
  transform: none;
}

.compact-row.action-note:nth-of-type(even) em {
  transform: none;
}

.bank-account-card {
  cursor: pointer;
}

.bank-account-card:hover {
  border-color: rgba(34, 83, 244, .32);
}



/* App-native message/confirm modal; replaces browser alert/confirm for Electron-safe UX */
.app-message-modal::backdrop {
  background: rgba(12, 18, 32, 0.48);
  backdrop-filter: blur(5px);
}

.app-message-card {
  width: min(440px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-head.compact {
  padding: 18px 20px;
}

.app-message-body {
  padding: 18px 20px 8px;
  color: var(--muted);
  line-height: 1.55;
  white-space: pre-line;
}

.app-message-card .modal-actions {
  padding: 16px 20px 20px;
}


/* Phase 2/3f accuracy panels */
.tax-grid {
  align-items: start;
}
.panel .row-actions {
  display: flex;
  gap: .45rem;
  align-items: center;
  flex-wrap: wrap;
}
.quality-row.is-pass strong:last-child {
  color: var(--good, #137a44);
}
.quality-row.is-warn strong:last-child {
  color: var(--warn, #b15c00);
}
#qualityScore,
#calibrationScore {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.5rem;
  padding: .15rem .45rem;
  margin-left: .35rem;
  border-radius: 999px;
  background: rgba(10, 132, 255, .10);
  color: var(--accent, #2253f4);
  font-size: .78rem;
}
.settings-card-group {
  border: 1px solid rgba(17, 24, 39, .10);
  border-radius: 18px;
  padding: 1rem;
  background: rgba(255,255,255,.62);
}
.settings-card-group + .settings-card-group {
  margin-top: 1rem;
}
.settings-card-group .settings-group-grid label {
  border: 0;
  background: transparent;
  padding: .25rem 0;
  box-shadow: none;
}


/* Phase 2/3g — bank opening balances + transfer matching */
.bank-account-card {
  position: relative;
}

.bank-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.account-edit-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.account-edit-btn svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: currentColor;
}

.account-edit-btn:hover,
.account-edit-btn:focus-visible {
  color: var(--ink);
  background: rgba(255, 255, 255, .62);
  box-shadow: 0 0 0 3px rgba(34, 83, 244, .10);
  outline: 0;
}


.mini-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: var(--ink);
  font: inherit;
  font-size: .82rem;
  padding: 6px 12px;
  cursor: pointer;
}

.mini-btn:hover,
.mini-btn:focus-visible {
  border-color: rgba(34, 83, 244, .45);
  box-shadow: 0 0 0 3px rgba(34, 83, 244, .10);
}

.field-help {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
  margin-top: 6px;
}


/* Phase 2/3j refinements */
.app-message-modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: none;
}

.app-message-modal::backdrop {
  background: rgba(15, 19, 28, .42);
  backdrop-filter: blur(3px);
}

.app-message-card {
  width: min(520px, calc(100vw - 40px));
  min-height: 0;
  border: 1px solid rgba(18, 24, 36, .10);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: 0 28px 90px rgba(18, 24, 36, .22);
}

.app-message-card .modal-head.compact {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 24px;
  padding: 28px 30px 10px;
}

.app-message-card .modal-head.compact h2 {
  margin: 4px 0 0;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.02;
  letter-spacing: -.055em;
  font-weight: 430;
}

.app-message-card .modal-head.compact .kicker {
  color: var(--muted);
  font-size: 1rem;
}

.app-message-card .icon-btn {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border-color: rgba(34, 83, 244, .35);
  color: var(--blue);
  font-size: 1.55rem;
  line-height: 1;
}

.app-message-body {
  padding: 44px 30px 32px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
  letter-spacing: -.012em;
}

.app-message-card .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 30px 30px;
}

.app-message-card .ghost-btn,
.app-message-card .primary-btn {
  min-width: 118px;
}

.tx-inline-badge {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: .45rem;
  padding: .18rem .46rem;
  border-radius: 999px;
  background: rgba(34, 83, 244, .08);
  color: var(--blue);
  border: 1px solid rgba(34, 83, 244, .22);
  font-size: .68rem;
  font-weight: 540;
  line-height: 1.1;
  letter-spacing: .01em;
}

.bank-account-card {
  user-select: none;
}

.bank-account-card.is-dragging {
  opacity: .54;
  transform: scale(.99);
}

.bank-account-card.is-drop-target {
  outline: 2px solid rgba(34, 83, 244, .28);
  outline-offset: 4px;
}

/* Merged from ldgr.css.2 + Phase 2/3m: compact controls, modal chrome and Starling Space support */
.account-parent-row.is-hidden {
  display: none;
}

.panel-head,
.modal-head {
  align-items: center;
}

.bank-head-actions,
.panel-head-actions,
.settings-head-actions {
  align-items: center;
}

.round-add-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  font-size: 1.05rem;
  transform: none;
  translate: 0 0;
  flex: 0 0 auto;
}

.bank-head-actions .round-add-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  font-size: 1.05rem;
}

.icon-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  font-size: 1.02rem;
  line-height: 1;
  border-color: rgba(34, 83, 244, .35);
  color: var(--blue);
  background: transparent;
}

.settings-head-actions .icon-btn,
.modal-head .icon-btn {
  align-self: center;
}

.invoice-modal-card.compact-modal-card,
.app-message-card {
  background: var(--paper);
}

.app-message-modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(560px, calc(100vw - 36px));
  overflow: visible;
}

.app-message-modal::backdrop {
  background: rgba(21, 25, 33, .42);
  backdrop-filter: blur(8px);
}

.app-message-card {
  width: min(520px, calc(100vw - 36px));
  border: 1px solid rgba(110, 111, 117, .18);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 24px 80px rgba(20, 33, 54, .22);
  overflow: visible;
  padding: 28px;
}

.app-message-card .modal-head.compact {
  padding: 0;
  margin-bottom: 20px;
}

.app-message-card .modal-head.compact h2 {
  font-size: clamp(1.2rem, 2vw, 2rem);
  line-height: 1.05;
  letter-spacing: -.03em;
  margin: 4px 0 0;
  color: var(--ink);
  font-weight: 460;
}

.app-message-body {
  padding: 4px 0 26px;
  color: var(--muted);
  line-height: 1.55;
  white-space: pre-line;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  max-width: 34rem;
}

.app-message-card .modal-actions {
  padding: 0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.app-message-card .ghost-btn {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--bad);
  color: var(--bad);
  background: transparent;
  padding: 10px 22px;
}

.app-message-card .primary-btn {
  min-height: 44px;
  border-radius: 999px;
  padding: 10px 24px;
}

.app-message-card .modal-actions .pill-btn {
  border-radius: 999px;
}

.tx-inline-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 183, 77, .16);
  color: var(--warn, #d08b00);
  border: 1px solid rgba(255, 183, 77, .32);
  font-size: .72rem;
  font-weight: 430;
  line-height: 1;
  vertical-align: middle;
  margin-left: 8px;
  white-space: nowrap;
}

.account-card.is-space {
  margin-left: 18px;
  border-style: dashed;
}

.account-card.is-space .bank-logo-wrap {
  background: rgba(34, 83, 244, .12);
}

.account-card.is-space .bank-logo-wrap::before {
  content: "●";
  color: var(--blue);
  font-size: 1.2rem;
}

.account-card.is-space .bank-logo-wrap img {
  display: none;
}

span.bank-card-balance.income-amount {
  font-size: clamp(1.0rem, 1.2vw, 1.2rem);
  padding: 4px 14px;
  border-radius: 99px;
  color: var(--blue);
  border: 1px solid var(--blue);
}

span.bank-card-balance.bad-amount {
  color: var(--bad);
  font-size: clamp(1.0rem, 1.2vw, 1.2rem);
  padding: 4px 14px;
  border-radius: 99px;
  border: 1px solid var(--bad);
}

@media (max-width: 720px) {
  .app-message-card {
    padding: 22px;
  }

  .app-message-card .modal-actions {
    justify-content: stretch;
  }

  .app-message-card .modal-actions > * {
    flex: 1 1 auto;
  }
}


/* Phase 2/3n: compact Starling Spaces and statement action alignment */
.account-grid {
  overflow: visible;
}

.account-card.bank-account-card.is-space {
  width: calc(100% - 18px);
  min-height: 102px;
  margin-left: 18px;
  padding: 12px 14px;
  border-style: dashed;
  border-radius: 18px;
  background: rgba(244, 242, 237, .72);
}

.account-card.bank-account-card.is-space .bank-card-top {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.account-card.bank-account-card.is-space .bank-logo-wrap {
  width: 34px;
  height: 34px;
}

.account-card.bank-account-card.is-space .bank-card-identity {
  gap: 0;
}

.account-card.bank-account-card.is-space .bank-card-flow {
  margin-top: 8px;
  font-size: .78rem;
}

.account-card.bank-account-card.is-space .bank-card-details {
  display: none;
}

.account-card.bank-account-card.is-space .bank-card-balance {
  font-size: .96rem;
  padding: 3px 10px;
}

.account-card.bank-account-card.is-space .bank-card-actions {
  margin-top: 2px;
}

.statement-controls {
  align-items: flex-end;
}

.statement-controls label {
  margin: 0;
}

.statement-controls .pill-btn,
.statement-controls .statement-import-btn {
  min-height: 54px;
}

.statement-controls .round-add-btn {
  align-self: flex-end;
  margin-bottom: 13px;
}



/* App-led date/month chooser */
.date-native-hidden {
  position: absolute !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  margin: 0 !important;
}

.app-date-trigger {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 16px;
  color: var(--ink);
  background: var(--paper);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-weight: 300;
  text-align: left;
}

.app-date-trigger:hover,
.app-date-trigger:focus-visible {
  border-color: rgba(34, 83, 244, .55);
  outline: none;
}

.app-date-trigger svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: var(--ink);
  fill: currentColor;
}

.app-date-trigger.is-empty {
  color: var(--muted);
}

.statement-controls label .app-date-trigger {
  min-width: min(360px, 44vw);
}

.app-date-dialog {
  width: min(520px, calc(100% - 28px));
}

.app-date-card {
  padding: 26px;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 28px 90px rgba(20, 33, 54, .22);
}

.app-date-head {
  margin-bottom: 18px;
  align-items: flex-start;
}

.app-date-head h2 {
  color: var(--ink);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.compact-close-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  font-size: 1.35rem;
}

.app-date-toolbar {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  margin: 0 0 16px;
}

.app-date-toolbar strong {
  text-align: center;
  color: var(--blue);
  font-weight: 460;
  font-size: 1.05rem;
}

.app-date-nav-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  font-size: 1.55rem;
  color: var(--blue);
  border: 1px solid rgba(34, 83, 244, .18);
}

.app-date-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
}

.app-date-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

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

.app-date-cell {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .74);
  color: var(--ink);
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-weight: 360;
}

.app-date-cell:hover,
.app-date-cell:focus-visible {
  border-color: rgba(34, 83, 244, .55);
  outline: none;
}

.app-date-cell.is-muted {
  opacity: .38;
}

.app-date-cell.is-selected {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--paper);
}

.app-date-cell.is-today:not(.is-selected) {
  border-color: var(--blue);
  color: var(--blue);
}

.app-date-actions {
  justify-content: space-between;
  margin-top: 18px;
}

@media (max-width: 720px) {
  .statement-controls label .app-date-trigger {
    min-width: 0;
  }

  .app-date-card {
    padding: 22px;
  }
}


/* Phase 2/3w — compact Space roll-up and negative amount hygiene */
.bank-card-details strong.bad-amount,
.warn-text strong.bad-amount,
.bad-amount {
  color: var(--bad);
}

.space-rollup-tab {
  justify-self: start;
  margin: -13px 0 8px 38px;
  min-height: 28px;
  padding: 4px 14px 5px;
  border: 1px solid rgba(34, 83, 244, .22);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  background: rgba(255, 255, 255, .84);
  color: var(--blue);
  font: inherit;
  font-size: .82rem;
  font-weight: 420;
  line-height: 1;
  box-shadow: 0 12px 22px rgba(20, 33, 54, .07);
}

.space-rollup-tab:hover,
.space-rollup-tab:focus-visible {
  border-color: rgba(34, 83, 244, .42);
  outline: none;
}

.bank-account-card.is-space {
  width: calc(100% - 38px);
  min-height: 100px;
  margin-left: 38px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(244, 242, 237, .72);
}

.bank-account-card.is-space .bank-card-top {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
}

.bank-account-card.is-space .bank-logo-wrap {
  width: 34px;
  height: 34px;
}

.bank-account-card.is-space .bank-card-flow {
  margin-top: 7px;
  font-size: .78rem;
}

.bank-account-card.is-space .bank-card-details {
  display: none;
}

.bank-account-card.is-space .bank-card-actions {
  right: 10px;
  bottom: 10px;
}

@media (max-width: 760px) {
  .space-rollup-tab {
    margin-left: 24px;
  }

  .bank-account-card.is-space {
    width: calc(100% - 24px);
    margin-left: 24px;
  }
}

/* Phase 2/3y — figure-only money tones */
.bad-amount,
[data-negative-tone="auto"].bad-amount {
  color: var(--bad);
}

.zero-amount,
[data-negative-tone="auto"].zero-amount {
  color: var(--blue);
}

/* Phase 2/3y — dashboard banking can include spaces/additional accounts */
#overviewBanking {
  max-height: 520px;
  overflow: auto;
  padding-right: 2px;
}

#overviewBanking .compact-row em.zero-amount {
  color: var(--blue);
}


/* Phase 4a: account-delete backup control */
.account-modal-actions {
  justify-content: flex-end;
}

.account-modal-actions #deleteAccountBtn {
  margin-right: auto;
}


/* Phase 4a import feedback */
body.is-importing-csv {
  cursor: progress;
}

body.is-importing-csv #bankImportStatus {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--blue);
}

body.is-importing-csv #bankImportStatus::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(34, 83, 244, .22);
  border-top-color: var(--blue);
  border-radius: 999px;
  animation: ldgr-spin .72s linear infinite;
}

body.is-importing-csv #bankImportInput + *,
body.is-importing-csv .import-actions {
  pointer-events: none;
  opacity: .72;
}

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

/* Phase 2/3 UI polish: dashboard metric titles + Starling Space child icon */
.svg-symbols {
  position: absolute;
  inline-size: 0;
  block-size: 0;
  overflow: hidden;
}

.metric-card > .metric-title {
  color: var(--muted);
  font-weight: 480;
}

/* Use this span in dashboard Space rows instead of the old arrow marker:
   <span class="space-child-icon" aria-hidden="true"><svg><use href="#icon-space-grid"></use></svg></span>
*/
.space-child-icon {
  inline-size: 16px;
  block-size: 16px;
  min-inline-size: 16px;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  flex: 0 0 16px;
}

.space-child-icon svg {
  inline-size: 100%;
  block-size: 100%;
  display: block;
  fill: currentColor;
}

/* Defensive support for generated dashboard Space rows if the renderer supplies a row class. */
#overviewBanking .compact-row.is-space,
#overviewBanking .compact-row.is-starling-space,
#overviewBanking .compact-row[data-account-type="space"],
#overviewBanking .compact-row[data-space="true"] {
  grid-template-columns: 18px minmax(0, 1fr) auto;
  column-gap: 10px;
}

#overviewBanking .compact-row.is-space::before,
#overviewBanking .compact-row.is-starling-space::before,
#overviewBanking .compact-row[data-account-type="space"]::before,
#overviewBanking .compact-row[data-space="true"]::before {
  content: "";
  inline-size: 16px;
  block-size: 16px;
  align-self: center;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M48 64c-8.8 0-16 7.2-16 16l0 96c0 8.8 7.2 16 16 16l96 0c8.8 0 16-7.2 16-16l0-96c0-8.8-7.2-16-16-16L48 64zM0 80C0 53.5 21.5 32 48 32l96 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48L0 80zM48 320c-8.8 0-16 7.2-16 16l0 96c0 8.8 7.2 16 16 16l96 0c8.8 0 16-7.2 16-16l0-96c0-8.8-7.2-16-16-16l-96 0zM0 336c0-26.5 21.5-48 48-48l96 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-96zM400 64l-96 0c-8.8 0-16 7.2-16 16l0 96c0 8.8 7.2 16 16 16l96 0c8.8 0 16-7.2 16-16l0-96c0-8.8-7.2-16-16-16zM304 32l96 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-96c0-26.5 21.5-48 48-48zm0 288c-8.8 0-16 7.2-16 16l0 96c0 8.8 7.2 16 16 16l96 0c8.8 0 16-7.2 16-16l0-96c0-8.8-7.2-16-16-16l-96 0zm-48 16c0-26.5 21.5-48 48-48l96 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-96z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M48 64c-8.8 0-16 7.2-16 16l0 96c0 8.8 7.2 16 16 16l96 0c8.8 0 16-7.2 16-16l0-96c0-8.8-7.2-16-16-16L48 64zM0 80C0 53.5 21.5 32 48 32l96 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48L0 80zM48 320c-8.8 0-16 7.2-16 16l0 96c0 8.8 7.2 16 16 16l96 0c8.8 0 16-7.2 16-16l0-96c0-8.8-7.2-16-16-16l-96 0zM0 336c0-26.5 21.5-48 48-48l96 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-96zM400 64l-96 0c-8.8 0-16 7.2-16 16l0 96c0 8.8 7.2 16 16 16l96 0c8.8 0 16-7.2 16-16l0-96c0-8.8-7.2-16-16-16zM304 32l96 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-96c0-26.5 21.5-48 48-48zm0 288c-8.8 0-16 7.2-16 16l0 96c0 8.8 7.2 16 16 16l96 0c8.8 0 16-7.2 16-16l0-96c0-8.8-7.2-16-16-16l-96 0zm-48 16c0-26.5 21.5-48 48-48l96 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-96z'/%3E%3C/svg%3E") center / contain no-repeat;
}

span.bank-card-balance.zero-amount {
    font-size: clamp(1.0rem, 1.2vw, 1.2rem);
    padding: 4px 14px;
    border-radius: 99px;
    color: var(--blue);
    border: 1px solid var(--blue);

/* CSV import reminder settings */
.reminder-status {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.45;
}
