:root {
  color-scheme: light;
  --ink: #14231d;
  --muted: #68766f;
  --green: #0f6b46;
  --green-dark: #084c32;
  --gold: #c89b3c;
  --paper: #f7f8f5;
  --line: #dce3de;
  --white: #ffffff;
  --danger: #a33b3b;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  min-height: 76px; padding: 14px 24px; display: flex; align-items: center;
  justify-content: space-between; gap: 20px; color: white;
  background: linear-gradient(110deg, #073d2b, #0f6b46 60%, #185c45);
  border-bottom: 3px solid var(--gold);
}
.topbar h1 { margin: 0; font-size: clamp(1.35rem, 2.5vw, 2rem); letter-spacing: -.03em; }
.eyebrow { margin: 0 0 2px; color: #e8d7a6; font-size: .75rem; font-weight: 800; letter-spacing: .12em; }
.privacy { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: #ecf5f0; }
.privacy span { width: 9px; height: 9px; background: #7be0a8; border-radius: 50%; box-shadow: 0 0 0 4px rgba(123,224,168,.15); }

.app-shell { display: grid; grid-template-columns: 390px minmax(0, 1fr); min-height: calc(100vh - 79px); }
.sidebar { padding: 18px; overflow-y: auto; border-right: 1px solid var(--line); background: #fbfcfa; }
.step { padding: 16px; margin-bottom: 14px; background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 25px rgba(20,35,29,.045); }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-head span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: white; background: var(--green); font-weight: 800; }
.step h2 { margin: 0; font-size: 1rem; }

.upload-card { display: block; padding: 13px 14px; margin-top: 9px; border: 1.5px dashed #aab8b0; border-radius: 12px; transition: .18s ease; cursor: pointer; }
.upload-card:hover { border-color: var(--green); background: #f2faf5; transform: translateY(-1px); }
.upload-card input { position: absolute; opacity: 0; pointer-events: none; }
.upload-card strong, .upload-card small { display: block; }
.upload-card strong { font-size: .92rem; }
.upload-card small { margin-top: 3px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

label { display: grid; gap: 5px; color: #4c5b54; font-size: .84rem; font-weight: 700; }
input[type="text"], input[type="number"], select { width: 100%; min-height: 42px; padding: 8px 10px; color: var(--ink); background: white; border: 1px solid #cbd5cf; border-radius: 9px; }
input[type="color"] { width: 100%; min-height: 42px; padding: 3px; border: 1px solid #cbd5cf; border-radius: 9px; background: white; }
input:focus, select:focus { outline: 3px solid rgba(15,107,70,.15); border-color: var(--green); }
.inline-control { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }

button { min-height: 42px; padding: 8px 13px; border-radius: 10px; border: 1px solid transparent; font-weight: 800; }
button:disabled { cursor: not-allowed; opacity: .48; }
.primary { color: white; background: var(--green); box-shadow: 0 8px 18px rgba(15,107,70,.18); }
.primary:hover:not(:disabled) { background: var(--green-dark); }
.secondary { color: var(--green); background: #eff8f2; border-color: #b8d5c4; }
.secondary:hover:not(:disabled) { background: #e1f2e7; }
.danger-ghost { width: 100%; margin-top: 10px; color: var(--danger); background: #fff7f7; border-color: #eed0d0; }
.wide { width: 100%; margin-top: 10px; }

.field-list { display: grid; gap: 7px; margin-top: 10px; }
.field-item { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 42px; padding: 9px 11px; text-align: left; color: var(--ink); background: #f6f8f5; border: 1px solid var(--line); border-radius: 10px; }
.field-item.active { color: var(--green-dark); background: #eaf6ee; border-color: #82b99a; }
.field-item small { color: var(--muted); font-weight: 600; }
.empty-note { margin: 4px 0; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.output label + .control-grid { margin-top: 10px; }

.workspace { min-width: 0; padding: 20px; display: flex; flex-direction: column; }
.workspace-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.workspace-head h2 { margin: 0; font-size: 1.1rem; }
.workspace-head p { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
.record-nav { display: flex; align-items: center; gap: 8px; }
.record-nav button { width: 42px; padding: 6px; color: var(--green); background: white; border-color: var(--line); }
.record-nav span { min-width: 68px; text-align: center; color: var(--muted); font-size: .85rem; font-weight: 700; }

.canvas-wrap { position: relative; flex: 1; min-height: 520px; display: grid; place-items: center; overflow: hidden; background: #dfe5e1; border: 1px solid #ccd5cf; border-radius: 18px; }
#previewCanvas { display: none; max-width: calc(100% - 30px); max-height: calc(100% - 30px); width: auto; height: auto; box-shadow: 0 18px 45px rgba(18,36,28,.2); touch-action: none; cursor: crosshair; }
.canvas-empty { text-align: center; color: var(--muted); padding: 30px; }
.canvas-empty strong { display: block; margin-top: 12px; color: var(--ink); font-size: 1.05rem; }
.canvas-empty p { margin: 6px 0 0; }
.empty-icon { display: grid; place-items: center; width: 76px; height: 76px; margin: auto; border-radius: 22px; color: var(--green); background: white; border: 1px solid #cbd8d0; font: 700 1.7rem Georgia, serif; box-shadow: 0 12px 28px rgba(20,35,29,.1); }

.progress-wrap { margin-top: 12px; }
.progress-track { height: 9px; overflow: hidden; background: #e5ebe7; border-radius: 10px; }
#progressBar { width: 0; height: 100%; background: linear-gradient(90deg, var(--green), #42a56f); transition: width .2s; }
#progressText { margin: 6px 0 0; color: var(--muted); font-size: .8rem; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 20; max-width: 390px; padding: 12px 16px; color: white; background: #132a20; border-radius: 11px; box-shadow: 0 15px 35px rgba(0,0,0,.2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
  .workspace { min-height: 680px; }
  .topbar { padding-inline: 16px; }
}
@media (max-width: 540px) {
  .privacy { display: none; }
  .sidebar, .workspace { padding: 12px; }
  .control-grid { grid-template-columns: 1fr; }
  .canvas-wrap { min-height: 430px; }
}
