:root {
  --bg: #f4efe7;
  --ink: #272320;
  --muted: #6f655c;
  --panel: rgba(255, 251, 245, 0.92);
  --accent: #a34d32;
  --accent-dark: #7e341d;
  --ok: #2f7a3d;
  --warn: #9a5d14;
  --err: #a31212;
  --border: rgba(39, 35, 32, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Plus Jakarta Sans", sans-serif;
  background: radial-gradient(circle at 12% 12%, #fce9d5, transparent 38%), radial-gradient(circle at 82% 10%, #ead6c2, transparent 36%), var(--bg);
  min-height: 100vh;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(42px);
  opacity: 0.45;
  z-index: -1;
}

.orb-a {
  width: 320px;
  height: 320px;
  background: #f2b38c;
  top: -80px;
  right: -40px;
}

.orb-b {
  width: 320px;
  height: 320px;
  background: #cfa07e;
  bottom: -120px;
  left: -40px;
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(9px);
  background: rgba(244, 239, 231, 0.72);
  border-bottom: 1px solid var(--border);
}

.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}

.brand {
  font-family: "Fraunces", serif;
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
}

.top-nav a {
  text-decoration: none;
  color: var(--ink);
  margin-left: 16px;
}

.top-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-user,
.status-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.hero {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-family: "Fraunces", serif;
}

.hero p {
  margin-top: 8px;
  color: var(--muted);
  max-width: 840px;
}

.badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  background: #fff9f2;
  color: var(--accent-dark);
  font-weight: 700;
}

.badge.ok {
  color: var(--ok);
}

.badge.warn {
  color: var(--warn);
}

.panel {
  margin: 18px 0;
  padding: 20px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 10px 22px rgba(39, 35, 32, 0.08);
}

.panel h2,
.panel h3 {
  margin-top: 0;
  font-family: "Fraunces", serif;
}

.narrow {
  width: min(520px, 100%);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
}

.form-grid textarea,
.form-grid input,
.form-grid select {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-grid input:hover,
.form-grid select:hover,
.form-grid textarea:hover {
  border-color: rgba(163, 77, 50, 0.45);
}

.form-grid textarea,
.form-grid button,
.form-grid .full {
  grid-column: 1 / -1;
}

.primary-btn,
.link-btn {
  display: inline-block;
  border: none;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
}

.primary-btn:hover,
.link-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(163, 77, 50, 0.28);
}

.primary-btn:active,
.link-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.primary-btn[disabled],
.link-btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.checklist {
  margin: 0;
  padding-left: 20px;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.stats {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.stats span,
.stats a {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  text-decoration: none;
  color: var(--ink);
  background: rgba(255, 249, 241, 0.8);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

thead {
  background: rgba(163, 77, 50, 0.1);
}

td,
th {
  border: 1px solid var(--border);
  text-align: left;
  padding: 8px 10px;
  vertical-align: middle;
}

.preview-img {
  width: min(100%, 320px);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.error {
  color: var(--err);
}

.warning {
  color: var(--warn);
}

pre {
  margin: 0;
  white-space: pre-wrap;
  background: #f5eee6;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  max-height: 380px;
  overflow: auto;
}

@media (max-width: 900px) {
  .split,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }
}

/* ===== UI/UX enhancements ===== */

/* Focus rings */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

/* Table row hover */
tbody tr {
  transition: background 0.1s;
}
tbody tr:hover {
  background: rgba(163, 77, 50, 0.04);
}

/* Status / confidence pills */
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  background: rgba(39, 35, 32, 0.08);
  color: var(--muted);
}
.pill.ok, .pill.high, .pill.done, .pill.complete {
  background: rgba(47, 122, 61, 0.13);
  color: var(--ok);
}
.pill.warn, .pill.medium, .pill.pending {
  background: rgba(154, 93, 20, 0.13);
  color: var(--warn);
}
.pill.err, .pill.low, .pill.failed {
  background: rgba(163, 18, 18, 0.13);
  color: var(--err);
}

/* Badge confidence variants */
.badge.high { color: var(--ok); border-color: rgba(47, 122, 61, 0.35); }
.badge.medium { color: var(--warn); border-color: rgba(154, 93, 20, 0.35); }
.badge.low { color: var(--err); border-color: rgba(163, 18, 18, 0.35); }

/* File drop zone */
.file-drop-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 16px 12px;
  background: #fff;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-height: 88px;
  justify-content: center;
}
.file-drop-zone:hover,
.file-drop-zone.dragover {
  border-color: var(--accent);
  background: #fff9f4;
}
.file-drop-zone.has-file {
  border-color: var(--ok);
  background: rgba(47, 122, 61, 0.04);
}
.file-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.drop-icon { font-size: 1.4rem; line-height: 1; }
.drop-hint {
  font-size: 0.83rem;
  color: var(--muted);
}
.drop-filename {
  font-size: 0.83rem;
  color: var(--ok);
  font-weight: 600;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: none;
}
.drop-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: none;
}

/* Loading spinner */
.spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 5px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Numbered step list */
.step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.step-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.step-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.step-text { line-height: 1.5; }

/* Quality check list */
.qc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.qc-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.93rem;
}

/* Key-value data list */
.data-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.data-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(39, 35, 32, 0.07);
}
.data-list li:last-child { border-bottom: none; }
.dl-label {
  color: var(--muted);
  font-size: 0.87rem;
  flex-shrink: 0;
}
.dl-value {
  font-weight: 600;
  font-size: 0.95rem;
  text-align: right;
}

/* Delta-E color coding */
.de-good { color: var(--ok); font-weight: 700; }
.de-ok   { color: var(--warn); font-weight: 700; }
.de-poor { color: var(--err); font-weight: 700; }

/* Adjustment values table */
.adj-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 0.9rem;
}
.adj-table th,
.adj-table td {
  border: 1px solid var(--border);
  padding: 7px 12px;
  text-align: center;
}
.adj-table thead {
  background: rgba(163, 77, 50, 0.09);
  font-weight: 700;
}

/* Photo grid in submission detail */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.photo-grid figure { margin: 0; }
.photo-grid figcaption {
  font-size: 0.83rem;
  color: var(--muted);
  margin-bottom: 6px;
}
