/* attotempo tools, RFID: one stylesheet for the office pages (index.html) and the handheld (handheld.html).
   No outside files (fonts, frameworks), so the pages load fast in China through the VPN and on the
   handheld's Wi-Fi. Light and dark follow the device's setting. */
:root {
    --bg: #f4f5f7; --panel: #ffffff; --panel-2: #f9fafb; --ink: #111827; --muted: #6b7280; --line: #e5e7eb;
    --accent: #2563eb; --accent-2: #1d4ed8; --accent-ink: #ffffff; --accent-soft: #eff4ff;
    --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
    --ok-bg: #ecfdf3; --warn-bg: #fff7e6; --bad-bg: #fef2f2; --info-bg: #eff4ff;
    --side: #0f172a; --side-ink: #cbd5e1; --side-muted: #64748b; --side-active: #1e293b;
    --radius: 12px; --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1120; --panel: #111827; --panel-2: #0f1624; --ink: #e5e7eb; --muted: #9ca3af; --line: #1f2937;
        --accent: #3b82f6; --accent-2: #60a5fa; --accent-ink: #ffffff; --accent-soft: #172554;
        --ok: #4ade80; --warn: #fbbf24; --bad: #f87171;
        --ok-bg: #052e1a; --warn-bg: #2b1d05; --bad-bg: #2c0f12; --info-bg: #111c33;
        --side: #070b14; --side-active: #111a2e;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
        color-scheme: dark;
    }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; font-weight: 700; } h2 { font-size: 1.1rem; font-weight: 650; } h3 { font-size: .98rem; font-weight: 650; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
p { margin: 0 0 .6em; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .84em; word-break: break-all; }
.hidden { display: none !important; }
.spacer { flex: 1; }
svg.icon { width: 18px; height: 18px; flex: none; }

/* ---------- app shell: sidebar + page ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 1.02rem; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #3b82f6, #6366f1); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: .95rem; }
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--side-muted); letter-spacing: .02em; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--side-active); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 #3b82f6; }
.nav a .count { margin-left: auto; background: #1d4ed8; color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 7px; font-weight: 600; }
.side-foot { margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid rgba(148, 163, 184, .15); display: flex; flex-direction: column; gap: 10px; font-size: .84rem; }
.side-foot label { display: flex; flex-direction: column; gap: 4px; color: var(--side-muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; }
.side-foot select { background: var(--side-active); color: #fff; border-color: rgba(148, 163, 184, .25); }
.who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 999px; background: #334155; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.who .name { color: #fff; font-weight: 600; line-height: 1.2; }
.who .role { color: var(--side-muted); font-size: .76rem; }
.side-foot button { background: transparent; color: var(--side-ink); border-color: rgba(148, 163, 184, .3); }
.side-foot button:hover { background: var(--side-active); }
.page { min-width: 0; }
.topbar { display: none; }
.content { max-width: 1240px; margin: 0 auto; padding: 26px 32px 60px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .titles { flex: 1 1 360px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.env { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #422006; color: #fcd34d; margin-left: 6px; }
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
    .app.menu-open .sidebar { transform: none; }
    .app.menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 30; }
    .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 20; }
    .topbar button { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .25); }
    .content { padding: 18px 16px 48px; }
}

/* ---------- cards, grids ---------- */
.panel, .card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .muted { font-size: .84rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grid2 > .panel, .grid2 > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.kpi .value { font-size: 1.7rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: .8rem; }
.empty { text-align: center; color: var(--muted); padding: 22px 12px; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .meta { color: var(--muted); font-size: .84rem; }
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 10px; }
.checklist .dot { width: 22px; height: 22px; border-radius: 999px; border: 2px solid var(--line); display: grid; place-items: center; font-size: .75rem; flex: none; }
.checklist li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist li.done span.text { color: var(--muted); text-decoration: line-through; }

/* ---------- forms and buttons ---------- */
label.field { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; font-weight: 500; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 11px; min-height: 38px; }
input[type=checkbox], input[type=radio] { min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
button, .button { font: inherit; font-weight: 550; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: var(--radius-sm); padding: 8px 14px; cursor: pointer; min-height: 38px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
button:hover, .button:hover { background: var(--panel-2); text-decoration: none; }
button:focus-visible, .button:focus-visible, .nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover, .button.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
button.ghost { border-color: transparent; background: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { border: 0; background: none; color: var(--accent); padding: 0 4px; min-height: 0; font-weight: 500; }
button.small, .button.small { min-height: 30px; padding: 4px 10px; font-size: .84rem; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: .94rem; white-space: nowrap; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--panel); }
.segmented a, .segmented button { border: 0; border-radius: 0; padding: 7px 14px; color: var(--muted); font-weight: 550; min-height: 36px; background: transparent; }
.segmented a + a, .segmented button + button { border-left: 1px solid var(--line); }
.segmented .active { background: var(--accent-soft); color: var(--accent); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; background: var(--panel-2); }
td.mono { white-space: nowrap; word-break: normal; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--accent-soft); }

/* ---------- badges, messages ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--info-bg); color: var(--accent); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.grey { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.note { padding: 11px 14px; border-radius: var(--radius-sm); background: var(--info-bg); margin: 8px 0; border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent); }
.note.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.note.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.note.bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #111827; color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 60; max-width: min(92vw, 560px); box-shadow: var(--shadow-lg); font-weight: 500; }
#toast.bad { background: #b91c1c; }
dialog { border: 0; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-lg); background: var(--panel); color: var(--ink); max-width: min(92vw, 440px); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }
.code-big { font: 700 2.6rem/1 ui-monospace, Consolas, monospace; letter-spacing: .18em; text-align: center; padding: 14px; background: var(--panel-2); border-radius: var(--radius-sm); border: 1px dashed var(--line); }

/* ---------- sign-in ---------- */
.center-card { max-width: 400px; margin: 10vh auto; }

/* ---------- label preview and designer ---------- */
.label-preview { background: #fff; border: 1px dashed #9aa5b4; border-radius: 4px; display: inline-block; max-width: 100%; }
.label-preview svg { display: block; max-width: 100%; height: auto; }
.designer-field { display: grid; grid-template-columns: 1.6fr .7fr .8fr 1.4fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
@media (max-width: 700px) { .designer-field { grid-template-columns: 1fr 1fr; } }

/* ---------- steps (print) and guided printing ---------- */
.step-num { width: 26px; height: 26px; border-radius: 999px; background: var(--accent); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: .86rem; flex: none; }
.guide { border: 2px solid var(--accent); border-radius: var(--radius); padding: 22px; background: var(--panel); box-shadow: var(--shadow); }
.guide .big { font-size: 1.5rem; font-weight: 750; margin: 6px 0 10px; }
.progress { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width .3s; }

/* ================================================================
   Handheld (Urovo DT50P, about 5.5" screen): big, clear, one hand
   ================================================================ */
.hh { background: var(--bg); }
.hh-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--side); color: #fff; }
.hh-bar .title { font-weight: 700; font-size: 1.05rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hh-bar button { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .25); min-height: 40px; }
.hh-bar select { background: #1e293b; color: #fff; border-color: rgba(255, 255, 255, .2); max-width: 46vw; }
.hh-bar .place { font-size: .8rem; background: #1e293b; padding: 4px 10px; border-radius: 999px; white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.hh main { padding: 12px 12px 90px; max-width: 640px; margin: 0 auto; }
.hh .whoami { display: flex; align-items: center; gap: 10px; padding: 4px 2px 12px; }
.hh .whoami .avatar { background: var(--accent); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px; min-height: 104px; padding: 14px; text-align: left; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); white-space: normal; font-weight: 650; font-size: 1.02rem; }
.tile svg { width: 26px; height: 26px; color: var(--accent); }
.tile span.sub { display: block; font-size: .78rem; font-weight: 450; color: var(--muted); margin-top: 2px; }
.tile.wide { grid-column: 1 / -1; min-height: 84px; flex-direction: row; align-items: center; justify-content: flex-start; }
.tile.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.tile.primary svg, .tile.primary span.sub { color: rgba(255, 255, 255, .85); }
.section-title { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 2px 8px; font-weight: 650; }
.hh .counter { font-size: 3.6rem; font-weight: 800; text-align: center; line-height: 1; margin: 8px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border-radius: 999px; min-height: 40px; padding: 6px 14px; }
.chips button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.hh #scanInput { width: 100%; font-size: 1rem; }
.pick-card { width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 3px; text-align: left; padding: 13px 14px; white-space: normal; border-radius: 12px; }
.pick-card > span { display: block; }
.hh-foot { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--panel) 92%, transparent); border-top: 1px solid var(--line); backdrop-filter: blur(6px); display: flex; gap: 8px; z-index: 10; }
.hh-foot button { flex: 1; min-height: 52px; font-size: 1.02rem; }
.reader-line { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--muted); padding: 6px 2px; }
.reader-line .led { width: 10px; height: 10px; border-radius: 999px; background: var(--muted); flex: none; }
.reader-line .led.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.reader-line .led.reading { background: #f59e0b; animation: pulse 1s infinite; }
.reader-line .led.off { background: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { min-height: 58px; font-size: 1.4rem; font-weight: 650; border-radius: 12px; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 12px 0 16px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 999px; border: 2px solid var(--muted); }
.pin-dots span.on { background: var(--ink); border-color: var(--ink); }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.names button { min-height: 56px; justify-content: flex-start; white-space: normal; text-align: left; }
.code-input { font: 700 2rem/1 ui-monospace, Consolas, monospace; letter-spacing: .3em; text-align: center; width: 100%; padding: 14px; }

/* Find: a big gauge that fills as you get closer */
.finder { text-align: center; padding: 18px 14px 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); transition: background .2s, border-color .2s; }
.finder.warm { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.finder.hot { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.finder .big { font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.finder .gauge { width: 220px; max-width: 70vw; margin: 6px auto 0; display: block; }
.finder .pct { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: -58px; }
.finder .trend { font-weight: 700; font-size: 1.05rem; min-height: 1.5em; }
.finder .trend.up { color: var(--ok); } .finder .trend.down { color: var(--bad); }
.meter { height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.meter > div { height: 100%; background: var(--ok); width: 0; transition: width .15s; }
.spark { width: 100%; height: 40px; display: block; margin-top: 8px; }
.nav a.active-group { color: #fff; }
