/* =====================================================================
   מלאי פילמנטים · v3
   One interface, two palettes. Components read only the tokens below, so another
   palette is one more [data-theme] block. Product photos and filament swatches never
   read them.
   ===================================================================== */
:root{
  --font:'IBM Plex Sans Hebrew', system-ui, sans-serif;
  --mono:'IBM Plex Mono', ui-monospace, monospace;
  --tile:156px; --r:12px;
}
:root, [data-theme="dark"]{
  color-scheme:dark;
  --bg:#111213; --surface:#1A1B1D; --surface-2:#232427; --well:#1F2023; --field:#151617;
  --line:#2C2D31; --line-strong:#3E4045; --shelf:#34363B;
  --text:#ECEAE6; --muted:#A6A39C; --faint:#7A776F;
  --accent:#E8A23A; --accent-text:#F0B75E; --on-accent:#1A1206; --accent-soft:rgba(232,162,58,.12);
  --fault:#C98A74; --fault-bg:rgba(201,138,116,.10); --fault-line:rgba(201,138,116,.32);
  --danger:#E07A66; --danger-bg:rgba(224,122,102,.12);
  --ok:#8FAE96; --ok-bg:rgba(143,174,150,.12);
  --unknown:#D9A857; --unknown-line:rgba(217,168,87,.45);
  --plan:#8FA9D6; --plan-bg:rgba(143,169,214,.12);
  --chip:#0B0C0D; --chip-text:#ECEAE6; --amt-bg:#2A2B2F;
  --scrim:rgba(0,0,0,.6); --shadow:0 18px 40px -16px rgba(0,0,0,.7);
  --bed:#2A2B2F; --layer-2:#C98A2E; --focus:#F0B75E;
}
[data-theme="light"]{
  color-scheme:light;
  --bg:#F2F0EA; --surface:#FBFAF6; --surface-2:#EDE9E1; --well:#ECE8DF; --field:#FFFFFF;
  --line:#DFDACF; --line-strong:#C8C2B5; --shelf:#CFC9BC;
  --text:#1D1C1A; --muted:#5F5B53; --faint:#8A857B;
  --accent:#B5461A; --accent-text:#A03C14; --on-accent:#FFFFFF; --accent-soft:rgba(181,70,26,.09);
  --fault:#94432D; --fault-bg:#F3E6DF; --fault-line:rgba(148,67,45,.3);
  --danger:#A4331F; --danger-bg:#F6E2DB;
  --ok:#4C7656; --ok-bg:#E4EDE4;
  --unknown:#8A5A12; --unknown-line:rgba(138,90,18,.4);
  --plan:#3E5F96; --plan-bg:#E3E9F3;
  --chip:#1D1C1A; --chip-text:#FBFAF6; --amt-bg:#FBFAF6;
  --scrim:rgba(29,28,26,.4); --shadow:0 18px 40px -18px rgba(60,50,30,.35);
  --bed:#D9D4C8; --layer-2:#933714; --focus:#B5461A;
}

*{box-sizing:border-box}
html{scrollbar-gutter:stable}
body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font);font-size:15px;line-height:1.45;-webkit-font-smoothing:antialiased}
body.modal-open{overflow:hidden}
button,input,select,textarea{font:inherit;color:inherit}
a{color:inherit}
:focus-visible{outline:2px solid var(--focus);outline-offset:2px;border-radius:6px}
[hidden]{display:none !important}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.ico{flex:0 0 auto;display:block}
.mono{font-family:var(--mono)} .muted{color:var(--muted)} .small{font-size:13px}
h1,h2,h3,h4{font-family:var(--font)}

/* ---------- form controls ---------- */
input:where(:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range])), select, textarea{
  background:var(--field);color:var(--text);border:1px solid var(--line-strong);border-radius:9px;padding:9px 12px;font-size:15px;width:100%;
}
input::placeholder, textarea::placeholder{color:var(--faint)}
input:focus, select:focus, textarea:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
textarea{resize:vertical;line-height:1.5}
input[type=checkbox]{width:18px;height:18px;accent-color:var(--accent)}

/* ---------- buttons ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;height:40px;padding:0 15px;border-radius:9px;border:1px solid var(--line-strong);
  background:var(--surface-2);color:var(--text);font-size:14px;font-weight:500;cursor:pointer;text-decoration:none;white-space:nowrap}
.btn:hover{border-color:var(--muted)}
.btn:disabled{opacity:.45;cursor:default}
.btn.sm{height:34px;padding:0 11px;font-size:13.5px;border-radius:8px}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--on-accent);font-weight:600}
.btn.primary:hover{filter:brightness(1.06)}
.btn.primary.danger, .btn.danger.primary{background:var(--danger);border-color:var(--danger);color:#fff}
.btn.accent, .btn.teal{border-color:var(--accent);color:var(--accent-text);background:var(--accent-soft);font-weight:600}
.btn.blue{border-color:var(--plan);color:var(--plan);background:var(--plan-bg)}
.btn.warn{border-color:var(--fault-line);color:var(--fault);background:var(--fault-bg);font-weight:600}
.btn.danger{border-color:var(--danger);color:var(--danger);background:none}
.btn.ghost{background:none;border-color:transparent;color:var(--muted)}
.btn.ghost:hover{color:var(--text);border-color:var(--line-strong)}
.btn.wide{width:100%}
.icon-btn{display:flex;align-items:center;justify-content:center;width:40px;height:40px;flex:0 0 auto;border-radius:10px;border:1px solid var(--line-strong);background:var(--surface);color:var(--text);cursor:pointer}
.icon-btn:hover{border-color:var(--muted)}
.linkish{background:none;border:none;padding:0 4px;color:var(--accent-text);font-weight:600;cursor:pointer;text-decoration:underline;text-underline-offset:3px}

/* ---------- print loader (drawn by script, see util.js) ---------- */
.printer-loader{display:flex;flex-direction:column;align-items:center}
.printer-loader svg{display:block;overflow:visible}
.pl-bed{fill:var(--bed)} .pl-bead{fill:var(--accent)} .pl-bead.alt{fill:var(--layer-2)} .pl-nozzle{fill:var(--text)} .pl-tip{fill:var(--accent)}
.pl-text{margin-top:14px;font-size:14.5px;color:var(--muted)}

/* ---------- full-screen states: boot, load failure ---------- */
.screen-state{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:32px 20px;text-align:center;color:var(--muted)}
.screen-state h2{margin:6px 0 0;font-size:20px;color:var(--text)}
.screen-state p{margin:0;max-width:360px}
.screen-state .actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:center;margin-top:12px}
.screen-state details{font-size:12.5px;color:var(--faint);margin-top:10px}
.screen-state code{font-family:var(--mono);direction:ltr;display:inline-block;margin-top:6px}
.screen-state .fail-ico{color:var(--fault)}

/* ---------- login ---------- */
.login-screen{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:32px 16px}
.login{width:100%;max-width:400px;display:flex;flex-direction:column;gap:26px}
.login .brand{display:flex;flex-direction:column;gap:14px}
.login .mark{width:44px;height:44px}
.login h1{margin:0;font-size:30px;font-weight:600;letter-spacing:-.01em;line-height:1.1}
.login .brand p{margin:0;color:var(--muted)}
.login-card{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:26px 24px;display:flex;flex-direction:column;gap:18px}
.field{display:flex;flex-direction:column;gap:7px;font-size:14px;color:var(--muted)}
.login-card input{height:48px;font-size:16px;direction:ltr;text-align:left;background:var(--bg)}
.pw{position:relative;display:block}
.pw input{padding-left:66px}
.pw button{position:absolute;left:8px;top:50%;transform:translateY(-50%);height:34px;padding:0 10px;border:none;background:none;color:var(--muted);font-size:13px;cursor:pointer;border-radius:8px}
.login-submit{height:50px;border:none;border-radius:11px;background:var(--accent);color:var(--on-accent);font-size:16px;font-weight:600;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:12px}
.login-submit[disabled]{cursor:progress;opacity:.92}
.login-submit .busy{display:none;align-items:center;gap:12px}
.login-screen.busy .login-submit .idle{display:none}
.login-screen.busy .login-submit .busy{display:flex}
.login-screen.busy input{opacity:.6}
.bar{width:64px;height:4px;border-radius:2px;background:color-mix(in srgb, var(--on-accent) 25%, transparent);overflow:hidden;position:relative}
.bar::after{content:"";position:absolute;inset:0;background:var(--on-accent);transform-origin:right;animation:bar 1.1s ease-in-out infinite}
@keyframes bar{0%{transform:scaleX(0)}60%{transform:scaleX(1);opacity:1}100%{transform:scaleX(1);opacity:0}}
.form-error{display:flex;gap:10px;align-items:flex-start;padding:11px 13px;border-radius:10px;background:var(--danger-bg);color:var(--danger);font-size:14px}
.form-error:empty{display:none}
.login-foot{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;font-size:13.5px;color:var(--faint)}

/* theme switch */
.theme{display:inline-flex;align-items:center;border:1px solid var(--line-strong);border-radius:999px;padding:3px;gap:2px;flex:0 0 auto}
.theme button{display:flex;align-items:center;gap:6px;border:none;background:none;height:34px;padding:0 12px;border-radius:999px;cursor:pointer;color:var(--muted);font-size:13.5px}
.theme button[aria-pressed="true"]{background:var(--surface-2);color:var(--text);font-weight:600}

/* ---------- app shell ---------- */
.app{container-type:inline-size}
.wrap{max-width:1440px;margin:0 auto;padding:28px 56px 90px;display:flex;flex-direction:column;gap:32px}
.top{display:flex;align-items:center;gap:20px}
.inv{display:flex;flex-direction:column;gap:2px;min-width:0}
.inv-select{font-size:22px;font-weight:600;background:transparent;border:none;color:var(--text);padding:0 0 0 22px;width:auto;max-width:100%;cursor:pointer;appearance:none;-webkit-appearance:none;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23A6A39C' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat left center}
.inv-select:focus{box-shadow:none}
.inv-select option{background:var(--surface);color:var(--text);font-size:15px}
.inv-sub{font-size:13.5px;color:var(--muted)}
.sync{background:none;border:none;padding:0;color:var(--faint);font-size:13px;cursor:pointer}
.sync:hover{color:var(--text)}
.nav{display:flex;gap:22px;margin-inline-start:auto;align-items:center}
.nav .nl{background:none;border:none;padding:0;text-decoration:none;color:var(--muted);font-size:15px;white-space:nowrap;cursor:pointer}
.nav .nl:hover{color:var(--text)}
.avatar{width:40px;height:40px;flex:0 0 auto;border-radius:50%;border:1px solid var(--line-strong);background:var(--surface);font-weight:600;cursor:pointer}
.btn-add{height:44px;padding:0 20px;border-radius:9px;border:none;background:var(--accent);color:var(--on-accent);font-weight:600;display:flex;align-items:center;gap:8px;cursor:pointer;white-space:nowrap;flex:0 0 auto}
.menu-btn,.theme-mini{display:none}

/* ---------- photo well ----------
   The product photo has its baked-in white removed (only white connected to the photo's
   border) and sits on a quiet well. No filter, blend mode or tint on the photo. */
.well{position:relative;border-radius:12px;background:var(--well);overflow:hidden;display:flex;align-items:center;justify-content:center}
.well img{display:block;width:100%;height:100%;object-fit:contain;padding:7%;opacity:0;transition:opacity .2s}
.well img.ready{opacity:1}
.well.nophoto{background:var(--sw)}
.well.empty{background:none;border:1.5px dashed var(--line-strong);color:var(--faint);font-size:12.5px}

/* ---------- printer ---------- */
.printer{display:flex;flex-direction:column;gap:14px}
.sec-head{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap}
.sec-head h2{margin:0;font-size:17px;font-weight:600}
.sec-head .meta{font-size:13.5px;color:var(--muted)}
.sec-head .end{margin-inline-start:auto}
.heads{display:grid;grid-template-columns:repeat(var(--cols,5),minmax(0,1fr));gap:12px}
.heads.few{max-width:calc(var(--cols,1) * 250px)}
.head{display:flex;flex-direction:column;gap:12px;padding:14px;border-radius:14px;background:var(--surface);border:1px solid var(--line);min-width:0;text-align:start;cursor:pointer;color:var(--text)}
.head:hover{border-color:var(--line-strong)}
.head-top{display:flex;align-items:center;justify-content:space-between;gap:8px}
.head .num{font-family:var(--mono);font-size:13px;color:var(--muted);font-weight:500}
.head .num .short{display:none}
.head .num .n{display:none}
.head .well{width:100%;aspect-ratio:4/3}
.head .who{display:flex;flex-direction:column;gap:1px;min-width:0}
.head b{font-size:15.5px;font-weight:600;line-height:1.3;overflow-wrap:anywhere}
.head small{font-size:13px;color:var(--muted)}
.head .empty-name{font-size:15px;color:var(--muted)}
.head .why{font-size:13px;line-height:1.4;color:var(--muted);padding-top:10px;border-top:1px solid var(--line)}
.head .plan-note{font-size:13px;color:var(--plan);display:flex;gap:6px;align-items:center}
.row-tag,.chev{display:none}
.tag{display:inline-flex;align-items:center;gap:5px;height:24px;padding:0 8px;border-radius:6px;font-size:12.5px;font-weight:500;white-space:nowrap}
.tag.ok{color:var(--ok)}
.tag.fault{color:var(--fault);background:var(--fault-bg);box-shadow:inset 0 0 0 1px var(--fault-line);font-weight:600}
.tag.plan{color:var(--plan);background:var(--plan-bg)}
.todo{display:flex;gap:10px 18px;align-items:center;flex-wrap:wrap;font-size:14.5px;color:var(--muted);padding:12px 16px;border-radius:12px;background:var(--surface);border:1px solid var(--line)}
.todo:empty{display:none}
.todo strong{color:var(--text);font-weight:600}
.todo .sep{width:1px;height:18px;background:var(--line-strong)}
.todo .fault-text{color:var(--fault);font-weight:600}
.btn-line{height:36px;padding:0 14px;border-radius:8px;border:1px solid var(--accent);background:none;color:var(--accent-text);font-weight:600;cursor:pointer}
.psum{display:none}

/* ---------- inventory controls ---------- */
.controls{display:flex;align-items:flex-end;gap:12px 24px;flex-wrap:wrap;border-bottom:1px solid var(--line)}
.mtabs{display:flex;gap:22px;overflow-x:auto;scrollbar-width:none;min-width:0;flex:1 1 420px}
.mtabs::-webkit-scrollbar{display:none}
.mtab{flex:0 0 auto;background:none;border:none;padding:0 0 12px;margin-bottom:-1px;border-bottom:2px solid transparent;color:var(--muted);cursor:pointer;font-size:15px;display:flex;gap:6px;align-items:baseline;white-space:nowrap}
.mtab i{font-style:normal;font-family:var(--mono);font-size:12px;color:var(--faint)}
.mtab[aria-pressed="true"]{color:var(--text);font-weight:600;border-bottom-color:var(--text)}
.search{display:flex;gap:10px;padding-bottom:10px;flex:0 1 auto;min-width:0}
.search input,.search select{height:42px;width:auto;min-width:0}
.search input{width:250px}
.filter-btn{display:none;height:46px;padding:0 14px;border-radius:9px;border:1px solid var(--line-strong);background:var(--surface);align-items:center;gap:6px;font-weight:600;cursor:pointer;white-space:nowrap;flex:0 0 auto}
.fcount:empty{display:none}
.fcount{min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:var(--accent);color:var(--on-accent);font-size:12px;font-weight:700;display:inline-flex;align-items:center;justify-content:center}
.colors{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:14px}
.colors .lbl{font-size:13.5px;color:var(--muted);margin-inline-end:4px}
.cchip{display:inline-flex;align-items:center;gap:7px;height:34px;padding:0 12px 0 10px;border-radius:999px;border:1px solid var(--line-strong);background:none;color:var(--text);font-size:14px;cursor:pointer}
.cchip .dot{width:14px;height:14px;border-radius:50%;background:var(--fc);box-shadow:0 0 0 1px rgba(128,128,128,.55)}
.cchip i{font-style:normal;font-family:var(--mono);font-size:12px;color:var(--faint)}
.cchip[aria-pressed="true"]{border-color:var(--text);background:var(--surface-2);font-weight:600}
.cchip[disabled]{opacity:.35;cursor:default}
.active-filters{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:12px}
.active-filters:empty{display:none}
.achip{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 6px 0 12px;border-radius:8px;background:var(--surface-2);border:1px solid var(--line-strong);font-size:14px;cursor:pointer;color:var(--text);flex:0 0 auto}
.achip .x{width:22px;height:22px;border-radius:6px;display:flex;align-items:center;justify-content:center;color:var(--muted)}
.achip:hover .x{background:var(--line)}
.achip .dot{width:11px;height:11px;border-radius:50%;background:var(--fc);box-shadow:0 0 0 1px rgba(128,128,128,.55)}
.none{margin-top:30px;padding:28px;border:1px dashed var(--line-strong);border-radius:12px;text-align:center;color:var(--muted)}

/* ---------- shelves ---------- */
.shelves{display:flex;flex-wrap:wrap;gap:36px 56px;margin-top:26px}
.shelf{flex:0 1 auto;max-width:100%;display:flex;flex-direction:column;gap:14px}
.shelf-head{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.shelf-head h3{margin:0;font-size:19px;font-weight:600;white-space:nowrap}
.shelf-head .spec{font-family:var(--mono);font-size:12.5px;color:var(--muted);padding:1px 7px;border:1px solid var(--line-strong);border-radius:6px}
.shelf-head .meta{font-size:13.5px;color:var(--faint)}
.row{display:flex;flex-wrap:wrap;gap:18px 14px;padding-bottom:16px;border-bottom:3px solid var(--shelf)}
.tile{width:var(--tile);display:flex;flex-direction:column;gap:8px;text-align:start;background:none;border:none;padding:0;cursor:pointer;color:var(--text)}
.tile .well{width:100%;aspect-ratio:1/1}
.tile:hover .well{box-shadow:0 0 0 1.5px var(--line-strong)}
.tile.is-out{opacity:.55}
.tile .txt{display:contents}
.badge{direction:ltr;position:absolute;z-index:1;height:22px;padding:0 7px;border-radius:6px;display:flex;align-items:center;font-family:var(--mono);font-size:12px;font-weight:500}
.badge.count{top:9px;inset-inline-start:9px;background:var(--chip);color:var(--chip-text)}
.badge.slot{top:9px;inset-inline-end:9px;background:var(--accent);color:var(--on-accent)}
.badge.flag{bottom:9px;inset-inline-end:9px;background:var(--fault-bg);color:var(--fault);box-shadow:inset 0 0 0 1px var(--fault-line);font-family:var(--font)}
/* the amount: always in the same corner, big enough to read at a glance */
.amt{position:absolute;z-index:1;bottom:9px;inset-inline-start:9px;display:flex;align-items:baseline;gap:2px;height:28px;padding:0 9px;border-radius:8px;background:var(--amt-bg);box-shadow:0 0 0 1px var(--line-strong);font-family:var(--mono);font-weight:600;font-size:15.5px;line-height:28px;color:var(--text);white-space:nowrap}
.amt small{font-size:11.5px;font-weight:500;color:var(--muted)}
.amt.unknown{font-family:var(--font);font-size:13px;color:var(--unknown);box-shadow:0 0 0 1px var(--unknown-line)}
.amt.low{color:var(--fault);box-shadow:0 0 0 1px var(--fault-line)}
.amt.out{font-family:var(--font);font-size:13px;color:var(--muted)}
.tile .name{display:flex;align-items:flex-start;gap:7px;font-size:15px;font-weight:500;line-height:1.3;padding:0 2px}
.sw{width:11px;height:11px;margin-top:5px;flex:0 0 auto;border-radius:50%;background:var(--sw);box-shadow:0 0 0 1px rgba(128,128,128,.5)}
.tile .sub{font-size:13px;color:var(--muted);padding:0 2px;margin-top:-5px}

/* ---------- combos & wishlist ---------- */
.section{display:flex;flex-direction:column;gap:16px}
.toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.toolbar .search-input{max-width:280px;height:42px}
.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:14px}
.combo-card,.wish-card{position:relative;background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:16px;display:flex;flex-direction:column;gap:10px}
.combo-top{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
.combo-name{margin:0;font-size:16px;font-weight:600}
.combo-chips{display:flex;flex-wrap:wrap;gap:6px}
.combo-chip{display:inline-flex;align-items:center;gap:7px;font-size:13.5px;padding:5px 11px;border-radius:999px;border:1px solid var(--line-strong);background:var(--surface-2);color:var(--text);cursor:pointer}
.combo-chip i{width:10px;height:10px;border-radius:50%;background:var(--dot);box-shadow:0 0 0 1px rgba(128,128,128,.5)}
.combo-chip.missing{cursor:default;color:var(--muted);border-style:dashed}
.note{font-size:14px;color:var(--muted);background:var(--surface-2);padding:9px 12px;border-radius:9px;line-height:1.5}
.mini-actions{display:flex;gap:6px;align-items:center}
.mini-actions .icon-btn{width:34px;height:34px;border-radius:8px}
.wish-photo{margin:-16px -16px 0;height:120px;border-radius:14px 14px 0 0}
.wish-material{font-family:var(--mono);font-size:12px;color:var(--muted)}
.wish-title{font-weight:600;font-size:15.5px}
.wish-bottom{display:flex;justify-content:space-between;align-items:center;margin-top:auto;gap:8px}
.wish-price{font-family:var(--mono);font-size:14px;font-weight:600}
.add-card{border:1.5px dashed var(--line-strong);border-radius:14px;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:14.5px;padding:18px;min-height:120px;background:none;cursor:pointer}
.add-card:hover{border-color:var(--accent);color:var(--accent-text)}
.empty-state{color:var(--muted);font-size:14px;padding:20px;border:1px dashed var(--line-strong);border-radius:12px;text-align:center;grid-column:1/-1}
.jump-highlight .well{box-shadow:0 0 0 3px var(--accent)}
.jump-highlight.head{box-shadow:0 0 0 3px var(--accent)}

/* ---------- modals: centred on desktop, bottom sheets on the phone ---------- */
.modal-overlay{position:fixed;inset:0;background:var(--scrim);display:flex;align-items:center;justify-content:center;padding:20px;z-index:1000}
.modal{width:100%;max-width:500px;max-height:90vh;overflow-y:auto;overscroll-behavior:contain;background:var(--surface);border:1px solid var(--line-strong);border-radius:18px;box-shadow:var(--shadow);padding:22px}
.modal.wide{max-width:740px}
.modal h3{margin:0 0 6px;font-size:19px;font-weight:600}
.modal .sub{color:var(--muted);font-size:14px;margin:0 0 14px;line-height:1.55}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.form-grid .full{grid-column:1/-1}
.form-grid label{display:flex;flex-direction:column;gap:6px;font-size:13.5px;color:var(--muted)}
.form-actions{display:flex;gap:10px;align-items:center;margin-top:18px;flex-wrap:wrap}
.form-actions .spacer{flex:1}
.checkbox{flex-direction:row !important;align-items:center;gap:9px !important;color:var(--text) !important;font-size:14px !important}
.checkbox input{width:auto}
.dialog-card{max-width:440px;display:flex;flex-direction:column;gap:18px}
.dialog-text{font-size:15px;line-height:1.65;white-space:pre-line}
.dialog-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.tabs{display:flex;gap:6px;margin:6px 0 16px;flex-wrap:wrap}
.tab{height:36px;padding:0 14px;border-radius:9px;border:1px solid var(--line-strong);background:none;color:var(--muted);cursor:pointer;font-size:14px}
.tab.active{border-color:var(--text);color:var(--text);background:var(--surface-2);font-weight:600}
.list-box{max-height:300px;overflow-y:auto;overscroll-behavior:contain;border:1px solid var(--line);border-radius:10px;padding:6px;background:var(--bg);display:flex;flex-direction:column;gap:2px}
.list-row{display:flex;align-items:center;gap:10px;min-height:42px;padding:6px 10px;border-radius:8px;font-size:14.5px;cursor:pointer;text-align:start;background:transparent;border:none;color:var(--text);width:100%}
.list-row:hover{background:var(--surface-2)}
.list-row input[type=checkbox]{width:18px;flex:0 0 auto}
.form-grid label.list-row{flex-direction:row;gap:10px;font-size:14.5px;color:var(--text)}
.list-row .dot{width:12px;height:12px;border-radius:50%;flex:0 0 auto;box-shadow:0 0 0 1px rgba(128,128,128,.5)}
.dot{width:12px;height:12px;border-radius:50%;flex-shrink:0;box-shadow:0 0 0 1px rgba(128,128,128,.5)}
.pill{font-family:var(--mono);font-size:11.5px;padding:2px 7px;border-radius:6px;border:1px solid var(--line-strong);color:var(--muted)}
.pill.blue{color:var(--plan);border-color:var(--plan);background:var(--plan-bg)}
.pill.warn{color:var(--fault);border-color:var(--fault-line);background:var(--fault-bg)}
.member-row{display:grid;grid-template-columns:1fr auto auto;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line);font-size:14.5px}
.member-row select{width:auto;padding:6px 10px;font-size:14px}
.member-row .who small{display:block;color:var(--muted);font-family:var(--mono);font-size:12px;direction:ltr;text-align:right}
.weigh-preview{margin:14px 0 4px;padding:14px;border-radius:10px;background:var(--surface-2);border:1px solid var(--line)}
.weigh-preview .big{font-family:var(--mono);font-size:24px;font-weight:600}
.warn-box{font-size:14px;line-height:1.55;color:var(--unknown);background:var(--accent-soft);border:1px solid var(--unknown-line);border-radius:9px;padding:10px 12px;margin-top:10px}
.fault-text{font-size:14.5px;line-height:1.5;color:var(--fault);white-space:pre-wrap;background:var(--fault-bg);border-radius:9px;padding:10px 12px}
.resolved-note{font-size:13.5px;color:var(--ok)}
.weigh-list{display:flex;flex-direction:column;gap:8px;max-height:62vh;overflow-y:auto;overscroll-behavior:contain}
.weigh-row{display:grid;grid-template-columns:14px 1fr 104px 76px;gap:10px;align-items:center;padding:9px 11px;border-radius:10px;background:var(--surface-2);border:1px solid var(--line)}
.weigh-row.saved{border-color:var(--ok)}
.weigh-row .nm{font-size:14.5px} .weigh-row .nm small{display:block;color:var(--muted);font-family:var(--mono);font-size:12px}
.weigh-row input{padding:8px;text-align:center;direction:ltr;font-family:var(--mono)}
.weigh-row .res{font-family:var(--mono);font-size:13px;text-align:center}
.weigh-row .dot{width:12px;height:12px}

/* material details / manage */
.ms-head{display:flex;gap:16px;align-items:center;margin-bottom:16px}
.ms-head h3{margin:2px 0}
.ms-head .well{width:96px;height:96px;flex:0 0 auto}
.ms-close{margin-inline-start:auto;align-self:flex-start}
.ms-mat{font-family:var(--mono);font-size:12.5px;color:var(--muted)}
.kv{display:grid;grid-template-columns:auto 1fr;gap:9px 18px;font-size:15px;margin:0 0 18px;padding:14px;border-radius:12px;background:var(--surface-2)}
.kv > span:nth-child(odd){color:var(--muted)}
.kv .warnv{color:var(--unknown)}
.ms-title{margin:0 0 10px;font-size:15px;font-weight:600}
.ms-list{display:flex;flex-direction:column;gap:8px}
.ms-row{display:flex;gap:12px;align-items:center;padding:11px 13px;border:1px solid var(--line);border-radius:11px;background:var(--surface-2);flex-wrap:wrap}
.ms-info{flex:1 1 200px;display:flex;flex-direction:column;gap:3px;min-width:0}
.ms-info b{font-size:14.5px}
.ms-info span{font-size:13.5px;color:var(--muted)}
.ms-acts{display:flex;gap:6px}
.ms-acts .btn{min-width:96px}
.ms-acts .btn{width:100%}
.ms-bar{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}
.danger-zone{margin-top:20px;border-top:1px solid var(--line);padding-top:14px}
.danger-zone .dz-panel{margin-top:10px;padding:12px;border:1px solid var(--danger);border-radius:10px;background:var(--danger-bg)}
.danger-zone .dz-panel p{margin:0 0 10px}
.danger-zone .dz-list{display:flex;gap:6px;flex-wrap:wrap}

/* guided material form */
.wz-steps{display:flex;gap:6px;margin-bottom:16px}
.wz-dot{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;background:none;border:none;color:var(--muted);font-size:12.5px;cursor:pointer;padding:0;font-family:inherit}
.wz-dot:disabled{cursor:default}
.wz-dot i{font-style:normal;width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;border:1.5px solid var(--line-strong);font-family:var(--mono);font-size:13px}
.wz-dot.on{color:var(--text)} .wz-dot.on i{border-color:var(--accent);background:var(--accent-soft);color:var(--accent-text)}
.wz-dot.done i{border-color:var(--ok);background:var(--ok-bg);color:var(--ok)}
.wz-title{font-size:20px !important;margin:0 0 14px !important}
.wz-body{display:flex;flex-direction:column;gap:14px}
.wz-field{display:flex;flex-direction:column;gap:7px;font-size:14px;color:var(--muted)}
.wz-field input,.wz-field textarea,.wz-field select{font-size:15.5px;padding:11px 13px}
.wz-field .opt{font-size:12.5px;opacity:.8}
.wz-two{display:grid;grid-template-columns:1fr 1fr;gap:12px;align-items:end}
.wz-chips{display:flex;flex-wrap:wrap;gap:6px}
.chip{height:32px;padding:0 12px;border-radius:999px;border:1px solid var(--line-strong);background:none;font-size:13.5px;cursor:pointer;color:var(--muted)}
.chip{display:inline-flex;align-items:center;gap:7px;white-space:nowrap}
.chip .sw{margin-top:0}
.chip.active{border-color:var(--accent);color:var(--accent-text);background:var(--accent-soft)}
.wz-hint{font-size:13.5px;color:var(--muted);margin:-4px 0 0;line-height:1.5}
.wz-adv{border:1px solid var(--line);border-radius:10px;padding:10px 14px}
.wz-adv summary{cursor:pointer;font-size:14px;color:var(--muted)}
.wz-adv[open] summary{margin-bottom:12px}
.wz-adv .checkbox{margin-top:12px;display:flex}
.wz-preview{height:160px;border:1px dashed var(--line-strong);border-radius:12px;display:flex;align-items:center;justify-content:center;overflow:hidden;color:var(--muted);font-size:13px}
.wz-preview img{max-width:100%;max-height:100%}
.wz-count{display:flex;flex-direction:column;gap:10px}
.wz-count-row{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--line);border-radius:11px;background:var(--surface-2);font-size:15px}
.stepper{display:flex;align-items:center;gap:4px;direction:ltr}
.stepper button{width:40px;height:40px;border-radius:9px;border:1px solid var(--line-strong);background:var(--surface);color:var(--text);font-size:19px;cursor:pointer}
.stepper b{min-width:38px;text-align:center;font-family:var(--mono);font-size:19px}
.wz-nav{border-top:1px solid var(--line);padding-top:16px}
.fam-pick{display:flex;flex-wrap:wrap;gap:6px}

/* filter sheet (phone) */
.fsec{display:flex;flex-direction:column;gap:10px}
.fsec h4{margin:0;font-size:14px;color:var(--muted);font-weight:600}
.fsec .opts{display:flex;flex-wrap:wrap;gap:8px}
.seg2{display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--line-strong);border-radius:10px;overflow:hidden}
.seg2 button{height:44px;border:none;background:none;cursor:pointer;color:var(--muted)}
.seg2 button[aria-pressed="true"]{background:var(--surface-2);color:var(--text);font-weight:600}
.sheet-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px}
.sheet-title h3{margin:0}
.sheet-body{display:flex;flex-direction:column;gap:20px}
.sheet-foot{display:grid;grid-template-columns:1fr 2fr;gap:10px;padding-top:14px;margin-top:18px;border-top:1px solid var(--line)}
.sheet-foot .btn{height:50px}
.menu-list{display:flex;flex-direction:column;gap:4px}
.menu-list button,.menu-list a{display:flex;align-items:center;gap:12px;min-height:52px;padding:0 12px;border-radius:10px;border:none;background:none;color:var(--text);font-size:16px;text-align:start;text-decoration:none;cursor:pointer}
.menu-list button:hover,.menu-list a:hover{background:var(--surface-2)}

.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%) translateY(20px);opacity:0;pointer-events:none;background:var(--surface-2);border:1px solid var(--line-strong);color:var(--text);padding:11px 18px;border-radius:10px;font-size:14.5px;box-shadow:var(--shadow);z-index:2000;transition:all .2s ease;max-width:90vw}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
.toast.ok{border-color:var(--ok)} .toast.err{border-color:var(--danger);color:var(--danger)}
.fab{display:none}
footer{text-align:center;padding:26px;color:var(--faint);font-size:12.5px}

/* ---------- mid widths ---------- */
@container (max-width: 1180px){
  .wrap{padding:24px 32px 90px}
  .nav .nl{display:none}
  .menu-btn{display:flex}
  .heads{gap:10px}
  .head{padding:12px}
  .head .tag.ok span{display:none}
}
@container (max-width: 860px){
  .search{flex:1 1 100%;padding-bottom:12px}
  .search input{width:auto;flex:1 1 auto}
  .mtabs{flex-basis:100%;order:2}
  .theme button span{display:none}
  .theme button{padding:0 10px}
  .head .well{aspect-ratio:1/1}
  .head .why{display:none}
  .head .num .full{display:none}
  .head .num .short{display:inline}
  .head .tag.ok{padding:0 4px}
}

/* ---------- phone: its own layout, not a shrunk desktop ---------- */
@container (max-width: 640px){
  .wrap{padding:14px 16px 112px;gap:22px}
  .top{gap:8px}
  .inv-select{font-size:19px}
  .avatar,.top .btn-add,.theme{display:none}
  .theme-mini{display:flex}
  .nav{gap:8px}

  /* printer: summary always visible; five separate rows when open */
  .printer .sec-head{display:none}
  .psum{display:flex;flex-direction:column;gap:12px}
  .psum-top{display:flex;align-items:center;justify-content:space-between;gap:10px}
  .psum-top b{font-size:16.5px}
  .psum-top .meta{font-size:13.5px;color:var(--muted)}
  .psum-top .meta .f{color:var(--fault);font-weight:600}
  .psum-toggle{height:40px;padding:0 12px;border-radius:9px;border:1px solid var(--line-strong);background:var(--surface);display:flex;align-items:center;gap:6px;font-weight:600;cursor:pointer;flex:0 0 auto}
  .psum-toggle svg{transition:transform .2s}
  .printer.open .psum-toggle svg{transform:rotate(180deg)}
  .slots{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}
  .slots.few{grid-template-columns:repeat(var(--cols,5),minmax(0,64px))}
  .slot{display:flex;flex-direction:column;align-items:center;gap:5px;padding:8px 2px 8px;border-radius:12px;background:var(--surface);border:1px solid var(--line);cursor:pointer;color:var(--text)}
  .slot .well{width:44px;height:44px;border-radius:9px}
  .slot .well.empty{font-size:0}
  .slot .e{font-family:var(--mono);font-size:13px;font-weight:600}
  .slot .st{font-size:12px;line-height:1;display:flex;align-items:center;gap:3px;color:var(--ok)}
  .slot .st.empty{color:var(--faint)}
  .slot.fault{box-shadow:inset 0 0 0 1px var(--fault-line)}
  .slot.fault .st{color:var(--fault);font-weight:600}
  .printer:not(.open) .heads{display:none}
  .printer.open .slots{display:none}
  .heads,.heads.few{grid-template-columns:1fr;gap:8px;max-width:none}
  .head{flex-direction:row;align-items:center;gap:12px;padding:10px 12px;border-radius:12px;min-height:72px}
  .head-top{flex-direction:column;align-items:center;justify-content:center;width:30px}
  .head .num{font-size:20px;font-weight:600;color:var(--text);line-height:1}
  .head .num .full,.head .num .short{display:none}
  .head .num .n{display:block}
  .head .well{width:52px;height:52px;aspect-ratio:auto;flex:0 0 auto;border-radius:10px}
  .head .well.empty{font-size:0}
  .head .who{flex:1 1 auto}
  .head .top-tag{display:none}
  .head .row-tag{display:inline-flex}
  .head .why,.head .plan-note{display:none}
  .head .tag.ok span{display:inline}
  .head .tag.ok{padding:0 8px}
  .chev{display:block;color:var(--faint)}
  .todo{padding:12px 14px}
  .todo .sep{display:none}

  .controls{border-bottom:none;gap:10px;position:sticky;top:0;z-index:5;background:var(--bg);padding-top:6px}
  .search{order:-1;padding-bottom:0;flex:1 1 100%}
  .search select{display:none}
  .search input{height:46px;font-size:16px}
  .filter-btn{display:flex}
  .colors{display:none}
  .mtabs{gap:8px;flex-basis:100%;padding-bottom:10px;border-bottom:1px solid var(--line)}
  .mtab{height:38px;padding:0 14px;border:1px solid var(--line-strong);border-radius:999px;margin:0;font-size:14px;align-items:center}
  .mtab[aria-pressed="true"]{border-color:var(--text);background:var(--surface-2)}
  .active-filters{margin-top:10px;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
  .active-filters::-webkit-scrollbar{display:none}
  .achip{height:36px}

  .shelves{gap:26px;margin-top:16px}
  .shelf{flex:1 1 100%;gap:10px}
  .shelf-head h3{font-size:18px}
  .row{display:flex;flex-direction:column;gap:8px;border-bottom:none;padding:0}
  .tile{width:auto;flex-direction:row;align-items:center;gap:12px;padding:8px;border-radius:12px;background:var(--surface);border:1px solid var(--line)}
  .tile .well{width:76px;height:76px;flex:0 0 auto;aspect-ratio:auto;border-radius:10px}
  .tile .well img{padding:5%}
  .tile .txt{display:flex;flex:1 1 auto;min-width:0;flex-direction:column;gap:3px}
  .tile .name{font-size:16px;padding:0}
  .tile .sub{margin:0;padding:0}
  .tile .amt{position:static;flex:0 0 auto}
  .badge{height:20px;font-size:11px;padding:0 5px}
  .badge.count{top:5px;inset-inline-start:5px} .badge.slot{top:5px;inset-inline-end:5px} .badge.flag{bottom:5px;inset-inline-end:5px}
  .cards{grid-template-columns:1fr}
  .fab{display:flex;position:fixed;left:16px;bottom:20px;height:52px;padding:0 20px;border-radius:26px;box-shadow:0 8px 22px rgba(0,0,0,.3);z-index:900}
  body.modal-open .fab{display:none}
}
/* dialogs become bottom sheets on narrow screens (viewport query: they live outside the app container) */
@media (max-width: 640px){
  .modal-overlay{align-items:flex-end;padding:0}
  .modal{max-width:none !important;border-radius:20px 20px 0 0;max-height:88vh;padding:10px 18px 24px;border-bottom:none}
  .modal::before{content:"";display:block;width:40px;height:5px;border-radius:3px;background:var(--line-strong);margin:0 auto 14px}
  .form-grid,.wz-two{grid-template-columns:1fr}
  .ms-acts{width:100%}
  .ms-acts .btn{flex:1 1 0}
  .wz-dot span{display:none}
  .dialog-card{border-radius:20px 20px 0 0}
}
@media (prefers-reduced-motion: reduce){ *{transition:none !important} .bar::after{animation:none;transform:scaleX(.5)} }
.wz-hint:empty{display:none}
.wz-hint.err{color:var(--danger)}
input.bad{border-color:var(--danger) !important}
/* combo form */
.combo-pick-head{display:flex;align-items:center;gap:12px}
.combo-pick-head span{font-size:13.5px;color:var(--muted);white-space:nowrap}
.combo-pick-head input{flex:1 1 auto}
.slot-badge{margin-inline-start:auto;font-family:var(--mono);font-size:12px;color:var(--accent-text);background:var(--accent-soft);padding:2px 7px;border-radius:6px}

/* =====================================================================
   DESIGN PREVIEW (html.preview — only the /preview/ copy)
   ===================================================================== */
/* light palette taken from the Figma frame ("סדנת המודל"): warm paper #F4F0E7, cards #FFFCF6,
   ink #292A27, olive #465031 for primary actions, sage #E4E7D5 for "full", brick #B73A2F on #F8DFD2 for trouble */
html.preview[data-theme="light"]{
  --font:'Noto Sans Hebrew', 'IBM Plex Sans Hebrew', system-ui, sans-serif;
  --bg:#F4F0E7; --surface:#FFFCF6; --surface-2:#F8F6EF; --well:#EDE6D9; --field:#FFFFFF;
  --line:#D8D1C3; --line-strong:#BDB4A4; --shelf:#D8D1C3;
  --text:#292A27; --muted:#706E65; --faint:#9A968B;
  --accent:#465031; --accent-text:#465031; --on-accent:#FFFCF6; --accent-soft:#E4E7D5;
  --fault:#B73A2F; --fault-bg:#F8DFD2; --fault-line:rgba(183,58,47,.45);
  --danger:#B73A2F; --danger-bg:#F8DFD2;
  --ok:#66704A; --ok-bg:#E4E7D5;
  --unknown:#78835B; --unknown-line:rgba(120,131,91,.45);
  --plan:#476E8A; --plan-bg:#E3EAEE;
  --chip:#292A27; --chip-text:#FFFCF6; --amt-bg:#FFFCF6;
  --focus:#465031; --bed:#D8D1C3; --layer-2:#465031;
}
html.preview{ --unknown-bg:rgba(217,168,87,.08); --low-edge:#E07A66; }
html.preview[data-theme="light"]{ --unknown-bg:#EDE6D9; --low-edge:#D86135; }

.preview-note{font-size:12.5px;color:var(--muted);background:var(--surface-2);border:1px dashed var(--line-strong);border-radius:8px;padding:6px 12px;align-self:flex-start}
.preview-note a{color:var(--accent-text)}

/* 1. printer heads: amount + fill bar, health and swap at the bottom */
html.preview .head .fill{display:flex;flex-direction:column;gap:6px;margin-top:10px}
html.preview .fill-top{display:flex;justify-content:space-between;align-items:baseline;font-size:13px;color:var(--muted)}
html.preview .fill-top b{font-size:15.5px;color:var(--text);font-weight:700}
html.preview .fill-bar{height:7px;border-radius:99px;background:var(--line);overflow:hidden}
html.preview .fill-bar i{display:block;height:100%;border-radius:inherit;background:var(--ok)}
html.preview .fill.mid .fill-bar i{background:#D9A12F}
html.preview .fill.low .fill-bar i{background:var(--danger)}
html.preview .fill.low .fill-top b{color:var(--danger)}
html.preview .fill.unknown .fill-bar{background:repeating-linear-gradient(135deg,var(--line) 0 6px,transparent 6px 10px)}
html.preview .fill.unknown .fill-top b{color:var(--unknown);font-weight:600}
html.preview .head-foot{display:flex;justify-content:space-between;align-items:center;margin-top:auto;padding-top:10px;border-top:1px solid var(--line);font-size:13.5px}
html.preview .hf-health{display:inline-flex;align-items:center;gap:5px;font-weight:600}
html.preview .hf-health.ok{color:var(--ok)} html.preview .hf-health.ok::before{content:"✓"}
html.preview .hf-health.bad{color:var(--fault)}
html.preview .hf-swap{color:var(--plan);font-weight:600;padding:4px 6px;margin:-4px -6px;border-radius:6px;cursor:pointer}
html.preview .hf-swap:hover{background:var(--plan-bg)}
html.preview .head .why{border-top:none;padding-top:0}

/* 2. inventory tabs */
.inv-tabs{display:flex;align-items:center;gap:6px;overflow-x:auto;scrollbar-width:none}
.inv-tabs::-webkit-scrollbar{display:none}
.inv-tabs .lbl{font-size:13.5px;color:var(--faint);white-space:nowrap;margin-inline-end:4px}
.inv-tabs button{flex:0 0 auto;height:34px;padding:0 14px;border-radius:9px;border:none;background:none;color:var(--muted);font-size:14px;font-weight:600;cursor:pointer;white-space:nowrap}
.inv-tabs button:hover{background:var(--surface-2)}
.inv-tabs button[aria-pressed="true"]{background:var(--accent-soft);color:var(--text)}

/* 3. combinations as compact cards */
.cb-grid{grid-template-columns:repeat(auto-fill,minmax(260px,1fr)) !important;gap:10px !important}
.cb-card{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border-radius:12px;border:1px solid var(--line);background:var(--surface-2);color:var(--text);text-align:start;cursor:pointer;min-height:72px}
.cb-card:hover{border-color:var(--line-strong)}
.cb-txt{display:flex;flex-direction:column;gap:3px;min-width:0}
.cb-txt b{font-size:15.5px;font-weight:700}
.cb-txt small{font-size:13px;color:var(--muted)}
.cb-dots{display:flex;align-items:center;flex:0 0 auto;direction:ltr}
.cb-dots i{width:26px;height:26px;border-radius:50%;background:var(--sw);box-shadow:0 0 0 2px var(--surface-2),inset 0 0 0 1px rgba(128,128,128,.35);margin-left:-7px}
.cb-dots i:first-child{margin-left:0}
.cb-dots em{font-style:normal;font-size:12px;color:var(--muted);margin-left:6px}

/* 4. filter row: search + selects + one view button on top, all material tabs on their own row */
html.preview .controls{flex-wrap:wrap;row-gap:4px}
html.preview .search{order:1;flex:1 1 100%;padding-bottom:6px}
html.preview .search input{flex:1 1 auto;width:auto;max-width:420px}
html.preview .mtabs{order:2;flex:1 1 100%;flex-wrap:wrap;row-gap:10px;overflow:visible}
.viewtoggle{display:inline-flex;align-items:center;gap:8px;height:42px;padding:0 14px;border-radius:9px;border:1px solid var(--line-strong);background:var(--surface);color:var(--text);font-size:14px;font-weight:600;cursor:pointer;white-space:nowrap;flex:0 0 auto;margin-inline-start:auto}
.viewtoggle:hover{border-color:var(--muted)}

/* ledger: every product its own bordered card, with its photo */
#grid.is-ledger{display:block}
.lg-head{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap;margin-bottom:14px}
.lg-head h3{margin:0;font-size:18px;font-weight:700}
.lg-head .meta{font-size:13px;color:var(--muted)}
.ledger{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:10px}
.lg-cell{display:flex;align-items:center;gap:12px;padding:10px 14px 10px 12px;border:1px solid var(--line);border-radius:12px;background:var(--surface);color:var(--text);text-align:start;cursor:pointer;min-height:92px;position:relative;overflow:hidden}
.lg-cell:hover{border-color:var(--line-strong);box-shadow:0 6px 16px -10px rgba(0,0,0,.35)}
.lg-cell.full{background:var(--ok-bg);border-color:color-mix(in srgb,var(--ok) 28%,var(--line))}
.lg-cell.low{background:var(--danger-bg);border-color:color-mix(in srgb,var(--danger) 35%,var(--line))}
.lg-cell.low::after{content:"";position:absolute;inset-block:0;inset-inline-end:0;width:4px;background:var(--low-edge)}
.lg-cell.unknown{background:var(--unknown-bg)}
.lg-cell.out{opacity:.6}
.lg-cell .lg-well{width:68px;height:68px;flex:0 0 auto;border-radius:10px;aspect-ratio:auto}
.lg-cell .lg-well img{padding:6%}
.lg-main{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1 1 auto}
.lg-main b{display:flex;align-items:center;gap:7px;font-size:15px;font-weight:700;line-height:1.3}
.lg-main b .sw{margin-top:0}
.lg-main small{font-size:12.5px;color:var(--muted)}
.lg-main .mono{font-size:11.5px;color:var(--faint);text-align:right}
.lg-amt{display:flex;flex-direction:column;align-items:flex-end;gap:6px;flex:0 0 auto;text-align:end;padding-inline-start:12px;border-inline-start:1px solid var(--line);align-self:stretch;justify-content:center}
.lg-amt>span{display:flex;flex-direction:column;align-items:flex-end}
.lg-amt b{font-size:16px;font-weight:700;white-space:nowrap}
.lg-amt small{font-size:12px;color:var(--muted);white-space:nowrap}
.lg-amt .low b,.lg-amt .low small{color:var(--danger)}
.lg-amt .unknown b{color:var(--unknown);font-weight:600}
.lg-legend{display:flex;flex-wrap:wrap;gap:16px;margin-top:12px;font-size:12.5px;color:var(--muted)}
.lg-legend span{display:inline-flex;align-items:center;gap:6px}
.lg-legend i{width:14px;height:14px;border-radius:4px;border:1px solid var(--line-strong)}
.lg-legend i.full{background:var(--ok-bg)} .lg-legend i.low{background:var(--danger-bg)} .lg-legend i.unknown{background:var(--unknown-bg)}

@container (max-width: 640px){
  html.preview .head .fill{margin-top:6px}
  html.preview .head-foot{display:none}
  html.preview .search{padding-bottom:0}
  html.preview .search input{max-width:none}
  html.preview .mtabs{flex-wrap:wrap;overflow:visible;gap:6px;padding-bottom:8px}
  html.preview .mtab{height:32px;padding:0 11px;font-size:13.5px}
  .inv-tabs{margin-top:0}
  .ledger{grid-template-columns:1fr;gap:8px}
  .lg-cell{min-height:0;padding:8px 12px 8px 8px}
  .lg-cell .lg-well{width:56px;height:56px}
  .cb-grid{grid-template-columns:1fr !important}
}

@container (max-width: 640px){
  .search .viewtoggle{display:none}
  html.preview .fill-top span{display:none}
  html.preview .fill-top{justify-content:flex-start}
  html.preview .head .fill{max-width:180px}
}

/* ---- the Figma "feel" in the light theme: square corners, hairline borders, a paper header band, heavy headings ---- */
html.preview[data-theme="light"] body{font-family:var(--font)}
html.preview[data-theme="light"] :is(.head,.todo,.well,.tile,.tile .well,.slot,.slot .well,.combo-card,.wish-card,.wish-photo,.cb-card,.add-card,.empty-state,.none,
  .lg-cell,.lg-cell .lg-well,.kv,.ms-row,.list-box,.weigh-row,.weigh-preview,.warn-box,.fault-text,.note,.wz-adv,.wz-preview,.wz-count-row,.dz-panel,.psum,.modal,.dialog-card,.toast){border-radius:4px}
html.preview[data-theme="light"] :is(.btn,.btn.sm,.btn-add,.btn-line,.filter-btn,.viewtoggle,.icon-btn:not(.avatar),.tab,.inv-tabs button,.seg2,.achip,.stepper button,.psum-toggle,.menu-list button,.menu-list a,.list-row,.shelf-head .spec,.badge,.amt,.tag,.pill,.slot-badge,.mini-actions .icon-btn){border-radius:3px}
html.preview[data-theme="light"] :is(input,select,textarea){border-radius:3px}
html.preview[data-theme="light"] .mtab{border-radius:0}
html.preview[data-theme="light"] :is(.head,.todo,.tile,.combo-card,.wish-card,.cb-card,.lg-cell){border:1px solid var(--line);box-shadow:none}
html.preview[data-theme="light"] .tile{background:var(--surface)}
html.preview[data-theme="light"] .lg-cell.full{border-color:#C9CDB5}
html.preview[data-theme="light"] .lg-cell.low{border-color:#E7B7A6}
html.preview[data-theme="light"] :is(h1,h2,h3,.sec-head h2,.shelf-head h3,.lg-head h3,.inv-select){font-weight:800;letter-spacing:-.01em;color:var(--text)}
html.preview[data-theme="light"] .head b,html.preview[data-theme="light"] .lg-main b,html.preview[data-theme="light"] .cb-txt b{font-weight:700}
html.preview[data-theme="light"] .head .num{font-family:var(--mono);color:var(--text);font-weight:600}
/* paper band behind the header (with the inventory tabs inside it), edge to edge and up to the top of the page */
html.preview header.top{flex-wrap:wrap}
html.preview #invTabs{order:10;flex:1 1 100%;margin-top:0}
html.preview[data-theme="light"] header.top{position:relative;background:var(--surface);box-shadow:0 0 0 100vmax var(--surface);clip-path:inset(-300px -100vmax 0 -100vmax);padding-bottom:14px}
html.preview[data-theme="light"] header.top::after{content:"";position:absolute;bottom:0;left:-100vmax;right:-100vmax;height:1px;background:var(--line)}
html.preview[data-theme="light"] .preview-note{background:transparent}
/* primary actions in olive ink, secondary ones as outlined paper buttons */
html.preview[data-theme="light"] .btn-add{background:var(--accent);color:var(--on-accent)}
html.preview[data-theme="light"] :is(.btn:not(.primary):not(.danger):not(.accent):not(.empty-btn),.btn-line,.filter-btn,.viewtoggle){background:var(--surface);border-color:var(--line-strong);color:var(--text)}
html.preview[data-theme="light"] .btn.accent{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
html.preview[data-theme="light"] .inv-tabs button[aria-pressed="true"]{background:var(--accent-soft);color:var(--text)}
html.preview[data-theme="light"] .todo{background:var(--surface)}
html.preview[data-theme="light"] .todo .fault-text{background:var(--fault-bg);color:var(--fault)}
html.preview[data-theme="light"] .hf-health.ok{color:var(--ok)}
html.preview .app{overflow-x:clip}

/* adding people */
.tab-badge{display:inline-flex;min-width:18px;height:18px;padding:0 5px;margin-inline-start:6px;border-radius:9px;background:var(--danger);color:#fff;font-size:11.5px;font-weight:700;align-items:center;justify-content:center}
#manageBtn[data-badge]:not([data-badge=""])::after{content:attr(data-badge);display:inline-flex;min-width:17px;height:17px;padding:0 4px;margin-inline-start:6px;border-radius:9px;background:var(--danger);color:#fff;font-size:11px;font-weight:700;align-items:center;justify-content:center;vertical-align:1px}
.req-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:10px 0;border-bottom:1px solid var(--line);font-size:14.5px;color:var(--text)}
.req-row .who{flex:1 1 220px;display:flex;flex-direction:column;gap:2px;min-width:0}
.req-row .who small{color:var(--muted);font-size:12.5px}
.req-row select{width:auto;padding:6px 10px;font-size:14px}
.pill.approved{background:var(--ok-bg);color:var(--ok)} .pill.rejected{background:var(--danger-bg);color:var(--danger)}
.otp-overlay{position:fixed;inset:0;background:var(--scrim);display:flex;align-items:center;justify-content:center;z-index:3000;padding:16px}
.otp-overlay.force{background:var(--bg)}
.otp-card{width:min(460px,100%);background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:22px;display:flex;flex-direction:column;gap:12px;box-shadow:var(--shadow)}
.otp-card h3{margin:0;font-size:19px}
.otp-card .sub{margin:0}
.otp-code{font-family:var(--mono);font-size:24px;letter-spacing:.08em;text-align:center;padding:12px;border-radius:10px;background:var(--surface-2);border:1px dashed var(--line-strong);user-select:all}
.otp-msg{font-size:13px}

/* notifications */
.bell{position:relative;width:40px;height:40px;flex:0 0 auto}
.bell[data-badge]:not([data-badge=""])::after{content:attr(data-badge);position:absolute;top:-3px;inset-inline-end:-3px;min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:var(--danger);color:#fff;font-size:10.5px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;line-height:1}
.note-h{margin:14px 0 6px;font-size:13px;color:var(--muted);font-weight:600}
.note-row{display:flex;gap:10px;align-items:flex-start;padding:10px 12px;border:1px solid var(--line);border-radius:10px;margin-bottom:8px;background:var(--surface);color:var(--text)}
.note-row.unread{border-color:var(--accent);box-shadow:inset -3px 0 0 var(--accent)}
.note-ico{font-size:17px;line-height:1.3}
.note-txt{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px;font-size:14.5px}
.note-body{color:var(--muted);font-size:13.5px;line-height:1.45}
.note-txt small{color:var(--faint);font-size:12px}
.otp-mini{font-family:var(--mono);font-size:14px;padding:4px 8px;border:1px dashed var(--line-strong);border-radius:6px;background:var(--surface-2);user-select:all;white-space:nowrap}
.login-row .who small{display:block}
html.preview[data-theme="light"] :is(.note-row,.otp-mini){border-radius:3px}

/* selects: our own chevron, with room between it and the edge of the box */
select:not(.inv-select){appearance:none;-webkit-appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A857B' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:left 14px center;background-size:12px;padding-left:38px}
.empty-btn{color:var(--danger);border-color:color-mix(in srgb,var(--danger) 45%,var(--line-strong));background:transparent}
.empty-btn:hover{background:var(--danger-bg)}

/* preview: inventory name is a title (switching only via "מעבר מלאי"); swap link beside the extruder name */
html.preview #inventorySelect{display:none}
.inv-title{margin:0;font-size:22px;font-weight:700;line-height:1.3}
html.preview .head-top{justify-content:flex-start}
html.preview .head-top .top-tag{margin-inline-start:auto}
html.preview .head-top .hf-swap{font-size:13px;padding:2px 6px;margin:-2px 0}
@container (max-width: 640px){ .inv-title{font-size:19px} html.preview .head-top .hf-swap{display:none} }

/* heads: the swap button sits where "תקין" was; a fault tag stays, with the button next to it */
html.preview .head-top .top-tag{display:inline-flex;align-items:center;gap:6px}
html.preview .head .tag.ok{display:none}
html.preview .head-top .hf-swap{font-size:13.5px;padding:3px 8px;margin:-3px -4px -3px 0;border-radius:6px}

/* management: sections instead of many tabs */
.mg-sec{padding:16px 0;border-top:1px solid var(--line)}
.mg-sec:first-child{border-top:none;padding-top:4px}
.mg-sec h4{margin:0 0 8px;font-size:15.5px}
.mg-fold>summary{cursor:pointer;font-weight:600;font-size:15px;color:var(--text);list-style:none;display:flex;align-items:center;gap:8px}
.mg-fold>summary::-webkit-details-marker{display:none}
.mg-fold>summary::before{content:"";width:8px;height:8px;border-inline-end:2px solid var(--muted);border-bottom:2px solid var(--muted);transform:rotate(45deg);margin-top:-4px;transition:transform .15s}
.mg-fold[open]>summary::before{transform:rotate(225deg);margin-top:4px}
.mg-fold[open]>summary{margin-bottom:12px}
@container (max-width: 640px){ html.preview .head-top .top-tag{display:none} }

.inv-hello{font-size:13.5px;color:var(--muted);margin-bottom:2px}
.inv-hello:empty{display:none}
.pw-rules{list-style:none;margin:-4px 0 0;padding:0;display:flex;flex-direction:column;gap:4px;font-size:13.5px;color:var(--muted)}
.pw-rules li{display:flex;align-items:center;gap:7px}
.pw-rules li::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--line-strong);flex:0 0 auto}
.pw-rules li.ok{color:var(--ok)} .pw-rules li.ok::before{background:var(--ok)}
.pw-rules li.bad{color:var(--danger)} .pw-rules li.bad::before{background:var(--danger)}

/* management extras */
.mg-danger{margin-top:22px;padding-top:14px;border-top:1px solid var(--line)}
.mg-danger>summary{font-size:13.5px;font-weight:500;color:var(--muted)}
.user-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.user-row .who{flex:1 1 200px}
.user-row .flags{display:flex;flex-wrap:wrap;gap:6px 14px;flex:1 1 320px}
.user-acts{display:flex;gap:8px;flex-wrap:wrap}
.acc-panel{flex:1 1 100%;display:flex;flex-direction:column;gap:6px;margin-top:4px;padding:10px 12px;background:var(--surface-2);border:1px solid var(--line);border-radius:10px}
html.preview[data-theme="light"] .acc-panel{border-radius:3px}
.acc-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
.acc-row span{font-size:14.5px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.acc-row select{width:auto;min-width:150px;padding-top:6px;padding-bottom:6px;font-size:14px}
.mi-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.mi-head select{width:auto;padding-top:4px;padding-bottom:4px;font-size:15px;font-weight:600}
#muIdleFold{margin-top:14px}
