:root {
  color-scheme: light;
  --ink: #1f2937;
  --muted: #667085;
  --line: #d6d2c8;
  --paper: #f7f3eb;
  --surface: #fffdf8;
  --stone: #d8c59f;
  --stone-dark: #8b7757;
  --accent: #25636b;
  --accent-strong: #163f45;
  --danger: #a44234;
  --shadow: 0 18px 45px rgba(31, 41, 55, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: #202833;
  color: #f9f4e8;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--stone);
  color: #202833;
  border-radius: 8px;
  font-weight: 800;
  font-size: 14px;
}

.brand strong,
.session-card strong {
  display: block;
  font-size: 18px;
}

.brand span:last-child,
.session-card span {
  color: rgba(249, 244, 232, 0.72);
  font-size: 14px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-link {
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgba(249, 244, 232, 0.8);
  background: transparent;
  min-height: 44px;
  text-align: left;
  padding: 0 14px;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(216, 197, 159, 0.14);
  border-color: rgba(216, 197, 159, 0.22);
  color: #fffdf8;
}

.session-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(216, 197, 159, 0.22);
  border-radius: 8px;
  display: grid;
  gap: 10px;
}

.main {
  min-width: 0;
  padding: 28px;
}

.auth-panel {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 32px;
  align-items: center;
}

.auth-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

p {
  line-height: 1.6;
  color: var(--muted);
}

.demo-access,
.auth-card,
.panel,
.metric,
.process-step,
.example-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.demo-access {
  width: min(440px, 100%);
  padding: 16px;
  display: grid;
  gap: 4px;
  margin-top: 26px;
}

.demo-access span {
  color: var(--muted);
}

.auth-card {
  padding: 22px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  background: #ede7da;
  border-radius: 8px;
  margin-bottom: 18px;
}

.segment {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segment.active {
  background: var(--surface);
  color: var(--ink);
}

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

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

label {
  display: grid;
  gap: 7px;
  color: #384250;
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c9c2b4;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

input[type="range"] {
  padding: 0;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
}

.wide {
  grid-column: 1 / -1;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding-top: 22px;
}

.primary,
.secondary,
.ghost {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
}

.primary {
  border: 1px solid var(--accent-strong);
  background: var(--accent);
  color: #fff;
}

.secondary {
  border: 1px solid #b9b09f;
  background: #fffdf8;
  color: var(--ink);
}

.ghost {
  border: 1px solid rgba(249, 244, 232, 0.28);
  background: transparent;
  color: #fffdf8;
}

.form-message {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--danger);
  font-weight: 700;
}

.workspace {
  display: grid;
  gap: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 44px);
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  padding: 16px;
  box-shadow: none;
}

.metric span,
.spec-list span {
  color: var(--muted);
  font-size: 14px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 28px;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.designer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "upload controls"
    "preview preview"
    "export export";
  gap: 16px;
}

.upload-panel {
  grid-area: upload;
}

.controls-panel {
  grid-area: controls;
}

.preview-panel {
  grid-area: preview;
}

.export-panel {
  grid-area: export;
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-heading p {
  margin-bottom: 0;
}

.step-number {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ede7da;
  color: var(--accent-strong);
  font-weight: 900;
}

.dropzone {
  min-height: 126px;
  border: 1.5px dashed #a99d88;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  margin-bottom: 16px;
  background: #fbf8f0;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.dropzone span {
  color: var(--accent-strong);
  font-size: 18px;
}

.dropzone small {
  color: var(--muted);
  font-weight: 500;
}

.range-value {
  color: var(--muted);
  font-size: 13px;
}

.preview-stage {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #cfc8ba;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(31, 41, 55, 0.06)),
    #e6dfd2;
}

canvas {
  display: block;
  max-width: 100%;
}

#previewCanvas {
  width: 100%;
  height: auto;
}

.status-line,
.export-actions,
.spec-list {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.status-line {
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.export-actions {
  margin-bottom: 16px;
}

.export-status {
  margin: -4px 0 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-strong);
}

.printing-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.compact-heading {
  margin-bottom: 12px;
}

.printing-controls {
  margin-bottom: 14px;
}

.printing-status-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
  margin: 14px 0;
}

.printing-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbf8f0;
}

.printing-box p,
.printing-box ul,
.printing-note {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.printing-box ul {
  padding-left: 20px;
}

.printing-facts,
.manufacturing-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.printing-facts span,
.manufacturing-info div {
  border: 1px solid #ded6c7;
  border-radius: 8px;
  padding: 10px;
  background: #fffdf8;
  font-size: 14px;
}

.manufacturing-info span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.manufacturing-info strong {
  display: block;
  margin-top: 3px;
}

.spec-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.spec-list div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f0;
}

.spec-list strong {
  display: block;
  margin-top: 4px;
}

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

.process-step,
.example-card {
  padding: 18px;
}

.process-step span {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  margin-bottom: 14px;
}

.note-panel {
  margin-top: 16px;
}

.examples-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.example-card {
  box-shadow: none;
}

.example-canvases {
  display: grid;
  gap: 10px;
}

.example-card canvas {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f0;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

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

th {
  color: var(--accent-strong);
  background: #f1eadc;
}

.admin-note {
  margin: 14px 0 0;
  font-size: 14px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-link {
    text-align: center;
  }

  .auth-panel,
  .designer-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .designer-grid {
    grid-template-areas:
      "upload"
      "controls"
      "preview"
      "export";
  }

  .examples-grid,
  .process-grid,
  .printing-status-grid,
  .spec-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 18px;
  }

  .sidebar {
    padding: 18px;
  }

  .nav-list,
  .metrics-grid,
  .examples-grid,
  .process-grid,
  .printing-status-grid,
  .printing-facts,
  .manufacturing-info,
  .spec-list,
  .auth-form,
  .control-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .export-actions {
    flex-direction: column;
  }

  h1 {
    font-size: 34px;
  }
}
