.panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-color: var(--border);
  overflow: hidden;
}

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

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

.panel-header {
  padding: 10px 12px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

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

.top-bar-icon {
  display: block;
  flex-shrink: 0;
  margin-right: -8px;
}

.top-bar-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  white-space: nowrap;
}

.top-bar-version {
  color: var(--text-muted);
  font-size: 11px;
}

.top-bar-spacer {
  flex: 1;
}

.progress-bar {
  width: 160px;
  height: 6px;
  background: var(--bg-dark);
  border-radius: 3px;
  overflow: hidden;
  display: none;
}

.progress-bar.active {
  display: block;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s;
}

.progress-label {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
}

.top-bar-btn {
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.top-bar-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--accent-dim);
}

.hierarchy-list {
  list-style: none;
}

.hierarchy-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}

.hierarchy-item:hover {
  background: var(--bg-hover);
}

.hierarchy-item.selected {
  background: var(--bg-hover);
  outline: 1px solid var(--accent-dim);
}

.hierarchy-item-icon {
  width: 14px;
  text-align: center;
  color: var(--accent);
  flex-shrink: 0;
}

.hierarchy-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hierarchy-item-count {
  font-size: 10px;
  color: var(--text-muted);
}

.hierarchy-item-vis {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.hierarchy-item-vis:hover {
  background: var(--bg-dark);
  color: var(--text);
}

.hierarchy-item-vis.is-off {
  opacity: 0.35;
}

.hierarchy-item.is-invisible .hierarchy-item-name,
.hierarchy-item.is-invisible .hierarchy-item-icon,
.hierarchy-item.is-invisible .hierarchy-item-count {
  opacity: 0.4;
}

.hierarchy-item-delete {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  visibility: hidden;
}

.hierarchy-item:hover .hierarchy-item-delete,
.hierarchy-item.selected .hierarchy-item-delete {
  visibility: visible;
}

.hierarchy-item-delete:hover {
  background: var(--danger);
  color: #fff;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.header-menu {
  position: relative;
}

.header-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-dark);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.header-add-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-dim);
}

.header-dropdown {
  position: fixed;
  z-index: 50;
  min-width: 140px;
  padding: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--bg-hover);
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

.dialog {
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.dialog-close {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.dialog-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.dialog-body {
  padding: 14px;
}

.dialog-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.dialog-section-title {
  margin-bottom: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.dialog-section-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.format-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-dark);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.format-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent-dim);
}

.format-input {
  display: none;
}

.format-icon {
  font-size: 20px;
  line-height: 1;
}

.format-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.format-ext {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.dialog-about {
  width: 480px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.dialog-about .dialog-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.about-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.about-icon {
  flex-shrink: 0;
  border-radius: 8px;
}

.about-app-name {
  font-size: 16px;
  font-weight: 600;
}

.about-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

.about-meta-sep {
  margin: 0 4px;
}

.about-text {
  margin: 0 0 8px;
  line-height: 1.45;
  color: var(--text);
}

.about-text:last-child {
  margin-bottom: 0;
}

.about-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.5;
}

.about-list li + li {
  margin-top: 4px;
}

.about-refs li {
  word-break: break-word;
}

.about-link {
  color: var(--accent);
  text-decoration: none;
}

.about-link:hover {
  text-decoration: underline;
}

.btn {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-dark);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-dim);
}

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

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

.btn-danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-sm {
  padding: 3px 8px;
  font-size: 11px;
}

.btn-group {
  flex: 1;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.btn-group .btn {
  flex: 1;
  min-width: 0;
}

.inspector-empty {
  padding: 16px;
  color: var(--text-muted);
  text-align: center;
  font-size: 12px;
}

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

.inspector-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.inspector-section-title.collapsible {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.inspector-section-title.collapsible:hover {
  color: var(--text);
}

.inspector-section-title.collapsible::before {
  content: '';
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: rotate(90deg);
  transition: transform 0.15s ease;
}

.inspector-section.collapsed .inspector-section-title.collapsible::before {
  transform: rotate(0deg);
}

.inspector-section.collapsed .inspector-section-title {
  margin-bottom: 0;
}

.inspector-section.collapsed .inspector-section-body {
  display: none;
}

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

.field-row label {
  flex: 0 0 90px;
  color: var(--text-muted);
  font-size: 11px;
}

.field-row input[type='number'],
.field-row input[type='text'],
.field-row select {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-mono);
}

.field-row input[type='range'] {
  flex: 1;
  min-width: 0;
}

.field-input-compact {
  flex: 0 0 64px !important;
  width: 64px;
  padding: 4px 4px !important;
  text-align: left;
}

.field-row-xyz .xyz-inputs {
  flex: 1;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.field-row-xyz .xyz-inputs input {
  flex: 1;
  min-width: 0;
}

.field-row input[type='file'] {
  flex: 1;
  font-size: 11px;
  color: var(--text-muted);
}

.field-row input[type='checkbox'] {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

#intensity-scale-bar,
#plane-scale-bar,
#camera-scale-bar {
  margin-top: 4px;
}

.plane-preview {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-dark);
  image-rendering: pixelated;
}

.field-value {
  flex: 0 0 48px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.colormap-bar {
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border);
  margin: 4px 0 2px;
}

.colormap-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.spectrum-chart {
  width: 100%;
  margin-top: 4px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.spectrum-chart svg {
  display: block;
}

.spectrum-axis path,
.spectrum-axis line {
  stroke: var(--border);
}

.spectrum-axis text {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.spectrum-area {
  opacity: 0.75;
}

.spectrum-line {
  stroke: var(--text);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.spectrum-guide {
  stroke: var(--accent);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.spectrum-focus {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 1;
  pointer-events: none;
}

.spectrum-readout {
  margin-top: 4px;
  min-height: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.warning-banner {
  background: #3e2723;
  border: 1px solid #bf360c;
  color: #ffcc80;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 11px;
  margin-bottom: 8px;
  white-space: pre-line;
}

.hierarchy-item-static {
  opacity: 0.6;
  cursor: default;
}

.hidden {
  display: none !important;
}

.field-value-wide {
  flex: 1;
  text-align: left;
}
