:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #61708a;
  --line: #dce3ef;
  --blue: #2779d9;
  --blue-dark: #1559a8;
  --selected: #e8f2ff;
  --danger: #c93434;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Arial, sans-serif; color: var(--ink); background: var(--bg); }
.app-header { height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.app-header h1 { margin: 0 0 3px; font-size: 20px; }
.app-header p { margin: 0; color: var(--muted); font-size: 13px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
button, .file-button { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
button:hover, .file-button:hover { border-color: var(--blue); }
button.primary { background: var(--blue); border-color: var(--blue); color: white; font-weight: 700; }
button.primary:hover { background: var(--blue-dark); }
button.danger { color: var(--danger); border-color: #f0b8b8; }
.file-button input { display: none; }
.layout { display: grid; grid-template-columns: 300px minmax(520px, 1fr) 360px; height: calc(100vh - 78px); }
.sidebar { overflow: auto; padding: 12px; }
.left-panel { border-right: 1px solid var(--line); }
.right-panel { border-left: 1px solid var(--line); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(12, 24, 48, 0.04); }
.panel h2 { font-size: 14px; margin: 0 0 10px; }
.preview-panel { display: flex; flex-direction: column; min-width: 0; }
.preview-toolbar { height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fbfcfe; color: var(--muted); font-size: 13px; }
#previewFrame { width: 100%; height: 100%; border: 0; background: white; }
.list { display: flex; flex-direction: column; gap: 6px; }
.list-item { display: block; width: 100%; text-align: left; border-radius: 8px; border: 1px solid var(--line); background: #fff; padding: 8px; cursor: pointer; }
.list-item:hover { background: #f8fbff; }
.list-item.selected { background: var(--selected); border-color: var(--blue); }
.item-title { font-size: 13px; font-weight: 700; line-height: 1.25; }
.item-meta { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.25; }
.compact .list-item { padding: 7px; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; font-size: 13px; background: white; }
.field textarea { min-height: 110px; resize: vertical; }
.inline-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.editor-empty { color: var(--muted); font-size: 13px; line-height: 1.45; }
.tool-stack { display: flex; flex-direction: column; gap: 8px; }
.notice { padding: 8px; background: #fff8dc; border: 1px solid #f4df91; border-radius: 8px; font-size: 12px; color: #6d5300; }
.preview-selected { outline: 3px solid #38B0F7 !important; outline-offset: 2px !important; }
.preview-hover { outline: 2px dashed #ff9f1c !important; outline-offset: 2px !important; }
[contenteditable="true"] { cursor: text; }
@media (max-width: 1180px) { .layout { grid-template-columns: 260px minmax(420px, 1fr) 320px; } }


.panel-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel-heading-row h2 { margin: 0; }
.field-help { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.preview-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.view-toggle { display: inline-flex; gap: 2px; padding: 2px; background: #edf3fb; border: 1px solid var(--line); border-radius: 9px; }
.view-toggle button { border: 0; background: transparent; padding: 6px 9px; border-radius: 7px; font-weight: 700; color: var(--muted); }
.view-toggle button.active { background: #fff; color: var(--blue); box-shadow: 0 1px 2px rgba(12, 24, 48, 0.08); }
.preview-view { flex: 1; min-height: 0; }
.preview-view[hidden] { display: none !important; }
.code-workspace { padding: 12px; background: #f8fbff; overflow: auto; }
.code-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.footer-field { flex: 1; max-width: 380px; margin-bottom: 0; }
.code-view { width: 100%; height: calc(100% - 76px); min-height: 360px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: 12px/1.45 Consolas, Monaco, 'Courier New', monospace; color: #1d2939; background: #fff; resize: none; white-space: pre; }
.code-panel { border-color: #c7ddff; }

