/* Ramzi web app. All styling lives here (CSP: no inline styles). Tokens follow the approved mockup. */

:root {
  --ink: #1E2823;
  --muted: #56645B;
  --card: #FFFFFF;
  --line: #E3DDCE;
  --line2: #D9D2C0;
  --line3: #EFE9DA;
  --green: #1C7A4B;
  --green-d: #14603A;
  --green-bg: #E3F3EA;
  --blue: #23589E;
  --blue-d: #1B4880;
  --blue-bg: #DCE8F7;
  --red: #B3261E;
  --red-bg: #FDE7E4;
  --orange: #8A4A00;
  --orange-bg: #FFF0DC;
  --neutral-bg: #EDE8DC;
  --cart-line: #B9B19C;
  --bg: #F6F2E9;
  --bgimg: none;
  --bgsize: auto;
  --font-body: "Assistant", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Rubik", "Assistant", system-ui, sans-serif;
}
html[data-bg="notepad"] { --bg: #FBF8F0; --bgimg: radial-gradient(#D5CDB8 1.3px, transparent 1.4px); --bgsize: 20px 20px; }
html[data-bg="sage"] { --bg: #E9EFE6; }
html[data-bg="sky"] { --bg: #EAF1F7; }
html[data-fs="s"] { font-size: 14.5px; }
html[data-fs="m"] { font-size: 16px; }
html[data-fs="l"] { font-size: 18px; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background-color: var(--bg);
  background-image: var(--bgimg);
  background-size: var(--bgsize);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.3;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea { font-family: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.offscreen { position: fixed; inset-inline-start: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }
.noscript { padding: 24px; }
.icon { flex-shrink: 0; }
.flip { transform: scaleX(-1); }
[dir="ltr"] .flip-ltr { transform: scaleX(-1); }
[dir="ltr"] .icon-back { transform: scaleX(-1); }
.muted-ic { color: var(--muted); }
.muted-s { color: var(--muted); font-size: 0.875rem; }

/* ---------- layout ---------- */
.app { position: relative; height: 100dvh; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; }
.content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.col { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 16px 14px; display: flex; flex-direction: column; gap: 8px; }
.scroll > * { flex-shrink: 0; }
.grow { flex: 1 1 0; min-width: 0; }
.gap { height: 6px; }

/* ---------- headers ---------- */
.hdr { display: flex; align-items: center; gap: 10px; padding: 22px 20px 8px; flex-shrink: 0; }
.hdr.tight { padding-top: 18px; padding-inline: 16px; }
.backhdr { display: flex; align-items: center; gap: 10px; padding: 18px 16px 6px; flex-shrink: 0; }
.hdr-main { flex: 1; min-width: 0; }
.hdr-title { font-family: var(--font-head); font-weight: 700; font-size: 1.625rem; line-height: 1.15; }
.hdr-title.sm { font-size: 1.5rem; }
.hdr-title.center { text-align: center; }
.hdr-sub { font-size: 0.875rem; color: var(--muted); }
.hdr-sub.center { text-align: center; }
.hdr-add { padding: 0 16px 8px; flex-shrink: 0; }
.iconbtn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--card); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0; font-size: 1.25rem; font-weight: 700; }
.iconbtn.sm { width: 40px; height: 40px; border-radius: 20px; border: 1.5px solid var(--line2); }
.iconbtn.green { background: var(--green); color: #fff; border: 0; border-radius: 14px; width: 44px; height: 44px; }

/* ---------- tab bar ---------- */
.tabbar { height: 76px; padding: 8px 8px 10px; background: var(--card); border-top: 1px solid var(--line); display: flex; gap: 4px; flex-shrink: 0; padding-bottom: max(10px, env(safe-area-inset-bottom)); height: auto; min-height: 76px; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-weight: 600; font-size: 0.78rem; border-radius: 14px; min-height: 56px; }
.tab.on { color: var(--green); font-weight: 700; background: var(--green-bg); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 58px; padding: 0 18px; border-radius: 18px; border: 2px solid transparent; background: var(--green); color: #fff; font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; text-align: center; }
.btn.sm { min-height: 48px; font-size: 1rem; border-radius: 14px; padding: 0 14px; font-family: var(--font-body); }
.btn.xs { min-height: 36px; font-size: 0.875rem; border-radius: 12px; padding: 0 12px; font-family: var(--font-body); }
.btn.outline { background: var(--card); color: var(--ink); border: 1.5px solid var(--line2); font-family: var(--font-body); font-size: 1rem; min-height: 52px; border-radius: 16px; }
.btn.outline.green { border: 2px solid var(--green); color: var(--green-d); }
.btn.outline.on { background: var(--green-bg); border-color: var(--green); color: var(--green-d); }
.btn.outline.muted { color: var(--muted); }
.btn.danger-outline { background: var(--card); color: var(--red); border: 1.5px solid var(--red); font-family: var(--font-body); font-size: 1rem; min-height: 50px; border-radius: 16px; }
.btn.danger-outline.on { background: var(--red-bg); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.sm.outline, .btn.sm.danger-outline { min-height: 46px; font-size: 0.9375rem; }
.btn.xs.danger-outline, .btn.xs.outline { min-height: 36px; font-size: 0.875rem; }
.btn.cta { min-height: 62px; border-radius: 20px; gap: 12px; }
.btn:disabled { opacity: 0.5; }
.linkbtn { background: none; border: 0; color: var(--muted); font-size: 1rem; font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.link { color: var(--blue); font-weight: 700; font-size: 0.9375rem; }
.btnrow { display: flex; gap: 8px; }
.btnrow > .btn { flex: 1; }
.btnrow .btn.sm { white-space: nowrap; font-size: 0.875rem; padding: 0 6px; gap: 5px; }

/* ---------- chips ---------- */
.chip { min-height: 40px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line2); background: var(--card); font-size: 0.9rem; font-weight: 700; color: var(--ink); flex-shrink: 0; }
.chip.on { border: 2px solid var(--blue); background: var(--blue-bg); color: var(--blue-d); }
.chip.big { min-height: 48px; font-size: 1rem; }
.chip.big.on { border-color: var(--green); background: var(--green-bg); color: var(--green-d); }
.chip.big.on.blue { border-color: var(--blue); background: var(--blue-bg); color: var(--blue-d); }
.chip-note { font-size: 0.78rem; font-weight: 600; }
.chiprow { display: flex; gap: 8px; padding: 0 16px 8px; flex-shrink: 0; }
.chiprow.scrollx { overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.chiprow .chip { flex: 1; padding: 0 8px; }
.chiprow.scrollx .chip { flex: none; padding: 0 16px; }
.chipwrap, .catgrid { display: flex; flex-wrap: wrap; gap: 8px; }
.catgrid { padding-bottom: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.wrap { align-content: flex-start; }
.itemchip { min-height: 46px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line2); background: var(--card); font-size: 1.0625rem; font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.itemchip.del { border-color: var(--red); color: var(--red); }
.itemchip.big { min-height: 54px; padding: 0 18px; border-radius: 16px; font-size: 1.1875rem; font-weight: 700; gap: 7px; }
.itemchip.cart { min-height: 48px; padding: 0 16px; border-radius: 16px; border: 1.5px dashed var(--cart-line); background: var(--neutral-bg); font-size: 1.0625rem; font-weight: 600; color: var(--muted); text-decoration: line-through; }
.itemchip.cart .icon { color: var(--green); text-decoration: none; }
.itemchip .dated { color: var(--orange); }

/* ---------- section headers ---------- */
.sec { display: flex; justify-content: space-between; align-items: center; background: var(--blue); color: #fff; border-radius: 12px; padding: 8px 14px; font-family: var(--font-head); font-weight: 600; font-size: 0.9rem; width: 100%; border: 0; text-align: start; }
.sec-btn { cursor: pointer; }
.sec-right { display: inline-flex; align-items: center; gap: 8px; }
.sec .cnt { background: var(--blue-d); border-radius: 10px; padding: 1px 9px; font-size: 0.8125rem; }
.sec.small { width: 100%; padding: 6px 14px; margin-top: 4px; font-size: 0.9rem; }
.sec.cart { background: var(--line2); color: var(--ink); margin-top: 8px; }
.sec.cart .cnt { background: var(--bg); }
.aisle { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.divider { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 0.875rem; margin-top: 6px; }
.divider.red { color: var(--red); }
.divider-l { flex: 1; height: 2px; background: var(--red); }
.actrow { display: flex; gap: 8px; }
.actrow > * { flex: 1; }
.modehint { font-size: 0.875rem; font-weight: 700; color: var(--muted); text-align: center; }
.cta-wrap { padding: 10px 16px 12px; flex-shrink: 0; display: flex; flex-direction: column; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; }
.card-title { font-family: var(--font-head); font-weight: 600; font-size: 1.125rem; margin-bottom: 4px; }
.hint { font-size: 0.8125rem; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.hint.big { font-size: 0.9375rem; }
.empty { text-align: center; padding: 26px 12px; }
.empty-t { font-family: var(--font-head); font-weight: 600; font-size: 1.125rem; }
.empty-s { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.lbl { font-size: 0.875rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.quip { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; font-size: 0.9375rem; line-height: 1.4; }
.quip b { color: var(--green-d); }
.quipcard { font-size: 1rem; line-height: 1.4; }
.note { line-height: 1.45; }
.pill { background: var(--neutral-bg); border-radius: 10px; padding: 2px 10px; font-size: 0.8125rem; font-weight: 700; white-space: nowrap; }
.tagchip { display: inline-flex; align-items: center; gap: 5px; background: var(--blue-bg); color: var(--blue-d); border-radius: 12px; padding: 5px 11px; font-size: 0.8125rem; font-weight: 700; white-space: nowrap; }
.tagchip.green { background: var(--green-bg); color: var(--green-d); }
.badge { border-radius: 8px; padding: 2px 8px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.orange { background: var(--orange-bg); color: var(--orange); }
.badge.neutral { background: var(--neutral-bg); color: var(--ink); }
.badge.none { background: var(--card); color: var(--muted); border: 1px solid var(--line2); padding: 1px 7px; }

/* ---------- forms ---------- */
.inp { border: 0; outline: 0; background: transparent; font-size: 1.0625rem; min-width: 0; width: 100%; }
.addbox, .searchwrap { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1.5px solid var(--line2); border-radius: 18px; padding: 5px 8px 5px 14px; min-height: 54px; }
[dir="rtl"] .addbox { padding: 5px 14px 5px 8px; }
.searchwrap { border-radius: 14px; min-height: 46px; padding: 0 14px; color: var(--muted); }
.addbox:focus-within, .searchwrap:focus-within { border-color: var(--blue); }
.inp.boxed { border: 1.5px solid var(--line2); border-radius: 14px; padding: 0 14px; min-height: 48px; background: var(--card); margin-bottom: 10px; }
.searchbox { flex: 1; }

/* ---------- home ---------- */
.pad-home { padding: 22px 20px 14px; gap: 14px; }
.home-head { display: flex; align-items: center; gap: 12px; }
.avatar { width: 48px; height: 48px; border-radius: 24px; background: var(--green); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 700; font-size: 1.375rem; flex-shrink: 0; }
.avatar.big { width: 84px; height: 84px; border-radius: 42px; font-size: 2.5rem; }
.avatar.sm { width: 38px; height: 38px; border-radius: 19px; font-size: 1rem; }
.avatar.blue { background: var(--blue-bg); color: var(--blue-d); }
.pchip { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 6px 12px; font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.pchip.on { background: var(--green-bg); border-color: var(--green-bg); color: var(--green-d); font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--green); flex-shrink: 0; }
.dot.muted { background: var(--cart-line); }
.hero { display: flex; align-items: center; gap: 16px; background: var(--green); color: #fff; border-radius: 24px; padding: 18px 20px; min-height: 100px; }
.hero-ic { width: 56px; height: 56px; border-radius: 28px; background: var(--green-d); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hero-txt { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.hero-t { font-family: var(--font-head); font-weight: 700; font-size: 1.625rem; line-height: 1.15; }
.hero-s { font-size: 0.84rem; color: var(--green-bg); }
.stat-row { display: flex; gap: 10px; }
.stat-tile { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; }
.stat-n { font-family: var(--font-head); font-weight: 700; font-size: 1.75rem; line-height: 1.1; }
.stat-l { font-size: 0.875rem; color: var(--muted); font-weight: 600; }
.exp-card { padding: 14px 16px 6px; }
.exp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.exp-head .card-title { margin: 0; }
.exp-row { display: flex; align-items: center; gap: 10px; min-height: 46px; border-top: 1px solid var(--line3); }
.exp-name { flex: 1; font-size: 1.0625rem; font-weight: 600; }
.exp-empty { color: var(--muted); padding: 10px 0 12px; font-size: 0.9375rem; }
.recent { font-size: 0.875rem; color: var(--muted); text-align: center; }
.pad-list, .pad-set, .pad-more, .pad-veg, .pad-stock { padding: 4px 16px 14px; }
.pad-list { gap: 12px; }
.pad-set { gap: 10px; }
.pad-stock { gap: 8px; }

/* ---------- banner ---------- */
.banner { display: flex; align-items: center; gap: 8px; background: var(--orange-bg); color: var(--orange); border: 1.5px solid var(--orange); border-radius: 14px; padding: 8px 12px; margin: 10px 16px 0; font-size: 0.875rem; font-weight: 700; flex-shrink: 0; }

/* ---------- stock tiles ---------- */
.stock-sec { display: flex; flex-direction: column; gap: 8px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; gap: 3px; border-radius: 14px; border: 1.5px solid var(--line2); background: var(--card); padding: 8px 10px; min-height: 60px; text-align: start; min-width: 0; }
.tile.alert { border-color: var(--red); }
.tile.sel { border-color: var(--blue); background: var(--blue-bg); }
.tile-name { font-size: 1rem; font-weight: 700; line-height: 1.2; display: flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.tile-info { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tile-ago { font-size: 0.78rem; color: var(--muted); }
.tile-check { width: 18px; height: 18px; border-radius: 6px; border: 2px solid var(--muted); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tile-check.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.tile.pantry { flex-direction: row; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; }
[dir="rtl"] .tile.pantry { padding: 6px 10px 6px 6px; }
.tile-main { flex: 1; min-width: 0; background: none; border: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; text-align: start; }
.outbtn { width: 38px; height: 38px; border-radius: 19px; border: 1.5px solid var(--green); background: var(--card); color: var(--green-d); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0; }
.btn.more { align-self: stretch; }
.bulkbar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--card); border-top: 1px solid var(--line); flex-shrink: 0; flex-wrap: wrap; }
.bulk-n { font-weight: 700; font-size: 0.875rem; flex-basis: 100%; }
.bulkbar .btn { flex: 1; min-width: 0; padding: 0 8px; }

/* ---------- lists in sub screens ---------- */
.row { display: flex; align-items: center; gap: 14px; min-height: 58px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 0 14px; width: 100%; text-align: start; }
.row-ic { width: 40px; height: 40px; border-radius: 20px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.row-ic.green { background: var(--green-bg); color: var(--green-d); }
.row-ic.blue { background: var(--blue-bg); color: var(--blue-d); }
.row-ic.red { background: var(--red-bg); color: var(--red); }
.row-ic.orange { background: var(--orange-bg); color: var(--orange); }
.row-ic.neutral { background: var(--neutral-bg); color: var(--ink); }
.row-t { flex: 1; font-size: 1.125rem; font-weight: 700; }
.version { text-align: center; font-size: 0.8125rem; color: var(--muted); padding-top: 6px; }
.mgrow { display: flex; align-items: center; gap: 8px; min-height: 56px; border-radius: 16px; border: 1.5px solid var(--line2); background: var(--card); padding: 0 14px; width: 100%; text-align: start; }
.mgrow-name { flex: 1; font-size: 1.125rem; font-weight: 700; }
.actrow-i { display: flex; align-items: center; gap: 12px; min-height: 60px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 0 12px; }
.act-t { flex: 1; font-size: 1rem; font-weight: 600; line-height: 1.3; }
.act-time { font-size: 0.8125rem; color: var(--muted); font-weight: 600; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.vegbtn { min-height: 56px; border-radius: 16px; border: 1.5px solid var(--line2); background: var(--card); font-size: 1.0625rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 6px; }
.vegbtn.on { border: 2px solid var(--green); background: var(--green-bg); color: var(--green-d); }
.vegbtn.rem { border-color: var(--red); color: var(--red); }
.bottombar { display: flex; gap: 8px; padding: 10px 16px 12px; background: var(--card); border-top: 1px solid var(--line); flex-shrink: 0; }
.bottombar .btn { min-height: 52px; white-space: nowrap; padding: 0 8px; font-size: 0.9375rem; }
.card > .btn { width: 100%; }
.textcard { font-size: 1.1875rem; font-weight: 600; line-height: 1.55; white-space: pre-line; padding: 14px 18px; border-radius: 20px; }

/* ---------- settings / sharing / devices ---------- */
.setcard { padding: 4px 14px; }
.setrow { display: flex; align-items: center; gap: 12px; min-height: 56px; border-bottom: 1px solid var(--line3); }
.setrow.last { border-bottom: 0; }
.setrow-t { flex: 1; font-size: 1.0625rem; font-weight: 700; }
.setblock { padding: 10px 0 12px; border-bottom: 1px solid var(--line3); }
.setblock .setrow-t { display: block; margin-bottom: 8px; }
.daysrow { display: flex; gap: 6px; }
.daysrow .chip { flex: 1; padding: 0; min-height: 44px; border-radius: 12px; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 17px; border: 1.5px solid var(--cart-line); padding: 0; }
.swatch.on { border: 3px solid var(--green); }
.swatch.sw-cream { background: #F6F2E9; }
.swatch.sw-notepad { background: #FBF8F0; }
.swatch.sw-sage { background: #E9EFE6; }
.swatch.sw-sky { background: #EAF1F7; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper-v { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; min-width: 56px; text-align: center; }
.switch { width: 52px; height: 30px; border-radius: 15px; border: 0; background: var(--cart-line); position: relative; flex-shrink: 0; padding: 0; }
.switch .knob { position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 12px; background: #fff; transition: inset-inline-start 0.15s; }
.switch.on { background: var(--green); }
.switch.on .knob { inset-inline-start: 25px; }
.seg { display: inline-flex; border: 1.5px solid var(--line2); border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.seg-b { border: 0; background: var(--card); padding: 7px 12px; font-size: 0.875rem; font-weight: 700; min-height: 36px; }
.seg-b.on { background: var(--green); color: #fff; }
.fs-s { font-size: 0.8125rem; } .fs-m { font-size: 1rem; } .fs-l { font-size: 1.25rem; }
.member { display: flex; align-items: center; gap: 12px; min-height: 60px; border-bottom: 1px solid var(--line3); }
.member:last-child { border-bottom: 0; }
.memberlist { padding: 4px 14px; }
.member-t { flex: 1; font-size: 1.0625rem; font-weight: 700; }
.ready { background: var(--green-bg); border: 1.5px solid var(--green); display: flex; flex-direction: column; gap: 10px; }
.ready-t { font-size: 0.875rem; font-weight: 700; color: var(--green-d); }
.ready-boxes { display: flex; gap: 10px; }
.ready-box { flex: 1; background: var(--card); border-radius: 14px; padding: 8px 12px; }
.ready-k { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.ready-v { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; letter-spacing: 1px; text-align: end; }
.activeinv { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 0.9375rem; font-weight: 600; }
.device { display: flex; flex-direction: column; gap: 6px; }
.device.current { border: 1.5px solid var(--green); }
.device-row { display: flex; align-items: center; gap: 10px; }
.device-main { flex: 1; min-width: 0; }
.device-t { font-size: 1.0625rem; font-weight: 700; }
.device-s, .device-since { font-size: 0.8125rem; color: var(--muted); }
.infocard { background: var(--green-bg); border-color: var(--green-bg); color: var(--green-d); font-size: 0.9rem; line-height: 1.4; }

/* ---------- welcome ---------- */
.pad-welcome { padding: 40px 20px 16px; gap: 16px; }
.welcome-top { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.okbadge { display: inline-flex; align-items: center; gap: 8px; background: var(--green-bg); color: var(--green-d); border-radius: 14px; padding: 6px 14px; font-size: 0.9375rem; font-weight: 700; }
.step { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; }
.step-n { width: 26px; height: 26px; border-radius: 13px; background: var(--green); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.875rem; flex-shrink: 0; }
.step-t { font-size: 0.9375rem; line-height: 1.4; }
.tghint { background: var(--orange-bg); color: var(--orange); border-radius: 16px; padding: 12px 14px; font-size: 0.9rem; line-height: 1.4; }
.welcome-foot { padding: 12px 20px 18px; display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.paste .inp.boxed { margin-bottom: 4px; }
.paste .btn { width: 100%; margin-top: 10px; min-height: 52px; }

/* ---------- shopping mode ---------- */
.shop-col { background: transparent; }
.shop-top { padding: 14px 16px 8px; display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.shop-top .banner { margin: 0; }
.shop-badges { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fullbadge { display: inline-flex; align-items: center; gap: 6px; background: var(--green-bg); color: var(--green-d); border-radius: 16px; padding: 5px 11px; font-size: 0.8125rem; font-weight: 700; }
.shop-titlerow { display: flex; align-items: center; gap: 12px; }
.progress { flex: 1; height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.progress-bar { height: 10px; background: var(--green); border-radius: 5px; transition: width 0.25s; }
.progress-n { font-family: var(--font-head); font-weight: 600; font-size: 1rem; color: var(--green-d); flex-shrink: 0; }
.pad-shop { padding: 0 16px 12px; }
.doneall { width: 100%; text-align: center; font-weight: 700; color: var(--green-d); background: var(--green-bg); border-radius: 14px; padding: 10px; }
.shop-bottom { display: flex; gap: 10px; padding: 10px 16px 18px; background: var(--card); border-top: 1px solid var(--line); flex-shrink: 0; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.holdbtn { position: relative; overflow: hidden; width: 168px; padding: 0 10px; white-space: nowrap; font-size: 0.9375rem; min-height: 58px; border: 2px solid var(--red); border-radius: 18px; touch-action: none; user-select: none; -webkit-user-select: none; font-weight: 700; flex-shrink: 0; }
.holdbtn .hold-fill { position: absolute; inset: 0; background: var(--red-bg); transform: scaleX(0); transform-origin: left center; }
[dir="rtl"] .holdbtn .hold-fill { transform-origin: right center; }
.holdbtn .icon, .holdbtn .hold-t { position: relative; }
.shop-bottom .btn.outline { border: 2px solid var(--green); color: var(--green-d); border-radius: 18px; min-height: 58px; font-size: 1.0625rem; font-weight: 700; }

/* ---------- sheets / dialogs / toast ---------- */
#overlay { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
#overlay > * { pointer-events: auto; }
.sheet-layer, .dlg-layer { position: fixed; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.dlg-layer { justify-content: center; padding: 24px; }
.sheet-dim { position: absolute; inset: 0; background: rgba(20, 30, 25, 0.5); }
.sheet { position: relative; width: 100%; max-width: 480px; max-height: 92dvh; background-color: var(--bg); background-image: var(--bgimg); background-size: var(--bgsize); border-radius: 28px 28px 0 0; padding: 10px 16px 18px; display: flex; flex-direction: column; gap: 12px; animation: rz-up 0.2s ease-out; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.handle { align-self: center; width: 44px; height: 5px; border-radius: 3px; background: var(--cart-line); flex-shrink: 0; }
.sheet-head { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.sheet-titles { flex: 1; min-width: 0; }
.sheet-title { font-family: var(--font-head); font-weight: 700; font-size: 1.5rem; line-height: 1.15; overflow-wrap: anywhere; }
.sheet-sub { font-size: 0.9375rem; color: var(--muted); }
.sheet-body { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 0; }
.mg-wrap, .mg-body { display: flex; flex-direction: column; gap: 14px; }
.recrow { display: flex; gap: 8px; }
.recrow .chip { flex: 1; padding: 0 4px; }
.dlg { position: relative; width: 100%; max-width: 340px; background: var(--card); border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 12px; animation: rz-pop 0.15s ease-out; }
.dlg-t { font-family: var(--font-head); font-weight: 700; font-size: 1.375rem; }
.dlg-p { font-size: 1rem; line-height: 1.4; color: var(--muted); }
.toast { position: fixed; inset-inline: 16px; bottom: 96px; margin: 0 auto; max-width: 440px; background: var(--ink); color: #fff; border-radius: 18px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; font-size: 0.9375rem; font-weight: 700; animation: rz-up 0.18s ease-out; }
.toast-t { flex: 1; }
.toast-a { background: none; border: 0; color: #57D48B; font-weight: 700; font-size: 0.9375rem; min-height: 40px; padding: 0 8px; }
@keyframes rz-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rz-pop { from { transform: scale(0.95); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet, .dlg, .toast { animation: none; } .progress-bar, .switch .knob { transition: none; } }

/* ---------- item sheet ---------- */
.statcard { display: flex; align-items: center; gap: 14px; background: var(--neutral-bg); border-radius: 20px; padding: 14px 16px; }
.statcard.red { background: var(--red-bg); }
.statcard.orange { background: var(--orange-bg); }
.statcard-main { flex: 1; }
.statcard-big { font-family: var(--font-head); font-weight: 700; font-size: 1.875rem; line-height: 1.1; }
.statcard.red .statcard-big { color: var(--red); }
.statcard.orange .statcard-big { color: var(--orange); }
.statcard-sub { font-size: 0.9375rem; font-weight: 600; }
.statcard-side { font-size: 0.875rem; font-weight: 600; color: var(--muted); text-align: end; }
.stats { display: flex; gap: 10px; }
.stat { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; text-align: center; }
.stat .stat-n { font-size: 1.5rem; }
.stat .stat-l { font-size: 0.8125rem; }
.chks { display: flex; flex-direction: column; gap: 8px; }
.chk { display: flex; align-items: center; gap: 12px; min-height: 50px; background: var(--card); border: 1.5px solid var(--line2); border-radius: 16px; padding: 0 14px; font-size: 1.0625rem; font-weight: 700; }
.chk.on { background: var(--green-bg); border-color: var(--green); }
.chk input { width: 22px; height: 22px; accent-color: var(--green); }

/* ---------- date sheet + camera ---------- */
.scan-zone { display: flex; flex-direction: column; gap: 8px; }
.cam { position: relative; height: 232px; border-radius: 22px; background: #16201B; overflow: hidden; }
.cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-c { position: absolute; width: 34px; height: 34px; border: 0 solid #57D48B; }
.cam-c.tl { top: 40px; inset-inline-start: 38px; border-top-width: 4px; border-inline-start-width: 4px; border-start-start-radius: 8px; }
.cam-c.tr { top: 40px; inset-inline-end: 38px; border-top-width: 4px; border-inline-end-width: 4px; border-start-end-radius: 8px; }
.cam-c.bl { bottom: 40px; inset-inline-start: 38px; border-bottom-width: 4px; border-inline-start-width: 4px; border-end-start-radius: 8px; }
.cam-c.br { bottom: 40px; inset-inline-end: 38px; border-bottom-width: 4px; border-inline-end-width: 4px; border-end-end-radius: 8px; }
.cam-line { position: absolute; inset-inline: 44px; top: 50%; height: 2px; background: #57D48B; animation: rz-scan 2.2s ease-in-out infinite alternate; }
@keyframes rz-scan { from { transform: translateY(-50px); } to { transform: translateY(50px); } }
@media (prefers-reduced-motion: reduce) { .cam-line { animation: none; } }
.cam-pill { position: absolute; top: 10px; inset-inline-start: 12px; display: inline-flex; align-items: center; gap: 6px; background: #0D1511; color: #fff; border-radius: 14px; padding: 5px 11px; font-size: 0.8125rem; font-weight: 700; }
.cam-pill .dot { background: #57D48B; }
.cam-hint { position: absolute; bottom: 10px; inset-inline: 12px; text-align: center; background: #0D1511; color: #fff; border-radius: 12px; padding: 6px 10px; font-size: 0.875rem; font-weight: 600; }
.cam-actions { display: flex; gap: 8px; }
.cam-actions .btn { flex: 1; }
.photo-zone { display: flex; flex-direction: column; gap: 10px; align-items: stretch; background: var(--card); border: 1.5px dashed var(--line2); border-radius: 18px; padding: 14px; }
.photo-note { color: var(--muted); font-size: 0.9375rem; text-align: center; }
.found { display: flex; align-items: center; gap: 10px; background: var(--green-bg); border: 1.5px solid var(--green); border-radius: 18px; padding: 10px 14px; }
.found-main { flex: 1; min-width: 0; }
.found-k { font-size: 0.8125rem; font-weight: 700; color: var(--green-d); }
.found-r { font-size: 0.8125rem; color: var(--muted); margin-top: 2px; }
.found-v { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.found .btn { min-height: 48px; }
.daychips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.daychips .chip { padding: 0 4px; }
.daychip { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.daychip .chip-note { font-size: 0.7rem; }

/* ---------- calendar ---------- */
.cal { gap: 10px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cal-title { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: 0.8125rem; color: var(--muted); font-weight: 700; padding: 4px 0; }
.cal-d { min-height: 44px; border-radius: 12px; border: 1.5px solid transparent; background: var(--card); font-size: 1rem; font-weight: 700; padding: 0; }
.cal-d.today { border-color: var(--blue); }
.cal-d.sel { background: var(--green); color: #fff; border-color: var(--green); }

@media (min-width: 481px) {
  body { background-color: var(--bg); }
  .app { box-shadow: 0 0 0 1px var(--line); }
}

/* pull down to refresh */
.ptr { position: fixed; top: env(safe-area-inset-top, 0px); left: 50%; margin-left: -20px; width: 40px; height: 40px; border-radius: 50%; background: var(--card); color: var(--green); box-shadow: 0 2px 10px rgba(30, 40, 35, 0.22); display: flex; align-items: center; justify-content: center; transform: translateY(-56px); opacity: 0; pointer-events: none; z-index: 40; }
.ptr svg { transition: transform 0.15s; }
.ptr.ready svg { transform: rotate(180deg); }
.ptr.spin svg { display: none; }
.ptr.spin::after { content: ""; width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--green); animation: rz-spin 0.8s linear infinite; }
@keyframes rz-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ptr.spin::after { animation-duration: 2s; } }
