/* ============ RARE WING ERP — industrial black + safety orange ============ */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Source+Sans+3:wght@400;600;700&display=swap');

:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --ink: #14181f;
  --muted: #5b6572;
  --line: #dfe3e9;
  --brand: #191d24;
  --brand-dark: #0b0d11;
  --accent: #ea580c;
  --display: "Bebas Neue", "Segoe UI", sans-serif;
  --ok: #1a7f37;
  --warn: #b45309;
  --danger: #b91c1c;
  --chip-printing: #fde68a;
  --chip-printing-ink: #713f12;
  --chip-ready: #bfdbfe;
  --chip-ready-ink: #1e3a8a;
  --chip-stitching: #fed7aa;
  --chip-stitching-ink: #7c2d12;
  --chip-done: #bbf7d0;
  --chip-done-ink: #14532d;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(22, 32, 46, 0.08), 0 4px 14px rgba(22, 32, 46, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}
.boot { padding: 48px; text-align: center; color: var(--muted); }

button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label.f {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 14px;
}
label.f > span { display: block; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- header ---------- */
.topbar {
  background: linear-gradient(180deg, #1c2129 0%, #12151b 100%);
  border-bottom: 3px solid var(--accent);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .logo { font-family: var(--display); font-size: 26px; font-weight: 400; letter-spacing: 0.1em; display: flex; align-items: center; gap: 10px; }
.logo-chip {
  background: #fff;
  border-radius: 8px;
  padding: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.logo-chip img { width: 30px; height: 30px; object-fit: contain; display: block; }
.login-logo { width: 170px; height: auto; margin: 0 auto 6px; display: block; }
.topbar .spacer { flex: 1; }
.rolebadge {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.35);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.mode-demo {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}
.mode-live { background: var(--ok); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; letter-spacing: 0.05em; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 700;
  background: var(--brand);
  color: #fff;
}
.btn:hover { background: var(--brand-dark); }
.btn.accent { background: var(--accent); }
.btn.accent:hover { filter: brightness(0.92); }
.btn.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.ghost:hover { background: rgba(15,76,129,0.06); }
.btn.ghost.inverse { color: #fff; border-color: rgba(255,255,255,0.6); }
.btn.ghost.inverse:hover { background: rgba(255,255,255,0.12); }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); }
.btn.danger:hover { background: rgba(185,28,28,0.06); }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(160deg, #23272f 0%, #14171c 55%, #0a0c0f 100%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  text-align: center;
}
.login-card h1 { margin: 0 0 4px; font-family: var(--display); font-size: 34px; font-weight: 400; letter-spacing: 0.1em; }
.login-card .sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.pin-row { display: flex; gap: 10px; margin: 18px 0 8px; }
.pin-row input { text-align: center; font-size: 22px; letter-spacing: 0.4em; font-weight: 700; }
.login-err { color: var(--danger); font-size: 14px; min-height: 20px; margin: 6px 0 10px; font-weight: 600; }
.login-hint { font-size: 12px; color: var(--muted); margin-top: 18px; }

/* ---------- layout ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 20px 16px 80px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-family: var(--display); font-size: 28px; font-weight: 400; letter-spacing: 0.06em; }
.page-head .spacer { flex: 1; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar input[type="search"] { max-width: 280px; }
.toolbar select { max-width: 210px; }

/* ---------- job cards ---------- */
.job-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.job-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  border-left: 6px solid var(--line);
  cursor: pointer;
  transition: transform 0.08s ease;
}
.job-card:hover { transform: translateY(-2px); }
.job-card.s-printing { border-left-color: #f59e0b; }
.job-card.s-ready { border-left-color: #3b82f6; }
.job-card.s-stitching { border-left-color: #ea580c; }
.job-card.s-stitchdone { border-left-color: #9333ea; }
.job-card.s-done { border-left-color: #16a34a; }
.job-card .row1 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.job-card .jobno { font-weight: 800; font-size: 15px; color: var(--accent); }
.job-card .row1 .spacer { flex: 1; }
.job-card h3 { margin: 2px 0 6px; font-size: 17px; }
.job-card .meta { font-size: 13.5px; color: var(--muted); }
.job-card .meta b { color: var(--ink); font-weight: 600; }
.job-card .thumb-row { display: flex; gap: 6px; margin-top: 10px; }
.job-card .thumb-row img {
  width: 54px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line);
}
.urgent-flag { color: var(--danger); font-weight: 800; font-size: 12px; letter-spacing: 0.05em; }

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.chip.s-printing { background: var(--chip-printing); color: var(--chip-printing-ink); }
.chip.s-ready { background: var(--chip-ready); color: var(--chip-ready-ink); }
.chip.s-stitching { background: var(--chip-stitching); color: var(--chip-stitching-ink); }
.chip.s-stitchdone { background: #e9d5ff; color: #6b21a8; }
.chip.s-done { background: var(--chip-done); color: var(--chip-done-ink); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1.5px dashed var(--line);
}
.empty .big { font-size: 44px; margin-bottom: 10px; }

/* ---------- summary strip ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat {
  background: var(--card);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  cursor: pointer;
  border: 2px solid transparent;
}
.stat.active { border-color: var(--accent); }
.stat .n { font-family: var(--display); font-size: 32px; font-weight: 400; letter-spacing: 0.03em; }
.stat .t { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- form ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card h3 {
  margin: 0 0 16px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand);
  border-bottom: 2px solid var(--line);
  padding-bottom: 8px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
}
.seg button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.check-row { display: flex; flex-wrap: wrap; gap: 8px; }
.check-row label.ck {
  display: flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
}
.check-row label.ck:has(input:checked) { background: #e7f0f9; border-color: var(--brand); color: var(--brand); }
.check-row input[type="checkbox"] { width: auto; }

.size-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 8px; }
.size-cell { text-align: center; }
.size-cell .sz { font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 4px; }
.size-cell input { text-align: center; padding: 8px 4px; font-weight: 700; }
.size-total { margin-top: 10px; font-weight: 800; font-size: 15px; }
.size-total span { color: var(--accent); font-size: 20px; }

/* image upload */
.img-up { display: flex; flex-wrap: wrap; gap: 12px; }
.img-slot {
  width: 150px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.img-slot img { width: 100%; height: 110px; object-fit: cover; display: block; }
.img-slot .cap { padding: 6px; }
.img-slot .cap select, .img-slot .cap input { padding: 5px 8px; font-size: 12.5px; margin-bottom: 4px; }
.img-slot .rm { width: 100%; border: none; background: #fee2e2; color: var(--danger); font-weight: 700; font-size: 12px; padding: 5px; }
.img-add {
  width: 150px; min-height: 178px;
  border: 2px dashed var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.img-add:hover { border-color: var(--brand); color: var(--brand); }
.img-add .plus { font-size: 30px; line-height: 1; }

.form-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  position: sticky; bottom: 0;
  background: linear-gradient(transparent, var(--bg) 30%);
  padding: 16px 0 10px;
}
.form-err { color: var(--danger); font-weight: 700; margin: 4px 0; }

/* ---------- job sheet (detail) ---------- */
.sheet {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}
.sheet-head { display: flex; align-items: flex-start; gap: 14px; border-bottom: 3px solid var(--ink); padding-bottom: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.sheet-head .co { font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; }
.sheet-head h2 { margin: 2px 0 4px; font-family: var(--display); font-size: 32px; font-weight: 400; letter-spacing: 0.05em; }
.sheet-head .jobno { font-size: 17px; font-weight: 800; color: var(--accent); }
.sheet-head .spacer { flex: 1; }
.sheet-head .due { text-align: right; }
.sheet-head .due .d { font-size: 20px; font-weight: 800; }

.spec-table { width: 100%; border-collapse: collapse; margin-bottom: 4px; }
.spec-table td {
  border: 1px solid var(--line);
  padding: 9px 12px;
  font-size: 15px;
  vertical-align: top;
}
.spec-table td.k {
  width: 34%;
  background: #f6f8fb;
  font-weight: 700;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.spec-table td.v { font-weight: 600; }

.sizes-table { width: 100%; border-collapse: collapse; }
.sizes-table th, .sizes-table td { border: 1px solid var(--ink); padding: 8px 6px; text-align: center; }
.sizes-table th { background: #f6f8fb; font-size: 13px; text-transform: uppercase; }
.sizes-table td { font-size: 18px; font-weight: 800; }
.sizes-table td.total { background: #fff7ed; color: var(--accent); }

/* name & number roster */
.paste-zone {
  border: 2px dashed var(--brand);
  background: #eef4fa;
  color: var(--brand-dark);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
  font-size: 14.5px;
  margin-bottom: 12px;
}
.paste-zone b { font-size: 16px; }
.paste-zone { opacity: 0.65; transition: all 0.15s ease; cursor: pointer; }
.paste-zone.armed {
  opacity: 1;
  border-style: solid;
  background: #dcebf7;
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.12);
}
.paste-zone.armed::after { content: " ✓ ready to paste"; font-weight: 800; font-size: 12.5px; display: block; margin-top: 2px; color: var(--ok); }

.roster-edit { width: 100%; border-collapse: collapse; }
.roster-edit th { font-size: 12px; text-transform: uppercase; color: var(--muted); text-align: left; padding: 4px 6px; }
.roster-edit td { padding: 3px 4px; }
.roster-edit td.sl { font-weight: 700; color: var(--muted); width: 30px; text-align: center; }
.roster-edit input, .roster-edit select { padding: 7px 9px; }
.roster-edit td:nth-child(3) { width: 90px; }
.roster-edit td:nth-child(4) { width: 100px; }
.rm-row { border: none; background: transparent; color: var(--danger); font-weight: 800; font-size: 15px; padding: 6px; }

.roster-table { width: 100%; border-collapse: collapse; }
.roster-table th, .roster-table td { border: 1px solid var(--ink); padding: 7px 10px; text-align: left; font-size: 15px; }
.roster-table th { background: #f6f8fb; font-size: 12.5px; text-transform: uppercase; }
.roster-table td.sl { text-align: center; font-weight: 700; color: var(--muted); width: 38px; }
.roster-table td.nm { font-weight: 700; }
.roster-table td.no { font-weight: 800; font-size: 17px; }
.roster-table .qccol { text-align: center; width: 70px; }
.roster-table input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--ok); cursor: pointer; }
.roster-table tr.qc-done td { background: #f0fdf4; }
.roster-table tr.qc-done td.nm, .roster-table tr.qc-done td.no { color: var(--ok); }

.qc-progress {
  float: right;
  font-size: 13px;
  font-weight: 800;
  background: var(--chip-printing);
  color: var(--chip-printing-ink);
  padding: 3px 12px;
  border-radius: 999px;
}
.qc-progress.qc-ok { background: var(--chip-done); color: var(--chip-done-ink); }

.design-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.design-box { border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; }
.design-box .tag {
  background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 6px 10px;
}
.design-box img { width: 100%; max-height: 340px; object-fit: contain; display: block; background: #fafafa; }
.design-box .note { padding: 8px 10px; font-size: 13.5px; border-top: 1px solid var(--line); }
.design-box.placeholder {
  min-height: 200px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-weight: 700; border-style: dashed;
}

.notes-box {
  border: 2px dashed var(--warn);
  background: #fffbeb;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  white-space: pre-wrap;
}

.status-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0; }

.remark { border-left: 3px solid var(--brand); padding: 6px 12px; margin-bottom: 8px; background: #f6f8fb; border-radius: 0 8px 8px 0; }
.remark .who { font-size: 12px; color: var(--muted); font-weight: 700; }
.remark-input { display: flex; gap: 8px; margin-top: 10px; }

.activity { font-size: 13px; color: var(--muted); }
.activity li { margin-bottom: 3px; }

.back-link { color: var(--brand); font-weight: 700; text-decoration: none; font-size: 15px; }
.back-link:hover { text-decoration: underline; }

.banner {
  background: #fff7ed;
  border: 1.5px solid #fdba74;
  color: #7c2d12;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}
.banner b { font-weight: 800; }

.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 100;
  animation: toast-in 0.2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------- print ---------- */
@media print {
  body { background: #fff; }
  .topbar, .status-actions, .no-print, .toast, .banner { display: none !important; }
  .page { max-width: none; padding: 0; }
  .sheet { box-shadow: none; padding: 0; border-radius: 0; }
  .design-box img { max-height: 300px; }
}
