/* Receiptly · SMQ monochrome dark (minimal) */

:root,
[data-palette="smq-mono"],
[data-palette="graphite"] {
  --bg: #050505;
  --surface: #0e0e0e;
  --surface-2: #161616;
  --text: #f2f2f2;
  --muted: #8a8a8a;
  --faint: #555;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #f2f2f2;
  --accent-fg: #050505;
  --accent-soft: rgba(255, 255, 255, 0.07);
  --accent-glow: transparent;
  --ok: #c8c8c8;
  --ok-bg: rgba(255, 255, 255, 0.06);
  --err: #e8e8e8;
  --err-bg: rgba(255, 255, 255, 0.08);
  --info: #a0a0a0;
  --info-bg: rgba(255, 255, 255, 0.06);
  --swatch-1: #050505;
  --swatch-2: #f2f2f2;
  --swatch-3: #555;
}

/* Optional accents kept but de-emphasized */
[data-palette="midnight"] {
  --bg: #070b14; --surface: #0f1624; --surface-2: #172033;
  --text: #e8eefc; --muted: #8b9bb8; --faint: #5a6a88;
  --line: rgba(140, 170, 255, 0.12); --accent: #8eb6ff; --accent-fg: #071018;
  --accent-soft: rgba(142, 182, 255, 0.14); --accent-glow: transparent;
  --ok: #a8c4ff; --ok-bg: rgba(142, 182, 255, 0.1);
  --err: #e8e8e8; --err-bg: rgba(255,255,255,0.08);
  --info: #93c5fd; --info-bg: rgba(147,197,253,0.1);
  --swatch-1: #070b14; --swatch-2: #8eb6ff; --swatch-3: #5a6a88;
}
[data-palette="ember"] {
  --bg: #0c0908; --surface: #161110; --surface-2: #211816;
  --text: #f6efe9; --muted: #a8988c; --faint: #6e5f56;
  --line: rgba(255,180,120,0.1); --accent: #e8a06a; --accent-fg: #1a0e08;
  --accent-soft: rgba(232,160,106,0.14); --accent-glow: transparent;
  --ok: #c8c8c8; --ok-bg: rgba(255,255,255,0.06);
  --err: #e8e8e8; --err-bg: rgba(255,255,255,0.08);
  --info: #fdba74; --info-bg: rgba(253,186,116,0.1);
  --swatch-1: #0c0908; --swatch-2: #e8a06a; --swatch-3: #6e5f56;
}
[data-palette="forest"] {
  --bg: #080c0a; --surface: #101612; --surface-2: #18201a;
  --text: #eaf3ec; --muted: #8fa598; --faint: #5c6f63;
  --line: rgba(140,200,160,0.1); --accent: #7dcea0; --accent-fg: #07140c;
  --accent-soft: rgba(125,206,160,0.14); --accent-glow: transparent;
  --ok: #c8c8c8; --ok-bg: rgba(255,255,255,0.06);
  --err: #e8e8e8; --err-bg: rgba(255,255,255,0.08);
  --info: #86efac; --info-bg: rgba(134,239,172,0.1);
  --swatch-1: #080c0a; --swatch-2: #7dcea0; --swatch-3: #5c6f63;
}
[data-palette="violet"] {
  --bg: #0b0912; --surface: #14111f; --surface-2: #1d1830;
  --text: #f0eafc; --muted: #9b92b5; --faint: #6b6288;
  --line: rgba(180,150,255,0.12); --accent: #b9a0ff; --accent-fg: #120a22;
  --accent-soft: rgba(185,160,255,0.14); --accent-glow: transparent;
  --ok: #c8c8c8; --ok-bg: rgba(255,255,255,0.06);
  --err: #e8e8e8; --err-bg: rgba(255,255,255,0.08);
  --info: #c4b5fd; --info-bg: rgba(196,181,253,0.1);
  --swatch-1: #0b0912; --swatch-2: #b9a0ff; --swatch-3: #6b6288;
}
[data-palette="ocean"] {
  --bg: #060d10; --surface: #0d171b; --surface-2: #142328;
  --text: #e6f4f6; --muted: #7fa3ab; --faint: #4f6e75;
  --line: rgba(80,200,210,0.12); --accent: #5eead4; --accent-fg: #04201c;
  --accent-soft: rgba(94,234,212,0.14); --accent-glow: transparent;
  --ok: #c8c8c8; --ok-bg: rgba(255,255,255,0.06);
  --err: #e8e8e8; --err-bg: rgba(255,255,255,0.08);
  --info: #67e8f9; --info-bg: rgba(103,232,249,0.1);
  --swatch-1: #060d10; --swatch-2: #5eead4; --swatch-3: #4f6e75;
}
[data-palette="smq"] {
  --bg: #050505; --surface: #0e0e0e; --surface-2: #161616;
  --text: #f2f2f2; --muted: #8a8a8a; --faint: #555;
  --line: rgba(255,255,255,0.08); --accent: #f2f2f2; --accent-fg: #050505;
  --accent-soft: rgba(255,255,255,0.07); --accent-glow: transparent;
  --ok: #c8c8c8; --ok-bg: rgba(255,255,255,0.06);
  --err: #e8e8e8; --err-bg: rgba(255,255,255,0.08);
  --info: #a0a0a0; --info-bg: rgba(255,255,255,0.06);
  --swatch-1: #050505; --swatch-2: #f2f2f2; --swatch-3: #555;
}

:root {
  --radius: 12px;
  --radius-sm: 10px;
  --pad: 1.25rem;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

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

html {
  -webkit-tap-highlight-color: transparent;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: -0.015em;
}

.app {
  max-width: 400px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(0.6rem + env(safe-area-inset-top, 0px)) var(--pad) calc(1rem + var(--safe-b));
  display: flex;
  flex-direction: column;
}

/* Header — logo + product centered; settings floats top-right */
.top {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 2.75rem 0;
  margin-bottom: 0.5rem;
  min-height: 5.5rem;
}

.top-settings {
  position: absolute;
  top: 0.15rem;
  right: 0;
  z-index: 2;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  text-align: center;
}

.brand-logo {
  height: 48px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: block;
  filter: brightness(1.08);
}

.brand-product {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

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

/* Views */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.view { animation: fade 0.18s ease; }

/* Home: optical vertical center of capture block */
.view-home {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 6vh;
  max-width: 22rem;
  width: 100%;
  margin: 0 auto;
}

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

.screen-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.back-link {
  display: inline-block;
  border: none;
  background: none;
  color: var(--faint);
  font: inherit;
  font-size: 0.85rem;
  padding: 0;
  margin: 0 0 1.1rem;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.back-link:active { color: var(--text); }

/* Home */
.hero {
  margin-bottom: 1.5rem;
  padding-top: 0;
  text-align: center;
}

.hero-title {
  margin: 0 0 0.4rem;
  font-size: 2.05rem;
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.hero-sub {
  margin: 0;
  color: var(--faint);
  font-size: 0.88rem;
  letter-spacing: 0.01em;
}

.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 1.05rem 1.15rem;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius);
  cursor: pointer;
}

.cta:active { opacity: 0.88; }

.cta-text {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.cta-text strong {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.cta-text small {
  font-size: 0.75rem;
  opacity: 0.45;
  font-weight: 400;
}

.cta-chevron {
  font-size: 1.1rem;
  opacity: 0.4;
  font-weight: 300;
}

.cta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.cta-soft {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
}

.cta-soft:active { background: var(--surface); }

.cta-soft strong {
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.status-pill {
  margin-top: 1.5rem;
  padding: 0.55rem 0;
  color: var(--faint);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  border: none;
  background: transparent;
  text-align: center;
}

/* Forms */
.block { margin-bottom: 1.25rem; }

.label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.field { display: block; margin-bottom: 0.75rem; }
.field.tight { margin-bottom: 0.65rem; }

.input,
.select-fallback {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
}

.input:focus {
  border-color: rgba(255, 255, 255, 0.22);
}

.input.mono, .mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}

textarea.input {
  resize: vertical;
  min-height: 5.5rem;
}

.file-pill {
  display: inline-block;
  max-width: 100%;
  margin: 0 0 1.1rem;
  padding: 0;
  background: none;
  border: none;
  color: var(--faint);
  font-size: 0.72rem;
  font-family: var(--mono);
  word-break: break-all;
}

.micro {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--faint);
  line-height: 1.35;
}

.micro.center { text-align: center; }

/* Choices */
.choice-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
  font: inherit;
  cursor: pointer;
}

.choice:active { background: var(--surface); }

.choice.is-selected {
  border-color: rgba(255, 255, 255, 0.35);
  background: var(--surface);
}

.choice-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--faint);
  flex-shrink: 0;
}

.choice.is-selected .choice-dot {
  border-color: var(--text);
  background: var(--text);
  box-shadow: inset 0 0 0 2px var(--surface);
}

.choice-body {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.choice-body strong {
  font-size: 0.92rem;
  font-weight: 550;
  letter-spacing: -0.02em;
}

.choice-body span {
  font-size: 0.72rem;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-empty {
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
  color: var(--faint);
  font-size: 0.85rem;
  text-align: center;
}

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.chip:active,
.chip.is-on {
  background: var(--surface-2);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Collapsible */
.more {
  margin: 0.4rem 0 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: transparent;
  overflow: hidden;
}

.more.inset { margin-top: 0.65rem; }

.more > summary {
  list-style: none;
  padding: 0.75rem 0.9rem;
  font-size: 0.85rem;
  color: var(--faint);
  cursor: pointer;
  user-select: none;
}

.more > summary::-webkit-details-marker { display: none; }

.more > summary::after {
  content: "+";
  float: right;
  color: var(--faint);
}

.more[open] > summary::after { content: "−"; }

.more-body { padding: 0 0.9rem 0.9rem; }

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-ghost {
  font: inherit;
  cursor: pointer;
  border: none;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  box-shadow: none;
}

.btn-primary:active { opacity: 0.88; }

.btn-primary:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.btn-secondary {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-weight: 500;
  font-size: 0.88rem;
  border: 1px solid var(--line);
}

.btn-ghost {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  flex-shrink: 0;
  border: 1px solid var(--line);
}

.btn-ghost.danger {
  color: var(--muted);
  border-color: var(--line);
  background: transparent;
}

.bottom-bar {
  position: sticky;
  bottom: 0;
  padding: 0.75rem 0 calc(0.4rem + var(--safe-b));
  margin-top: 0.5rem;
  background: linear-gradient(to top, var(--bg) 75%, transparent);
}

/* Settings */
.panel {
  background: transparent;
  border-radius: var(--radius);
  padding: 0 0 1.1rem;
  margin-bottom: 0.85rem;
  border: none;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0 0 0.75rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.panel-help {
  margin: -0.4rem 0 0.75rem;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.account-row strong {
  font-size: 0.92rem;
  font-weight: 550;
}

.account-row .micro { margin: 0.1rem 0 0; }

/* Palette */
.palette-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.palette-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.6rem 0.65rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.palette-card.is-selected {
  border-color: rgba(255, 255, 255, 0.3);
}

.palette-swatches {
  display: flex;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.palette-swatches span { flex: 1; }

.palette-meta {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.palette-meta strong {
  font-size: 0.78rem;
  font-weight: 550;
}

.palette-meta span {
  font-size: 0.65rem;
  color: var(--faint);
}

/* Dest list */
.dest-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.7rem 0;
  border-radius: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
}

.dest-main {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.dest-main strong {
  font-size: 0.88rem;
  font-weight: 550;
}

.dest-main .micro {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dest-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.dest-toggle {
  display: flex;
  align-items: center;
  font-size: 0.7rem;
  color: var(--faint);
  cursor: pointer;
}

.dest-del {
  border: none;
  background: none;
  color: var(--faint);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0.2rem;
}

/* Scan */
.scan-pages {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin: 0.75rem 0 0.9rem;
}

.scan-page {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  aspect-ratio: 3 / 4;
}

.scan-page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(0.15);
}

.scan-page .scan-num {
  position: absolute;
  left: 0.35rem;
  top: 0.35rem;
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
}

.scan-page .scan-remove {
  position: absolute;
  right: 0.3rem;
  top: 0.3rem;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.scan-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
}

.scan-add {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  margin: 0;
}

.scan-empty {
  grid-column: 1 / -1;
  padding: 1.75rem 1rem;
  text-align: center;
  color: var(--faint);
  font-size: 0.85rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}

/* Done */
.done {
  text-align: center;
  padding-top: 2.75rem;
}

.done-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  font-weight: 500;
}

.done .screen-title { margin-bottom: 0.65rem; }

.done-body {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  margin-bottom: 1.6rem;
  word-break: break-word;
}

.done-body p { margin: 0 0 0.55rem; }

.done-body code {
  display: block;
  margin: 0.3rem 0;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  text-align: left;
  overflow-x: auto;
}

.done-body strong { color: var(--text); }

/* Toast */
.toast {
  margin: -0.35rem 0 1rem;
  padding: 0.6rem 0;
  border-radius: 0;
  font-size: 0.82rem;
  background: transparent;
  border-bottom: 1px solid var(--line);
  animation: fade 0.15s ease;
}

.toast.ok { color: var(--muted); }
.toast.err { color: var(--text); }
.toast.info { color: var(--muted); }

.code-block {
  display: block;
  margin: 0.45rem 0 0;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  word-break: break-all;
}

.foot {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.65rem;
  color: var(--faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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