@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-dark:    #111318;
  --bg-panel:   #1a1d24;
  --bg-toolbar: #21252e;
  --bg-canvas:  #0e1014;
  --border:     #2e3340;
  --text:       #d4d4d4;
  --text-dim:   #7a7a7a;
  --accent:     #f5c518;
  --btn-hover:  #262b35;
  --btn-active: #2d2400;
}

body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', Arial, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 12px;
}

/* ══════════════════════════════════════
   MENU BAR
══════════════════════════════════════ */
#menubar {
  background: #0d1018;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  height: 28px;
  padding: 0 8px;
  gap: 2px;
  flex-shrink: 0;
  user-select: none;
  z-index: 500;
}

#menubar .logo {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  margin-right: 12px;
  letter-spacing: 1px;
}

.menu-item {
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text);
  transition: background 0.1s;
  position: relative;
}

.menu-item:hover { background: var(--btn-hover); }
.menu-item.open  { background: var(--btn-active); color: var(--accent); }

/* ── DROPDOWN ── */
.dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 250px;
  background: #1a1d24;
  border: 1px solid #3a4050;
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 4px 8px 24px rgba(0,0,0,0.8);
  z-index: 999;
  padding: 4px 0;
}

.menu-item.open .dropdown { display: block; }

.dd-item {
  display: flex;
  align-items: center;
  padding: 5px 14px 5px 8px;
  cursor: pointer;
  gap: 8px;
  white-space: nowrap;
  position: relative;
}

.dd-item:hover { background: var(--btn-hover); }
.dd-item.active { background: var(--btn-active); border-left: 2px solid var(--accent); }
.dd-item.disabled { opacity: 0.35; cursor: default; pointer-events: none; }

.dd-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.75; }
.dd-label { flex: 1; font-size: 12px; }
.dd-shortcut { font-size: 11px; color: var(--text-dim); margin-left: 16px; }
.dd-arrow { font-size: 9px; color: var(--text-dim); }
.dd-sep { height: 1px; background: #2e3340; margin: 3px 0; }
.dd-section {
  font-size: 10px;
  color: var(--text-dim);
  padding: 5px 10px 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* submenu */
.dd-sub { position: relative; }
.dd-sub > .submenu {
  display: none;
  position: absolute;
  top: -4px;
  left: 100%;
  min-width: 200px;
  background: #1a1d24;
  border: 1px solid #3a4050;
  border-radius: 6px;
  box-shadow: 4px 8px 24px rgba(0,0,0,0.8);
  padding: 4px 0;
  z-index: 1000;
}
.dd-sub:hover > .submenu { display: block; }

/* ══════════════════════════════════════
   RIBBON TAB BAR
══════════════════════════════════════ */
#ribbon-tab-bar {
  background: #0d1018;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  height: 24px;
  padding: 0 8px;
  gap: 0;
  flex-shrink: 0;
  user-select: none;
}

.rtab-btn {
  padding: 3px 16px 4px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  position: relative;
  top: 1px;
  letter-spacing: 0.3px;
  transition: color 0.1s;
}
.rtab-btn:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.rtab-btn.active {
  color: var(--accent);
  background: var(--bg-toolbar);
  border-color: var(--border);
  border-bottom-color: var(--bg-toolbar);
  font-weight: 600;
}

/* ══════════════════════════════════════
   RIBBON TOOLBAR
══════════════════════════════════════ */
#ribbon {
  background: var(--bg-toolbar);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ribbon-panel {
  display: none;
  align-items: stretch;
  height: 90px;
  padding: 0 2px;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.ribbon-panel.active { display: flex; }

.ribbon-group {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #2e3340;
  padding: 3px 4px 0;
  min-width: fit-content;
  flex-shrink: 0;
  position: relative;
}

.ribbon-group-label {
  font-size: 10px;
  color: #666;
  text-align: center;
  padding: 2px 6px 3px;
  margin-top: auto;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.ribbon-group-label:hover { color: var(--accent); }

/* ── row of buttons inside a ribbon group ── */
.ribbon-buttons {
  display: flex;
  gap: 1px;
  flex: 1;
  align-items: stretch;
}

/* ── stacked small-button column (3 rows) ── */
.ribbon-sm-col {
  display: flex;
  flex-direction: column;
  gap: 1px;
  justify-content: space-evenly;
}

/* ── base button ── */
.rbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3px 6px 2px;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid transparent;
  color: #c8c8c8;
  gap: 2px;
  transition: background 0.1s;
  user-select: none;
  white-space: nowrap;
}

/* ── LARGE button (primary tool, full panel height) ── */
.rbtn-lg {
  flex-direction: column;
  min-width: 46px;
  padding: 4px 6px 3px;
  flex: 0 0 auto;
}
.rbtn-lg svg   { width: 26px; height: 26px; }
.rbtn-lg span  { font-size: 10px; color: #c8c8c8; }

/* ── SMALL button (secondary, stacked 3-high) ── */
.rbtn-sm {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  min-width: 88px;
  height: 20px;
  padding: 1px 5px;
  gap: 5px;
  border-radius: 3px;
}
.rbtn-sm svg  { width: 14px; height: 14px; flex-shrink: 0; }
.rbtn-sm span { font-size: 10px; color: #c8c8c8; }

.rbtn:hover  { background: var(--btn-hover); border-color: #3a4050; }
.rbtn.active { background: var(--btn-active); border-color: var(--accent); color: var(--accent); }
.rbtn svg    { width: 20px; height: 20px; }
.rbtn span   { font-size: 10px; color: #c8c8c8; }

/* ── Split button (arc dropdown in ribbon) ── */
.rbtn-split {
  position: relative;
  display: flex;
  gap: 0;
  align-items: stretch;
}
.rbtn-split .rbtn-lg {
  border-right: none;
  border-radius: 4px 0 0 4px;
}
.rbtn-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  font-size: 8px;
  color: var(--text-dim);
  cursor: pointer;
  background: var(--bg-toolbar);
  border: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-radius: 0 4px 4px 0;
  transition: background 0.15s;
}
.rbtn-arrow:hover { background: var(--btn-hover); color: var(--text); }
.rbtn-rbn-dropdown {
  display: none;
  position: fixed;       /* escapes overflow:hidden ribbon panel */
  z-index: 9999;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  min-width: 210px;
  box-shadow: 0 4px 16px rgba(0,0,0,.6);
  flex-direction: column;
  padding: 3px 0;
}
.rbtn-rbn-dropdown.open { display: flex; }
.rbn-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
}
.rbn-dd-item:hover { background: var(--btn-hover); }
.rbn-dd-item.active { color: var(--accent); background: var(--btn-active); }
.arc-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ── Ribbon ByLayer property dropdowns ── */
.rbtn-prop {
  display: flex;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
  padding: 2px 4px;
}

.ribbon-bylayer {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 19px;
}

.ribbon-bylayer-swatch {
  width: 12px; height: 12px;
  border: 1px solid #555;
  border-radius: 2px;
  flex-shrink: 0;
}

.ribbon-bylayer select {
  background: #111318;
  border: 1px solid #3a4050;
  color: #c8c8c8;
  font-size: 10px;
  padding: 0 3px;
  height: 18px;
  border-radius: 3px;
  min-width: 90px;
  cursor: pointer;
}
.ribbon-bylayer select:focus { outline: none; border-color: var(--accent); }

.ribbon-bylayer-icon {
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ribbon-bylayer-icon svg { width: 12px; height: 12px; opacity: 0.7; }

/* ══════════════════════════════════════
   MAIN AREA
══════════════════════════════════════ */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ══════════════════════════════════════
   LEFT TOOLBAR
══════════════════════════════════════ */
#left-toolbar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  width: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px;
  gap: 2px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: visible;
}

.ltool {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid transparent;
  color: var(--text);
  transition: background 0.1s;
  position: relative;
  flex-shrink: 0;
}

.ltool:hover  { background: var(--btn-hover); border-color: var(--border); }
.ltool.active { background: var(--btn-active); border-color: var(--accent); color: var(--accent); }
.ltool svg    { width: 15px; height: 15px; }

.ltool-sep {
  width: 24px;
  height: 1px;
  background: var(--border);
  margin: 2px 0;
  flex-shrink: 0;
}

/* tooltip */
.ltool:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 36px;
  top: 50%;
  transform: translateY(-50%);
  background: #21252e;
  color: var(--text);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 9999;
  font-size: 11px;
  border: 1px solid #3a4050;
  pointer-events: none;
  box-shadow: 2px 4px 12px rgba(0,0,0,0.6);
}

/* ══════════════════════════════════════
   CANVAS AREA
══════════════════════════════════════ */
#canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--bg-canvas);
}

#ruler-corner {
  position: absolute;
  top: 0; left: 0;
  width: 20px; height: 20px;
  background: #1a1d24;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

#canvas-wrapper {
  position: absolute;
  top: 20px; left: 20px; right: 0; bottom: 0;
  overflow: hidden;
  cursor: crosshair;
}

#main-canvas { display: block; }

/* ══════════════════════════════════════
   RIGHT PANEL
══════════════════════════════════════ */
#right-panel { display: none; }

.rpanel-tab {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.rtab {
  flex: 1;
  padding: 6px;
  text-align: center;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  transition: all 0.1s;
}

.rtab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(245,197,24,0.04);
}

.rpanel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.prop-section { margin-bottom: 12px; }

.prop-title {
  font-size: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--border);
}

.prop-row {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  gap: 4px;
}

.prop-label {
  color: var(--text-dim);
  width: 70px;
  font-size: 11px;
  flex-shrink: 0;
}

.prop-value {
  flex: 1;
  background: #111318;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 11px;
  font-family: 'Courier New', monospace;
}

.prop-value:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Layer panel toolbar ── */
.ly-search-row { padding: 0 0 4px; }
.ly-search {
  width: 100%;
  background: #111318;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  outline: none;
  font-family: inherit;
}
.ly-search:focus { border-color: var(--accent); }

.ly-toolbar {
  display: flex;
  gap: 2px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}
.ly-tbtn {
  padding: 2px 7px;
  font-size: 10px;
  background: var(--btn-hover);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.ly-tbtn:hover { background: #333a47; border-color: var(--accent); color: var(--accent); }

.ly-colhdr {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 3px;
  font-size: 9px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  user-select: none;
}

/* ── Layer items ── */
.layer-item {
  display: flex;
  flex-direction: column;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 1px;
  border: 1px solid transparent;
  transition: background 0.08s;
}
.layer-item:hover  { background: var(--btn-hover); }
.layer-item.active {
  background: rgba(245,197,24,0.07);
  border-color: rgba(245,197,24,0.18);
}

.ly-row1 {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 1px;
}
.ly-row2 {
  display: flex;
  gap: 2px;
  padding: 1px 4px 4px 30px;
}

.ly-cur {
  width: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ly-swatch {
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}
.ly-swatch:hover { transform: scale(1.25); border-color: var(--accent); }

.ly-name {
  flex: 1;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: none;
}

.ly-icons { display: flex; gap: 1px; flex-shrink: 0; }
.ly-btn {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 2px;
  cursor: pointer;
  color: var(--text-dim);
  transition: background 0.08s;
}
.ly-btn:hover     { background: rgba(255,255,255,0.1); color: var(--text); }
.ly-btn.ly-off    { color: #c0392b; }
.ly-btn.ly-frozen { color: #5dade2; }
.ly-btn.ly-locked { color: var(--accent); }
.ly-btn.ly-noplot { opacity: 0.25; }

/* Inline rename */
.ly-rename {
  flex: 1;
  background: #111318;
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 11px;
  padding: 0 4px;
  border-radius: 3px;
  outline: none;
  font-family: inherit;
  min-width: 0;
}

/* ── Layer linetype / lineweight selects ── */
.layer-lt, .layer-lw {
  background: #21252e;
  border: 1px solid #3a4050;
  color: #aaa;
  font-size: 9px;
  border-radius: 3px;
  padding: 1px 2px;
  cursor: pointer;
}
.layer-lt { flex: 1; min-width: 0; }
.layer-lw { width: 44px; flex-shrink: 0; }
.layer-lt:focus, .layer-lw:focus { outline: none; border-color: var(--accent); }

/* ══════════════════════════════════════
   LAYER MANAGER DIALOG
══════════════════════════════════════ */
#layer-manager-dlg {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  width: 740px;
  height: 440px;
  background: #1a1d24;
  border: 1px solid #3a4050;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.7);
  z-index: 3000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-width: 420px;
  min-height: 220px;
}

#lm-title-bar {
  background: #23283a;
  border-bottom: 1px solid #3a4050;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: move;
  user-select: none;
  flex-shrink: 0;
}
#lm-title-bar span {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
}
#lm-close-btn {
  width: 20px; height: 20px;
  background: none; border: none;
  color: var(--text-dim);
  cursor: pointer; font-size: 17px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 3px; padding: 0; flex-shrink: 0;
}
#lm-close-btn:hover { background: #c0392b; color: #fff; }

#lm-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 6px;
  border-bottom: 1px solid #2a2e3a;
  flex-shrink: 0;
  flex-wrap: wrap;
  background: #1e2230;
}
.lm-tbtn {
  padding: 3px 8px;
  font-size: 11px;
  background: #252a35;
  border: 1px solid #3a4050;
  color: var(--text);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  display: flex; align-items: center; gap: 3px;
}
.lm-tbtn:hover { background: #333a47; border-color: var(--accent); color: var(--accent); }
.lm-sep { width: 1px; height: 16px; background: #3a4050; margin: 0 2px; flex-shrink: 0; }
.lm-filter-label { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.lm-filter-input {
  background: #111318;
  border: 1px solid #3a4050;
  color: var(--text);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  outline: none;
  font-family: inherit;
  width: 110px;
}
.lm-filter-input:focus { border-color: var(--accent); }

/* Column widths — must match between header and rows */
.lm-col-status, .lm-c-status { width: 22px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.lm-col-color,  .lm-c-color  { width: 20px; flex-shrink: 0; }
.lm-col-name,   .lm-c-name   { flex: 1; min-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; }
.lm-col-icon,   .lm-c-icon   { width: 26px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.lm-col-lt,     .lm-c-lt-sel { width: 100px; flex-shrink: 0; }
.lm-col-lw,     .lm-c-lw-sel { width: 62px; flex-shrink: 0; }

#lm-col-header {
  display: flex;
  align-items: center;
  padding: 3px 6px;
  background: #1e2230;
  border-bottom: 1px solid #2a2e3a;
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  user-select: none;
  flex-shrink: 0;
}

#layer-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 0;
}
#layer-list::-webkit-scrollbar { width: 6px; }
#layer-list::-webkit-scrollbar-thumb { background: #3a4050; border-radius: 3px; }

.lm-row {
  display: flex;
  align-items: center;
  padding: 3px 6px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 3px;
  margin: 0 2px 1px;
  transition: background 0.07s;
}
.lm-row:hover { background: var(--btn-hover); }
.lm-active {
  background: rgba(245,197,24,0.07);
  border-color: rgba(245,197,24,0.2);
}

.lm-c-color {
  width: 16px; height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.1s;
}
.lm-c-color:hover { transform: scale(1.25); border-color: var(--accent); }

.lm-c-name {
  flex: 1; min-width: 80px;
  font-size: 12px;
  user-select: none;
  padding: 0 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.lm-c-icon {
  width: 26px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 3px; cursor: pointer;
  color: var(--text-dim);
  transition: background 0.07s;
}
.lm-c-icon:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.lm-c-icon.ly-off    { color: #c0392b; }
.lm-c-icon.ly-frozen { color: #5dade2; }
.lm-c-icon.ly-locked { color: var(--accent); }
.lm-c-icon.ly-noplot { opacity: 0.25; }

.lm-c-lt-sel, .lm-c-lw-sel {
  background: #21252e;
  border: 1px solid #3a4050;
  color: #aaa;
  font-size: 10px;
  border-radius: 2px;
  padding: 1px 2px;
  cursor: pointer;
  font-family: inherit;
}
.lm-c-lt-sel { width: 100px; }
.lm-c-lw-sel { width: 62px; }
.lm-c-lt-sel:focus, .lm-c-lw-sel:focus { outline: none; border-color: var(--accent); }

.lm-rename {
  flex: 1; min-width: 0;
  background: #111318;
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 12px;
  padding: 0 4px;
  border-radius: 3px;
  outline: none;
  font-family: inherit;
}

/* ══════════════════════════════════════
   COMMAND LINE
══════════════════════════════════════ */
#cmdline-area {
  background: #0e1014;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#cmd-output {
  height: 52px;
  overflow-y: auto;
  padding: 4px 8px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.5;
}

.cmd-line          { color: var(--text-dim); }
.cmd-line.response { color: #9cdcfe; }
.cmd-line.error    { color: #f48771; }
.cmd-line.info     { color: #4ec9b0; }

#cmd-input-row {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
  padding: 3px 8px;
  gap: 6px;
}

/* ── Command Autocomplete Popup — floats over canvas like AutoCAD ── */
#cmd-suggest {
  position: fixed;
  z-index: 9999;
  width: 420px;
  background: #1a1d24;
  border: 1px solid #3a4050;
  border-bottom: 2px solid var(--accent);
  border-radius: 6px 6px 0 0;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 -8px 28px rgba(0,0,0,.9);
}
.cmd-sug-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  cursor: pointer;
  border-bottom: 1px solid #21252e;
  transition: background .08s;
  min-height: 28px;
}
.cmd-sug-item:last-child { border-bottom: none; }
.cmd-sug-item:hover,
.cmd-sug-item.active { background: var(--btn-active); }
.cmd-sug-alias {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #3a2e00;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  min-width: 28px;
  height: 16px;
  font-family: 'Courier New', monospace;
  flex-shrink: 0;
}
.cmd-sug-name {
  color: #e0e0e0;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  min-width: 110px;
  letter-spacing: .4px;
}
.cmd-sug-hl { color: var(--accent); }
.cmd-sug-desc {
  color: #6a6a6a;
  font-size: 11px;
  font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
}

#cmd-prompt {
  color: var(--accent);
  font-family: monospace;
  font-size: 12px;
  white-space: nowrap;
}

#cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: white;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  caret-color: var(--accent);
}

/* ══════════════════════════════════════
   LAYER CONTROL BAR
══════════════════════════════════════ */
#layer-ctrl-bar {
  background: #1a1d24;
  border-bottom: 1px solid var(--border);
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 6px;
  flex-shrink: 0;
  user-select: none;
}

.lctrl-label {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

#lctrl-select {
  background: #111318;
  border: 1px solid #3a4050;
  color: var(--text);
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 3px;
  cursor: pointer;
  height: 20px;
  min-width: 110px;
}

#lctrl-lt {
  background: #111318;
  border: 1px solid #3a4050;
  color: var(--text);
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 3px;
  cursor: pointer;
  height: 20px;
  min-width: 90px;
}

#lctrl-lw {
  background: #111318;
  border: 1px solid #3a4050;
  color: var(--text);
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 3px;
  cursor: pointer;
  height: 20px;
  min-width: 65px;
}

#lctrl-select:focus, #lctrl-lt:focus, #lctrl-lw:focus { outline: none; border-color: var(--accent); }

#lctrl-color {
  width: 14px; height: 14px;
  border: 1px solid #555;
  border-radius: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

.lctrl-sep {
  width: 1px; height: 16px;
  background: var(--border);
  margin: 0 3px;
}

/* ══════════════════════════════════════
   MODEL / LAYOUT TABS
══════════════════════════════════════ */
#model-tabs {
  background: #111318;
  border-top: 1px solid var(--border);
  height: 24px;
  display: flex;
  align-items: flex-end;
  padding: 0 0 0 10px;
  gap: 0;
  flex-shrink: 0;
}

.mtab {
  padding: 3px 16px 3px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-dim);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  white-space: nowrap;
  transition: color 0.1s;
}

.mtab:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.mtab.active {
  background: #1a1d24;
  color: var(--accent);
  border-color: var(--border);
  border-bottom-color: #1a1d24;
}

.mtab-add {
  padding: 2px 8px 3px;
  font-size: 15px;
  cursor: pointer;
  color: var(--text-dim);
  line-height: 1;
  align-self: center;
}
.mtab-add:hover { color: var(--accent); }

/* ══════════════════════════════════════
   STATUS BAR
══════════════════════════════════════ */
#statusbar {
  background: #0d1018;
  height: 22px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 10px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

.status-item {
  font-size: 11px;
  color: #7a7a7a;
  display: flex;
  align-items: center;
  gap: 3px;
}

.status-item span { color: var(--text); }

.status-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
}

.status-toggle {
  padding: 1px 8px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #cccccc;
  transition: all 0.1s;
}

.status-toggle:hover { background: rgba(255,255,255,0.08); }
.status-toggle.on  { color: var(--accent); background: rgba(245,197,24,0.1); }
.status-toggle.off { color: #444; }

#status-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ══════════════════════════════════════
   SCROLLBARS
══════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: #3a4050; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #f5c51860; }

/* ══════════════════════════════════════
   DYNAMIC INPUT OVERLAY
══════════════════════════════════════ */
#dyn-input input:focus {
  outline: none;
  border-color: var(--accent) !important;
}
#dyn-input input:disabled {
  opacity: 0.3;
}

/* ══════════════════════════════════════
   CONTEXT MENU
══════════════════════════════════════ */
#ctx-menu {
  position: fixed;
  background: #1a1d24;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 0;
  z-index: 1000;
  min-width: 180px;
  display: none;
  box-shadow: 2px 4px 16px rgba(0,0,0,0.7);
}

.ctx-item {
  padding: 5px 16px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.ctx-item:hover { background: var(--btn-hover); }
.ctx-item .shortcut { color: var(--text-dim); font-size: 11px; }
.ctx-sep { height: 1px; background: var(--border); margin: 3px 0; }

/* ══════════════════════════════════════
   MODAL DIALOG
══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: #1a1d24;
  border: 1px solid #3a4050;
  border-radius: 8px;
  min-width: 340px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.8);
  overflow: hidden;
}

.modal-header {
  background: var(--btn-active);
  border-bottom: 1px solid var(--accent);
  padding: 8px 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--accent);
}

.modal-close {
  cursor: pointer;
  font-size: 16px;
  opacity: 0.7;
  color: var(--text);
}

.modal-close:hover { opacity: 1; }

.modal-body { padding: 16px; }

.modal-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.modal-label { width: 90px; font-size: 12px; color: var(--text-dim); flex-shrink: 0; }

.modal-input {
  flex: 1;
  background: #111318;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.modal-input:focus { outline: none; border-color: var(--accent); }

.modal-footer {
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.btn {
  padding: 5px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--btn-hover);
  transition: background 0.1s;
  font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
}

.btn:hover    { background: #333a47; }
.btn.primary  { background: var(--accent); border-color: var(--accent); color: #111318; font-weight: 600; }
.btn.primary:hover { background: #ffd740; }
