@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;650;750;850&display=swap");

:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --ink: #15181d;
  --muted: #68717c;
  --line: #d9e0e7;
  --line-strong: #bac7d3;
  --teal: #0b6b63;
  --teal-ink: #063f3b;
  --teal-soft: #e5f2ef;
  --blue: #235a8f;
  --amber: #b66b10;
  --red: #a8312a;
  --shadow: 0 14px 34px rgba(18, 28, 38, 0.08);
  --glass: rgba(255, 255, 255, 0.74);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --glass-line: rgba(136, 154, 171, 0.36);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background:
    linear-gradient(115deg, rgba(11, 107, 99, 0.08), transparent 26%),
    linear-gradient(245deg, rgba(182, 107, 16, 0.08), transparent 32%),
    linear-gradient(180deg, #eef3f6 0%, #f9fbfc 48%, #edf2f5 100%);
  max-width: 100%;
}

body {
  margin: 0;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

.app-boot {
  width: min(420px, 100%);
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.app-boot-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid #075d56;
  border-radius: 8px;
  background: #0b6b63;
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 850;
  box-shadow: 0 10px 20px rgba(11, 107, 99, 0.18);
}

.app-boot-heading {
  display: grid;
  gap: 3px;
}

.app-boot-heading strong {
  font-size: 1.08rem;
  line-height: 1.2;
}

.app-boot-heading span {
  color: var(--muted);
  font-size: 0.82rem;
}

.app-boot-folders {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.app-boot-folder {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(18, 28, 38, 0.045);
}

.app-boot-folder i {
  align-self: stretch;
  background: var(--teal);
}

.app-boot-folder b {
  width: 58%;
  height: 11px;
  border-radius: 5px;
  background: #dfe6eb;
}

.app-boot-folder-two i {
  background: var(--blue);
}

.app-boot-folder-two b {
  width: 42%;
}

.app-boot-folder-three i {
  background: var(--amber);
}

.app-boot-folder-three b {
  width: 68%;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

.shell {
  width: min(1120px, 100%);
  max-width: 100%;
  overflow-x: clip;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
}

.app {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0 0;
}

.brand,
.head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-home {
  min-width: 0;
  min-height: 44px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.brand-home:hover .brand-mark {
  transform: translateY(-1px);
}

.brand-mark,
.login-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  transition: transform 160ms ease;
}

.login-mark {
  width: 52px;
  height: 52px;
}

h1 {
  font-size: 1.45rem;
  line-height: 1.05;
}

.brand p,
.app-head p,
.status,
.meta,
.empty,
.list-head span {
  color: var(--muted);
}

.brand p,
.app-head p {
  margin-top: 3px;
  font-size: 0.9rem;
}

.icon-button,
.edit-button,
.delete-button,
.text-button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.icon-button {
  font-size: 1.15rem;
}

.icon-button.is-busy {
  color: transparent;
  position: relative;
}

.icon-button.is-busy::after {
  content: "";
  width: 15px;
  height: 15px;
  border: 2px solid rgba(76, 86, 97, 0.22);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 820ms linear infinite;
}

.profile-button {
  min-width: 0;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(220, 232, 239, 0.55));
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 850;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 18px rgba(18, 28, 38, 0.08);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--glass);
  box-shadow: 0 12px 28px rgba(18, 28, 38, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(14px);
}

.app-notice {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--teal) 24%, var(--glass-line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(236, 247, 244, 0.72)),
    var(--glass);
  box-shadow: 0 12px 28px rgba(18, 28, 38, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(14px);
}

.app-notice[data-level="success"] {
  border-color: color-mix(in srgb, var(--teal) 34%, var(--glass-line));
}

.app-notice[data-level="warning"] {
  border-color: color-mix(in srgb, var(--amber) 42%, var(--glass-line));
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 246, 230, 0.78)),
    var(--glass);
}

.app-notice strong {
  font-size: 0.9rem;
}

.app-notice p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.share-import {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 0.9fr) minmax(170px, 0.85fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--glass-line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(235, 244, 252, 0.74)),
    var(--glass);
  box-shadow: 0 14px 30px rgba(18, 28, 38, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
}

.share-import.has-status {
  border-color: color-mix(in srgb, var(--blue) 42%, var(--glass-line));
}

.share-import.is-saving {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(232, 243, 255, 0.82)),
    var(--glass);
}

.share-import.is-error {
  border-color: color-mix(in srgb, var(--red) 36%, var(--glass-line));
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 240, 239, 0.78)),
    var(--glass);
}

.share-copy {
  display: grid;
  gap: 4px;
  align-self: center;
}

.share-copy strong {
  font-size: 0.96rem;
}

.share-copy p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.share-actions {
  display: flex;
  gap: 8px;
}

.share-actions .primary-button {
  min-width: 88px;
}

#shareStatus {
  grid-column: 1 / -1;
}

.summary-strip div {
  display: grid;
  gap: 3px;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
}

.summary-strip div:last-child {
  border-right: 0;
}

.summary-strip span {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.summary-strip strong {
  font-size: 1.1rem;
}

.login-panel,
.capture-panel,
.receipt-card,
.folder-add {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  display: grid;
  gap: 16px;
  width: min(430px, 100%);
  margin: 18vh auto 0;
  padding: 22px;
}

form {
  display: grid;
  gap: 12px;
}

.capture-panel {
  padding: 12px;
}

#receiptForm {
  grid-template-columns: minmax(240px, 1.05fr) minmax(300px, 1fr) minmax(140px, 0.42fr) auto;
  align-items: end;
  gap: 10px;
}

.capture-panel.create-mode #receiptForm {
  grid-template-columns: minmax(240px, 1.05fr) minmax(300px, 1fr) minmax(140px, 0.42fr) auto;
}

label,
.field {
  display: grid;
  gap: 7px;
}

label > span,
.field > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfd;
  color: var(--ink);
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
.drop-zone:focus-within {
  outline: 3px solid rgba(11, 107, 99, 0.18);
  outline-offset: 2px;
}

.voice-field {
  display: block;
}

.voice-field input {
  width: 100%;
}

.drop-zone {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(244, 249, 250, 0.76)),
    color-mix(in srgb, var(--teal) 5%, white);
  cursor: default;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.drop-zone.is-opening-camera,
.drop-zone.is-opening-files {
  border-color: color-mix(in srgb, var(--teal) 42%, var(--line-strong));
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(229, 242, 239, 0.82)),
    color-mix(in srgb, var(--teal) 8%, white);
  box-shadow:
    0 0 0 4px rgba(11, 107, 99, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.drop-zone.is-opening-camera .drop-icon,
.drop-zone.is-opening-files .drop-icon {
  animation: softPulse 820ms ease-in-out infinite;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  display: grid;
  flex: 0 0 36px;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-size: 1.45rem;
  line-height: 1;
}

.drop-copy {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  gap: 3px;
}

.drop-copy strong {
  font-size: 0.96rem;
}

.drop-copy span {
  color: var(--muted);
  font-size: 0.82rem;
}

.drop-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 7px;
}

.drop-action {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--teal) 24%, var(--line));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--teal-ink);
  cursor: pointer;
  padding: 0 10px;
  font-weight: 850;
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  font: inherit;
}

.camera-action {
  background: var(--teal);
  color: white;
}

.primary-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 22px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(18, 28, 38, 0.12);
}

.primary-button:disabled {
  opacity: 0.62;
}

#statusText {
  grid-column: 1 / -1;
}

.status {
  min-height: 20px;
  font-size: 0.9rem;
}

.status.error {
  color: var(--red);
}

.action-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 20, 24, 0.42);
  backdrop-filter: blur(14px) saturate(0.92);
  animation: modalFade 160ms ease both;
}

.action-modal.is-closing {
  animation: modalFade 140ms ease reverse both;
}

.bill-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 32;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 20, 24, 0.55);
  backdrop-filter: blur(16px) saturate(0.92);
  animation: modalFade 160ms ease both;
}

.bill-viewer-modal.is-closing {
  animation: modalFade 140ms ease reverse both;
}

.has-bill-viewer {
  overflow: hidden;
}

.bill-viewer-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1120px, 100%);
  height: min(850px, calc(100dvh - 36px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(239, 247, 248, 0.92)),
    var(--surface);
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  animation: dialogIn 180ms cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.bill-viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.bill-viewer-head > div:first-child {
  min-width: 0;
}

.bill-viewer-head h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.bill-viewer-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.bill-viewer-tools {
  display: inline-grid;
  grid-template-columns: 40px minmax(52px, auto) 40px 56px 40px;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.bill-viewer-tools button,
.bill-viewer-tools span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-weight: 900;
}

.bill-viewer-tools span {
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
}

.bill-viewer-close {
  display: grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(168, 49, 42, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--red);
  font-size: 1.35rem;
  font-weight: 900;
}

.bill-viewer-stage {
  position: relative;
  display: grid;
  min-height: 0;
  align-items: start;
  justify-items: center;
  overflow: auto;
  padding: 22px;
  background:
    linear-gradient(45deg, rgba(210, 221, 226, 0.28) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(210, 221, 226, 0.28) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(210, 221, 226, 0.28) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(210, 221, 226, 0.28) 75%),
    #eef4f6;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.bill-viewer-stage.is-loading {
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.1)),
    linear-gradient(180deg, #eef4f6, #dfe9ed);
  background-size: 260% 100%, auto;
  animation: viewerLoadWash 1.1s ease-in-out infinite;
}

.bill-viewer-stage.is-loading::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 3px solid rgba(83, 97, 109, 0.18);
  border-top-color: var(--teal);
  border-radius: 999px;
  animation: spin 850ms linear infinite;
}

.bill-viewer-stage.is-loading::after {
  content: "Loading preview";
  position: absolute;
  left: 50%;
  top: calc(50% + 34px);
  z-index: 1;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.bill-viewer-stage iframe,
.bill-viewer-stage img {
  border: 0;
  background: white;
}

.bill-viewer-stage img {
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  object-fit: contain;
  box-shadow: 0 12px 32px rgba(18, 28, 38, 0.14);
  transition: opacity 140ms ease;
}

.bill-viewer-stage.is-loading img {
  opacity: 0;
}

.bill-viewer-stage iframe {
  width: 100%;
  height: 100%;
}

.bill-viewer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.bill-viewer-actions a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
}

.bill-viewer-actions a:last-child {
  border-color: color-mix(in srgb, var(--teal) 28%, white);
  background: var(--teal);
  color: white;
}

.action-dialog {
  display: grid;
  width: min(430px, 100%);
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(240, 246, 248, 0.92)),
    var(--surface);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  animation: dialogIn 180ms cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.action-dialog-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal-ink);
  font-size: 1.2rem;
  font-weight: 900;
}

.action-modal.is-danger .action-dialog-mark {
  background: #fff0ef;
  color: var(--red);
}

.action-dialog h2 {
  margin: 0;
  font-size: 1.24rem;
  line-height: 1.1;
}

.action-dialog p {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.action-dialog small {
  color: var(--muted);
  line-height: 1.45;
}

.action-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.danger-confirm {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--red);
  color: white;
  font-weight: 850;
  box-shadow: 0 10px 22px rgba(168, 49, 42, 0.18);
}

@keyframes modalFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes savedFolderWash {
  0% {
    box-shadow:
      0 0 0 0 color-mix(in srgb, var(--folder-color, var(--teal)) 24%, transparent),
      0 24px 52px color-mix(in srgb, var(--folder-color, var(--teal)) 18%, rgba(18, 28, 38, 0.12)),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
    filter: saturate(1.18);
  }
  45% {
    box-shadow:
      0 0 0 5px color-mix(in srgb, var(--folder-color, var(--teal)) 18%, transparent),
      0 26px 54px color-mix(in srgb, var(--folder-color, var(--teal)) 24%, rgba(18, 28, 38, 0.12)),
      inset 0 1px 0 rgba(255, 255, 255, 0.94);
    filter: saturate(1.3);
  }
  100% {
    box-shadow:
      0 24px 52px color-mix(in srgb, var(--folder-color, var(--teal)) 18%, rgba(18, 28, 38, 0.12)),
      inset 0 1px 0 rgba(255, 255, 255, 0.86),
      inset 0 -1px 0 rgba(255, 255, 255, 0.42);
    filter: saturate(1);
  }
}

@keyframes newReceiptIn {
  from {
    opacity: 0.72;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes viewerLoadWash {
  0% {
    background-position: 0 0, 0 0;
  }
  100% {
    background-position: 220% 0, 0 0;
  }
}

@keyframes softPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

.list-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-top: 8px;
}

.list-actions {
  display: flex;
  gap: 8px;
}

#backButton {
  border: 1px solid color-mix(in srgb, var(--blue) 22%, var(--line));
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(235, 244, 252, 0.76));
  color: var(--blue);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

#backButton::before {
  content: "‹";
  margin-right: 6px;
  font-size: 1.15em;
  line-height: 0;
}

.list-head h2 {
  margin-top: 2px;
  font-size: 1.28rem;
}

.text-button {
  padding: 0 14px;
  color: var(--teal-ink);
  font-weight: 800;
}

.receipt-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  padding-bottom: 36px;
}

.receipt-list.is-folder-detail {
  grid-template-columns: 1fr;
  gap: 12px;
}

.receipt-list.is-folder-detail + * {
  min-width: 0;
}

.folder-context {
  display: grid;
}

.folder-tile {
  position: relative;
  display: grid;
  min-height: 188px;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--folder-color, var(--teal)) 18%, rgba(255, 255, 255, 0.68));
  border-radius: 8px;
  background:
    radial-gradient(circle at 86% 18%, color-mix(in srgb, var(--folder-glow, white) 58%, transparent), transparent 32%),
    linear-gradient(128deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.58) 34%, color-mix(in srgb, var(--folder-color, var(--teal)) 10%, #f7fbfc) 100%),
    linear-gradient(180deg, color-mix(in srgb, var(--folder-color, var(--teal)) 22%, transparent), rgba(255, 255, 255, 0) 62%),
    linear-gradient(90deg, color-mix(in srgb, var(--folder-color, var(--teal)) 22%, transparent), transparent 42%);
  color: var(--ink);
  text-align: left;
  box-shadow:
    0 24px 52px color-mix(in srgb, var(--folder-color, var(--teal)) 18%, rgba(18, 28, 38, 0.12)),
    0 2px 0 rgba(255, 255, 255, 0.7) inset,
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    inset 0 -1px 0 rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(20px) saturate(1.18);
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.folder-tile:hover {
  border-color: color-mix(in srgb, var(--folder-color, var(--teal)) 38%, var(--glass-line));
  box-shadow:
    0 22px 48px rgba(18, 28, 38, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.38);
  transform: translateY(-1px);
}

.folder-tile:active {
  transform: translateY(0);
}

.folder-tile.has-new-receipt {
  border-color: color-mix(in srgb, var(--folder-color, var(--teal)) 44%, rgba(255, 255, 255, 0.72));
  animation: savedFolderWash 950ms ease-out 1;
}

.folder-tile.is-settled {
  opacity: 0.58;
  filter: grayscale(0.92) saturate(0.55);
}

.folder-tile.is-settled:hover {
  transform: none;
}

.folder-main {
  position: relative;
  display: grid;
  gap: 10px;
  width: 100%;
  min-height: 176px;
  align-content: end;
  padding: 34px 18px 18px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  overflow: hidden;
}

.folder-art {
  position: absolute;
  top: 30px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0.2)),
    color-mix(in srgb, var(--folder-color, var(--teal)) 16%, white);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 14px 26px rgba(18, 28, 38, 0.08);
}

.folder-art svg {
  width: 52px;
  height: 52px;
  fill: none;
  stroke: var(--folder-color, var(--teal));
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.folder-tile::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  width: min(118px, 42%);
  height: 16px;
  border: 1px solid color-mix(in srgb, var(--folder-color, var(--teal)) 22%, rgba(255, 255, 255, 0.62));
  border-bottom: 0;
  border-radius: 8px 10px 0 0;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.18)),
    linear-gradient(135deg, color-mix(in srgb, var(--folder-color, var(--teal)) 34%, white), color-mix(in srgb, var(--folder-color, var(--teal)) 16%, white));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  z-index: 1;
}

.folder-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, 0.58) 0%, rgba(255, 255, 255, 0.18) 22%, transparent 42%),
    linear-gradient(180deg, transparent 0, transparent 16px, color-mix(in srgb, var(--folder-color, var(--teal)) 22%, transparent) 17px, transparent 18px);
  pointer-events: none;
  z-index: 1;
}

.folder-main::before {
  content: "";
  position: absolute;
  inset: 18px 0 auto;
  height: 58px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent);
  pointer-events: none;
}

.folder-main > * {
  position: relative;
  z-index: 2;
}

.folder-main strong {
  display: block;
  max-width: calc(100% - 84px);
  margin-top: 0;
  font-size: 1.24rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.folder-date {
  color: var(--muted);
  font-size: 0.9rem;
}

.folder-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.folder-stats span {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 8px 18px rgba(18, 28, 38, 0.04);
  backdrop-filter: blur(10px);
}

.folder-stats b {
  color: var(--ink);
  font-size: 1rem;
}

.folder-card-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  margin: 0 18px 16px;
}

.folder-add-inline,
.folder-download-inline,
.folder-delete-inline {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
}

.folder-add-inline {
  border: 1px solid color-mix(in srgb, var(--teal) 28%, white);
  background: rgba(229, 242, 239, 0.78);
  color: var(--teal-ink);
}

.folder-delete-inline {
  border: 1px solid #e6bbb7;
  padding: 0 13px;
  background: rgba(255, 242, 241, 0.78);
  color: var(--red);
}

.folder-download-inline {
  border: 1px solid var(--line-strong);
  padding: 0 13px;
  background: rgba(238, 242, 245, 0.78);
  color: var(--ink);
}

.folder-add-inline,
.folder-download-inline,
.folder-delete-inline {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.folder-download-inline.disabled {
  cursor: default;
  opacity: 0.5;
}

.folder-open {
  grid-column: 1 / -1;
  position: relative;
  display: grid;
  gap: 13px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--folder-color, var(--teal)) 28%, rgba(255, 255, 255, 0.68));
  border-radius: 8px;
  background:
    radial-gradient(circle at 92% 10%, color-mix(in srgb, var(--folder-glow, white) 50%, transparent), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.8) 42%, color-mix(in srgb, var(--folder-color, var(--teal)) 8%, #f3f8fa)),
    linear-gradient(90deg, color-mix(in srgb, var(--folder-color, var(--teal)) 20%, transparent), transparent 42%);
  box-shadow:
    0 22px 48px rgba(18, 28, 38, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    inset 0 -1px 0 rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(18px) saturate(1.14);
  overflow: hidden;
}

.folder-open.is-settled {
  opacity: 0.72;
  filter: grayscale(0.72) saturate(0.62);
}

.folder-open.has-new-receipt {
  border-color: color-mix(in srgb, var(--folder-color, var(--teal)) 42%, rgba(255, 255, 255, 0.72));
  animation: savedFolderWash 950ms ease-out 1;
}

.folder-open::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  width: 128px;
  height: 18px;
  border-radius: 8px 10px 0 0;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.22)),
    color-mix(in srgb, var(--folder-color, var(--teal)) 24%, white);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.folder-open::after {
  content: "";
  position: absolute;
  inset: 18px 0 auto;
  height: 1px;
  background: color-mix(in srgb, var(--folder-color, var(--teal)) 18%, rgba(136, 154, 171, 0.34));
}

.folder-open > * {
  position: relative;
  z-index: 1;
}

.folder-open-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.folder-open-nav {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.folder-back-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--folder-color, var(--teal)) 28%, rgba(255, 255, 255, 0.7));
  border-radius: 8px;
  padding: 0 11px 0 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), color-mix(in srgb, var(--folder-color, var(--teal)) 10%, rgba(255, 255, 255, 0.78)));
  color: color-mix(in srgb, var(--folder-color, var(--teal)) 76%, #17212b);
  font-weight: 900;
  box-shadow:
    0 8px 18px color-mix(in srgb, var(--folder-color, var(--teal)) 10%, rgba(18, 28, 38, 0.08)),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.folder-back-button span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 7px;
  background: color-mix(in srgb, var(--folder-color, var(--teal)) 14%, white);
  font-size: 1.32rem;
  line-height: 1;
}

.folder-back-button b {
  font-size: 0.82rem;
}

.folder-open-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.folder-open-actions {
  display: flex;
  gap: 8px;
}

.folder-icon-action {
  display: grid;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.folder-icon-action.danger {
  color: var(--red);
  border-color: rgba(168, 49, 42, 0.22);
  background: rgba(255, 255, 255, 0.82);
}

.folder-icon-action.settle {
  color: var(--teal-ink);
  border-color: rgba(11, 107, 99, 0.24);
  background: rgba(229, 242, 239, 0.86);
}

.folder-icon-action.settle:disabled {
  color: #68717c;
  border-color: var(--line);
  background: rgba(238, 242, 245, 0.72);
  cursor: default;
}

.folder-icon-action.disabled,
.folder-icon-action:disabled {
  opacity: 0.62;
  pointer-events: none;
}

.folder-icon-action.is-busy {
  position: relative;
  color: transparent;
}

.folder-icon-action.is-busy::after {
  content: "";
  width: 15px;
  height: 15px;
  border: 2px solid rgba(76, 86, 97, 0.26);
  border-top-color: var(--teal-ink);
  border-radius: 50%;
  animation: spin 820ms linear infinite;
}

.folder-open.is-settled .folder-icon-action.settle {
  color: var(--blue);
  border-color: color-mix(in srgb, var(--blue) 30%, var(--line));
  background: rgba(235, 244, 252, 0.86);
}

.folder-open-identity {
  display: grid;
  gap: 8px;
  align-items: start;
  padding: 2px 0 0;
}

.folder-open h3 {
  max-width: 100%;
  margin: 0;
  font-size: clamp(1.72rem, 4vw, 2.65rem);
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.folder-open-date {
  width: fit-content;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--folder-color, var(--teal)) 18%, rgba(255, 255, 255, 0.72));
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), color-mix(in srgb, var(--folder-color, var(--teal)) 8%, rgba(255, 255, 255, 0.7)));
  color: color-mix(in srgb, var(--folder-color, var(--teal)) 68%, var(--muted));
  font-size: 0.84rem;
  font-weight: 850;
}

.capture-panel.upload-mode {
  border-color: color-mix(in srgb, var(--teal) 18%, var(--line));
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(244, 249, 250, 0.82)),
    rgba(255, 255, 255, 0.72);
  box-shadow:
    0 12px 30px rgba(18, 28, 38, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.capture-panel.upload-mode #receiptForm {
  grid-template-columns: minmax(280px, 1fr) minmax(150px, 0.46fr) auto;
  align-items: end;
}

.capture-panel.upload-mode .drop-zone {
  min-height: 66px;
  border-color: color-mix(in srgb, var(--teal) 32%, var(--line));
}

.capture-panel.upload-mode .primary-button {
  min-width: 132px;
}

.settled-note {
  width: fit-content;
  max-width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(238, 242, 245, 0.76);
  color: #4c5661;
  font-size: 0.84rem;
  font-weight: 750;
}

.folder-action-feedback {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--folder-color, var(--teal)) 24%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--folder-color, var(--teal)) 9%, rgba(255, 255, 255, 0.82));
  color: #26323d;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.25;
}

.folder-action-feedback::before {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-right: 7px;
  border: 2px solid color-mix(in srgb, var(--folder-color, var(--teal)) 28%, rgba(76, 86, 97, 0.25));
  border-top-color: var(--folder-color, var(--teal));
  border-radius: 50%;
  vertical-align: -0.08em;
  animation: spin 820ms linear infinite;
}

.folder-action-feedback.is-success {
  border-color: rgba(11, 107, 99, 0.22);
  background: rgba(229, 242, 239, 0.86);
  color: var(--teal-ink);
}

.folder-action-feedback.is-save {
  border-color: color-mix(in srgb, var(--folder-color, var(--teal)) 28%, rgba(255, 255, 255, 0.7));
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), color-mix(in srgb, var(--folder-color, var(--teal)) 12%, rgba(255, 255, 255, 0.74)));
  color: color-mix(in srgb, var(--folder-color, var(--teal)) 74%, #18222c);
}

.folder-action-feedback.is-success::before {
  content: "✓";
  width: auto;
  height: auto;
  border: 0;
  animation: none;
}

.folder-action-feedback.is-error {
  border-color: rgba(168, 49, 42, 0.24);
  background: #fff0ef;
  color: var(--red);
}

.folder-action-feedback.is-error::before {
  content: "!";
  width: auto;
  height: auto;
  border: 0;
  animation: none;
}

.folder-open-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, max-content));
  justify-content: start;
  gap: 8px;
}

.folder-open-meta span {
  display: flex;
  min-width: 122px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--folder-color, var(--teal)) 12%, rgba(255, 255, 255, 0.72));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.folder-open-meta b {
  color: var(--ink);
  font-size: 0.98rem;
  text-transform: none;
}

.folder-summary {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  background: var(--glass-strong);
  box-shadow: 0 12px 28px rgba(18, 28, 38, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
}

.folder-summary-actions {
  display: flex;
  gap: 8px;
}

.folder-summary-text {
  display: grid;
  gap: 3px;
}

.folder-summary span {
  color: var(--muted);
  font-size: 0.88rem;
}

.receipt-card {
  position: relative;
  z-index: 0;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: 14px;
  border-color: var(--glass-line);
  background: var(--glass-strong);
  box-shadow: 0 10px 24px rgba(18, 28, 38, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  scroll-margin-top: 180px;
}

.receipt-card::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 4px;
  border-radius: 0 8px 8px 0;
  background: var(--receipt-accent, var(--line-strong));
  opacity: 0.42;
}

.receipt-details {
  min-width: 0;
}

.receipt-card.is-moving {
  border-color: color-mix(in srgb, var(--teal) 34%, var(--glass-line));
}

.receipt-card.is-processing {
  border-color: color-mix(in srgb, var(--blue) 34%, var(--glass-line));
}

.receipt-card.is-processing::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  content: "";
  opacity: 0.7;
  transform: translateX(-100%);
  animation: receipt-reading-sheen 1.8s ease-in-out infinite;
}

.receipt-card.needs-attention {
  border-color: color-mix(in srgb, var(--red) 34%, var(--glass-line));
}

.receipt-card.is-new {
  border-color: color-mix(in srgb, var(--receipt-accent, var(--teal)) 42%, var(--glass-line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--receipt-accent, var(--teal)) 8%, transparent), rgba(255, 255, 255, 0.04)),
    var(--glass-strong);
  animation: newReceiptIn 220ms ease-out 1;
}

.receipt-card.is-new::before {
  width: 6px;
  opacity: 0.82;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--receipt-accent, var(--teal)) 12%, transparent);
}

.receipt-card.is-busy {
  opacity: 0.72;
  pointer-events: none;
}

.receipt-card.is-action-pending {
  border-color: color-mix(in srgb, var(--receipt-accent, var(--teal)) 32%, var(--glass-line));
}

.receipt-action-feedback {
  grid-column: 1 / -1;
  width: fit-content;
  max-width: 100%;
  margin: -2px 0 0;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--receipt-accent, var(--teal)) 24%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--receipt-accent, var(--teal)) 8%, rgba(255, 255, 255, 0.82));
  color: color-mix(in srgb, var(--receipt-accent, var(--teal)) 70%, #26323d);
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.25;
}

.receipt-action-feedback[hidden] {
  display: none;
}

.receipt-action-feedback::before {
  content: "";
  display: inline-block;
  width: 0.66em;
  height: 0.66em;
  margin-right: 7px;
  border: 2px solid color-mix(in srgb, var(--receipt-accent, var(--teal)) 24%, rgba(76, 86, 97, 0.22));
  border-top-color: var(--receipt-accent, var(--teal));
  border-radius: 50%;
  vertical-align: -0.08em;
  animation: spin 820ms linear infinite;
}

.receipt-action-feedback.is-success {
  border-color: rgba(11, 107, 99, 0.22);
  background: rgba(229, 242, 239, 0.86);
  color: var(--teal-ink);
}

.receipt-action-feedback.is-success::before {
  content: "✓";
  width: auto;
  height: auto;
  border: 0;
  animation: none;
}

.receipt-action-feedback.is-error {
  border-color: rgba(168, 49, 42, 0.24);
  background: #fff0ef;
  color: var(--red);
}

.receipt-action-feedback.is-error::before {
  content: "!";
  width: auto;
  height: auto;
  border: 0;
  animation: none;
}

.receipt-preview {
  position: relative;
  display: grid;
  width: 112px;
  height: 132px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(184, 204, 214, 0.78);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0)),
    var(--receipt-preview-image, linear-gradient(145deg, rgba(250, 253, 254, 0.94), rgba(224, 235, 238, 0.88)));
  background-position: center;
  background-size: cover;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow:
    0 8px 18px rgba(18, 28, 38, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.receipt-preview img {
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  object-fit: contain;
}

.bill-viewer-document {
  transform-origin: center center;
  transition: width 120ms ease, transform 120ms ease;
}

.receipt-preview.is-generated img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.receipt-preview-ext {
  position: absolute;
  right: 5px;
  top: 5px;
  max-width: calc(100% - 10px);
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 7px;
  background: rgba(15, 23, 32, 0.72);
  color: white;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(18, 28, 38, 0.12);
}

.receipt-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.receipt-title {
  min-width: 0;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.receipt-type {
  flex: 0 0 auto;
  border-radius: 8px;
  padding: 5px 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.receipt-file-name {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
  word-break: break-word;
}

@keyframes receipt-reading-sheen {
  0% {
    transform: translateX(-100%);
  }
  55%,
  100% {
    transform: translateX(100%);
  }
}

.receipt-actions {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 44px);
  align-items: stretch;
  justify-content: end;
  gap: 8px;
}

.receipt-actions > * {
  scroll-margin-top: 180px;
}

.move-button,
.receipt-menu-button,
.edit-button,
.info-button {
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.receipt-menu-button {
  color: var(--muted);
  font-size: 1.24rem;
}

.info-button {
  font-family: Georgia, serif;
  font-size: 1rem;
  font-style: italic;
}

.info-button:disabled {
  opacity: 0.46;
}

.download-button {
  display: inline-flex;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0;
  background: var(--teal);
  color: white;
  font-size: 1.1rem;
  font-weight: 800;
  text-decoration: none;
}

.share-button {
  display: inline-flex;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--line));
  border-radius: 8px;
  padding: 0;
  background: rgba(235, 244, 252, 0.86);
  color: var(--blue);
  font-size: 1.1rem;
  font-weight: 800;
}

.share-button:disabled {
  opacity: 0.64;
}

.delete-button {
  color: var(--red);
  font-size: 1.25rem;
}

.receipt-menu {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 10px 22px rgba(18, 28, 38, 0.06);
}

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

.receipt-menu button {
  display: inline-flex;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.receipt-menu .delete-button {
  border-color: rgba(168, 49, 42, 0.18);
  background: rgba(255, 247, 246, 0.84);
}

.move-panel,
.audit-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  align-items: center;
  padding-top: 2px;
}

.move-panel {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto;
}

.audit-panel {
  grid-template-columns: minmax(150px, 1.2fr) minmax(100px, 0.7fr) minmax(120px, 0.8fr) minmax(170px, 1fr) auto;
}

.move-panel[hidden],
.audit-panel[hidden] {
  display: none;
}

.move-panel select,
.move-panel input,
.audit-panel select,
.audit-panel input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
}

.move-panel input[hidden] {
  display: none;
}

.move-confirm,
.audit-save {
  min-height: 42px;
  border: 1px solid color-mix(in srgb, var(--teal) 28%, white);
  border-radius: 8px;
  background: rgba(229, 242, 239, 0.86);
  color: var(--teal-ink);
  padding: 0 13px;
  font-weight: 850;
}

.receipt-info {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  padding-top: 2px;
}

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

.receipt-info span {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.receipt-info small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.receipt-info b {
  color: var(--ink);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.receipt-reread-button {
  grid-column: 1 / -1;
  min-height: 42px;
  border: 1px solid color-mix(in srgb, var(--teal) 36%, white);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(229, 242, 239, 0.96), rgba(204, 231, 225, 0.9));
  color: var(--teal-ink);
  font: inherit;
  font-weight: 850;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.receipt-reread-button:disabled {
  opacity: 0.62;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
  font-size: 0.84rem;
}

.tag {
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--surface-2);
  color: #4c5661;
}

.tag.amount {
  background: #fff2db;
  color: var(--amber);
}

.tag.duplicate {
  background: #eef2f5;
  color: #6a7179;
}

.tag.reading {
  background: #e8f3ff;
  color: var(--blue);
}

.tag.check {
  background: #fff0ef;
  color: var(--red);
}

.empty {
  grid-column: 1 / -1;
  padding: 24px 0;
  text-align: center;
}

.empty.in-folder {
  padding: 12px 0;
}

.empty-panel {
  grid-column: 1 / -1;
  display: grid;
  min-height: 180px;
  place-items: center;
  gap: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(14px);
}

.empty-panel.in-folder {
  min-height: 210px;
  padding: 22px;
  border-style: solid;
  border-color: color-mix(in srgb, var(--folder-color, var(--teal)) 20%, var(--line-strong));
  background:
    radial-gradient(circle at 50% 0, color-mix(in srgb, var(--folder-glow, white) 42%, transparent), transparent 46%),
    var(--glass);
}

.empty-folder-art {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.24)),
    color-mix(in srgb, var(--folder-color, var(--teal)) 13%, white);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 12px 22px rgba(18, 28, 38, 0.07);
}

.empty-folder-art svg {
  width: 52px;
  height: 52px;
  fill: none;
  stroke: var(--folder-color, var(--teal));
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-folder-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.empty-folder-actions .primary-button,
.empty-folder-actions .text-button {
  min-width: 112px;
}

.empty-panel strong {
  font-size: 1.05rem;
}

@media (max-width: 900px) {
  .share-import {
    grid-template-columns: 1fr 1fr;
  }

  .share-copy,
  .share-actions,
  #shareStatus {
    grid-column: 1 / -1;
  }

  #receiptForm,
  .capture-panel.create-mode #receiptForm {
    grid-template-columns: 1fr 1fr;
  }

  .drop-zone,
  #statusText {
    grid-column: 1 / -1;
  }

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

  .receipt-preview {
    width: 88px;
    height: 104px;
  }

  .receipt-actions {
    grid-column: 1 / -1;
    justify-content: end;
  }
}

@media (max-width: 620px) {
  .shell,
  .app,
  .summary-strip,
  .capture-panel,
  #receiptForm,
  .receipt-list,
  .receipt-list > *,
  .folder-open,
  .folder-open-top,
  .folder-open-meta,
  .folder-summary,
  .receipt-card,
  .receipt-details,
  .receipt-title-row,
  .receipt-actions,
  .receipt-menu,
  .move-panel,
  .audit-panel {
    min-width: 0;
    max-width: 100%;
  }

  .shell {
    width: 100%;
  }

  .bill-viewer-modal {
    padding: 8px;
  }

  .bill-viewer-dialog {
    width: 100%;
    height: calc(100dvh - 16px);
  }

  .bill-viewer-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px;
  }

  .bill-viewer-tools {
    grid-column: 1 / -1;
    grid-template-columns: 44px minmax(52px, 1fr) 44px 64px 44px;
    order: 2;
    width: 100%;
    margin-left: 0;
  }

  .bill-viewer-close {
    grid-column: 2;
    grid-row: 1;
  }

  .bill-viewer-actions {
    padding: 10px;
  }

  .bill-viewer-stage {
    padding: 10px;
  }

  .bill-viewer-actions a {
    flex: 1;
  }

  .shell {
    padding: calc(10px + env(safe-area-inset-top)) 10px calc(18px + env(safe-area-inset-bottom));
  }

  .app-head {
    position: sticky;
    top: 0;
    z-index: 5;
    align-items: center;
    margin: -10px -10px 0;
    padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
    background: rgba(244, 248, 250, 0.86);
    border-bottom: 1px solid rgba(136, 154, 171, 0.22);
    backdrop-filter: blur(16px) saturate(1.08);
  }

  h1 {
    font-size: 1.18rem;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .head-actions {
    gap: 8px;
  }

  .summary-strip {
    border-radius: 8px;
  }

  .summary-strip div {
    padding: 11px 12px;
  }

  .list-head {
    align-items: center;
    margin-top: 2px;
  }

  .list-head h2 {
    font-size: 1.12rem;
  }

  .text-button,
  .icon-button {
    min-height: 42px;
  }

  .capture-panel {
    padding: 10px;
  }

  #receiptForm,
  .share-import,
  .capture-panel.create-mode #receiptForm,
  .capture-panel.upload-mode #receiptForm {
    grid-template-columns: 1fr;
  }

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

  .amount-field,
  .trip-field,
  #statusText {
    grid-column: auto;
  }

  .receipt-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .drop-zone {
    width: 100%;
    max-width: 100%;
    min-height: 78px;
    flex-wrap: wrap;
    padding: 14px;
    border-color: color-mix(in srgb, var(--teal) 28%, var(--line-strong));
  }

  .drop-actions {
    display: grid;
    width: 100%;
    min-width: 0;
    flex-basis: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .drop-action {
    min-width: 0;
    flex: 1;
  }

  .drop-icon {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
  }

  .drop-copy strong {
    font-size: 1.02rem;
  }

  .receipt-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 11px;
    padding: 11px;
    width: 100%;
  }

  .receipt-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-content: stretch;
    width: 100%;
  }

  .receipt-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .move-panel,
  .audit-panel {
    grid-template-columns: 1fr;
  }

  .receipt-preview {
    width: 72px;
    height: 88px;
  }

  .download-button,
  .share-button,
  .move-button,
  .receipt-menu-button,
  .edit-button,
  .info-button,
  .delete-button {
    width: auto;
    min-width: 0;
    max-width: 100%;
  }

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

  .folder-tile {
    min-height: 160px;
  }

  .folder-main {
    min-height: 160px;
    padding: 30px 15px 15px;
  }

  .folder-main strong {
    font-size: 1.16rem;
  }

  .folder-open {
    padding: 15px;
  }

  .folder-open-top {
    align-items: start;
    gap: 10px;
  }

  .folder-open-nav {
    align-items: start;
    flex-direction: column;
    gap: 7px;
  }

  .folder-back-button {
    min-height: 40px;
  }

  .folder-open-label {
    padding-left: 2px;
  }

  .folder-open h3 {
    font-size: 1.78rem;
  }

  .folder-open-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .folder-open-meta span {
    min-width: 0;
    padding: 9px;
  }

  .folder-stats span {
    padding: 9px;
  }

  .folder-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .folder-summary-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (display-mode: standalone) {
  html {
    background-color: #eef3f6;
  }

  .shell {
    max-width: 760px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
