:root {
  color-scheme: light;
  --bg: #eef2ee;
  --panel: #ffffff;
  --ink: #16211f;
  --muted: #62716d;
  --line: #d8e1dd;
  --primary: #176b63;
  --primary-dark: #0f4c46;
  --accent: #d1852d;
  --accent-soft: #fff2dd;
  --danger: #a33a32;
  --shadow: 0 14px 36px rgba(25, 42, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1;
}

h2 {
  font-size: clamp(1rem, 1.8vw, 1.2rem);
}

.workbench {
  display: grid;
  grid-template-columns: clamp(220px, 30vw, 360px) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-width: 640px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100vh;
  height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.brand-row,
.camera-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
}

.selector-block,
.current-card,
.storage-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
}

.workflow-panel[hidden] {
  display: none;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-title-row {
  align-items: flex-start;
}

.section-title p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.step-number {
  display: inline-grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-height: 42px;
}

.group-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.group-button,
.back-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
  white-space: nowrap;
}

.group-button.active,
.back-button {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.model-grid .tag-button {
  text-align: left;
}

.part-grid .tag-button {
  min-height: 54px;
}

.tag-button {
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.tag-button.active {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.empty-text {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.92rem;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.stack-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.stack-form input {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
}

.inline-form input {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
}

.primary-button,
.secondary-button,
.ghost-button,
.text-button,
.stack-form .secondary-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 12px;
  font-weight: 800;
  white-space: nowrap;
}

.secondary-button {
  color: var(--primary-dark);
  border-color: rgba(23, 107, 99, 0.3);
  background: #eaf5f2;
}

.ghost-button {
  color: var(--primary-dark);
  border-color: rgba(23, 107, 99, 0.28);
  background: #f7fbfa;
}

.text-button {
  width: 100%;
  margin-top: auto;
  color: var(--danger);
  background: transparent;
}

.current-card {
  display: grid;
  gap: 6px;
  background: var(--accent-soft);
}

.current-card span {
  font-size: 1.05rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.current-card small {
  color: #755523;
  overflow-wrap: anywhere;
}

.storage-card {
  display: grid;
  gap: 8px;
}

.storage-card strong,
.storage-card small {
  display: block;
}

.storage-card small {
  margin-top: 4px;
  color: var(--muted);
}

.storage-card .secondary-button,
.storage-card .text-button {
  width: 100%;
}

.text-button.compact {
  min-height: 36px;
  margin-top: 0;
  padding: 0 8px;
}

.camera-area {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) 14px;
}

.camera-toolbar {
  min-height: 50px;
}

.status-pill {
  max-width: 50%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: #fff;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.capture-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  border: 2px dashed #9eb5ae;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(23, 107, 99, 0.09), rgba(209, 133, 45, 0.12)),
    #f9fbfa;
}

.capture-zone[aria-disabled="true"] {
  filter: grayscale(0.2);
}

.capture-zone video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #101412;
}

.capture-zone span {
  z-index: 1;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.camera-controls {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
}

.shutter-button {
  min-width: 110px;
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  font: inherit;
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(15, 76, 70, 0.25);
}

.shutter-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

@media (max-width: 760px) {
  .workbench {
    grid-template-columns: 210px minmax(430px, 1fr);
  }

  .side-panel {
    gap: 10px;
    padding-inline: 10px;
  }

  .brand-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .button-grid {
    grid-template-columns: 1fr;
  }

  .selector-block,
  .current-card,
  .storage-card {
    padding: 10px;
  }

  .tag-button {
    min-height: 40px;
    padding: 7px 8px;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .camera-area {
    padding-left: 10px;
  }

  .status-pill {
    max-width: 100%;
  }
}
