:root{
  --bg0:#0b0f14;
  --bg1:#0e1520;
  --panel:#0f1826;
  --panel2:#121f31;
  --text:#eaf0ff;
  --muted:#9fb0cf;
  --line:rgba(255,255,255,.10);
  --shadow: 0 20px 60px rgba(0,0,0,.40);
  --brand:#7dd3fc;
  --brand2:#a78bfa;
  --danger:#fb7185;
  --warn:#fbbf24;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  background:
    radial-gradient(1000px 600px at 10% -10%, rgba(125,211,252,.25), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(167,139,250,.18), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  line-height:1.35;
}

a{color:inherit; text-decoration:none}

.topbar{
  position:sticky;
  top:0;
  z-index:10;
  background: rgba(11,15,20,.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner{
  max-width: 1100px;
  margin:0 auto;
  padding: 14px 16px;
  display:flex;
  gap:10px;
  align-items:center;
}
.topbar__spacer{flex:1}
.brand{
  font-weight:700;
  letter-spacing:.2px;
}
.brand::after{
  content:"";
  display:inline-block;
  width:8px;
  height:8px;
  margin-left:8px;
  border-radius:999px;
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  box-shadow: 0 0 0 4px rgba(125,211,252,.12);
}

.topnav{
  display:flex;
  gap:6px;
  align-items:center;
}
.topnav__link{
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: rgba(159,176,207,.92);
  font-weight: 800;
  font-size: 13px;
}
.topnav__link:hover{
  color: var(--text);
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.10);
}

.main{
  max-width: 1100px;
  margin:0 auto;
  padding: 18px 16px 56px;
}

.h1{
  margin:0 0 8px;
  font-size: 28px;
  letter-spacing:-.3px;
}

.muted{color:var(--muted)}

.flash{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(18,31,49,.55);
  padding: 12px 12px;
  border-radius: 12px;
  margin: 0 0 14px;
}

.banner{
  display:flex;
  align-items:center;
  gap:12px;
  justify-content:space-between;
  padding: 12px 14px;
  border:1px solid rgba(251,191,36,.25);
  background: rgba(251,191,36,.10);
  border-radius: 14px;
  margin: 4px 0 16px;
}
.banner__actions{
  display:flex;
  align-items:center;
  gap:8px;
}

.toolbar{
  display:flex;
  align-items:center;
  gap:10px;
  margin: 10px 0 14px;
}
.toolbar__spacer{flex:1}

.filters select{
  padding: 11px 12px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(15,24,38,.65);
  color: var(--text);
}

.search{
  width:min(520px, 100%);
  padding: 12px 12px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(15,24,38,.65);
  color: var(--text);
  outline:none;
}
.search:focus{border-color: rgba(125,211,252,.40); box-shadow: 0 0 0 4px rgba(125,211,252,.12);}

.card{
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(18,31,49,.70), rgba(15,24,38,.62));
  box-shadow: var(--shadow);
}
.card__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 16px 16px 0;
}
.card__title{
  margin:0;
  font-size: 16px;
  letter-spacing: .1px;
}
.card__actions{display:flex; gap:8px; align-items:center}
.card__body{padding: 14px 16px 16px}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-weight:600;
  cursor:pointer;
}
.btn:hover{background: rgba(255,255,255,.09)}
.btn--primary{
  border-color: rgba(125,211,252,.35);
  background: linear-gradient(135deg, rgba(125,211,252,.22), rgba(167,139,250,.16));
}
.btn--ghost{background: transparent}
.btn--danger{
  border-color: rgba(251,113,133,.35);
  background: rgba(251,113,133,.10);
}
.btn--small{
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.chip{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}
.chip__label{font-size: 12px; color: var(--muted)}
.chip__value{font-weight: 700}

.profile-switch{
  display:flex;
  align-items:center;
  gap:8px;
}
.profile-switch select{
  padding: 9px 10px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(15,24,38,.65);
  color: var(--text);
}

.list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.row{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  padding: 14px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(15,24,38,.55);
  transition: transform .08s ease, background .08s ease, border-color .08s ease;
}
.row:hover{
  transform: translateY(-1px);
  background: rgba(18,31,49,.55);
  border-color: rgba(125,211,252,.20);
}
.row--warn{border-color: rgba(251,191,36,.22)}
.row--danger{border-color: rgba(251,113,133,.26)}
.row--ok{border-color: rgba(125,211,252,.18)}
.row--static:hover{
  transform:none;
  background: rgba(15,24,38,.55);
}
.row__main{min-width:0}
.row__title{font-weight:800; letter-spacing:-.1px}
.row__meta{color: var(--muted); font-size: 13px; margin-top:2px}
.row__qty{text-align:right}
.qty{font-weight:800}
.qty--big{font-size: 32px; letter-spacing:-.6px}
.qty__unit{font-weight:700; color: var(--muted)}

.bar{
  height: 8px;
  border-radius: 999px;
  margin-top: 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.08);
  overflow:hidden;
}
.bar--big{height: 10px; margin-top: 12px; max-width: 560px}
.bar__fill{
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(125,211,252,.85), rgba(167,139,250,.75));
}
.bar--warn .bar__fill{background: linear-gradient(90deg, rgba(251,191,36,.92), rgba(125,211,252,.55));}
.bar--danger .bar__fill{background: linear-gradient(90deg, rgba(251,113,133,.95), rgba(251,191,36,.60));}

.empty{
  padding: 18px 14px;
  border-radius: 16px;
  border: 1px dashed rgba(255,255,255,.18);
  color: var(--muted);
  background: rgba(15,24,38,.35);
}

.center{
  min-height: calc(100vh - 40px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 22px 16px;
}
.login{
  width: min(460px, 100%);
  border-radius: 22px;
  border:1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(18,31,49,.76), rgba(15,24,38,.62));
  box-shadow: var(--shadow);
  padding: 22px 18px;
}

.stack{display:flex; flex-direction:column; gap:12px}
.field{display:flex; flex-direction:column; gap:6px}
.field__label{font-size: 13px; color: var(--muted)}
.field__input{
  width:100%;
  padding: 12px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(15,24,38,.65);
  color: var(--text);
  outline:none;
}
.field__input:focus{border-color: rgba(125,211,252,.40); box-shadow: 0 0 0 4px rgba(125,211,252,.12);}
.field__textarea{min-height: 90px; resize: vertical}

.grid{
  display:grid;
  gap:12px;
  grid-template-columns: 1fr 1fr;
}

.item-header{
  display:flex;
  gap:14px;
  justify-content:space-between;
  align-items:flex-end;
  margin: 6px 0 14px;
}
.item-qty{text-align:right}

.pill{
  display:inline-flex;
  align-items:center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  vertical-align:middle;
}
.pill--warn{
  border-color: rgba(251,191,36,.25);
  background: rgba(251,191,36,.12);
}
.pill--danger{
  border-color: rgba(251,113,133,.30);
  background: rgba(251,113,133,.12);
}

.hint{
  margin-top: 10px;
  color: rgba(159,176,207,.90);
  font-size: 13px;
}
.spacer{height: 14px}

.adj{
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.adj:last-child{border-bottom:none}
.adj__main{display:flex; justify-content:space-between; gap:10px}
.adj__delta{font-weight:900}
.adj__reason{color: var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.adj__meta{margin-top:4px; color: rgba(159,176,207,.85); font-size: 12px}

.row-actions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top: 8px;
}

.archive{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.kv{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.kv__row{
  display:flex;
  justify-content:space-between;
  gap:14px;
  padding: 10px 10px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.kv__k{color: rgba(159,176,207,.92); font-size: 13px}
.kv__v{font-weight: 800}

.grid--wide{margin-top: 12px}

.photos__grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:10px;
  margin-bottom: 14px;
}
.photo{
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(15,24,38,.55);
  overflow:hidden;
  padding: 10px;
}
.photo img{
  width:100%;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  display:block;
  margin-bottom: 10px;
}

.upload{margin-top: 14px}

.scan__video{
  border-radius: 18px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.30);
  aspect-ratio: 16 / 10;
}
#scanVideo{width:100%; height:100%; object-fit:cover}

.cat-rename{
  display:flex;
  gap:8px;
  align-items:center;
  justify-content:flex-end;
  margin-bottom: 8px;
}
.cat-rename__input{
  width: 180px;
  padding: 8px 10px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(15,24,38,.65);
  color: var(--text);
}

.reorder-actions{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  margin-top: 10px;
  flex-wrap:wrap;
}

.runout{margin-top: 12px}

@media (max-width: 900px){
  .grid{grid-template-columns: 1fr}
  .item-header{flex-direction:column; align-items:flex-start}
  .item-qty{text-align:left}
  .row{flex-direction:column; align-items:flex-start}
  .row__qty{text-align:left}
  .topbar__inner{flex-wrap:wrap}
  .photos__grid{grid-template-columns: repeat(2, minmax(0, 1fr))}
  .cat-rename{justify-content:flex-start}
  .cat-rename__input{width: 100%}
}
