:root {
  color-scheme: light;
  --green-950: #003d29;
  --green-900: #004c32;
  --green-800: #006240;
  --green-100: #dcebe5;
  --ink: #14211c;
  --muted: #66736d;
  --line: #dce3df;
  --surface: #ffffff;
  --page: #f2f5f3;
  --shadow: 0 18px 48px rgba(0, 57, 37, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 1080px;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-mark {
  width: 42px;
  height: 48px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(145deg, var(--green-800), var(--green-950));
  border: 2px solid white;
  outline: 1px solid var(--green-900);
}

h1, h2, p { margin: 0; }
h1 { font-size: 20px; line-height: 1.1; }
h2 { font-size: 17px; }
.eyebrow { color: var(--green-800); font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; margin-bottom: 4px; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.topbar-actions span { color: var(--muted); font-size: 12px; }
.project-select { max-width: 180px; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; color: var(--ink); background: white; }

.workspace {
  height: calc(100vh - 78px);
  display: grid;
  grid-template-columns: 430px minmax(650px, 1fr);
}

.panel {
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.editor-panel { padding: 24px 24px 50px; }
.editor-panel section + section { margin-top: 28px; padding-top: 26px; border-top: 1px solid var(--line); }

.section-heading { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.section-heading p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.step { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; display: grid; place-items: center; background: var(--green-100); color: var(--green-900); font-size: 12px; font-weight: 800; }

.template-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.format-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.format-card { padding: 10px 7px; text-align: left; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); }
.format-card strong, .format-card small { display: block; }
.format-card strong { font-size: 12px; }
.format-card small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.25; }
.format-card.active { border-color: var(--green-800); background: #f0f8f5; box-shadow: 0 0 0 2px rgba(0,98,64,.08); }
.template-card { min-height: 60px; padding: 10px 11px; display: flex; align-items: center; gap: 9px; text-align: left; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: white; transition: .18s ease; }
.template-card:hover { border-color: #8eb3a4; transform: translateY(-1px); }
.template-card.active { border-color: var(--green-800); background: #f0f8f5; box-shadow: 0 0 0 2px rgba(0,98,64,.08); }
.template-card .icon { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; display: grid; place-items: center; color: white; background: var(--green-800); font-size: 15px; }
.template-card span:last-child { font-size: 12px; font-weight: 700; line-height: 1.2; }

.photo-picker { min-height: 66px; padding: 12px; display: flex; gap: 12px; align-items: center; border: 1px dashed #9db6ac; border-radius: 11px; background: #f7faf9; cursor: pointer; }
.photo-picker:hover { background: #eef6f3; }
.photo-picker-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green-800); font-size: 23px; }
.photo-picker strong, .photo-picker small { display: block; }
.photo-picker strong { font-size: 13px; }
.photo-picker small { color: var(--muted); font-size: 11px; margin-top: 4px; }
.photo-picker input { display: none; }
.photo-picker.compact { min-height: 58px; }
.photo-picker.compact .photo-picker-icon { width: 34px; height: 34px; font-size: 17px; }

.photo-controls { margin-top: 12px; padding: 13px; border-radius: 10px; background: #f7f9f8; }
.photo-controls > label, .photo-controls .two-columns label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
input[type="range"] { width: 100%; accent-color: var(--green-800); }
.hidden { display: none; }
.text-button { padding: 8px 0 0; border: 0; background: transparent; color: #9e3c3c; font-size: 11px; }
.batch-status { margin-top: 10px; padding: 10px 12px; border-radius: 9px; color: var(--green-950); background: #e9f4f0; font-size: 11px; line-height: 1.45; }
.button-wide { width: 100%; margin-top: 10px; }
.layout-hint { margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.layout-reset { display: block; color: var(--green-800); }
.layout-reset.hidden { display: none; }

.field-grid { display: grid; gap: 12px; margin-top: 15px; }
.field { display: grid; gap: 6px; }
.field > span { display: flex; justify-content: space-between; color: #3c4943; font-size: 12px; font-weight: 700; }
.field em { color: var(--muted); font-style: normal; font-weight: 400; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; color: var(--ink); outline: 0; background: white; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--green-800); box-shadow: 0 0 0 3px rgba(0,98,64,.09); }

.preview-area { min-width: 0; display: grid; grid-template-rows: auto 1fr auto; padding: 22px 26px 16px; overflow: hidden; }
.preview-toolbar, .preview-footer { display: flex; justify-content: space-between; align-items: center; }
.preview-actions { display: flex; gap: 9px; }
.button { border: 0; border-radius: 9px; padding: 10px 15px; font-size: 12px; font-weight: 750; }
.button-primary { color: white; background: var(--green-800); box-shadow: 0 7px 18px rgba(0,98,64,.2); }
.button-primary:hover { background: var(--green-900); }
.button-ghost { color: #34433d; background: #edf1ef; }
.button-ghost:hover { background: #e3e9e6; }

.canvas-stage { min-height: 0; margin: 18px 0 12px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background-color: #e3e8e5; background-image: linear-gradient(45deg,#d8dedb 25%,transparent 25%),linear-gradient(-45deg,#d8dedb 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#d8dedb 75%),linear-gradient(-45deg,transparent 75%,#d8dedb 75%); background-size: 24px 24px; background-position: 0 0,0 12px,12px -12px,-12px 0; box-shadow: var(--shadow); }
#cardCanvas { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; background: white; box-shadow: 0 4px 25px rgba(0,0,0,.12); }
#cardCanvas.layout-editing { cursor: grab; }
#cardCanvas.layout-dragging { cursor: grabbing; }
.preview-footer { color: var(--muted); font-size: 11px; }

.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 20px; padding: 11px 16px; color: white; background: #17241e; border-radius: 9px; font-size: 12px; opacity: 0; pointer-events: none; transition: .22s ease; z-index: 30; }
.toast.show { opacity: 1; translate: -50% 0; }

@media (max-width: 1250px) {
  .workspace { grid-template-columns: 380px minmax(650px, 1fr); }
  .editor-panel { padding-inline: 18px; }
}
