/* Renteria Capital design tokens used by Prewind and custom components. */

@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");

:root {
  /* Existing brand palette */
  --navy-950: #041225;
  --navy-900: #071a33;
  --navy-800: #0c294d;
  --gold-500: #c89b3c;
  --gold-400: #ddb85f;
  --ivory-100: #fbf8f1;
  --ivory-200: #f3ecdf;
  --ink-900: #101828;
  --ink-600: #475467;

  /* Fonts */
  --font-body: "Inter", system-ui, sans-serif;
  --font-heading: Georgia, "Times New Roman", serif;
  --font-normal: 400;
  --font-semibold: 600;
  --font-bold: 700;

  /* Prewind brand colors */
  --brand-1: var(--gold-500);
  --brand-1-content: var(--navy-950);
  --brand-1-light: #f7eed5;
  --brand-2: var(--navy-900);
  --brand-2-light: #dbe4ee;
  --brand-3: var(--navy-800);
  --brand-3-light: #d6e2ee;
  --brand-4: var(--gold-400);
  --brand-4-light: #fbf3dc;

  /* Neutral colors */
  --black: #101828;
  --darker: #344054;
  --dark: var(--ink-600);
  --midtone: #667085;
  --light: #d0d5dd;
  --lighter: #f2f4f7;
  --white: #ffffff;

  /* Semantic colors */
  --success: #16803c;
  --success-light: #dcfce7;
  --info: #175cd3;
  --info-light: #dbeafe;
  --warning: #b54708;
  --warning-light: #fef0c7;
  --error: #b42318;
  --error-light: #fee4e2;
  --link: #175cd3;
  --highlight: #fef3c7;

  /* Borders and outlines */
  --border: 1px;
  --border-sm: 0.5px;
  --border-lg: 2px;

  /* Border radius */
  --rounded: 0.625rem;
  --rounded-sm: 0.25rem;
  --rounded-lg: 1rem;
  --rounded-full: 9999px;

  /* Shadows */
  --shadow: 0 4px 4px 1px rgb(0 0 0 / 15%), 0 2px 4px -2px rgb(0 0 0 / 25%);
  --shadow-sm: 0 2px 3px -0.5px rgb(0 0 0 / 10%), 0 1px 2px -1px rgb(0 0 0 / 10%);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 10%), 0 4px 6px -4px rgb(0 0 0 / 10%);

  /* Content constraints */
  --max-w-text: 80ch;
  --max-w-form: 40rem;
  --container-max: 1400px;
  --container-padding: 0 var(--space-md);

  /* Fluid type scale */
  --text-sm: clamp(0.8333rem, 0.7917rem + 0.2083vw, 1rem);
  --text-base: clamp(1rem, 0.9375rem + 0.3125vw, 1.25rem);
  --text-lg: clamp(1.2rem, 1.109rem + 0.4531vw, 1.563rem);
  --text-xl: clamp(1.44rem, 1.312rem + 0.6414vw, 1.953rem);
  --text-2xl: clamp(1.728rem, 1.55rem + 0.8918vw, 2.441rem);
  --text-3xl: clamp(2.074rem, 1.829rem + 1.223vw, 3.052rem);
  --text-4xl: clamp(2.488rem, 2.157rem + 1.658vw, 3.815rem);

  /* Fluid spacing scale */
  --space-3xs: clamp(0.2222rem, 0.2171rem + 0.0258vw, 0.2429rem);
  --space-2xs: clamp(0.3333rem, 0.3155rem + 0.0894vw, 0.4048rem);
  --space-xs: clamp(0.5rem, 0.4563rem + 0.2186vw, 0.6749rem);
  --space-sm: clamp(0.75rem, 0.6562rem + 0.4688vw, 1.125rem);
  --space-md: clamp(1.125rem, 0.9374rem + 0.938vw, 1.875rem);
  --space-lg: clamp(1.688rem, 1.328rem + 1.798vw, 3.126rem);
  --space-xl: clamp(2.531rem, 1.861rem + 3.35vw, 5.211rem);
  --space-2xl: clamp(3.797rem, 2.574rem + 6.113vw, 8.688rem);
  --space-3xl: clamp(5.695rem, 3.499rem + 10.98vw, 14.48rem);
  --space-4xl: clamp(8.543rem, 4.643rem + 19.5vw, 24.14rem);
}

body {
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
}

.pwa-status-banner {
  position: fixed;
  z-index: 1000;
  right: max(var(--space-sm), env(safe-area-inset-right));
  bottom: max(var(--space-sm), env(safe-area-inset-bottom));
  left: max(var(--space-sm), env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  border: var(--border) solid var(--light);
  border-radius: var(--rounded);
  padding: var(--space-xs) var(--space-sm);
  box-shadow: var(--shadow-lg);
}

.pwa-status-banner[hidden] {
  display: none;
}

.pwa-update-banner {
  background: var(--navy-900);
  color: var(--white);
}

.pwa-update-banner button {
  border: 0;
  border-radius: var(--rounded-sm);
  padding: var(--space-2xs) var(--space-xs);
  background: var(--gold-500);
  color: var(--navy-950);
  font: inherit;
  font-weight: var(--font-bold);
  cursor: pointer;
}

.pwa-offline-banner {
  background: var(--warning-light);
  color: var(--warning);
}

.receipt-thumbnail {
  width: 100%;
  height: 6rem;
}

.financial-number {
  font-variant-numeric: tabular-nums;
}

.assistant-composer {
  position: static;
  z-index: 10;
}

.assistant-workspace {
  display: grid;
  gap: var(--space-sm);
  min-height: 0;
}

.assistant-conversation-list {
  max-height: 15rem;
}

.assistant-chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 38rem;
  overflow: hidden;
}

.assistant-turns-scroll {
  flex: 1;
  min-height: 12rem;
  max-height: 55vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.assistant-receipt-details summary {
  cursor: pointer;
}

.receipt-capture-preview {
  width: 4rem;
  height: 4rem;
}

.receipt-upload-open {
  overflow: hidden;
}

.receipt-upload-dialog {
  width: min(calc(100% - 2rem), 36rem);
  max-width: none;
  max-height: min(90dvh, 48rem);
  margin: auto;
  border: var(--border) solid var(--light);
  border-radius: var(--rounded-lg);
  padding: 0;
  background: var(--white);
  color: var(--black);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.receipt-upload-dialog::backdrop {
  background: rgb(7 26 51 / 70%);
  backdrop-filter: blur(2px);
}

.receipt-upload-form {
  display: flex;
  flex-direction: column;
  max-height: min(90dvh, 48rem);
}

.receipt-upload-body {
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-md);
  overflow-y: auto;
}

.receipt-upload-close {
  flex: none;
  width: 2rem;
  height: 2rem;
  border: var(--border) solid var(--light);
  border-radius: var(--rounded-full);
  background: var(--white);
  color: var(--brand-2);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.receipt-upload-picker {
  border: var(--border) dashed var(--light);
  border-radius: var(--rounded);
  padding: var(--space-sm);
}

.receipt-upload-selection {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  border-top: var(--border) solid var(--light);
  padding-top: var(--space-sm);
}

.receipt-upload-selection[hidden] {
  display: none;
}

.receipt-upload-preview {
  width: 4rem;
  height: 4rem;
  flex: none;
  border-radius: var(--rounded-sm);
  background: var(--lighter);
  object-fit: cover;
}

.receipt-upload-steps {
  display: grid;
  gap: var(--space-2xs);
  padding-left: 1.25rem;
  list-style: decimal;
}

.receipt-camera-open {
  overflow: hidden;
}

.receipt-camera-overlay {
  position: fixed;
  z-index: 1100;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  background: var(--black);
}

.receipt-camera-overlay[hidden] {
  display: none;
}

.receipt-camera-header-spacer {
  width: 4.5rem;
}

.receipt-camera-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--black);
}

.receipt-camera-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.receipt-camera-guide {
  position: absolute;
  inset: 8% 6%;
  border: var(--border-lg) solid rgb(255 255 255 / 75%);
  border-radius: var(--rounded);
  pointer-events: none;
}

.receipt-camera-instruction {
  position: absolute;
  right: var(--space-sm);
  bottom: var(--space-sm);
  left: var(--space-sm);
  border-radius: var(--rounded-full);
  padding: var(--space-2xs) var(--space-sm);
  background: rgb(0 0 0 / 70%);
  color: var(--white);
  text-align: center;
  font-size: var(--text-sm);
}

.receipt-camera-shutter {
  width: 4.5rem;
  height: 4.5rem;
  border: 0.35rem solid var(--white);
  border-radius: var(--rounded-full);
  background: var(--brand-1);
  box-shadow: inset 0 0 0 0.2rem var(--black);
}

.app-sidebar-mobile-header {
  cursor: pointer;
}

.app-sidebar-workspace-label {
  font-size: 0.75rem;
  line-height: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.app-sidebar-chevron {
  transition: transform 150ms ease;
}

.app-sidebar-toggle-input:checked + .app-sidebar-mobile-header .app-sidebar-chevron {
  transform: rotate(180deg);
}

.receipt-status-dot {
  width: 0.5rem;
  height: 0.5rem;
  background-color: currentColor;
}

.receipt-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.receipt-summary-primary {
  grid-column: 1 / -1;
}

.receipt-summary-stat {
  border-top: var(--border) solid var(--light);
}

.receipt-summary-stat:nth-child(odd) {
  border-left: var(--border) solid var(--light);
}

.graph-horizontal-bar {
  display: block;
  width: 100%;
  height: 0.5rem;
}

.graph-bar-track {
  fill: var(--lighter);
}

.graph-bar-fill {
  fill: var(--brand-1);
}

.graph-bar-fill-secondary {
  fill: var(--brand-3);
}

.graph-monthly-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(5.5rem, 1fr));
  gap: var(--space-sm);
  min-width: 38rem;
}

.graph-month-column {
  display: block;
  width: 100%;
  height: 8rem;
}

@media (min-width: 40rem) {
  .pwa-status-banner {
    left: auto;
    max-width: 32rem;
  }

  .receipt-thumbnail {
    width: 6rem;
  }
}

@media (min-width: 64rem) {
  .assistant-main {
    height: 100vh;
    overflow: hidden;
  }

  .assistant-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .assistant-workspace {
    grid-template-columns: 14rem minmax(0, 1fr);
    align-items: stretch;
    flex: 1;
  }

  .assistant-conversation-rail,
  .assistant-chat-panel {
    height: 100%;
  }

  .assistant-conversation-list,
  .assistant-turns-scroll {
    max-height: none;
  }

  .assistant-chat-panel {
    min-height: 0;
  }

  .receipt-summary-grid {
    grid-template-columns: minmax(14rem, 2fr) repeat(4, minmax(7rem, 1fr));
  }

  .receipt-summary-primary {
    grid-column: auto;
  }

  .receipt-summary-stat,
  .receipt-summary-stat:nth-child(odd) {
    border-top: 0;
    border-left: var(--border) solid var(--light);
  }

  .app-sidebar-menu,
  .app-sidebar-content {
    display: flex !important;
    flex: 1;
    flex-direction: column;
  }

  .app-sidebar-mobile-header {
    display: none;
  }

  .app-sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
  }
}

@media (max-width: 39.999rem) {
  .receipt-ledger {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .receipt-ledger table,
  .receipt-ledger tbody {
    display: block;
  }

  .receipt-ledger thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    clip-path: inset(50%);
  }

  .receipt-ledger-row {
    display: grid;
    grid-template-areas:
      "merchant amount"
      "date status";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-xs) var(--space-sm);
    margin-bottom: var(--space-xs);
    border: var(--border) solid var(--light);
    border-radius: var(--rounded);
    padding: var(--space-sm);
    background: var(--white);
    box-shadow: var(--shadow-sm);
  }

  .receipt-ledger-row > * {
    padding: 0;
  }

  .receipt-ledger-merchant {
    grid-area: merchant;
  }

  .receipt-ledger-amount {
    grid-area: amount;
    align-self: start;
  }

  .receipt-ledger-date {
    grid-area: date;
    align-self: center;
  }

  .receipt-ledger-status {
    grid-area: status;
    align-self: center;
    text-align: right;
  }
}

@media (max-width: 63.999rem) {
  .app-sidebar {
    position: sticky;
    z-index: 50;
    top: 0;
  }

  .app-sidebar-menu,
  .app-sidebar-content {
    width: 100%;
  }

  .app-sidebar-content {
    border-top: var(--border) solid var(--brand-3);
  }

  .app-sidebar-toggle-input:not(:checked) ~ .app-sidebar-content {
    display: none;
  }
}

/* Dense financial workspace shared by the dashboard, receipt inbox and graphs. */

.finance-main {
  min-height: 100vh;
  background: var(--lighter);
}

.finance-toolbar,
.finance-flash,
.finance-utility-bar,
.finance-section-heading {
  padding: 0.625rem 0.75rem;
}

.finance-page {
  width: 100%;
  padding: 0.75rem;
}

.finance-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.finance-summary-cell {
  min-width: 0;
  border-right: var(--border) solid var(--light);
  border-bottom: var(--border) solid var(--light);
  padding: 0.55rem 0.75rem;
}

.finance-summary-cell:nth-child(even) {
  border-right: 0;
}

.finance-summary-cell:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.finance-summary-label {
  overflow: hidden;
  color: var(--midtone);
  font-size: 0.68rem;
  font-weight: var(--font-bold);
  letter-spacing: 0.035em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.finance-summary-value {
  margin-top: 0.2rem;
  overflow: hidden;
  font-size: 1.05rem;
  font-weight: var(--font-bold);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-summary-link {
  display: inline-block;
  margin-top: 0.2rem;
  color: var(--link);
  font-size: 0.72rem;
  font-weight: var(--font-semibold);
  text-decoration: none;
}

.finance-summary-link:hover {
  text-decoration: underline;
}

.finance-table-shell {
  border-bottom: var(--border) solid var(--light);
}

.compact-finance-table {
  width: 100%;
  min-width: 58rem;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
  line-height: 1.25;
}

.compact-finance-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  border-right: var(--border) solid var(--light);
  border-bottom: var(--border) solid var(--light);
  padding: 0.4rem 0.5rem;
  background: var(--lighter);
  color: var(--midtone);
  font-size: 0.67rem;
  font-weight: var(--font-bold);
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.compact-finance-table tbody th,
.compact-finance-table tbody td {
  border-right: var(--border) solid var(--lighter);
  border-bottom: var(--border) solid var(--light);
  padding: 0.4rem 0.5rem;
  background: var(--white);
  color: var(--dark);
  font-weight: var(--font-normal);
  text-align: left;
  vertical-align: middle;
}

.compact-finance-table tbody tr:hover > * {
  background: var(--brand-4-light);
}

.compact-finance-table .finance-description {
  min-width: 14rem;
}

.compact-finance-table .text-right {
  text-align: right;
}

.finance-empty {
  padding: 2rem 1rem !important;
  text-align: center !important;
}

.graph-analysis-grid {
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 64rem) {
  .finance-workspace .app-sidebar {
    width: 13.5rem;
    padding: 0.75rem;
  }

  .finance-workspace .app-sidebar-content {
    gap: 0.75rem;
  }

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

  .finance-summary-cell,
  .finance-summary-cell:nth-child(even),
  .finance-summary-cell:nth-last-child(-n + 2) {
    border-right: var(--border) solid var(--light);
    border-bottom: 0;
  }

  .finance-summary-cell:last-child {
    border-right: 0;
  }

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

@media (max-width: 39.999rem) {
  .finance-toolbar,
  .finance-flash,
  .finance-utility-bar,
  .finance-section-heading,
  .finance-page {
    padding-right: 0.5rem;
    padding-left: 0.5rem;
  }
}

/* Compact ledger workspace. Prewind supplies the colors and typography; these
   rules cover the dense table, sticky header and responsive table-to-card flow. */

.ledger-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--lighter);
}

.ledger-toolbar,
.ledger-notice,
.ledger-filters {
  padding: 0.625rem 0.75rem;
}

.ledger-quick-add-grid {
  display: grid;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
}

.ledger-quick-panel {
  border: var(--border) solid var(--light);
  border-radius: var(--rounded-sm);
  background: var(--white);
}

.ledger-quick-summary {
  padding: 0.375rem 0.5rem;
  cursor: pointer;
  user-select: none;
}

.ledger-quick-panel[open] .ledger-quick-summary {
  border-bottom: var(--border) solid var(--light);
  background: var(--lighter);
}

.ledger-quick-form,
.ledger-entry-form,
.payment-account-quick-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
  padding: 0.5rem;
}

.ledger-field-label {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--midtone);
  font-size: 0.7rem;
  font-weight: var(--font-bold);
  letter-spacing: 0.025em;
  line-height: 1.1;
  text-transform: uppercase;
}

.ledger-control {
  display: block;
  width: 100%;
  height: 2rem;
  border: var(--border) solid var(--light);
  border-radius: var(--rounded-sm);
  padding: 0.25rem 0.45rem;
  background: var(--white);
  color: var(--black);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.2;
}

.ledger-control:focus {
  border-color: var(--brand-1);
  outline: var(--border-lg) solid var(--brand-1-light);
}

.ledger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  border: var(--border) solid transparent;
  border-radius: var(--rounded-sm);
  padding: 0.25rem 0.65rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: var(--font-bold);
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.ledger-button-primary {
  border-color: var(--brand-2);
  background: var(--brand-2);
  color: var(--white);
}

.ledger-button-primary:hover {
  background: var(--brand-3);
}

.ledger-button-secondary {
  border-color: var(--light);
  background: var(--white);
  color: var(--brand-2);
}

.ledger-form-errors {
  grid-column: 1 / -1;
  border: var(--border) solid var(--error);
  border-radius: var(--rounded-sm);
  padding: 0.35rem 0.5rem;
  background: var(--error-light);
  color: var(--error);
  font-size: 0.75rem;
}

.ledger-form-errors ul {
  margin-top: 0.2rem;
  padding-left: 1rem;
}

.ledger-filter-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
}

.financial-date-fields {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
}

.financial-custom-date-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.financial-custom-date-fields[hidden] {
  display: none;
}

.financial-date-filter {
  padding: 0.625rem 0.75rem;
}

.financial-date-filter-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
}

.account-ledger-summary {
  padding: 0.5rem 0.75rem;
}

.account-ledger-summary dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border: var(--border) solid var(--light);
}

.account-ledger-summary dl > div {
  min-width: 0;
  border-bottom: var(--border) solid var(--light);
  padding: 0.45rem 0.6rem;
}

.account-ledger-summary dl > div:last-child {
  border-bottom: 0;
}

.account-ledger-summary dt {
  color: var(--midtone);
  font-size: 0.67rem;
  font-weight: var(--font-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.account-ledger-summary dd {
  margin-top: 0.15rem;
  color: var(--brand-2);
  font-size: 0.9rem;
  font-weight: var(--font-bold);
}

.account-ledger-summary dl span:not(.ledger-kind) {
  display: block;
  margin-top: 0.1rem;
  color: var(--midtone);
  font-size: 0.7rem;
}

.ledger-filter-actions {
  min-height: 2rem;
}

.payment-accounts-table {
  min-width: 48rem;
}

.ledger-table-shell {
  flex: 1;
  min-height: 15rem;
  overflow: auto;
  background: var(--white);
  scrollbar-gutter: stable;
}

.ledger-table {
  width: 100%;
  min-width: 64rem;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
  line-height: 1.25;
}

.ledger-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  border-right: var(--border) solid var(--light);
  border-bottom: var(--border) solid var(--light);
  padding: 0.4rem 0.5rem;
  background: var(--lighter);
  color: var(--midtone);
  font-size: 0.67rem;
  font-weight: var(--font-bold);
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.ledger-table tbody th,
.ledger-table tbody td {
  border-right: var(--border) solid var(--lighter);
  border-bottom: var(--border) solid var(--light);
  padding: 0.38rem 0.5rem;
  background: var(--white);
  color: var(--dark);
  font-weight: var(--font-normal);
  text-align: left;
  vertical-align: middle;
}

.ledger-table tbody tr:hover > th,
.ledger-table tbody tr:hover > td {
  background: var(--brand-4-light);
}

.ledger-table .ledger-number {
  text-align: right;
  white-space: nowrap;
}

.ledger-description {
  width: 24%;
  min-width: 13rem;
}

.ledger-description-text,
.ledger-memo {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-description-text {
  color: var(--brand-2);
  font-weight: var(--font-semibold);
}

.ledger-memo {
  max-width: 24rem;
  margin-top: 0.1rem;
  color: var(--midtone);
  font-size: 0.7rem;
}

.ledger-kind,
.ledger-source {
  display: inline-flex;
  align-items: center;
  border-radius: var(--rounded-full);
  padding: 0.12rem 0.4rem;
  background: var(--lighter);
  font-size: 0.7rem;
  font-weight: var(--font-semibold);
  white-space: nowrap;
}

.ledger-kind-expense,
.ledger-amount-expense {
  color: var(--error);
}

.ledger-kind-expense {
  background: var(--error-light);
}

.ledger-kind-income,
.ledger-amount-income {
  color: var(--success);
}

.ledger-kind-income {
  background: var(--success-light);
}

.ledger-amount {
  font-weight: var(--font-bold) !important;
}

.ledger-row-actions {
  min-width: 8rem;
  white-space: nowrap;
}

.ledger-actions-heading {
  text-align: right !important;
}

.ledger-action-link,
.ledger-action-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-size: 0.72rem;
  font-weight: var(--font-semibold);
  text-decoration: none;
  cursor: pointer;
}

.ledger-action-link:hover,
.ledger-action-button:hover {
  text-decoration: underline;
}

.ledger-action-button {
  color: var(--error);
}

.ledger-empty {
  padding: 2rem 1rem !important;
  text-align: center !important;
}

.ledger-pagination-shell {
  display: flex;
  justify-content: center;
  border-top: var(--border) solid var(--light);
  padding: 0.5rem 0.75rem;
  background: var(--white);
}

.pagy.series-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.pagy.series-nav a {
  min-width: 1.75rem;
  border: var(--border) solid var(--light);
  border-radius: var(--rounded-sm);
  padding: 0.2rem 0.45rem;
  color: var(--brand-2);
  font-size: 0.75rem;
  font-weight: var(--font-semibold);
  text-align: center;
  text-decoration: none;
}

.pagy.series-nav a[aria-current="page"] {
  border-color: var(--brand-2);
  background: var(--brand-2);
  color: var(--white);
}

.pagy.series-nav a[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
}

.ledger-edit-row > td {
  padding: 0 !important;
  background: var(--brand-4-light) !important;
}

.ledger-readonly-value {
  display: flex;
  align-items: center;
  min-height: 2rem;
  border: var(--border) solid var(--light);
  border-radius: var(--rounded-sm);
  padding: 0.25rem 0.45rem;
  background: var(--lighter);
  color: var(--dark);
  font-size: 0.8rem;
}

.ledger-edit-page {
  width: min(100%, 72rem);
  padding: 0.75rem;
}

.ledger-edit-page .ledger-entry-form {
  border: var(--border) solid var(--light);
  border-radius: var(--rounded-sm);
  background: var(--white);
}

@media (min-width: 40rem) {
  .ledger-quick-form,
  .ledger-entry-form,
  .payment-account-quick-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ledger-quick-description,
  .ledger-form-description,
  .ledger-form-memo {
    grid-column: span 2;
  }

  .ledger-quick-memo {
    grid-column: span 2;
  }

  .ledger-quick-submit,
  .ledger-form-actions {
    align-self: end;
  }

  .ledger-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .financial-date-fields {
    grid-template-columns: minmax(9rem, 0.75fr) minmax(18rem, 1.5fr);
  }

  .financial-date-filter-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .financial-date-filter-form .financial-date-fields {
    grid-column: auto;
  }

  .account-ledger-summary dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-ledger-summary dl > div:nth-child(odd) {
    border-right: var(--border) solid var(--light);
  }

  .account-ledger-summary dl > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

@media (min-width: 55rem) {
  .payment-account-quick-form {
    grid-template-columns: minmax(12rem, 2fr) minmax(9rem, 1fr) 7rem auto;
  }
}

@media (min-width: 64rem) {
  .ledger-main {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .ledger-workspace .app-sidebar {
    width: 13.5rem;
    padding: 0.75rem;
  }

  .ledger-workspace .app-sidebar-content {
    gap: 0.75rem;
  }

  .ledger-filter-form {
    grid-template-columns: minmax(12rem, 2fr) repeat(5, minmax(7rem, 1fr)) auto;
  }

  .account-ledger-summary dl {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .account-ledger-summary dl > div,
  .account-ledger-summary dl > div:nth-child(odd) {
    border-right: var(--border) solid var(--light);
    border-bottom: 0;
  }

  .account-ledger-summary dl > div:last-child {
    border-right: 0;
  }

  .ledger-workspace .app-sidebar a > img[width="52"],
  .finance-workspace .app-sidebar a > img[width="52"] {
    width: 2.5rem;
    height: 2.5rem;
  }

  .ledger-workspace .app-sidebar a > .font-heading,
  .finance-workspace .app-sidebar a > .font-heading {
    overflow: hidden;
    font-size: 0.9rem;
    text-overflow: ellipsis;
  }
}

@media (min-width: 75rem) {
  .ledger-quick-form {
    grid-template-columns: 6.75rem minmax(8rem, 1.6fr) 5rem 4rem minmax(6.5rem, 1fr) minmax(6.5rem, 1fr) minmax(7rem, 1fr) minmax(8rem, 1fr) auto;
  }

  .ledger-quick-description,
  .ledger-quick-memo {
    grid-column: auto;
  }
}

@media (max-width: 47.999rem) {
  .ledger-toolbar,
  .ledger-notice,
  .ledger-filters {
    padding-right: 0.5rem;
    padding-left: 0.5rem;
  }

  .ledger-quick-add-grid {
    padding-right: 0.5rem;
    padding-left: 0.5rem;
  }

  .ledger-table-shell {
    overflow: visible;
    padding: 0.5rem;
    background: var(--lighter);
  }

  .ledger-table,
  .ledger-table tbody {
    display: block;
    min-width: 0;
  }

  .ledger-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    clip-path: inset(50%);
  }

  .ledger-entry-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    margin-bottom: 0.5rem;
    border: var(--border) solid var(--light);
    border-radius: var(--rounded-sm);
    background: var(--white);
    box-shadow: var(--shadow-sm);
  }

  .ledger-table .ledger-entry-row > th,
  .ledger-table .ledger-entry-row > td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
    border-right: 0;
    padding: 0.45rem 0.5rem;
  }

  .ledger-table .ledger-entry-row > th::before,
  .ledger-table .ledger-entry-row > td::before {
    flex: none;
    color: var(--midtone);
    content: attr(data-label);
    font-size: 0.65rem;
    font-weight: var(--font-bold);
    letter-spacing: 0.025em;
    text-transform: uppercase;
  }

  .ledger-table .ledger-description,
  .ledger-table .ledger-row-actions {
    grid-column: 1 / -1;
    width: auto;
    min-width: 0;
  }

  .ledger-table .ledger-description {
    display: block;
  }

  .ledger-table .ledger-description::before {
    display: block;
    margin-bottom: 0.25rem;
  }

  .ledger-memo {
    max-width: 100%;
  }

  .ledger-table .ledger-row-actions {
    border-bottom: 0;
  }

  .ledger-table .ledger-number {
    text-align: left;
  }

  .ledger-edit-row,
  .ledger-edit-row > td {
    display: block;
    width: 100%;
  }

  .ledger-edit-row {
    margin-bottom: 0.5rem;
    border: var(--border) solid var(--brand-1);
  }

  .ledger-empty {
    display: block;
    border: var(--border) solid var(--light) !important;
    border-radius: var(--rounded-sm);
    background: var(--white) !important;
  }
}
