:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #1e2a32;
  --muted: #6d7a83;
  --line: #d8e0e5;
  --accent: #136f63;
  --accent-dark: #0d554c;
  --blue: #2f6fed;
  --orange: #d6811f;
  --danger: #b84040;
  --shadow: 0 1px 6px rgba(20, 32, 40, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button, input, select {
  font: inherit;
}

button, .file-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  min-height: 30px;
}

button:hover, .file-button:hover {
  border-color: #aebdc6;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-dark);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 7px;
  background: #fff;
  min-height: 30px;
}

.app-header {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #18262f;
  color: #fff;
}

.app-header h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.app-header p {
  margin: 3px 0 0;
  color: #c9d5db;
  font-size: 12px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.app-shell {
  display: grid;
  grid-template-columns: clamp(168px, 20vw, 238px) minmax(240px, 1fr) clamp(214px, 26vw, 286px);
  height: calc(100vh - 58px);
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  overflow: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 10px;
  min-height: 0;
}

.inspector-panel {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.sidebar section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.sidebar h2 {
  font-size: 13px;
  margin: 0 0 8px;
}

.stack {
  display: grid;
  gap: 6px;
}

.grid-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.grid-form label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px;
  background: #edf2f4;
  border-bottom: 1px solid var(--line);
}

.tool-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.tool-group.compact {
  justify-content: flex-end;
}

.tool-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.tool.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  background: #cfd8dc;
  min-height: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #eef3f5;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #52626c;
  background: rgba(245, 247, 248, 0.86);
  font-size: 18px;
}

.status-bar {
  padding: 5px 8px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.project-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.project-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  background: #fff;
  box-shadow: var(--shadow);
}

.project-card strong {
  display: block;
  margin-bottom: 3px;
}

.project-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.project-card .row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 30px;
}

.file-button.full {
  width: 100%;
  margin: 6px 0;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.muted {
  color: var(--muted);
}

.validation-list {
  padding-left: 18px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.danger {
  color: var(--danger);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 168px minmax(220px, 1fr) 214px;
  }
  .inspector-panel {
    position: static;
    width: auto;
    box-shadow: none;
  }

  .app-header {
    padding: 6px 8px;
  }

  .app-header p {
    display: none;
  }

  .header-actions {
    gap: 5px;
  }

  .sidebar {
    padding: 8px;
  }

  .grid-form {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-content: flex-start;
  }

  .tool-group.compact {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 150px minmax(180px, 1fr) 184px;
  }

  .app-header h1 {
    font-size: 16px;
  }

  button,
  .file-button,
  input,
  select {
    font-size: 12px;
  }

  .tool-group {
    gap: 4px;
  }
}


#editorCanvas.move-mode {
  cursor: move;
}

.selection-summary {
  padding: 0.75rem;
  border: 1px solid #c8d3da;
  background: #f8fbfc;
  border-radius: 6px;
}
