* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #fff;
  color: #222;
  font: 13px/1.4 system-ui, sans-serif;
}

.editor {
  display: grid;
  grid-template-columns: 200px 1fr 260px;
  height: 100vh;
}

.pane {
  padding: 10px;
  border-right: 1px solid #ccc;
  overflow: auto;
}
.pane:last-child { border-right: none; }

.pane h4 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #666;
}

.tool {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  margin: 3px 0;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #f5f5f5;
  color: #222;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tool:hover { background: #ebebeb; }
.tool.active { background: #2b6cb0; color: #fff; border-color: #2b6cb0; }
.tool kbd {
  font: 11px/1 ui-monospace, monospace;
  color: inherit;
  opacity: .6;
}

.pane-canvas {
  position: relative;
  padding: 0;
  overflow: hidden;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  touch-action: none;
  user-select: none;
}
#canvas.tool-node, #canvas.tool-path, #canvas.tool-tag, #canvas.tool-wall { cursor: crosshair; }
#canvas.tool-delete, #canvas.tool-destination, #canvas.tool-link { cursor: pointer; }
#canvas.pan-ready { cursor: grab; }
#canvas.panning { cursor: grabbing; }
#canvas text { pointer-events: none; }

/* Floor tabs */
#floor-tabs { margin-top: 14px; }
.floor-tabs-row { display: flex; flex-wrap: wrap; gap: 4px; }
.floor-tab {
  display: flex;
  align-items: stretch;
  max-width: 100%;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #f5f5f5;
  overflow: hidden;
}
.floor-tab.active { background: #2b6cb0; border-color: #2b6cb0; }
.floor-tab button, .floor-add {
  padding: 3px 7px;
  border: none;
  background: transparent;
  color: #222;
  font: inherit;
  cursor: pointer;
}
.floor-tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.floor-tab.active button { color: #fff; }
.floor-tab:not(.active) .floor-tab-del { visibility: hidden; }
.floor-tab-del { border-left: 1px solid rgba(255, 255, 255, .35) !important; }
.floor-tab button:hover { background: rgba(0, 0, 0, .08); }
.floor-add { min-width: 28px; border: 1px solid #bbb; border-radius: 4px; background: #f5f5f5; }
.floor-add:hover { background: #ebebeb; }
.floor-rename {
  width: 120px;
  padding: 2px 6px;
  border: none;
  font: inherit;
  outline: 2px solid #2b6cb0;
  outline-offset: -2px;
}
.floor-msg { min-height: 17px; margin-top: 3px; font-size: 12px; color: #c53030; }

/* Map toolbar */
#toolbar { margin-top: 10px; }
.tb-field { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 6px; }
.tb-field span { font-size: 12px; color: #555; }
.tb-field input {
  width: 100%;
  padding: 2px 6px;
  border: 1px solid #bbb;
  border-radius: 2px;
  background: #fafafa;
  color: #222;
  font: inherit;
}
.tb-field input:focus { outline: 2px solid #2b6cb0; outline-offset: -1px; background: #fff; }
.tb-check { display: flex; align-items: center; gap: 6px; margin: 4px 0 6px; cursor: pointer; }
.tb-check input { margin: 0; }
.tb-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0 6px; }
.tb-button { justify-content: center; }
.tb-wide { grid-column: 1 / -1; }

/* Floor tools */
#floor-tools { margin-top: 18px; }
.floor-tools summary {
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #666;
  cursor: pointer;
}
.ft-group { margin: 10px 0 0; }
.ft-group h5 { margin: 0 0 2px; font-size: 12px; color: #444; }
.ft-pick { display: flex; align-items: center; gap: 8px; }
.ft-pick .tool { width: auto; flex: none; }
.ft-pick .ro { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #555; }
.ft-result { margin: 2px 0 0; }
.ft-result:empty { display: none; }

/* Map checks */
#checks { margin-top: 18px; }
.check {
  display: block;
  width: 100%;
  padding: 2px 4px;
  margin: 0 0 1px;
  border: none;
  border-radius: 3px;
  background: none;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
button.check:hover { background: #f0f0f0; }
.check-error { color: #c53030; }
.check-warning { color: #b7791f; }
.check-ok { color: #2f855a; cursor: default; }

/* Dialogs */
.dialog {
  max-width: min(520px, calc(100vw - 32px));
  padding: 16px 20px;
  border: 1px solid #bbb;
  border-radius: 6px;
  color: #222;
  background: #fff;
}
.dialog::backdrop { background: rgba(0, 0, 0, .3); }
.dialog h3 { margin: 0 0 8px; font-size: 14px; }
.dialog-text { margin: 0 0 14px; white-space: pre-line; }
.dialog-actions { display: flex; justify-content: flex-end; }
.dialog-actions .tool, .help-head .tool { width: auto; margin: 0; padding: 5px 16px; }
.help { max-width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); line-height: 1.5; }
.help-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.help h2 { margin: 0; font-size: 17px; }
.help h3 { margin: 18px 0 4px; font-size: 14px; }
.help ul { margin: 0; padding-left: 20px; }
.help li { margin: 3px 0; }
.help a { color: #2b6cb0; }
.help kbd, .help code {
  padding: 0 4px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #f5f5f5;
  font: 12px ui-monospace, monospace;
}
.help code { border: none; }
.keys { border-collapse: collapse; }
.keys td { padding: 2px 14px 2px 0; vertical-align: top; }

/* Properties panel */
.field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}
.field input, .field select {
  width: 96px;
  padding: 1px 6px;
  border: 1px solid #bbb;
  border-radius: 2px;
  background: #fafafa;
  color: #222;
  font: inherit;
  text-align: right;
}
.field input.wide { width: 150px; text-align: left; }
.field input:focus, .field select:focus { outline: 2px solid #2b6cb0; outline-offset: -1px; background: #fff; }
.field input::placeholder { color: #999; }
.field .ro { min-width: 70px; text-align: right; color: #555; }
.props-help { margin-top: 8px; font-size: 11px; color: #666; }
