:root {
  --ink: #23201c;
  --paper: #faf8f5;
  --line: #ddd6cc;
  --accent: #a15c2d;
  --accent-dark: #7d4620;
  --ok: #2f7a3d;
  --err: #b3341c;
  --muted: #6b6459;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

.topbar {
  background: var(--ink);
  color: #fff;
}
.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.brand { font-weight: 700; font-size: 1.05rem; }
.brand-light { font-weight: 400; opacity: 0.75; }
.topnav a {
  color: #fff;
  text-decoration: none;
  margin-left: 14px;
  opacity: 0.9;
  font-size: 0.92rem;
}
.topnav a:first-child { margin-left: 0; }
.whoami { opacity: 0.85; font-size: 0.92rem; margin-right: 4px; }

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px 48px;
}

h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 24px 0 8px; }
p.lead { color: var(--muted); margin-top: 0; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.job-header { border-left: 4px solid var(--accent); }
.job-header dl { margin: 8px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.job-header dt { color: var(--muted); font-size: 0.85rem; }
.job-header dd { margin: 0; font-weight: 600; }

.stat-row { display: flex; gap: 24px; margin-top: 10px; flex-wrap: wrap; }
.stat { }
.stat .num { font-size: 1.5rem; font-weight: 700; }
.stat .label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat.over .num { color: var(--err); }

form label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin: 14px 0 4px;
}
form label:first-child { margin-top: 0; }

input[type=text], input[type=password], input[type=date], input[type=time],
input[type=number], select, textarea {
  width: 100%;
  padding: 12px 10px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
textarea { min-height: 70px; resize: vertical; }

.time-row { display: flex; gap: 10px; }
.time-row > div { flex: 1; }

.btn {
  display: inline-block;
  width: 100%;
  text-align: center;
  padding: 13px 16px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  margin-top: 18px;
  text-decoration: none;
}
.btn:hover, .btn:active { background: var(--accent-dark); }
.btn.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.small { width: auto; padding: 8px 14px; font-size: 0.88rem; margin-top: 0; }

.msg {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 0.92rem;
}
.msg.ok { background: #e6f2e8; color: var(--ok); }
.msg.err { background: #fbe8e3; color: var(--err); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
th, td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; }
.table-wrap { overflow-x: auto; }

.job-list a.job-row {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
}
.job-list a.job-row:last-child { border-bottom: none; }
.job-list .job-no { font-weight: 700; }
.job-list .job-meta { color: var(--muted); font-size: 0.85rem; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #eee;
  color: var(--muted);
}
.badge.open { background: #fdeee0; color: var(--accent-dark); }
.badge.complete { background: #e6f2e8; color: var(--ok); }

.qr-block { text-align: center; }
.qr-block img { max-width: 260px; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
.qr-link { font-size: 0.8rem; word-break: break-all; color: var(--muted); margin-top: 8px; }

.stage-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.stage-legend span {
  background: #f1ece4;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

@media print {
  .topbar, .no-print { display: none !important; }
  body { background: #fff; }
}
