:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #090a0a;
  color: #e6edf3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: #090a0a;
}

button, select, input {
  font: inherit;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background: #090a0a;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 26px;
  border: 1px solid #26302d;
  border-radius: 8px;
  background: #101312;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.login-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2ad4a7, #3c8cff);
}

.login-title {
  font-size: 26px;
  font-weight: 800;
}

.login-subtitle {
  color: #91a7b9;
  margin-top: -10px;
}

.login-button {
  width: 100%;
  margin-top: 4px;
}

.login-error {
  padding: 10px 12px;
  border: 1px solid #70413f;
  border-radius: 8px;
  color: #ffd8d4;
  background: #251413;
}

.user-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: #91a7b9;
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: #090a0a;
}

.sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #26302d;
  background: #101211;
  padding: 22px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
}

.menu {
  display: grid;
  gap: 8px;
}

.menu button,
.icon-button,
.primary-button,
.secondary-button {
  border: 1px solid #2b3834;
  background: #171a19;
  color: #dce7ef;
  border-radius: 8px;
  min-height: 38px;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.menu button {
  text-align: left;
  padding: 12px;
}

.menu button.active,
.primary-button {
  border-color: #2bc39a;
  background: #12352d;
  color: #f4fffb;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid #26302d;
  display: grid;
  gap: 10px;
}

.sidebar-user {
  color: #91a7b9;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-logout {
  width: 100%;
  border: 1px solid #2b3834;
  background: #171a19;
  color: #dce7ef;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 12px;
  cursor: pointer;
  text-align: left;
}

.sidebar-logout:hover,
.sidebar-logout:focus-visible {
  border-color: #2bc39a;
  background: #12352d;
  color: #f4fffb;
}

.content {
  min-width: 0;
  padding: 22px;
}

.page-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.stacked-title {
  display: grid;
  justify-content: stretch;
}

.page-title h1 {
  font-size: 24px;
  margin: 0;
}

.page-title span {
  color: #8fa4b7;
  font-size: 13px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid #26302d;
  border-radius: 8px;
  background: #101312;
  margin-bottom: 14px;
}

.controls-custom {
  grid-template-columns: repeat(6, minmax(140px, 1fr));
}

.shared-controls {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.shared-controls.controls-custom {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: #91a7b9;
  font-size: 12px;
}

.field select,
.field input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #2b3834;
  border-radius: 8px;
  padding: 0 10px;
  color: #edf6fb;
  background: #0b0d0d;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.secondary-button,
.primary-button,
.icon-button {
  padding: 0 12px;
}

.compact {
  min-height: 30px;
  padding: 0 10px;
}

.toast {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2f5148;
  background: #10231f;
  color: #dff8ff;
}

.accordion {
  display: grid;
  gap: 12px;
}

.section {
  border: 1px solid #26302d;
  border-radius: 8px;
  background: #101312;
  overflow: hidden;
}

.section-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 14px;
  border: 0;
  color: #eef7fb;
  background: #171a19;
  cursor: pointer;
}

.section-body {
  padding: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric-card,
.chart-card,
.table-card,
.placeholder {
  border: 1px solid #203040;
  border-radius: 8px;
  background: #0d0f0f;
}

.metric-card {
  padding: 13px;
}

.metric-card span {
  color: #8fa4b7;
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.external-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.chart-card {
  min-height: 340px;
  padding: 12px;
}

.lazy-card {
  min-height: 340px;
}

.spectrum-card {
  container-type: inline-size;
  min-height: 390px;
  padding: 12px;
  border: 1px solid #203040;
  border-radius: 8px;
  background: #0d0f0f;
}

.chart-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 24px;
  margin-bottom: 8px;
  color: #edf6fb;
  font-weight: 650;
}

.chart-title-with-actions {
  grid-template-columns: minmax(0, 1fr) auto;
}

.spectrum-heading,
.spectrum-actions {
  min-width: 0;
}

.spectrum-heading strong,
.spectrum-heading span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.chart-title.stacked {
  display: grid;
  justify-content: stretch;
  align-items: start;
  gap: 3px;
}

.chart-title.stacked span {
  color: #91a7b9;
  font-size: 12px;
  font-weight: 500;
}

.chart-state {
  height: 280px;
  display: grid;
  place-items: center;
  color: #90a6b8;
}

.chart-state.small {
  height: 96px;
}

.chart {
  width: 100%;
  height: 280px;
}

.chart-actions {
  position: relative;
  justify-self: end;
}

.kebab-button {
  width: 32px;
  height: 32px;
  border: 1px solid #2b3834;
  border-radius: 8px;
  background: #171a19;
  color: #dce7ef;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.chart-actions-menu {
  position: absolute;
  top: 36px;
  right: 0;
  z-index: 5;
  width: 148px;
  display: grid;
  padding: 6px;
  border: 1px solid #2b3834;
  border-radius: 8px;
  background: #111514;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
}

.chart-actions-menu button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  color: #edf6fb;
  background: transparent;
  text-align: left;
  padding: 0 10px;
  cursor: pointer;
}

.chart-actions-menu button:hover,
.chart-actions-menu button:focus {
  background: #12352d;
}

.expert-comments-panel {
  display: grid;
  gap: 14px;
  min-height: 160px;
}

.expert-comment-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #203040;
  border-radius: 8px;
  background: #0d0f0f;
}

.expert-comment-textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  border: 1px solid #2b3834;
  border-radius: 8px;
  padding: 10px 12px;
  color: #edf6fb;
  background: #0b0d0d;
}

.expert-comment-textarea:focus {
  outline: none;
  border-color: #2bc39a;
  box-shadow: 0 0 0 2px rgba(43, 195, 154, 0.16);
}

.expert-comment-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: #91a7b9;
  font-size: 12px;
}

.expert-comment-save {
  border: 1px solid #2bc39a;
  background: #12352d;
  color: #f4fffb;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

.expert-comment-save:disabled {
  cursor: wait;
  opacity: 0.62;
}

.expert-comments-note,
.expert-comments-empty {
  padding: 12px;
  border: 1px solid #203040;
  border-radius: 8px;
  color: #9fb2c2;
  background: #0d0f0f;
}

.expert-comments-table-wrap {
  overflow-x: auto;
  min-height: 96px;
  border: 1px solid #203040;
  border-radius: 8px;
  background: #0d0f0f;
}

.expert-comments-status {
  min-height: 24px;
  color: #91a7b9;
  font-size: 12px;
}

.expert-comments-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.expert-comments-table th,
.expert-comments-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #26302d;
  text-align: left;
  vertical-align: top;
}

.expert-comments-table th {
  color: #93a9ba;
  background: #171a19;
}

.expert-comment-cell {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.expert-comment-actions-cell {
  width: 150px;
  white-space: nowrap;
}

.expert-comment-action {
  border: 1px solid #2b3834;
  background: #171a19;
  color: #dce7ef;
  border-radius: 8px;
  min-height: 32px;
  padding: 0 10px;
  cursor: pointer;
}

.expert-comment-action:hover,
.expert-comment-action:focus-visible {
  border-color: #2bc39a;
  background: #12352d;
  color: #f4fffb;
}

.expert-comment-action:disabled {
  cursor: wait;
  opacity: 0.62;
}

.expert-comment-danger {
  border-color: #70413f;
  color: #ffd8d4;
}

.expert-comment-danger:hover,
.expert-comment-danger:focus-visible {
  border-color: #d75b54;
  background: #251413;
  color: #fff0ef;
}

.expert-comment-edit-textarea {
  width: 100%;
  min-height: 82px;
  resize: vertical;
  border: 1px solid #2b3834;
  border-radius: 8px;
  padding: 10px 12px;
  color: #edf6fb;
  background: #0b0d0d;
}

.expert-comment-edit-textarea:focus {
  outline: none;
  border-color: #2bc39a;
  box-shadow: 0 0 0 2px rgba(43, 195, 154, 0.16);
}

.expert-comment-edit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.expert-comment-muted {
  display: block;
  margin-top: 6px;
  color: #91a7b9;
  font-size: 12px;
}

.report-page {
  display: grid;
  gap: 16px;
}

.report-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.report-header h1 {
  margin: 0;
  font-size: 24px;
}

.report-subtitle {
  margin: 6px 0 0;
  color: #8fa4b7;
}

.report-actions {
  display: flex;
  justify-content: flex-end;
}

.report-pdf-button {
  border: 1px solid #2bc39a;
  background: #12352d;
  color: #f4fffb;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

.report-pdf-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.report-kpi-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #203040;
  border-radius: 8px;
  background: linear-gradient(180deg, #101615, #0d0f0f);
}

.report-kpi-label,
.report-kpi-hint {
  color: #8fa4b7;
  font-size: 12px;
}

.report-kpi-value {
  color: #f4fffb;
  font-size: 24px;
}

.report-filters {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) minmax(220px, 1fr);
  gap: 10px;
  padding: 14px;
  border: 1px solid #26302d;
  border-radius: 8px;
  background: #101312;
}

.report-filter {
  display: grid;
  gap: 6px;
}

.report-filter span {
  color: #91a7b9;
  font-size: 12px;
}

.report-search input {
  width: 100%;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: start;
}

.report-feed {
  display: grid;
  gap: 10px;
}

.report-feed-title {
  color: #edf6fb;
  font-weight: 700;
}

.report-comment-card,
.report-side-panel {
  border: 1px solid #203040;
  border-radius: 8px;
  background: #0d0f0f;
}

.report-comment-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.report-comment-badge {
  width: fit-content;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid #2bc39a;
  border-radius: 999px;
  color: #c9fff1;
  background: #12352d;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.report-comment-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: #91a7b9;
  font-size: 12px;
}

.report-comment-text {
  margin: 0;
  color: #edf6fb;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.report-side-panel {
  padding: 14px;
}

.report-side-panel h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.report-sensor-summary {
  display: grid;
  gap: 12px;
}

.report-sensor-row {
  display: grid;
  gap: 6px;
}

.report-sensor-row > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.report-sensor-name {
  color: #dce7ef;
  overflow-wrap: anywhere;
}

.report-sensor-count {
  color: #9ef4da;
  font-weight: 700;
}

.report-sensor-bar {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: #2bc39a;
}

.report-table-wrap {
  overflow-x: auto;
  border: 1px solid #203040;
  border-radius: 8px;
  background: #0d0f0f;
}

.report-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #26302d;
  text-align: left;
  vertical-align: top;
}

.report-table th {
  color: #93a9ba;
  background: #171a19;
}

.report-comment-table-text {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.chart-view-page {
  min-height: 100vh;
  padding: 22px;
  background: #090a0a;
}

.chart-view-page .chart-card,
.chart-view-page .spectrum-card {
  min-height: calc(100vh - 130px);
}

.chart-view-page .chart {
  height: calc(100vh - 230px);
  min-height: 420px;
}

.spectrum-panel {
  display: grid;
  gap: 12px;
}

.packet-card {
  border: 1px solid #203040;
  border-radius: 8px;
  background: #0d0f0f;
  padding: 12px;
}

.packet-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.packet-heading strong {
  color: #edf6fb;
}

.packet-heading span,
.muted {
  color: #91a7b9;
  font-size: 12px;
}

.packet-table-wrap {
  max-height: 280px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid #26302d;
  border-radius: 8px;
}

.packet-table {
  width: 100%;
  min-width: 680px;
}

.packet-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #171a19;
}

.packet-table th,
.packet-table td {
  padding: 6px 10px;
}

.packet-table tr {
  cursor: pointer;
}

.packet-table tbody tr:hover,
.packet-table tbody tr.selected {
  background: #11251f;
}

.spectrum-chart-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.spectrum-chart-row.with-cursor {
  grid-template-columns: 120px minmax(0, 1fr) minmax(210px, 260px);
}

.spectrum-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

@container (max-width: 760px) {
  .spectrum-card .chart-title-with-actions {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .spectrum-card .spectrum-actions {
    justify-content: flex-start;
  }
}

.cursor-button {
  min-width: 74px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid #2b3834;
  border-radius: 8px;
  background: #171a19;
  color: #dce7ef;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.cursor-button:hover:not(:disabled),
.cursor-button:focus-visible:not(:disabled) {
  border-color: #3d6f62;
  background: #12231f;
}

.cursor-button.active {
  border-color: #4fb99f;
  background: #14362f;
  color: #edf6fb;
  box-shadow: inset 0 0 0 1px rgba(79, 185, 159, 0.18);
}

.cursor-button.sideband {
  min-width: 132px;
}

.cursor-button.harmonic {
  min-width: 132px;
}

.cursor-button.reset-zoom {
  min-width: 104px;
}

.cursor-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.clear-cursor-button {
  min-width: 104px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid #3a302d;
  border-radius: 8px;
  background: #1b1715;
  color: #f0c7bb;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.clear-cursor-button:hover,
.clear-cursor-button:focus-visible {
  border-color: #7b5549;
  background: #261c19;
  color: #ffe2d9;
}

.peak-list {
  min-height: 280px;
  padding: 10px;
  border: 1px solid #26302d;
  border-radius: 8px;
  background: #101312;
  display: grid;
  align-content: start;
  gap: 7px;
}

.peak-list strong {
  color: #edf6fb;
  font-size: 12px;
}

.peak-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #91a7b9;
  font-size: 12px;
}

.peak-row b {
  color: #ffb4b6;
  font-weight: 650;
}

.cursor-table-card {
  min-height: 280px;
  padding: 10px;
  border: 1px solid #26302d;
  border-radius: 8px;
  background: #101312;
  display: grid;
  align-content: start;
  gap: 8px;
}

.chart-cursor-shell {
  position: relative;
  min-width: 0;
}

.cursor-lines-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.cursor-harmonic-line {
  position: absolute;
  top: 44px;
  bottom: 48px;
  width: 1px;
  background: rgba(180, 210, 255, 0.75);
  box-shadow: 0 0 8px rgba(90, 140, 255, 0.45);
  pointer-events: none;
}

.cursor-harmonic-line.primary {
  width: 2px;
  background: rgba(255, 220, 120, 0.95);
  box-shadow: 0 0 10px rgba(255, 220, 120, 0.5);
}

.cursor-harmonic-line.secondary {
  opacity: 0.85;
}

.cursor-sideband-line {
  position: absolute;
  top: 44px;
  bottom: 48px;
  width: 1px;
  background: rgba(113, 211, 185, 0.68);
  box-shadow: 0 0 8px rgba(70, 190, 160, 0.36);
  pointer-events: none;
}

.cursor-sideband-line.center {
  width: 2px;
  background: rgba(255, 220, 120, 0.95);
  box-shadow: 0 0 10px rgba(255, 220, 120, 0.5);
}

.cursor-sideband-line.negative {
  background: rgba(110, 170, 255, 0.68);
}

.cursor-sideband-line.positive {
  background: rgba(113, 211, 185, 0.68);
}

.cursor-table-card.sideband {
  border-color: #2a3f39;
}

.cursor-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cursor-table-head strong {
  color: #edf6fb;
  font-size: 12px;
}

.cursor-status {
  padding: 2px 7px;
  border: 1px solid #2b3834;
  border-radius: 999px;
  color: #9fd9cc;
  background: #12231f;
  font-size: 11px;
  font-weight: 650;
}

.cursor-list {
  display: grid;
  gap: 5px;
}

.cursor-row {
  display: grid;
  grid-template-columns: 44px minmax(78px, 1fr) minmax(82px, 1fr);
  gap: 8px;
  align-items: center;
  color: #d8e3eb;
  font-size: 12px;
}

.cursor-row.header {
  color: #91a7b9;
  font-size: 11px;
  font-weight: 650;
}

.cursor-row.out-of-range {
  color: #6f808b;
}

.cursor-row.out-of-range span:last-child {
  font-size: 11px;
}

.table-grid {
  display: grid;
  gap: 12px;
}

.table-card {
  padding: 12px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}

th, td {
  padding: 8px 10px;
  border-bottom: 1px solid #26302d;
  color: #d8e3eb;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #93a9ba;
  background: #171a19;
}

.placeholder {
  min-height: 420px;
  display: grid;
  place-items: center;
  color: #9fb2c2;
}

.fusion-page {
  display: grid;
  gap: 14px;
}

.fusion-title {
  align-items: start;
  margin-bottom: 0;
}

.fusion-title p {
  max-width: 760px;
  margin: 7px 0 0;
  color: #8fa4b7;
  line-height: 1.5;
}

.fusion-context,
.fusion-empty,
.fusion-detail-empty {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 14px;
  border: 1px solid #2a4a41;
  border-radius: 8px;
  color: #cce4db;
  background: #10201c;
}

.fusion-context span {
  color: #a8c2b8;
  font-size: 13px;
}

.fusion-empty,
.fusion-detail-empty {
  color: #9fb2c2;
  border-color: #203040;
  background: #0d0f0f;
}

.fusion-controls {
  margin-bottom: 0;
}

.fusion-summary-wrap {
  overflow-x: auto;
  border: 1px solid #203040;
  border-radius: 8px;
  background: #0d0f0f;
}

.fusion-summary-table {
  min-width: 980px;
}

.fusion-summary-table tbody tr {
  cursor: pointer;
}

.fusion-summary-table tbody tr:hover,
.fusion-summary-table tbody tr.selected {
  background: #112b25;
}

.fusion-summary-table small {
  display: block;
  margin-top: 4px;
  color: #91a7b9;
  white-space: normal;
}

.fusion-non-evaluable {
  border-color: #40536a;
  color: #c4d9ec;
  background: #13202c;
}

.fusion-score-badge {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.fusion-impact {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.25;
  border: 1px solid #2b3834;
  color: #dce7ef;
  background: #171a19;
}

.fusion-impact-strong {
  border-color: #e0673f;
  color: #e0673f;
}

.fusion-impact-notable {
  border-color: #e0b84c;
  color: #e0b84c;
}

.fusion-impact-partial,
.fusion-impact-weak {
  border-color: #8fbf5f;
  color: #8fbf5f;
}

.fusion-impact-not_found {
  border-color: #55606a;
  color: #8fa0ac;
}

.fusion-evidence-not-found td {
  color: #7c8a96;
}

.fusion-evidence-table small {
  display: block;
  margin-top: 3px;
  color: #6f7d88;
}

.fusion-trend-card,
.fusion-detail {
  padding: 14px;
  border: 1px solid #203040;
  border-radius: 8px;
  background: #0d0f0f;
}

.fusion-trend-card {
  min-height: 390px;
}

.fusion-chart {
  width: 100%;
  height: 320px;
}

.fusion-detail h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.fusion-detail-summary {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: 7px 14px;
  margin: 0;
  font-size: 13px;
}

.fusion-detail-summary dt {
  color: #91a7b9;
}

.fusion-detail-summary dd {
  margin: 0;
  color: #d8e3eb;
  overflow-wrap: anywhere;
}

.fusion-detail-section {
  padding-top: 12px;
  border-top: 1px solid #26302d;
}

.fusion-detail-section + .fusion-detail-section {
  margin-top: 14px;
}

.fusion-detail-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #edf6fb;
}

.fusion-detail-section p {
  margin: 0;
  color: #91a7b9;
  font-size: 13px;
}

.fusion-detail-section ul {
  margin: 0;
  padding-left: 18px;
  color: #d8e3eb;
  font-size: 13px;
  line-height: 1.5;
}

.fusion-reference-table small {
  display: block;
  margin-top: 4px;
  color: #91a7b9;
}

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

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid #26302d;
  }

  .menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-footer {
    margin-top: 18px;
  }

  .controls,
  .metric-grid,
  .chart-grid,
  .report-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .controls-custom {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-filters,
  .report-layout {
    grid-template-columns: 1fr;
  }

  .fusion-detail-summary {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

@media (max-width: 680px) {
  .content {
    padding: 14px;
  }

  .menu,
  .controls,
  .controls-custom,
  .metric-grid,
  .chart-grid,
  .report-kpi-grid {
    grid-template-columns: 1fr;
  }

  .report-header {
    display: grid;
  }

  .fusion-title {
    display: grid;
  }

  .report-actions {
    justify-content: stretch;
  }

  .report-pdf-button {
    width: 100%;
  }

  .spectrum-chart-row {
    grid-template-columns: 1fr;
  }

  .spectrum-chart-row.with-cursor {
    grid-template-columns: 1fr;
  }

  .peak-list {
    min-height: auto;
  }

  .cursor-table-card {
    min-height: auto;
  }
}

/* Maintenance Fault Management */

.field textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  border: 1px solid #2b3834;
  border-radius: 8px;
  padding: 10px 12px;
  color: #edf6fb;
  background: #0b0d0d;
}

.field textarea:focus {
  outline: none;
  border-color: #2bc39a;
  box-shadow: 0 0 0 2px rgba(43, 195, 154, 0.16);
}

.maint-page {
  display: grid;
  gap: 16px;
}

.maint-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.maint-tab {
  border: 1px solid #2b3834;
  background: #171a19;
  color: #dce7ef;
  border-radius: 8px;
  min-height: 36px;
  padding: 0 14px;
  cursor: pointer;
}

.maint-tab.active {
  border-color: #2bc39a;
  background: #12352d;
  color: #f4fffb;
}

.maint-badge {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.maint-checkbox-field {
  flex-direction: row;
  align-items: center;
  display: flex;
  gap: 8px;
}

.maint-checkbox-field input {
  width: auto;
  min-height: auto;
}

.maint-table-wrap {
  overflow-x: auto;
  border: 1px solid #203040;
  border-radius: 8px;
  background: #0d0f0f;
}

.maint-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

.maint-table th,
.maint-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #26302d;
  text-align: left;
  vertical-align: top;
}

.maint-table th {
  color: #93a9ba;
  background: #171a19;
}

.maint-table tbody tr {
  cursor: pointer;
}

.maint-table tbody tr:hover {
  background: #121615;
}

.maint-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
  color: #91a7b9;
  font-size: 13px;
}

.maint-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 7, 0.6);
  display: flex;
  justify-content: flex-end;
  z-index: 40;
}

.maint-drawer {
  width: min(45vw, 640px);
  max-width: 100%;
  min-width: 360px;
  height: 100%;
  overflow-y: auto;
  background: #101312;
  border-left: 1px solid #26302d;
  padding: 22px;
  position: relative;
  display: grid;
  gap: 16px;
  align-content: start;
}

.maint-drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 1px solid #2b3834;
  background: #171a19;
  color: #dce7ef;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.maint-drawer-title {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  padding-right: 36px;
}

.maint-drawer-title h2 {
  margin: 0;
  font-size: 20px;
}

.maint-drawer-title span {
  color: #91a7b9;
  font-size: 13px;
}

.maint-drawer-section {
  border-top: 1px solid #26302d;
  padding-top: 16px;
  display: grid;
  gap: 10px;
}

.maint-drawer-section h3 {
  margin: 0;
  font-size: 14px;
  color: #93a9ba;
}

.maint-drawer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin: 0;
}

.maint-drawer-grid dt {
  color: #91a7b9;
  font-size: 12px;
}

.maint-drawer-grid dd {
  margin: 2px 0 0;
  color: #edf6fb;
}

.maint-drawer-grid select {
  width: 100%;
  min-height: 34px;
  border: 1px solid #2b3834;
  border-radius: 8px;
  padding: 0 8px;
  color: #edf6fb;
  background: #0b0d0d;
}

.maint-drawer-description {
  margin: 0;
  color: #edf6fb;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.maint-timeline {
  display: grid;
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.maint-timeline-item {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 4px 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #1c2422;
}

.maint-timeline-time {
  color: #91a7b9;
  font-size: 12px;
  grid-row: span 2;
}

.maint-timeline-actor {
  color: #9ef4da;
  font-weight: 600;
  font-size: 13px;
}

.maint-timeline-note {
  grid-column: 2;
  color: #dce7ef;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.maint-drawer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid #26302d;
  padding-top: 16px;
}

.maint-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 7, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.maint-modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #101312;
  border: 1px solid #26302d;
  border-radius: 8px;
  padding: 20px;
  display: grid;
  gap: 14px;
}

.maint-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.maint-modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.maint-modal-header .maint-drawer-close {
  position: static;
}

.maint-modal-body {
  display: grid;
  gap: 12px;
}

.maint-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 980px) {
  .maint-drawer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .maint-drawer {
    width: 100%;
    min-width: 0;
  }

  .maint-timeline-item {
    grid-template-columns: 1fr;
  }

  .maint-timeline-time {
    grid-row: auto;
  }

  .maint-timeline-note {
    grid-column: 1;
  }

  .maint-drawer-actions button,
  .maint-modal-actions button {
    flex: 1;
  }
}

/* Ask AI */

.ask-ai-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 45;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid #2bc39a;
  background: #12352d;
  color: #f4fffb;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(5, 7, 7, 0.5);
}

.ask-ai-fab:hover {
  filter: brightness(1.08);
}

/* Non-blocking floating panel, not a modal: no backdrop/overlay element
   exists at all, so the rest of the page (charts, tables, filters, buttons)
   stays fully interactive underneath it and is never dimmed. The panel is
   pointer-events:auto on an otherwise untouched page — there is nothing
   behind it to disable pointer-events on. */
.ask-ai-drawer {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 440px;
  max-width: calc(100vw - 40px);
  height: min(760px, calc(100vh - 40px));
  z-index: 60;
  pointer-events: auto;
  background: #101312;
  border: 1px solid #26302d;
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(5, 7, 7, 0.45);
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 12px;
  overflow: hidden;
}

.ask-ai-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #26302d;
  padding-bottom: 12px;
}

.ask-ai-title {
  font-size: 16px;
  font-weight: 700;
  color: #edf6fb;
}

.ask-ai-context {
  margin-top: 4px;
  font-size: 12px;
  color: #8fa4b7;
}

.ask-ai-header-actions {
  display: flex;
  gap: 8px;
}

.ask-ai-icon-button {
  background: #0b0d0d;
  border: 1px solid #26302d;
  color: #e6edf3;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.ask-ai-icon-button:hover {
  border-color: #2bc39a;
}

.ask-ai-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
}

.ask-ai-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ask-ai-chip {
  align-self: flex-start;
  background: #0b0d0d;
  border: 1px solid #2b3834;
  color: #e6edf3;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.ask-ai-chip:hover {
  border-color: #2bc39a;
}

.ask-ai-chip.active {
  border-color: #2bc39a;
  background: #12352d;
  color: #f4fffb;
}

.ask-ai-message {
  display: flex;
  flex-direction: column;
  max-width: 92%;
}

.ask-ai-message-user {
  align-self: flex-end;
  align-items: flex-end;
}

.ask-ai-message-assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.ask-ai-bubble {
  white-space: pre-wrap;
  word-break: break-word;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
}

.ask-ai-message-user .ask-ai-bubble {
  background: #12352d;
  color: #f4fffb;
  border: 1px solid #2bc39a;
}

.ask-ai-message-assistant .ask-ai-bubble {
  background: #0b0d0d;
  color: #e6edf3;
  border: 1px solid #26302d;
}

.ask-ai-loading .ask-ai-bubble,
.ask-ai-loading {
  color: #8fa4b7;
  font-size: 13px;
  font-style: italic;
}

.ask-ai-footer {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #0b0d0d;
  border: 1px solid #26302d;
  font-size: 11px;
  color: #91a7b9;
  max-width: 100%;
}

.ask-ai-footer-label {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: #8fa4b7;
  margin-bottom: 4px;
}

.ask-ai-footer-line {
  color: #93a9ba;
}

.ask-ai-feedback {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ask-ai-feedback-btn {
  background: #0b0d0d;
  border: 1px solid #26302d;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 13px;
  cursor: pointer;
}

.ask-ai-feedback-btn.active {
  border-color: #2bc39a;
  background: #12352d;
}

.ask-ai-negative-panel {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.ask-ai-comment-input {
  width: 100%;
  background: #0b0d0d;
  border: 1px solid #26302d;
  border-radius: 8px;
  color: #e6edf3;
  padding: 6px 8px;
  font-size: 12px;
}

.ask-ai-send-small {
  background: #12352d;
  border: 1px solid #2bc39a;
  color: #f4fffb;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.ask-ai-error {
  border: 1px solid #70413f;
  background: #251413;
  color: #ffd8d4;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}

.ask-ai-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  border-top: 1px solid #26302d;
  padding-top: 12px;
}

.ask-ai-textarea {
  flex: 1;
  min-height: 40px;
  max-height: 140px;
  resize: vertical;
  background: #0b0d0d;
  border: 1px solid #26302d;
  border-radius: 8px;
  color: #e6edf3;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}

.ask-ai-textarea:disabled {
  opacity: 0.6;
}

.ask-ai-send {
  background: #12352d;
  border: 1px solid #2bc39a;
  color: #f4fffb;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.ask-ai-send:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (max-width: 768px) {
  .ask-ai-drawer {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    max-width: none;
    height: calc(100vh - 16px);
  }

  .ask-ai-fab {
    right: 16px;
    bottom: 16px;
  }
}
