/* ============================================================
   AI EYE LIVE — Design System
   Mobile-first. One-handed use. Fast before fancy.
   ============================================================ */

:root {
  /* Brand */
  --brand:        #2563eb;   /* trust blue */
  --brand-dark:   #1d4ed8;
  --brand-tint:   #eff4ff;
  --accent:       #0ea5e9;

  /* Status colors (match the blueprint status chips) */
  --ok:           #16a34a;
  --ok-tint:      #e8f7ee;
  --warn:         #d97706;
  --warn-tint:    #fdf3e3;
  --danger:       #dc2626;
  --danger-tint:  #fdeaea;
  --review:       #7c3aed;
  --review-tint:  #f1ebfe;

  /* Neutrals */
  --ink:          #0f172a;
  --ink-2:        #475569;
  --ink-3:        #94a3b8;
  --line:         #e2e8f0;
  --bg:           #f6f8fb;
  --card:         #ffffff;

  /* Shape */
  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 8px 24px rgba(15,23,42,.06);
  --shadow-lg: 0 12px 40px rgba(15,23,42,.16);

  /* Layout */
  --max: 480px;            /* mobile-first column */
  --header-h: 56px;
  --claimbar-h: 76px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }

/* ---------- App column ---------- */
.app-shell {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
}

/* ---------- Top bar ---------- */
.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255,255,255,.9);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .back {
  background: none; border: none; font-size: 22px; line-height: 1;
  color: var(--ink); cursor: pointer; padding: 6px; border-radius: 8px;
}
.topbar .back:active { background: var(--line); }
.topbar h1 { font-size: 17px; font-weight: 700; margin: 0; flex: 1; }
.topbar .spacer { flex: 1; }

/* ---------- Brand mark ---------- */
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; letter-spacing: -.02em; color: var(--ink);
}
.brand .eye {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: grid; place-items: center; color: #fff; font-size: 14px;
}

/* ---------- Content ---------- */
.screen { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.screen.has-claimbar { padding-bottom: calc(var(--claimbar-h) + 24px); }
.stack > * + * { margin-top: 14px; }
.muted { color: var(--ink-2); }
.tiny { font-size: 12.5px; color: var(--ink-3); }
.center { text-align: center; }

h2.section { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin: 4px 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card.tap { cursor: pointer; transition: transform .08s ease, box-shadow .12s ease; }
.card.tap:active { transform: scale(.99); box-shadow: var(--shadow-lg); }

.choice {
  display: flex; gap: 14px; align-items: flex-start;
}
.choice .ic {
  flex: none; width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center; font-size: 22px;
  background: var(--brand-tint); color: var(--brand);
}
.choice h3 { margin: 0 0 4px; font-size: 17px; }
.choice p { margin: 0; font-size: 13.5px; color: var(--ink-2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 0 18px;
  border: none; border-radius: var(--r);
  font-size: 16px; font-weight: 700; cursor: pointer;
  background: var(--brand); color: #fff;
  transition: filter .12s ease, transform .06s ease;
}
.btn:active { transform: translateY(1px); filter: brightness(.96); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1.5px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.sm { min-height: 40px; font-size: 14px; width: auto; padding: 0 14px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { width: auto; flex: 1; }

/* ---------- Status chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; line-height: 1;
  padding: 6px 10px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.matched, .chip.correct      { color: var(--ok);     background: var(--ok-tint); }
.chip.missing, .chip.missing_item { color: var(--danger); background: var(--danger-tint); }
.chip.overcharged, .chip.mrp_overcharge { color: var(--danger); background: var(--danger-tint); }
.chip.quantity_mismatch, .chip.quantity_short { color: var(--warn); background: var(--warn-tint); }
.chip.pack_size_mismatch { color: var(--warn); background: var(--warn-tint); }
.chip.wrong_item, .chip.wrong_item_delivered { color: var(--warn); background: var(--warn-tint); }
.chip.double_scanned { color: var(--danger); background: var(--danger-tint); }
.chip.needs_review, .chip.item_not_visible { color: var(--review); background: var(--review-tint); }
.chip.suggested { color: var(--ink-2); background: #f1f5f9; border-style: dashed; border-color: var(--ink-3); }
.chip.fee, .chip.tax, .chip.discount, .chip.coupon, .chip.other { color: var(--ink-3); background: #f1f5f9; }

/* "AI suggested" badge */
.sugg-tag { font-size: 10.5px; font-weight: 700; color: var(--review); text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Upload / dropzone ---------- */
.dropzone {
  border: 2px dashed var(--brand); border-radius: var(--r);
  background: var(--brand-tint);
  padding: 26px 16px; text-align: center; cursor: pointer;
}
.dropzone .big { font-size: 34px; }
.dropzone strong { display: block; margin-top: 6px; font-size: 16px; color: var(--brand-dark); }
.dropzone span { font-size: 12.5px; color: var(--ink-2); }
.dropzone.drag { background: #dbe7ff; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #fff;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .rm {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px;
  border-radius: 50%; border: none; background: rgba(15,23,42,.7); color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer;
}
.thumb .tag {
  position: absolute; bottom: 0; left: 0; right: 0;
  font-size: 10px; font-weight: 700; text-align: center;
  background: rgba(15,23,42,.65); color: #fff; padding: 3px;
}

/* ---------- Bill item rows ---------- */
.item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px;
}
.item + .item { margin-top: 10px; }
.item .row1 { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.item .name { font-weight: 700; font-size: 15px; }
.item .meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.item .price { font-weight: 700; white-space: nowrap; }
.item .row2 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.item .editbtn { margin-left: auto; }

.qtybox { display: flex; align-items: center; gap: 6px; }
.qtybox button {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 18px; cursor: pointer; color: var(--ink);
}
.qtybox input {
  width: 46px; text-align: center; height: 30px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px;
}

/* status picker */
.statuses { display: flex; flex-wrap: wrap; gap: 6px; }
.statuses .chip { cursor: pointer; opacity: .55; }
.statuses .chip.active { opacity: 1; outline: 2px solid currentColor; outline-offset: 1px; }

/* ---------- Sticky claim bar ---------- */
.claimbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-width: var(--max); margin: 0 auto;
  height: calc(var(--claimbar-h) + env(safe-area-inset-bottom));
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 -8px 24px rgba(15,23,42,.08);
}
.claimbar .amt { flex: 1; }
.claimbar .amt small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.claimbar .amt b { font-size: 22px; color: var(--danger); letter-spacing: -.02em; }
.claimbar .btn { width: auto; min-width: 150px; }

/* ---------- Summary band ---------- */
.summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px;
}
.summary div { text-align: center; }
.summary b { display: block; font-size: 20px; }
.summary small { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .02em; }
.summary .m-ok b { color: var(--ok); }
.summary .m-issue b { color: var(--danger); }
.summary .m-review b { color: var(--review); }

/* ---------- Processing ---------- */
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: none; }
.steps .dot {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); display: grid; place-items: center; font-size: 14px; color: var(--ink-3);
}
.steps li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.active .dot { border-color: var(--brand); color: var(--brand); animation: pulse 1.1s infinite; }
.steps li.active span { color: var(--ink); font-weight: 700; }
.steps li span { color: var(--ink-3); }
@keyframes pulse { 0%,100%{ box-shadow: 0 0 0 0 rgba(37,99,235,.4);} 50%{ box-shadow: 0 0 0 7px rgba(37,99,235,0);} }
.spinner {
  width: 42px; height: 42px; margin: 8px auto; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Dispute message ---------- */
.msgbox {
  background: #0f172a; color: #e2e8f0; border-radius: var(--r);
  padding: 14px; font-size: 13.5px; white-space: pre-wrap; line-height: 1.55;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  max-height: 320px; overflow: auto;
}

/* ---------- History rows ---------- */
.hist {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
}
.hist + .hist { margin-top: 10px; }
.hist .v { flex: 1; min-width: 0; }
.hist .v b { font-size: 15px; display: block; }
.hist .v small { color: var(--ink-3); font-size: 12px; }
.hist .claim { text-align: right; }
.hist .claim b { color: var(--danger); }
.hist .claim small { display: block; font-size: 11px; color: var(--ink-3); }

/* ---------- Forms ---------- */
label.fl { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input {
  width: 100%; min-height: 50px; padding: 0 14px; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: var(--r); background: #fff; color: var(--ink);
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.field + .field { margin-top: 14px; }

/* ---------- Toast & banners ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: 90px; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: rise .25s ease; max-width: 90%;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

.banner {
  border-radius: var(--r); padding: 12px 14px; font-size: 13.5px;
  display: flex; gap: 10px; align-items: flex-start;
}
.banner.info { background: var(--brand-tint); color: var(--brand-dark); }
.banner.warn { background: var(--warn-tint); color: #92400e; }
.banner.review { background: var(--review-tint); color: #5b21b6; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 40px 16px; color: var(--ink-3); }
.empty .big { font-size: 44px; }

/* ============================================================
   LANDING PAGE  (wider, marketing)
   ============================================================ */
.land { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; }
.nav .links { display: flex; gap: 22px; align-items: center; }
.nav .links a { color: var(--ink-2); font-weight: 600; font-size: 14.5px; }
@media (max-width: 640px) { .nav .links a:not(.btn) { display: none; } }

.hero { text-align: center; padding: 40px 0 24px; }
.hero h1 { font-size: clamp(30px, 7vw, 52px); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 16px; }
.hero h1 .g { background: linear-gradient(120deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: clamp(16px, 2.4vw, 20px); color: var(--ink-2); max-width: 620px; margin: 0 auto 26px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .cta .btn { width: auto; min-width: 190px; }
.hero .note { margin-top: 14px; font-size: 13px; color: var(--ink-3); }

.phone {
  max-width: 320px; margin: 26px auto 0; background: #fff; border-radius: 28px;
  border: 8px solid #0f172a; box-shadow: var(--shadow-lg); overflow: hidden;
}
.phone .ph-top { background: var(--brand); color: #fff; padding: 14px 16px; font-weight: 700; }
.phone .ph-body { padding: 14px; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 820px) { .grid3 { grid-template-columns: 1fr; } }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); }
.feature .ic { width: 48px; height: 48px; border-radius: 12px; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; font-size: 24px; margin-bottom: 12px; }
.feature h3 { margin: 0 0 6px; font-size: 18px; }
.feature p { margin: 0; color: var(--ink-2); font-size: 14.5px; }

.sec { padding: 56px 0; }
.sec h2 { font-size: clamp(24px, 4vw, 34px); text-align: center; letter-spacing: -.02em; margin: 0 0 6px; }
.sec .sub { text-align: center; color: var(--ink-2); max-width: 560px; margin: 0 auto 34px; }

.steps-h { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; counter-reset: s; }
@media (max-width: 820px) { .steps-h { grid-template-columns: 1fr 1fr; } }
.steps-h .st { text-align: center; }
.steps-h .st .n { width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.steps-h .st h4 { margin: 0 0 4px; font-size: 16px; }
.steps-h .st p { margin: 0; font-size: 13.5px; color: var(--ink-2); }

.proof-demo { background: linear-gradient(135deg, var(--brand-dark), #0b1f4d); color: #fff; border-radius: var(--r-lg); padding: 30px; }
.proof-demo h3 { margin: 0 0 4px; font-size: 22px; }
.proof-demo .demo-table { background: rgba(255,255,255,.06); border-radius: var(--r); overflow: hidden; margin-top: 16px; }
.proof-demo .drow { display: grid; grid-template-columns: 1.6fr .7fr .7fr 1.1fr; gap: 6px; padding: 11px 14px; font-size: 13px; align-items: center; border-bottom: 1px solid rgba(255,255,255,.08); }
.proof-demo .drow.h { font-weight: 700; color: #cbd5e1; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.proof-demo .drow:last-child { border-bottom: none; }
.proof-demo .drow .res { font-weight: 700; }

.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: stretch; }
@media (max-width: 820px) { .pricing { grid-template-columns: 1fr; } }
.plan { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.plan.hot { border: 2px solid var(--brand); position: relative; }
.plan.hot .badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.plan h3 { margin: 0 0 4px; }
.plan .price { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.plan .price small { font-size: 14px; color: var(--ink-3); font-weight: 600; }
.plan ul { list-style: none; padding: 0; margin: 16px 0; flex: 1; }
.plan ul li { padding: 7px 0 7px 26px; position: relative; font-size: 14px; color: var(--ink-2); }
.plan ul li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }

.footer { border-top: 1px solid var(--line); padding: 34px 0; color: var(--ink-3); font-size: 13.5px; }
.footer .cols { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }

/* ---------- Bill items table ---------- */
.tablewrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
table.bt { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
table.bt thead th {
  position: sticky; top: 0; background: var(--brand-tint); color: var(--brand-dark);
  font-size: 11px; text-transform: uppercase; letter-spacing: .03em; font-weight: 700;
  text-align: left; padding: 9px 8px; white-space: nowrap; border-bottom: 1px solid var(--line);
}
table.bt th.c, table.bt td.c { text-align: center; }
table.bt th.r, table.bt td.r { text-align: right; white-space: nowrap; }
table.bt td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.bt tbody tr:last-child td { border-bottom: none; }
table.bt td.num { color: var(--ink-3); width: 26px; }
table.bt td.pname { min-width: 150px; }
table.bt td.pname span { font-weight: 600; }
table.bt tr.muted td { color: var(--ink-3); background: #fafbfc; }
table.bt tr.editrow td { background: var(--brand-tint); padding: 4px 12px 12px; }
table.bt .chip { font-size: 11px; padding: 4px 8px; }
.linkbtn { background: none; border: none; color: var(--brand); font-weight: 700; font-size: 12.5px; cursor: pointer; padding: 4px; white-space: nowrap; }
.linkbtn:active { opacity: .6; }
.rowact { white-space: nowrap; }
.okbtn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 14px; cursor: pointer; line-height: 1; margin: 0 1px; color: var(--ink-2);
}
.okbtn:active { transform: scale(.92); }
.okbtn.on { background: var(--ok); border-color: var(--ok); color: #fff; }

/* utilities */
.hide { display: none !important; }
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap8 { gap: 8px; }
.mt0 { margin-top: 0; }
.w-auto { width: auto; }
