:root { --bg:#f4f6f8; --card:#fff; --ink:#1f2933; --muted:#616e7c; --line:#d9e2ec; --primary:#1565c0; --ok:#2e7d32; --warn:#b26a00; --bad:#c62828; --nav-h:60px; }
* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; font:16px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; background:var(--bg); color:var(--ink); }
.top { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 16px; background:#0d2b55; color:#fff; flex-wrap:wrap; padding-top:max(10px, env(safe-area-inset-top)); }
.brand { font-weight:700; font-size:17px; }
nav { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
nav a { color:#fff; text-decoration:none; padding:8px 12px; border-radius:8px; }
nav a.active, nav a:hover { background:rgba(255,255,255,.15); }
main { max-width:1100px; margin:0 auto; padding:16px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:16px; margin-bottom:14px; }
h1 { font-size:20px; margin:0 0 10px; } h2 { font-size:16px; margin:0 0 8px; }
label { display:block; font-size:13px; color:var(--muted); margin:8px 0 4px; }
input, select, textarea, button { font:inherit; }
input[type=text], input[type=password], input[type=date], select, textarea { width:100%; padding:11px 12px; border:1px solid var(--line); border-radius:10px; background:#fff; font-size:16px; min-height:44px; }
input[type=file] { width:100%; padding:10px; border:1px dashed var(--line); border-radius:10px; background:#fff; }
textarea { min-height:160px; font-family:ui-monospace,Consolas,monospace; font-size:14px; }
.row { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:12px; }
.btn { padding:11px 16px; border-radius:10px; border:1px solid var(--line); background:#fff; cursor:pointer; min-height:44px; }
.btn.primary { background:var(--primary); color:#fff; border-color:var(--primary); }
.btn.link { background:none; border:none; color:#fff; text-decoration:underline; min-height:0; padding:6px 8px; }
.btn:disabled { opacity:.5; cursor:not-allowed; }
.btn.small { padding:7px 11px; font-size:14px; min-height:36px; }
.banner { padding:10px 12px; border-radius:10px; margin:10px 0; border:1px solid; }
.banner.ok { background:#e8f5e9; border-color:#a5d6a7; color:var(--ok); }
.banner.warn { background:#fff8e1; border-color:#ffe082; color:var(--warn); }
.banner.bad { background:#ffebee; border-color:#ef9a9a; color:var(--bad); }
.muted { color:var(--muted); font-size:13px; }
.thumbs { display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
.thumb { width:110px; border:1px solid var(--line); border-radius:8px; padding:4px; background:#fff; font-size:12px; text-align:center; }
.thumb img { width:100%; height:130px; object-fit:cover; border-radius:6px; display:block; }
.thumb.bad { border-color:#ef9a9a; background:#ffebee; }
table { width:100%; border-collapse:collapse; font-size:14px; }
th, td { padding:8px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
th { background:#f0f4f8; font-weight:600; position:sticky; top:0; }
td.num, th.num { text-align:right; white-space:nowrap; }
.tag { display:inline-block; padding:2px 7px; border-radius:999px; font-size:12px; background:#eceff1; }
.tag.pic_only { background:#ffebee; color:var(--bad); } .tag.sheet_only { background:#fff3e0; color:var(--warn); }
.tag.qty_diff { background:#fff8e1; color:#8d6e00; } .tag.unknown { background:#ede7f6; color:#4527a0; } .tag.match { background:#e8f5e9; color:var(--ok); }
.tag.done { background:#e8f5e9; color:var(--ok); } .tag.uploaded { background:#e3f2fd; color:var(--primary); } .tag.failed { background:#ffebee; color:var(--bad); }
.steps { padding-left:20px; } .steps li { margin:4px 0; }
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:8px; margin:10px 0; }
.stat { background:#f0f4f8; border-radius:10px; padding:8px 10px; } .stat b { display:block; font-size:18px; } .stat span { font-size:12px; color:var(--muted); }
.hidden { display:none !important; }
.toast { position:fixed; left:50%; bottom:calc(20px + env(safe-area-inset-bottom)); transform:translateX(-50%); background:#1f2933; color:#fff; padding:10px 16px; border-radius:10px; max-width:90vw; z-index:50; }
.scroll { overflow-x:auto; -webkit-overflow-scrolling:touch; }
.login { max-width:380px; margin:40px auto; }
pre.prompt { white-space:pre-wrap; word-break:break-word; font-size:12px; max-height:260px; overflow:auto; background:#f8fafc; border:1px solid var(--line); border-radius:8px; padding:10px; }
.actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }

/* ───────── searchable select (app.js searchable()) ───────── */
.ss { position:relative; }
.ss select.ss-src { display:none; }
.ss-input { padding-right:34px; background-image:linear-gradient(45deg,transparent 50%,#616e7c 50%),linear-gradient(135deg,#616e7c 50%,transparent 50%); background-position:calc(100% - 18px) 50%,calc(100% - 13px) 50%; background-size:5px 5px; background-repeat:no-repeat; }
.ss-list { position:absolute; left:0; right:0; top:100%; z-index:30; max-height:280px; overflow:auto; background:#fff; border:1px solid var(--line); border-radius:10px; box-shadow:0 8px 24px rgba(0,0,0,.12); margin-top:4px; }
.ss-group { padding:6px 12px 2px; font-size:11px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); background:#f8fafc; }
.ss-item { padding:10px 12px; cursor:pointer; min-height:40px; }
.ss-item:hover, .ss-item.sel { background:#e3f2fd; }
.ss-empty { padding:10px 12px; color:var(--muted); font-size:13px; }

/* ───────── phones (7-Oct): bottom navigation, stacked rows, full-width buttons ───────── */
@media (max-width:640px) {
  main { padding:12px 12px calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); }
  .card { padding:12px; border-radius:10px; }
  h1 { font-size:18px; }
  .top { padding:8px 12px; }
  .top #who { display:none; }
  nav { position:fixed; left:0; right:0; bottom:0; z-index:40; background:#0d2b55; margin:0; gap:0; padding:0 0 env(safe-area-inset-bottom); height:calc(var(--nav-h) + env(safe-area-inset-bottom)); border-top:1px solid rgba(255,255,255,.15); }
  nav a, nav .btn.link { flex:1; display:flex; align-items:center; justify-content:center; height:var(--nav-h); border-radius:0; padding:0; font-size:13px; text-decoration:none; }
  nav a.active { background:rgba(255,255,255,.18); box-shadow:inset 0 3px 0 #fff; }
  .actions .btn, .actions > * { flex:1 1 100%; }
  .actions .muted { flex-basis:100%; }
  .thumb { width:calc(33.33% - 6px); } .thumb img { height:120px; }
  .stats { grid-template-columns:repeat(2,1fr); }
  .toast { left:12px; right:12px; transform:none; max-width:none; text-align:center; }
  /* every table becomes a list of cards; td labels come from data-label (app.js stack()) */
  table.stack, table.stack tbody, table.stack tr, table.stack td { display:block; width:100%; }
  table.stack thead, table.stack tr.head, table.stack th { display:none; }
  table.stack tr { border:1px solid var(--line); border-radius:10px; margin-bottom:8px; padding:6px 10px; background:#fff; }
  table.stack tr.total { background:#f0f4f8; font-weight:600; }
  table.stack td { border:none; padding:4px 0; display:flex; justify-content:space-between; gap:10px; text-align:right; }
  table.stack td::before { content:attr(data-label); color:var(--muted); font-size:12px; text-align:left; flex:0 0 42%; }
  table.stack td:empty { display:none; }
  table.stack td.main { font-weight:600; text-align:left; }
  table.stack td.main::before { display:none; }
}
@media (min-width:641px) { nav .btn.link { color:#fff; } }
