@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/inter-latin-700-normal.woff2") format("woff2");
}

:root {
  --background: hsl(30 16% 95%);
  --foreground: hsl(24 18% 13%);
  --primary: hsl(23 46% 32%);
  --primary-foreground: hsl(30 44% 97%);
  --sidebar: #3E2619;
  --sidebar-foreground: #F5EDE4;
  --sidebar-muted: #C9B8A8;
  --sidebar-accent: #583A2A;
  --sidebar-accent-foreground: #FFF8F1;
  --sidebar-border: #4A3224;
  --sidebar-hover: #4D3224;
  --muted: hsl(30 16% 95%);
  --muted-foreground: hsl(26 10% 40%);
  --border: hsl(30 14% 88%);
  --success: hsl(152 55% 30%);
  --negative: hsl(0 62% 40%);
}

html.dark {
  --background: hsl(24 18% 7%);
  --foreground: hsl(30 20% 94%);
  --primary: hsl(24 50% 58%);
  --primary-foreground: hsl(20 45% 8%);
  --sidebar: #181411;
  --sidebar-foreground: #EDE6DE;
  --sidebar-muted: #B7ADA4;
  --sidebar-accent: #2F2823;
  --sidebar-accent-foreground: #F3F0ED;
  --sidebar-border: #3F3731;
  --sidebar-hover: #26201C;
  --muted: hsl(24 12% 14%);
  --muted-foreground: hsl(30 12% 68%);
  --border: hsl(24 12% 22%);
  --success: hsl(152 45% 62%);
  --negative: hsl(0 75% 68%);
}

html, body, #app { min-height: 100%; }
body { margin: 0; background: var(--background); color: var(--foreground); }
.value { font-variant-numeric: tabular-nums; }
/* Bordas outlined iguais às dos campos (LinesInputs do tema Mud). */
.mud-button-outlined {
  border-color: var(--mud-palette-lines-inputs) !important;
}
.app-sider,
.app-drawer {
  background: var(--sidebar) !important;
  color: var(--sidebar-foreground);
}
.app-sider {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: 248px;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--sidebar-border);
  transition: width .15s ease;
}
.app-drawer {
  display: flex;
  flex-direction: column;
}
.app-sider.is-collapsed { width: 72px; }
.app-sider.is-collapsed .brand-lockup,
.app-sider.is-collapsed .nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
.app-sider.is-collapsed .nav-link-label,
.app-sider.is-collapsed .nav-label,
.app-sider.is-collapsed .sider-mail { display: none; }
.app-sider.is-collapsed .brand-lockup .mud-icon-button { margin-left: 0; }
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 12px;
  color: var(--sidebar-accent-foreground);
  border-bottom: 1px solid var(--sidebar-border);
}
.brand-lockup strong,
.brand-lockup small { display: block; }
.brand-lockup strong { color: var(--sidebar-accent-foreground); font-weight: 600; }
.brand-lockup small {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 700;
}
.app-nav {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 16px;
  padding: 12px;
  overflow-y: auto;
}
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-label {
  margin: 0 8px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}
a.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  color: var(--sidebar-muted) !important;
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.25;
  transition: background-color .15s ease, color .15s ease;
}
a.nav-link .nav-link-icon,
a.nav-link .mud-icon-root {
  color: inherit !important;
  font-size: 18px !important;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
a.nav-link .nav-link-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.nav-link:hover {
  background: var(--sidebar-hover) !important;
  color: var(--sidebar-foreground) !important;
}
a.nav-link.active {
  background: var(--sidebar-accent) !important;
  color: var(--sidebar-accent-foreground) !important;
  font-weight: 500;
}
a.nav-link.active:hover {
  background: var(--sidebar-accent) !important;
  color: var(--sidebar-accent-foreground) !important;
}
.brand-lockup .mud-icon-button {
  color: var(--sidebar-muted) !important;
  margin-left: auto;
}
.brand-lockup .mud-icon-button:hover {
  color: var(--sidebar-accent-foreground) !important;
  background: var(--sidebar-hover) !important;
}
.sider-mail {
  margin-top: auto;
  padding: 12px;
  font-size: 11px;
  color: var(--sidebar-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid var(--sidebar-border);
}
.drawer-layer {
  position: fixed;
  inset: 0;
  z-index: 1400;
}
.app-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(264px, 86vw);
  z-index: 1401;
  overflow: auto;
  box-shadow: 4px 0 24px rgba(0, 0, 0, .2);
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 0;
}
.shell .mud-main-content { margin-left: 248px; }
.shell.is-collapsed .mud-main-content { margin-left: 72px; }
.app-header { left: 248px !important; width: calc(100% - 248px) !important; background: var(--mud-palette-surface, #fff) !important; color: var(--foreground) !important; border-bottom: 1px solid var(--border); border-top: 2px solid color-mix(in srgb, var(--primary) 50%, transparent); }
.shell.is-collapsed .app-header { left: 72px !important; width: calc(100% - 72px) !important; }
.header-menu-btn { display: none; }
.header-filters-menu { display: none; }
.header-filters-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: min(280px, 84vw);
  padding: 12px;
}
.header-filters-panel .company-select,
.header-filters-panel .period-picker { width: 100%; }
.header-filters-panel .month-select,
.header-filters-panel .year-input { width: 100%; }
@media (max-width: 959.98px) {
  .app-sider { display: none !important; }
  .shell .mud-main-content, .shell.is-collapsed .mud-main-content { margin-left: 0; }
  .app-header, .shell.is-collapsed .app-header { left: 0 !important; width: 100% !important; }
  .header-menu-btn { display: inline-flex; }
  .header-filters-desktop { display: none !important; }
  .header-filters-menu { display: inline-flex; align-items: center; }
}
.app-header, .app-header .mud-toolbar { overflow: visible; }
.app-header .mud-toolbar { min-height: 56px; padding: 0 12px; gap: 8px; flex-wrap: nowrap; }
.header-filters {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}
.company-select {
  flex: 0 0 auto !important;
  max-width: none !important;
}
.company-select .mud-input,
.company-select .mud-select-input,
.company-select .mud-input-slot,
.company-select input.mud-input-slot {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
}
.month-select { width: 108px; flex: 0 0 auto; }
.year-input { width: 104px; flex: 0 0 auto; }
.period-picker { flex-wrap: nowrap; flex: 0 0 auto; }
.user-name { display: inline-block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.user-menu-btn-mobile { display: none; }
.user-menu-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 16px 6px; min-width: 220px; max-width: 260px; }
.user-menu-head strong { font-size: 13px; font-weight: 600; line-height: 1.3; }
.user-menu-mail { font-size: 11px; font-weight: 400; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 599.98px) {
  .user-menu-btn-desktop { display: none !important; }
  .user-menu-btn-mobile { display: inline-flex; }
}
.mud-button-root, .mud-tab { text-transform: none; letter-spacing: 0; }

.account-tree { overflow-x: auto; background: var(--mud-palette-surface, #fff); border-radius: 10px; }
.account-tree-head, .account-tree .mud-treeview { min-width: 920px; }
.account-tree .mud-treeview { overflow: visible; }
.account-tree-head, .account-tree-line { display: flex; align-items: center; gap: 8px; }
.account-tree-head { min-height: 36px; padding: 6px 8px 6px 48px; border-bottom: 1px solid var(--border); color: var(--muted-foreground); font-size: 12px; font-weight: 600; }
.account-tree-line { width: 100%; min-height: 28px; }
.account-tree-line.is-draggable { cursor: grab; }
.account-tree-line.is-draggable:active { cursor: grabbing; }
.account-tree-line.is-drag-over { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.account-drag-handle { flex: 0 0 auto; opacity: .55; }
.account-tree-name { flex: 1 1 auto; min-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-tree-meta { display: flex; align-items: center; flex: 0 0 auto; }
.account-col { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.account-col-code { width: 104px; }
.account-col-group { width: 220px; }
.account-col-kind { width: 148px; }
.account-col-flag { width: 72px; }
.account-col-actions { width: 40px; display: flex; justify-content: flex-end; overflow: visible; }
.account-col-actions .mud-icon-button { padding: 4px; }
.account-tree .mud-treeview-item-label { flex: 1; min-width: 0; }
.account-tree .mud-treeview-item-content { border-bottom: 1px solid var(--border); }
.account-tree-empty { display: block; padding: 16px; }
.registry-actions { white-space: nowrap; text-align: end; vertical-align: middle; }
.registry-actions .mud-stack { display: inline-flex; flex-direction: row; flex-wrap: nowrap; width: max-content; margin-left: auto; }
.money-positive { color: var(--success); }
.money-negative { color: var(--negative); }
.money-muted { color: var(--muted-foreground); }
.dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--muted-foreground);
  display: inline-block;
  flex-shrink: 0;
}
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; border: 1px solid var(--border); padding: 1px 8px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.chip-neutral { background: var(--muted); color: var(--muted-foreground); }
.chip-ok { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.chip-info { background: color-mix(in srgb, #2F5D73 14%, transparent); color: #2F5D73; border-color: color-mix(in srgb, #2F5D73 35%, transparent); }
.chip-warn { background: color-mix(in srgb, #8A5A24 16%, transparent); color: #8A5A24; border-color: color-mix(in srgb, #8A5A24 35%, transparent); }
.chip-bad { background: color-mix(in srgb, var(--negative) 14%, transparent); color: var(--negative); border-color: color-mix(in srgb, var(--negative) 35%, transparent); }
.chip-plain { background: transparent; color: var(--muted-foreground); text-decoration: line-through; }
html.dark .chip-info { color: #8FBFCF; }
html.dark .chip-warn { color: #E2B07A; }
.row-cancelled { opacity: .6; }
.row-diff { background: color-mix(in srgb, var(--negative) 12%, transparent); }
.row-weekend { color: var(--muted-foreground); }
.qr svg { width: 176px; height: 176px; background: white; border-radius: 8px; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 8px 16px; background: var(--negative); color: white; z-index: 50; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* Nota de débito impressa. O restante do espaçamento fica nos controles do MudBlazor. */
.muted { color: var(--muted-foreground); font-size: 12px; }
.forecast-notes { display: flex; flex-direction: column; gap: 10px; }
.forecast-notes p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 11px;
  line-height: 1.55;
  max-width: 1100px;
}
.forecast-notes .note-em,
.note-em { color: var(--foreground); font-weight: 500; }
.forecast-notes a { font-size: inherit; }
.micro-label { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-foreground); }
.doc-page { min-height: 100%; background: var(--muted); padding: 24px 12px 40px; }
.doc-toolbar { width: min(210mm, 100%); margin: 0 auto 12px; }
.doc-sheet { position: relative; width: min(210mm, 100%); margin: 0 auto; background: white; color: #111; padding: 14mm; }
.doc-stamp { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.doc-stamp span { font-size: 72pt; font-weight: 700; color: rgba(0,0,0,.1); transform: rotate(-32deg); }
.doc-head, .doc-sign { display: flex; justify-content: space-between; gap: 24px; }
.doc-head { border-bottom: 2px solid black; padding-bottom: 8px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 9pt; margin-top: 16px; }
.doc-table th { border-bottom: 2px solid black; text-align: left; font-size: 8pt; text-transform: uppercase; padding: 4px 8px; background: #F5F5F5; }
.doc-table td { border-bottom: 1px solid #E5E5E5; padding: 4px 8px; }
.doc-box { border: 1px solid #333; padding: 12px; margin-top: 16px; font-size: 10pt; }
.doc-totals { width: 320px; margin-left: auto; margin-top: 16px; font-size: 10pt; }
.doc-totals div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #CCC; padding: 4px 0; }
.doc-totals .net { border-top: 3px double black; border-bottom: 0; font-weight: 700; }
.matrix { overflow-x: auto; }
.matrix table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; }
.mud-table .mud-table-cell {
  padding-top: 14px !important;
  padding-bottom: 14px !important;
}
.mud-table.mud-table-dense .mud-table-cell {
  padding-top: 12px !important;
  padding-bottom: 12px !important;
}
.mud-table .mud-table-head .mud-table-cell {
  padding-top: 12px !important;
  padding-bottom: 12px !important;
}
.matrix th, .matrix td { padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 13px; white-space: nowrap; vertical-align: middle; text-align: right; }
.matrix td.col-action,
.matrix th.col-action { text-align: right; width: 1%; }
.matrix td.col-action .mud-button-root { margin-left: auto; }
.matrix th { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-foreground); text-align: right; background: color-mix(in srgb, var(--muted) 70%, var(--mud-palette-surface, #fff)); }
.matrix .sticky-col { position: sticky; left: 0; z-index: 1; min-width: 280px; text-align: left !important; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--foreground); background: var(--mud-palette-surface, #fff); }
/* Tabelas de texto (plano de ação, etc.): cabeçalho alinhado à esquerda como o dado. */
.matrix.matrix-list th,
.matrix.matrix-list th.col-end,
.matrix.matrix-list th.col-action,
.matrix.matrix-list td {
  text-align: left !important;
}
.matrix.matrix-list td.col-end,
.matrix.matrix-list td.col-action {
  text-align: right !important;
}
.matrix.matrix-list td { white-space: normal; max-width: 280px; }
/* Listas curtas (responsáveis): tabela no tamanho do conteúdo, sem espalhar colunas. */
.matrix.matrix-compact table {
  width: auto;
  min-width: 0;
}
.matrix.matrix-compact td,
.matrix.matrix-compact th {
  max-width: none;
}
.owner-field {
  width: 260px;
  max-width: 100%;
}
.matrix thead .sticky-col { z-index: 2; background: color-mix(in srgb, var(--muted) 70%, var(--mud-palette-surface, #fff)); }
.matrix .is-current { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.matrix .is-projected { background: color-mix(in srgb, var(--primary) 7%, transparent); color: var(--primary); }
.matrix tr.section-in td, .matrix tr.section-in td.sticky-col { background: color-mix(in srgb, var(--success) 14%, var(--mud-palette-surface, #fff)); font-weight: 600; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.matrix tr.section-out td, .matrix tr.section-out td.sticky-col { background: color-mix(in srgb, var(--negative) 12%, var(--mud-palette-surface, #fff)); font-weight: 600; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.matrix tr.row-total td, .matrix tr.row-total td.sticky-col { font-weight: 600; background: color-mix(in srgb, var(--muted) 75%, var(--mud-palette-surface, #fff)); }
.matrix tr.row-balance td, .matrix tr.row-balance td.sticky-col { font-weight: 700; background: color-mix(in srgb, var(--primary) 10%, var(--mud-palette-surface, #fff)); }
.matrix tr.dre-subtotal td, .matrix tr.dre-subtotal td.sticky-col { font-weight: 700; background: color-mix(in srgb, var(--primary) 8%, var(--mud-palette-surface, #fff)); }
.matrix tr.dre-group td, .matrix tr.dre-group td.sticky-col { font-weight: 600; background: color-mix(in srgb, var(--muted) 80%, var(--mud-palette-surface, #fff)); }
.matrix tr.dre-account td.sticky-col { padding-left: 28px; color: var(--muted-foreground); }
.matrix tr.dre-indicator td { color: var(--muted-foreground); font-style: italic; font-size: 12px; }
.matrix tr.dre-group td.sticky-col, .matrix tr.dre-indicator td.sticky-col { padding-left: 16px; }
/* Botão nativo centraliza o texto; força valor/título à direita na grade. */
.matrix button.cell-link {
  background: none;
  border: 0;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  text-align: right !important;
  font: inherit;
  color: inherit;
  cursor: pointer;
  padding: 4px 0;
}
.matrix .sticky-col button.cell-link {
  margin-left: 0;
  text-align: left !important;
}
.matrix button.cell-link:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.matrix button.cell-link:disabled { cursor: default; }
.matrix button.cell-link:disabled:hover { background: none; }
.cell-edit { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.cell-hint { font-size: 10px; color: var(--muted-foreground); line-height: 1.2; }
.cell-input {
  width: 148px;
  max-width: 100%;
  --ctrl-h: 40px;
}
.cell-input .mud-input-control { margin: 0 !important; }
.cell-input .mud-input {
  height: var(--ctrl-h) !important;
  min-height: var(--ctrl-h) !important;
}
.cell-input .mud-input-outlined .mud-input-outlined-border {
  border-radius: 8px !important;
  border-color: var(--mud-palette-lines-inputs, var(--border)) !important;
}
.cell-input .mud-input-outlined:hover .mud-input-outlined-border,
.cell-input .mud-input-outlined.mud-input-focused .mud-input-outlined-border {
  border-color: var(--primary) !important;
}
.cell-input .mud-input-slot,
.cell-input input.mud-input-slot {
  height: var(--ctrl-h) !important;
  min-height: var(--ctrl-h) !important;
  text-align: right;
  font-size: 13px !important;
  font-variant-numeric: tabular-nums;
  padding: 0 10px !important;
  line-height: var(--ctrl-h) !important;
}
.cell-input input::placeholder { color: color-mix(in srgb, var(--muted-foreground) 70%, transparent); opacity: 1; }
/* Controles de barra: mesma altura (40px) para botão, select e campo. */
.ctrl,
.header-select,
.owner-field,
.page-header-row > .mud-button-root,
.page-header-actions .mud-button-root,
.page-header > .mud-button-root,
.page-header .mud-button-root.mud-button-outlined,
.card-toolbar .mud-button-root {
  --ctrl-h: 40px;
  height: var(--ctrl-h) !important;
  min-height: var(--ctrl-h) !important;
  box-sizing: border-box;
}
.header-select.mud-select,
.header-select.mud-input-control,
.owner-field.mud-input-control,
.ctrl.mud-select,
.ctrl.mud-input-control {
  height: auto !important;
  min-height: 0 !important;
}
.header-select .mud-input-control,
.owner-field .mud-input-control,
.ctrl .mud-input-control {
  margin: 0 !important;
  height: var(--ctrl-h, 40px);
}
.header-select .mud-input,
.owner-field .mud-input,
.ctrl .mud-input {
  height: var(--ctrl-h, 40px) !important;
  min-height: var(--ctrl-h, 40px) !important;
  font-size: 13px;
}
.header-select .mud-input-slot,
.header-select input.mud-input-slot,
.owner-field .mud-input-slot,
.owner-field input.mud-input-slot,
.ctrl .mud-input-slot,
.ctrl input.mud-input-slot {
  height: var(--ctrl-h, 40px) !important;
  min-height: var(--ctrl-h, 40px) !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  font-size: 13px !important;
  line-height: var(--ctrl-h, 40px) !important;
}
.header-select .mud-input-outlined .mud-input-outlined-border,
.owner-field .mud-input-outlined .mud-input-outlined-border,
.ctrl .mud-input-outlined .mud-input-outlined-border {
  border-radius: 8px !important;
}
.page-header-row > .mud-button-root,
.page-header-actions .mud-button-root,
.page-header .mud-button-root.mud-button-outlined,
.card-toolbar .mud-button-root,
.ctrl.mud-button-root {
  padding: 0 12px !important;
  font-size: 13px !important;
  line-height: 1 !important;
  border-radius: 8px !important;
  text-transform: none;
}
.page-header-row > .mud-button-root .mud-button-label,
.page-header-actions .mud-button-root .mud-button-label,
.card-toolbar .mud-button-root .mud-button-label,
.ctrl.mud-button-root .mud-button-label {
  gap: 6px;
}
.page-header-row > .mud-button-root .mud-button-icon-start,
.page-header-actions .mud-button-root .mud-button-icon-start,
.card-toolbar .mud-button-root .mud-button-icon-start,
.ctrl.mud-button-root .mud-button-icon-start {
  margin: 0 !important;
  font-size: 16px !important;
}
.switch-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--mud-palette-surface, #fff);
  padding: 0 10px;
  font-size: 13px;
  color: var(--foreground);
  white-space: nowrap;
  box-sizing: border-box;
}
.switch-box .mud-switch { margin: 0; }
.switch-box .threshold-input { width: 64px; --ctrl-h: 28px; }
.switch-box .threshold-input .mud-input-control { margin: 0; }
.switch-box .threshold-input input { text-align: right; padding: 0 6px !important; }
.page-layout { display: flex; flex-direction: column; gap: 20px; }
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  width: 100%;
}
.page-header-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 280px;
  max-width: 720px;
}
.page-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  margin-left: auto;
}
.page-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.page-header .header-select,
.page-header-actions .header-select,
.page-header-row .header-select {
  margin: 0 !important;
  flex: 0 0 auto;
}
.page-header .header-select .mud-input-control,
.page-header-actions .header-select .mud-input-control,
.page-header-row .header-select .mud-input-control { margin: 0; }
.page-header .mud-button-root,
.page-header-actions .mud-button-root,
.page-header-row .mud-button-root { flex: 0 0 auto; }
.card-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.card-toolbar-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.cell-input-quiet .mud-input-outlined .mud-input-outlined-border {
  border-color: transparent !important;
  background: transparent;
}
.cell-input-quiet .mud-input-outlined:hover .mud-input-outlined-border,
.cell-input-quiet .mud-input-outlined.mud-input-focused .mud-input-outlined-border {
  border-color: var(--primary) !important;
  background: var(--mud-palette-surface, #fff);
}
@media (max-width: 960px) {
  .page-header { align-items: stretch; }
  .page-header-row { justify-content: flex-start; }
  .page-header-actions { margin-left: 0; max-width: none; align-items: stretch; }
}
.kpi-card { min-height: 112px; display: flex; flex-direction: column; }
.overview-row > .mud-grid-item > .kpi-card { height: 100%; }
.kpi-value { font-size: 1.75rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-value-md { font-size: 1.125rem; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; margin-top: 8px; }
.overview-card {
  background: var(--mud-palette-surface, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(28, 20, 15, .04);
}
.overview-row > .mud-grid-item {
  display: flex;
}
.overview-card-fill {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
}
.settings-company-row {
  width: 100%;
  align-items: stretch;
}
.settings-company-card {
  flex: 1 1 0;
  min-width: 220px;
  width: auto;
  height: auto;
  align-self: stretch;
}
.overview-stat {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--muted) 55%, transparent);
  padding: 12px;
}
.overview-stat-value { display: block; margin-top: 4px; font-size: 1.125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.overview-table .mud-table-head .mud-table-cell {
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  background: color-mix(in srgb, var(--muted) 70%, var(--mud-palette-surface, #fff));
}
.overview-table .mud-table-cell { font-size: 13px; padding-top: 14px !important; padding-bottom: 14px !important; }
.entries-filters { border-bottom: 1px solid var(--border); }
.entries-selection { border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--muted) 55%, transparent); }
.entries-search { width: min(280px, 100%); --ctrl-h: 36px; }
.entries-filter,
.entries-filter-sm,
.entries-date,
.entries-search {
  --ctrl-h: 36px;
  margin: 0 !important;
}
.entries-filter .mud-input-control,
.entries-filter-sm .mud-input-control,
.entries-date .mud-input-control,
.entries-search .mud-input-control { margin: 0 !important; }
.entries-filter .mud-input,
.entries-filter-sm .mud-input,
.entries-date .mud-input,
.entries-search .mud-input {
  height: 36px !important;
  min-height: 36px !important;
  font-size: 13px;
}
.entries-filter .mud-input-slot,
.entries-filter-sm .mud-input-slot,
.entries-date .mud-input-slot,
.entries-search .mud-input-slot,
.entries-filter input.mud-input-slot,
.entries-filter-sm input.mud-input-slot,
.entries-date input.mud-input-slot,
.entries-search input.mud-input-slot {
  height: 36px !important;
  min-height: 36px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: 36px !important;
  font-size: 13px !important;
}
.entries-filter { width: 196px; max-width: 100%; }
.entries-filter-sm { width: 148px; max-width: 100%; }
.entries-date { width: 148px; max-width: 100%; }
.cash-accounts {
  width: 100%;
}
.cash-account-card {
  cursor: pointer;
  flex: 1 1 0;
  min-width: 180px;
  width: auto;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cash-account-card.is-selected {
  border-color: color-mix(in srgb, var(--primary) 70%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 45%, transparent);
}
.cash-balance-card { min-height: 76px; }
.cash-balance-value { font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.allocation-tabs .mud-tabs-toolbar { background: transparent; }
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--muted) 88%, var(--border));
}
.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.segmented button .mud-icon-root {
  font-size: 18px;
}
.segmented button.is-active {
  background: var(--mud-palette-surface, #fff);
  color: var(--foreground);
  box-shadow: 0 1px 2px rgba(28, 20, 15, .08);
}
.matrix.matrix-list td.registry-name { font-weight: 600; color: var(--foreground); }
.matrix.matrix-list td.col-action { text-align: right; }
.warn-note {
  border-color: color-mix(in srgb, #8A5A24 40%, var(--border));
  background: color-mix(in srgb, #F7E8D0 70%, var(--mud-palette-surface, #fff));
  color: #6B3F12;
}
.info-note {
  border-color: color-mix(in srgb, #2F5D73 40%, var(--border));
  background: color-mix(in srgb, #2F5D73 8%, var(--mud-palette-surface, #fff));
  color: #234556;
}
.callout-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.45;
}
.callout-row .callout-icon { flex-shrink: 0; margin-top: 1px; }
.warn-note .callout-icon { color: #8A5A24; }
.info-note .callout-icon { color: #2F5D73; }

@media print {
  .no-print, .mud-appbar, .app-sider, .app-drawer, .drawer-backdrop { display: none !important; }
  .shell .mud-main-content, .shell.is-collapsed .mud-main-content { margin-left: 0; }
  .doc-page { background: white; padding: 0; }
  .doc-sheet { width: auto; padding: 0; }
}
