:root {
  --ink: #10213b;
  --ink-soft: #344b6c;
  --muted: #7c90ad;
  --muted-2: #a2b2c8;
  --blue: #2f6bf6;
  --blue-deep: #1952dc;
  --blue-soft: #eaf1ff;
  --red: #e84d5b;
  --line: rgba(168, 195, 233, 0.28);
  --card: rgba(255, 255, 255, 0.82);
  --shadow-card: 0 10px 26px rgba(58, 105, 178, 0.09);
  --shadow-float: 0 18px 46px rgba(50, 94, 164, 0.16);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "SF Mono", "Roboto Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
}

.clipboard-helper {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 8%, rgba(187, 218, 255, 0.9) 0, transparent 32%),
    radial-gradient(circle at 12% 90%, rgba(205, 230, 255, 0.86) 0, transparent 35%),
    linear-gradient(145deg, #eaf4ff 0%, #dbeaff 48%, #cfe2ff 100%);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(47, 107, 246, 0.28);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 22px;
  height: 22px;
  display: block;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-glow {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(42px);
  opacity: 0.75;
}

.page-glow-a {
  width: 280px;
  height: 280px;
  right: 14%;
  top: 12%;
  background: rgba(160, 202, 255, 0.54);
}

.page-glow-b {
  width: 340px;
  height: 340px;
  left: 9%;
  bottom: 8%;
  background: rgba(194, 221, 255, 0.62);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(430px, 100vw);
  height: min(920px, 100vh);
  height: min(920px, 100dvh);
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 89% 15%, rgba(180, 216, 255, 0.52) 0, transparent 28%),
    radial-gradient(circle at 8% 73%, rgba(200, 227, 255, 0.58) 0, transparent 31%),
    linear-gradient(180deg, #f8fbff 0%, #eef6ff 44%, #dfedff 100%);
  border-radius: 34px;
  box-shadow:
    0 36px 100px rgba(51, 89, 148, 0.28),
    0 2px 0 rgba(255, 255, 255, 0.9) inset;
}

.app-shell::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 230px;
  height: 230px;
  right: -92px;
  top: -105px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(159, 203, 255, 0.36), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.62);
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---------- headers ---------- */
.home-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: calc(24px + env(safe-area-inset-top)) 24px 0;
  flex: none;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.48);
  box-shadow:
    0 11px 24px rgba(46, 107, 229, 0.24),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
}

.brand-mark-blue {
  background: linear-gradient(145deg, #79b1ff 0%, #3878fb 45%, #1e56df 100%);
}

.brand-mark-chart {
  background: linear-gradient(145deg, #8bb9ff 0%, #3e7df8 46%, #1b54d7 100%);
}

.brand-icon {
  width: 27px;
  height: 27px;
  stroke-width: 1.7;
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.24;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.brand-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.6px;
  font-weight: 500;
}

.header-action {
  margin-left: auto;
  flex: none;
  height: 34px;
  padding: 0 11px 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  color: #3a587f;
  background: rgba(255, 255, 255, 0.68);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 6px 16px rgba(56, 98, 161, 0.09);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.15s ease, color 0.16s ease, background 0.16s ease;
}

.header-action .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.header-action:active {
  transform: scale(0.95);
  color: var(--blue);
  background: rgba(255, 255, 255, 0.94);
}

/* ---------- capture ---------- */
.capture-view {
  overflow: hidden;
}

.capture-main {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 22px calc(104px + env(safe-area-inset-bottom));
}

.scanner {
  position: relative;
  width: min(292px, 78vw);
  height: min(326px, 38vh);
  height: min(326px, 38dvh);
  min-height: 268px;
  margin-top: auto;
  flex: none;
}

.scan-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: #9fc2fa;
  border-style: solid;
  border-width: 0;
  opacity: 0.84;
}

.corner-tl {
  left: 18px;
  top: 22px;
  border-left-width: 2px;
  border-top-width: 2px;
  border-top-left-radius: 10px;
}

.corner-tr {
  right: 18px;
  top: 22px;
  border-right-width: 2px;
  border-top-width: 2px;
  border-top-right-radius: 10px;
}

.corner-bl {
  left: 18px;
  bottom: 29px;
  border-left-width: 2px;
  border-bottom-width: 2px;
  border-bottom-left-radius: 10px;
}

.corner-br {
  right: 18px;
  bottom: 29px;
  border-right-width: 2px;
  border-bottom-width: 2px;
  border-bottom-right-radius: 10px;
}

.scan-halo {
  position: absolute;
  left: 50%;
  top: 42%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.halo-outer {
  width: 215px;
  height: 215px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.86) 0%, rgba(227, 240, 255, 0.8) 47%, rgba(196, 223, 255, 0.28) 68%, transparent 71%);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 20px 55px rgba(98, 153, 231, 0.12);
  animation: halo-breathe 4.5s ease-in-out infinite;
}

.halo-inner {
  width: 166px;
  height: 166px;
  background: radial-gradient(circle at 42% 32%, rgba(255, 255, 255, 0.82), rgba(207, 231, 255, 0.38) 56%, transparent 72%);
  border: 1px dashed rgba(144, 186, 245, 0.38);
}

@keyframes halo-breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.96; }
  50% { transform: translate(-50%, -50%) scale(1.035); opacity: 1; }
}

.shutter {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 116px;
  height: 116px;
  transform: translate(-50%, -50%);
  border: 7px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background:
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.45) 0%, transparent 34%),
    linear-gradient(145deg, #6ba7ff 0%, #3779fb 44%, #1d55dc 100%);
  box-shadow:
    0 20px 44px rgba(43, 104, 232, 0.36),
    0 0 0 8px rgba(255, 255, 255, 0.26),
    inset 0 2px 4px rgba(255, 255, 255, 0.4);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  z-index: 2;
}

.shutter:active {
  transform: translate(-50%, -50%) scale(0.95);
  box-shadow:
    0 12px 28px rgba(43, 104, 232, 0.32),
    0 0 0 6px rgba(255, 255, 255, 0.2);
}

.shutter .icon {
  width: 47px;
  height: 47px;
  stroke-width: 1.55;
}

.shutter-caption {
  position: absolute;
  left: 50%;
  top: calc(42% + 117px);
  transform: translateX(-50%);
  margin: 0;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--ink-soft);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.mini-gallery {
  position: absolute;
  right: 5px;
  top: calc(42% - 10px);
  width: 65px;
  padding: 9px 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--blue);
  box-shadow: 0 10px 25px rgba(58, 104, 171, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  line-height: 1.3;
  font-weight: 600;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.mini-gallery-icon {
  width: 28px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, #edf5ff, #d8e8ff);
}

.mini-gallery-icon .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.gallery-button {
  position: relative;
  z-index: 2;
  width: min(292px, 80vw);
  height: 54px;
  margin-top: 17px;
  padding: 0 17px;
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: 19px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 13px 30px rgba(61, 107, 176, 0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.15s ease, background 0.2s ease;
}

.gallery-button:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.9);
}

.gallery-button-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #edf5ff, #dcecff);
  color: #3678ef;
}

.gallery-button-icon .icon {
  width: 19px;
  height: 19px;
}

.gallery-chevron {
  width: 18px;
  height: 18px;
  margin-left: auto;
  color: #8fa5c1;
  stroke-width: 2;
}

.capture-hint {
  position: relative;
  z-index: 2;
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 15px;
  color: #526c8e;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hint-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #f0a21b;
  background: rgba(255, 244, 202, 0.86);
}

.hint-icon .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2;
}

.wave-art {
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 190px;
  pointer-events: none;
}

/* ---------- bottom navigation ---------- */
.bottom-nav {
  position: absolute;
  z-index: 30;
  left: 16px;
  right: 16px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  height: 70px;
  padding: 7px 16px;
  display: flex;
  align-items: stretch;
  border-radius: 23px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.82);
  box-shadow:
    0 18px 40px rgba(45, 88, 157, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.nav-item {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #8a9db7;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.2px;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-item .icon {
  width: 23px;
  height: 23px;
  stroke-width: 1.9;
}

.nav-item.is-active {
  color: var(--blue);
}

.nav-item.is-active .icon {
  filter: drop-shadow(0 4px 7px rgba(47, 107, 246, 0.28));
}

.nav-item:active {
  background: rgba(234, 242, 255, 0.82);
}

/* ---------- search & ranking ---------- */
.search-view {
  overflow: hidden;
}

.search-header {
  padding-bottom: 0;
}

.search-bar {
  position: relative;
  z-index: 2;
  flex: none;
  height: 48px;
  margin: 18px 22px 0;
  padding: 5px 5px 5px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 24px rgba(59, 106, 175, 0.07);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar:focus-within {
  border-color: rgba(94, 148, 249, 0.55);
  box-shadow: 0 8px 26px rgba(59, 106, 175, 0.12), 0 0 0 3px rgba(47, 107, 246, 0.07);
}

.search-leading {
  width: 19px;
  height: 19px;
  color: #7f96b4;
  stroke-width: 2;
}

.search-bar input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
}

.search-bar input::placeholder {
  color: #8fa3be;
  font-weight: 500;
}

.search-bar input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-submit {
  flex: none;
  height: 36px;
  min-width: 58px;
  padding: 0 14px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #5b95ff, #2f6bf6);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 7px 16px rgba(47, 107, 246, 0.24);
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.search-submit:active {
  transform: scale(0.96);
}

.records-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 20px calc(108px + env(safe-area-inset-bottom));
  scrollbar-width: none;
}

.records-scroll::-webkit-scrollbar {
  display: none;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 21px 3px 14px;
}

.section-title-wrap h2 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.section-trophy {
  width: 20px;
  height: 20px;
  color: #e8a51b;
  stroke-width: 1.8;
}

.section-title-wrap p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.3px;
}

.crown-accent {
  width: 39px;
  height: 35px;
  flex: none;
  display: grid;
  place-items: center;
  color: #f1b52c;
  background: rgba(255, 248, 224, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 13px;
  transform: rotate(5deg);
  box-shadow: 0 6px 15px rgba(223, 164, 32, 0.1);
}

.crown-accent .icon {
  width: 21px;
  height: 21px;
  stroke-width: 1.8;
}

.records-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.rank-card {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 11px;
  padding: 14px 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 20px;
  box-shadow: 0 9px 22px rgba(65, 107, 171, 0.07);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  cursor: pointer;
}

.rank-card:active {
  transform: scale(0.988);
}

.rank-1 {
  background: linear-gradient(135deg, #fffaf0 0%, #ffe9b9 100%);
}

.rank-2 {
  background: linear-gradient(135deg, #f4f8ff 0%, #dce9ff 100%);
}

.rank-3 {
  background: linear-gradient(135deg, #fff5f1 0%, #ffdcd2 100%);
}

.rank-4 {
  background: linear-gradient(135deg, #f0fcf6 0%, #d1f2e2 100%);
}

.rank-5 {
  background: linear-gradient(135deg, #f0f6ff 0%, #deebff 100%);
}

.rank-rest {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(232, 241, 255, 0.94) 100%);
}

.rank-badge {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 6px 12px rgba(61, 101, 161, 0.16), inset 0 1px 1px rgba(255, 255, 255, 0.45);
}

.rank-1 .rank-badge {
  background: linear-gradient(145deg, #ffd766, #eda313);
  box-shadow: 0 6px 13px rgba(214, 151, 15, 0.26), inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

.rank-2 .rank-badge {
  background: linear-gradient(145deg, #a9c6ee, #6e94c6);
}

.rank-3 .rank-badge {
  background: linear-gradient(145deg, #ffae82, #f27545);
}

.rank-4 .rank-badge {
  background: linear-gradient(145deg, #6ed6aa, #2baa79);
}

.rank-5 .rank-badge {
  background: linear-gradient(145deg, #8bb6ff, #4d82e6);
}

.rank-rest .rank-badge {
  background: linear-gradient(145deg, #c1d4ef, #98b3d8);
}

.rank-body {
  min-width: 0;
}

.rank-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.rank-number {
  min-width: 0;
  padding-top: 1px;
  color: #223a5c;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.15px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-amount {
  flex: none;
  margin-left: auto;
  color: #1f3554;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.rank-amount .unit {
  margin-left: 2px;
  font-size: 9.5px;
  font-weight: 700;
  color: #6d829f;
}

.rank-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 9px;
  min-height: 27px;
}

.rank-time {
  min-width: 0;
  color: #7c91ac;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.rank-action {
  height: 27px;
  padding: 0 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #566c89;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease;
}

.rank-action .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.rank-action:active {
  background: rgba(255, 255, 255, 0.55);
  color: var(--blue-deep);
}

/* skeleton and states */
.skeleton-card {
  height: 87px;
  border-radius: 20px;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.54) 18%, rgba(255, 255, 255, 0.9) 36%, rgba(255, 255, 255, 0.54) 54%);
  background-size: 200% 100%;
  border: 1px solid rgba(255, 255, 255, 0.58);
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  from { background-position: 120% 0; }
  to { background-position: -80% 0; }
}

.empty-state {
  padding: 44px 26px 38px;
  text-align: center;
  border-radius: 23px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.empty-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  border-radius: 19px;
  color: #4d84ee;
  background: linear-gradient(145deg, #edf5ff, #d9e9ff);
  box-shadow: 0 8px 20px rgba(71, 117, 188, 0.1);
}

.empty-icon .icon {
  width: 27px;
  height: 27px;
}

.empty-state h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 750;
}

.empty-state p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.empty-action {
  margin-top: 18px;
  height: 40px;
  padding: 0 19px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, #5c96ff, #2f6bf6);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(47, 107, 246, 0.2);
}

.error-state .empty-icon {
  color: #d88327;
  background: linear-gradient(145deg, #fff9e8, #ffedc7);
}

/* ---------- overlays ---------- */
.overlay {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 90% 8%, rgba(184, 218, 255, 0.58), transparent 31%),
    linear-gradient(180deg, #f9fcff 0%, #f1f7ff 46%, #e8f1ff 100%);
  animation: overlay-in 0.3s cubic-bezier(0.22, 0.75, 0.24, 1);
}

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

.overlay-topbar {
  flex: none;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 8px;
  padding: calc(13px + env(safe-area-inset-top)) 20px 9px;
}

.overlay-topbar h2 {
  margin: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0.4px;
}

.topbar-spacer {
  width: 40px;
  height: 40px;
}

.round-button {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #324a6b;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 6px 18px rgba(56, 98, 161, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.15s ease;
}

.round-button:active {
  transform: scale(0.94);
}

.round-button .icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.overlay-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px calc(28px + env(safe-area-inset-bottom));
  scrollbar-width: none;
}

.overlay-scroll::-webkit-scrollbar {
  display: none;
}

.review-preview,
.detail-preview {
  position: relative;
  width: 100%;
  height: clamp(238px, 35vh, 338px);
  height: clamp(238px, 35dvh, 338px);
  overflow: hidden;
  border-radius: 24px;
  background: #102035;
  box-shadow: 0 18px 38px rgba(28, 55, 91, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.review-preview img,
.detail-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background:
    radial-gradient(circle at 50% 35%, rgba(79, 111, 154, 0.28), transparent 62%),
    #102035;
}

.detail-overlay {
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.detail-scroll {
  touch-action: pan-y;
  overscroll-behavior: contain;
  overscroll-behavior-x: none;
  will-change: transform;
}

.detail-scroll.is-snapping {
  transition: transform 0.22s cubic-bezier(0.22, 0.75, 0.24, 1);
}

.detail-scroll.slide-next {
  animation: detail-slide-from-right 0.28s cubic-bezier(0.22, 0.75, 0.24, 1);
}

.detail-scroll.slide-prev {
  animation: detail-slide-from-left 0.28s cubic-bezier(0.22, 0.75, 0.24, 1);
}

@keyframes detail-slide-from-right {
  from { opacity: 0.35; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes detail-slide-from-left {
  from { opacity: 0.35; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}

.detail-page-indicator {
  position: absolute;
  right: 12px;
  bottom: 12px;
  min-width: 47px;
  height: 26px;
  padding: 0 9px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(8, 23, 41, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.2px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
}

.preview-shade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 90px;
  background: linear-gradient(180deg, transparent, rgba(5, 17, 33, 0.48));
  pointer-events: none;
}

.ocr-badge {
  position: absolute;
  left: 13px;
  bottom: 13px;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #fff;
  background: rgba(10, 26, 47, 0.64);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.ocr-badge.is-done {
  color: #14724d;
  background: rgba(240, 255, 248, 0.92);
  border-color: rgba(255, 255, 255, 0.65);
}

.ocr-badge.is-warning {
  color: #96611a;
  background: rgba(255, 248, 228, 0.95);
  border-color: rgba(255, 255, 255, 0.7);
}

.ocr-badge .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

.spinner {
  width: 13px;
  height: 13px;
  flex: none;
  border: 2px solid rgba(47, 107, 246, 0.18);
  border-top-color: var(--blue);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.75s linear infinite;
}

.spinner-white {
  border-color: rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
}

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

.recognize-note {
  margin-top: 12px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 14px;
  color: #8a641a;
  background: rgba(255, 247, 222, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.68);
  font-size: 11px;
  line-height: 1.5;
  font-weight: 500;
}

.recognize-note .icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: #e6a11b;
}

/* ---------- 用模型识别 ---------- */
.vision-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.vision-retry {
  flex: none;
  height: 40px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 13px;
  color: #2b66dd;
  background: rgba(214, 230, 255, 0.8);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 7px 16px rgba(47, 107, 246, 0.1);
  transition: transform 0.15s ease, opacity 0.16s ease, background 0.16s ease;
}

.vision-retry .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.vision-retry:active:not(:disabled) {
  transform: scale(0.96);
}

.vision-retry:disabled {
  opacity: 0.66;
}

.vision-retry.is-off {
  color: #5c7391;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 6px 14px rgba(56, 98, 161, 0.08);
}

.vision-hint {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.45;
  letter-spacing: 0.1px;
}

.info-form {
  margin-top: 14px;
}

.edit-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 3px 9px;
}

.edit-section-title h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 750;
}

.edit-section-title span {
  color: var(--muted);
  font-size: 10px;
}

.field-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 66px;
  padding: 11px 14px;
  margin-bottom: 10px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 21px rgba(55, 100, 166, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field-card:focus-within {
  border-color: rgba(95, 150, 250, 0.48);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px rgba(55, 100, 166, 0.1), 0 0 0 3px rgba(47, 107, 246, 0.06);
}

.field-icon {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #3978ee;
  background: linear-gradient(145deg, #eef5ff, #dceaff);
}

.field-icon .icon {
  width: 20px;
  height: 20px;
  stroke-width: 1.9;
}

.field-icon-amount {
  color: #c58a15;
  background: linear-gradient(145deg, #fff9e8, #fff0c9);
}

.field-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.field-label {
  color: #7d91ac;
  font-size: 10px;
  font-weight: 550;
  letter-spacing: 0.3px;
}

.field-input {
  width: 100%;
  min-width: 0;
  height: 27px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #172c49;
  font-size: 16px;
  line-height: 27px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.number-input {
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: -0.25px;
  appearance: none;
  -webkit-appearance: none;
}

.field-input::placeholder {
  color: #b5c4d8;
  font-weight: 500;
}

.amount-unit {
  flex: none;
  align-self: flex-end;
  margin-bottom: 5px;
  color: #677d99;
  font-size: 11.5px;
  font-weight: 700;
}

.field-status {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  display: none;
  place-items: center;
  color: #fff;
  background: #46b982;
}

.field-card.is-valid .field-status {
  display: grid;
}

.field-status::after {
  content: "";
  width: 7px;
  height: 4px;
  border-left: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(-45deg) translate(0.5px, -0.5px);
}


.quick-amounts {
  margin: -2px 3px 13px;
  padding: 0 1px;
}

.quick-amounts-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 550;
  letter-spacing: 0.2px;
}

.quick-amount-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.quick-amount-button {
  height: 36px;
  padding: 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 11px;
  color: #496381;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 5px 12px rgba(55, 100, 166, 0.05);
  font-size: 12px;
  font-weight: 700;
  transition: color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.quick-amount-button:active {
  transform: scale(0.96);
}

.quick-amount-button.is-selected {
  color: #fff;
  background: linear-gradient(135deg, #619bff, #2f6bf6);
  border-color: transparent;
  box-shadow: 0 6px 14px rgba(47, 107, 246, 0.22);
}

.primary-button {
  position: relative;
  width: 100%;
  height: 54px;
  border: 0;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #619bff 0%, #2f6bf6 48%, #1f56df 100%);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.5px;
  box-shadow: 0 14px 28px rgba(47, 107, 246, 0.26);
  transition: transform 0.16s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.primary-button:active:not(:disabled) {
  transform: scale(0.985);
  box-shadow: 0 9px 20px rgba(47, 107, 246, 0.22);
}

.primary-button:disabled {
  color: rgba(255, 255, 255, 0.74);
  background: linear-gradient(135deg, #b8c9e5, #9eb5d7);
  box-shadow: none;
}

.save-button {
  margin-top: 6px;
}

.save-caption {
  margin: 9px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.2px;
}

/* ---------- detail ---------- */
.detail-preview {
  height: clamp(210px, 30vh, 300px);
  height: clamp(210px, 30dvh, 300px);
}

.detail-card {
  position: relative;
  z-index: 2;
  margin-top: 16px;
  padding: 3px 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 0;
}

.detail-row-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #3978ee;
  background: linear-gradient(145deg, #eef5ff, #dceaff);
}

.detail-row-icon .icon {
  width: 19px;
  height: 19px;
}

.detail-row:nth-child(3) .detail-row-icon {
  color: #c58a15;
  background: linear-gradient(145deg, #fff9e8, #fff0c9);
}

.detail-row:nth-child(5) .detail-row-icon {
  color: #4a8c84;
  background: linear-gradient(145deg, #edfbf7, #d9f4ec);
}

.detail-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.detail-label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
}

.detail-row-body strong {
  color: #1a304e;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.35;
  word-break: break-all;
}

#detailNumber {
  font-family: var(--mono);
  font-size: 16.5px;
  letter-spacing: -0.15px;
}

.detail-divider {
  height: 1px;
  margin-left: 50px;
  background: rgba(163, 187, 220, 0.18);
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.soft-button {
  height: 50px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  transition: transform 0.15s ease, background 0.2s ease;
}

.soft-button:active {
  transform: scale(0.98);
}

.soft-button .icon {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.soft-blue {
  color: #2b66dd;
  background: rgba(214, 230, 255, 0.78);
}

.soft-red {
  color: #dd4d5b;
  background: rgba(255, 222, 225, 0.8);
}

.close-button {
  width: 100%;
  height: 50px;
  margin-top: 11px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  color: #425a78;
  background: rgba(255, 255, 255, 0.64);
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 6px 18px rgba(49, 91, 154, 0.05);
}

.close-button:active {
  background: rgba(255, 255, 255, 0.86);
}


/* ---------- settings ---------- */
.settings-overlay {
  z-index: 46;
}

.settings-scroll {
  padding-bottom: calc(30px + env(safe-area-inset-bottom));
}

.settings-intro {
  margin: 2px 3px 18px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.settings-section {
  margin-bottom: 16px;
}

.settings-section-title {
  margin: 0 3px 9px;
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: 0.2px;
}

.preset-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-chip {
  height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  color: #43608a;
  background: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 6px 16px rgba(55, 100, 166, 0.05);
  transition: transform 0.15s ease, color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.preset-chip[data-preset="custom"] {
  grid-column: 1 / -1;
}

.preset-chip:active {
  transform: scale(0.97);
}

.preset-chip.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #619bff 0%, #2f6bf6 60%, #1f56df 100%);
  box-shadow: 0 9px 20px rgba(47, 107, 246, 0.22);
}

.settings-preset-note {
  margin: 9px 3px 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 11px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 8px 21px rgba(55, 100, 166, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.settings-field:focus-within {
  border-color: rgba(95, 150, 250, 0.48);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(55, 100, 166, 0.1), 0 0 0 3px rgba(47, 107, 246, 0.06);
}

.settings-label {
  color: #7d91ac;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.settings-field input {
  width: 100%;
  min-width: 0;
  height: 26px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #172c49;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1px;
}

.settings-field input::placeholder {
  color: #b5c4d8;
  font-weight: 500;
}

.settings-hint {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.key-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-input-wrap input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  letter-spacing: 0;
}

.key-toggle {
  flex: none;
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 9px;
  color: #3568c4;
  background: rgba(230, 240, 255, 0.9);
  font-size: 10px;
  font-weight: 700;
}

.key-toggle:active {
  background: rgba(216, 231, 255, 0.98);
}

.settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 3px;
}

.settings-test,
.settings-save {
  height: 50px;
  padding: 0 10px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.2px;
  transition: transform 0.15s ease, opacity 0.18s ease;
}

.settings-test {
  border: 1px solid rgba(255, 255, 255, 0.92);
  color: #36577f;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 18px rgba(51, 99, 173, 0.07);
}

.settings-save {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #619bff 0%, #2f6bf6 55%, #1f56df 100%);
  box-shadow: 0 12px 24px rgba(47, 107, 246, 0.24);
}

.settings-test:active:not(:disabled),
.settings-save:active:not(:disabled) {
  transform: scale(0.98);
}

.settings-test:disabled,
.settings-save:disabled {
  opacity: 0.7;
}

.settings-status {
  margin: 2px 0 0;
  padding: 10px 12px;
  border-radius: 13px;
  color: #37527a;
  background: rgba(234, 241, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 550;
  line-height: 1.55;
  word-break: break-word;
}

.settings-status[data-kind="ok"] {
  color: #14724d;
  background: rgba(228, 250, 239, 0.9);
}

.settings-status[data-kind="error"] {
  color: #a8323f;
  background: rgba(255, 233, 235, 0.92);
}

.settings-status[data-kind="pending"] {
  color: #8a641a;
  background: rgba(255, 247, 222, 0.92);
}

.settings-caption {
  margin: 1px 3px 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

/* ---------- full-screen big-text mode ---------- */
.big-mode-button {
  color: var(--blue);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.2px;
}

.app-shell.has-big-view .toast {
  position: fixed;
  bottom: calc(170px + env(safe-area-inset-bottom));
}

.app-shell.has-big-view .modal {
  position: fixed;
}

.big-view {
  position: fixed;
  touch-action: pan-y;
  overscroll-behavior: contain;
  z-index: 60;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  padding:
    calc(22px + env(safe-area-inset-top))
    16px
    calc(16px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 18% 12%, rgba(168, 207, 255, 0.55), transparent 34%),
    radial-gradient(circle at 88% 82%, rgba(197, 226, 255, 0.65), transparent 38%),
    linear-gradient(180deg, #f9fcff 0%, #eef6ff 48%, #e2eeff 100%);
  color: var(--ink);
}

.big-main {
  width: 100%;
  max-width: 680px;
  flex: 1;
  min-height: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3.4vh, 34px);
  text-align: center;
}

.big-view:focus {
  outline: none;
}

.big-number {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.5vh, 16px);
  color: #0d1f38;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "PingFang SC", monospace;
  font-size: clamp(38px, calc((100vw - 64px) / 4.25), 88px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-shadow: none;
}

.big-number-line {
  display: block;
  max-width: 100%;
  padding-left: 0.06em;
  white-space: nowrap;
  overflow: visible;
}

.big-amount {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  color: #112a4b;
  font-family: var(--font);
  font-size: clamp(34px, 11vw, 68px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.big-amount-unit {
  color: #57708f;
  font-size: clamp(13px, 3.2vw, 20px);
  font-weight: 700;
  letter-spacing: 0;
}

.big-actions {
  width: 100%;
  max-width: 620px;
  margin: 10px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: none;
}

.big-nav-button,
.big-exit-button {
  min-height: 52px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  font-size: 14.5px;
  font-weight: 750;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.big-nav-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #4a6588;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 7px 18px rgba(51, 99, 173, 0.06);
}

.big-nav-button .icon {
  width: 18px;
  height: 18px;
  stroke-width: 2.1;
}

.big-nav-button:active:not(:disabled) {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.96);
}

.big-nav-button:disabled {
  opacity: 0.34;
}

.big-exit-button {
  grid-column: 1 / -1;
  color: #3b5578;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 6px 16px rgba(51, 99, 173, 0.05);
  font-weight: 700;
  font-size: 13.5px;
}

.big-exit-button:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.88);
}

/* ---------- dialog & toast ---------- */
.modal {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 36, 61, 0.3);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fade-in 0.2s ease;
}

.dialog-card {
  position: relative;
  z-index: 1;
  width: min(326px, 100%);
  padding: 23px 22px 19px;
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: linear-gradient(180deg, #fbfdff 0%, #f1f7ff 100%);
  box-shadow: 0 28px 70px rgba(14, 37, 69, 0.26);
  text-align: center;
  animation: dialog-in 0.24s cubic-bezier(0.2, 0.9, 0.25, 1);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.dialog-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  color: #df4f5c;
  border-radius: 17px;
  background: linear-gradient(145deg, #fff1f2, #ffdce0);
}

.dialog-icon .icon {
  width: 24px;
  height: 24px;
}

.dialog-card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
}

.dialog-card p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.dialog-button {
  height: 46px;
  border: 0;
  border-radius: 14px;
  color: #495f7d;
  background: rgba(225, 236, 250, 0.82);
  font-size: 13px;
  font-weight: 700;
}

.dialog-delete {
  color: #fff;
  background: linear-gradient(135deg, #f06b76, #dc4755);
  box-shadow: 0 9px 20px rgba(220, 71, 85, 0.22);
}

.dialog-button:disabled {
  opacity: 0.65;
}

.toast {
  position: absolute;
  z-index: 90;
  left: 50%;
  bottom: calc(102px + env(safe-area-inset-bottom));
  max-width: calc(100% - 44px);
  min-height: 42px;
  padding: 8px 15px 8px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  background: rgba(20, 38, 63, 0.92);
  box-shadow: 0 15px 34px rgba(18, 38, 65, 0.24);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-icon {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #052318;
  background: #a4f0c8;
}

.toast.is-error .toast-icon {
  color: #3a090d;
  background: #ffc3c8;
}

.toast-icon .icon {
  width: 15px;
  height: 15px;
  stroke-width: 2.4;
}

.button-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button-loading .spinner {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}

/* ---------- responsive ---------- */
@media (min-width: 561px) {
  .app-shell {
    height: min(920px, calc(100vh - 36px));
    height: min(920px, calc(100dvh - 36px));
    border-radius: 36px;
    border: 1px solid rgba(255, 255, 255, 0.54);
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }

  .page-glow {
    display: none;
  }
}

@media (max-height: 720px) {
  .home-header {
    padding-top: calc(16px + env(safe-area-inset-top));
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }

  .brand-copy h1 {
    font-size: 21px;
  }

  .scanner {
    min-height: 245px;
    height: 31vh;
    height: 31dvh;
  }

  .shutter {
    width: 102px;
    height: 102px;
  }

  .shutter .icon {
    width: 41px;
    height: 41px;
  }

  .shutter-caption {
    top: calc(42% + 110px);
    font-size: 15px;
  }

  .halo-outer {
    width: 188px;
    height: 188px;
  }

  .halo-inner {
    width: 148px;
    height: 148px;
  }

  .mini-gallery {
    top: calc(42% - 14px);
  }

  .gallery-button {
    margin-top: 10px;
    height: 49px;
  }

  .capture-hint {
    padding: 8px 13px;
  }

  .section-heading {
    padding-top: 15px;
  }

  .bottom-nav {
    height: 64px;
  }

  .review-preview {
    height: 200px;
  }

  .field-card {
    min-height: 60px;
  }
}

@media (max-height: 640px) {
  .mini-gallery {
    display: none;
  }

  .scanner {
    min-height: 220px;
  }

  .capture-main {
    padding-top: 0;
  }
}

@media (max-width: 360px) {
  .overlay-scroll {
    padding-left: 16px;
    padding-right: 16px;
  }

  .field-card {
    padding: 10px 12px;
    gap: 9px;
  }

  .field-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .field-status {
    display: none !important;
  }

  .number-input {
    font-size: 16px;
    letter-spacing: -0.4px;
  }

  .amount-input {
    font-size: 15px;
  }

  .review-preview {
    height: 210px;
  }
}

@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;
  }
}
