:root {
  font-family: Inter, system-ui, sans-serif;
  color: #1c2d23;
  background: #f7f9f6;
  font-synthesis: none;
  --text: #1c2d23;
  --muted: #53675b;
  --line: #dce5dc;
  --soft: #edf4ed;
  --accent: #235c40;
  --card-width: 228px;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
:focus-visible { outline: 2px solid #377b56; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.site-header {
  height: 72px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); background: #fff; gap: 12px;
}
.brand, .toolbar { display: flex; align-items: center; gap: 10px; }
.brand { gap: 11px; }
.brand h1 { font-size: 18px; letter-spacing: -.045em; line-height: 1.16; }
.brand p, .panel-header p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.button, .icon-button { border-radius: 8px; font-size: 13px; font-weight: 650; }
.button { min-height: 36px; padding: 7px 12px; border: 1px solid transparent; white-space: nowrap; }
.primary { color: white; background: var(--accent); }
.primary:hover:not(:disabled) { background: #1b492f; }
.secondary { color: var(--text); background: #fff; border-color: var(--line); }
.secondary:hover:not(:disabled) { background: var(--soft); border-color: #b7cbbd; }
.danger { color: #9b302e; background: #fff; border-color: #efd0cb; }
.danger:hover { background: #fff1ef; }
.save-status { font-size: 12px; color: var(--muted); margin-right: 8px; }
.save-status:not(:empty)::before {
  content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px;
  border-radius: 50%; vertical-align: 1px; background: #67a57b;
}
.save-status[data-error] { color: #9b302e; }
.save-status[data-error]::before { background: #b84b46; }
.workspace {
  display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; padding: 18px 24px 22px;
  height: calc(100dvh - 72px); min-height: 540px;
}
.canvas-panel, .inspector { min-width: 0; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.panel-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: none;
  min-height: 68px; padding: 12px 17px; border-bottom: 1px solid var(--line);
}
.panel-header h2 { font-size: 15px; letter-spacing: -.025em; }
.canvas {
  position: relative; flex: 1; min-height: 0; overflow: auto; isolation: isolate;
  background-color: #f6f9f5;
  background-image: radial-gradient(circle, #cedbd1 1px, transparent 1px);
  background-size: 20px 20px; scrollbar-color: #bccfbf #f6f9f5;
}
.canvas:focus-visible { outline-offset: -3px; }
.board { position: relative; min-height: 100%; min-width: 100%; }
.edges, .nodes { position: absolute; inset: 0; }
.edges { width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.edge-line { fill: none; stroke: #819b89; stroke-width: 1.7; }
.edge-active { stroke: #276846; stroke-width: 2.5; }
.edge-end { fill: #eff7ef; stroke: #527d61; stroke-width: 1.6; }
.empty {
  width: min(385px, calc(100% - 30px)); margin: 0; padding: 32px 20px; text-align: center;
  border: 1px solid var(--line); border-radius: 16px; background: #fffffff5;
  box-shadow: 0 10px 32px #193d2010; position: absolute; top: 48%; left: 50%; translate: -50% -50%;
}
.empty img { margin-bottom: 18px; }
.empty h3 { font-size: 23px; letter-spacing: -.045em; }
.empty p { max-width: 265px; margin: 9px auto 21px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.empty .toolbar { justify-content: center; flex-wrap: wrap; }
.canvas-footer {
  flex: none; padding: 10px 16px; display: flex; gap: 12px; justify-content: space-between;
  border-top: 1px solid var(--line); font-size: 11px; color: var(--muted);
}
.canvas-footer span:first-child { font-weight: 700; color: var(--accent); }
.table-node {
  position: absolute; width: var(--card-width); border-radius: 10px; background: #fff; border: 1px solid #bdcec0;
  box-shadow: 0 5px 18px #25432b14; overflow: hidden;
}
.table-node.selected { border-color: #39835a; box-shadow: 0 0 0 2px #39835a35, 0 7px 19px #25432b19; z-index: 1; }
.node-header {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 40px;
  padding: 0 11px; background: #e8f2e8; border: 0; border-bottom: 1px solid var(--line);
  color: #234831; font-weight: 750; font-size: 13px; text-align: left; cursor: grab; touch-action: none;
}
.node-header:active { cursor: grabbing; }
.node-header:focus-visible { outline-offset: -3px; }
.node-name, .node-column-name, .list-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-header::before {
  content: ''; width: 13px; height: 12px; flex: none; border: 1px solid currentColor; border-radius: 2px;
  background: linear-gradient(currentColor, currentColor) center 3px / 100% 1px no-repeat;
}
.node-column {
  display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 7px; align-items: center;
  padding: 0 10px; height: 29px; border-bottom: 1px solid #edf2ed; font-size: 11px;
}
.node-column:last-child { border-bottom: 0; }
.node-column-name { font-weight: 620; }
.node-type { color: var(--muted); font-size: 10px; }
.key-label { margin-left: 5px; color: #2a6140; font-size: 9px; font-weight: 800; }
.inspector-body { overflow: auto; padding: 15px; }
.inspector-empty { color: var(--muted); font-size: 13px; line-height: 1.55; padding: 10px 2px; }
.inspector-section + .inspector-section { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.inspector-section h3 { font-size: 13px; }
.section-heading { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 9px; }
.small { min-height: 30px; font-size: 11px; padding: 5px 8px; }
label { display: block; font-weight: 650; font-size: 12px; }
input:not([type=checkbox]), select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 36px; padding: 7px 9px;
  border: 1px solid #c8d7cb; border-radius: 7px; color: var(--text); background: #fff; font-size: 13px;
}
label > :is(input, select) { margin-top: 6px; }
select {
  appearance: none; padding-right: 28px;
  background: linear-gradient(45deg, transparent 50%, #476451 50%) right 15px center / 5px 5px no-repeat,
    linear-gradient(135deg, #476451 50%, transparent 50%) right 10px center / 5px 5px no-repeat, #fff;
}
.item-list { display: grid; gap: 5px; }
.list-item {
  border: 1px solid var(--line); background: #fff; border-radius: 7px; color: var(--text);
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 9px; min-height: 33px; text-align: left; font-size: 12px;
}
.list-item:hover, .list-item[aria-pressed=true] { background: var(--soft); border-color: #aec6b2; }
.list-meta { flex: none; color: var(--muted); font-size: 10px; }
.column-editor { background: #f5f8f4; border: 1px solid var(--line); border-radius: 9px; padding: 10px; margin-top: 8px; display: grid; gap: 10px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.column-options { display: flex; gap: 5px 9px; flex-wrap: wrap; }
.check-label { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; }
.check-label input { margin: 0; accent-color: var(--accent); }
.column-editor .danger { justify-self: start; }
.field-note, .error { font-size: 11px; color: #98342e; margin-top: 5px; }
.field-note:empty, .error:empty, .export-status:empty, .issues:empty, .notification:empty { display: none; }
.inspector-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
dialog { width: min(490px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0; border-radius: 14px; border: 1px solid var(--line); color: var(--text); background: #fff; box-shadow: 0 16px 70px #15251d44; }
dialog::backdrop { background: #15251d70; }
.dialog-content { padding: 18px; display: grid; gap: 14px; }
.dialog-heading, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dialog-actions { justify-content: flex-end; }
.dialog-actions > .danger { margin-right: auto; }
.dialog-heading h2 { font-size: 18px; letter-spacing: -.025em; }
.dialog-content p, .issues { font-size: 13px; line-height: 1.5; color: var(--muted); }
.dialog-content .error { color: #98342e; }
.icon-button { background: #fff; color: var(--text); border: 1px solid var(--line); width: 31px; height: 31px; font-size: 20px; line-height: 1; }
.icon-button:hover { background: var(--soft); }
.issues { margin: 0; padding-left: 20px; overflow-wrap: anywhere; }
.export-dialog { width: min(700px, calc(100vw - 28px)); }
#preview { resize: vertical; background: #f5f8f5; font: 12px/1.6 'IBM Plex Mono', monospace; white-space: pre; }
.notification { position: fixed; bottom: 16px; right: 19px; z-index: 3; max-width: calc(100% - 40px); padding: 10px 14px; border-radius: 8px; color: white; background: #235c40; font-size: 13px; pointer-events: none; }
@media (max-width: 850px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 286px; padding: 12px; gap: 10px; }
  .site-header { padding: 0 14px; }
  .panel-header { padding: 10px; }
}
@media (max-width: 680px) {
  .workspace { height: auto; grid-template-columns: minmax(0, 1fr); }
  .canvas-panel { min-height: 450px; }
  .canvas { min-height: 370px; }
  .save-status, #graph-help { display: none; }
  .site-header { height: 62px; }
  .site-header .button { padding-inline: 8px; }
  .brand img { width: 30px; height: 30px; }
  .brand h1 { font-size: 16px; }
  .brand p { font-size: 11px; }
}
@media (max-width: 365px) {
  .panel-header .toolbar, .site-header .toolbar { gap: 5px; }
  .panel-header .button { padding-inline: 6px; font-size: 11px; }
}
