:root {
  --bg: #3a3f47;
  --panel: #4a5059;
  --border: #5c6370;
  --text: #eef1f5;
  --muted: #b4bcc8;
  --title-red: #e53935;
  --blue: #4a9eff;
  --red: #e53935;
  --purple: #9b7cff;
  --green: #4caf6a;
  --yellow: #e6b422;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.muted-note {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1rem;
}

.import-format-note {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
}

.import-format-note strong {
  color: var(--text);
}

.import-format-note code {
  display: block;
  margin-top: 0.4rem;
  padding: 0.45rem 0.6rem;
  background: #353a42;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.auth-description {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
  margin: 0 0 1.25rem;
  max-width: 52rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-card {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.admin-user-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr 0.8fr 1.4fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.admin-user-row select,
.admin-user-row button {
  width: 100%;
}

.admin-user-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-backups-card {
  margin-bottom: 1rem;
  border: 1px solid var(--border, #ccc);
}

.admin-backups-card h4 {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
}

.admin-backup-actions {
  margin-bottom: 0.75rem;
}

.admin-backup-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border, #ddd);
}

.admin-backup-row:last-child {
  border-bottom: none;
}

.access-code-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
}

.admin-access-code-row {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border, #ddd);
}

.admin-access-code-row:last-child {
  border-bottom: none;
}

button.danger {
  background: #8b2e2e;
  border: 1px solid #a33;
  color: #fff;
}

button.danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .admin-user-row {
    grid-template-columns: 1fr;
  }
}

button,
input,
select {
  font: inherit;
}

header.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

#appChrome {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 25;
  width: 11.5rem;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

#appChrome header.topbar {
  flex-direction: column;
  align-items: stretch;
  padding: 1rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

#appChrome .topbar h1 {
  font-size: 1rem;
  line-height: 1.2;
}

#appChrome .site-brand-header .site-logo {
  max-width: 9.5rem;
}

#appChrome #userGreeting {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.site-app-link {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.app-link-button {
  display: inline-block;
  text-decoration: none;
  border-radius: 10px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  background: #5a6170;
  color: var(--text);
  font-size: 0.88rem;
  text-align: center;
}

.app-link-button:hover {
  opacity: 0.96;
}

.site-app-link .app-link-button {
  display: block;
  width: 100%;
}

.auth-app-link-row {
  margin: 1rem 0 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#appChrome .topbar-actions {
  flex-direction: column;
  margin-top: 0.75rem;
}

#appChrome .topbar-actions button {
  width: 100%;
}

.app-content {
  margin-left: 11.5rem;
  min-height: 100vh;
  min-width: 0;
}

.topbar-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.topbar h1,
.auth-card > h1,
.panel > h2 {
  color: var(--title-red);
}

.site-brand {
  display: flex;
  justify-content: center;
}

.site-logo {
  display: block;
  width: 100%;
  height: auto;
}

.site-brand-auth {
  margin-bottom: 1rem;
}

.site-brand-auth .site-logo {
  max-width: 280px;
  margin: 0 auto;
}

.site-brand-header .site-logo {
  max-width: 100%;
}

#appChrome .site-brand-header {
  margin-bottom: 0.15rem;
}

.topbar h1 {
  margin: 0 0 0.3rem;
  font-size: 1.4rem;
}

.panel > h2 {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.4rem;
  margin: 1rem;
}

.auth-card {
  max-width: 820px;
  margin: 2rem auto;
}

.legal-page h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.05rem;
}

.legal-page p,
.legal-page ul {
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.95rem;
}

.legal-page ul {
  padding-left: 1.25rem;
  margin: 0.5rem 0 1rem;
}

.legal-page li {
  margin-bottom: 0.35rem;
}

.legal-page a {
  color: var(--blue);
}

.legal-disclaimer {
  margin-top: 1.5rem;
  font-size: 0.85rem;
}

.signup-terms-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
}

.signup-terms-label input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.signup-terms-label a {
  color: var(--blue);
}

.auth-support-footer {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.88rem;
}

.auth-support-footer a {
  color: var(--blue);
}

.auth-forms {
  display: grid;
  gap: 1.6rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.auth-forms form:not(.hidden),
.grid-form:not(.hidden) {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.95rem;
}

input,
select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  background: #353a42;
  color: var(--text);
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

button {
  border: none;
  border-radius: 10px;
  padding: 0.95rem 1.3rem;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
}

button.secondary {
  background: #5a6170;
  color: var(--text);
}

button:hover {
  opacity: 0.96;
}

.tabs {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.35rem;
  padding: 0.65rem 0.55rem;
}

.tabs button {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  font-size: 0.88rem;
}

.tabs button.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.nav-group-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sub-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-left: 0.65rem;
  padding-left: 0.35rem;
  border-left: 2px solid var(--border);
}

.sub-tabs.hidden {
  display: none;
}

.sub-tabs button {
  font-size: 0.82rem;
  padding: 0.45rem 0.55rem;
}

.sub-tabs button.active {
  background: rgba(74, 158, 255, 0.22);
  color: #9fd0ff;
  border-color: var(--blue);
}

main {
  max-width: 1200px;
  margin: 0 auto 2rem;
}

.list {
  margin-top: 1rem;
}

.card-item,
.budget-item,
.entry-item,
.trial-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.8rem;
}

.row-grid {
  display: grid;
  gap: 0.75rem;
}

.trial-row,
.budget-item,
.entry-item {
  grid-template-columns: minmax(220px, 1fr) repeat(4, minmax(100px, 1fr)) auto;
}

.trial-header,
.budget-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.trial-table,
.budget-table,
.entries-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.trial-table th,
.trial-table td,
.budget-table th,
.budget-table td,
.entries-table th,
.entries-table td {
  padding: 0.9rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.entries-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.9rem;
}

.entries-table input,
.entries-table select {
  width: 100%;
}

.entry-grid-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.entry-form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.entry-subledger-update-section {
  margin-top: 0.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.entry-subledger-update-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.entry-subledger-update-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.65rem;
}

.entry-subledger-update-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
}

.entry-subledger-update-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  min-width: 12rem;
}

.entry-subledger-update-preview {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.88rem;
}

.entry-subledger-create-wrap {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.65rem 0.85rem;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.entry-subledger-create-wrap label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  min-width: 0;
}

.entry-subledger-create-title {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
}

.trial-table th,
.budget-table th,
.entries-table th {
  background: #353a42;
}

.badge {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  color: #fff;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.badge span {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  display: inline-block;
}

.symbol {
  display: inline-block;
  width: 1.1rem;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1;
  margin-right: 0.6rem;
}

.trial-sticky-zone {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  margin-bottom: 0.5rem;
}

.trial-sticky-zone.has-pinned-totals {
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.trial-sticky-header {
  background: var(--panel);
  padding: 0.75rem 0 0.75rem;
  border-bottom: 1px solid var(--border);
}

.trial-sticky-zone.has-pinned-totals .trial-sticky-header {
  border-bottom: none;
}

.trial-pin-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--muted);
  cursor: pointer;
}

.trial-display-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
}

.trial-mtd-change-note {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.trial-mtd-change-cell {
  font-style: italic;
}

.trial-period-controls {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.trial-period-controls.hidden {
  display: none;
}

.trial-period-status {
  margin: 0 0 0.5rem;
}

.trial-period-status.closed {
  color: #e05555;
}

.trial-period-warning {
  margin: 0.35rem 0 0.5rem;
  color: var(--warning, #c77800);
}

.trial-period-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.trial-col-lock,
.trial-lock-cell {
  width: 5.5rem;
  text-align: center;
  white-space: nowrap;
}

.trial-lock-btn {
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
}

button.secondary.trial-lock-btn-unlock,
button.secondary.trial-unlock-all-btn {
  border-color: rgba(200, 120, 0, 0.4);
  color: #c77800;
}

button.secondary.trial-lock-btn-unlock:hover,
button.secondary.trial-unlock-all-btn:hover {
  border-color: #c77800;
  color: #c77800;
}

.trial-lock-badge {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.15);
  color: var(--muted);
}

.trial-lock-badge.closed {
  background: rgba(220, 80, 80, 0.15);
  color: #e05555;
}

.trial-lock-badge.account-locked {
  background: rgba(91, 159, 212, 0.15);
  color: #5b9fd4;
}

.trial-row-closed {
  opacity: 0.85;
}

.app-display-options {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.65rem 0.55rem 0.85rem;
  background: var(--panel);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.display-option-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
}

.app-show-nav {
  position: fixed;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 30;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
}

html.compact-layout,
body.compact-layout {
  font-size: 9px;
}

html.compact-layout #appChrome {
  position: static;
  width: 100%;
  height: auto;
  border-right: none;
  border-bottom: 1px solid var(--border);
  overflow: visible;
}

html.compact-layout .app-content {
  margin-left: 0;
  width: 100%;
  max-width: 100%;
}

html.compact-layout #appChrome header.topbar {
  flex-direction: row;
  align-items: center;
}

html.compact-layout #appChrome .topbar h1 {
  font-size: 0.9rem;
}

html.compact-layout #appChrome .site-brand-header .site-logo {
  max-width: 5.5rem;
}

html.compact-layout #appChrome .topbar-actions {
  flex-direction: row;
  margin-top: 0;
}

html.compact-layout #appChrome .topbar-actions button {
  width: auto;
}

html.compact-layout .tabs {
  flex-direction: row;
  flex-wrap: wrap;
  flex: none;
  padding: 0.5rem 0.75rem;
  gap: 0.45rem;
}

html.compact-layout .tabs button {
  width: auto;
  text-align: center;
  flex: 1 1 auto;
}

html.compact-layout .nav-group-block {
  flex: 1 1 100%;
  flex-direction: column;
  gap: 0.35rem;
}

html.compact-layout .nav-group-block > button[data-nav-group] {
  width: 100%;
}

html.compact-layout .nav-group-block .sub-tabs {
  flex-direction: row;
  flex-wrap: wrap;
  margin-left: 0;
  padding-left: 0;
  border-left: none;
  border-top: 1px solid var(--border);
  padding-top: 0.35rem;
}

html.compact-layout .nav-group-block .sub-tabs button {
  flex: 1 1 auto;
  min-width: 5.5rem;
}

html.compact-layout main {
  max-width: none;
  margin: 0 0 1rem;
}

html.compact-layout .app-display-options {
  flex-direction: row;
  flex-wrap: wrap;
  margin-top: 0;
  padding: 0.35rem 0.75rem 0.5rem;
  border-top: none;
  border-bottom: 1px solid var(--border);
}

body.compact-layout .panel {
  margin: 0.25rem;
  padding: 0.5rem;
  border-radius: 10px;
}

body.compact-layout #trialBalanceSection {
  margin: 0;
  padding: 0.35rem 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
}

body.compact-layout #trialBalanceSection > h2,
body.compact-layout #trialBalanceSection > div[style] {
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

body.compact-layout #trialBalanceTable,
body.compact-layout #trialBalanceSummary,
body.compact-layout #trialStickyZone {
  width: 100%;
  max-width: 100%;
}

body.compact-layout #trialBalanceTable .trial-table-4col,
body.compact-layout #trialBalanceSummary .trial-table-4col {
  width: 100%;
  table-layout: fixed;
}

body.compact-layout .panel > h2 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

body.compact-layout .panel > h3 {
  font-size: 0.9rem;
  margin: 0.75rem 0 0.4rem;
}

body.compact-layout header.topbar {
  padding: 0.45rem 0.75rem;
}

body.compact-layout header.topbar h1 {
  font-size: 0.9rem;
}

body.compact-layout #userGreeting {
  font-size: 0.75rem;
}

body.compact-layout .tabs button {
  padding: 0.7rem 0.9rem;
  font-size: 1.15rem;
  min-height: 2.75rem;
  line-height: 1.2;
}

body.compact-layout .app-show-nav {
  padding: 0.65rem 0.95rem;
  font-size: 1.15rem;
  min-height: 2.75rem;
}

html.compact-layout #appChrome .topbar-actions button {
  padding: 0.65rem 0.9rem;
  font-size: 1.1rem;
  min-height: 2.75rem;
}

body.compact-layout .app-display-options,
body.compact-layout .display-option-label {
  font-size: 0.68rem;
  padding-top: 0.35rem;
  padding-bottom: 0.45rem;
  gap: 0.35rem 0.75rem;
}

body.compact-layout button,
body.compact-layout input,
body.compact-layout select {
  padding: 0.3rem 0.45rem;
  font-size: 0.68rem;
}

body.compact-layout label {
  font-size: 0.68rem;
  gap: 0.2rem;
}

body.compact-layout .trial-filter {
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

body.compact-layout .trial-filter button {
  padding: 0.7rem 0.9rem;
  font-size: 1.1rem;
  min-height: 2.75rem;
  width: 100%;
  min-width: 0;
}

body.compact-layout .trial-filter label {
  font-size: 1.05rem;
}

body.compact-layout .trial-filter input[type="month"] {
  font-size: 1.05rem;
  padding: 0.65rem 0.75rem;
  min-height: 2.75rem;
}

body.compact-layout .trial-display-options {
  font-size: 1rem;
  gap: 0.65rem 1rem;
}

body.compact-layout .trial-pin-label,
body.compact-layout .trial-compact-period-label {
  font-size: 1.05rem;
}

body.compact-layout .trial-pin-label input[type="checkbox"],
body.compact-layout .trial-pin-label input[type="radio"] {
  width: 1.2rem;
  height: 1.2rem;
}

body.compact-layout .trial-table,
body.compact-layout .entries-table,
body.compact-layout .budget-table {
  font-size: 0.62rem;
}

body.compact-layout .trial-table-4col tbody.trial-account-rows td.trial-amount,
body.compact-layout .trial-table-4col tbody.trial-account-rows td.trial-budget,
body.compact-layout #trialBalanceTotalsInline .trial-totals-table td.trial-amount,
body.compact-layout #trialBalanceTotalsInline .trial-totals-table td.trial-budget,
body.compact-layout .trial-table-4col tbody.trial-summary-rows td.trial-amount,
body.compact-layout .trial-table-4col tbody.trial-summary-rows td.trial-budget {
  font-size: 1.5rem !important;
  padding-top: 0.65rem !important;
  padding-bottom: 0.65rem !important;
}

body.compact-layout .trial-table-4col tbody.trial-account-rows .account-name,
body.compact-layout #trialBalanceTotalsInline .trial-totals-table .account-name,
body.compact-layout .trial-table-4col tbody.trial-summary-rows .account-name {
  font-size: 1.3rem;
}

body.compact-layout #trialBalanceTotalsInline .trial-totals-table thead th {
  font-size: 1.2rem;
  padding-top: 0.55rem !important;
  padding-bottom: 0.55rem !important;
}

body.compact-layout #trialBalanceSummary .trial-totals-table th,
body.compact-layout #trialBalanceSummary .trial-totals-table td {
  font-size: 1.1rem !important;
  padding-top: 0.4rem !important;
  padding-bottom: 0.4rem !important;
}

body.compact-layout #trialBalanceSummary .trial-totals-table .account-name {
  font-size: 1rem;
}

body.compact-layout #trialBalanceSummary .trial-totals-table thead th {
  font-size: 0.95rem !important;
  padding-top: 0.35rem !important;
  padding-bottom: 0.35rem !important;
}

body.compact-layout .trial-sticky-zone.has-pinned-totals #trialBalanceSummary .trial-totals-table thead {
  display: none;
}

/* Shared horizontal padding keeps pinned totals aligned with account rows below */
body.compact-layout .trial-table-4col th.trial-col-header,
body.compact-layout .trial-table-4col td.trial-amount,
body.compact-layout .trial-table-4col td.trial-budget {
  text-align: right !important;
  padding-left: 0.3rem !important;
  padding-right: 0.45rem !important;
  font-variant-numeric: tabular-nums;
}

body.compact-layout .trial-table-4col td:first-child {
  text-align: left;
  padding-left: 0.35rem !important;
  padding-right: 0.3rem !important;
}

body.compact-layout .trial-table-4col thead th {
  font-size: 1.2rem;
  padding-top: 0.55rem !important;
  padding-bottom: 0.55rem !important;
}

body.compact-layout.compact-period-mtd .trial-col-ytd,
body.compact-layout.compact-period-ytd .trial-col-mtd {
  display: none !important;
}

/* Hidden period columns still had col widths (~41% of table), leaving visible cols at ~60% */
body.compact-layout.compact-period-mtd .trial-table-4col col.trial-col-ytd,
body.compact-layout.compact-period-ytd .trial-table-4col col.trial-col-mtd {
  width: 0 !important;
  visibility: collapse;
}

body.compact-layout.compact-period-mtd .trial-table-4col col.trial-col-account,
body.compact-layout.compact-period-ytd .trial-table-4col col.trial-col-account {
  width: 34%;
}

body.compact-layout.compact-period-mtd .trial-table-4col col.trial-col-mtd.trial-col-actual,
body.compact-layout.compact-period-ytd .trial-table-4col col.trial-col-ytd.trial-col-actual {
  width: 22%;
}

body.compact-layout.compact-period-mtd .trial-table-4col col.trial-col-mtd.trial-col-budget-wide,
body.compact-layout.compact-period-ytd .trial-table-4col col.trial-col-ytd.trial-col-budget-wide {
  width: 44%;
}

body.compact-layout .trial-sticky-header {
  padding-left: 0;
  padding-right: 0;
}

.trial-compact-period {
  display: none;
}

body.compact-layout .trial-compact-period {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.trial-compact-period-label {
  color: var(--muted);
  font-size: 0.95rem;
}

body.compact-layout .trial-compact-period-label {
  font-size: 1rem;
}

body.compact-layout .trial-table th,
body.compact-layout .trial-table td,
body.compact-layout .entries-table th,
body.compact-layout .entries-table td,
body.compact-layout .budget-table th,
body.compact-layout .budget-table td {
  padding: 0.25rem 0.2rem !important;
}

body.compact-layout .entries-table input,
body.compact-layout .entries-table select {
  font-size: 1.05rem;
  padding: 0.65rem 0.75rem;
}

body.compact-layout .entries-table {
  display: block;
}

body.compact-layout .entries-table thead {
  display: none;
}

body.compact-layout .entries-table tbody {
  display: block;
}

body.compact-layout .entries-table tbody tr {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "date date"
    "account account"
    "debit credit"
    "description description"
    "remove remove";
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  margin-bottom: 0.85rem;
  background: rgba(0, 0, 0, 0.12);
  gap: 0.65rem;
}

body.compact-layout .entries-table tbody td {
  display: block;
  width: auto;
  padding: 0;
  border: none;
}

body.compact-layout .entries-table tbody td[data-label="Date"] {
  grid-area: date;
}

body.compact-layout .entries-table tbody td[data-label="Account"] {
  grid-area: account;
}

body.compact-layout .entries-table tbody td[data-label="Debit"] {
  grid-area: debit;
}

body.compact-layout .entries-table tbody td[data-label="Credit"] {
  grid-area: credit;
}

body.compact-layout .entries-table tbody td[data-label="Description"] {
  grid-area: description;
}

body.compact-layout .entries-table tbody td:last-child {
  grid-area: remove;
}

body.compact-layout .entries-table tbody td::before {
  content: attr(data-label);
  display: block;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

body.compact-layout .entries-table tbody td:last-child::before {
  content: none;
}

body.compact-layout .entry-remove-row {
  width: 100%;
}

body.compact-layout #entriesList {
  font-size: 1rem;
}

body.compact-layout .symbol {
  width: 0.65rem;
  font-size: 0.72rem;
  margin-right: 0.2rem;
}

body.compact-layout .account-name {
  font-size: 0.65rem;
}

body.compact-layout .trial-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  font-size: 0.65rem;
}

body.compact-layout .list .item {
  padding: 0.4rem 0.5rem;
  font-size: 0.68rem;
}

body.compact-layout .muted-note {
  font-size: 0.65rem;
  margin-bottom: 0.5rem;
}

body.compact-layout .entry-export-controls {
  margin: 0.5rem 0;
  gap: 0.35rem;
}

body.app-hide-nav #appChrome {
  display: none;
}

body.app-hide-nav .app-content {
  margin-left: 0;
}

body.app-hide-nav .panel {
  margin: 0.15rem;
  border-radius: 6px;
}

body.app-hide-nav #trialBalanceSection {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
}

body.app-hide-nav .trial-filter,
body.app-hide-nav #trialFilterInfo {
  display: none;
}

.link-button {
  margin-top: 0.75rem;
  width: 100%;
}

.trial-sticky-zone #trialBalanceSummary {
  display: none;
  background: var(--panel);
  padding: 0.1rem 0 0.35rem;
}

.trial-sticky-zone.has-pinned-totals #trialBalanceSummary {
  display: block;
}

.trial-totals-inline {
  margin-bottom: 0.35rem;
}

.trial-totals-table {
  margin-top: 0;
  margin-bottom: 0;
}

#trialBalanceSummary .trial-header,
#trialBalanceTotalsInline .trial-header,
.trial-totals-inline .trial-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.75rem;
  align-items: center;
  font-size: 0.84rem;
}

#trialBalanceSummary .trial-header .symbol,
#trialBalanceTotalsInline .trial-header .symbol,
.trial-totals-inline .trial-header .symbol {
  width: 0.8rem;
  font-size: 0.8rem;
  margin-right: 0.3rem;
}

.trial-totals-table.trial-table-4col th,
.trial-totals-table.trial-table-4col td {
  padding: 0.38rem 0.42rem !important;
  font-size: 0.84rem;
}

.trial-totals-table.trial-table-4col td:first-child {
  gap: 0.35rem;
}

.trial-totals-table.trial-table-4col .symbol {
  width: 0.8rem;
  font-size: 0.8rem;
  margin-right: 0.3rem;
}

.trial-filter {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0;
  align-items: end;
}

.entry-export-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin: 1rem 0;
}

.trial-filter label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.95rem;
}

.trial-filter button {
  min-width: 120px;
}

.trial-table tbody tr.clickable {
  cursor: pointer;
}

.trial-table tbody tr.clickable:hover {
  background: rgba(255, 255, 255, 0.06);
}

.history-row-clickable {
  cursor: pointer;
}

.history-row-clickable:hover {
  background: rgba(255, 255, 255, 0.06);
}

.history-edit-hint {
  margin: 0.35rem 0 0;
  grid-column: 1 / -1;
}

.trial-table td {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.account-detail {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.account-values {
  display: flex;
  align-items: center;
  gap: 1rem;
  white-space: nowrap;
}

.account-name {
  font-weight: 600;
}

.account-balance,
.account-budget {
  font-size: 0.95rem;
}

.account-balance {
  font-weight: 700;
  color: var(--text);
  min-width: 80px;
  text-align: right;
}

.account-budget {
  color: var(--muted);
  min-width: 80px;
  text-align: right;
}

.trial-table-4col {
  width: 100%;
  table-layout: fixed;
}

.trial-table-4col .trial-col-account {
  width: 38%;
}

.trial-table-4col .trial-col-amount {
  width: 15.5%;
}

.trial-table-4col th.trial-col-header,
.trial-table-4col td.trial-amount,
.trial-table-4col td.trial-budget {
  text-align: right;
}

.trial-table-4col td {
  display: table-cell !important;
  justify-content: auto !important;
  align-items: auto !important;
  gap: 0 !important;
  padding: 0.9rem 0.7rem !important;
  vertical-align: middle;
}

.trial-table-4col td:first-child {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  text-align: left;
}

.trial-table-4col td.trial-amount {
  font-weight: 700;
  color: var(--text);
}

.trial-table-4col td.trial-budget {
  font-weight: 600;
  color: var(--muted);
}

.trial-table-4col tbody.trial-summary-rows tr {
  border-top: 2px solid var(--border);
}

.trial-table-4col tbody.trial-summary-rows tr.trial-net-income-row {
  border-bottom: 2px solid #000;
}

.trial-table-4col tbody.trial-summary-rows tr.type-Asset td {
  background: rgba(40, 123, 222, 0.22);
}

.trial-table-4col tbody.trial-summary-rows tr.type-Liability td {
  background: rgba(208, 56, 58, 0.22);
}

.trial-table-4col tbody.trial-summary-rows tr.type-Equity td {
  background: rgba(124, 77, 255, 0.22);
}

.trial-table-4col tbody.trial-summary-rows tr.type-Revenue td {
  background: rgba(31, 138, 61, 0.22);
}

.trial-table-4col tbody.trial-summary-rows tr.type-Expense td {
  background: rgba(214, 164, 0, 0.22);
}

.trial-table-4col tbody.trial-summary-rows tr.trial-net-income-row td {
  background: rgba(255, 140, 0, 0.22);
}

.trial-table-4col tbody.trial-account-rows tr.type-Asset td {
  background: rgba(40, 123, 222, 0.12);
}

.trial-table-4col tbody.trial-account-rows tr.type-Liability td {
  background: rgba(208, 56, 58, 0.12);
}

.trial-table-4col tbody.trial-account-rows tr.type-Equity td {
  background: rgba(124, 77, 255, 0.12);
}

.trial-table-4col tbody.trial-account-rows tr.type-Revenue td {
  background: rgba(31, 138, 61, 0.12);
}

.trial-table-4col tbody.trial-account-rows tr.type-Expense td {
  background: rgba(214, 164, 0, 0.12);
}

.trial-table-4col tbody.trial-account-rows tr.clickable:hover td {
  filter: brightness(1.08);
}

.history-item div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.show-more-btn {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.75rem;
  text-align: center;
}

.entry-row-account {
  width: 100%;
  min-width: 140px;
}

.budget-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.budget-import-actions,
.entry-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.budget-import-hint {
  margin: 0;
}

body.compact-layout .import-format-note {
  font-size: 0.65rem;
  padding: 0.45rem 0.55rem;
}

body.compact-layout .import-format-note code {
  font-size: 0.6rem;
}

/* Soft background tints per account type to improve contrast */
.card-item.type-Asset { background: rgba(40,123,222,0.06); }
.card-item.type-Liability { background: rgba(208,56,58,0.06); }
.card-item.type-Equity { background: rgba(124,77,255,0.06); }
.card-item.type-Revenue { background: rgba(31,138,61,0.06); }
.card-item.type-Expense { background: rgba(214,164,0,0.06); }

.trial-table:not(.trial-table-4col) tbody tr.type-Asset td { background: rgba(40,123,222,0.04); }
.trial-table:not(.trial-table-4col) tbody tr.type-Liability td { background: rgba(208,56,58,0.04); }
.trial-table:not(.trial-table-4col) tbody tr.type-Equity td { background: rgba(124,77,255,0.04); }
.trial-table:not(.trial-table-4col) tbody tr.type-Revenue td { background: rgba(31,138,61,0.04); }
.trial-table:not(.trial-table-4col) tbody tr.type-Expense td { background: rgba(214,164,0,0.04); }

.message {
  color: var(--red);
  min-height: 1.4rem;
}

@media (max-width: 900px) {
  .trial-row,
  .budget-item,
  .entry-item {
    grid-template-columns: 1fr;
  }
}

.budget-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: flex-end;
}

.budget-controls label {
  display: grid;
  gap: 0.4rem;
}

.budget-spreadsheet {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
  overflow-x: auto;
  display: block;
}

.budget-spreadsheet thead {
  display: table;
  width: 100%;
  border-collapse: collapse;
}

.budget-spreadsheet tbody {
  display: block;
  max-height: 600px;
  overflow-y: auto;
}

.budget-spreadsheet tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.budget-spreadsheet th,
.budget-spreadsheet td {
  padding: 0.7rem;
  border: 1px solid var(--border);
  text-align: center;
  word-break: break-word;
  font-size: 0.85rem;
}

.budget-spreadsheet th {
  background: #353a42;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

.budget-spreadsheet td:first-child {
  text-align: left;
  min-width: 140px;
}

.budget-spreadsheet th:first-child {
  text-align: left;
}

.budget-cell {
  width: 100%;
  border: 1px solid var(--border);
  padding: 0.5rem;
  text-align: right;
  border-radius: 4px;
  font-size: 0.8rem;
}

.budget-row-total {
  font-weight: 600;
  background: rgba(40,123,222,0.05);
}

.budget-row-Asset td { background: rgba(40,123,222,0.02); }
.budget-row-Liability td { background: rgba(208,56,58,0.02); }
.budget-row-Equity td { background: rgba(124,77,255,0.02); }
.budget-row-Revenue td { background: rgba(31,138,61,0.02); }
.budget-row-Expense td { background: rgba(214,164,0,0.02); }

.report-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.report-compare-budget-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.35rem;
}

.calculator-block {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.calculator-block:last-child {
  border-bottom: none;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
}

.calculator-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.calculator-table-wrap {
  overflow-x: auto;
  max-height: min(70vh, 640px);
  overflow-y: auto;
}

#amortTable,
#loanScheduleTable {
  font-size: 0.78rem;
}

#amortTable th,
#amortTable td,
#loanScheduleTable th,
#loanScheduleTable td {
  padding: 0.18rem 0.28rem;
  line-height: 1.15;
  vertical-align: middle;
  white-space: nowrap;
}

#amortTable input[type="number"],
#loanScheduleBody input[type="number"],
#loanScheduleBody input[type="date"] {
  width: 5.5rem;
  max-width: 100%;
  min-height: 1.35rem;
  height: 1.35rem;
  padding: 0.1rem 0.25rem;
  font-size: 0.78rem;
  line-height: 1.1;
  box-sizing: border-box;
}

#loanScheduleBody input[type="date"] {
  width: 7.25rem;
}

.loan-schedule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  align-items: center;
}

.loan-schedule-actions button {
  padding: 0.12rem 0.4rem;
  font-size: 0.72rem;
  line-height: 1.2;
  min-height: 0;
}

.loan-schedule-actions .muted-note {
  font-size: 0.7rem;
}

.tvm-grid {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: 640px;
  margin-top: 0.75rem;
}

.tvm-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(120px, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.tvm-spacer {
  width: 5.5rem;
}

.loans-rebuild-schedule-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  grid-column: 1 / -1;
}

#loansRebuildScheduleNote {
  grid-column: 1 / -1;
  margin-top: -0.35rem;
}

.loan-schedule-panel {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.loan-schedule-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.loan-schedule-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 640px) {
  .tvm-row {
    grid-template-columns: 1fr;
  }

  .tvm-spacer {
    display: none;
  }
}

.report-output {
  margin: 1rem 0;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.report-table td,
.report-table th {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.report-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.report-variance-green {
  color: var(--green);
}

.report-variance-yellow {
  color: var(--yellow);
}

.report-variance-blue {
  color: var(--blue);
}

.report-variance-red {
  color: var(--red);
}

.report-variance-neutral {
  color: var(--muted);
}

.report-variance {
  white-space: nowrap;
}

.report-variance-value {
  display: inline-block;
  min-width: 4.5rem;
  text-align: right;
}

.report-variance-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  margin-left: 0.35rem;
  font-weight: 700;
  line-height: 1;
}

.report-variance-icon-ok {
  color: var(--green);
}

.report-variance-icon-caution {
  color: var(--yellow);
}

.report-variance-icon-critical {
  color: var(--red);
}

.report-show-variance-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.report-variance-tolerance-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.report-variance-tolerance-label input {
  width: 4.5rem;
}

.report-subtotal td {
  font-weight: 700;
}

.report-total td {
  font-weight: 700;
  border-top: 2px solid var(--border);
}

.report-title-row td {
  padding-top: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
}

.report-chart-wrap {
  max-width: 640px;
  margin: 1rem 0 2rem;
}

.report-chart-wrap.report-bar-chart-wrap {
  max-width: min(960px, 100%);
  margin: 1.25rem 0 2rem;
}

.report-chart-wrap.report-bar-chart-wrap canvas {
  min-height: 280px;
}

.report-trend-chart-wrap {
  max-width: 720px;
}

.report-trend-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.subledger-batch-select {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.custom-col-specific-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.custom-report-builder {
  overflow: hidden;
}

.custom-report-lines-wrap {
  overflow-x: auto;
  max-width: 100%;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.custom-report-lines-table {
  font-size: 0.75rem;
  table-layout: fixed;
  width: 100%;
  min-width: 680px;
  margin-bottom: 0;
}

.custom-report-lines-table th,
.custom-report-lines-table td {
  padding: 0.3rem 0.35rem;
  vertical-align: middle;
  overflow: hidden;
}

.custom-report-lines-table th:nth-child(1),
.custom-report-lines-table td:nth-child(1) {
  width: 1.75rem;
}

.custom-report-lines-table th:nth-child(2),
.custom-report-lines-table td:nth-child(2) {
  width: 5.5rem;
}

.custom-report-lines-table th:nth-child(3),
.custom-report-lines-table td:nth-child(3) {
  width: 5.5rem;
}

.custom-report-lines-table th:nth-child(4),
.custom-report-lines-table th:nth-child(5),
.custom-report-lines-table th:nth-child(6),
.custom-report-lines-table th:nth-child(7),
.custom-report-lines-table th:nth-child(8),
.custom-report-lines-table td:nth-child(4),
.custom-report-lines-table td:nth-child(5),
.custom-report-lines-table td:nth-child(6),
.custom-report-lines-table td:nth-child(7),
.custom-report-lines-table td:nth-child(8) {
  width: 6.5rem;
}

.custom-report-lines-table th:nth-child(9),
.custom-report-lines-table td:nth-child(9) {
  width: 3.5rem;
}

.custom-report-lines-table input,
.custom-report-lines-table select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  font-size: 0.72rem;
  padding: 0.2rem 0.3rem;
  box-sizing: border-box;
}

.custom-report-lines-table .expr-input-wrap {
  min-width: 0;
  max-width: 100%;
  gap: 0.2rem;
}

.custom-report-lines-table .expr-input-wrap input {
  flex: 1;
  min-width: 0;
}

.custom-report-lines-table .custom-line-main-cell {
  min-width: 0;
}

.custom-report-lines-table .custom-line-inline-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
}

.custom-report-lines-table .custom-line-level {
  width: 2.5rem;
  padding: 0.2rem;
}

.custom-report-lines-table .custom-line-preset {
  width: 100%;
  font-size: 0.72rem;
}

.custom-report-lines-table td.custom-line-field-hidden {
  opacity: 0.35;
  pointer-events: none;
}

.custom-report-lines-table .expr-input-wrap .custom-line-pick-accounts {
  flex-shrink: 0;
  font-size: 0.62rem;
  padding: 0.15rem 0.2rem;
}

.report-drag-cell {
  width: 2rem;
  text-align: center;
  vertical-align: middle;
}

.investment-summary {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.investment-balance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.investment-balance-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.investment-unrealized {
  font-weight: 600;
}

.subledger-action-info {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.subledger-action-info p {
  margin: 0.25rem 0;
}

.subledger-entry-review-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(76, 175, 106, 0.08);
}

.subledger-entry-review-text {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.investment-balance-field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.investment-month-market,
.investment-month-basis {
  width: 7rem;
}

.subledger-month-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.subledger-month-nav {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.subledger-review-entry-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.subledger-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.subledger-help-note {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
}

.subledger-form-wrap {
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.subledger-list {
  margin-top: 0.35rem;
}

.subledger-hidden-note {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.subledger-hide-if-zero-btn.active {
  border-color: var(--accent, #4a90d9);
  color: var(--accent, #4a90d9);
  background: rgba(74, 144, 217, 0.12);
}

.subledger-card.card-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.4rem;
  grid-template-columns: unset;
}

.subledger-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 1.85rem;
}

.subledger-drag-handle {
  cursor: grab;
  user-select: none;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.15rem 0.25rem;
  flex-shrink: 0;
}

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

.subledger-card.subledger-card-dragging {
  opacity: 0.55;
}

.subledger-card.subledger-card-drop-above {
  box-shadow: inset 0 2px 0 var(--accent, #6b9fff);
}

.subledger-row-body {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  flex-wrap: nowrap;
  overflow: hidden;
  text-align: left;
}

.subledger-row-name {
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: left;
}

.subledger-row-meta {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.subledger-inline-edit {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.3rem;
  flex-shrink: 0;
  font-size: 0.78rem;
}

.subledger-inline-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.subledger-inline-edit input {
  width: 5.25rem;
  padding: 0.12rem 0.35rem;
  font-size: 0.82rem;
  text-align: left;
}

.subledger-inline-edit button {
  font-size: 0.68rem;
  padding: 0.12rem 0.38rem;
  white-space: nowrap;
}

.subledger-row-balance {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 6.5rem;
  text-align: right;
  justify-self: end;
  font-size: 0.95rem;
}

.subledger-card .card-item-actions {
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 0.25rem;
  overflow-x: auto;
  padding-top: 0.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  width: 100%;
}

.subledger-card .card-item-actions button {
  font-size: 0.7rem;
  padding: 0.16rem 0.4rem;
  white-space: nowrap;
}

.subledger-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
  align-items: center;
}

.subledger-upload-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}

.subledger-upload-label input[type="file"] {
  display: none;
}

.subledger-month-balance-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  margin-top: 0.35rem;
}

.subledger-month-balance-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.85rem;
}

.subledger-month-balance-field input {
  width: 8rem;
}

.investment-card .subledger-row-body {
  overflow-x: auto;
  scrollbar-width: thin;
}

.investment-card .card-item-actions {
  flex-wrap: nowrap;
}

.subledger-total-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-top: 2px solid var(--border);
  font-weight: 700;
  text-align: left;
}

.subledger-total-row .subledger-row-balance,
.subledger-total-row .subledger-balance {
  min-width: 6.5rem;
  text-align: right;
  justify-self: end;
}

.report-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  cursor: grab;
  color: var(--muted);
  user-select: none;
  letter-spacing: -0.15em;
  font-weight: 700;
  touch-action: none;
}

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

.report-row-dragging {
  opacity: 0.55;
}

.report-row-drop-above {
  box-shadow: inset 0 2px 0 var(--blue);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.expr-input-wrap {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  min-width: 10rem;
}

.expr-input-wrap .custom-line-expr {
  flex: 1;
  min-width: 5rem;
}

.expr-input-wrap .custom-line-pick-accounts {
  flex-shrink: 0;
  font-size: 0.75rem;
  padding: 0.25rem 0.4rem;
}

.account-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
}

.account-picker-dialog {
  width: min(520px, 100%);
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.account-picker-dialog h3 {
  margin: 0;
}

.account-picker-search {
  width: 100%;
}

.account-picker-list {
  overflow-y: auto;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.account-picker-item {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.account-picker-item.selected {
  border-color: #4caf6a;
  background: rgba(76, 175, 106, 0.15);
}

.account-picker-gl {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.account-picker-type {
  font-size: 0.78rem;
  color: var(--muted);
}

.account-picker-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.subledger-card .subledger-status,
.subledger-card .subledger-posted {
  font-size: 0.75rem;
  flex-shrink: 0;
}

.subledger-balance {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.subledger-detail {
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.subledger-status {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

.subledger-posted {
  font-size: 0.82rem;
  color: #8fd4a0;
  font-weight: 600;
}

.subledger-panel .grid-form label {
  min-width: 12rem;
}

.account-cash-field-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}

.account-flag-btn {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.45rem;
  min-width: 4.5rem;
}

.account-flag-btn.account-category-btn {
  min-width: 6.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
}

.ratios-table .muted-note {
  font-size: 0.88rem;
}

.account-flag-btn.account-category-btn.active {
  background: rgba(76, 175, 106, 0.22);
  border-color: #4caf6a;
  color: #8fd4a0;
}

.account-flag-btn.account-category-btn.equity-contributed {
  background: rgba(155, 124, 255, 0.22);
  border-color: var(--purple);
  color: #c4b0ff;
}

.account-flag-btn.account-category-btn.equity-earned {
  background: rgba(76, 175, 106, 0.22);
  border-color: #4caf6a;
  color: #8fd4a0;
}

.account-flag-btn.account-category-btn.equity-adjustments {
  background: rgba(230, 180, 34, 0.18);
  border-color: var(--yellow);
  color: #f0d878;
}

.account-flag-btn.account-category-btn.asset-cash {
  background: rgba(74, 158, 255, 0.22);
  border-color: var(--blue);
  color: #9fd0ff;
}

.account-flag-btn.account-category-btn.asset-current {
  background: rgba(76, 175, 106, 0.22);
  border-color: #4caf6a;
  color: #8fd4a0;
}

.account-flag-btn.account-category-btn.asset-non-current {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.obligations-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.obligation-amount {
  font-weight: 700;
  min-width: 6rem;
  text-align: right;
}

.obligation-paid-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
}

.report-split-categories-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.accounts-service-org-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.custom-report-instructions {
  margin: 0.75rem 0 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.92rem;
  line-height: 1.5;
}

.custom-report-instructions ol {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.custom-report-instructions ul {
  margin: 0.35rem 0 0.35rem;
  padding-left: 1.25rem;
}

.custom-report-instructions li + li {
  margin-top: 0.45rem;
}

.report-print-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}

.report-print-logo {
  height: 48px;
  width: auto;
}

.report-print-heading h3 {
  margin: 0;
  font-size: 1.35rem;
}

.report-print-subtitle {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

@media print {
  body.printing-report * {
    visibility: hidden;
  }

  body.printing-report #reportPrintArea,
  body.printing-report #reportPrintArea * {
    visibility: visible;
  }

  body.printing-report #reportPrintArea {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 0.5in;
    box-sizing: border-box;
    color: #000;
    background: #fff;
  }

  body.printing-report #reportPrintArea .report-print-header {
    border-bottom-color: #333;
  }

  body.printing-report #reportPrintArea .report-print-subtitle {
    color: #444;
  }

  body.printing-report #reportPrintArea h4 {
    margin: 1rem 0 0.35rem;
    font-size: 11pt;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #333;
  }

  body.printing-report #reportPrintArea .report-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
    font-size: 10pt;
  }

  body.printing-report #reportPrintArea .report-table td,
  body.printing-report #reportPrintArea .report-table th {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid #ccc;
  }

  body.printing-report #reportPrintArea .report-total td {
    border-top: 2px solid #333;
  }

  body.printing-report #reportPrintArea .report-amount {
    text-align: right;
    white-space: nowrap;
  }

  @page {
    margin: 0.75in;
  }
}
