/* Keep controls within their grid tracks, including native macOS form controls. */
.formgrid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.field,
.formgrid > *,
.linegrid > * {
  min-width: 0;
}
.entry-similar-prompt {
  border-left: 3px solid #d5ad66;
  animation: entry-spec-appear 180ms ease-out;
}
.entry-similar-prompt > strong {
  font-size: 14px;
  color: #765820;
}
.entry-similar-prompt > p {
  margin: 6px 0 10px;
  color: #796b51;
  font-size: 12px;
}
.entry-similar-prompt > p > span {
  display: block;
  color: #9a8b72;
  margin-top: 3px;
}
.entry-similar-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 132px;
  overflow: auto;
}
.entry-similar-choices button {
  font-size: 13px;
  padding: 7px 11px;
  border-color: #dac59e;
  background: #fffdf8;
  color: #705522;
}
.entry-similar-prompt .entry-keep-spec {
  margin-top: 10px;
  font-size: 12px;
  padding: 6px 10px;
  background: transparent;
  color: #716958;
  border-color: #ddd3c0;
}
@keyframes entry-spec-appear {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .entry-similar-prompt {
    animation: none;
  }
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 14px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.field input,
.field select {
  height: 44px;
  min-height: 44px;
  line-height: 22px;
}
.field textarea {
  resize: vertical;
  min-height: 82px;
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  background: white
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23546d74' stroke-width='1.5'/%3E%3C/svg%3E")
    no-repeat right 10px center;
}
.field input:disabled,
.field select:disabled {
  background-color: #eef2f3;
  color: #849196;
  cursor: not-allowed;
}
.linegrid {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.8fr) minmax(
      0,
      1.2fr
    ) minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}
.linegrid .field {
  line-height: 1.6;
}
.lineamount {
  display: block;
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.4;
  padding-top: 4px;
}
.lineform {
  min-width: 0;
}
dialog {
  width: 1040px;
  max-width: calc(100vw - 32px);
  padding: 26px;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100dvh - 40px);
}
.modalhead .link {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  padding: 0;
}
.footer {
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.lineform > .row {
  align-items: flex-start;
}
.typehint {
  flex: 1;
  min-width: 160px;
}
.removeline {
  flex: none;
}
.entry-line-number {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 13px;
  font-size: 12px;
  color: #81939d;
}
.entry-line-number strong {
  font-size: 13px;
  font-weight: 500;
  color: #4e7385;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}
.records-toolbar {
  flex-wrap: wrap;
}
.record-filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.record-filters input {
  width: 245px;
  min-width: 160px;
}
.calendar-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  font-weight: 500;
  white-space: nowrap;
}
.calendar-trigger svg {
  flex-shrink: 0;
}
.statement-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.statement-heading p {
  margin-bottom: 0;
}
.carryover {
  border-left: 3px solid var(--green);
  padding-left: 20px;
  flex-shrink: 0;
}
.carryover span {
  display: block;
  font-size: 14px;
  color: var(--muted);
}
.carryover strong {
  font-size: 27px;
  font-weight: 650;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
dialog[data-variant="month"] {
  width: 400px;
}
dialog[data-variant="range"] {
  width: 740px;
}
.calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 16px 0 20px;
}
.calendar-nav > button {
  padding: 4px 12px;
  font-size: 24px;
  line-height: 1.2;
  min-width: 38px;
  height: 38px;
}
.calendar-nav select {
  height: 38px;
  min-height: 38px;
  padding: 4px 10px;
}
.month-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.month-grid button {
  height: 64px;
  font-size: 16px;
  position: relative;
}
.month-grid small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
}
.month-grid button.selected,
.day-grid button.selected {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.range-endpoints {
  display: flex;
  gap: 14px;
  align-items: center;
}
.range-endpoints button {
  flex: 1;
  text-align: left;
  padding: 10px 14px;
}
.range-endpoints button span {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.range-endpoints button strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.range-endpoints button.active {
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green);
}
.range-calendars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px;
}
.date-month h3 {
  text-align: center;
  margin: 0 0 12px;
  font-size: 16px;
}
.day-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.day-grid > * {
  min-width: 0;
  text-align: center;
}
.day-grid button {
  height: 37px;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: 6px;
}
.day-grid .weekday {
  font-size: 13px;
  color: var(--muted);
  padding-bottom: 6px;
}
.day-grid .in-range {
  background: var(--accent);
  border-radius: 0;
}
.day-grid .is-today:not(.selected) {
  border-color: var(--green);
}
.range-footer {
  justify-content: space-between;
}
@media (max-width: 900px) {
  .linegrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .linegrid > .field:last-child {
    grid-column: 2;
    grid-row: 3;
  }
  .statement-heading {
    align-items: flex-start;
  }
  .carryover strong {
    font-size: 23px;
  }
}
@media (max-width: 600px) {
  dialog {
    padding: 18px;
    max-width: calc(100vw - 20px);
  }
  .range-calendars {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .formgrid {
    grid-template-columns: 1fr;
  }
  .statement-heading {
    flex-direction: column;
    gap: 16px;
  }
  .carryover {
    width: 100%;
  }
  .record-filters,
  .record-filters input {
    width: 100%;
  }
  .record-filters .calendar-trigger {
    flex: 1;
  }
  .linegrid {
    gap: 14px;
  }
  .linegrid .field {
    font-size: 14px;
  }
  .footer button {
    flex: 1;
    white-space: nowrap;
  }
  .range-endpoints {
    gap: 8px;
  }
  .range-endpoints button {
    padding: 8px;
  }
  .range-endpoints button strong {
    font-size: 15px;
  }
}
@media print {
  .statement-heading {
    flex-direction: row;
  }
  .carryover strong {
    font-size: 22px;
  }
  .carryover {
    width: auto;
  }
}

.unsaved-confirm {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff8e8;
  box-shadow: 0 4px 12px #0001;
  margin-bottom: 14px;
}
.unsaved-confirm button {
  white-space: nowrap;
}
.record-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px;
  background: #f5f8fa;
}
.record-pagination > div {
  flex-basis: 100%;
  text-align: center;
}
.record-pagination .month-weight-total {
  display: inline-flex;
  margin-left: 6px;
}
#revisionNotice {
  position: sticky;
  top: 0;
  z-index: 30;
}
.record-page-body:empty {
  display: none;
}
@media print {
  .record-pagination,
  .unsaved-confirm,
  #revisionNotice {
    display: none !important;
  }
}
