:root {
  font-family: Lato, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #202e2c;
  background: #f7f8f5;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; background: #fff; border-bottom: 1px solid #dfe5dc; }
.brand-wrap, .brand { display: flex; align-items: center; gap: 11px; }
.brand { text-decoration: none; font-size: 15px; font-weight: 800; letter-spacing: -.025em; color: #173454; }
.brand-icon { width: 30px; height: 30px; border-radius: 8px; background: #18614c; color: #fff; display: grid; place-items: center; font-size: 16px; font-weight: 900; box-shadow: 0 3px 8px #18614c26; }
.brand-divider { width: 1px; height: 21px; margin: 0 5px; background: #d9e2ed; }
.brand-section { font-size: 14px; font-weight: 600; color: #687e94; }
.top-links { display: flex; gap: 25px; }
.top-links a { color: #657b91; font-size: 13px; font-weight: 650; text-decoration: none; }
.top-links a:hover { color: #18614c; }

.app-shell { display: grid; grid-template-columns: 266px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.template-panel { display: flex; flex-direction: column; height: calc(100vh - 68px); min-height: 0; overflow: hidden; padding: 28px 14px 20px; background: #fff; border-right: 1px solid #dfe5dc; }
.sidebar-head { padding: 0 12px; }
.eyebrow { color: #627a56; font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.sidebar-head h1 { font-size: 23px; line-height: 1.2; margin: 8px 0 7px; letter-spacing: -.04em; }
.sidebar-head p { margin: 0; color: #6f7b68; font-size: 12px; line-height: 1.5; }
.search-wrap { display: flex; align-items: center; gap: 9px; margin: 24px 6px 16px; padding: 0 11px; height: 38px; border: 1px solid #dce5ef; border-radius: 8px; background: #f9fbfd; color: #92a3b2; }
.search-wrap:focus-within { border-color: #6fa5ca; box-shadow: 0 0 0 3px #327eae1c; }
.search-wrap svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; flex: none; }
.search-wrap input { border: 0; background: transparent; width: 100%; outline: 0; color: #183552; font-size: 12px; }
.search-wrap input::placeholder { color: #778771; }
.template-list { overflow: auto; flex: 1; padding: 0 2px 20px; }
.template-group { margin-bottom: 17px; }
.group-heading { margin: 0 9px 7px; color: #778771; font-size: 10px; text-transform: uppercase; font-weight: 800; letter-spacing: .12em; }
.template-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; color: #596951; font-size: 12px; font-weight: 650; line-height: 1.25; }
.template-item:hover { background: #f3f7fb; color: #1d547c; }
.template-item.active { background: #eaf2e8; color: #18614c; box-shadow: inset 3px 0 #64805a; }
.template-glyph { flex: none; display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #e1eaf2; border-radius: 6px; color: #6a90ad; background: #fff; font-size: 12px; font-weight: 800; }
.template-item.active .template-glyph { border-color: #b9d8eb; color: #2b759f; }
.sidebar-foot { padding: 15px 12px 0; border-top: 1px solid #e6ebe1; color: #9caebe; font-size: 11px; }
.sidebar-foot span { padding: 0 3px; }

.work-area { display: grid; grid-template-columns: minmax(410px, 1.05fr) minmax(360px, .95fr); gap: 20px; padding: 22px; min-width: 0; height: calc(100vh - 68px); }
.editor-panel, .preview-panel { min-height: 0; background: #fff; border: 1px solid #dfe5dc; border-radius: 13px; box-shadow: 0 4px 20px #1e476709; }
.editor-panel { display: flex; flex-direction: column; overflow: hidden; }
.editor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding: 27px 30px 23px; border-bottom: 1px solid #e6ebe1; }
.editor-head h2, .preview-head h2 { margin: 7px 0 6px; font-size: 24px; letter-spacing: -.045em; line-height: 1.15; }
.editor-head p { margin: 0; max-width: 560px; color: #6b7963; font-size: 12px; line-height: 1.5; }
.type-badge { flex: none; background: #edf3e7; border: 1px solid #dce5d4; color: #58714c; border-radius: 6px; padding: 5px 8px; font: 600 10px/1.2 ui-monospace, Consolas, monospace; }
.editor-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 28px; border-bottom: 1px solid #e6ebe1; }
.segmented { display: inline-flex; padding: 3px; border-radius: 8px; background: #f0f4f8; }
.segmented button { border: 0; border-radius: 6px; background: none; padding: 7px 12px; color: #6c7865; font-size: 11px; font-weight: 700; }
.segmented button.active { color: #31563d; background: #fff; box-shadow: 0 1px 4px #1e476718; }
.toolbar-actions { display: flex; gap: 12px; }
.text-button { padding: 6px 0; border: 0; background: none; color: #4c7895; font-size: 11px; font-weight: 700; white-space: nowrap; }
.text-button:hover { color: #1d5e87; text-decoration: underline; }
.editor-empty, .preview-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; flex: 1; padding: 24px; }
.editor-empty h3, .preview-empty h3 { margin: 22px 0 7px; font-size: 17px; letter-spacing: -.025em; }
.editor-empty p, .preview-empty p { margin: 0; color: #91a2b4; font-size: 12px; line-height: 1.55; max-width: 220px; }
.empty-graphic { position: relative; width: 94px; height: 94px; border: 1px solid #dbe9f2; border-radius: 20px; background: linear-gradient(145deg,#f4faff,#e8f3fa); box-shadow: 0 10px 25px #275e7c13; }
.empty-graphic span { display: block; height: 6px; margin: 20px 18px 0; border-radius: 8px; background: #b9d7e9; }
.empty-graphic span + span { width: 46px; margin-top: 10px; }
.empty-graphic span:last-child { width: 32px; }
.form-panel { overflow: auto; flex: 1; padding: 24px 30px 32px; }
.json-panel { overflow: auto; flex: 1; display: flex; flex-direction: column; padding: 24px 30px 28px; }
.json-panel label { font-weight: 750; font-size: 12px; }
.json-panel p { color: #8498ab; font-size: 12px; margin: 6px 0 14px; }
.json-panel textarea { flex: 1; min-height: 330px; width: 100%; padding: 16px; resize: vertical; outline: none; border: 1px solid #dce6ef; border-radius: 9px; color: #223d56; background: #f9fbfd; font: 12px/1.6 ui-monospace, Consolas, monospace; tab-size: 2; }
.json-panel textarea:focus { border-color: #6fa5ca; box-shadow: 0 0 0 3px #327eae1c; }
.form-section { margin: 0 0 26px; }
.section-title { margin: 0 0 14px; color: #20435f; font-size: 13px; font-weight: 800; letter-spacing: -.01em; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field label { color: #415d74; font-size: 11px; font-weight: 750; }
.field input, .field textarea, .field select { width: 100%; outline: none; border: 1px solid #dce6ef; border-radius: 7px; background: #fff; color: #19354e; padding: 9px 11px; font-size: 12px; transition: border-color .15s, box-shadow .15s; }
.field textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #64a2cb; box-shadow: 0 0 0 3px #327eae1a; }
.field input[type=color] { height: 38px; padding: 3px; }
.field input[type=file] { border-style: dashed; background: #f9fcfe; }
.field small { color: #9babb8; font-size: 10px; }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: #d46a68; }
.field.invalid small { color: #b65250; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.object-card, .array-card { border: 1px solid #e4ecf3; border-radius: 9px; background: #fbfcf9; padding: 15px 15px 2px; margin-bottom: 15px; }
.object-card > .section-title { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eaf0f5; padding-bottom: 11px; margin-bottom: 16px; }
.array-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 7px 0 12px; }
.array-heading .section-title { margin: 0; }
.array-count { color: #97a9b9; font-size: 10px; font-weight: 700; margin-left: 5px; }
.array-item { position: relative; padding: 15px 15px 1px; margin-bottom: 10px; background: #fff; border: 1px solid #e3ebf2; border-radius: 8px; }
.item-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 12px; color: #435f77; font-size: 11px; font-weight: 800; }
.item-actions { display: flex; gap: 6px; }
.mini-button, .add-button { border: 1px solid #d7e5ef; border-radius: 6px; background: #fff; color: #4e7f9f; font-size: 10px; font-weight: 750; padding: 5px 8px; }
.mini-button:hover, .add-button:hover { background: #eef6fb; border-color: #afcfe3; }
.mini-button.danger { color: #b87370; }
.mini-button.danger:hover { background: #fff1ef; border-color: #ebc8c4; }
.add-button { margin: 1px 0 15px; padding: 7px 10px; }
.image-note { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 2px; color: #6d8a9f; font-size: 10px; }
.image-thumb { max-width: 80px; max-height: 50px; border: 1px solid #e1eaf2; border-radius: 4px; }
.error-panel { margin: 0 28px 16px; padding: 12px 15px; border: 1px solid #f0c9c6; border-radius: 8px; color: #9b403c; background: #fff5f3; font-size: 11px; line-height: 1.5; max-height: 140px; overflow: auto; }
.error-panel ul { margin: 5px 0 0; padding-left: 18px; }
.editor-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px 28px; border-top: 1px solid #e6ebe1; background: #fff; }
.footer-note { color: #99aab8; font-size: 10px; }
.primary-button { display: flex; align-items: center; justify-content: space-between; gap: 30px; border: 0; border-radius: 7px; padding: 11px 15px; min-width: 146px; color: #fff; background: #18614c; font-size: 12px; font-weight: 800; box-shadow: 0 3px 8px #18614c30; }
.primary-button:hover { background: #104b3a; }
.primary-button:disabled { opacity: .65; cursor: wait; }

.preview-panel { display: flex; flex-direction: column; overflow: hidden; background: #f5f7f1; }
.preview-head { display: flex; justify-content: space-between; align-items: center; padding: 27px 27px 20px; background: #fff; border-bottom: 1px solid #e6ebe1; }
.preview-head h2 { margin-bottom: 0; }
.preview-status { padding: 6px 9px; border-radius: 99px; background: #f2f5f8; color: #91a3b2; font-size: 10px; font-weight: 750; white-space: nowrap; }
.preview-status.ready { color: #318067; background: #e6f5ee; }
.preview-status.dirty { color: #a67731; background: #fff4dc; }
.preview-empty { background: radial-gradient(circle at center, #fff 0, #f8fbfe 75%); }
.paper-illustration { width: 133px; height: 176px; padding: 27px 20px; border: 1px solid #dbe7ef; border-radius: 4px; background: #fff; box-shadow: 0 12px 25px #2a547d20; transform: rotate(-3deg); }
.paper-line { display: block; width: 77%; height: 5px; margin-bottom: 9px; border-radius: 5px; background: #dce9f3; }
.paper-line.long { width: 90%; height: 8px; background: #8db7d2; margin-bottom: 18px; }
.paper-line.short { width: 52%; }
.paper-block { display: block; height: 27px; margin: 18px 0 14px; border-radius: 3px; background: #eff6fa; }
.canvas-wrap { flex: 1; overflow: auto; min-height: 0; padding: 24px; background: #e8ede2; text-align: center; }
#pdf-preview { display: block; width: auto; height: auto; max-width: 100%; margin: 0 auto; background: #fff; box-shadow: 0 5px 22px #2d4a6133; }
.preview-footer { display: flex; align-items: center; justify-content: space-between; padding: 13px 20px; background: #fff; border-top: 1px solid #e8edf2; }
.preview-footer span { color: #8c9eaf; font-size: 10px; }
.page-navigation { display: flex; align-items: center; gap: 7px; }
.page-navigation button { border: 1px solid #d6e3ed; background: #f9fcfe; color: #376786; width: 27px; height: 27px; border-radius: 6px; font-size: 13px; }
.page-navigation button:hover:not(:disabled) { background: #e8f3f9; }
.page-navigation button:disabled { opacity: .35; cursor: default; }
.page-navigation span { min-width: 55px; text-align: center; font-size: 10px; font-weight: 750; }
.download-button { display: inline-flex; justify-content: center; align-items: center; padding: 9px 13px; text-decoration: none; background: #eaf2e5; border: 1px solid #d0dec7; border-radius: 7px; color: #386331; font-size: 11px; font-weight: 800; }
.download-button:hover { background: #dfebd7; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: 280px; padding: 11px 15px; border-radius: 8px; color: #fff; background: #1d425e; box-shadow: 0 6px 20px #1d425e40; font-size: 12px; }

.studio-gate { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 44px 20px; background: linear-gradient(135deg, #f4f7ef 0%, #fbfcf9 52%, #edf3e8 100%); }
.studio-gate-card { width: min(100%, 490px); padding: 38px 40px; border: 1px solid #dfe5dc; border-radius: 10px; background: #fff; box-shadow: 0 18px 48px #30462012; }
.studio-gate-card h1 { margin: 10px 0 8px; color: #263c2a; font-family: Georgia, serif; font-size: clamp(30px, 5vw, 38px); font-weight: 400; letter-spacing: -.04em; }
.studio-gate-intro { margin: 0 0 26px; color: #61705c; line-height: 1.6; }
.studio-gate-card form label { display: block; margin-bottom: 7px; color: #34482d; font-size: 13px; font-weight: 700; }
.studio-gate-card form input { width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid #cbd5c4; border-radius: 6px; background: #fcfdf9; color: #273a2a; font: inherit; }
.studio-gate-card form input:focus { border-color: #789868; outline: 0; box-shadow: 0 0 0 3px #94b78330; }
.studio-gate-submit { width: 100%; justify-content: space-between; margin-top: 18px; }
.studio-gate-error { margin: 12px 0 0; color: #a23333; font-size: 13px; }
.studio-gate-note { margin: 20px 0 0; color: #778373; font-size: 12px; line-height: 1.55; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 222px minmax(0,1fr); }
  .work-area { grid-template-columns: minmax(0,1fr); height: auto; }
  .editor-panel { min-height: 600px; }
  .form-panel { max-height: 650px; }
  .preview-panel { min-height: 560px; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 16px; height: 60px; }
  .top-links { gap: 12px; }
  .top-links a { font-size: 11px; }
  .top-links a:nth-child(2) { display: none; }
  .brand-section, .brand-divider { display: none; }
  .app-shell { display: block; }
  .template-panel { height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid #dfe5dc; padding: 18px 12px 8px; }
  .sidebar-head p, .sidebar-foot { display: none; }
  .sidebar-head h1 { margin-bottom: 0; }
  .search-wrap { margin: 14px 6px 9px; }
  .template-list { display: flex; overflow-x: auto; padding-bottom: 8px; }
  .template-group { flex: none; margin: 0 10px 0 0; }
  .group-heading { margin-bottom: 5px; }
  .template-group-items { display: flex; gap: 5px; }
  .template-item { white-space: nowrap; width: auto; }
  .work-area { padding: 12px; gap: 12px; }
  .editor-head, .preview-head { padding: 20px; }
  .editor-head h2, .preview-head h2 { font-size: 21px; }
  .editor-toolbar { padding: 12px 18px; flex-wrap: wrap; }
  .form-panel, .json-panel { padding: 20px; }
  .editor-footer { padding: 14px 18px; }
  .footer-note { max-width: 140px; }
}

/* Workspace typography and surfaces follow the public documentation pages. */
.site-header .header-inner { max-width: none; padding-left: 28px; padding-right: 28px; }
.app-shell, .template-panel, .work-area { min-height: calc(100vh - 86px); }
.template-panel, .work-area { height: calc(100vh - 86px); }
.sidebar-head h1, .editor-head h2, .preview-head h2 { font-family: Georgia, serif; font-weight: 400; letter-spacing: -.035em; }
.sidebar-head h1 { font-size: 28px; }
.editor-head h2, .preview-head h2 { font-size: 28px; }
.editor-panel, .preview-panel { border-radius: 8px; box-shadow: 0 3px 12px #30462008; }
.field input, .field textarea, .field select { background: #fcfdf9; border-color: #d4decd; color: #34482d; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #8da67a; box-shadow: 0 0 0 3px #94b78320; }
.search-wrap { border-color: #d4decd; background: #f9fbf5; }
.search-wrap:focus-within { border-color: #8da67a; box-shadow: 0 0 0 3px #94b78320; }
.search-wrap input { color: #34482d; }
.template-item:hover { color: #315d3e; background: #f0f5e9; }
.template-glyph, .template-item.active .template-glyph { color: #617e53; border-color: #d6e3cb; }
.group-heading { color: #7f8d74; }
.sidebar-foot, .footer-note, .preview-footer span { color: #75836c; }
.text-button, .mini-button, .add-button { color: #527b42; }
.mini-button:hover, .add-button:hover { color: #315d3e; background: #eff5e7; border-color: #bccdb0; }
.array-card, .object-card, .array-item { border-color: #dfe5d8; }
.segmented { background: #edf2e7; }
.segmented button.active { color: #315d3e; }
.primary-button { box-shadow: 0 3px 8px #30462017; }
.preview-empty { background: radial-gradient(circle at center, #fff 0, #f3f7ed 75%); }
.paper-line { background: #dfe8d5; }
.paper-line.long { background: #8faa7d; }
.paper-block { background: #eef3e7; }
.download-button { color: #386331; border-color: #cbdcc0; background: #eaf2e4; }
.download-button:hover { background: #dfebd7; }
.page-navigation button { color: #496940; border-color: #cddcc3; background: #f7faf2; }
.toast { background: #315b40; }
@media (max-width: 1180px) { .work-area { height: auto; } }
@media (max-width: 780px) {
  .site-header .header-inner { padding-left: 20px; padding-right: 20px; }
  .studio-gate { min-height: calc(100vh - 120px); padding: 28px 16px; }
  .studio-gate-card { padding: 30px 24px; }
  .app-shell { display: block; min-height: 0; }
  .template-panel { height: auto; min-height: 0; padding: 20px 14px 8px; }
  .work-area { min-height: 0; }
}
