:root{--bg:#101418;--fg:#e8ecf1;--dim:#9aa4b1;--card:#1a2028;--line:#2a323d;--accent:#3b9eff;--danger:#e0514f;--ok:#2ea043;--bar:rgba(10,13,17,.72);color-scheme:dark}
*{box-sizing:border-box}
html,body{margin:0;padding:0;background:var(--bg);color:var(--fg);font:16px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,"Noto Sans Hebrew",Arial,sans-serif;-webkit-text-size-adjust:100%}
body{display:flex;flex-direction:column;min-height:100dvh}
svg{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.hidden{display:none!important}
/* the icon sheet only holds symbols: an svg without a size is drawn 300x150 and pushes every screen down */
.sprite{position:absolute;width:0;height:0;overflow:hidden}
button{font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}

/* header */
.top{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:10px;padding:calc(8px + env(safe-area-inset-top)) 12px 8px;background:var(--bar);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);border-bottom:1px solid var(--line)}
.title{flex:1;display:flex;flex-direction:column;min-width:0}
#brand{font-weight:700}
.who{font-size:12px;color:var(--dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ghost{color:var(--fg);background:transparent}
[dir=rtl] #back svg{transform:scaleX(-1)}
.langs{display:flex;gap:6px}
.flag{width:36px;height:28px;padding:0;border-radius:6px;overflow:hidden;border:2px solid transparent;opacity:.6;background:transparent}
.flag[aria-pressed=true]{border-color:var(--accent);opacity:1}
.flag svg{display:block;width:100%;height:100%;stroke:none;fill:none;stroke-linecap:butt}

/* layout */
main{flex:1;display:flex;flex-direction:column}
.screen{flex:1;display:flex;flex-direction:column;align-items:center;gap:12px;padding:16px 14px calc(16px + env(safe-area-inset-bottom))}
.screen.center{justify-content:center}
.card{width:min(440px,100%);display:flex;flex-direction:column;gap:14px;padding:18px;border-radius:16px;background:var(--card);border:1px solid var(--line)}
.card.wide{width:min(720px,100%)}
.card h1,.screen h1{font-size:22px;margin:0;text-align:center}
.screen h2{display:flex;align-items:center;gap:8px;font-size:20px;margin:0}
.screen h2 svg{width:24px;height:24px;flex:none}
label{display:flex;flex-direction:column;gap:6px;font-size:14px;color:var(--dim)}
input{width:100%;padding:12px 14px;border-radius:12px;border:1px solid var(--line);background:#0d1115;color:var(--fg);font:inherit;font-size:17px;font-family:inherit;outline:none}
input:focus{border-color:var(--accent)}
.big{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:14px 16px;border-radius:14px;border:1px solid var(--line);background:#262e38;color:var(--fg);font-size:17px;font-weight:600;text-decoration:none}
.big.primary{background:var(--accent);color:#06111c;border-color:transparent}
.big.danger{background:var(--danger);color:#fff;border-color:transparent}
.big[disabled]{opacity:.55;cursor:default}
.big svg{width:22px;height:22px;flex:none}
.hint{margin:0;font-size:14px;color:var(--dim);text-align:center}
.hint.small{font-size:13px}
.hint.bad,.msg.bad{color:#ffb4a8}
.msg{margin:0;min-height:1.4em;font-size:14px;text-align:center;color:#ffb4a8}
.msg.ok{color:#7ee2a0}
.row{display:flex;align-items:center;justify-content:space-between;gap:12px}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:10px;width:min(440px,100%)}
.lbl{font-size:14px;color:var(--dim)}
.stepper{display:flex;align-items:center;gap:8px}
.stepper input,.stepper output{width:72px;min-width:56px;padding:6px 4px;text-align:center;font-size:24px;font-weight:700;font-variant-numeric:tabular-nums;-moz-appearance:textfield}
.stepper input::-webkit-outer-spin-button,.stepper input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.iconBtn{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:0;border-radius:10px;color:#333;background:#eef1f5;flex:none}
.iconBtn svg{width:22px;height:22px}
.card .iconBtn,.top .iconBtn{color:var(--fg);background:#262e38}
.top .ghost{background:transparent}
.photoRow{display:flex;flex-direction:column;gap:6px}
.photoWrap{position:relative}
.photoWrap img{display:block;width:100%;max-height:260px;object-fit:cover;border-radius:12px}
.photoWrap .iconBtn{position:absolute;top:8px;inset-inline-end:8px;background:rgba(10,13,17,.7);color:#fff}

/* the issued voucher (white card: the digits for the customer) */
.qrCard{display:flex;flex-direction:column;align-items:center;gap:10px;width:min(360px,100%);padding:20px 18px;border-radius:18px;background:#fff;color:#111}
.qrCard .brandLine{font-size:13px;color:#666;letter-spacing:.08em;text-transform:uppercase}
.codeRow{display:flex;align-items:center;gap:10px;direction:ltr}
.code{font-size:28px;font-weight:700;letter-spacing:.18em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-variant-numeric:tabular-nums}
.qrCard .hint{color:#555}
.qrCard .hint.ok{color:#1a7f37}
.qrCard .hint.bad{color:#b42318}
.qrCard .big{width:100%;margin-top:6px}

/* redeem */
.codeForm{display:flex;gap:8px;direction:ltr}
.codeForm input{flex:1;min-width:0;letter-spacing:.12em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
/* the Check button keeps its own width, the field takes the rest of the row (a full-width button squeezed it to a sliver) */
.codeForm .big{width:auto;flex:none}
.vcard{display:flex;flex-direction:column;gap:8px;padding:14px;border-radius:12px;border:1px solid var(--line);background:#0d1115}
.vcard .code{font-size:24px;text-align:center;direction:ltr}
.vTitle{font-size:18px;font-weight:600}
.vMeta{font-size:14px;color:var(--dim);white-space:pre-line}
.vState{font-weight:700}
.vcard.open .vState{color:var(--accent)}
.vcard.ok .vState{color:var(--ok)}
.vcard.bad .vState{color:var(--danger)}
/* one fixed frame for the picture and for the line standing in for it, so the button never moves when the picture arrives */
.vPhoto,.vPhotoNote{width:100%;height:min(260px,32vh);height:min(260px,32svh);margin:0;border-radius:10px;background:#000}
.vPhoto{display:block;object-fit:contain}
.vhProbe{position:fixed;top:0;left:0;width:0;height:100vh;height:100svh;visibility:hidden;pointer-events:none}
.vPhotoNote{display:flex;align-items:center;justify-content:center;padding:14px;color:var(--dim);text-align:center}
html.leaving body{visibility:hidden}

/* log */
.tableWrap{overflow:auto;max-height:60vh;border:1px solid var(--line);border-radius:12px}
table{width:100%;border-collapse:collapse;font-size:14px}
th,td{padding:8px 10px;text-align:start;border-bottom:1px solid var(--line);white-space:nowrap}
th{position:sticky;top:0;background:#222a34;font-weight:600}
td.num{direction:ltr;unicode-bidi:isolate;font-variant-numeric:tabular-nums;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
tr.used td{color:var(--dim)}
tr.used td.state{color:var(--ok)}

/* the customer's voucher page (/v/<code>, the email link): the voucher and its own Redeem button */
.screen.cust{justify-content:flex-start}
.custCard{gap:10px;text-align:center}
.custCard .brandLine{font-size:13px;color:var(--dim);letter-spacing:.08em;text-transform:uppercase}
.custCard .vTitle{font-size:22px}
.custCard .code{font-size:26px;direction:ltr}
.custCard .vState{padding:10px 12px;border-radius:12px;background:#0d1115;font-size:17px}
.custCard.open .vState{color:var(--accent)}
.custCard.ok .vState{background:var(--ok);color:#fff;font-size:22px}
.custCard.bad .vState{background:rgba(224,81,79,.16);color:#ffb4a8}
.custCard .msg{white-space:pre-line}
.confirm{display:flex;flex-direction:column;gap:10px}
.confirmQ{margin:0;font-size:15px}
.custCard .row2{width:100%}
.langLink{color:var(--dim)}

/* the admin screen (/admin): the journal, one voucher with its state switch and its history */
.whoBtn{padding:0;border:0;background:transparent;text-align:start;text-decoration:underline dotted;text-underline-offset:3px}
.aBar{display:flex;align-items:center;justify-content:space-between;gap:10px;width:min(720px,100%)}
.aSearch{display:flex;gap:8px;width:min(720px,100%)}
.aSearch input{flex:1;min-width:0}
.aSearch .big{width:auto;flex:none}
.aList{display:flex;flex-direction:column;gap:8px;width:min(720px,100%)}
.aRow{display:flex;flex-direction:column;gap:4px;width:100%;padding:12px 14px;border-radius:12px;border:1px solid var(--line);background:var(--card);text-align:start}
.aRow .l1{display:flex;align-items:center;justify-content:space-between;gap:10px;font-weight:600}
.aRow .nm{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.aRow .l2{font-size:13px;color:var(--dim)}
.badge{flex:none;padding:2px 10px;border-radius:999px;font-size:13px;font-weight:700;background:rgba(59,158,255,.15);color:var(--accent)}
.badge.used{background:rgba(46,160,67,.2);color:#7ee2a0}
.aCard{gap:10px}
.aHead{display:flex;align-items:center;justify-content:space-between;gap:10px}
.aCard .code{font-size:24px;text-align:center;direction:ltr}
.aCard h3{margin:8px 0 0;font-size:16px}
.hist{display:flex;flex-direction:column;gap:8px;margin:0;padding:0;list-style:none}
.hist li{padding:8px 10px;border-radius:10px;border:1px solid var(--line);background:#0d1115;font-size:14px;line-height:1.5}
.hist .when{color:var(--dim)}

.ver{margin:0;font-size:12px;color:var(--dim);text-align:center}
.msg.info{color:var(--dim)}

/* v0.6: what a voucher grants (chips with the option picture), the live clock, the issue check boxes, the admin options */
.items{display:flex;flex-wrap:wrap;justify-content:center;gap:6px}
.item{display:inline-flex;align-items:center;gap:6px;padding:4px 12px;border-radius:999px;background:#0d1115;border:1px solid var(--line);font-size:15px;font-weight:600;line-height:1.2}
.item img{width:28px;height:28px;border-radius:50%;object-fit:cover;flex:none;background:#262e38;margin-inline-start:-8px}
.qrCard .item{background:#eef1f5;border-color:#dde2e8;color:#111}
.vcard .items,.aCard .items{justify-content:flex-start}
.clock{display:flex;flex-direction:column;align-items:center;line-height:1}
.clockTime{font-size:44px;font-weight:700;font-variant-numeric:tabular-nums;letter-spacing:.02em;direction:ltr;unicode-bidi:isolate}
.optList{margin:0;padding:10px 12px;border:1px solid var(--line);border-radius:12px;display:flex;flex-direction:column;gap:4px;min-width:0}
.optList legend{padding:0 6px;font-size:14px;color:var(--dim)}
#optItems{display:flex;flex-direction:column;gap:2px}
.opt{flex-direction:row;align-items:center;gap:10px;padding:6px 2px;font-size:16px;color:var(--fg);cursor:pointer}
.opt input{width:22px;height:22px;padding:0;flex:none;accent-color:var(--accent);margin:0}
.opt img{width:40px;height:40px;border-radius:8px;object-fit:cover;flex:none;background:#262e38}
.aBtns{display:flex;gap:8px;align-items:center}
.aBtns .big{width:auto;flex:none;padding:10px 14px;font-size:15px}
.optRow{display:flex;align-items:center;gap:12px;width:100%;padding:10px 12px;border-radius:12px;border:1px solid var(--line);background:var(--card)}
.optRow .pic{width:48px;height:48px;padding:0;border:0;border-radius:10px;overflow:hidden;flex:none;background:#0d1115;display:flex;align-items:center;justify-content:center;color:var(--dim)}
.optRow .pic img{width:100%;height:100%;object-fit:cover;display:block}
.optRow .pic svg{width:22px;height:22px}
.optRow .nm{flex:1;min-width:0;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.optRow .tag{font-size:12px;color:var(--dim);font-weight:400}
.optRow.off{opacity:.55}
.optRow .big{width:auto;flex:none;height:38px;padding:0 12px;font-size:14px;line-height:1} /* line-height 1: the 1.4 leading rounded the words up by 0.8px */
.optPicRow{display:flex;align-items:center;gap:10px}
.optPicRow .big{flex:1}
/* v0.11, measured off the pixels: line-height 1 at a fixed height centres the words (1.4 rounded them up), and the plus
   drawing leaves 4.1 of its 24 units empty at its side, so the Add button gives that much back to keep what shows centred */
#optForm .big{height:54px;padding-block:0;line-height:1}
#optAddBtn svg{margin-inline-start:-3.76px}
/* v0.12, measured off the pixels: an icon beside a word gives back the empty edge of its own drawing (as #optAddBtn above),
   so the ink is what gets centred, not the drawing's box: the check leaves 4.1 of its 24 units, the cross 5.1, the options box 3.1 */
.big svg:has(> use[href="#i-check"]){margin-inline-start:-3.76px}
.big svg:has(> use[href="#i-x"]){margin-inline-start:-4.68px}
#optionsBtn svg{margin-inline-start:-2.84px}
.optPicRow img{width:64px;height:64px;border-radius:10px;object-fit:cover;flex:none}
/* the pencil: the row opens in place, its name in a field (16px or more, or iOS zooms in) and Change picture / Save / Cancel under it */
.optRow .edit,.optRow .drop,.optRow .bin{width:40px;height:40px;color:var(--fg);background:#262e38}
.optRow .edit svg,.optRow .drop svg,.optRow .bin svg{width:20px;height:20px}
.optRow .iconBtn[disabled]{opacity:.55;cursor:default}
.optRow.failed{border-color:var(--danger)}
.optRow .why{display:block;white-space:normal;font-size:12px;font-weight:400;color:#ffb4a8}
.optRow.editing{flex-wrap:wrap;border-color:var(--accent)}
.optRow .nmEdit{flex:1;min-width:0;width:auto;padding:8px 10px}
.optRow .editBtns{display:flex;flex-wrap:wrap;align-items:center;gap:8px;width:100%}
/* v0.7: the edit's own picture button (camera + Change picture) at the start, Save / Cancel together at the end; when the
   line is too narrow for all three the pair moves under it, never split */
.optRow .editBtns .picBtn{gap:6px}
.optRow .editBtns .picBtn svg{width:18px;height:18px}
.optRow .saveBtns{display:flex;gap:8px;margin-inline-start:auto}
/* v0.8: a picture pasted from the clipboard; the hint under the add form's picture button names the keys, on a computer
   only (a phone has no Ctrl+V) */
.pasteHint{display:none;margin-top:-6px}
@media (hover:hover) and (pointer:fine){.pasteHint{display:block}}
kbd{display:inline-block;padding:0 6px;border:1px solid var(--line);border-bottom-width:2px;border-radius:6px;background:#0d1115;color:var(--fg);font:inherit;font-size:12px;line-height:1.5;unicode-bidi:isolate}
/* the customer's card sits in the middle of the screen; without a photo the space is freed and the rest moves up with it.
   Auto margins center it while it fits and leave it at the top when it is taller than the screen (no clipped top). */
.screen.cust .custCard{margin-top:auto;margin-bottom:auto}
/* a short phone where the picture would get very small: the card takes its spacing in first (voucher.js fit() sets .tight) */
.screen.cust .custCard.tight{gap:6px;padding:12px 14px}
.custCard.tight .vState{padding:6px 10px}
.custCard.tight .clockTime{font-size:38px}
.custCard.tight .confirm{gap:6px}
.custCard.tight .big{padding:11px 16px}
