:root { --g: #14532d; --bg: #f6f7f5; --fg: #1b1f1d; --mut: #5f6b64; --warn: #9a3412; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); overflow-x: hidden;
  font: 16px/1.4 system-ui, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif; }
.frame { max-width: 560px; min-width: 0; margin: 0 auto; padding: 12px 16px 24px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bar h1 { font-size: 1.25rem; margin: 8px 0; overflow-wrap: anywhere; }
.card { background: #fff; border-radius: 12px; padding: 20px 16px; margin-top: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.center { text-align: center; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.btn { font: inherit; min-height: 48px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--g);
  background: #fff; color: var(--g); cursor: pointer; width: 100%; margin-top: 8px; }
.btn.primary { background: var(--g); color: #fff; }
.btn.tile { min-height: 96px; font-size: 1.1rem; margin: 0; }
.btn.link { width: auto; border: 0; background: none; min-height: 44px; margin: 0; text-decoration: underline; }
.warn { color: var(--warn); font-weight: 600; font-size: 1.1rem; }
.muted { color: var(--mut); font-size: .85rem; overflow-wrap: anywhere; }
.foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 24px; }
.banner { background: #fff7ed; border: 1px solid var(--warn); color: var(--warn); border-radius: 10px; padding: 8px 12px; margin-top: 8px; }
label { display: block; margin-top: 12px; font-weight: 600; }
input[type="text"], input[type="search"] { font: inherit; width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid var(--mut); border-radius: 10px; background: #fff; color: var(--fg); }
input[aria-invalid="true"] { border-color: var(--warn); border-width: 2px; }
.row { display: flex; gap: 8px; align-items: stretch; }
.row .btn { width: auto; margin-top: 0; flex: 0 0 auto; }
.field { min-width: 0; }
.err { color: var(--warn); font-size: .9rem; margin: 4px 0 0; min-height: 0; }
.err:empty { display: none; }
.snap { background: #fef3c7; border: 1px solid #b45309; color: #78350f; border-radius: 8px; padding: 8px 12px; font-weight: 700; margin: 8px 0; }
.ok { color: var(--g); font-weight: 700; font-size: 1.2rem; }
.pick-list, .entries { list-style: none; padding: 0; margin: 0; }
.pick-list .btn { text-align: start; }
.scan-video { width: 100%; max-height: 240px; margin-top: 8px; border-radius: 10px; background: #000; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; background: #e5e7eb; color: #1f2937; }
.badge.sending { background: #dbeafe; color: #1e3a8a; }
.badge.submitted { background: #dcfce7; color: var(--g); }
.badge.cancelled { background: #fee2e2; color: #991b1b; }
.entry { margin-top: 12px; overflow-wrap: anywhere; }

select { font: inherit; width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid var(--mut); border-radius: 10px; background: #fff; color: var(--fg); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tabs .btn { width: auto; flex: 1 1 auto; margin-top: 0; min-width: 0; }
.line { border-top: 1px solid #e5e7eb; margin-top: 16px; padding-top: 12px; }
.line h3 { font-size: 1.05rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.sumline { overflow-wrap: anywhere; margin: 6px 0; }
.errs { margin: 4px 0 0; padding-inline-start: 20px; }
.card h2 { font-size: 1.1rem; margin: 0 0 8px; }
.badge.pending { background: #fef3c7; color: #78350f; }
.badge.kind { background: #e0f2fe; color: #0c4a6e; }
.badge.unsent { background: #fee2e2; color: #991b1b; }

/* ---- v2 look: app bar, compact cards, side-by-side quantity boxes, Send bar pinned at the bottom ---- */
:root { --line: #e5e7eb; --g-soft: #ecf4ee; }
.frame { padding: 0 12px 24px; }
.bar { position: sticky; top: 0; z-index: 20; background: var(--g); color: #fff; margin: 0 -12px; padding: 8px 12px; min-height: 52px; gap: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.bar h1 { flex: 1; margin: 0; font-size: 1.1rem; color: #fff; }
.bar .btn.link { color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.55); border-radius: 8px; padding: 2px 12px; min-height: 36px; font-size: .9rem; }
.bar .back { background: none; border: 0; color: #fff; font-size: 2rem; line-height: 1; width: 44px; min-height: 44px; margin-inline-start: -10px; cursor: pointer; }
[dir="rtl"] .chev { display: inline-block; transform: scaleX(-1); }
.card { padding: 14px; margin-top: 10px; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.count { background: var(--g-soft); color: var(--g); border-radius: 999px; padding: 0 10px; font-size: .9rem; }
.grid { gap: 10px; margin-top: 12px; }
.btn.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 110px; border: 0; box-shadow: 0 1px 3px rgba(0,0,0,.15); font-weight: 600; }
.btn.tile .ico { font-size: 2rem; line-height: 1; }
.qtygrid { align-items: end; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; margin-top: 4px; }
.qtygrid > :only-child { grid-column: 1 / -1; }
.qtygrid label { margin-top: 6px; font-size: .85rem; color: var(--mut); }
.qtygrid input { text-align: center; font-size: 1.25rem; font-weight: 600; min-height: 50px; }
.line-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.line-head h3 { flex: 1; min-width: 0; }
.line .x { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--mut); font-size: 1rem; cursor: pointer; }
.line { margin-top: 12px; padding-top: 10px; }
.line:first-of-type { border-top: 0; margin-top: 4px; }
.actions { position: sticky; bottom: 0; z-index: 10; display: grid; grid-template-columns: 2fr 1fr; gap: 8px; padding: 10px 0 4px; margin-top: 8px; background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 30%); }
.actions .btn { margin-top: 0; font-weight: 600; }
.foot { margin-top: 20px; }

/* ---- daily tasks ---- */
.task-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.task-item .btn { width: auto; margin-top: 0; flex: 0 0 auto; min-height: 40px; }
.task-item .x { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--mut); cursor: pointer; }
.task-item.done { color: var(--g); }
.tile-note { font-size: .8rem; font-weight: 600; color: var(--mut); min-height: 1em; }
.tile-note:empty { display: none; }
.stat-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
input[type="date"] { font: inherit; width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid var(--mut); border-radius: 10px; background: #fff; color: var(--fg); }

/* ---- scan-first home and the bottom bar ---- */
.frame { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.actions { bottom: calc(64px + env(safe-area-inset-bottom)); }
.hero { display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 12px; padding: 18px 16px; border: 0; border-radius: 14px; background: var(--g); color: #fff; font: inherit; text-align: start; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.hero .ico { font-size: 2.6rem; line-height: 1; }
.hero-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hero-text strong { font-size: 1.35rem; }
.hero-text small { font-size: .85rem; opacity: .9; }
.bottomnav { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottomnav .navin { display: flex; max-width: 560px; margin: 0 auto; }
.bottomnav button { flex: 1 1 0; min-width: 0; min-height: 58px; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: none; color: var(--mut); font: inherit; font-size: .72rem; cursor: pointer; overflow-wrap: anywhere; }
.bottomnav button .ico { font-size: 1.35rem; line-height: 1; }
.bottomnav button[aria-current="page"] { color: var(--g); font-weight: 700; }
.bottomnav button.scan { background: var(--g); color: #fff; border-radius: 14px; margin: 5px 4px; }

/* ---- v3 finish: depth, rhythm, touch feedback ---- */
:root { --g2: #1f7a45; --radius: 16px; --shadow: 0 1px 2px rgba(16,40,26,.06), 0 6px 18px rgba(16,40,26,.08); }
html, body { background: linear-gradient(180deg, #eef3ee 0, var(--bg) 220px) no-repeat, var(--bg); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
.bar { background: linear-gradient(135deg, #0f3d22, var(--g2)); box-shadow: 0 2px 10px rgba(15,61,34,.35); }
.bar h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: .2px; }
.card { border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(20,83,45,.06); }
.card h2 { font-size: 1.05rem; font-weight: 700; }
.btn { border-radius: 14px; font-weight: 600; transition: transform .08s ease, box-shadow .15s ease, background .15s ease; }
.btn:active { transform: scale(.975); }
.btn.primary { background: linear-gradient(135deg, var(--g), var(--g2)); border-color: transparent; box-shadow: 0 4px 12px rgba(20,83,45,.28); }
.btn.tile { border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.btn.tile .ico { font-size: 2.1rem; }
.hero { border-radius: 20px; box-shadow: 0 8px 22px rgba(20,83,45,.30); }
input[type="text"], input[type="search"], select { border-radius: 12px; border-color: #c9d2cc; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, .btn:focus-visible { outline: none; border-color: var(--g2); box-shadow: 0 0 0 3px rgba(31,122,69,.22); }
.qtygrid input { background: #f8faf8; }
.badge { padding: 3px 12px; letter-spacing: .2px; }
.banner, .snap { border-radius: 12px; }
.bottomnav { background: rgba(255,255,255,.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 -4px 18px rgba(16,40,26,.10); border-top: 1px solid rgba(20,83,45,.08); }
.bottomnav button { transition: color .15s, transform .08s; }
.bottomnav button:active { transform: scale(.94); }
.bottomnav button[aria-current="page"] { color: var(--g); font-weight: 700; }
.line .x { transition: background .15s; }
.line .x:active { background: #fee2e2; }
.pick-list .btn { border-radius: 12px; border-color: #dfe5e1; background: #fff; }
@media (prefers-reduced-motion: reduce) { .btn, .bottomnav button { transition: none; } .btn:active { transform: none; } }
.hero { background: linear-gradient(135deg, #0f3d22, var(--g2)); }
.bottomnav button.scan { background: linear-gradient(135deg, var(--g), var(--g2)); color: #fff; box-shadow: 0 3px 10px rgba(20,83,45,.35); }

/* ---- v4: cream / deep green / gold, line icons, quiet cards (matches the Codex demo look) ---- */
:root { --g: #153f35; --g2: #153f35; --bg: #f6f5ef; --fg: #203a33; --ink: #203a33; --mut: #737b72; --line: #e3e5dc; --gold: #efd28d; --g-soft: #e9eee7; --warn: #9a3c24; --radius: 18px; --shadow: none; }
html, body { background: var(--bg); color: var(--fg); font-family: 'Segoe UI', Tahoma, "Noto Sans Arabic", Arial, sans-serif; }
.ico svg, .arrow svg, .bottomnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }
.frame { max-width: 480px; padding: 0 20px 110px; }
/* header: quiet, on the cream page */
.bar { background: var(--bg); color: var(--ink); box-shadow: none; margin: 0 -20px; padding: 18px 20px 14px; min-height: 72px; gap: 11px; }
.bar h1 { color: var(--ink); font-size: 1.05rem; font-weight: 700; letter-spacing: .025em; }
.bar .btn.link { color: var(--ink); background: transparent; border: 1px solid #d5d9ce; border-radius: 20px; padding: 6px 14px; min-height: 40px; font-size: .8rem; }
.bar .back { color: var(--g); background: #fff; border: 1px solid var(--line); border-radius: 50%; width: 40px; min-height: 40px; height: 40px; font-size: 1.7rem; margin-inline-start: 0; padding: 0 0 3px; }
.brandmark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; background: var(--g); color: var(--gold); font-weight: 700; font-size: 1.4rem; flex: none; }
/* home */
.eyebrow { font-size: .68rem; font-weight: 700; letter-spacing: .15em; color: var(--mut); margin: 6px 0 10px; }
[dir="rtl"] .eyebrow { letter-spacing: 0; }
.headline { font-size: 1.95rem; line-height: 1.12; letter-spacing: -.035em; font-weight: 650; margin: 0 0 20px; color: var(--ink); }
[dir="rtl"] .headline { letter-spacing: 0; line-height: 1.4; font-size: 1.9rem; }
.hero { background: var(--g); border-radius: 22px; padding: 22px; gap: 16px; min-height: 112px; box-shadow: none; margin-top: 0; }
.hero .ico { color: var(--gold); background: #ffffff12; border: 1px solid #ffffff22; border-radius: 15px; padding: 13px; display: flex; }
.hero-text { flex: 1; }
.hero-text strong { font-size: 1.2rem; margin-bottom: 6px; }
.hero-text small { color: #c1d2c8; font-size: .78rem; line-height: 1.5; }
.hero .arrow { color: var(--gold); display: flex; }
[dir="rtl"] .arrow svg { transform: scaleX(-1); }
.grid { gap: 12px; margin-top: 14px; }
.btn.tile { align-items: flex-start; justify-content: flex-start; text-align: start; gap: 12px; min-height: 108px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: none; color: var(--ink); font-weight: 600; }
.btn.tile:first-child { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 78px; gap: 16px; }
.btn.tile .ico { background: #f2f4ed; color: var(--g); border-radius: 12px; padding: 9px; display: flex; font-size: 1rem; }
.btn.tile strong { display: block; font-size: .95rem; font-weight: 650; }
.tile-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile-note { display: block; font-size: .72rem; color: var(--mut); font-weight: 400; }
#home-continue { background: #fff8e6; border: 1px solid #dac388; color: #5b4a22; border-radius: 15px; text-align: start; justify-content: flex-start; font-weight: 600; margin-top: 14px; }
.foot { margin-top: 24px; font-size: .75rem; }
/* cards, buttons, fields */
.card { border: 1px solid var(--line); border-radius: 18px; box-shadow: none; background: #fff; padding: 18px; margin-top: 14px; }
.card h2 { font-size: 1.05rem; font-weight: 650; }
.btn { border-radius: 13px; border: 1px solid var(--line); background: #fff; color: var(--g); min-height: 50px; font-weight: 600; }
.btn.primary { background: var(--g); border-color: var(--g); color: #fff; box-shadow: none; }
.btn.link { border: 0; background: none; }
input[type="text"], input[type="search"], select, input[type="number"] { border: 1px solid #d8ddd2; border-radius: 12px; background: #fff; color: var(--ink); }
input:focus, select:focus { border-color: var(--g); box-shadow: 0 0 0 3px rgba(21,63,53,.14); }
.btn:focus-visible, button:focus-visible { outline: 3px solid #b27d17; outline-offset: 2px; box-shadow: none; }
label { color: var(--mut); font-size: .8rem; font-weight: 500; }
.qtygrid input { background: #fff; color: var(--g); }
.count { background: var(--g-soft); color: var(--g); }
.line { border-top: 1px solid var(--line); }
.banner { background: #fff8e6; border: 1px solid #dac388; color: #5b4a22; border-radius: 14px; }
.snap { background: #eeeada; border: 0; color: #7c704e; border-radius: 12px; font-weight: 600; }
.warn { color: var(--warn); }
.badge { background: #eaf0e4; color: #43633e; font-size: .7rem; }
.badge.submitted { background: #e4eee2; color: #285637; }
.badge.pending { background: #fff1d0; color: #7a653a; }
.badge.cancelled, .badge.unsent { background: #f6e5de; color: #94482d; }
.ok { color: #285637; }
.pick-list .btn { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
/* bottom bar */
.bottomnav { background: rgba(250,251,247,.93); border-top: 1px solid var(--line); box-shadow: none; }
.bottomnav button { color: #839085; font-size: .66rem; min-height: 60px; }
.bottomnav button svg { width: 22px; height: 22px; }
.bottomnav button[aria-current="page"] { color: var(--g); font-weight: 700; }
.bottomnav button.scan { background: var(--g); color: var(--gold); box-shadow: none; border-radius: 16px; margin: 6px 6px; }
.bottomnav button.scan[aria-current="page"] { color: var(--gold); }
.actions { background: linear-gradient(to bottom, rgba(246,245,239,0), var(--bg) 30%); }
@media (min-width: 700px) { html, body { background: #eceee6; } .frame { background: var(--bg); border-inline: 1px solid var(--line); min-height: 100vh; } }
.brandmark { display: block; background: #fff; border: 1px solid var(--line); padding: 6px; object-fit: contain; color: inherit; }
