:root {
  --bg: #ececec;
  --panel: #ffffff;
  --panel-2: #d9d9d9;
  --text: #1a1d21;
  --muted: #555555;
  --border: #a7a7a7;
  --accent: #1f4e78;
  --accent-2: #6a1b9a;
  --accent-3: #00838f;
  --accent-4: #2e7d32;
  --danger: #cc3300;
  --control-accent: var(--accent);
  --table-even: #f4f4f4;
  --table-odd: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  --font: "Segoe UI", Arial, sans-serif;
}

body.dark {
  color-scheme: dark;
  --bg: #181b1f;
  --panel: #23272d;
  --panel-2: #2b3037;
  --text: #f2f4f7;
  --muted: #c3c8cf;
  --border: #505864;
  --control-accent: #8bbcf0;
  --table-even: #20242a;
  --table-odd: #252a31;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

body.dark .header-logo,
body.dark .welcome-logo {
  filter: invert(1);
}

input[type="checkbox"],
input[type="range"] {
  accent-color: var(--control-accent);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-header,
.top-actions,
.status-bar {
  flex-shrink: 0;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px 0 12px;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.brand-title {
  font-size: 28px;
  font-weight: 700;
}

.top-actions {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--border);
  background: linear-gradient(#fbfbfb, #dddddd);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 4px;
  cursor: pointer;
  font: 600 14px var(--font);
  box-shadow: var(--shadow);
}

.btn:hover {
  filter: brightness(0.98);
}
body.dark .btn:not(:where(.btn-dark, .btn-primary, .btn-accent, .btn-teal, .btn-green)) {
  background: var(--panel-2);
  color: var(--text);
}

body.dark .btn:disabled {
  opacity: 1;
  background: var(--panel-2);
  color: var(--muted);
  border-style: dashed;
}

body.dark .btn:hover:not(:disabled) {
  filter: brightness(1.12);
}

body.dark .btn-dark {
  background: #d9e3ed;
  color: #181b1f;
  border-color: #d9e3ed;
}

.btn-small {
  padding: 7px 10px;
  font-size: 12px;
}

.btn-dark {
  background: #000;
  color: #fff;
  border-color: #000;
}

.btn-primary {
  background: #1f4e78;
  color: #fff;
  border-color: #1f4e78;
}

.btn-accent {
  background: #6a1b9a;
  color: #fff;
  border-color: #6a1b9a;
}

.btn-teal {
  background: #00838f;
  color: #fff;
  border-color: #00838f;
}

.btn-green {
  background: #2e7d32;
  color: #fff;
  border-color: #2e7d32;
}

.main-content {
  flex: 1;
  display: flex;
  min-height: 0;
}

.splash-screen,
.workspace {
  flex: 1;
  min-height: 0;
}

.splash-screen {
  position: relative;
}

.welcome-block {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.welcome-text {
  font-size: 34px;
  margin-bottom: 12px;
}

.welcome-logo {
  width: min(760px, 80vw);
  max-width: 100%;
  object-fit: contain;
}

.credits {
  position: absolute;
  left: 24px;
  bottom: 24px;
  font-size: 25px;
  line-height: 1.35;
  color: var(--muted);
}

.workspace {
  padding: 8px;
}

.view {
  height: 100%;
}

.modules-title {
  font-size: 17px;
  font-weight: 700;
  margin: 4px 0 8px 4px;
}

.module-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.module-button {
  min-width: 150px;
  min-height: 58px;
  padding: 10px 12px;
  font-weight: 700;
}

.module-button.inactive {
  opacity: 0.55;
  filter: grayscale(0.2);
}

body.dark .btn.module-button.inactive {
  opacity: 1;
  filter: none;
  color: var(--muted);
  border-style: dashed;
}

.overview-layout,
.module-layout {
  display: flex;
  gap: 8px;
  min-height: calc(100vh - 210px);
}

.module-layout {
  --module-left-width: 45%;
  align-items: stretch;
}

.project-panel {
  width: 220px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 10px;
  overflow: auto;
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.project-field {
  margin-bottom: 10px;
}

.project-field-label {
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}

.project-field-value {
  font-size: 13px;
  white-space: pre-wrap;
}

.overview-panel,
.module-left,
.module-right {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.overview-panel {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.overview-top,
.module-header,
.arrow-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.overview-note,
.module-subtitle,
.table-note {
  font-size: 13px;
  color: var(--muted);
}

.toggle-row {
  display: flex;
  gap: 16px;
  padding: 8px 0;
  font-size: 14px;
}

.plot-card {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  background: #fff;
  overflow: auto;
}

.overview-layout .plot-card {
  max-height: 400px;
  height: 400px;
  flex: none;
}

body.dark .plot-card,
body.dark .module-plot-wrap,
body.dark .isolated-card {
  background: #f7f7f7;
}

.plot-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#moduleView {
  --module-plot-size: 560px;
  --isolated-plot-size: 210px;
}

.module-left {
  width: var(--module-left-width);
  min-width: 320px;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 8px;
}

.module-divider {
  width: 8px;
  flex: none;
  align-self: stretch;
  cursor: col-resize;
  border-radius: 4px;
  background: linear-gradient(to right, transparent 0, transparent 2px, var(--border) 2px, var(--border) 6px, transparent 6px);
}

.module-divider:hover,
.module-divider:focus-visible {
  background: linear-gradient(to right, transparent 0, transparent 2px, #6b84c3 2px, #6b84c3 6px, transparent 6px);
  outline: none;
}

.is-resizing,
.is-resizing * {
  user-select: none !important;
  cursor: col-resize !important;
}

.module-plot-zone {
  flex: none;
  height: var(--module-plot-zone-height, auto);
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
}

.module-h-divider {
  height: 8px;
  flex: none;
  align-self: stretch;
  cursor: row-resize;
  border-radius: 4px;
  background: linear-gradient(to bottom, transparent 0, transparent 2px, var(--border) 2px, var(--border) 6px, transparent 6px);
}

.module-h-divider:hover,
.module-h-divider:focus-visible {
  background: linear-gradient(to bottom, transparent 0, transparent 2px, #6b84c3 2px, #6b84c3 6px, transparent 6px);
  outline: none;
}

.is-resizing-h,
.is-resizing-h * {
  user-select: none !important;
  cursor: row-resize !important;
}

.module-right.has-h-split .module-info-blocks {
  flex: 1;
  min-height: 60px;
  overflow-y: auto;
}

.module-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 8px;
}

.module-title {
  font-size: 20px;
  font-weight: 700;
}

.table-heading {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.table-scroller {
  flex: 1;
  min-height: 280px;
  overflow: auto;
  border: 1px solid var(--border);
  margin-top: 6px;
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.records-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  padding: 6px;
  text-align: left;
  white-space: nowrap;
}

.records-table tbody tr:nth-child(even) {
  background: var(--table-even);
}

.records-table tbody tr:nth-child(odd) {
  background: var(--table-odd);
}

.records-table td {
  padding: 5px 6px;
  border-bottom: 1px solid rgba(127, 127, 127, 0.18);
  vertical-align: top;
}

.records-table .col-include,
.records-table .col-index,
.records-table .col-type,
.records-table .col-dd,
.records-table .col-dip,
.records-table .col-trend,
.records-table .col-plunge,
.records-table .col-slip,
.records-table .col-comment,
.records-table .col-subclass,
.records-table .col-color {
  white-space: nowrap;
}

.records-table tr.row-alert {
  background: #ffe9e6 !important;
}

body.dark .records-table tr.row-alert {
  background: #4f2520 !important;
}

.text-input {
  width: 100%;
  min-width: 70px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 4px 6px;
  font: 12px var(--font);
}

.color-input {
  width: 32px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border);
  background: none;
}

#moduleView.faults-mode .table-note {
  font-size: 11px;
}

#moduleView.faults-mode .table-scroller {
  margin-top: 4px;
}

#moduleView.faults-mode .records-table {
  font-size: 11px;
  table-layout: fixed;
}

#moduleView.faults-mode .records-table thead th {
  padding: 3px 4px;
  font-size: 10px;
  letter-spacing: 0.1px;
}

#moduleView.faults-mode .records-table td {
  padding: 2px 4px;
  line-height: 1.05;
  vertical-align: middle;
}

#moduleView.faults-mode .records-table .col-include {
  width: 20px;
}

#moduleView.faults-mode .records-table .col-index {
  width: 28px;
}

#moduleView.faults-mode .records-table .col-type {
  width: 56px;
}

#moduleView.faults-mode .records-table .col-dd,
#moduleView.faults-mode .records-table .col-trend {
  width: 56px;
}

#moduleView.faults-mode .records-table .col-dip,
#moduleView.faults-mode .records-table .col-plunge {
  width: 44px;
}

#moduleView.faults-mode .records-table .col-slip {
  width: 44px;
}

#moduleView.faults-mode .records-table .col-comment {
  width: 112px;
}

#moduleView.faults-mode .records-table .col-subclass {
  width: 92px;
}

#moduleView.faults-mode .records-table .col-color {
  width: 24px;
}

#moduleView.faults-mode .text-input {
  min-width: 0;
  padding: 1px 3px;
  font-size: 11px;
  line-height: 1.05;
}

#moduleView.faults-mode .color-input {
  width: 16px;
  height: 14px;
  border: 0;
}

#moduleView.faults-mode .records-table input[type="checkbox"] {
  width: 12px;
  height: 12px;
  margin: 0;
}

.module-info-blocks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stats-block,
.fold-block {
  margin-top: 0;
  padding: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  white-space: pre-wrap;
  font-family: Consolas, monospace;
  font-size: clamp(12px, 0.85vw, 14px);
  line-height: 1.35;
}

.stats-block:empty,
.fold-block:empty {
  display: none;
}

.fold-block {
  color: #2e7d32;
}

body.dark .fold-block {
  color: #91dfa3;
}

.button-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.slider-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.slider-label input[type="range"] {
  width: 80px;
}

#moduleView .module-plot-wrap,
.module-right .module-plot-wrap {
  position: relative !important;
  width: min(100%, var(--module-plot-size)) !important;
  max-width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  height: min(100%, var(--module-plot-size)) !important;
  min-height: min(180px, var(--module-plot-size)) !important;
  max-height: var(--module-plot-size) !important;
  align-self: flex-end !important;
  flex: none !important;
  overflow: hidden !important;
}

#moduleView .module-plot-wrap img.plot-image,
.module-right .module-plot-wrap img.plot-image {
  max-height: 100% !important;
  max-width: 100% !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

.isolated-card {
  position: relative;
  flex: none;
  width: var(--isolated-plot-size);
  min-width: var(--isolated-plot-size);
  aspect-ratio: 1 / 1;
  height: var(--isolated-plot-size);
  border: 1px solid var(--border);
  background: #fff;
  padding: 4px;
  box-shadow: var(--shadow);
}

.isolated-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.status-bar {
  padding: 6px 12px 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.app-modal {
  width: min(980px, 90vw);
  border: 1px solid var(--border);
  padding: 0;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}

.app-modal.modal-wide[open] {
  width: min(96vw, 1800px);
  max-width: 96vw;
  height: 96vh;
  max-height: 96vh;
  display: flex;
  flex-direction: column;
}

.app-modal::backdrop {
  background: rgba(0, 0, 0, 0.46);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
}

.modal-body {
  padding: 14px;
  max-height: 76vh;
  overflow: auto;
}

.app-modal.modal-wide .modal-body {
  flex: 1;
  max-height: none;
  min-height: 0;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.rose-grid {
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  align-items: start;
}

.rose-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.rose-preview {
  min-width: 0;
}

.rose-fieldset {
  border: 1px solid var(--border);
  padding: 8px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
}

.rose-fieldset legend {
  font-size: 12px;
  font-weight: 700;
  padding: 0 4px;
}

.rose-option-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.rose-option-label {
  color: var(--muted);
}

.rose-input {
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 4px 6px;
  font: 12px var(--font);
}

.rose-color {
  width: 46px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  background: none;
}

.rose-check {
  font-size: 12px;
  line-height: 1.35;
}

.rose-alpha-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rose-range {
  width: 100%;
}

.rose-alpha-value {
  min-width: 34px;
  font-size: 12px;
  text-align: right;
}

.modal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-plot {
  display: block;
  width: 80%;
  height: auto;
  border: 1px solid var(--border);
  background: #fff;
  margin: 0 auto;
}

.rose-grid .modal-plot {
  width: 94%;
}

.pole-preview-card {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 10px;
  width: min(100%, 75%);
  margin: 0 auto;
}

.frohlich-content {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.frohlich-plot-card {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 10px;
  flex: 1 1 55%;
  min-width: 0;
}

.frohlich-plot-card .modal-plot {
  width: 100%;
}

.frohlich-table-wrap {
  flex: 1 1 45%;
  min-width: 0;
  max-height: 74vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 0;
}

.frohlich-table {
  min-width: 560px;
}

.frohlich-table th,
.frohlich-table td {
  text-align: center;
}

@media (max-width: 1180px) {
  .frohlich-content {
    flex-direction: column;
  }

  .frohlich-table-wrap {
    max-height: 40vh;
    width: 100%;
  }
}

@media (max-width: 1180px) {
  .rose-shell {
    grid-template-columns: 1fr;
  }

  .rose-grid {
    grid-template-columns: 1fr;
  }

  .pole-preview-card {
    width: 100%;
  }
}

.plain-note {
  line-height: 1.5;
  white-space: pre-wrap;
}

.type-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

.type-chip {
  border: 1px solid var(--border);
  background: var(--panel-2);
  padding: 8px 10px;
}

.review-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-summary {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.review-toolbar,
.review-buttons,
.review-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.review-check {
  font-size: 13px;
  color: var(--muted);
}

.review-table-wrap {
  max-height: 62vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 0;
}

.review-table {
  min-width: 900px;
  font-size: 9px;
  table-layout: fixed;
  border-collapse: collapse;
}

.review-table th,
.review-table td {
  padding: 1px 3px;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.1;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-table th {
  font-weight: 600;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  background: var(--panel-2);
  position: sticky;
  top: 0;
  z-index: 1;
}

.review-table td:first-child,
.review-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}

.review-table th:first-child {
  background: var(--panel-2);
}

.review-table td:first-child {
  background: var(--table-odd);
}

.review-table tbody tr:nth-child(even) td:first-child {
  background: var(--table-even);
}

.review-table tr.row-alert td:first-child {
  background: #ffe9e6;
}

body.dark .review-table tr.row-alert td:first-child {
  background: #4f2520;
}

.review-input {
  min-height: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 1px 3px;
  font: 10px var(--font);
  line-height: 1.2;
}

.review-table textarea.review-input {
  resize: vertical;
  min-height: 28px;
  line-height: 1.3;
}

.review-table select.review-input {
  min-height: 18px;
  padding: 0 2px;
  font-size: 9px;
}

.review-table tr.row-deleted {
  opacity: 0.45;
}

body.dark .review-table tr.row-deleted {
  opacity: 1;
  color: var(--muted);
}

body.dark .review-table tr.row-deleted td {
  background: var(--panel-2);
}

body.dark .review-table tr.row-deleted .review-input {
  color: var(--muted);
}

.review-alerts {
  min-width: 360px;
  white-space: normal;
  line-height: 1.35;
}

/* Suggest families modal */
.suggest-families {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}

.suggest-families-head {
  font-weight: 600;
}

.suggest-families-scores {
  color: var(--muted);
  font-size: 11px;
}

.suggest-families-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.suggest-k-input {
  width: 52px;
}

.suggest-families-table {
  border-collapse: collapse;
  font-size: 11px;
}

.suggest-families-table th,
.suggest-families-table td {
  border: 1px solid var(--border);
  padding: 2px 6px;
  text-align: left;
  white-space: nowrap;
}

.suggest-families-table th {
  background: var(--panel-2);
}

.suggest-families-table .suggest-rows {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Workbench view */
.workbench-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  padding: 26px 10px;
}

.workbench-item {
  display: flex;
  align-items: center;
  gap: 14px;
}

.workbench-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.workbench-btn {
  min-width: 320px;
  padding: 14px 22px;
  font: 600 16px var(--font);
  text-align: left;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

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

body.dark .workbench-logo {
  filter: invert(1);
}

/* Workbench 3D viewer */
.workbench-tool-host {
  padding: 6px 10px 12px;
  min-width: 0;
}

.viewer3d-canvas-wrap {
  overflow: hidden;
}

.viewer3d {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.viewer3d-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.viewer3d-view-label {
  margin-left: auto;
  font: 11px Consolas, monospace;
  color: var(--muted);
}

.viewer3d-body {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.viewer3d-left {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.viewer3d-canvas-wrap {
  height: calc(100vh - 290px);
  min-height: 380px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.viewer3d-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.viewer3d-intersections {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 4px 8px;
}

.viewer3d-intersections-title {
  font: 600 10px var(--font);
}

.viewer3d-intersections-list {
  font: 10px Consolas, monospace;
  white-space: pre-line;
  color: var(--text);
  min-height: 30px;
  max-height: 90px;
  overflow-y: auto;
}

.viewer3d-right {
  flex: 0 0 430px;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 220px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.viewer3d-card {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 6px 8px;
}

.viewer3d-card-title {
  font: 600 10px var(--font);
  margin-bottom: 4px;
}

.viewer3d-row {
  display: grid;
  grid-template-columns: 26px minmax(60px, 1fr) repeat(5, minmax(0, auto)) 56px 18px;
  gap: 3px;
  align-items: center;
  padding: 2px 0;
  font-size: 10px;
  overflow: hidden;
}

.viewer3d-row-head {
  font-weight: 600;
  color: var(--muted);
}

.viewer3d-row .text-input {
  min-height: 18px;
  font-size: 10px;
  padding: 1px 3px;
}

.viewer3d-num {
  width: 46px;
}

.viewer3d-row select.text-input {
  max-width: 82px;
}

.viewer3d-opacity {
  width: 52px;
}

.viewer3d-del {
  border: none;
  background: none;
  color: #993333;
  cursor: pointer;
  font-size: 11px;
  padding: 0;
}

.viewer3d-add {
  margin-top: 4px;
}

.viewer3d-footer {
  font: 9px var(--font);
  color: var(--muted);
}

/* Plunge from Pitch tool */
.pitch-tool,
.apparent-tool {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pitch-tool-title {
  font: 600 13px var(--font);
}

.pitch-body {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
}

.pitch-inputs {
  min-width: 300px;
}

.pitch-grid {
  display: grid;
  grid-template-columns: auto 62px minmax(110px, 1fr);
  gap: 6px 10px;
  align-items: center;
  font-size: 11px;
  margin-bottom: 8px;
}

.pitch-num {
  width: 62px;
}

.pitch-range {
  width: 100%;
  accent-color: var(--control-accent, var(--accent));
}

.pitch-select {
  grid-column: 2 / 4;
  width: 100%;
}

.pitch-result {
  font: 600 12px Consolas, monospace;
  color: var(--accent);
  padding: 6px 0;
}

.pitch-formula {
  font: 9px var(--font);
  color: var(--muted);
}

.pitch-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 6px;
  font: 9px var(--font);
  color: var(--muted);
}

.pitch-chip::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  background: var(--chip);
  border: 1px solid var(--border);
}

.pitch-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 340px;
  flex: 0 1 460px;
}

.pitch-table-card {
  min-width: 0;
}

.pitch-hint {
  font-weight: 400;
  font-size: 9px;
  color: var(--muted);
}

.pitch-table-wrap {
  max-height: 230px;
  overflow: auto;
  margin-bottom: 6px;
}

.pitch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

.pitch-table th,
.pitch-table td {
  padding: 2px 3px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.pitch-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel-2, var(--panel));
  z-index: 1;
}

.pitch-cell {
  width: 48px;
  font-size: 10px;
  padding: 1px 2px;
  text-align: center;
}

.pitch-out {
  font-family: Consolas, monospace;
  min-width: 40px;
}

.pitch-del {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0 2px;
}

.pitch-del:hover {
  color: #c0392b;
}

.pitch-note {
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
}

.pitch-canvas-card {
  flex: 1 1 520px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
}

.pitch-canvas-wrap {
  flex: 1;
  min-height: 380px;
}

.pitch-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 1180px) {
  .overview-layout,
  .module-layout {
    flex-direction: column;
  }

  .module-layout {
    --module-left-width: 100%;
  }

  .project-panel,
  .module-left {
    width: 100%;
    min-width: 0;
  }

  .module-divider {
    display: none;
  }

  #moduleView .module-plot-wrap,
  .module-right .module-plot-wrap {
    width: min(100%, var(--module-plot-size)) !important;
    min-height: min(180px, var(--module-plot-size)) !important;
  }

  .credits {
    position: static;
    margin: 24px;
    font-size: 18px;
  }

  .welcome-block {
    position: static;
    transform: none;
    padding: 50px 20px 0;
  }
}

/* Floating "Ploting properties" panel (draggable, live-updating) */
.plot-props-panel {
  position: fixed;
  top: 84px;
  left: 62vw;
  width: min(292px, calc(100vw - 16px));
  max-height: min(84vh, calc(100vh - 16px));
  display: flex;
  flex-direction: column;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  z-index: 1200;
  font-size: 11px;
}

.plot-props-head {
  cursor: move;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  background: var(--accent);
  color: #fff;
  border-radius: 5px 5px 0 0;
}

.plot-props-title {
  font-weight: 700;
  font-size: 12px;
}

.plot-props-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.plot-props-body {
  overflow-y: auto;
  padding: 6px 8px;
}

.plot-props-body .rose-fieldset {
  margin-bottom: 8px;
}

.plot-props-body .rose-fieldset:last-child {
  margin-bottom: 0;
}

.pp-section {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px 5px;
  margin-bottom: 6px;
}

.pp-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 2px;
}

.pp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0;
  font-size: 11px;
}

.pp-row input[type="checkbox"] {
  margin: 0;
}

.pp-row input[type="color"] {
  width: 34px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
}

.pp-row input[type="number"] {
  width: 58px;
  font-size: 11px;
  padding: 1px 3px;
}

.pp-row select,
.pp-row input[type="number"] {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
}

.pp-row select {
  font-size: 11px;
  max-width: 152px;
  padding: 1px 2px;
}

.pp-row input[type="range"] {
  width: 108px;
}

.plot-props-foot {
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}
