/* Lenehans Mobile Warehouse - Stage 1 - mobile-first */
:root {
    --green: #1a6b3c;
    --green-dark: #12502c;
    --bg: #f4f6f5;
    --card: #ffffff;
    --text: #1c2320;
    --muted: #67736d;
    --line: #dde3df;
    --error: #b3261e;
    --error-bg: #fdeceb;
    --ok-bg: #e6f4ea;
    --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Top bar */
.topbar { background: var(--green); color: #fff; position: sticky; top: 0; z-index: 20;
          padding-top: env(safe-area-inset-top); }
.topbar-inner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.brand { font-weight: 700; font-size: 16px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-badge { background: rgba(255,255,255,.18); border-radius: 999px; padding: 3px 10px;
             font-size: 12px; white-space: nowrap; }
.menu-btn { background: none; border: none; color: #fff; font-size: 22px; padding: 2px 6px; cursor: pointer; }
.menu { background: var(--green-dark); display: flex; flex-direction: column; }
.menu a, .menu .linklike { color: #fff; text-decoration: none; padding: 13px 16px;
    border-top: 1px solid rgba(255,255,255,.12); background: none; border-left: none;
    border-right: none; border-bottom: none; font-size: 15px; text-align: left; width: 100%; cursor: pointer; }
.menu a:active, .menu .linklike:active { background: rgba(255,255,255,.1); }

/* Layout */
.container { max-width: 640px; margin: 0 auto; padding: 16px 14px 40px; }
.page-title { font-size: 22px; margin: 6px 0 12px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.warn-text { color: var(--error); font-weight: 600; }
hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

/* Cards & forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 16px; margin: 12px 0; }
.card h2 { font-size: 15px; margin: 4px 0 10px; }
label { display: block; font-size: 13.5px; font-weight: 600; margin: 12px 0 5px; }
input[type=text], input[type=password], input[type=number], select {
    width: 100%; padding: 12px; font-size: 16px; border: 1px solid var(--line);
    border-radius: 8px; background: #fff; color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 14px 0; padding: 10px 12px 12px; }
legend { font-size: 13px; font-weight: 700; padding: 0 4px; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 400; font-size: 15px;
         margin: 9px 0; }
.check input { width: 20px; height: 20px; flex: none; }

/* Buttons */
.btn { display: inline-block; padding: 13px 18px; border-radius: 9px; font-size: 15.5px;
       font-weight: 600; border: none; cursor: pointer; text-decoration: none; text-align: center; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:active { background: var(--green-dark); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { display: block; width: 100%; margin-top: 16px; }

/* Alerts */
.alert { border-radius: 9px; padding: 12px 14px; margin: 12px 0; font-size: 14.5px; }
.alert-success { background: var(--ok-bg); border: 1px solid #b5dcc2; }
.alert-error { background: var(--error-bg); border: 1px solid #f2b8b5; color: var(--error); }

/* Login */
.login-wrap { max-width: 380px; margin: 8vh auto 0; }
.login-logo { text-align: center; }
.login-logo img { border-radius: 18px; }
.login-title { text-align: center; font-size: 19px; margin: 12px 0 4px; }

/* Awaiting */
.center-card { text-align: center; margin-top: 8vh; }
.big-icon { font-size: 44px; }

/* Dashboard tiles */
.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 18px 12px; text-align: center; text-decoration: none; color: var(--text); }
.tile:active { background: #eef3ef; }
.tile-icon { font-size: 30px; }
.tile-label { font-weight: 600; font-size: 14.5px; margin-top: 8px; }
.tile-note { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.tile-disabled { opacity: .45; pointer-events: none; }

/* Lists (users) */
.list { margin-top: 10px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 13px 14px; margin-bottom: 9px; text-decoration: none; color: var(--text); }
.list-row:active { background: #eef3ef; }
.list-primary { font-weight: 600; font-size: 15px; display: flex; align-items: center;
                gap: 7px; flex-wrap: wrap; }
.list-secondary { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.chev { color: var(--muted); font-size: 22px; }
.pill { border-radius: 999px; font-size: 10.5px; font-weight: 700; padding: 2px 8px;
        text-transform: uppercase; letter-spacing: .3px; }
.pill-operator { background: #e8eef9; color: #23539e; }
.pill-supervisor { background: #fdf1dd; color: #8a5a00; }
.pill-admin { background: #efe4f7; color: #6a2d91; }
.pill-inactive { background: #eee; color: #777; }

/* Connection page */
.map-row { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line);
           font-size: 14px; align-items: flex-start; }
.map-row:first-of-type { border-top: none; }

/* ===== Stage 2: search, scanner, item screen ===== */
.search-row { display: flex; gap: 8px; align-items: stretch; }
.search-row input { flex: 1; }
.scan-btn { flex: none; width: 52px; font-size: 22px; padding: 0; }

.scanner-wrap { padding: 10px; }
.scanner-head { display: flex; justify-content: space-between; align-items: center;
                font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.scanner-wrap video { width: 100%; border-radius: 8px; background: #000; max-height: 46vh; object-fit: cover; }
.mini-btn { background: #eef3ef; border: 1px solid var(--line); border-radius: 7px;
            font-size: 15px; padding: 5px 9px; margin-left: 6px; cursor: pointer; }
.torch-on { background: #ffe9a8; }

.row-thumb { width: 42px; height: 42px; border-radius: 7px; object-fit: cover;
             background: #eef3ef; flex: none; }
.row-thumb-ph { display: inline-flex; align-items: center; justify-content: center; font-size: 20px; }
.row-main { flex: 1; min-width: 0; }
.row-main .list-primary { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#results .list-row { gap: 11px; }

.back-link { display: inline-block; color: var(--green); text-decoration: none;
             font-weight: 600; margin-bottom: 6px; }

.item-card { padding: 14px; }
.item-head { display: flex; gap: 13px; }
.item-img { width: 78px; height: 78px; border-radius: 10px; object-fit: cover;
            background: #eef3ef; flex: none; }
.item-img-placeholder { display: flex; align-items: center; justify-content: center; font-size: 34px; }
.item-headings { min-width: 0; }
.item-title { font-size: 17px; margin: 0 0 6px; line-height: 1.25; }
.item-sku, .item-barcode { font-size: 13px; color: var(--muted); }

.section-label { font-size: 13px; font-weight: 700; text-transform: uppercase;
                 letter-spacing: .3px; color: var(--muted); margin: 18px 2px 8px;
                 display: flex; align-items: center; gap: 8px; }
.fresh-badge { color: #1a6b3c; font-size: 11px; font-weight: 700; text-transform: none; letter-spacing: 0; }
.stale-badge { color: #8a5a00; font-size: 11px; font-weight: 700; text-transform: none; letter-spacing: 0; }

.level-card { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.level-loc { font-weight: 700; font-size: 15px; }
.level-figures { display: flex; gap: 22px; }
.figure { text-align: center; }
.figure-num { font-size: 26px; font-weight: 800; line-height: 1; }
.figure-num.small-num { font-size: 17px; font-weight: 700; }
.figure-label { font-size: 11px; color: var(--muted); margin-top: 3px; }

.action-grid { display: grid; grid-template-columns: 1fr; gap: 9px; margin: 18px 0 8px; }
.btn-disabled { background: #eef3ef; color: #9aa5a0; border: 1px solid var(--line);
                display: flex; justify-content: space-between; align-items: center; }
.stage-tag { font-size: 10.5px; background: #dfe6e1; border-radius: 999px; padding: 2px 8px; color: #6b756f; }
.text-center { text-align: center; }
