:root {
  color-scheme: light;
  font-family:
    Arial, "Helvetica Neue", sans-serif;
  background: #f6f7f8;
  color: #111827;
  --ink: #111827;
  --muted: #5b6677;
  --line: #d9dee7;
  --line-soft: #e9edf2;
  --panel: #ffffff;
  --canvas: #f6f7f8;
  --active: #121827;
  --accent: #2f7a59;
  --accent-soft: #edf5ef;
  --focus: #286647;
  --radius: 8px;
  --warn: #9a3d20;
  --shadow: 0 2px 6px rgb(17 24 39 / 3%);
  --shell-max-width: 1380px;
  --shell-inline-padding: clamp(24px, 5vw, 72px);
  --shell-content-width: calc(var(--shell-max-width) - var(--shell-inline-padding) - var(--shell-inline-padding));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--canvas);
}

html,
body,
#root {
  height: 100%;
}

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

button,
a.secondary-button {
  cursor: pointer;
  text-decoration: none;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 46px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 650;
  letter-spacing: 0;
}

.page-frame {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--canvas);
  overflow: hidden;
}

.brand-header {
  position: relative;
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
  padding: 18px max(var(--shell-inline-padding), calc((100vw - var(--shell-content-width)) / 2));
  background: var(--panel);
  border-bottom: 1px solid var(--line-soft);
}

.brand-logo {
  display: block;
  width: 62px;
  flex-shrink: 0;
  height: auto;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.brand-title {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-actions {
  position: absolute;
  right: var(--shell-inline-padding);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.loading {
  min-height: calc(100vh - 160px);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 17px;
}

.app-shell,
.login-page {
  width: min(var(--shell-max-width), 100%);
  min-height: 0;
  margin: 0 auto;
  padding: 28px var(--shell-inline-padding) 32px;
}

.login-page {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 28px;
  text-align: center;
}

.app-shell {
  display: grid;
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.page-intro {
  margin-bottom: 30px;
  text-align: center;
}

.login-intro {
  margin-bottom: 0;
}

.page-intro p {
  max-width: 960px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 21px;
  line-height: 1.45;
}

.login-intro p {
  margin-top: 14px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
  color: var(--muted);
  font-size: 17px;
}

.filter-pill,
.prefix-group label,
.payment-group label {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: #3f4858;
  padding: 0 18px;
  line-height: 1.1;
}

.filter-pill.active,
.prefix-group label.selected {
  border-color: var(--active);
  background: var(--active);
  color: #ffffff;
}

.login-panel,
.capture-form,
.receipt-list {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  width: min(430px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  text-align: left;
}

.workspace {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  justify-content: center;
  gap: 22px;
}

.capture-form {
  display: grid;
  gap: 22px;
  padding: 28px;
}

.receipt-list {
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

label {
  display: grid;
  min-width: 0;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 12px;
  caret-color: var(--accent);
}

select {
  appearance: none;
  padding-right: 44px;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%235B6677' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px 16px;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  padding: 0 18px;
  border: 1px solid transparent;
  letter-spacing: 0;
}

.primary-button {
  background: var(--active);
  color: #ffffff;
}

.primary-button:hover {
  background: #273044;
}

.secondary-button {
  background: #ffffff;
  border-color: var(--line);
  color: #3f4858;
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: #bfc7d3;
  background: #f9fafb;
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: #3f4858;
}

.fixed-action-bar {
  background: var(--panel);
  border-top: 1px solid var(--line-soft);
  padding: 14px var(--shell-inline-padding);
}

.fixed-action-inner {
  width: min(var(--shell-content-width), 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto;
}

.fixed-action-secondary {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.piece-preview {
  min-width: 0;
  max-width: min(420px, 40vw);
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #f9fafb;
  color: #3f4858;
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fixed-submit {
  min-width: 220px;
}

.login-panel .primary-button {
  width: 100%;
}

.dropzone {
  position: relative;
  min-height: 190px;
  padding: 24px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #b8c0cc;
  border-radius: 8px;
  background: #f8faf9;
  color: var(--muted);
  text-align: center;
}

.dropzone-copy {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 42ch;
}

.dropzone-copy svg {
  margin-bottom: 4px;
  color: var(--accent);
}

.dropzone-title {
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}

.dropzone-hint {
  font-size: 13px;
  line-height: 1.5;
}

.dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone.has-file {
  padding: 12px;
  background: #edf0ee;
}

.dropzone img {
  width: 100%;
  height: 100%;
  max-height: 280px;
  object-fit: contain;
}

.dropzone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.document-picker-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 18px;
}

.backup-warning { padding: 12px 16px; border: 1px solid #d5b599; border-radius: 6px; color: #774724; background: #fff8ef; font-size: 13px; line-height: 1.5; }
.receipt-view-switch { display: flex; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.receipt-view-switch button { min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--panel); font-size: 13px; }
.receipt-view-switch button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.receipt-editor, .receipt-history { grid-column: 1 / -1; padding: 20px 0 4px; border-top: 1px solid var(--line); margin-top: 12px; }
.receipt-editor h3, .receipt-history h3 { margin: 0 0 8px; font-size: 16px; }
.receipt-editor fieldset { display: grid; gap: 16px; margin: 20px 0; padding: 0; border: 0; min-width: 0; }
.receipt-edit-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.receipt-editor label { display: grid; gap: 6px; min-width: 0; color: var(--muted); font-size: 13px; }
.receipt-editor-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.receipt-editor-actions button { min-height: 44px; font-size: 13px; }
.receipt-history ul { display: grid; gap: 12px; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.receipt-load-more { display: block; margin: 20px auto; }
@media (max-width: 600px) { .receipt-edit-grid { grid-template-columns: 1fr 1fr; } .receipt-edit-grid > :first-child { grid-column: 1 / -1; } }

.document-picker-actions button {
  min-height: 44px;
  font-size: 13px;
}

.document-text-button {
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-underline-offset: 3px;
}

.document-text-button:hover { text-decoration: underline; }
.selected-document { width: 100%; min-width: 0; }
.selected-document-info {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.selected-document-info > :first-child { color: var(--ink); }

.pdf-reader { display: flex; flex-direction: column; min-height: 0; width: 100%; }
.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.pdf-pagination { display: flex; align-items: center; gap: 8px; }
.pdf-pagination > span { min-width: 86px; text-align: center; font-variant-numeric: tabular-nums; }
.pdf-pagination button, .document-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
}
.pdf-pagination button:hover:not(:disabled), .document-close:hover { background: var(--accent-soft); }
.pdf-toolbar .pdf-zoom { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pdf-zoom select { width: auto; min-width: 100px; min-height: 36px; padding: 4px 30px 4px 8px; font-size: 13px; }
.pdf-viewport {
  flex: 1;
  min-height: 160px;
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
  background: #e9edea;
  scrollbar-color: #9ba89f #e9edea;
}
.pdf-page { width: max-content; min-width: 40px; max-width: none; margin-inline: auto; }
.pdf-canvas canvas { display: block; background: white; box-shadow: 0 2px 6px rgb(17 24 39 / 12%); }
.pdf-message { display: block; margin: 20px auto; max-width: 36ch; color: var(--muted); font-size: 13px; line-height: 1.6; text-align: center; }
.pdf-reader.is-compact { border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.pdf-reader.is-compact .pdf-viewport { max-height: 280px; }
.pdf-reader.is-compact .pdf-toolbar { justify-content: center; }
.pdf-thumbnail { display: block; position: relative; width: 100%; height: 100%; overflow: hidden; }
.pdf-thumbnail .pdf-page { position: absolute; top: 0; left: 0; transform: scale(.55); transform-origin: top left; }
.pdf-thumbnail .pdf-message { display: none; }
.pdf-thumbnail-label {
  position: absolute;
  inset: auto 0 0;
  padding: 2px;
  background: #f1e9db;
  color: #694625;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
}
.pdf-thumbnail-fallback { display: grid; height: 100%; place-items: center; font-size: 11px; }
.document-dialog {
  width: min(1060px, calc(100vw - 40px));
  height: min(940px, calc(100dvh - 40px));
  max-height: calc(100dvh - 40px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 12px 40px rgb(17 24 39 / 20%);
}
.document-dialog[open] { display: flex; flex-direction: column; }
.document-dialog::backdrop { background: rgb(17 24 39 / 60%); }
.document-dialog-header { display: flex; align-items: center; gap: 24px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.document-dialog-header > div { flex: 1; min-width: 0; }
.document-dialog-header h2 { margin: 0; font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; }
.document-dialog-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.document-close { padding: 8px 12px; font-size: 13px; }
.document-dialog > .pdf-reader { flex: 1; overflow: hidden; }
.document-dialog-footer { display: flex; gap: 12px 24px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); }
.document-dialog-footer a { color: var(--accent); font-size: 13px; text-underline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 600px) {
  .document-dialog { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .document-dialog-header { gap: 12px; padding: 12px 16px; }
  .document-dialog-header h2 { font-size: 15px; }
  .pdf-toolbar { padding-inline: 12px; }
  .pdf-pagination button, .document-close { min-height: 44px; min-width: 44px; }
  .document-dialog-footer { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .document-dialog-footer a { display: flex; align-items: center; min-height: 36px; }
}

.prefix-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.prefix-group {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.prefix-group label {
  position: relative;
  cursor: pointer;
  min-height: 40px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 650;
}

.prefix-group label:hover,
.prefix-group label:focus-within {
  z-index: 4;
}

.prefix-code {
  pointer-events: none;
}

.prefix-group input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.payment-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.payment-group label {
  cursor: pointer;
  min-height: 40px;
  padding: 0 12px;
  font-size: 13px;
}

.payment-group label.selected {
  border-color: var(--active);
  background: var(--active);
  color: #ffffff;
}

.payment-group input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.compact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 100px;
  gap: 12px;
  align-items: end;
}

.receipt-date-field {
  display: grid;
  min-width: 0;
  gap: 6px;
  grid-column: 1 / -1;
}

.monthly-choice,
.receipt-editor .monthly-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  width: fit-content;
  cursor: pointer;
  color: var(--ink);
}

.monthly-choice input {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.month-fields,
.receipt-editor .month-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 12px;
  margin: 0;
}

.month-fields legend {
  margin-bottom: 8px;
}

.compact-grid:has(.receipt-date-field),
.receipt-edit-grid:has(.receipt-date-field) {
  grid-template-columns: minmax(0, 1fr) 104px;
}

.status,
.error {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.status:empty {
  display: none;
}

.error {
  color: var(--warn);
}

.archive-toggle {
  width: 100%;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 18px 22px;
  text-align: left;
}

.archive-toggle span:first-child {
  display: grid;
  gap: 3px;
  font-size: 15px;
  font-weight: 650;
}

.archive-toggle small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.archive-chevron {
  width: 12px;
  height: 12px;
  border-right: 2px solid #6b7280;
  border-bottom: 2px solid #6b7280;
  transform: rotate(45deg);
  transition: transform 160ms ease, border-color 160ms ease;
}

.archive-toggle[aria-expanded="true"] .archive-chevron {
  transform: rotate(225deg);
}

.archive-toggle:hover .archive-chevron {
  border-color: #111827;
}

.archive-export-panel {
  display: grid;
  gap: 10px;
  padding: 0 22px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.archive-export-panel .receipt-meta {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
}

.archive-period-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  align-items: end;
}

.archive-period-grid label {
  gap: 6px;
  font-size: 12px;
}

.archive-period-grid input,
.archive-period-grid select {
  min-height: 42px;
  padding: 8px 10px;
  font-size: 14px;
}

.archive-period-grid .secondary-button {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding-inline: 12px;
}

.archive-actions {
  display: grid;
  grid-template-columns: 1fr;
  align-items: end;
  gap: 8px;
}

.archive-filter-control {
  min-width: 0;
}

.archive-download-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.archive-download-links .secondary-button {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding-inline: 12px;
  font-size: 13px;
}

.archive-download-button {
  border-color: var(--active);
  background: var(--active);
  color: #ffffff;
  font-weight: 650;
}

.archive-download-button:hover {
  border-color: #273044;
  background: #273044;
}

/* Receipt rows adapt to the available archive width, including a narrow sidebar. */
.receipt-list {
  container-type: inline-size;
}

.preview-notice {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.receipt-list-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  padding: 20px 20px 14px;
}

.receipt-list-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.receipt-list-heading > span,
.receipt-list-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.receipt-list-heading p {
  grid-column: 1 / -1;
}

.receipt-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.receipt-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 36px;
  gap: 10px 12px;
  padding: 18px 20px;
  border-top: 1px solid var(--line-soft);
  align-items: start;
}

.receipt-item:hover {
  background: #fafbfa;
}

.receipt-thumbnail {
  padding: 0;
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 60px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f5f6f4;
  color: var(--muted);
  text-decoration: none;
  overflow: hidden;
}

.receipt-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.receipt-thumbnail:hover {
  border-color: var(--accent);
}

.receipt-file-placeholder {
  display: grid;
  justify-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
}

.receipt-thumbnail.is-pdf {
  color: #765434;
  background: #faf6ed;
}

.receipt-row-body {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.receipt-title {
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  display: block;
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.receipt-title:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

.receipt-details,
.receipt-person {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.receipt-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0 10px;
}

.receipt-person {
  margin-top: 2px;
}

.receipt-payment::before {
  content: "·";
  margin-right: 10px;
}

.receipt-summary {
  grid-column: 2 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.receipt-amount {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.receipt-amount span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.receipt-amount.is-missing {
  font-size: 12px;
  font-weight: 400;
  color: var(--warn);
  white-space: normal;
}

.receipt-status {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
}

.receipt-status::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 6px 2px 0;
  border-radius: 50%;
  background: currentColor;
}

.status-ready {
  color: #286647;
}

.status-needs_review {
  color: var(--warn);
}

.receipt-menu-button {
  grid-column: 3;
  grid-row: 1;
  display: grid;
  place-items: center;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.receipt-menu-button:hover,
.receipt-menu-button[aria-expanded="true"] {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.receipt-actions:not([hidden]) {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.receipt-open-link {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--focus);
  font-size: 12px;
}

.receipt-delete-warning {
  flex-basis: 100%;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--warn);
}

.receipt-delete-button,
.receipt-cancel-button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--panel);
  font-size: 12px;
}

.receipt-delete-button {
  color: var(--warn);
}

.receipt-delete-button:hover:not(:disabled) {
  border-color: #d9b7ab;
  background: #fff7f4;
}

.receipt-cancel-button:hover {
  background: var(--canvas);
}

@container (min-width: 520px) {
  .receipt-item {
    grid-template-columns: 48px minmax(0, 1fr) max-content 36px;
    gap: 12px 16px;
    padding: 18px 22px;
  }

  .receipt-thumbnail {
    grid-row: 1;
    width: 48px;
    height: 64px;
  }

  .receipt-summary {
    grid-column: 3;
    grid-row: 1;
    display: grid;
    justify-items: end;
    padding-top: 2px;
    gap: 7px;
  }

  .receipt-menu-button {
    grid-column: 4;
  }
}

@media (min-width: 1100px) {
  .workspace:has(.receipt-list.is-open) {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }
}

@media (max-width: 1099px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .receipt-list {
    order: -1;
  }
}

@media (pointer: coarse) {
  .archive-period-grid input,
  .archive-period-grid select,
  .pdf-zoom select {
    font-size: 16px;
  }

  .receipt-item {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  .receipt-menu-button,
  .receipt-delete-button,
  .receipt-cancel-button {
    min-width: 44px;
    min-height: 44px;
  }

  @container (min-width: 520px) {
    .receipt-item {
      grid-template-columns: 48px minmax(0, 1fr) max-content 44px;
    }
  }
}

.receipt-meta,
.muted {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

::selection {
  background: #d7e9dc;
  color: var(--ink);
}

html {
  scrollbar-color: #a6b2aa var(--canvas);
  scrollbar-width: thin;
}

a {
  text-underline-offset: 3px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
label:has(input[type="radio"]:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

button:disabled {
  cursor: wait;
  opacity: .6;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.capture-form h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.prefix-group + .field-hint {
  margin-top: 8px;
}

.prefix-group label,
.payment-group label {
  transition: background-color 140ms ease, border-color 140ms ease;
}

.prefix-group label:not(.selected):hover,
.payment-group label:not(.selected):hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.payment-group label.selected {
  color: #24563a;
  background: var(--accent-soft);
  border-color: var(--accent);
}

input,
select,
textarea {
  min-width: 0;
  font-size: 16px;
}

input[type="date"],
input[type="number"],
.receipt-meta {
  font-variant-numeric: tabular-nums;
}

/* iOS date controls miscalculate 100% widths when the input has padding.
   The outer frame owns that spacing; the native input remains fully usable. */
.date-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding-inline: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.date-control input[type="date"] {
  display: block;
  appearance: none;
  -webkit-appearance: none;
  min-width: 0;
  min-height: 42px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.date-control input::-webkit-date-and-time-value {
  min-height: 1.5em;
  text-align: left;
}

.date-control:focus-within {
  border-color: var(--focus);
}

.date-control:has(:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.date-control input:focus-visible {
  outline: none;
}

/* Use the archive's actual width, also when it is a desktop sidebar. */
@container (max-width: 380px) {
  .archive-period-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
}

.piece-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.archive-empty {
  display: grid;
  gap: 10px;
  padding: 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.archive-empty p {
  margin: 0;
}

.archive-empty .secondary-button {
  justify-self: start;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 920px) {
  .brand-header {
    min-height: 100px;
    flex-wrap: wrap;
  }

  .app-shell,
  .login-page {
    padding-top: 30px;
  }

  h1 {
    font-size: 36px;
  }

  .page-intro p {
    font-size: 18px;
  }

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

  .brand-actions {
    position: static;
    width: 100%;
    justify-content: center;
  }

  .brand-title {
    font-size: 26px;
  }

  .brand-subtitle {
    font-size: 15px;
  }
}

@media (max-width: 640px), (max-height: 500px) and (pointer: coarse) {
  html,
  body,
  #root {
    height: auto;
    min-height: 100%;
  }

  body {
    min-height: 100dvh;
    overflow: auto;
  }

  .page-frame {
    min-height: 100dvh;
    height: auto;
    grid-template-rows: auto auto auto;
    overflow: visible;
  }

  .brand-header {
    align-items: center;
    min-height: 92px;
    flex-wrap: nowrap;
    gap: 14px;
    padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 14px max(18px, env(safe-area-inset-left));
  }

  .brand-logo {
    width: 52px;
  }

  .brand-title {
    font-size: 22px;
  }

  .brand-subtitle {
    font-size: 13px;
    white-space: normal;
  }

  .app-shell,
  .login-page {
    overflow: visible;
    padding: 16px max(14px, env(safe-area-inset-right)) 20px max(14px, env(safe-area-inset-left));
  }

  h1 {
    font-size: 31px;
  }

  .page-intro {
    margin-bottom: 22px;
  }

  .filter-row {
    font-size: 15px;
  }

  .filter-pill {
    min-height: 40px;
    padding: 0 14px;
  }

  .payment-group label {
    min-height: 44px;
    padding: 0 12px;
  }

  .workspace {
    gap: 14px;
  }

  .receipt-list {
    order: -1;
  }

  .prefix-row {
    grid-template-columns: 1fr;
  }

  .prefix-group label {
    min-width: 44px;
    min-height: 44px;
  }

  .archive-actions {
    grid-template-columns: 1fr;
  }

  .archive-download-links {
    grid-template-columns: 1fr;
  }

  .capture-form,
  .login-panel {
    padding: 14px;
  }

  .capture-form {
    gap: 20px;
    padding: 20px 16px;
  }

  .archive-toggle {
    min-height: 52px;
    padding: 14px 18px;
  }

  .archive-export-panel {
    gap: 9px;
    padding: 0 18px 14px;
  }

  .archive-period-grid input,
  .archive-period-grid select {
    min-height: 44px;
    font-size: 16px;
  }

  .archive-period-grid .secondary-button {
    min-height: 44px;
  }

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

  .receipt-view-switch button,
  .archive-download-links .secondary-button,
  .pdf-toolbar button,
  .pdf-zoom select,
  .document-dialog-footer a {
    min-height: 44px;
  }

  .pdf-zoom select {
    font-size: 16px;
  }

  .receipt-editor-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .dropzone {
    min-height: 170px;
  }

  .compact-grid {
    grid-template-columns: minmax(0, 1fr) 104px;
  }

  .compact-grid > label:first-child {
    grid-column: 1 / -1;
  }

  .fixed-action-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    padding: 8px max(14px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }

  .fixed-action-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(132px, 42%);
    align-items: center;
    gap: 6px;
  }

  .fixed-action-secondary {
    display: grid;
    width: 100%;
    justify-content: stretch;
    gap: 6px;
  }

  .fixed-action-secondary > a.secondary-button {
    display: none;
  }

  .piece-preview {
    border: 0;
    background: transparent;
    width: 100%;
    max-width: 100%;
    padding: 0;
    font-size: 12px;
    text-align: left;
  }

  .fixed-submit {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  .receipt-item {
    padding: 16px;
    column-gap: 10px;
  }

  .receipt-list-heading {
    padding-inline: 16px;
  }
}
