:root{
  color-scheme:dark;
  --bg:#0e1319;
  --surface:#161c25;
  --surface2:#1e2632;
  --line:#283140;
  --fg:#e9eef5;
  --muted:#8c97a9;
  --accent:#38c6e6;
  --accent-ink:#03222b;
  --ok:#5cc58b;
  --warn:#e3b04b;
  --bad:#f07272;
  font:17px/1.45 Figtree,system-ui,sans-serif
}
:root[data-theme=light]{
  color-scheme:light;
  --bg:#f3f5f8;
  --surface:#ffffff;
  --surface2:#e9edf2;
  --line:#d5dce5;
  --fg:#151b24;
  --muted:#5d6879;
  --accent:#0a7f9c;
  --accent-ink:#ffffff;
  --ok:#1c8350;
  --warn:#8f6208;
  --bad:#c1363a
}
*{
  box-sizing:border-box
}
body{
  margin:0;
  background:var(--bg);
  color:var(--fg)
}
button,input,select{
  font:inherit
}
button,a,input,select{
  -webkit-tap-highlight-color:transparent
}
button,input,select{
  min-height:44px
}
button{
  cursor:pointer;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface2);
  color:var(--fg);
  padding:10px 16px;
  font-weight:600
}
button:hover{
  border-color:var(--accent)
}
button:disabled{
  cursor:wait;
  opacity:.55
}
button:focus-visible,input:focus-visible,select:focus-visible,a:focus-visible{
  outline:3px solid var(--accent);
  outline-offset:3px
}
input,select{
  width:100%;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface);
  color:var(--fg);
  padding:11px 12px;
  font-size:17px
}
input[type=checkbox],input[type=radio]{
  width:24px;
  height:24px;
  min-height:24px;
  accent-color:var(--accent);
  flex-shrink:0
}
label{
  display:block;
  font-weight:500;
  margin:14px 0 7px
}
fieldset{
  border:0;
  padding:0;
  margin:0;
  min-width:0
}
h1,h2,h3,.brand{
  font-family:'Bricolage Grotesque',system-ui,sans-serif;
  line-height:1.15
}
h1{
  font-size:36px;
  letter-spacing:-1px;
  margin:0 0 20px
}
h2{
  font-size:25px;
  margin:0
}
h3{
  font-size:19px;
  margin:0
}
p{
  margin:10px 0 16px
}
svg{
  width:24px;
  height:24px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8
}
.masthead,main{
  max-width:760px;
  margin:auto;
  padding-left:max(16px,env(safe-area-inset-left));
  padding-right:max(16px,env(safe-area-inset-right))
}
.masthead{
  padding-top:max(25px,env(safe-area-inset-top));
  padding-bottom:20px;
  border-bottom:1px solid var(--line)
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  font-size:28px;
  font-weight:700
}
.brand svg{
  color:var(--accent);
  stroke-width:4;
  width:30px;
  height:30px
}
.edition{
  margin-left:auto;
  font:11px Figtree,system-ui;
  letter-spacing:1.5px;
  color:var(--muted)
}
.save-line{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:12px;
  font-size:13px;
  color:var(--muted)
}
#save-status[data-state=saved]{
  color:var(--ok)
}
#save-status[data-state=failed],#connection{
  color:var(--bad)
}
main{
  padding-bottom:160px
}
.stock-header{
  position:sticky;
  top:0;
  z-index:2;
  background:var(--bg);
  padding:24px 0 18px
}
.title-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px
}
.title-row h1{
  margin-bottom:16px
}
.title-row button{
  padding:10px;
  display:grid;
  place-items:center
}
.eyebrow{
  color:var(--muted);
  font-size:11px;
  letter-spacing:1.8px;
  font-weight:700;
  margin:0 0 7px
}
#item-count{
  font:16px 'IBM Plex Mono',monospace;
  color:var(--muted);
  vertical-align:middle;
  margin-left:8px
}
#category{
  height:48px
}
#search-wrap{
  margin-bottom:12px
}
#search-wrap label{
  font-size:14px;
  margin-top:0
}
.banner,article,.empty{
  padding:18px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:12px;
  margin:0 0 20px
}
.banner{
  border-left:3px solid var(--accent);
  font-size:15px
}
.banner .dismiss{
  float:right;
  padding:4px 10px;
  margin:-8px -8px 0 8px
}
.banner p{
  margin-bottom:8px
}
.link{
  background:none;
  border:0;
  color:var(--accent);
  padding:8px 0;
  text-align:left
}
.group{
  margin-bottom:26px
}
.group-head{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap:12px;
  margin:0 0 12px
}
.group-head small{
  font-size:12px;
  color:var(--muted);
  white-space:nowrap
}
.table-head,.item-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) 54px 54px 54px;
  gap:5px;
  align-items:center
}
.table-head{
  color:var(--muted);
  font-size:11px;
  padding:0 8px 9px
}
.table-head span:not(:first-child){
  text-align:center
}
.item-list{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden
}
.item-row{
  padding:13px 8px;
  min-height:82px;
  border-bottom:1px solid var(--line)
}
.item-row:last-child{
  border:0
}
.item-name{
  border:0;
  background:none;
  padding:4px 3px;
  text-align:left;
  font-size:16px;
  overflow-wrap:anywhere;
  font-weight:600
}
.pill{
  display:block;
  width:fit-content;
  max-width:100%;
  font:9px/1.4 Figtree,system-ui;
  letter-spacing:.25px;
  padding:3px 5px;
  border-radius:4px;
  margin-top:6px;
  background:var(--surface2);
  color:var(--muted)
}
.pill.low,.total.low{
  color:var(--warn)
}
.pill.out,.total.out{
  color:var(--bad)
}
.qty,.total{
  font-family:'IBM Plex Mono',monospace;
  font-size:17px;
  font-variant-numeric:tabular-nums;
  text-align:center
}
.qty{
  padding:6px 2px;
  min-width:44px;
  background:var(--surface2)
}
.qty.unknown{
  color:var(--muted);
  border-style:dashed
}
.qty sup{
  font:10px Figtree,system-ui
}
.total{
  overflow-wrap:anywhere
}
.provisional{
  color:var(--muted)
}
.total small{
  display:block;
  font:9px Figtree,system-ui;
  margin-top:4px
}
.add{
  position:fixed;
  right:max(20px,calc((100vw - 720px)/2));
  bottom:calc(94px + env(safe-area-inset-bottom));
  width:60px;
  height:60px;
  background:var(--accent);
  color:var(--accent-ink);
  border:0;
  border-radius:20px;
  font-size:34px;
  box-shadow:0 8px 28px #0005;
  z-index:3;
  padding:0
}
nav{
  position:fixed;
  bottom:0;
  left:0;
  right:0;
  z-index:4;
  border-top:1px solid var(--line);
  background:var(--surface);
  padding-bottom:env(safe-area-inset-bottom)
}
nav>div{
  display:flex;
  max-width:760px;
  margin:auto;
  padding:6px 10px
}
nav button{
  flex:1;
  border:0;
  background:none;
  font-size:12px;
  color:var(--muted);
  padding:6px 2px;
  min-height:62px
}
nav button span{
  display:block;
  font-size:23px;
  line-height:28px
}
nav button[aria-current]{
  color:var(--accent);
  background:var(--surface2)
}
#more-panel,#later-panel{
  padding-top:30px
}
article h2{
  font-size:21px
}
article p,.muted{
  color:var(--muted);
  font-size:15px
}
#appearance label,.check{
  display:flex;
  align-items:center;
  gap:12px;
  min-height:44px
}
.empty{
  text-align:center;
  color:var(--muted);
  padding:35px 20px
}
.primary{
  background:var(--accent);
  color:var(--accent-ink);
  border-color:var(--accent)
}
.danger{
  color:var(--bad)
}
dialog{
  color:var(--fg);
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:20px 20px 0 0;
  position:fixed;
  inset:auto 0 0;
  width:100%;
  max-width:560px;
  max-height:90dvh;
  overflow:auto;
  margin:0 auto;
  padding:20px 20px max(24px,env(safe-area-inset-bottom));
  box-shadow:0 20px 100px #0007
}
dialog::backdrop{
  background:#0009
}
.sheet-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:18px
}
.sheet-head h2{
  overflow-wrap:anywhere
}
.sheet-head button{
  font-size:26px;
  padding:0;
  width:44px;
  flex-shrink:0
}
.stepper{
  display:grid;
  grid-template-columns:60px 1fr 60px;
  gap:12px;
  align-items:center
}
.stepper button{
  height:60px;
  font-size:32px;
  padding:0
}
.stepper input{
  font:36px 'Bricolage Grotesque',system-ui;
  text-align:center;
  height:76px;
  padding:6px;
  width:100%;
  appearance:textfield
}
.stepper input::-webkit-inner-spin-button{
  appearance:none
}
.actions{
  display:flex;
  gap:12px;
  margin-top:24px
}
.actions>*{
  flex:1
}
.effect{
  font-size:16px;
  color:var(--muted);
  min-height:52px
}
.two{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px
}
#sheet-error{
  color:var(--bad);
  font-size:15px;
  white-space:pre-line
}
#toast{
  position:fixed;
  left:50%;
  bottom:calc(165px + env(safe-area-inset-bottom));
  transform:translateX(-50%);
  z-index:10;
  background:var(--fg);
  color:var(--bg);
  border-radius:10px;
  padding:12px 18px;
  max-width:90%;
  width:max-content;
  font-size:15px
}
#toast:empty{
  display:none
}
.sr-only,.skip:not(:focus){
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap
}
.skip:focus{
  display:block;
  padding:16px;
  color:var(--accent)
}
[hidden]{
  display:none!important
}
body:has(dialog[open]){
  overflow:hidden
}
@media(min-width:600px){
  .masthead{
    padding-top:35px
  }
  .stock-header{
    padding-top:30px
  }
  h1{
    font-size:42px
  }
  .table-head,.item-row{
    grid-template-columns:minmax(0,1fr) 90px 90px 90px;
    gap:10px
  }
  .item-row{
    padding:14px 16px
  }
  .table-head{
    padding-left:16px;
    padding-right:16px;
    font-size:13px
  }
  .item-name{
    font-size:18px
  }
  .pill{
    font-size:10px
  }
  .qty{
    font-size:20px;
    min-height:48px
  }
  .total{
    font-size:20px
  }
  dialog{
    inset:0;
    margin:auto;
    border-radius:20px;
    padding:26px;
    max-height:85dvh;
    height:fit-content
  }
  nav button{
    font-size:14px
  }
  .edition{
    font-size:12px
  }
}
@media(prefers-reduced-motion:no-preference){
  dialog[open]{
    animation:appear .16s ease-out
  }
  @keyframes appear{
    from{
      opacity:0;
      transform:translateY(12px)
    }
    to{
      opacity:1;
      transform:translateY(0)
    }
  }
}
nav button svg{
  display:block;
  margin:0 auto 3px;
  width:24px;
  height:24px
}
.pill{
  font-size:10px
}
.total small{
  font-size:10px
}
