:root {
  --fond: #f4f3ef; --card: #ffffff; --text: #1d1f1e; --slab: #6b706c; --linie: #dedbd2;
  --accent: #1f6f5c; --accent-t: #ffffff; --evid: #e8590c; --rau: #b42318; --umbra: 0 1px 3px rgba(0,0,0,.08);
  --scena: #e9e7e1;
}
@media (prefers-color-scheme: dark) {
  :root { --fond: #151716; --card: #1f2221; --text: #eceeed; --slab: #9aa19d; --linie: #333836;
    --accent: #4fb39a; --accent-t: #0d1412; --evid: #ff8a3d; --rau: #ff6b5e; --umbra: none; --scena: #262a28; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

header#sus { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: var(--accent); color: var(--accent-t); }
#titlu { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#tCod { font-size: 22px; line-height: 1.1; letter-spacing: .5px; }
#tSub { font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic { width: 40px; height: 40px; border: 0; border-radius: 10px; background: rgba(255,255,255,.16);
  font-size: 26px; line-height: 1; display: grid; place-items: center; cursor: pointer; }

main { max-width: 760px; margin: 0 auto; padding: 0 0 calc(24px + env(safe-area-inset-bottom)); }
#ecranLista { padding: 12px 16px; }
#mesaj:not(:empty) { padding: 12px 16px 0; }
#mesaj .card { margin: 0; }

.card { background: var(--card); border: 1px solid var(--linie); border-radius: 12px; box-shadow: var(--umbra);
  padding: 14px 16px; margin: 0 0 12px; }
.card h2 { font-size: 17px; margin: 0 0 6px; }
.card p { margin: 0 0 8px; color: var(--slab); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  padding: 0 16px; border-radius: 10px; border: 1px solid var(--linie); background: var(--card); cursor: pointer; }
.btn.prim { background: var(--accent); color: var(--accent-t); border-color: var(--accent); font-weight: 600; }
.rand-btn { display: flex; flex-wrap: wrap; gap: 8px; }
.mesaj-rau { border-color: var(--rau); }
.mesaj-rau h2 { color: var(--rau); }

ul.lista { list-style: none; margin: 0; padding: 0; }
ul.lista li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--linie); cursor: pointer; }
ul.lista li:first-child { border-top: 0; }
ul.lista .cod { font-weight: 700; min-width: 58px; }
ul.lista .nume { flex: 1; min-width: 0; }
ul.lista .dim { color: var(--slab); font-size: 14px; white-space: nowrap; }
ul.lista .sterge { border: 0; background: none; color: var(--slab); font-size: 20px; padding: 4px 8px; cursor: pointer; }
.pata { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(0,0,0,.2); flex: none; display: inline-block; }
.pata.mare { width: 28px; height: 28px; border-radius: 6px; }
.mat { display: inline-flex; align-items: center; gap: 8px; }
.cod-mic { color: var(--slab); font-size: 13px; white-space: nowrap; }
details.corp { border-top: 1px solid var(--linie); }
details.corp:first-of-type { border-top: 0; }
details.corp summary { padding: 10px 0; font-weight: 600; cursor: pointer; }

#scena { position: relative; height: 56vh; min-height: 300px; max-height: 560px; background: var(--scena); touch-action: none; }
#c3d { width: 100%; height: 100%; display: block; }
#niveluri { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex;
  background: var(--card); border: 1px solid var(--linie); border-radius: 12px; padding: 3px; box-shadow: var(--umbra); }
#niveluri button { border: 0; background: none; padding: 8px 12px; border-radius: 9px; font-size: 14px; cursor: pointer; }
#niveluri button.on { background: var(--accent); color: var(--accent-t); font-weight: 600; }
#bAR { position: absolute; right: 10px; top: 10px; min-height: 38px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--linie); background: var(--card); font-size: 14px; font-weight: 600; cursor: pointer; }

#fisa, #detalii { margin: 12px 16px 0; }
#fisa svg { width: 100%; height: auto; display: block; }
#fisa .leg { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--slab); margin-top: 6px; }
#fisa .leg i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
table.det { width: 100%; border-collapse: collapse; font-size: 15px; }
table.det td { padding: 7px 0; border-top: 1px solid var(--linie); vertical-align: top; }
table.det tr:first-child td { border-top: 0; }
table.det td:first-child { color: var(--slab); width: 38%; padding-right: 10px; }

#scanare, #arStrat { position: fixed; inset: 0; z-index: 20; }
#scanare { background: #000; }
#video { width: 100%; height: 100%; object-fit: cover; }
#scanare .cadru { position: absolute; left: 50%; top: 50%; width: 64vmin; height: 64vmin; transform: translate(-50%, -50%);
  border: 3px solid rgba(255,255,255,.9); border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
#bScanStop, #arStop { position: absolute; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  min-height: 46px; padding: 0 22px; border-radius: 12px; border: 0; background: #fff; color: #111; font-weight: 600; }
#arStrat { pointer-events: none; }
#arStrat button { pointer-events: auto; }
#arMesaj { position: absolute; left: 16px; right: 16px; top: calc(16px + env(safe-area-inset-top)); padding: 10px 14px;
  border-radius: 12px; background: rgba(0,0,0,.6); color: #fff; font-size: 15px; text-align: center; }
