/* GateCAD — forced Fusion Light Gray theme (one-to-one chrome) */

.f360 {
  --f360-appbar: #f3f3f3;
  --f360-panel: #ffffff;
  --f360-panel-2: #f7f7f7;
  --f360-canvas: #e8e8e8;
  --f360-line: #d0d0d0;
  --f360-text: #222222;
  --f360-dim: #666666;
  --f360-accent: #0696d7;
  --f360-accent-dark: #0078b8;
  --f360-selection: #bfe8fb;
  --f360-group: #888888;
  color-scheme: only light;
  height: 100%;
  min-height: 520px;
  display: grid;
  grid-template-rows: 40px 78px auto 1fr 52px;
  background: var(--f360-panel-2);
  color: var(--f360-text);
  font-size: 12px;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  outline: none;
  overflow: hidden;
  user-select: none;
}

.f360-appbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: var(--f360-appbar);
  border-bottom: 1px solid var(--f360-line);
  color: var(--f360-text);
}

.f360-data {
  width: 28px;
  height: 24px;
  border-radius: 3px;
  background: #e6e6e6;
  color: var(--f360-text);
  border: 1px solid var(--f360-line);
  font-size: 13px;
}

.f360-filemenu {
  display: flex;
  gap: 1px;
}

.f360-filemenu button {
  padding: 5px 8px;
  border-radius: 3px;
  color: var(--f360-text);
  font-size: 12px;
}

.f360-filemenu button:hover {
  background: #e4e4e4;
}

.f360-docname {
  margin-left: 8px;
  font-weight: 650;
  color: var(--f360-text);
}

.f360-units {
  margin-left: auto;
}

.f360-units select,
.f360-workspace select {
  background: #fff;
  color: var(--f360-text);
  border: 1px solid var(--f360-line);
  border-radius: 3px;
  padding: 4px 8px;
}

.f360-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: var(--f360-panel);
  border-bottom: 1px solid var(--f360-line);
}

.f360-toolbar-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 0;
}

.f360-workspace select {
  background: var(--f360-accent);
  color: #fff;
  border: none;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 12px;
}

.f360-tabs {
  display: flex;
  gap: 0;
  align-items: flex-end;
}

.f360-tabs button {
  padding: 8px 14px 7px;
  color: var(--f360-dim);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  background: transparent;
}

.f360-tabs button.active {
  color: var(--f360-accent);
  border-bottom-color: var(--f360-accent);
}

.f360-tabs button:hover {
  color: var(--f360-text);
}

.f360-cmds {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex: 1;
  overflow-x: auto;
  padding: 4px 8px 6px;
  min-height: 48px;
}

.f360-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 8px;
  border-right: 1px solid var(--f360-line);
}

.f360-group-tools {
  display: flex;
  gap: 2px;
}

.f360-group-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--f360-group);
  margin-top: 2px;
}

.f360-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 52px;
  height: 42px;
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--f360-text);
  background: transparent;
}

.f360-tool svg {
  width: 20px;
  height: 20px;
  color: #333;
  stroke: #333;
}

.f360-tool span {
  font-size: 10px;
  color: var(--f360-dim);
}

.f360-tool:hover,
.f360-tool.active {
  background: #ececec;
}

.f360-tool.active {
  outline: 1px solid var(--f360-accent);
}

.f360-body {
  display: grid;
  grid-template-columns: auto 240px minmax(0, 1fr) 250px;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  background: var(--f360-canvas);
}

/*
 * Each pane names its own column. Without this the Data Panel's `display:none`
 * removes it from the grid, every remaining pane slides one track left, and the
 * viewport ends up in the 240px browser column while Parameters takes 1fr.
 */
.f360-body > .f360-data-panel { grid-column: 1; }
.f360-body > .f360-browser { grid-column: 2; }
.f360-body > .f360-canvas-wrap { grid-column: 3; }
.f360-body > .f360-props { grid-column: 4; }

.f360-data-panel {
  width: 220px;
  padding: 12px;
  background: var(--f360-panel);
  border-right: 1px solid var(--f360-line);
  overflow: auto;
  color: var(--f360-text);
}

.f360-data-panel.hidden {
  display: none;
}

.f360-data-panel h3 {
  margin-bottom: 10px;
  font-size: 12px;
}

.f360-data-item {
  padding: 8px 10px;
  border-radius: 4px;
  margin-bottom: 4px;
  color: var(--f360-dim);
  border: 1px solid transparent;
}

.f360-data-item.active,
.f360-data-item:hover {
  background: var(--f360-selection);
  color: var(--f360-text);
  border-color: #9ad4ef;
}

.f360-browser,
.f360-props {
  background: var(--f360-panel);
  border-right: 1px solid var(--f360-line);
  overflow: auto;
  color: var(--f360-text);
}

.f360-props {
  border-right: none;
  border-left: 1px solid var(--f360-line);
  padding: 0 0 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.f360-browser-head {
  padding: 8px 12px;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--f360-dim);
  border-bottom: 1px solid var(--f360-line);
  background: var(--f360-panel-2);
  position: sticky;
  top: 0;
  z-index: 1;
}

.f360-browser details {
  padding: 6px 8px;
}

.f360-browser summary {
  cursor: pointer;
  font-weight: 650;
  padding: 4px;
  color: var(--f360-text);
}

.f360-node {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 4px 8px;
  border-radius: 3px;
  color: var(--f360-text);
  font-size: 12px;
}

.f360-node:hover,
.f360-node.active {
  background: var(--f360-selection);
}

.f360-canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: linear-gradient(180deg, #f2f2f2, #dcdcdc);
  overflow: hidden;
}

.f360-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.f360-viewcube {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  padding: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--f360-line);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.f360-viewcube button {
  min-width: 40px;
  height: 26px;
  border-radius: 3px;
  background: #f3f3f3;
  color: var(--f360-text);
  border: 1px solid var(--f360-line);
  font-size: 10px;
  font-weight: 700;
}

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

.f360-viewcube button svg {
  width: 14px;
  height: 14px;
}

.f360-nav {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--f360-line);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.f360-nav .f360-tool {
  min-width: 44px;
  height: 34px;
}

.f360-hud {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 5px 9px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--f360-line);
  color: var(--f360-dim);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.f360-sketchbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #eef6fb;
  border-bottom: 1px solid var(--f360-line);
}

.f360-sketchbar.hidden {
  display: none;
}

.f360-sketchbar-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--f360-accent-dark);
  margin-right: 6px;
}

.f360-sketchbar .f360-tool {
  min-width: 52px;
  height: 28px;
  padding: 0 8px;
}

.f360-sketchbar .f360-tool.active {
  background: var(--f360-accent);
  color: #fff;
  border-color: var(--f360-accent-dark);
}

.f360-import-preview {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 6;
  width: 220px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--f360-line);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.f360-import-preview.hidden {
  display: none;
}

.f360-import-preview img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 140px;
  object-fit: contain;
  background: #f0f0f0;
  margin-bottom: 6px;
}

.f360-import-preview p {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--f360-dim);
  line-height: 1.35;
}

.f360-marking {
  position: absolute;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 8px;
  width: 170px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--f360-line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  transform: translate(-50%, -50%);
}

.f360-marking.hidden {
  display: none;
}

.f360-marking button {
  padding: 8px;
  border-radius: 999px;
  background: #f0f0f0;
  color: var(--f360-text);
  border: 1px solid var(--f360-line);
  font-size: 10px;
}

.f360-marking button:hover {
  background: var(--f360-accent);
  color: #fff;
}

.f360-timeline {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--f360-panel);
  border-top: 1px solid var(--f360-line);
}

.f360-tl-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--f360-dim);
  text-transform: uppercase;
}

.f360-tl-track {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px 0;
}

.f360-tl-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 80px;
  padding: 5px 7px;
  border-radius: 3px;
  background: #f4f4f4;
  border: 1px solid var(--f360-line);
  color: var(--f360-text);
}

.f360-tl-item .idx {
  font-size: 10px;
  color: var(--f360-accent);
  font-weight: 700;
}

.f360-tl-item .nm {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.f360-tl-item.active {
  border-color: var(--f360-accent);
  background: var(--f360-selection);
}

.f360-tl-item.suppressed {
  opacity: 0.45;
}

.f360-tl-actions button {
  width: 30px;
  height: 26px;
  border-radius: 3px;
  background: #f0f0f0;
  border: 1px solid var(--f360-line);
  color: var(--f360-text);
}

.f360-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--f360-dim);
}

.f360-field input {
  background: #fff;
  border: 1px solid var(--f360-line);
  border-radius: 3px;
  color: var(--f360-text);
  padding: 6px 8px;
}

.f360-param-title {
  padding: 10px 12px 0;
  font-weight: 700;
  color: var(--f360-text);
}

.f360-mini {
  margin: 6px 12px;
  width: calc(100% - 24px);
  padding: 7px 10px;
  border-radius: 3px;
  background: #f0f0f0;
  border: 1px solid var(--f360-line);
  color: var(--f360-text);
  text-align: left;
}

.f360-mini.danger {
  background: #ffe8e6;
  color: #a32018;
  border-color: #f0b0aa;
}

.f360-mini:hover {
  background: var(--f360-accent);
  color: #fff;
  border-color: var(--f360-accent);
}

.f360 .muted {
  color: var(--f360-dim);
  padding: 8px 12px;
}

.f360-dialog {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.28);
}

.f360-dialog.hidden {
  display: none;
}

.f360-dialog-card {
  width: min(360px, 92%);
  background: #fff;
  border: 1px solid var(--f360-line);
  border-radius: 6px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
  padding: 14px;
  color: var(--f360-text);
}

.f360-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.f360-dialog-actions button {
  padding: 7px 14px;
  border-radius: 3px;
  background: #f0f0f0;
  border: 1px solid var(--f360-line);
  color: var(--f360-text);
}

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

.f360-dialog-actions button.ghost {
  background: #fff;
}

/* Features catalog */
.f360-features {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--f360-line);
}

.f360-features-search {
  margin: 8px 10px;
  padding: 6px 8px;
  border: 1px solid var(--f360-line);
  border-radius: 3px;
  background: #fff;
  color: var(--f360-text);
}

.f360-features-list {
  flex: 1;
  overflow: auto;
  padding: 0 8px 12px;
}

.f360-feat-ws {
  margin-bottom: 8px;
}

.f360-feat-ws > summary {
  font-weight: 700;
  color: var(--f360-accent-dark);
  cursor: pointer;
  padding: 4px;
}

.f360-feat-cmd {
  padding: 6px 8px;
  border-radius: 3px;
  margin-bottom: 4px;
  background: #fafafa;
  border: 1px solid #ececec;
}

.f360-feat-cmd strong {
  display: block;
  font-size: 11px;
  color: var(--f360-text);
}

.f360-feat-cmd span {
  display: block;
  font-size: 10px;
  color: var(--f360-dim);
  line-height: 1.35;
  margin-top: 2px;
}

.window[data-app-id="cad"] .window-body {
  background: #f7f7f7;
}

.window[data-app-id="cad"] .window-toolbar {
  background: #f3f3f3 !important;
  color: #222 !important;
}

.window[data-app-id="cad"] .window-title {
  color: #222 !important;
}

@media (max-width: 1100px) {
  .f360-body {
    grid-template-columns: auto 180px 1fr 0;
  }
  .f360-props {
    display: none;
  }
}
