:root {
  --bg: #f4f3ee;
  --surface: #ffffff;
  --surface-2: #ebe9e2;
  --fg: #1c1f1d;
  --muted: #5d6561;
  --line: #dddbd3;
  --accent: #0e7c5b;
  --accent-fg: #ffffff;
  --accent-strong: #0a6249;
  --accent-soft: #dcefe5;
  --warn: #8a5a0c;
  --warn-bg: #fbf0d8;
  --danger: #b42318;
  --danger-fg: #ffffff;
  --danger-bg: #fdecea;
  --ok: #0e7c5b;
  --ok-bg: #e3f4ec;
  --code-bg: #ffffff;
  --code-fg: #111312;
  --code-line: #dddbd3;
  --code-muted: #4a504c;
  --status-bar-bg: #0e7c5b;
  --media-bg: #000000;
  --on-media: #ffffff;
  --on-media-soft: rgb(255 255 255 / 0.18);
  --chrome-bg: rgb(244 243 238 / 0.86);
  --shadow: 0 1px 2px rgb(28 31 29 / 0.06), 0 6px 18px rgb(28 31 29 / 0.04);
  --shadow-raised: 0 16px 48px rgb(12 14 13 / 0.28);
  --knob: #ffffff;
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px;
  --font: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

:root,
::backdrop {
  --scrim: rgb(8 10 9 / 0.56);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181a;
    --surface: #202427;
    --surface-2: #2b3034;
    --fg: #eef0ec;
    --muted: #a2aaa5;
    --line: #353b3f;
    --accent: #2fbf8f;
    --accent-fg: #0d1f18;
    --accent-strong: #5fd3aa;
    --accent-soft: #173a2e;
    --warn: #e2a640;
    --warn-bg: #3a2f17;
    --danger: #f08a80;
    --danger-fg: #2a0f0c;
    --danger-bg: #3c1f1c;
    --ok: #2fbf8f;
    --ok-bg: #163327;
    --code-line: #353b3f;
    --status-bar-bg: #16181a;
    --chrome-bg: rgb(22 24 26 / 0.86);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.32);
    --shadow-raised: 0 16px 48px rgb(0 0 0 / 0.55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #16181a;
  --surface: #202427;
  --surface-2: #2b3034;
  --fg: #eef0ec;
  --muted: #a2aaa5;
  --line: #353b3f;
  --accent: #2fbf8f;
  --accent-fg: #0d1f18;
  --accent-strong: #5fd3aa;
  --accent-soft: #173a2e;
  --warn: #e2a640;
  --warn-bg: #3a2f17;
  --danger: #f08a80;
  --danger-fg: #2a0f0c;
  --danger-bg: #3c1f1c;
  --ok: #2fbf8f;
  --ok-bg: #163327;
  --code-line: #353b3f;
  --status-bar-bg: #16181a;
  --chrome-bg: rgb(22 24 26 / 0.86);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.32);
  --shadow-raised: 0 16px 48px rgb(0 0 0 / 0.55);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p,
ul,
dl,
dd {
  margin: 0;
}

a {
  color: var(--accent);
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.icon {
  flex: none;
  display: block;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top, 0px);
  overflow-x: clip;
}

.update-banner:not([hidden]) + .app {
  padding-top: 0;
}

.app::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  height: env(safe-area-inset-top, 0px);
  background: var(--status-bar-bg);
}

.view {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  min-height: calc(100vh - env(safe-area-inset-top, 0px));
  min-height: calc(100dvh - env(safe-area-inset-top, 0px));
  margin: 0 auto;
}

.view-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 8px 16px 28px;
}

.view-body > [data-region]:empty {
  display: none;
}

.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(48px, auto) 1fr minmax(48px, auto);
  align-items: center;
  gap: 4px;
  min-height: 56px;
  padding: 4px 8px;
  background: var(--chrome-bg);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
}

.topbar__title {
  min-width: 0;
  overflow: hidden;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__spacer {
  width: 48px;
}

.topbar--large {
  display: flex;
  justify-content: space-between;
  padding: 8px 8px 4px 16px;
}

.topbar--large .topbar__title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: left;
}

.topbar__back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: var(--tap);
  padding: 0 8px 0 2px;
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 17px;
  font-weight: 500;
  text-decoration: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.icon-btn:active {
  background: var(--surface-2);
}

.icon-btn--danger {
  color: var(--danger);
}

.bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: grid;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--chrome-bg);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
}

.bottom-bar:empty {
  display: none;
}

.bottom-bar--split {
  grid-template-columns: minmax(0, 1fr) auto;
}

.bottom-bar--split-wide {
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
}

.btn,
.chip,
.icon-btn,
.segment,
.link-btn,
input,
textarea,
select,
label {
  touch-action: manipulation;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: var(--tap);
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.12s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  pointer-events: none;
}

.btn:has(.file-input:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.btn-lg {
  min-height: 56px;
  font-size: 18px;
}

.btn-block {
  width: 100%;
}

.btn-start {
  justify-self: start;
  padding-left: 8px;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}

.btn-primary:active {
  background: var(--accent-strong);
}

.btn-secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--fg);
}

.btn-secondary:active {
  background: var(--surface-2);
}

.btn-ghost {
  color: var(--accent);
}

.btn-ghost:active {
  background: var(--accent-soft);
}

.btn-danger {
  background: var(--danger);
  color: var(--danger-fg);
}

.btn-danger-soft {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-media {
  background: var(--on-media);
  color: var(--media-bg);
}

.btn-link-media {
  min-height: var(--tap);
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--on-media);
  font-size: 17px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn {
  flex: none;
  min-height: var(--tap);
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
}

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

.stack {
  display: grid;
  gap: 10px;
}

.button-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card--padded {
  padding: 16px;
}

.card__text {
  color: var(--muted);
  font-size: 15px;
}

.card__text--strong {
  color: var(--fg);
  font-weight: 600;
}

.section-title {
  margin: 4px 4px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.group {
  display: grid;
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 15px;
}

.banner > .icon {
  margin-top: 1px;
}

.banner__text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.banner__action {
  min-height: var(--tap);
  margin-top: 10px;
  padding-inline: 16px;
  font-size: 15px;
}

.banner__text p + p,
.banner__text p + ul {
  margin-top: 6px;
}

.banner__list {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding-left: 18px;
  overflow-wrap: anywhere;
}

.banner--warn {
  background: var(--warn-bg);
  color: var(--fg);
}

.banner--warn > .icon {
  color: var(--warn);
}

.banner--danger {
  background: var(--danger-bg);
  color: var(--fg);
}

.banner--danger > .icon {
  color: var(--danger);
}

.banner--ok {
  background: var(--ok-bg);
  color: var(--fg);
}

.banner--ok > .icon {
  color: var(--ok);
}

.banner--muted {
  background: var(--surface-2);
  color: var(--fg);
}

.banner--muted > .icon {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.pill--ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.pill--warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.pill--danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.pill--muted {
  background: var(--surface-2);
  color: var(--muted);
}

.chain-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--chain-color, var(--muted));
}

.chain-dot--unknown {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--muted);
}

.chain-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 60%;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.chain-chip__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-row .chip > span:last-child {
  max-width: 45vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.chip::after {
  content: "";
  position: absolute;
  inset: -4px 0;
}

.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.chip--more {
  border-style: dashed;
  color: var(--muted);
}

.chip--small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.chip__note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.chip--small::after {
  inset: -6px 0;
}

.chip-row {
  display: flex;
  gap: 8px;
  margin: 0 -16px;
  padding: 6px 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 8px;
  padding: 4px 0;
}

.segment {
  display: flex;
  min-width: 0;
  border-radius: 13px;
  background: var(--surface-2);
}

.segment__btn {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 4px;
  overflow: hidden;
  border: 3px solid transparent;
  border-radius: 13px;
  background-clip: padding-box;
  background-color: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segment__btn[aria-pressed="true"] {
  background-color: var(--surface);
  color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--line);
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.summary {
  display: grid;
  gap: 4px;
  padding: 18px 20px 16px;
}

.summary--compact {
  display: block;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 15px;
}

.summary--compact strong {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.summary__label {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.summary__amount {
  font-size: 42px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.summary__stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.summary__stat {
  display: grid;
  align-content: start;
  gap: 2px;
  min-width: 0;
}

.summary__stat-label {
  color: var(--muted);
  font-size: 13px;
}

.summary__stat-value {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.summary__stat-note {
  color: var(--muted);
  font-size: 14px;
}

.summary__warn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 15px;
  font-weight: 600;
}

.voucher-list {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.voucher {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.voucher:active {
  background: var(--surface-2);
  transform: scale(0.99);
}

.voucher__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.voucher__amount {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.1;
  white-space: nowrap;
}

.voucher__when {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.voucher--soon {
  border-color: var(--warn);
  box-shadow: inset 4px 0 0 var(--warn), var(--shadow);
}

.voucher--soon .voucher__when {
  color: var(--warn);
  font-weight: 600;
}

.voucher--urgent {
  border-color: var(--danger);
  box-shadow: inset 4px 0 0 var(--danger), var(--shadow);
}

.voucher--urgent .voucher__when {
  color: var(--danger);
  font-weight: 700;
}

.voucher--dim {
  background: transparent;
  box-shadow: none;
}

.voucher--dim .voucher__amount {
  color: var(--muted);
}

.voucher--dim .chain-chip {
  color: var(--muted);
}

.voucher--dim .chain-dot {
  filter: grayscale(1);
  opacity: 0.6;
}

.voucher--used .voucher__amount {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 32px 12px 16px;
  text-align: center;
}

.empty__art,
.photo-intro__art {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 24px;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty__title,
.photo-intro__title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.empty__text,
.photo-intro__text {
  max-width: 34ch;
  color: var(--muted);
}

.empty__text--note {
  font-size: 14px;
  font-weight: 600;
}

.empty .btn {
  margin-top: 8px;
}

.empty-filter {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 28px 12px;
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.form-card {
  padding: 0 16px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.field:last-child {
  border-bottom: 0;
}

.field__label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.field__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -12px -4px -12px 0;
}

.field__optional {
  font-weight: 400;
}

.field__hint {
  color: var(--muted);
  font-size: 14px;
}

.field__hint--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.field__warning {
  color: var(--warn);
  font-weight: 600;
}

.field__warning--icon {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 14px;
}

.field__warning--icon .icon {
  margin-top: 2px;
}

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

.action-group__hint {
  padding: 0 4px;
}

.undo-bar {
  position: fixed;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  left: 16px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
  padding: 4px 4px 4px 16px;
  border-radius: var(--radius);
  background: var(--fg);
  color: var(--bg);
  box-shadow: var(--shadow-raised);
  font-size: 15px;
  font-weight: 600;
}

.undo-bar__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.undo-bar__action {
  flex: none;
  min-height: var(--tap);
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--bg);
  font-size: 15px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.undo-bar__action:focus-visible {
  outline-color: var(--bg);
}

.ocr--empty .btn {
  min-height: var(--tap);
}

.field__error {
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
}

.input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--fg);
  font-size: 17px;
  line-height: 1.3;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px var(--danger-bg);
}

.input[type="date"] {
  text-align: left;
}

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

.input--short {
  max-width: 140px;
}

.input--mono {
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

.textarea {
  min-height: 140px;
  font-family: var(--mono);
  font-size: 16px;
  resize: vertical;
}

.amount-input {
  position: relative;
}

.input--amount {
  min-height: 60px;
  padding-right: 52px;
  font-size: 30px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.amount-input__unit {
  position: absolute;
  top: 50%;
  right: 16px;
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
  transform: translateY(-50%);
  pointer-events: none;
}

.candidates {
  display: grid;
  gap: 4px;
}

.candidates__label {
  color: var(--muted);
  font-size: 13px;
}

.ocr {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius);
}

.ocr--running {
  border: 1px solid var(--line);
  background: var(--surface);
}

.ocr--done {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 2px 4px;
}

.ocr--failed {
  background: var(--danger-bg);
}

.ocr__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ocr__title {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 700;
}

.ocr--failed .ocr__title .icon {
  color: var(--danger);
}

.ocr__percent {
  color: var(--muted);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.ocr__label,
.ocr__note {
  color: var(--muted);
  font-size: 14px;
}

.ocr__error {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.ocr__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ocr__actions .btn {
  flex: 1 1 auto;
  white-space: nowrap;
}

.ocr-cta {
  border-style: dashed;
  border-color: var(--accent);
  color: var(--accent);
}

.progress {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-2);
}

.progress__bar {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform: scaleX(var(--p, 0));
  transform-origin: left center;
  transition: transform 0.3s ease;
}

.progress--indeterminate .progress__bar {
  width: 40%;
  transform: none;
  animation: progress-slide 1.4s ease-in-out infinite;
}

.spinner {
  flex: none;
  width: 20px;
  height: 20px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.busy-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 600;
}

.busy-card--media {
  border: 0;
  background: var(--surface);
  box-shadow: var(--shadow-raised);
}

.photo-intro {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 24px 8px 8px;
  text-align: center;
}

.code-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 20px 16px 18px;
  border: 1px solid var(--code-line);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-fg);
}

.code-card__symbol {
  width: 100%;
}

.code-card__symbol svg {
  display: block;
  width: 100%;
  height: 120px;
}

.code-card__symbol.is-qr svg {
  width: min(72vw, 280px);
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto;
}

.code-card__symbol.is-text {
  display: none;
}

.code-card__tip,
.code-fullscreen__tip {
  max-width: 34ch;
  color: var(--code-muted);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

.code-card__note {
  font-size: 14px;
  text-align: center;
}

.code-card__badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--code-fg);
  color: var(--code-bg);
  font-size: 13px;
  font-weight: 700;
}

.code-card--used .code-card__symbol,
.code-card--used .code-card__number {
  opacity: 0.35;
}

.code-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 50;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: var(--code-bg);
  color: var(--code-fg);
}

.code-fullscreen__stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px calc(env(safe-area-inset-right, 0px) + 72px) 16px calc(env(safe-area-inset-left, 0px) + 72px);
}

.code-fullscreen__symbol {
  width: 100%;
}

.code-fullscreen__symbol svg {
  display: block;
  width: 100%;
  height: min(58vh, 280px);
  height: min(58dvh, 280px);
}

.code-fullscreen__number {
  max-width: 100%;
  -webkit-user-select: all;
  user-select: all;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  overflow-wrap: anywhere;
}

.code-fullscreen__close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  right: calc(env(safe-area-inset-right, 0px) + 8px);
  background: var(--surface-2);
  color: var(--fg);
}

@media (orientation: portrait) {
  .code-fullscreen__stage {
    inset: auto;
    top: 50%;
    left: 50%;
    width: 100vh;
    width: 100dvh;
    height: 100vw;
    padding: 16px calc(env(safe-area-inset-top, 0px) + 64px);
    transform: translate(-50%, -50%) rotate(90deg);
  }

  .code-fullscreen__symbol svg {
    height: min(52vw, 280px);
  }
}

.code-card__fallback {
  font-size: 15px;
  text-align: center;
}

.code-card__number {
  max-width: 100%;
  -webkit-user-select: all;
  user-select: all;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.voucher-info {
  display: grid;
  gap: 12px;
  padding: 18px 16px 4px;
}

.voucher-info__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  gap: 8px;
  min-width: 0;
}

.voucher-info__amount {
  font-size: 46px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.voucher-info .chain-chip {
  max-width: 100%;
  min-width: 0;
  font-size: 15px;
}

.voucher-info .chain-chip__name {
  white-space: normal;
  overflow-wrap: anywhere;
}

.facts {
  display: grid;
}

.facts__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.facts--flush .facts__row:first-child {
  border-top: 0;
  padding-top: 0;
  min-height: 0;
}

.facts--flush {
  margin-bottom: 12px;
}

.facts dt {
  flex: none;
  color: var(--muted);
}

.facts dd {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 0;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.facts__sub {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.facts__row--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.facts__row--stacked dd {
  justify-items: start;
  font-weight: 400;
  text-align: left;
  white-space: pre-wrap;
}

.action-group {
  display: grid;
  gap: 10px;
}

.action-group .section-title {
  margin-bottom: 0;
}

.action-group .btn {
  padding-inline: 12px;
  font-size: 16px;
}

.debug {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.debug__summary {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 16px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.debug__summary::-webkit-details-marker {
  display: none;
}

.debug__summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s ease;
}

.debug[open] > .debug__summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.debug__content {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 0 16px 16px;
}

.debug__facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 12px;
  font-size: 14px;
}

.debug__facts dt {
  color: var(--muted);
}

.debug__facts dd {
  overflow-wrap: anywhere;
}

.debug__label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.debug__pre {
  max-height: 50vh;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font: 13px/1.45 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

code {
  font-family: var(--mono);
  font-size: 0.95em;
}

.rules {
  display: grid;
  gap: 8px;
}

.rules__head,
.rule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px var(--tap);
  align-items: center;
  gap: 8px;
}

.rules__head {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.rules__rows {
  display: grid;
  gap: 8px;
}

.rules__empty {
  color: var(--muted);
  font-size: 15px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 16px;
  cursor: pointer;
}

.switch-row__text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.switch-row__title {
  font-weight: 600;
}

.switch {
  position: relative;
  flex: none;
  width: 52px;
  height: 32px;
  margin: 0;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--knob);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}

.switch:checked {
  background: var(--accent);
  box-shadow: none;
}

.switch:checked::before {
  transform: translateX(20px);
}

.scanner {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  background: var(--media-bg);
  color: var(--on-media);
}

.scanner__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner__stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: calc(env(safe-area-inset-top, 0px) + 72px) 16px calc(env(safe-area-inset-bottom, 0px) + 140px);
}

.scanner__frame {
  position: relative;
  width: min(68vw, 360px);
  aspect-ratio: 3 / 1;
  border: 2px solid var(--on-media);
  border-radius: 18px;
  box-shadow: 0 0 0 100vmax var(--scrim);
  transition: border-color 0.2s ease;
}

.scanner__frame::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  left: 14px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
  animation: scan-sweep 2.2s ease-in-out infinite alternate;
}

.scanner[data-state="starting"] .scanner__frame::after,
.scanner[data-state="blocked"] .scanner__frame::after,
.scanner[data-state="paused"] .scanner__frame::after {
  display: none;
}

.scanner[data-state="found"] .scanner__frame {
  border-color: var(--accent);
  border-width: 4px;
}

.scanner[data-state="found"] .scanner__frame::after {
  animation: none;
}

.scanner[data-state="error"] .scanner__frame,
.scanner[data-state="error"] .scanner__hint,
.scanner[data-state="error"] .scanner__bottom .btn-media {
  display: none;
}

.scanner[data-state="error"]::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--scrim);
}

.scanner__hint {
  max-width: 30ch;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}

.scanner__panel {
  display: grid;
  gap: 10px;
  width: min(100%, 420px);
  padding: 20px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-raised);
  color: var(--fg);
}

.scanner__panel-title {
  font-size: 20px;
  font-weight: 800;
}

.scanner__panel-title:focus {
  outline: none;
}

.scanner__panel-text {
  color: var(--muted);
}

.scanner__panel-detail {
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.scanner__panel .stack {
  margin-top: 6px;
}

.scanner__top {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 0;
}

.icon-btn--media {
  background: var(--on-media-soft);
  color: var(--on-media);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.icon-btn--media:active {
  background: var(--on-media-soft);
}

.icon-btn--media[aria-pressed="true"] {
  background: var(--on-media);
  color: var(--media-bg);
}

.scanner__bottom {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}

.scanner__bottom .btn-media {
  width: min(100%, 360px);
}

.scanner__busy {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--scrim);
  color: var(--fg);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
  left: 16px;
  pointer-events: none;
  z-index: 100;
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--fg);
  color: var(--bg);
  box-shadow: var(--shadow-raised);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  animation: toast-in 0.22s ease-out;
}

.toast[data-kind="success"] {
  background: var(--ok);
  color: var(--accent-fg);
}

.toast[data-kind="error"] {
  background: var(--danger);
  color: var(--danger-fg);
}

.confirm-dialog {
  width: min(calc(100vw - 32px), 400px);
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-raised);
  color: var(--fg);
}

.confirm-dialog::backdrop {
  background: var(--scrim);
}

.confirm-dialog__body {
  display: grid;
  gap: 10px;
  padding: 22px 20px 18px;
}

.confirm-dialog__title {
  font-size: 20px;
  font-weight: 800;
}

.confirm-dialog__message {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.confirm-dialog__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.confirm-dialog__actions--stacked {
  grid-template-columns: 1fr;
}

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

@keyframes scan-sweep {
  from {
    transform: translateY(-28px);
  }
  to {
    transform: translateY(28px);
  }
}

@keyframes progress-slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 359px) {
  .segment {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .segment::-webkit-scrollbar {
    display: none;
  }

  .segment__btn {
    flex: 0 0 auto;
    overflow: visible;
  }
}

@media (min-width: 700px) {
  .view-body {
    padding-inline: 24px;
  }

  .chip-row {
    margin-inline: -24px;
    padding-inline: 24px;
  }
}

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

  .spinner {
    border-right-color: currentColor;
    opacity: 0.6;
  }

  .scanner__frame::after {
    display: none;
  }

  .progress--indeterminate .progress__bar {
    width: 100%;
    opacity: 0.5;
    animation: none;
  }
}

.update-banner {
  position: relative;
  z-index: 31;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(4px + env(safe-area-inset-top, 0px)) 4px 4px 16px;
  background: var(--accent);
  color: var(--accent-fg);
}

.update-banner__text {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.update-banner__action {
  flex: none;
  min-height: var(--tap);
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent-fg);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}

.update-banner__dismiss {
  display: grid;
  flex: none;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--accent-fg);
}

.update-banner :focus-visible {
  outline-color: var(--accent-fg);
}

.scanner__diagnostics {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  pointer-events: none;
}
