/* ScanAutos UI — light-only, flat Material 3 design system.
   App theme: Signal Blue (navy #0B1B33, blue #0A66FF, sky #4DA3FF, yellow #FFC400).
   Sellers' signs and listing pages can use any scheme from brand.js PALETTES;
   the app and website always use Signal Blue.
   No shadows, no glass: hierarchy comes from tonal surfaces, shape and colour.
   Colour roles derive from the brand palette (public/assets/brand.js). */
:root {
  color-scheme: light only;
  /* Brand roles */
  --primary: #0A66FF;
  --on-primary: #FFFFFF;
  --primary-container: #DCE7FF;
  --on-primary-container: #00285F;
  --brand-navy: #0B1B33;
  --accent: #FFC400;
  /* Surfaces (M3 tonal elevation) */
  --surface: #F7F9FC;
  --surface-low: #F1F4F9; /* Signal Blue background */
  --surface-container: #EBEFF5;
  --surface-high: #E4E9F1;
  --surface-highest: #DDE3EC;
  --on-surface: #171C24;
  --on-surface-variant: #46505F;
  --outline: #747E8C;
  --outline-variant: #C6CDD8;
  --inverse-surface: #2C313A;
  --inverse-on-surface: #EEF1F6;
  /* Status */
  --success: #1E8E4E; --success-container: #D5F5DF;
  --warning: #8A5300; --warning-container: #FFE8C2;
  --error: #BA1A1A; --error-container: #FFDAD6;

  /* Legacy names used across the app → M3 roles */
  --bg: var(--surface-low);
  --card: #FFFFFF;
  --label: var(--on-surface);
  --label2: var(--on-surface-variant);
  --label3: var(--outline);
  --sep: var(--outline-variant);
  --fill: var(--surface-high);
  --fill2: var(--surface-container);
  --blue: var(--primary);
  --green: var(--success);
  --red: var(--error);
  --orange: #E07B00;
  --yellow: var(--accent);
  --indigo: #4F46C8;
  --shadow: none;
  --shadow-lg: none;

  /* Shape scale (M3 expressive) */
  --r-sm: 12px;
  --r: 20px;
  --r-lg: 28px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "SA Text", -apple-system, BlinkMacSystemFont, "Roboto Flex", Roboto, "Segoe UI", system-ui, sans-serif;
  --font-head: "SA Brand", var(--font);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; font-family: var(--font); font-weight: 500; color: var(--label); background: var(--bg); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
b, strong, .headline, .title2, .title3 { font-weight: 700; }
.large-title { font-family: var(--font-head); font-size: 32px; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
.title2 { font-family: var(--font-head); font-size: 22px; font-weight: 800; letter-spacing: -0.015em; line-height: 1.25; }
.title3 { font-size: 20px; }
.headline { font-size: 16px; }
.subhead { font-size: 15px; }
.footnote { font-size: 13px; color: var(--label2); }
.caption { font-size: 12px; color: var(--label2); }
.muted { color: var(--label2); }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 22px; }

/* "glass" is kept as a class name but is now a flat surface. */
.glass { background: var(--surface); border: 0; box-shadow: none; }

/* Cards & lists (flat; separation by tone and dividers) */
.card { background: var(--card); border-radius: var(--r); padding: 18px; }
.section-header { font-size: 14px; font-weight: 700; color: var(--primary); padding: 0 16px 8px; margin-top: 26px; letter-spacing: 0.01em; }
.section-footer { font-size: 13px; color: var(--label2); padding: 8px 16px 0; }
.list { background: var(--card); border-radius: var(--r); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 16px; position: relative; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; transition: background .15s; }
.list-row + .list-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 1px; background: var(--surface-container); }
.list-row.icon-row + .list-row.icon-row::before { left: 64px; }
.list-row:hover { background: var(--surface-low); }
.list-row:active { background: var(--surface-container); }
.list-row .value { color: var(--label2); margin-left: auto; text-align: right; }
.chev::after { content: ""; display: inline-block; width: 8px; height: 8px; border-right: 2px solid var(--outline); border-top: 2px solid var(--outline); transform: rotate(45deg); margin-left: 6px; flex: none; }
.sym { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.sym svg { width: 19px; height: 19px; }

/* Buttons: filled / tonal / outlined / text, all pill-shaped */
.btn { appearance: none; border: 0; border-radius: 999px; padding: 0 24px; font-weight: 700; font-size: 15px; letter-spacing: 0.01em; background: var(--primary); color: var(--on-primary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; transition: background .15s, border-radius .2s; }
.btn:hover { background: color-mix(in srgb, var(--primary) 92%, #000); }
.btn:active { border-radius: 14px; }
.btn[disabled] { background: color-mix(in srgb, var(--on-surface) 12%, transparent) !important; color: color-mix(in srgb, var(--on-surface) 40%, transparent) !important; pointer-events: none; }
.btn.block { width: 100%; }
.btn.tinted { background: var(--primary-container); color: var(--on-primary-container); }
.btn.gray { background: var(--surface-high); color: var(--on-surface); }
.btn.outlined { background: none; color: var(--primary); box-shadow: inset 0 0 0 1px var(--outline); }
.btn.green { background: var(--success); color: #fff; }
.btn.red { background: var(--error); color: #fff; }
.btn.red.tinted { background: var(--error-container); color: #410002; }
.btn.small { padding: 0 16px; font-size: 14px; min-height: 40px; }
.btn.plain { background: none; color: var(--primary); padding: 8px 6px; min-height: 0; }
.btn.plain:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.btn svg { width: 20px; height: 20px; }

/* Text fields (M3 filled, expressive rounding) */
.field { display: block; }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--label2); margin: 0 4px 6px; }
.input, select.input, textarea.input { width: 100%; border: 0; background: var(--surface-container); border-radius: var(--r-sm); padding: 15px 16px; font-size: 16px; outline: none; box-shadow: none; transition: box-shadow .15s, background .15s; }
.input:hover { background: var(--surface-high); }
.input:focus { background: var(--surface-container); box-shadow: inset 0 0 0 2px var(--primary); }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.5; }
.input.code { font-size: 28px; letter-spacing: 10px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.list .input { box-shadow: none; border-radius: 0; background: transparent; padding: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Switch (M3) */
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-highest); box-shadow: inset 0 0 0 2px var(--outline); transition: background .2s, box-shadow .2s; }
.switch i::after { content: ""; position: absolute; top: 8px; left: 8px; width: 16px; height: 16px; border-radius: 50%; background: var(--outline); transition: all .2s cubic-bezier(.2,0,0,1); }
.switch input:checked + i { background: var(--primary); box-shadow: none; }
.switch input:checked + i::after { top: 4px; left: 24px; width: 24px; height: 24px; background: var(--on-primary); }

/* Segmented buttons (M3) */
.segmented { display: flex; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--outline); overflow: hidden; background: none; padding: 0; gap: 0; }
.segmented button { flex: 1; border: 0; background: none; padding: 10px 10px; font-size: 14px; font-weight: 700; cursor: pointer; color: var(--on-surface); min-height: 40px; }
.segmented button + button { box-shadow: inset 1px 0 0 var(--outline); }
.segmented button.on { background: var(--primary-container); color: var(--on-primary-container); }
.segmented button.on::before { content: "✓ "; }

/* Chips / badges (M3: 8px corners) */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 8px; background: var(--surface-high); color: var(--on-surface); white-space: nowrap; }
.badge.green { background: var(--success-container); color: #0B5A2C; }
.badge.blue { background: var(--primary-container); color: var(--on-primary-container); }
.badge.orange { background: var(--warning-container); color: var(--warning); }
.badge.red { background: var(--error-container); color: #93000A; }
.badge.gray { background: var(--surface-high); color: var(--label2); }
.badge svg { width: 14px; height: 14px; }

/* Bottom sheet + scrim; snackbar */
.scrim { display: none; position: fixed; inset: 0; background: rgba(11, 27, 51, .32); opacity: 0; transition: opacity .25s; z-index: 50; }
.scrim.show { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; max-height: 92dvh; overflow: auto; background: var(--surface-low); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 10px 18px calc(24px + var(--safe-b)); transform: translateY(105%); transition: transform .35s cubic-bezier(.2,0,0,1); z-index: 51; box-shadow: none; }
.sheet.show { transform: none; }
.sheet:not(.show) { visibility: hidden; transition: transform .35s cubic-bezier(.2,0,0,1), visibility 0s .35s; }
svg.inline { width: 15px; height: 15px; vertical-align: -2px; display: inline; }
.sheet .grabber { width: 32px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--on-surface-variant) 40%, transparent); margin: 6px auto 16px; }
@media (min-width: 700px) { .sheet { bottom: 50%; border-radius: var(--r-lg); transform: translateY(60%) scale(.96); opacity: 0; transition: transform .3s, opacity .2s; } .sheet.show { transform: translateY(50%); opacity: 1; } }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); top: auto; transform: translate(-50%, 160%); padding: 14px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; z-index: 100; transition: transform .3s cubic-bezier(.2,0,0,1), opacity .2s; max-width: min(560px, calc(100% - 32px)); text-align: left; background: var(--inverse-surface) !important; color: var(--inverse-on-surface); opacity: 0; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.err { color: #FFB4AB; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--surface-highest); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-container) 25%, var(--surface-low) 50%, var(--surface-container) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r); }
@keyframes shimmer { to { background-position: -200% 0; } }

.notice { border-radius: var(--r); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.notice.orange { background: var(--warning-container); color: #4A2C00; }
.notice.red { background: var(--error-container); color: #410002; }
.notice.blue { background: var(--primary-container); color: var(--on-primary-container); }
.notice.green { background: var(--success-container); color: #0B3D1E; }
.notice svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Fonts */
@font-face { font-family: 'SA Display'; src: url('/assets/fonts/BarlowCondensed_900Black.ttf') format('truetype'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'SA Condensed'; src: url('/assets/fonts/BarlowCondensed_700Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'SA Text'; src: url('/assets/fonts/Barlow_700Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'SA Text'; src: url('/assets/fonts/Barlow_500Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'SA Brand'; src: url('/assets/fonts/Montserrat_800ExtraBold.ttf') format('truetype'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'SA Brand'; src: url('/assets/fonts/Montserrat_500Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }

/* Brand lockup */
.sa-lockup { display: inline-flex; align-items: center; gap: 8px; color: var(--brand-navy); text-decoration: none; }
.sa-lockup svg { flex: none; }
.sa-word { font-family: 'SA Brand', var(--font); font-weight: 800; font-size: 1.12em; letter-spacing: -0.025em; line-height: 1; }
.sa-word b { color: var(--primary); font-weight: 800; }
.sa-word i { font-style: normal; font-weight: 500; color: #7A879B; }
.sa-lockup.dark { color: #fff; }
.sa-lockup.dark .sa-word b { color: #4DA3FF; }
.sa-lockup.dark .sa-word i { color: #8EA3C0; }
