/* WM - stil comun pentru ecranele de telefon / tableta */
:root {
  --bg: #f3f4f6; --surface: #ffffff; --ink: #111827; --muted: #6b7280; --line: #e5e7eb;
  --brand: #1e3a5f; --brand-soft: #e8eef6; --accent: #2563eb;
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7;
  --bad: #b91c1c; --bad-soft: #fee2e2;
  /* sarcini: 📤 picking (iei de pe raft) = portocaliu, 📥 punere pe raft (intrare) = verde */
  --task-out: #c2410c; --task-out-soft: #ffedd5; --task-in: #15803d; --task-in-soft: #dcfce7;
  --radius: 16px; --shadow: 0 1px 2px rgba(17,24,39,.06), 0 4px 16px rgba(17,24,39,.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
.mono { font-family: ui-monospace, "SF Mono", "Roboto Mono", Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* ---------- bara de sus */
.appbar {
  position: sticky; top: 0; z-index: 20; height: 56px; padding: 0 12px;
  display: flex; align-items: center; gap: 8px;
  background: var(--brand); color: #fff;
}
.appbar .back { color: #fff; font-size: 28px; line-height: 1; padding: 4px 8px 6px 2px; }
.appbar .title { font-weight: 650; font-size: 1.05rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .user { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.18);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem; text-transform: uppercase;
}
.appbar form { margin: 0; }
.appbar .logout { background: none; border: 0; color: rgba(255,255,255,.85); font-size: .85rem; padding: 6px 2px; }

main.page { padding: 14px 14px 110px; max-width: 640px; margin: 0 auto; }
main.page.wide { max-width: 1100px; }

/* ---------- carduri si liste */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.section-title { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 4px 8px; }
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .main { flex: 1; min-width: 0; }
.list-item .name { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-item .sub { font-size: .82rem; color: var(--muted); }
button.list-item { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; font: inherit; color: inherit; }
button.list-item:active { background: var(--brand-soft); }
.empty { padding: 18px 14px; color: var(--muted); text-align: center; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
        font-weight: 700; font-size: .9rem; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.card.task-out { border-left: 6px solid var(--task-out); }
.card.task-in { border-left: 6px solid var(--task-in); }
.pill.task-out { background: var(--task-out-soft); color: var(--task-out); }
.pill.task-in { background: var(--task-in-soft); color: var(--task-in); }
.package-label { margin-top: 6px; padding: 6px 10px; border-radius: 8px; background: #fef3c7; border: 1px solid #f59e0b; color: #78350f; }
.package-label.big { font-size: 1.15em; padding: 10px 12px; }
.btn.task-in-btn { background: var(--task-in); color: #fff; }
.card.warn { background: var(--warn-soft); }
button.chip { border: 0; font: inherit; color: inherit; cursor: pointer; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px;
         padding: 0 7px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .8rem; font-weight: 800; }
.tile.alert { background: var(--bad); color: #fff; }
.tile.alert .desc { color: rgba(255,255,255,.85); }
.tile.alert .badge { background: #fff; color: var(--bad); }
.btn.alert-btn { background: var(--bad); color: #fff; }
.btn.scan-shelf-btn { width: 52px; min-height: 50px; padding: 0; flex: none; font-size: 1.3rem; }
.btn.scan-shelf-btn.on { background: var(--accent); color: #fff; }
.issue { margin-top: 8px; padding: 8px 10px; border-radius: 12px; font-size: .92rem; }
.issue.open { background: var(--bad-soft); color: #7f1d1d; }
.issue.done { background: #f3f4f6; }
details.issue-box > summary { list-style: none; cursor: pointer; }
details.issue-box > summary::-webkit-details-marker { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border-radius: 10px;
        background: #f3f4f6; font-size: .88rem; }
.chip b { font-weight: 700; }

/* ---------- butoane si campuri */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px;
       padding: 0 18px; border: 0; border-radius: 14px; font: inherit; font-size: 1.05rem; font-weight: 700;
       background: var(--brand); color: #fff; }
.btn:active { transform: scale(.98); }
.btn.ghost { background: #eef0f3; color: var(--ink); }
.btn:disabled { opacity: .5; }
.row-btns { display: flex; gap: 10px; }
.row-btns .btn { flex: 1; }
.field { width: 100%; min-height: 50px; padding: 0 14px; font: inherit; font-size: 1rem; color: var(--ink);
         background: var(--surface); border: 1px solid var(--line); border-radius: 14px; outline: none; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.search { position: relative; }
.search .field { padding-left: 42px; }
.search::before { content: ""; position: absolute; left: 14px; top: 50%; width: 16px; height: 16px; margin-top: -9px;
  border: 2px solid var(--muted); border-radius: 50%; }
.search::after { content: ""; position: absolute; left: 28px; top: 50%; width: 7px; height: 2px; margin-top: 6px;
  background: var(--muted); transform: rotate(45deg); }

/* ---------- camera */
.cam { position: relative; background: #0b0f14; border-radius: 18px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 40vh; width: 100%; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam .corners { position: absolute; inset: 18% 12%; pointer-events: none; }
.cam .corners i { position: absolute; width: 28px; height: 28px; border: 0 solid #fff; }
.cam .corners i:nth-child(1) { left: 0; top: 0; border-left-width: 4px; border-top-width: 4px; border-top-left-radius: 10px; }
.cam .corners i:nth-child(2) { right: 0; top: 0; border-right-width: 4px; border-top-width: 4px; border-top-right-radius: 10px; }
.cam .corners i:nth-child(3) { left: 0; bottom: 0; border-left-width: 4px; border-bottom-width: 4px; border-bottom-left-radius: 10px; }
.cam .corners i:nth-child(4) { right: 0; bottom: 0; border-right-width: 4px; border-bottom-width: 4px; border-bottom-right-radius: 10px; }
.cam .laser { position: absolute; left: 14%; right: 14%; top: 50%; height: 2px; background: rgba(239,68,68,.9);
              box-shadow: 0 0 8px rgba(239,68,68,.8); animation: laser 2.2s ease-in-out infinite; }
@keyframes laser { 0%,100% { transform: translateY(-38px); } 50% { transform: translateY(38px); } }
.cam .overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
                gap: 10px; color: #fff; background: rgba(11,15,20,.72); border: 0; width: 100%; font: inherit; font-weight: 600; }
.cam .overlay .icon { font-size: 34px; }
.cam.idle .laser, .cam.paused .laser { display: none; }

/* ---------- locatia curenta */
.loc { display: flex; align-items: center; gap: 12px; }
.loc .pin { width: 46px; height: 46px; border-radius: 14px; background: var(--brand-soft); display: grid; place-items: center; font-size: 22px; flex: none; }
.loc .code { font-size: 1.7rem; font-weight: 800; letter-spacing: .02em; line-height: 1.1; }
.loc.none { border: 2px dashed #cbd5e1; box-shadow: none; background: transparent; }
.loc.none .code { font-size: 1.05rem; font-weight: 650; color: var(--muted); }
.flash { animation: flash .9s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 4px rgba(21,128,61,.45); } to { box-shadow: var(--shadow); } }

/* ---------- panou de jos (bottom sheet) */
.backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.backdrop.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface);
         border-radius: 22px 22px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
         box-shadow: 0 -8px 30px rgba(17,24,39,.18); transform: translateY(105%); transition: transform .25s ease;
         max-width: 640px; margin: 0 auto; max-height: 88vh; overflow-y: auto; }
.sheet.open { transform: translateY(0); }
.sheet .handle { width: 42px; height: 5px; border-radius: 3px; background: #d1d5db; margin: 0 auto 12px; }
.sheet h3 { margin: 0 0 4px; font-size: 1.15rem; line-height: 1.3; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.stat { background: #f6f7f9; border-radius: 12px; padding: 8px 10px; }
.stat .label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.15rem; font-weight: 800; }
.stepper { display: flex; align-items: stretch; gap: 10px; margin: 6px 0 14px; }
.stepper button { width: 64px; border: 0; border-radius: 14px; background: #eef0f3; font-size: 1.8rem; font-weight: 700; color: var(--ink); }
.stepper button:active { background: #e2e5ea; }
.stepper input { flex: 1; min-width: 0; height: 64px; text-align: center; font: inherit; font-size: 2rem; font-weight: 800;
                 border: 2px solid var(--line); border-radius: 14px; outline: none; }
.stepper input:focus { border-color: var(--accent); }

/* ---------- mesaje scurte (toast) */
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 60;
         transform: translate(-50%, 140%); transition: transform .25s ease; max-width: calc(100% - 28px);
         padding: 12px 16px; border-radius: 14px; background: #111827; color: #fff; font-weight: 600;
         box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.show { transform: translate(-50%, 0); }
.toast.ok { background: var(--ok); } .toast.warn { background: var(--warn); } .toast.bad { background: var(--bad); }

/* ---------- acasa */
.hello { margin: 6px 4px 14px; }
.hello h1 { margin: 0; font-size: 1.4rem; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 16px; min-height: 112px; border-radius: var(--radius);
        background: var(--surface); box-shadow: var(--shadow); color: var(--ink); }
.tile .icon { font-size: 26px; }
.tile .label { font-weight: 700; }
.tile .desc { font-size: .82rem; color: var(--muted); }
.tile.primary { grid-column: 1 / -1; background: var(--brand); color: #fff; min-height: 120px; }
.tile.primary .desc { color: rgba(255,255,255,.75); }
.status-line { display: flex; align-items: center; gap: 8px; margin: 16px 4px; font-size: .85rem; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.dot.bad { background: var(--bad); }

/* ---------- formular login */
.login { max-width: 380px; margin: 8vh auto 0; }
.login .brand { text-align: center; margin-bottom: 18px; }
.login .brand .logo { width: 64px; height: 64px; border-radius: 18px; background: var(--brand); color: #fff; display: grid;
                      place-items: center; font-weight: 800; font-size: 1.3rem; margin: 0 auto 10px; }
.login label { display: block; font-size: .85rem; font-weight: 600; margin: 12px 2px 6px; }
.alert { padding: 10px 12px; border-radius: 12px; background: var(--bad-soft); color: var(--bad); font-weight: 600; }
