@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=DM+Serif+Display&display=swap");

:root {
  color-scheme: light;
  font-family: "DM Sans", Arial, sans-serif;
  --ink: #1d2927;
  --muted: #6a7771;
  --paper: #f2f4f1;
  --card: #fff;
  --line: #e3e8e3;
  --green: #356b55;
  --green-dark: #234b3b;
  --red: #a53d39;
  --shadow: 0 14px 40px rgba(27,44,35,.07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 320px; margin: 0; background: var(--paper); color: var(--ink); }
body, button, input, textarea, select { font: 14px "DM Sans", Arial, sans-serif; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #e6ad58; outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
.skip-link { position: absolute; z-index: 20; top: 8px; left: 8px; padding: 10px 14px; transform: translateY(-160%); border-radius: 9px; background: #fff; }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.studio-topbar { position: sticky; z-index: 10; top: 0; display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 18px; padding: 9px clamp(16px,3vw,40px); border-bottom: 1px solid rgba(228,233,227,.8); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.studio-brand { display: inline-flex; align-items: center; gap: 11px; font-size: 15px; font-weight: 700; }
.studio-brand > span:last-child { display: grid; gap: 2px; }
.studio-brand small { color: var(--muted); font-size: 10px; font-weight: 500; }
.studio-brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: var(--green); color: #fff; font-size: 18px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-link { padding: 9px 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.button { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border: 1px solid transparent; border-radius: 9px; font-size: 12px; font-weight: 700; transition: background .16s ease, transform .16s ease, border-color .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { border-color: var(--green); background: var(--green); color: #fff; }
.button-primary:hover { border-color: var(--green-dark); background: var(--green-dark); }
.button-secondary { border-color: #dce5de; background: #f6f8f6; color: var(--green-dark); }
.button-secondary:hover { border-color: #b6cbbb; background: #eef4ef; }
.button-quiet { border-color: var(--line); background: #fff; color: #3e5148; }
.button-wide { width: 100%; }
.icon-button { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font-size: 20px; }
.mobile-menu-toggle { display: none; }
.studio-status { display: flex; min-height: 36px; align-items: center; gap: 8px; padding: 7px clamp(16px,3vw,40px); border-bottom: 1px solid var(--line); background: #f9fbf8; color: #40564a; font-size: 11px; }
.status-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #54a370; box-shadow: 0 0 0 3px #dceee0; }
.studio-status[data-state="dirty"] .status-dot { background: #d18a28; box-shadow: 0 0 0 3px #faebd2; }
.studio-status[data-state="error"] { background: #fff4f1; color: #8d302b; }
.studio-status[data-state="error"] .status-dot { background: #d2493e; box-shadow: 0 0 0 3px #f4d8d5; }
.storage-note { margin-left: auto; color: #77827c; }
.studio-workspace { display: grid; min-height: calc(100vh - 144px); grid-template-columns: minmax(238px, 260px) minmax(370px,1.12fr) minmax(350px,.94fr); align-items: stretch; }
.catalog-panel { position: sticky; top: 104px; display: flex; height: calc(100vh - 104px); min-height: 560px; flex-direction: column; padding: 22px 16px 16px; overflow-y: auto; border-right: 1px solid var(--line); background: #fff; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.panel-heading h1, .preview-heading h2 { margin: 0; font-family: "DM Serif Display", Georgia, serif; font-size: 25px; font-weight: 400; letter-spacing: -.025em; }
.eyebrow { margin: 0 0 6px; color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.catalog-total { display: grid; min-width: 30px; height: 30px; place-items: center; padding-inline: 8px; border-radius: 999px; background: #eaf2eb; color: var(--green-dark); font-size: 12px; font-weight: 700; }
.search-label, .editor-panel label, .studio-dialog label { display: grid; gap: 6px; color: #52615a; font-size: 11px; font-weight: 700; }
.search-label { margin-bottom: 14px; }
.search-label input, .editor-panel input:not([type="checkbox"]):not([type="color"]):not([type="file"]), .editor-panel textarea, .editor-panel select, .studio-dialog input, .studio-dialog textarea {
  width: 100%; min-width: 0; min-height: 40px; padding: 9px 11px; border: 1px solid #dfe5df; border-radius: 8px; background: #fff; color: var(--ink); font-size: 12px;
}
.editor-panel textarea, .studio-dialog textarea { min-height: 78px; resize: vertical; line-height: 1.55; }
.trade-list { display: grid; gap: 5px; }
.trade-option-wrap { display: grid; grid-template-columns: minmax(0,1fr) 25px; align-items: center; gap: 2px; }
.trade-option { display: grid; grid-template-columns: 35px minmax(0,1fr) 26px; align-items: center; gap: 9px; padding: 8px 8px; border: 1px solid transparent; border-radius: 10px; background: transparent; text-align: left; }
.trade-option:hover { background: #f6f8f6; }
.trade-option.is-active { border-color: #d7e5d9; background: #edf4ee; }
.trade-option-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: #edf2ed; color: var(--green); font-size: 16px; }
.trade-option-copy { min-width: 0; }
.trade-option-copy strong, .trade-option-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-option-copy strong { font-size: 11px; }
.trade-option-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.trade-option-count { color: #829087; font-size: 10px; text-align: right; }
.trade-remove { display: grid; width: 25px; height: 25px; place-items: center; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #9a5c57; font-size: 16px; }
.trade-remove:hover { border-color: #f0d7d4; background: #fff1ef; color: var(--red); }
.empty-list { padding: 14px 8px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.concept-list { display: grid; gap: 4px; margin: 5px 0 4px 42px; }
.concept-option { display: flex; min-width: 0; align-items: center; gap: 7px; padding: 7px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #55655c; text-align: left; }
.concept-option.is-active { border-color: #e0e9e1; background: #fff; color: var(--green-dark); }
.concept-option:hover { background: #fff; }
.concept-number { color: #9aa59f; font-size: 9px; font-weight: 700; }
.concept-name { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.catalog-actions { display: grid; gap: 8px; margin-top: 14px; }
.backup-tools { display: grid; justify-items: start; gap: 8px; margin-top: auto; padding-top: 22px; }
.text-button { padding: 2px 0; border: 0; background: transparent; color: var(--green); font-size: 11px; font-weight: 700; }
.text-button:hover { text-decoration: underline; }
.text-danger { color: var(--red); }
.privacy-note { margin: 13px 0 0; color: #89938e; font-size: 10px; line-height: 1.5; }
.editor-panel { min-width: 0; min-height: calc(100vh - 144px); padding: 27px clamp(20px,3vw,42px) 50px; background: #f8f9f7; }
.empty-editor { width: min(460px,100%); margin: 18vh auto 0; text-align: center; }
.empty-icon { display: grid; width: 58px; height: 58px; margin: 0 auto 17px; place-items: center; border: 1px solid #dce6dd; border-radius: 19px; background: #fff; color: var(--green); font-size: 24px; box-shadow: var(--shadow); }
.empty-editor h2 { margin: 0 0 12px; font-family: "DM Serif Display", Georgia, serif; font-size: 30px; font-weight: 400; }
.empty-editor > p:not(.eyebrow) { margin: 0 auto 20px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.editor-topline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 19px; }
.editor-breadcrumb { display: grid; gap: 4px; }
.editor-breadcrumb span { color: var(--muted); font-size: 10px; }
.editor-breadcrumb h2 { margin: 0; font-family: "DM Serif Display", Georgia, serif; font-size: 27px; font-weight: 400; }
.editor-top-actions { display: flex; gap: 7px; }
.editor-tabs { display: flex; gap: 5px; margin-bottom: 16px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.editor-tab { flex: 1; min-height: 34px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.editor-tab[aria-selected="true"] { background: #eaf2eb; color: var(--green-dark); }
.editor-content-area { display: grid; gap: 13px; }
.editor-card { padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: 0 4px 16px rgba(27,44,35,.025); }
.editor-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.editor-card-heading h3 { margin: 0; font-size: 13px; font-weight: 700; }
.editor-card-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.field-grid .field-full { grid-column: 1 / -1; }
.field-help { margin-top: 4px; color: #87918b; font-size: 10px; font-weight: 400; line-height: 1.5; }
.color-field { display: grid; grid-template-columns: 42px minmax(0,1fr); align-items: center; gap: 9px; }
.color-field input[type="color"] { width: 42px; height: 38px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.list-editor { display: grid; gap: 8px; }
.list-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 7px; padding: 8px; border: 1px solid #edf0ed; border-radius: 9px; background: #fbfcfb; }
.list-row-fields { display: grid; gap: 7px; }
.list-row-actions { display: flex; gap: 4px; }
.mini-button { display: inline-grid; min-width: 28px; height: 28px; place-items: center; padding: 0 6px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #52635a; font-size: 11px; }
.mini-button:hover { border-color: #bfd2c1; background: #f5f8f5; }
.mini-button-danger { color: var(--red); }
.add-row { min-height: 34px; border: 1px dashed #cbd9ce; border-radius: 8px; background: #fff; color: var(--green); font-size: 11px; font-weight: 700; }
.image-card { display: grid; grid-template-columns: 104px minmax(0,1fr); align-items: center; gap: 13px; }
.image-thumbnail { display: grid; width: 104px; height: 78px; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #edf1ed; color: #7a8a7f; font-size: 11px; text-align: center; }
.image-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.image-actions { display: grid; gap: 7px; }
.upload-button { position: relative; display: inline-flex; width: fit-content; min-height: 32px; align-items: center; padding: 7px 10px; border: 1px solid #dce5de; border-radius: 8px; background: #f7f9f7; color: var(--green-dark); font-size: 10px; font-weight: 700; cursor: pointer; }
.upload-button input { position: absolute; width: 1px!important; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.remove-image { width: fit-content; padding: 2px 0; border: 0; background: transparent; color: var(--red); font-size: 10px; font-weight: 700; }
.project-row { padding: 10px; border: 1px solid #edf0ed; border-radius: 10px; background: #fbfcfb; }
.section-toggle-list { display: grid; gap: 3px; }
.section-toggle { display: flex!important; align-items: center; gap: 9px!important; padding: 8px 0; border-bottom: 1px solid #f0f2f0; font-size: 11px!important; }
.section-toggle:last-child { border-bottom: 0; }
.section-toggle input { width: 16px; height: 16px; accent-color: var(--green); }
.section-order-list { display: grid; gap: 5px; }
.section-order-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid #edf0ed; border-radius: 8px; font-size: 11px; }
.section-order-arrows { display: flex; gap: 3px; margin-left: auto; }
.editor-danger-zone { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 15px; border-top: 1px solid var(--line); }
.preview-panel { position: sticky; top: 104px; display: flex; height: calc(100vh - 104px); min-height: 560px; flex-direction: column; padding: 19px 16px 15px; border-left: 1px solid var(--line); background: #eef1ed; }
.preview-heading { display: flex; min-height: 43px; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.preview-heading h2 { font-size: 21px; }
.preview-open { color: var(--green); font-size: 10px; font-weight: 700; }
.preview-frame-wrap { position: relative; min-height: 0; flex: 1; overflow: hidden; border: 1px solid #d8dfd8; border-radius: 11px; background: #fff; box-shadow: var(--shadow); }
.preview-frame-wrap iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-placeholder { display: grid; height: 100%; align-content: center; justify-items: center; gap: 10px; padding: 20px; color: var(--muted); text-align: center; }
.preview-placeholder > span:first-child { color: #9bac9f; font-size: 34px; }
.preview-placeholder strong { color: var(--ink); font-size: 12px; }
.preview-placeholder > span:last-child { max-width: 190px; font-size: 10px; line-height: 1.5; }
.preview-caption { margin: 11px 0 0; color: #7b8780; font-size: 10px; line-height: 1.5; }
.studio-footer { padding: 15px 20px; border-top: 1px solid var(--line); background: #fff; color: #7b8780; font-size: 10px; text-align: center; }
.studio-dialog { width: min(480px,calc(100% - 28px)); max-height: min(88vh,720px); padding: 25px; overflow-y: auto; border: 1px solid var(--line); border-radius: 18px; background: #fff; color: var(--ink); box-shadow: 0 25px 80px rgba(20,32,25,.22); }
.studio-dialog::backdrop { background: rgba(16,28,21,.58); backdrop-filter: blur(3px); }
.dialog-close-form { position: absolute; top: 14px; right: 14px; }
.studio-dialog h2 { margin: 0 35px 9px 0; font-family: "DM Serif Display", Georgia, serif; font-size: 27px; font-weight: 400; }
.studio-dialog > p:not(.eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.6; }
.studio-dialog [data-trade-form] { display: grid; gap: 13px; margin-top: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.mobile-panel-switch { display: none; }

@media (max-width: 1220px) {
  .studio-workspace { grid-template-columns: minmax(225px,250px) minmax(380px,1fr); }
  .preview-panel { display: none; }
  .studio-workspace[data-active-panel="preview"] .preview-panel { position: static; display: flex; height: calc(100vh - 190px); grid-column: 1/-1; min-height: 420px; border-left: 0; }
  .editor-panel, .catalog-panel { display: none; }
  .studio-workspace[data-active-panel="catalog"] .catalog-panel { display: flex; }
  .studio-workspace[data-active-panel="editor"] .editor-panel { display: block; }
  .mobile-panel-switch { position: sticky; z-index: 8; top: 104px; display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; padding: 7px 12px; border-bottom: 1px solid var(--line); background: rgba(249,251,248,.96); }
  .mobile-panel-switch button { min-height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
  .mobile-panel-switch button.is-active { background: #e5eee6; color: var(--green-dark); }
  .studio-workspace { min-height: calc(100vh - 190px); grid-template-columns: minmax(225px,250px) minmax(380px,1fr); }
  .studio-workspace[data-active-panel="catalog"] .editor-panel, .studio-workspace[data-active-panel="catalog"] .preview-panel,
  .studio-workspace[data-active-panel="editor"] .catalog-panel, .studio-workspace[data-active-panel="editor"] .preview-panel,
  .studio-workspace[data-active-panel="preview"] .catalog-panel, .studio-workspace[data-active-panel="preview"] .editor-panel { display: none; }
  .studio-workspace[data-active-panel="catalog"] { display: block; }
  .studio-workspace[data-active-panel="catalog"] .catalog-panel { position: static; height: auto; min-height: calc(100vh - 190px); border-right: 0; }
  .studio-workspace[data-active-panel="editor"] { display: block; }
  .studio-workspace[data-active-panel="preview"] { display: block; }
  .studio-workspace[data-active-panel="editor"] .editor-panel { min-height: calc(100vh - 190px); }
}
@media (max-width: 560px) {
  .studio-topbar { min-height: 60px; padding-inline: 13px; }
  .topbar-actions { gap: 5px; }
  .topbar-link { display: none; }
  .topbar-actions .button { min-height: 34px; padding: 7px 9px; font-size: 10px; }
  .mobile-menu-toggle { display: none; }
  .studio-status { align-items: flex-start; padding-inline: 13px; }
  .storage-note { max-width: 53%; font-size: 9px; text-align: right; }
  .mobile-panel-switch { top: 96px; }
  .studio-workspace { min-height: calc(100vh - 180px); }
  .editor-panel { padding: 21px 13px 36px; }
  .empty-editor { margin-top: 11vh; }
  .editor-card { padding: 14px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid .field-full { grid-column: auto; }
  .studio-workspace[data-active-panel="preview"] .preview-panel { height: calc(100vh - 180px); min-height: 340px; padding: 12px; }
  .image-card { grid-template-columns: 76px minmax(0,1fr); }
  .image-thumbnail { width: 76px; height: 65px; }
  .editor-top-actions .button { padding-inline: 9px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto!important; transition-duration: .01ms!important; } }
