/* ALW Shop Floor — standalone worker app. Phone-first: big type, big touch
   targets, one column. Matches the ALW/DecoNetwork blue so it feels family. */

:root {
  --bg: #eef1f4;
  --card: #ffffff;
  --ink: #33383d;
  --muted: #7a828a;
  --line: #e2e6ea;
  --accent: #1683e2;
  --accent-hover: #1276cf;
  --accent-tint: rgba(22,131,226,.10);
  --green: #2e9e5b;  --green-bg: #e7f7ee;
  --red: #d9333f;    --red-bg: #fdecea;
  --danger: #d9333f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,40,80,.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px; line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 14px; }
h2 { font-size: 17px; font-weight: 700; margin: 22px 0 10px; }
.muted { color: var(--muted); font-size: 13px; }

/* ── App bar ──────────────────────────────────────────────────────── */
.bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  background: var(--accent); color: #fff; padding: 0 14px;
  height: 54px; padding-top: env(safe-area-inset-top);
}
.bar-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px; }
.bar-brand:hover { text-decoration: none; }
.bar-brand img { height: 32px; border-radius: 5px; background: #fff; padding: 2px; }
.bar-worker { margin-left: auto; font-size: 13.5px; font-weight: 600; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.bar-out { background: rgba(255,255,255,.16); border: 0; color: #fff; font: inherit; font-size: 13px; padding: 8px 12px; border-radius: 8px; cursor: pointer; }

/* ── Flash ────────────────────────────────────────────────────────── */
.flash { padding: 12px 18px; font-size: 14.5px; font-weight: 600; }
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-error { background: var(--red-bg); color: var(--red); }
.flash-info { background: var(--accent-tint); color: var(--accent); }

/* ── Layout ───────────────────────────────────────────────────────── */
.wrap { max-width: 760px; margin: 14px auto 40px; padding: 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.back { margin: 2px 0 10px; font-size: 14.5px; }

/* ── Buttons & forms ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 10px;
  color: var(--ink); font: inherit; font-weight: 600; font-size: 14.5px;
  padding: 11px 16px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn.big { font-size: 17px; padding: 14px 18px; width: 100%; }
.linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; padding: 0; }
.linkbtn.danger { color: var(--danger); }
input, textarea, select { font: inherit; font-size: 16px; color: var(--ink); }
textarea, input:not([type="radio"]):not([type="checkbox"]):not([type="file"]) {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
textarea:focus, input:focus { outline: none; border-color: var(--accent); }
label { font-weight: 600; font-size: 14px; display: block; }
label > input, label > textarea { margin-top: 6px; font-weight: 400; }

/* ── Login ────────────────────────────────────────────────────────── */
.login-wrap { max-width: 420px; text-align: center; margin-top: 8vh; }
.login-logo img { height: 64px; border-radius: 10px; background: #fff; padding: 6px; box-shadow: var(--shadow); }
.login-wrap h1 { margin: 14px 0 4px; }
.login-form { text-align: left; display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.login-error { color: var(--danger); font-weight: 700; margin: 12px 0 0; }

/* ── Order lookup ─────────────────────────────────────────────────── */
.find { display: flex; flex-direction: column; gap: 12px; }
.find label { font-size: 15px; }
.find input {
  font-size: 28px; text-align: center; letter-spacing: .06em; font-weight: 700;
  padding: 14px 12px; border: 2px solid var(--line); border-radius: 12px;
}
.find input:focus { border-color: var(--accent); }
.notfound { margin: 12px 0 0; color: var(--danger); font-weight: 700; }

/* ── Order header ─────────────────────────────────────────────────── */
.order-head { margin-bottom: 14px; }
.order-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-title h1 { margin: 0; }
.order-meta { display: flex; gap: 10px 26px; flex-wrap: wrap; margin: 12px 0 4px; }
.order-meta > div { display: flex; flex-direction: column; }
.order-meta .muted { font-size: 12px; }

.pill { display: inline-block; padding: 4px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 700; }
.pill-blue, .pill-blue-dark, .pill-purple, .pill-violet, .pill-teal { background: var(--accent-tint); color: var(--accent); }
.pill-yellow { background: #fdf6df; color: #9a7b0a; }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-gray { background: #f0f0f2; color: var(--muted); }
.pill-red { background: var(--red-bg); color: var(--red); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 12px; }
.table { border-collapse: collapse; width: 100%; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table .num, th.num { text-align: right; }

/* ── Option panels ────────────────────────────────────────────────── */
.panel { margin-top: 14px; padding: 0; overflow: hidden; }
.panel > summary {
  display: flex; align-items: center; gap: 14px; padding: 17px 16px;
  cursor: pointer; list-style: none; font-size: 15px; line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel[open] > summary { border-bottom: 1px solid var(--line); }
.opt-ico { font-size: 27px; flex: 0 0 auto; }
.count {
  margin-left: auto; min-width: 27px; height: 27px; padding: 0 9px; border-radius: 14px;
  background: var(--accent-tint); color: var(--accent); font-size: 13.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.count-red { background: var(--red-bg); color: var(--red); }
.form { display: flex; flex-direction: column; gap: 12px; padding: 16px; }

/* Kind pickers */
.kinds { display: flex; gap: 8px; flex-wrap: wrap; }
.kind { position: relative; }
.kind input { position: absolute; opacity: 0; pointer-events: none; }
.kind span {
  display: inline-flex; align-items: center; padding: 12px 16px; border-radius: 24px;
  border: 1.5px solid var(--line); font-size: 14.5px; font-weight: 600; cursor: pointer;
  background: #fff; color: #4a5157;
}
.kind input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Photos */
.photo-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.photo-pick span {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed #b9c4cd; border-radius: 12px; padding: 30px 14px;
  font-size: 16px; font-weight: 700; color: #4a5157; cursor: pointer; background: #fafcfe;
}
.photo-pick input:focus + span { border-color: var(--accent); color: var(--accent); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; padding: 14px 16px 16px; }
.photo { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.photo img { display: block; width: 100%; height: 130px; object-fit: cover; }
.photo figcaption { padding: 8px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; }

/* Lists */
.history { padding: 4px 16px 14px; }
.list-card { padding: 4px 16px; }
.item { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item-main { min-width: 0; }
.item-note { margin: 6px 0 4px; font-size: 14.5px; white-space: pre-wrap; }
.item-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.complete-note { margin: 0 0 12px; font-size: 15px; color: var(--green); font-weight: 700; }
.complete-btn { background: var(--green); border-color: var(--green); }

@media (max-width: 600px) {
  .item { flex-direction: column; }
  .item form, .item .btn, .item-actions { width: 100%; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* Machine files (DST downloads) */
.files-card { margin-top: 14px; padding: 4px 16px 8px; }
.files-head { display: flex; align-items: center; gap: 12px; padding: 13px 0 4px; font-size: 15px; }
.files-card .item .btn { flex: 0 0 auto; }
@media (max-width: 600px) { .files-card .item .btn, .files-card .item a.btn { width: 100%; } }
