:root {
  color-scheme: light;
  --navy: #102b2c;
  --text: #182d43;
  --muted: #586d81;
  --line: #dbe5ed;
  --accent: #116452;
  --surface: #f2f6fa;
  font-family: Inter, 'Segoe UI', system-ui, sans-serif;
  background: var(--surface);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
button, a, input, select, [tabindex] { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #1684a7; outline-offset: 3px; }
[hidden] { display: none !important; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; flex: none; }
[data-icon] svg { width: 17px; height: 17px; }
.brand-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 clamp(16px, 3.2vw, 48px); min-height: 64px; background: var(--navy); color: #f6fbff;
  border-bottom: 2px solid #35645d;
}
.brand { display: inline-flex; gap: 11px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px;
  color: #dbf4e8; border: 1px solid #648e7e; background: #2a514a; font: 600 24px Georgia, serif;
}
.brand strong { display: block; font-size: 15px; line-height: 1.25; }
.brand small { display: block; margin-top: 2px; color: #b3cada; font-size: 8px; letter-spacing: .11em; white-space: nowrap; }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: #e0eef5; text-decoration: none; font-size: 13px; white-space: nowrap; }
.back-link:hover { text-decoration: underline; }
.workspace { max-width: 1620px; margin: auto; padding: 32px clamp(16px, 3.2vw, 48px) 20px; }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 23px; }
h1 { margin: 0; font-size: clamp(26px, 3vw, 39px); line-height: 1.15; color: var(--navy); letter-spacing: -.044em; font-weight: 740; }
.intro p { margin: 9px 0 0; line-height: 1.5; color: var(--muted); font-size: 14px; }
.project-actions, .tool-group { display: flex; gap: 8px; align-items: center; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px;
  border: 1px solid #cddce7; border-radius: 8px; background: #fff; color: #284258; padding: 7px 12px;
  font-size: 13px; font-weight: 650; white-space: nowrap;
}
.button:hover { border-color: #a6c5d4; background: #f3f9fc; }
.button.primary { color: white; background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: #0c4c3e; }
.button.danger { color: #a52742; margin-right: auto; }
.menu-wrap { position: relative; }
.dropdown { position: absolute; z-index: 4; right: 0; top: calc(100% + 7px); min-width: 220px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 12px 28px #172e4424; }
.dropdown button { width: 100%; border: 0; background: transparent; text-align: left; padding: 9px 10px; border-radius: 5px; font-size: 13px; color: var(--text); }
.dropdown button:hover { background: #edf5f8; }
.editor { border: 1px solid #d5e2ec; background: white; border-radius: 13px; box-shadow: 0 12px 35px #223d5310; overflow: hidden; }
.editor-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 57px; padding: 7px 16px; border-bottom: 1px solid var(--line); }
.workflow-name { display: flex; min-width: 0; gap: 5px; align-items: center; flex: 1; }
.file-icon { width: 34px; height: 34px; border-radius: 8px; background: #e9f5f8; color: #196883; }
.workflow-name input { min-width: 0; width: min(100%, 320px); padding: 6px 4px; border: 1px solid transparent; border-radius: 5px; color: var(--navy); font-weight: 700; font-size: 15px; }
.workflow-name input:hover { border-color: var(--line); }
.name-pencil { color: #688198; pointer-events: none; }
.name-pencil svg { width: 14px; height: 14px; }
.save-state { display: flex; align-items: center; gap: 6px; color: #30695e; font-size: 12px; white-space: nowrap; }
.save-state[data-error] { color: #9e344b; }
.save-state svg { width: 15px; height: 15px; }
.editor-body { display: grid; grid-template-columns: 218px minmax(0, 1fr); }
.sidebar { background: #fcfdff; border-right: 1px solid var(--line); }
.sidebar-section { padding: 15px 13px; }
.sidebar-section + .sidebar-section { border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.section-heading h2 { margin: 0; font-size: 13px; color: var(--navy); }
.count { display: inline-grid; min-width: 21px; height: 20px; align-items: center; justify-items: center; padding: 0 4px; border-radius: 6px; font-size: 11px; color: #446780; background: #ebf1f6; }
.step-types, .lane-list { display: grid; gap: 5px; }
.step-type, .lane-item { display: flex; align-items: center; gap: 8px; min-width: 0; width: 100%; text-align: left; color: #2c455b; background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 4px 7px; min-height: 34px; font-size: 12px; font-weight: 600; }
.step-type { cursor: grab; }
.step-type:active { cursor: grabbing; }
.step-type:hover, .step-type[aria-pressed="true"], .lane-item:hover { border-color: #7bb4c5; background: #edf7fa; }
.step-type .shape-preview { display: block; width: 29px; height: 20px; flex: none; }
.sidebar-tip { color: var(--muted); margin: 9px 0 0; font-size: 11px; line-height: 1.45; }
.lane-list { max-height: 194px; overflow: auto; }
.lane-item { min-height: 30px; justify-content: flex-start; }
.lane-item > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-item [data-icon] { margin-left: auto; }
.lane-item [data-icon] svg { width: 13px; height: 13px; }
.role-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; margin-left: 2px; }
.add-lane { margin-top: 9px; width: 100%; min-height: 33px; justify-content: start; border-style: dashed; color: var(--accent); }
.diagram-panel { min-width: 0; display: flex; flex-direction: column; }
.canvas-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; padding: 7px 12px; border-bottom: 1px solid var(--line); min-height: 49px; }
.tool-group { gap: 3px; }
.tool, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; border: 1px solid transparent; border-radius: 6px; color: #3e596e; background: transparent; font-size: 12px; font-weight: 650; }
.tool { padding: 0 7px; }
.icon-button { width: 32px; padding: 0; flex: none; }
.tool:hover, .icon-button:not(:disabled):hover { background: #eef5f8; }
.tool[aria-pressed="true"] { color: #185e76; background: #e9f4f8; border-color: #d7ebf1; }
.toolbar-divider { width: 1px; height: 22px; margin: 0 1px; background: var(--line); }
.zoom-tools { margin-left: auto; }
.zoom-tools output { font-size: 11px; color: #526b7f; min-width: 35px; text-align: center; font-variant-numeric: tabular-nums; }
.canvas-scroll {
  position: relative; background-color: #edf3f8; background-image: radial-gradient(#bed0df 1px, transparent 1px);
  background-size: 16px 16px; padding: 16px; min-height: 546px; height: min(62vh, 780px); overflow: auto; overscroll-behavior: contain;
}
.canvas-scroll:focus-visible { outline-offset: -3px; }
#diagram { display: block; overflow: visible; font-family: Inter, 'Segoe UI', system-ui, sans-serif; user-select: none; }
#diagram[data-mode="place"] .lane-area { cursor: crosshair; }
#diagram[data-mode="connect"] .diagram-node { cursor: crosshair; }
.diagram-node { cursor: grab; touch-action: none; }
.diagram-node.dragging { cursor: grabbing; }
.diagram-node:focus, .edge-group:focus { outline: none; }
.diagram-node:focus-visible .node-outline { stroke: #126284; stroke-width: 3; }
.edge-group:focus-visible .edge-line { stroke: #126284; stroke-width: 3; }
.edge-group { cursor: pointer; }
.lane-header { cursor: pointer; }
.empty-state { max-width: 330px; margin: 100px auto 0; padding: 28px 20px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.empty-state > [data-icon] { background: #e9f5f8; color: var(--accent); border-radius: 10px; width: 40px; height: 40px; }
.empty-state h2 { margin: 12px 0 0; font-size: 18px; }
.empty-state p { color: var(--muted); font-size: 13px; }
.editor-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 39px; padding: 7px 13px; border-top: 1px solid var(--line); }
.editor-footer p, .privacy-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.summary { white-space: nowrap; font-variant-numeric: tabular-nums; }
.privacy-note { margin-top: 12px; display: flex; align-items: center; gap: 6px; }
.privacy-note svg { width: 13px; height: 13px; }
dialog { width: min(421px, calc(100% - 24px)); max-height: 90vh; border: 1px solid #cddde8; border-radius: 13px; color: var(--text); padding: 17px; box-shadow: 0 16px 80px #0d263b4a; }
dialog::backdrop { background: #11283b66; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dialog-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
#dialog-fields { display: grid; gap: 12px; margin-top: 13px; }
#dialog-fields p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 13px; }
#dialog-fields label { display: grid; gap: 5px; font-size: 13px; font-weight: 650; }
#dialog-fields input, #dialog-fields select { width: 100%; min-height: 37px; padding: 6px 8px; border: 1px solid #c5d8e5; color: var(--text); border-radius: 6px; background: #fff; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; margin-top: 17px; }
@media (max-width: 760px) {
  .workspace { padding-top: 21px; }
  .intro { align-items: start; flex-direction: column; }
  .editor-body { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar-section + .sidebar-section { border-top: 0; border-left: 1px solid var(--line); }
  .canvas-scroll { min-height: 425px; height: 58vh; padding: 12px; }
}
@media (max-width: 430px) {
  .editor-header { padding-inline: 8px; }
  .name-pencil { display: none; }
  .save-state { max-width: 105px; white-space: normal; }
  .canvas-toolbar { padding-inline: 5px; gap: 3px; }
  .tool { padding: 0 3px; }
  .icon-button { width: 27px; }
  .editor-footer { align-items: flex-start; flex-direction: column; }
}
