/*
 * The chrome: menu bar, left tool rail, contextual tool options, status bar.
 */

/* ---- menu bar -------------------------------------------------------- */
.menubar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  padding: 0 var(--sp-2);
  font-size: var(--fs-md);
  gap: 2px;
}
.menubar .brand {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 var(--sp-3) 0 var(--sp-1);
  margin-right: var(--sp-1);
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--fg);
  border-right: 1px solid var(--border);
}
.menubar .brand .logo { color: var(--accent); }
.menubar .menu-title {
  padding: 0 10px;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
}
.menubar .menu-title:hover, .menubar .menu-title.open { background: var(--bg-hover); color: var(--fg); }
.menubar .doc-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 0 var(--sp-2);
  color: var(--fg-muted);
  font-size: var(--fs-sm);
}

.menu-popup {
  position: absolute;
  z-index: 100;
  min-width: 232px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  padding: var(--sp-1);
  animation: pop-in var(--speed) ease;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-3px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  font-size: var(--fs-md);
}
.menu-item:hover:not(.disabled), .menu-item.focus { background: var(--accent); color: var(--fg-on-accent); }
.menu-item.disabled { opacity: 0.42; }
.menu-item .label { flex: 1; }
.menu-item .shortcut {
  opacity: 0.62;
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.menu-item .check { width: 14px; display: inline-flex; justify-content: center; color: var(--accent); }
.menu-item:hover .check { color: var(--fg-on-accent); }
.menu-sep { height: 1px; background: var(--border); margin: var(--sp-1) 6px; }

/* ---- left tool rail -------------------------------------------------- */
.toolbar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-2) 0;
  gap: 2px;
  overflow: visible;
}
.toolbar .tool-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  padding: 0;
  position: relative;
  color: var(--fg-muted);
}
.toolbar .tool-btn:hover { background: var(--bg-hover); color: var(--fg); }
.toolbar .tool-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-ring);
}
.toolbar .tool-btn svg { width: 19px; height: 19px; }
.toolbar .sep { width: 22px; height: 1px; background: var(--border); margin: var(--sp-1) 0; }

/* fill/stroke chips pinned to the bottom of the rail */
.toolbar .fs { margin-top: auto; width: 36px; height: 36px; position: relative; }
.toolbar .fs .swatch { position: absolute; width: 20px; height: 20px; border-radius: var(--radius-sm); }
.toolbar .fs .swatch.fill { left: 3px; top: 3px; z-index: 2; }
.toolbar .fs .swatch.stroke { right: 3px; bottom: 3px; }

/* tooltips on the rail */
.toolbar .tool-btn::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--fg);
  color: var(--bg-panel);
  font-size: var(--fs-xs);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--speed) ease;
  z-index: 60;
  box-shadow: var(--shadow-2);
}
.toolbar .tool-btn:hover::after { opacity: 1; transition-delay: 350ms; }

/* ---- contextual tool options ---------------------------------------- */
.tool-options {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-3);
  font-size: var(--fs-sm);
  overflow: hidden;
  white-space: nowrap;
}
.tool-options .opt-group { display: flex; align-items: center; gap: var(--sp-2); }
.tool-options .opt-group > .lbl { color: var(--fg-muted); }
.tool-options .tool-id { color: var(--accent); gap: 6px; }
.tool-options .tool-id .tool-name { color: var(--fg); font-weight: 600; font-size: var(--fs-sm); }
.tool-options .sel-summary {
  margin-left: auto;
  color: var(--fg-muted);
  background: var(--bg-input-alt);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.tool-options .tool-tip { color: var(--fg-dim); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; }
.tool-options .sel-summary + .tool-tip { margin-left: var(--sp-2); }

/* isolation breadcrumb: "you are inside this group, click to leave" */
.tool-options .iso-exit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-ring);
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 500;
}
.tool-options .iso-exit:hover { background: var(--accent); color: var(--fg-on-accent); }
.tool-options .iso-exit .iso-x { display: inline-flex; opacity: 0.7; }
.tool-options .sep { width: 1px; height: 18px; background: var(--border); }
.tool-options button { padding: 2px 8px; height: 24px; display: inline-flex; align-items: center; gap: 5px; }
.tool-options input[type="text"] { width: 72px; height: 24px; }
.tool-options input[type="number"] { height: 24px; }

/* ---- status bar ------------------------------------------------------ */
.statusbar {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  overflow: hidden;
  white-space: nowrap;
}
.statusbar .coords { font-family: var(--font-mono); font-size: var(--fs-xs); min-width: 150px; }
.statusbar .zoom { display: flex; align-items: center; gap: 4px; }
.statusbar .zoom input { width: 62px; height: 22px; text-align: right; padding: 1px 5px; font-family: var(--font-mono); font-size: var(--fs-xs); }
.statusbar .zoom select { height: 22px; font-size: var(--fs-xs); }
.statusbar .snaps { display: flex; align-items: center; gap: 2px; }
.statusbar .snaps button {
  padding: 0 6px;
  height: 22px;
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
  color: var(--fg-dim);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.statusbar .snaps button:hover { color: var(--fg); background: var(--bg-hover); }
.statusbar .snaps button.active { color: var(--accent); background: var(--accent-soft); }
.statusbar .tip { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.statusbar .stats { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-dim); }
.statusbar .dirty { color: var(--warn); }
.statusbar .layer-name { color: var(--fg); }
