:root {
  color-scheme: light;
  --bg: #f2f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #e8eef6;
  --ink: #111827;
  --ink-soft: #536174;
  --line: #d8e0eb;
  --navy: #0b1220;
  --blue: #155eef;
  --blue-dark: #0d42ad;
  --green: #0d8a55;
  --green-soft: #e8f8f0;
  --amber: #bd6b00;
  --amber-soft: #fff3d8;
  --red: #c92a2a;
  --red-soft: #ffebeb;
  --shadow: 0 16px 45px rgba(22, 34, 54, .11);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
body.dark {
  color-scheme: dark;
  --bg: #08101d;
  --surface: #111b2b;
  --surface-2: #152236;
  --surface-3: #202f45;
  --ink: #f5f7fb;
  --ink-soft: #aab7ca;
  --line: #2b3a50;
  --navy: #050a12;
  --blue: #6b9cff;
  --blue-dark: #3d73dd;
  --green: #43c88d;
  --green-soft: #123a2c;
  --amber: #ffb342;
  --amber-soft: #3e2b0e;
  --red: #ff7272;
  --red-soft: #3d1b22;
  --shadow: 0 18px 48px rgba(0,0,0,.28);
}
button, input, select { font: inherit; }
button, a, label.file-method { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { max-width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }

.offline-bar { position: fixed; inset: 0 0 auto; z-index: 200; min-height: 32px; padding: 7px 16px; background: #8b2f14; color: #fff; text-align: center; font-size: 12px; font-weight: 900; letter-spacing: .08em; }
.offline-bar:not(.hidden) + .auth-shell, .offline-bar:not(.hidden) ~ .app-shell .topbar { margin-top: 32px; }

.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; background: linear-gradient(145deg, #2563eb, #0b3e9a); color: #fff; box-shadow: 0 10px 26px rgba(21,94,239,.3); }
.brand-mark span { font-size: 27px; font-weight: 1000; font-style: italic; transform: skew(-8deg); }
.brand-name { font-size: 18px; line-height: 1; font-weight: 950; letter-spacing: .08em; }
.brand-version { margin-top: 5px; color: var(--blue); font-size: 11px; line-height: 1; font-weight: 900; letter-spacing: .14em; }
.brand-lockup.compact .brand-mark { width: 41px; height: 41px; border-radius: 12px; }
.brand-lockup.compact .brand-mark span { font-size: 23px; }
.brand-lockup.compact .brand-name { font-size: 15px; }
.brand-lockup.compact .brand-version { font-size: 10px; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; background:
  radial-gradient(circle at 15% 10%, rgba(37,99,235,.19), transparent 34%),
  radial-gradient(circle at 88% 84%, rgba(13,138,85,.12), transparent 34%),
  var(--bg); }
.auth-card { width: min(100%, 470px); padding: 34px; border: 1px solid var(--line); border-radius: 28px; background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow); }
.auth-brand { margin-bottom: 34px; }
.auth-copy h1 { margin: 0 0 10px; font-size: clamp(30px, 8vw, 44px); line-height: .98; letter-spacing: -.04em; }
.auth-copy p { margin: 0 0 28px; color: var(--ink-soft); font-size: 15px; line-height: 1.6; }
.stack-form { display: grid; gap: 16px; }
.stack-form label, .settings-grid label { display: grid; gap: 8px; }
.stack-form label > span, .settings-grid label > span { color: var(--ink-soft); font-size: 11px; font-weight: 900; letter-spacing: .09em; }
.stack-form input, .settings-grid input { width: 100%; min-height: 52px; border: 1px solid var(--line); border-radius: 12px; padding: 0 15px; background: var(--surface-2); color: var(--ink); outline: none; }
.stack-form input:focus, .settings-grid input:focus, .scan-input-wrap:focus-within, .money-input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent); }
.form-message { min-height: 20px; margin: 9px 0 0; color: var(--red); font-size: 13px; font-weight: 700; }
.form-message.success { color: var(--green); }
.auth-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.auth-notes div { display: grid; gap: 5px; }
.auth-notes strong { font-size: 10px; letter-spacing: .08em; }
.auth-notes span { color: var(--ink-soft); font-size: 12px; line-height: 1.4; }

.button { min-height: 46px; border: 0; border-radius: 12px; padding: 0 18px; font-weight: 900; letter-spacing: .035em; transition: transform .12s ease, opacity .12s ease, background .12s ease; }
.button:active { transform: scale(.985); }
.button:disabled { opacity: .5; cursor: wait; }
.button-primary { background: var(--blue); color: #fff; box-shadow: 0 9px 22px color-mix(in srgb, var(--blue) 27%, transparent); }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.button-ghost { border: 1px dashed var(--line); background: transparent; color: var(--ink-soft); }
.button-large { min-height: 56px; font-size: 14px; }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 80; min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px max(16px, env(safe-area-inset-left)) 10px max(16px, env(safe-area-inset-right)); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px); }
.topbar-actions { display: flex; align-items: center; gap: 7px; }
.icon-button { min-height: 38px; border: 1px solid var(--line); border-radius: 11px; padding: 0 11px; background: var(--surface-2); color: var(--ink); font-size: 12px; font-weight: 900; }
.status-pill { display: inline-flex; align-items: center; min-height: 28px; padding: 0 9px; border-radius: 99px; background: var(--green-soft); color: var(--green); font-size: 10px; font-weight: 950; letter-spacing: .07em; }
.status-pill.offline { background: var(--red-soft); color: var(--red); }
.account-button { width: 39px; height: 39px; border: 0; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 950; }
.account-menu { position: fixed; z-index: 100; top: 61px; right: 14px; width: min(310px, calc(100vw - 28px)); padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.account-menu button { width: 100%; min-height: 44px; border: 0; border-radius: 10px; padding: 0 12px; background: transparent; color: var(--ink); text-align: left; font-weight: 800; }
.account-menu button:hover { background: var(--surface-2); }
.account-identity { display: grid; gap: 4px; padding: 10px 12px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.account-identity strong { font-size: 15px; }
.account-identity span { color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .07em; }
.buyer-badge { justify-self: start; margin-top: 4px; padding: 4px 7px; border-radius: 7px; background: var(--amber-soft); color: var(--amber) !important; }

.content-frame { width: min(100%, 1000px); margin: 0 auto; padding: 20px 16px calc(98px + var(--safe-bottom)); }
.view-panel { display: none; }
.view-panel.active { display: block; }
.scan-command-card { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 8px 28px rgba(24,39,63,.06); }
.scan-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.scan-input-wrap { min-height: 60px; display: flex; align-items: center; gap: 10px; border: 2px solid var(--ink); border-radius: 14px; padding: 0 12px; background: var(--surface-2); }
.scan-glyph { font-size: 25px; font-weight: 900; }
.scan-input-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 18px; font-weight: 850; text-transform: uppercase; }
.scan-input-wrap input::placeholder { color: var(--ink-soft); font-size: 13px; font-weight: 750; }
.input-clear { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--surface-3); color: var(--ink); font-size: 22px; }
.lookup-button { min-width: 116px; }
.scan-methods { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.method-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 11px; padding: 0 13px; background: var(--surface-2); color: var(--ink); font-size: 12px; font-weight: 900; }
.file-method { cursor: pointer; }
.file-method input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.scanner-hint { margin-left: auto; display: flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 10px; font-weight: 850; letter-spacing: .05em; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px color-mix(in srgb, var(--green) 13%, transparent); }
.scan-status { margin: 14px 0; padding: 13px 16px; border-radius: 12px; background: var(--surface-3); color: var(--ink); font-size: 13px; font-weight: 750; }
.scan-status.error { background: var(--red-soft); color: var(--red); }
.scan-status.success { background: var(--green-soft); color: var(--green); }
.scan-status.loading::before { content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 9px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -2px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { min-height: 58vh; display: grid; place-items: center; align-content: center; gap: 16px; padding: 44px 12px; text-align: center; }
.empty-visual { position: relative; width: 190px; height: 120px; display: grid; place-items: center; border: 2px solid color-mix(in srgb, var(--blue) 36%, var(--line)); border-radius: 20px; background: var(--surface); overflow: hidden; }
.barcode-bars { width: 120px; height: 64px; background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 5px, var(--ink) 5px 9px, transparent 9px 12px); opacity: .75; }
.scan-line { position: absolute; left: 18px; right: 18px; height: 3px; border-radius: 3px; background: var(--blue); box-shadow: 0 0 14px var(--blue); animation: scanline 2.2s ease-in-out infinite; }
@keyframes scanline { 0%, 100% { transform: translateY(-42px); } 50% { transform: translateY(42px); } }
.empty-state h1 { margin: 0; font-size: clamp(27px, 8vw, 43px); letter-spacing: -.04em; }
.empty-state p { max-width: 580px; margin: 0; color: var(--ink-soft); line-height: 1.6; }
.empty-steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 4px; }
.empty-steps span { display: flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: 10px; font-weight: 900; letter-spacing: .04em; }
.empty-steps b { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; }

.result-view { display: grid; gap: 14px; margin-top: 14px; }
.decision-card { overflow: hidden; border-radius: var(--radius-xl); padding: 18px; color: #fff; box-shadow: var(--shadow); }
.decision-buy { background: linear-gradient(135deg, #087e4d, #10a967); }
.decision-maybe { background: linear-gradient(135deg, #a45b00, #dc8a12); }
.decision-pass { background: linear-gradient(135deg, #a82121, #da3939); }
.decision-topline { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 24px; font-size: 10px; font-weight: 900; letter-spacing: .08em; opacity: .9; }
.source-badge { padding: 5px 8px; border-radius: 99px; background: rgba(255,255,255,.18); }
.decision-main { display: grid; grid-template-columns: minmax(0, .9fr) minmax(300px, 1.1fr); align-items: end; gap: 24px; }
.decision-eyebrow { font-size: 11px; font-weight: 900; letter-spacing: .11em; opacity: .83; }
.decision-main h1 { margin: 5px 0 0; font-size: clamp(34px, 7vw, 62px); line-height: .92; letter-spacing: -.045em; }
.decision-pair { display: grid; grid-template-columns: 1.25fr .75fr; gap: 10px; }
.decision-number-block { min-height: 112px; display: grid; align-content: center; justify-items: center; gap: 2px; border-radius: 17px; background: rgba(255,255,255,.16); text-align: center; }
.decision-number-block span { font-size: 9px; font-weight: 900; letter-spacing: .06em; opacity: .86; }
.decision-number-block strong { font-size: clamp(35px, 8vw, 58px); line-height: 1; letter-spacing: -.05em; }
.quantity-block strong::after { content: " PCS"; font-size: 11px; letter-spacing: .03em; }
.decision-subline { margin: 14px 0 0; font-size: 12px; line-height: 1.5; font-weight: 750; opacity: .9; }
.eligibility-warning, .internal-access-warning { display: grid; gap: 5px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--amber) 42%, var(--line)); border-radius: 13px; background: var(--amber-soft); color: var(--amber); }
.eligibility-warning strong, .internal-access-warning strong { font-size: 10px; font-weight: 950; letter-spacing: .08em; }
.eligibility-warning span, .internal-access-warning span { font-size: 10px; font-weight: 760; line-height: 1.45; }
.internal-access-warning { margin: -4px 0 12px; }

.product-card, .cost-check-card, .metrics-card, .fee-card, .advice-card, .settings-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 8px 28px rgba(24,39,63,.05); }
.product-card { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 18px; padding: 16px; }
.product-image-button { position: relative; min-height: 175px; border: 1px solid var(--line); border-radius: 14px; padding: 0; background: #fff; overflow: hidden; }
.product-image-button img { width: 100%; height: 100%; object-fit: contain; display: block; }
.saved-catalog-badge { position: absolute; left: 8px; bottom: 8px; padding: 5px 7px; border-radius: 7px; background: var(--blue); color: #fff; font-size: 9px; font-weight: 950; letter-spacing: .06em; }
.product-copy { min-width: 0; display: grid; align-content: center; gap: 13px; }
.product-heading-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.product-brand { display: block; margin-bottom: 5px; color: var(--blue); font-size: 12px; font-weight: 950; letter-spacing: .08em; }
.product-copy h2 { margin: 0; font-size: clamp(19px, 4vw, 28px); line-height: 1.16; letter-spacing: -.025em; text-transform: uppercase; }
.amazon-badge { flex: 0 0 auto; padding: 6px 8px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: 9px; font-weight: 950; letter-spacing: .05em; }
.product-meta { display: flex; flex-wrap: wrap; gap: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.product-meta span { padding: 5px 7px; border-radius: 7px; background: var(--surface-2); }
.product-links { display: flex; flex-wrap: wrap; gap: 8px; }
.product-links a { padding: 7px 9px; border-radius: 8px; background: var(--surface-3); color: var(--blue); text-decoration: none; font-size: 10px; font-weight: 900; letter-spacing: .04em; }

.cost-check-card, .metrics-card { padding: 18px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.section-kicker { display: block; margin-bottom: 5px; color: var(--blue); font-size: 10px; font-weight: 950; letter-spacing: .1em; }
.section-heading h2, .panel-header h1 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.saved-cogs-hint, .market-source-label { padding: 6px 8px; border-radius: 8px; background: var(--surface-3); color: var(--ink-soft); font-size: 9px; font-weight: 900; letter-spacing: .04em; }
.cost-row { display: grid; grid-template-columns: minmax(190px, .65fr) minmax(220px, 1fr); gap: 12px; }
.money-input { min-height: 82px; display: flex; align-items: center; border: 2px solid var(--ink); border-radius: 15px; padding: 0 16px; background: var(--surface-2); }
.money-input span { color: var(--ink-soft); font-size: 27px; font-weight: 900; }
.money-input input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 36px; font-weight: 950; }
.cost-verdict { min-height: 82px; display: grid; place-items: center; align-content: center; border-radius: 15px; text-align: center; }
.cost-verdict.neutral { background: var(--surface-3); color: var(--ink-soft); }
.cost-verdict.good { background: var(--green-soft); color: var(--green); }
.cost-verdict.warn { background: var(--amber-soft); color: var(--amber); }
.cost-verdict.bad { background: var(--red-soft); color: var(--red); }
.cost-verdict strong { font-size: 22px; }
.cost-verdict span { margin-top: 3px; font-size: 10px; font-weight: 900; letter-spacing: .07em; }
.profit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 10px; }
.profit-grid div { min-height: 70px; display: grid; align-content: center; gap: 4px; border-radius: 12px; padding: 10px; background: var(--surface-2); text-align: center; }
.profit-grid span { color: var(--ink-soft); font-size: 9px; font-weight: 900; letter-spacing: .05em; }
.profit-grid strong { font-size: 21px; }

.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.metric { min-height: 85px; display: grid; align-content: center; gap: 5px; border: 1px solid var(--line); border-radius: 13px; padding: 12px; background: var(--surface-2); }
.metric span { color: var(--ink-soft); font-size: 9px; font-weight: 900; letter-spacing: .055em; }
.metric strong { font-size: clamp(20px, 4vw, 29px); letter-spacing: -.03em; }
.metric.primary { border-color: color-mix(in srgb, var(--blue) 42%, var(--line)); background: color-mix(in srgb, var(--blue) 6%, var(--surface)); }
.metric.primary strong { color: var(--blue); }
.metric.rank strong { font-size: clamp(21px, 4vw, 31px); }

.fee-card details { padding: 0 18px; }
.fee-card summary { min-height: 56px; display: flex; align-items: center; cursor: pointer; font-size: 11px; font-weight: 950; letter-spacing: .06em; }
.fee-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 0 16px; }
.fee-grid div { display: grid; gap: 5px; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.fee-grid span { color: var(--ink-soft); font-size: 8px; font-weight: 900; letter-spacing: .04em; }
.fee-grid strong { font-size: 14px; }
.fee-note { margin: -5px 0 16px; color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.advice-card { padding: 16px; }
.warning-list, .reason-list { display: grid; gap: 8px; }
.reason-list { margin-top: 9px; }
.warning-item, .reason-item { display: flex; gap: 9px; align-items: flex-start; padding: 10px 11px; border-radius: 10px; font-size: 12px; line-height: 1.45; font-weight: 720; }
.warning-item { background: var(--amber-soft); color: var(--amber); }
.reason-item { background: var(--surface-2); color: var(--ink-soft); }
.result-actions { display: grid; grid-template-columns: 1.4fr .9fr .9fr; gap: 9px; }

.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 5px 0 16px; }
.panel-header h1 { font-size: clamp(24px, 6vw, 36px); }
.recent-list { display: grid; gap: 10px; }
.recent-card { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 15px; padding: 13px; background: var(--surface); }
.recent-decision { min-height: 58px; display: grid; place-items: center; border-radius: 11px; color: #fff; font-size: 14px; font-weight: 950; }
.recent-decision.buy { background: var(--green); }
.recent-decision.maybe { background: var(--amber); }
.recent-decision.pass { background: var(--red); }
.recent-copy { min-width: 0; }
.recent-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; text-transform: uppercase; }
.recent-copy span { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 10px; font-weight: 750; }
.recent-pay { text-align: right; }
.recent-pay strong { display: block; font-size: 20px; }
.recent-pay span { color: var(--ink-soft); font-size: 9px; font-weight: 850; }
.empty-list { padding: 50px 20px; border: 1px dashed var(--line); border-radius: 16px; color: var(--ink-soft); text-align: center; }

.admin-only-badge { padding: 7px 9px; border-radius: 8px; background: var(--blue); color: #fff; font-size: 9px; font-weight: 950; letter-spacing: .07em; }
.settings-card { padding: 18px; }
.settings-section + .settings-section { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.settings-section h2 { margin: 0 0 14px; font-size: 14px; }
.settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.settings-grid input { min-height: 47px; }
.settings-card > .button { margin-top: 20px; }
.team-heading { margin-top: 30px; }
.team-list { display: grid; gap: 10px; }
.team-card { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.team-name strong { display: block; }
.team-name span { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 10px; }
.team-control { display: grid; gap: 5px; }
.team-control > span { color: var(--ink-soft); font-size: 8px; font-weight: 900; }
.team-control input[type="number"] { width: 132px; min-height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 0 9px; background: var(--surface-2); color: var(--ink); }
.toggle-wrap { display: flex; align-items: center; gap: 7px; font-size: 10px; font-weight: 900; }
.toggle-wrap input { width: 42px; height: 24px; accent-color: var(--blue); }

.bottom-nav { position: fixed; z-index: 70; left: 50%; bottom: calc(10px + var(--safe-bottom)); transform: translateX(-50%); width: min(500px, calc(100vw - 20px)); min-height: 66px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; padding: 7px; border: 1px solid color-mix(in srgb, var(--line) 78%, transparent); border-radius: 20px; background: color-mix(in srgb, var(--navy) 94%, transparent); box-shadow: 0 18px 45px rgba(0,0,0,.27); backdrop-filter: blur(18px); }
.nav-button { border: 0; border-radius: 14px; display: grid; place-items: center; align-content: center; gap: 3px; background: transparent; color: #9aa7bb; }
.nav-button span { font-size: 19px; line-height: 1; }
.nav-button b { font-size: 9px; letter-spacing: .07em; }
.nav-button.active { background: #fff; color: #0b1220; }

.modal { position: fixed; z-index: 300; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(3,8,16,.72); backdrop-filter: blur(8px); }
.modal-sheet, .camera-sheet { width: min(100%, 720px); max-height: min(88vh, 920px); overflow: auto; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.38); }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.modal-header h2 { margin: 0; font-size: 21px; }
.modal-close { flex: 0 0 auto; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2); color: var(--ink); font-size: 27px; line-height: 1; }
.modal-intro { margin: 0; padding: 14px 18px 0; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.match-list { display: grid; gap: 10px; padding: 16px 18px 20px; }
.match-card { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 13px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.match-card img { width: 112px; height: 112px; object-fit: contain; border-radius: 10px; background: #fff; }
.match-copy { min-width: 0; }
.match-copy strong { display: block; font-size: 13px; line-height: 1.35; text-transform: uppercase; }
.match-copy span { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 10px; font-weight: 750; }
.match-card .button { min-width: 100px; }
.match-saved { border-color: var(--blue); box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 14%, transparent); }

.camera-sheet { width: min(100%, 760px); overflow: hidden; background: #050912; color: #fff; }
.dark-header { position: static; border-color: #253044; background: #0b1220; }
.dark-header .section-kicker { color: #82a8ff; }
.dark-header .modal-close { border-color: #2d3a51; background: #172237; color: #fff; }
.camera-stage { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #000; }
.camera-stage video { width: 100%; height: 100%; object-fit: cover; }
.camera-frame { position: absolute; inset: 24% 8%; border: 3px solid rgba(255,255,255,.92); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.34); }
.camera-frame::before, .camera-frame::after, .camera-frame span::before, .camera-frame span::after { content: ""; position: absolute; width: 36px; height: 36px; border-color: #59f0a6; border-style: solid; }
.camera-frame::before { left: -4px; top: -4px; border-width: 5px 0 0 5px; border-radius: 12px 0 0; }
.camera-frame::after { right: -4px; top: -4px; border-width: 5px 5px 0 0; border-radius: 0 12px 0 0; }
.camera-frame span::before { left: -4px; bottom: -4px; border-width: 0 0 5px 5px; border-radius: 0 0 0 12px; }
.camera-frame span::after { right: -4px; bottom: -4px; border-width: 0 5px 5px 0; border-radius: 0 0 12px; }
.camera-sweep { position: absolute; left: 11%; right: 11%; top: 50%; height: 3px; background: #59f0a6; box-shadow: 0 0 17px #59f0a6; animation: camerasweep 1.8s ease-in-out infinite; }
@keyframes camerasweep { 0%,100% { transform: translateY(-80px); } 50% { transform: translateY(80px); } }
.camera-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px 18px; background: #0b1220; }
.camera-footer p { margin: 0; color: #b7c3d6; font-size: 12px; }
.install-content { padding: 18px; }
.install-steps { display: grid; gap: 11px; }
.install-step { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 11px; align-items: start; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.install-step b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; }
.install-step strong { display: block; font-size: 13px; }
.install-step span { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.install-sheet > .button { width: calc(100% - 36px); margin: 0 18px 18px; }
.password-sheet { width: min(100%, 480px); }
.password-sheet form { padding: 18px; }
.password-sheet form > p { margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.image-modal { position: fixed; z-index: 400; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(0,0,0,.9); }
.image-stage { max-width: min(92vw, 900px); max-height: 88vh; display: grid; place-items: center; gap: 10px; }
.image-stage img { max-width: 100%; max-height: 80vh; object-fit: contain; border-radius: 14px; background: #fff; }
.image-stage p { margin: 0; color: #fff; text-align: center; font-size: 12px; }
.image-close { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; width: 48px; height: 48px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: rgba(0,0,0,.4); color: #fff; font-size: 32px; }
.toast-region { position: fixed; z-index: 500; left: 50%; bottom: calc(91px + var(--safe-bottom)); transform: translateX(-50%); width: min(92vw, 520px); display: grid; gap: 8px; pointer-events: none; }
.toast { padding: 13px 15px; border-radius: 12px; background: var(--navy); color: #fff; box-shadow: var(--shadow); font-size: 12px; font-weight: 750; animation: toastin .2s ease-out; }
.toast.error { background: #a52020; }
.toast.success { background: #087348; }
@keyframes toastin { from { transform: translateY(10px); opacity: 0; } }

@media (min-width: 1180px) {
  .bottom-nav {
    left: 24px;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    width: 82px;
    min-height: 256px;
    grid-auto-flow: row;
    grid-auto-rows: 1fr;
    border-radius: 22px;
  }
  .toast-region { bottom: 24px; }
}

@media (max-width: 760px) {
  .topbar { min-height: 60px; }
  .brand-lockup.compact .brand-name { font-size: 12px; }
  .brand-lockup.compact .brand-version { font-size: 8px; }
  .brand-lockup.compact .brand-mark { width: 35px; height: 35px; border-radius: 10px; }
  .brand-lockup.compact .brand-mark span { font-size: 19px; }
  .status-pill { display: none; }
  .content-frame { padding: 12px 10px calc(92px + var(--safe-bottom)); }
  .scan-command-card { padding: 10px; border-radius: 16px; }
  .scan-form { grid-template-columns: minmax(0, 1fr) 86px; gap: 7px; }
  .scan-input-wrap { min-height: 55px; padding: 0 9px; }
  .scan-input-wrap input { font-size: 16px; }
  .lookup-button { min-width: 0; padding: 0 9px; font-size: 11px; }
  .scan-methods { gap: 6px; }
  .method-button { flex: 1; min-height: 39px; padding: 0 8px; }
  .scanner-hint { display: none; }
  .empty-state { min-height: 55vh; }
  .decision-card { padding: 15px; border-radius: 20px; }
  .decision-main { grid-template-columns: 1fr; gap: 18px; }
  .decision-main h1 { font-size: clamp(38px, 13vw, 57px); }
  .decision-number-block { min-height: 95px; }
  .decision-number-block strong { font-size: clamp(37px, 12vw, 53px); }
  .product-card { grid-template-columns: 118px minmax(0, 1fr); gap: 11px; padding: 11px; }
  .product-image-button { min-height: 125px; }
  .product-heading-row { display: block; }
  .amazon-badge { display: inline-flex; margin-top: 8px; }
  .product-copy h2 { font-size: 16px; }
  .product-meta { gap: 4px; }
  .product-meta span { font-size: 8px; }
  .product-links a { font-size: 8px; }
  .cost-check-card, .metrics-card { padding: 14px; }
  .section-heading { display: block; }
  .saved-cogs-hint, .market-source-label { display: inline-flex; margin-top: 8px; }
  .cost-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .money-input, .cost-verdict { min-height: 76px; }
  .money-input input { font-size: 31px; }
  .cost-verdict strong { font-size: 17px; }
  .profit-grid { gap: 6px; }
  .profit-grid div { padding: 7px; }
  .profit-grid strong { font-size: 17px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .metric { min-height: 78px; padding: 10px; }
  .metric strong { font-size: 22px; }
  .fee-grid { grid-template-columns: repeat(2, 1fr); }
  .result-actions { grid-template-columns: 1fr; }
  .result-actions .button { min-height: 52px; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .team-card { grid-template-columns: 1fr; }
  .team-control input[type="number"] { width: 100%; }
  .match-card { grid-template-columns: 90px minmax(0, 1fr); }
  .match-card img { width: 90px; height: 90px; }
  .match-card .button { grid-column: 1 / -1; width: 100%; }
  .camera-stage { aspect-ratio: 3 / 4; }
  .camera-footer { display: grid; }
}

@media (max-width: 430px) {
  .auth-card { padding: 26px 20px; }
  .auth-notes { grid-template-columns: 1fr; }
  .decision-pair { grid-template-columns: 1.15fr .85fr; }
  .decision-number-block span { font-size: 8px; }
  .product-card { grid-template-columns: 104px minmax(0, 1fr); }
  .product-image-button { min-height: 112px; }
  .product-meta span:nth-child(3) { display: none; }
  .cost-row { grid-template-columns: 1fr; }
  .profit-grid { grid-template-columns: 1fr 1fr 1fr; }
  .profit-grid span { font-size: 7px; }
  .profit-grid strong { font-size: 15px; }
  .settings-grid { grid-template-columns: 1fr; }
  .recent-card { grid-template-columns: 76px minmax(0, 1fr); }
  .recent-pay { grid-column: 2; text-align: left; display: flex; gap: 7px; align-items: baseline; }
  .bottom-nav { bottom: calc(6px + var(--safe-bottom)); width: calc(100vw - 12px); }
}

@media (display-mode: standalone) {
  .install-button { display: none !important; }
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
}

.team-actions { display: grid; gap: 8px; }
