:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --ink: #231f1c;
  --muted: #6f6860;
  --line: #d9d0c4;
  --panel: #fffaf2;
  --coffee: #4a2f24;
  --green: #2f6b4f;
  --gold: #b7863b;
  --danger: #a4382f;
  --radius: 8px;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: #fff8ed;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.topnav a {
  color: var(--coffee);
  font-weight: 700;
  text-decoration: none;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.shell.narrow {
  width: min(560px, calc(100% - 32px));
}

.status-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.status-band > div {
  min-width: 0;
  padding: 18px;
  background: var(--panel);
}

.label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin-bottom: 0;
}

.section-head p {
  max-width: 420px;
  margin-bottom: 0;
  color: var(--muted);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.app-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  min-height: 176px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.app-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: var(--coffee);
  color: #fff;
  font-weight: 800;
}

.app-content h3 {
  margin-bottom: 8px;
}

.app-content p {
  color: var(--muted);
  line-height: 1.45;
}

.app-content .meta {
  margin-top: 12px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.button {
  grid-column: 2;
  align-self: end;
  justify-self: start;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.button.secondary {
  margin-left: 8px;
  background: var(--coffee);
}

.button.disabled {
  background: #c9c0b4;
  color: #5b544d;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-box,
.panel {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.form {
  display: grid;
  gap: 16px;
}

.form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.form input {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.form button {
  padding: 12px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--coffee);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.alert,
.success {
  padding: 12px 14px;
  border-radius: 6px;
}

.alert {
  border: 1px solid #e2b8b3;
  background: #fff1ef;
  color: var(--danger);
}

.success {
  border: 1px solid #b9d8c8;
  background: #edf8f1;
  color: var(--green);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 18px;
}

.photo-layout {
  display: grid;
  grid-template-columns: minmax(280px, 460px) 1fr;
  gap: 18px;
  align-items: start;
}

.research-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
  align-items: start;
}

.research-preview-panel,
.research-detail-panel {
  width: 100%;
}

.product-data-overview {
  width: 100%;
  margin-bottom: 28px;
}

.research-main-image {
  min-height: 320px;
}

.research-result-card {
  display: grid;
  gap: 16px;
  margin: 0 0 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.research-result-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
}

.research-result-head h3 {
  margin: 4px 0 0;
}

.data-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.data-summary div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.data-summary dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.data-summary dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.result-text {
  display: grid;
  gap: 6px;
}

.result-text h4,
.result-text p {
  margin: 0;
}

.source-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  overflow-wrap: anywhere;
}

.empty-state.compact {
  padding: 12px;
}

.file-meta {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
}

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

.photo-panel {
  width: 100%;
}

.camera-box {
  display: grid;
  gap: 10px;
}

.camera-box video,
.camera-box canvas {
  display: none;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #15120f;
  object-fit: cover;
}

.camera-box video.active,
.camera-box canvas.active {
  display: block;
}

.camera-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.camera-actions button {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--coffee);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.workflow-actions button {
  padding: 12px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--coffee);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.workflow-actions button:disabled {
  background: #c9c0b4;
  color: #5b544d;
  cursor: default;
}

.todo-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 18px;
  align-items: start;
}

.inline-form {
  margin-top: 16px;
}

.inline-form button,
.todo-check button,
.todo-delete button,
.todo-actions button,
.assistant-answer button {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--coffee);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.todo-list {
  display: grid;
  gap: 10px;
}

.todo-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.todo-item p {
  margin-bottom: 6px;
  line-height: 1.45;
}

.todo-item span {
  color: var(--muted);
  font-size: 12px;
}

.todo-item.done {
  opacity: 0.7;
}

.todo-item.done p {
  text-decoration: line-through;
}

.todo-delete button {
  color: var(--danger);
}

.todo-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.assistant-state {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #edf8f1;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.assistant-note {
  margin-top: 10px;
  padding: 10px;
  border-left: 3px solid var(--gold);
  background: #fff8ed;
  color: var(--muted);
}

.assistant-answer {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.assistant-answer label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.assistant-answer p {
  margin-bottom: 0;
  color: var(--coffee);
  font-weight: 700;
}

.empty-state {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.result-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.featured-selection {
  grid-template-columns: minmax(220px, 340px) 1fr;
  align-items: center;
  margin-bottom: 18px;
}

.result-preview {
  display: grid;
  min-height: 210px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-color: #fff;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.result-preview img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
}

.result-card h3 {
  overflow-wrap: anywhere;
  margin: 10px 0 8px;
  font-size: 16px;
}

.result-card p {
  color: var(--muted);
  font-size: 13px;
}

.section-space {
  margin-top: 34px;
}

.form textarea {
  width: 100%;
  resize: vertical;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
}

@media (max-width: 720px) {
  .topbar,
  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .status-band {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .photo-layout {
    grid-template-columns: 1fr;
  }

  .research-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .data-summary {
    grid-template-columns: 1fr;
  }

  .camera-actions {
    grid-template-columns: 1fr;
  }

  .todo-layout,
  .todo-item {
    grid-template-columns: 1fr;
  }
}
