* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1a1f2c;
  background: #f5f7fb;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--primary); color: white;
  padding: 12px 16px; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; color: white; }
.topbar .brand:hover { text-decoration: none; }
.logo-text { font-weight: 700; font-size: 18px; letter-spacing: 0.5px; }
.product-tag {
  font-size: 11px; background: rgba(255,255,255,0.15);
  padding: 3px 8px; border-radius: 10px; font-weight: 600;
}
.logout { color: white; font-size: 14px; opacity: 0.85; }

.container {
  max-width: 760px; margin: 0 auto;
  padding: 16px;
}
.footer {
  text-align: center; font-size: 12px; color: #888;
  padding: 24px 16px 40px;
}

h1, h2, h3 { color: var(--primary); margin-top: 0; }
h1 { font-size: 22px; }
h2 { font-size: 18px; margin-top: 24px; }
h3 { font-size: 16px; }

.card {
  background: white; border-radius: 12px;
  padding: 18px; margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

label { display: block; font-weight: 600; margin: 12px 0 6px; font-size: 14px; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 12px 14px; border: 1px solid #d4d9e3;
  border-radius: 10px; font-size: 16px; background: white;
}
input[type=file] {
  width: 100%; padding: 10px; border: 1px dashed #b8c0d0;
  border-radius: 10px; background: #fafbff; font-size: 14px;
}
textarea { min-height: 70px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: white; border: none;
  padding: 14px 22px; border-radius: 10px; font-size: 16px;
  font-weight: 600; cursor: pointer; text-decoration: none;
  min-height: 48px;
}
.btn:hover { opacity: 0.92; text-decoration: none; color: white; }
.btn-accent { background: var(--accent); color: #1a1f2c; }
.btn-outline { background: white; color: var(--primary); border: 2px solid var(--primary); }
.btn-danger { background: #c0392b; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.checkbox-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 8px;
  background: #f5f7fb; margin-bottom: 6px;
}
.checkbox-row input[type=checkbox] {
  width: 22px; height: 22px; accent-color: var(--primary);
}
.checkbox-row label { margin: 0; font-weight: 500; flex: 1; }

.op-card {
  background: white; border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px;
  border-left: 4px solid var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.op-card.safety { border-left-color: #c0392b; }
.op-card.alignment { border-left-color: #16a085; }
.op-card.custom { border-left-color: #8e44ad; }
.op-card .op-name { font-weight: 600; }
.op-cat-tag {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border-radius: 6px; background: #ecf0f7; color: #555;
  text-transform: uppercase; letter-spacing: 0.5px; margin-left: 6px;
}

.flash-wrap { padding: 0 16px; max-width: 760px; margin: 8px auto; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; }
.flash-error { background: #ffe1e1; color: #a92626; }
.flash-success { background: #e1ffe7; color: #1c7a3a; }

.dashboard-job {
  background: white; border-radius: 12px; padding: 14px;
  margin-bottom: 10px; display: flex; justify-content: space-between;
  align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.dashboard-job .meta { font-size: 13px; color: #666; }
.status-badge {
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  font-weight: 600; text-transform: uppercase;
}
.status-in_progress { background: #fff3cd; color: #856404; }
.status-completed { background: #d4edda; color: #155724; }

.step-pills {
  display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto;
  padding-bottom: 4px;
}
.step-pill {
  flex-shrink: 0; padding: 6px 12px; border-radius: 16px;
  font-size: 12px; background: #e6e9f0; color: #666;
  white-space: nowrap; font-weight: 600;
  text-decoration: none; cursor: pointer;
  border: none;
}
.step-pill:hover { text-decoration: none; opacity: 0.85; }
.step-pill.active { background: var(--primary); color: white; }
.step-pill.done { background: #16a085; color: white; }
.step-pill.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-back {
  background: white; color: var(--primary);
  border: 2px solid #d4d9e3;
}
.btn-back:hover { background: #f5f7fb; color: var(--primary); }

.thumb-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumb {
  width: 70px; height: 70px; object-fit: cover;
  border-radius: 8px; border: 1px solid #d4d9e3;
}
.file-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: #ecf0f7; padding: 6px 10px; border-radius: 6px;
  font-size: 13px; margin: 2px;
}
.file-pill a { color: var(--primary); }

.section-help { font-size: 13px; color: #666; margin-top: -4px; margin-bottom: 8px; }

.share-link-box {
  background: #ecf0f7; border-radius: 10px; padding: 14px;
  word-break: break-all; font-size: 14px; font-family: monospace;
  border: 1px solid #d4d9e3;
}

@media (max-width: 500px) {
  .container { padding: 12px; }
  h1 { font-size: 20px; }
}

/* ---------- Audit / integrity page ---------- */
.audit-files { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.audit-file {
  border-left: 4px solid #ccc; background: #fafbfc;
  padding: 10px 12px; border-radius: 6px; font-size: 13px;
}
.audit-file--verified { border-left-color: #1f8b4c; }
.audit-file--mismatch { border-left-color: #c92a2a; background: #fff5f5; }
.audit-file--missing  { border-left-color: #c92a2a; background: #fff5f5; }
.audit-file--unhashed { border-left-color: #d4a017; }
.audit-file-head {
  display: flex; justify-content: space-between; gap: 10px;
  align-items: center; margin-bottom: 4px; flex-wrap: wrap;
}
.audit-status { font-weight: 700; font-size: 12px; }
.audit-file-name { font-weight: 600; color: var(--primary); word-break: break-all; }
.audit-file-meta {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 12px; color: #555; margin: 4px 0;
}
.audit-hash { font-family: monospace; font-size: 11px; word-break: break-all; margin-top: 4px; color: #444; }
.audit-hash-bad { color: #c92a2a; }
.audit-hash-warn { color: #946a00; font-family: inherit; }

.audit-log { list-style: none; padding: 0; margin: 12px 0 0 0; }
.audit-entry {
  border-left: 3px solid var(--primary); background: #fafbfc;
  padding: 10px 12px; margin-bottom: 8px; border-radius: 0 6px 6px 0;
}
.audit-entry-head {
  display: flex; justify-content: space-between; gap: 10px;
  align-items: baseline; flex-wrap: wrap;
}
.audit-action {
  font-weight: 700; font-size: 12px; text-transform: uppercase;
  color: var(--primary); letter-spacing: 0.5px;
}
.audit-ts { font-size: 11px; color: #777; font-family: monospace; }
.audit-entry-detail { font-size: 14px; margin: 4px 0; color: #222; }
.audit-entry-meta { font-size: 12px; color: #555; }
.audit-entry-hash { margin-top: 6px; font-size: 11px; color: #555; }
.audit-entry-hash summary { cursor: pointer; color: var(--primary); }
.audit-entry-hash code { font-size: 10.5px; word-break: break-all; display: inline-block; }
