:root {
  --bg: #e8efe8;
  --surface: rgba(255, 252, 247, 0.78);
  --surface-strong: #fffaf2;
  --text: #181c17;
  --muted: #576156;
  --line: rgba(24, 28, 23, 0.1);
  --primary: #d85b34;
  --primary-strong: #bf4f2c;
  --accent: #177f78;
  --shadow: 0 24px 80px rgba(24, 28, 23, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 20%, rgba(23, 127, 120, 0.16), transparent 26%),
    radial-gradient(circle at 88% 8%, rgba(216, 91, 52, 0.14), transparent 24%),
    linear-gradient(180deg, #f4efe6, var(--bg));
  font-family: "Trebuchet MS", Arial, sans-serif;
}

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

.brand-logo {
  margin: 0 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 7vw, 92px);
  font-weight: 900;
  line-height: 0.88;
  letter-spacing: 0;
  text-transform: uppercase;
  color: #163028;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9),
    0 8px 18px rgba(24, 28, 23, 0.14),
    0 24px 60px rgba(23, 127, 120, 0.18);
}

.brand-logo::first-letter {
  color: var(--primary);
}

.brand-logo-small {
  font-size: clamp(24px, 2.55vw, 36px);
  margin-bottom: 4px;
  line-height: 0.92;
}

.product-title {
  margin: 0 0 16px;
  color: var(--muted);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(15px, 1.45vw, 21px);
  font-weight: 700;
  line-height: 1.15;
  max-width: 34ch;
}

.auth-copy .brand-logo {
  font-size: clamp(28px, 4.2vw, 56px);
  margin-bottom: 12px;
  line-height: 0.96;
}

.auth-copy .product-title {
  font-size: clamp(15px, 1.5vw, 20px);
  max-width: 38ch;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  background: linear-gradient(145deg, rgba(255, 250, 242, 0.84), rgba(255, 255, 255, 0.68));
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  padding: 28px;
  backdrop-filter: blur(14px);
}

.auth-copy h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 0.95;
  margin: 0 0 16px;
  max-width: 10ch;
}

.auth-copy p {
  max-width: 52ch;
  line-height: 1.7;
  color: var(--muted);
}

.auth-form,
.publish-form {
  display: grid;
  gap: 16px;
  align-content: start;
}

.public-shell {
  min-height: 100vh;
}

.public-hero {
  min-height: 100vh;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(44px, 8vw, 96px) 0;
  display: grid;
  align-content: center;
  gap: clamp(28px, 5vw, 54px);
}

.public-hero-copy {
  max-width: 760px;
}

.public-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  color: #12362f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 3.2vw, 40px);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9),
    0 10px 24px rgba(24, 28, 23, 0.18);
}

.public-eyebrow i {
  color: var(--primary);
  font-size: 0.92em;
}

.public-lead {
  max-width: 66ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.65;
}

.public-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.public-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
}

.public-actions i {
  font-size: 18px;
}

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

.public-showcase article {
  position: relative;
  padding: 22px;
  background: rgba(255, 250, 242, 0.82);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(24, 28, 23, 0.08);
}

.public-card-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 14px 32px rgba(24, 28, 23, 0.16);
  font-size: 22px;
}

.public-showcase span {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--primary);
  font-weight: 800;
}

.public-showcase strong {
  display: block;
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
}

.public-showcase p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.public-projects {
  display: grid;
  gap: 22px;
  padding: clamp(28px, 5vw, 52px);
  background: rgba(255, 250, 242, 0.72);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.public-section-title {
  display: grid;
  gap: 8px;
}

.public-section-title h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 0.95;
  color: #163028;
}

.public-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 14px;
}

.public-project-card {
  display: grid;
  align-content: start;
  padding: 22px;
  min-height: 250px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(24, 28, 23, 0.08);
}

.public-project-card h3 {
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1.08;
  color: #163028;
}

.public-project-card p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.public-project-card a {
  align-self: end;
  justify-self: start;
  color: var(--primary-strong);
  font-weight: 800;
  text-decoration: none;
}

.public-project-card a:hover {
  color: var(--accent);
}

.auth-form label,
.model-field,
.publish-form label {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(23, 127, 120, 0.45);
  box-shadow: 0 0 0 4px rgba(23, 127, 120, 0.1);
}

textarea {
  min-height: 340px;
  resize: vertical;
  line-height: 1.65;
}

.primary-button,
.secondary-button {
  border: 0;
  cursor: pointer;
  padding: 14px 18px;
  transition: transform 120ms ease, background 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), #ee9e63);
  color: white;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  border: 1px solid var(--line);
}

.action-generate {
  background: linear-gradient(135deg, #d85b34, #f0a36a);
  color: #ffffff;
}

.action-revise {
  background: linear-gradient(135deg, #177f78, #45b7a9);
  color: #ffffff;
  border-color: rgba(23, 127, 120, 0.42);
}

.action-publish {
  background: linear-gradient(135deg, #225a95, #4f8fd6);
  color: #ffffff;
  border-color: rgba(34, 90, 149, 0.42);
}

.action-clear {
  background: #fff5df;
  color: #7a4a12;
  border-color: rgba(122, 74, 18, 0.26);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(24, 28, 23, 0.12);
}

.primary-button:active,
.secondary-button:active,
.primary-button.is-loading,
.secondary-button.is-loading {
  transform: translateY(1px) scale(0.98);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.primary-button.is-loading,
.secondary-button.is-loading {
  position: relative;
  overflow: hidden;
}

.primary-button.is-loading::after,
.secondary-button.is-loading::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
  animation: button-load 1s linear infinite;
}

@keyframes button-load {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

.form-error {
  color: #8d2e2a;
}

.admin-shell {
  min-height: 100vh;
  padding: 10px 14px 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 10px;
}

.topbar h1,
.panel-head h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.topbar h1 {
  font-size: clamp(13px, 1.3vw, 17px);
  line-height: 1.12;
  max-width: 42ch;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.toolbar .primary-button,
.toolbar .secondary-button {
  padding: 11px 14px;
  font-size: 14px;
  min-height: 48px;
  white-space: nowrap;
}

.toolbar .model-field select {
  width: 230px;
  min-width: 230px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.toolbar .image-model-field select {
  width: 148px;
  min-width: 148px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 40%) minmax(420px, 60%);
  gap: 18px;
  min-height: calc(100vh - 104px);
}

.editor-panel,
.preview-panel {
  min-width: 0;
  background: linear-gradient(145deg, rgba(255, 252, 247, 0.84), rgba(255, 255, 255, 0.66));
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 18px;
  display: grid;
  gap: 16px;
}

.editor-panel {
  grid-template-rows: auto minmax(220px, 1fr) auto auto;
}

.preview-panel {
  grid-template-rows: auto 1fr;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.status-row,
.published-link {
  font-size: 14px;
  color: var(--muted);
}

.published-link a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(23, 127, 120, 0.35);
}

.published-link a:hover {
  color: var(--primary);
  border-bottom-color: currentColor;
}

#previewFrame {
  width: 100%;
  min-height: 72vh;
  border: 1px solid var(--line);
  background: white;
}

.preview-wrap {
  position: relative;
  min-height: 72vh;
}

.preview-wrap #previewFrame {
  height: 100%;
}

.busy-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background:
    radial-gradient(circle at 50% 42%, rgba(23, 127, 120, 0.2), transparent 28%),
    rgba(255, 252, 247, 0.82);
  backdrop-filter: blur(10px);
  z-index: 3;
  text-align: center;
  color: var(--text);
}

.busy-overlay[hidden] {
  display: none;
}

.busy-overlay strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
}

.busy-overlay small {
  color: var(--muted);
}

.loader-orbit {
  position: relative;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(23, 127, 120, 0.22);
  border-radius: 50%;
  animation: orbit-spin 1.4s linear infinite;
}

.loader-orbit span {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 30px rgba(216, 91, 52, 0.42);
}

.loader-orbit span:nth-child(1) {
  top: -9px;
  left: calc(50% - 9px);
}

.loader-orbit span:nth-child(2) {
  right: 4px;
  bottom: 14px;
  background: var(--accent);
}

.loader-orbit span:nth-child(3) {
  left: 4px;
  bottom: 14px;
  background: #f2b705;
}

@keyframes orbit-spin {
  to {
    transform: rotate(360deg);
  }
}

.projects-panel {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.image-plan-panel {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  --details-accent: #177f78;
  --details-accent-soft: rgba(23, 127, 120, 0.14);
  --details-border: rgba(23, 127, 120, 0.34);
  --details-bg: rgba(226, 249, 246, 0.72);
  --details-bg-open: rgba(215, 246, 241, 0.94);
  --details-content-bg: rgba(239, 253, 251, 0.58);
}

.block-editor-panel {
  border-top: 1px solid rgba(74, 139, 73, 0.22);
  padding-top: 12px;
  --details-accent: #3f7f3f;
  --details-accent-soft: rgba(74, 139, 73, 0.15);
  --details-border: rgba(74, 139, 73, 0.34);
  --details-bg: rgba(236, 248, 229, 0.78);
  --details-bg-open: rgba(224, 244, 214, 0.96);
  --details-content-bg: rgba(245, 252, 239, 0.62);
}

.image-plan-panel[open],
.block-editor-panel[open] {
  border-top-color: var(--details-border);
}

.image-plan-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  border: 1px solid var(--details-border, var(--line));
  background: var(--details-bg, rgba(255, 255, 255, 0.72));
  padding: 12px 14px;
  box-shadow: inset 4px 0 0 var(--details-accent, var(--accent));
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}

.image-plan-summary::-webkit-details-marker {
  display: none;
}

.image-plan-summary::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--details-accent-soft, rgba(23, 127, 120, 0.12));
  color: var(--details-accent, var(--accent));
  font-weight: 900;
}

.image-plan-panel[open] .image-plan-summary::before {
  content: "−";
}

.image-plan-panel[open] .image-plan-summary::before,
.block-editor-panel[open] .image-plan-summary::before {
  content: "-";
  background: var(--details-accent, var(--accent));
  color: #ffffff;
}

.image-plan-panel[open] .image-plan-summary,
.block-editor-panel[open] .image-plan-summary {
  background: var(--details-bg-open, rgba(255, 255, 255, 0.9));
  border-color: var(--details-accent, var(--accent));
  box-shadow:
    inset 4px 0 0 var(--details-accent, var(--accent)),
    0 10px 24px rgba(24, 28, 23, 0.08);
}

.image-plan-summary:hover {
  background: var(--details-bg-open, rgba(255, 255, 255, 0.9));
  border-color: var(--details-accent, var(--accent));
  transform: translateY(-1px);
}

.image-plan-summary span {
  flex: 1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
}

.image-plan-summary small {
  color: var(--muted);
  font-size: 13px;
}

.image-plan-panel[open] .image-plan-summary small,
.block-editor-panel[open] .image-plan-summary small {
  color: var(--details-accent, var(--accent));
  font-weight: 700;
}

.image-plan-content {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--details-border, var(--line));
  background: var(--details-content-bg, rgba(255, 255, 255, 0.44));
}

.block-editor-content {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--details-border, var(--line));
  background: var(--details-content-bg, rgba(255, 255, 255, 0.44));
}

.block-editor-content label {
  display: grid;
  gap: 8px;
}

.block-editor-content label span {
  color: var(--accent);
  font-weight: 700;
}

.block-editor-panel .block-editor-content label span {
  color: var(--details-accent);
}

.block-editor-content textarea {
  min-height: 120px;
}

.block-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

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

.bullet-icon-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 180px);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.bullet-icon-row span {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

.native-icon-select {
  display: none;
}

.icon-picker {
  position: relative;
  min-width: 0;
}

.icon-picker-button {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.icon-picker-button:hover,
.icon-picker.is-open .icon-picker-button {
  border-color: rgba(23, 127, 120, 0.45);
  box-shadow: 0 0 0 4px rgba(23, 127, 120, 0.1);
}

.icon-picker-current,
.icon-picker-option i {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(23, 127, 120, 0.12);
  color: var(--accent);
  font-size: 14px;
}

.icon-picker-current i.is-auto,
.icon-picker-option i.is-auto {
  opacity: 0.64;
}

.icon-picker-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-picker-chevron {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.icon-picker-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  max-height: 290px;
  overflow: auto;
  border: 1px solid rgba(23, 127, 120, 0.26);
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(24, 28, 23, 0.18);
  padding: 6px;
}

.icon-picker.is-open .icon-picker-menu {
  display: grid;
  gap: 2px;
}

.icon-picker-option {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
}

.icon-picker-option:hover,
.icon-picker-option.is-selected {
  background: rgba(23, 127, 120, 0.1);
}

.icon-picker-option.is-selected {
  font-weight: 700;
}

.image-plan-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.image-plan-card h3,
.image-plan-card p {
  margin: 0;
}

.image-plan-card h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
}

.image-plan-card p {
  color: var(--muted);
  line-height: 1.5;
}

.image-prompt-field {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.image-prompt-field span {
  color: var(--accent);
  font-weight: 700;
}

.image-prompt-field textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid var(--line);
  background: rgba(24, 28, 23, 0.06);
  padding: 10px;
  font: 13px/1.55 Consolas, "Courier New", monospace;
  color: var(--text);
}

.projects-list {
  display: grid;
  gap: 10px;
  max-height: 220px;
  overflow: auto;
}

.project-item {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
  padding: 10px;
}

.project-open {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 2px;
  text-align: left;
}

.project-open strong {
  display: block;
  margin-bottom: 4px;
}

.project-open small {
  color: var(--muted);
}

.project-item.active {
  border-color: rgba(23, 127, 120, 0.45);
  box-shadow: inset 0 0 0 1px rgba(23, 127, 120, 0.22);
}

.project-delete {
  border: 1px solid rgba(141, 46, 42, 0.24);
  background: rgba(141, 46, 42, 0.08);
  color: #8d2e2a;
  cursor: pointer;
  padding: 8px 10px;
  align-self: center;
  transition: background 160ms ease, transform 120ms ease;
}

.project-delete:hover {
  background: rgba(141, 46, 42, 0.14);
}

.project-delete:active {
  transform: translateY(1px);
}

.publish-dialog {
  border: 1px solid var(--line);
  padding: 0;
  background: transparent;
}

.publish-form {
  background: var(--surface-strong);
  padding: 20px;
  min-width: min(520px, calc(100vw - 32px));
}

.slug-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

menu {
  display: flex;
  justify-content: end;
  gap: 12px;
  padding: 0;
  margin: 8px 0 0;
}

@media (max-width: 980px) {
  .auth-panel,
  .workspace {
    grid-template-columns: 1fr;
  }

  .block-editor-grid,
  .block-editor-actions,
  .bullet-icon-row {
    grid-template-columns: 1fr;
  }

  .public-showcase {
    grid-template-columns: 1fr;
  }

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