.organisation-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

/* Author-level layout rules such as .detail-grid { display: grid; } override
   the browser's default [hidden] rule unless we explicitly hide tab panels. */
#topics-tab-panel[hidden],
#api-dashboard-panel[hidden] {
  display: none !important;
}

.organisation-tab {
  position: relative;
  padding: 11px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 600 11px ui-monospace, monospace;
  letter-spacing: .03em;
  cursor: pointer;
}

.organisation-tab:hover,
.organisation-tab.active {
  color: var(--cyan);
}

.organisation-tab.active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--cyan);
  content: "";
}

.api-dashboard-panel {
  min-height: calc(100vh - 280px);
}

.api-dashboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 14px;
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
}

.api-dashboard-toolbar h2 {
  margin: 0;
  font-size: 17px;
}

.api-dashboard-toolbar p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.api-dashboard-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-button,
.primary-button,
.danger-button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 3px;
  font: 600 11px ui-monospace, monospace;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--cyan);
  background: var(--cyan);
  color: var(--bg);
}

.primary-button:hover {
  filter: brightness(1.08);
}

.danger-button {
  margin-right: auto;
  border: 1px solid #66303a;
  background: #2a151a;
  color: #ff8294;
}

.api-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-tile {
  grid-column: span 3;
  min-height: 184px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  overflow: hidden;
}

.dashboard-tile[data-width="medium"] { grid-column: span 4; }
.dashboard-tile[data-width="large"] { grid-column: span 6; }
.dashboard-tile[data-width="full"] { grid-column: 1 / -1; }

.dashboard-tile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 61px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.dashboard-tile-header h3 {
  margin: 0;
  font-size: 13px;
}

.dashboard-tile-endpoint {
  display: block;
  max-width: 320px;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font: 9px ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-menu-button {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tile-menu-button:hover {
  border-color: var(--line);
  color: var(--cyan);
}

.dashboard-tile-body {
  min-height: 121px;
  padding: 16px;
}

.tile-loading,
.tile-error,
.tile-empty {
  display: grid;
  min-height: 88px;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.tile-error { color: #ff8294; }

.metric-value {
  font: 700 35px/1 ui-monospace, monospace;
  letter-spacing: -.05em;
}

.metric-unit {
  margin-left: 6px;
  color: var(--muted);
  font: 600 12px ui-monospace, monospace;
  letter-spacing: 0;
}

.metric-label,
.tile-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
}

.status-value {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid color-mix(in srgb, var(--cyan) 35%, transparent);
  border-radius: 3px;
  color: var(--cyan);
  font: 700 13px ui-monospace, monospace;
}

.status-value::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px var(--accent-dim);
  content: "";
}

.status-value.status-bad {
  border-color: #66303a;
  color: #ff8294;
}

.text-value {
  color: #d5dbe1;
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.json-value {
  max-height: 330px;
  margin: 0;
  overflow: auto;
  color: #cbd2d9;
  font: 10px/1.55 ui-monospace, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.data-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.data-list li {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-2);
  color: #cbd2d9;
  font: 10px/1.45 ui-monospace, monospace;
  overflow-wrap: anywhere;
}

.data-table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.data-table th { color: var(--muted); font-weight: 600; text-align: left; }
.data-table th,
.data-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table td { color: #cbd2d9; font-family: ui-monospace, monospace; overflow-wrap: anywhere; }

.dashboard-media {
  display: block;
  width: 100%;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #05080b;
  object-fit: contain;
}

.dashboard-image { min-height: 160px; }
.dashboard-video { aspect-ratio: 16 / 9; }

.dashboard-empty-state {
  display: grid;
  min-height: 360px;
  padding: 42px;
  place-items: center;
  align-content: center;
  border: 1px dashed #303946;
  border-radius: 4px;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  text-align: center;
}

.dashboard-empty-state[hidden] { display: none; }
.dashboard-empty-state h3 { margin: 14px 0 0; font-size: 16px; }
.dashboard-empty-state p { max-width: 510px; margin: 9px 0 20px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.dashboard-empty-icon { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid color-mix(in srgb, var(--cyan) 40%, transparent); border-radius: 50%; background: var(--accent-dim); color: var(--cyan); font-size: 25px; }

.configuration-dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100vh - 38px);
  padding: 0;
  border: 1px solid #343d49;
  border-radius: 5px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .58);
}

#dashboard-tile-dialog {
  width: min(960px, calc(100vw - 28px));
}

.configuration-dialog::backdrop { background: rgba(3, 6, 9, .82); backdrop-filter: blur(4px); }
.configuration-dialog-content { display: flex; max-height: calc(100vh - 40px); flex-direction: column; }
.configuration-dialog-header { display: flex; justify-content: space-between; gap: 20px; padding: 21px 23px; border-bottom: 1px solid var(--line); }
.configuration-dialog-header h2 { margin: 0; font-size: 18px; }
.configuration-dialog-header p { margin-top: 8px; color: var(--muted); font-size: 11px; }
.dialog-close { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel-2); color: var(--muted); font-size: 20px; cursor: pointer; }
.dialog-close:hover { color: var(--cyan); border-color: var(--cyan); }

.configuration-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  padding: 21px 23px;
  overflow: auto;
}

.configuration-form-grid label > span { display: block; margin-bottom: 7px; color: #adb5bd; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.configuration-form-grid input,
.configuration-form-grid select,
.configuration-form-grid textarea { width: 100%; min-height: 39px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 3px; outline: none; background: #0d1218; color: var(--text); font: 12px ui-sans-serif, system-ui; }
.configuration-form-grid textarea { resize: vertical; font-family: ui-monospace, monospace; line-height: 1.5; }
.configuration-form-grid input:focus,
.configuration-form-grid select:focus,
.configuration-form-grid textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px var(--accent-dim); }
.configuration-form-grid small { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.field-span-2 { grid-column: 1 / -1; }
.field-label { display: block; margin-bottom: 7px; color: #adb5bd; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.input-suffix { display: flex; align-items: center; }
.input-suffix input { border-radius: 3px 0 0 3px; }
.input-suffix i { display: grid; min-height: 39px; padding: 0 11px; place-items: center; border: 1px solid var(--line); border-left: 0; border-radius: 0 3px 3px 0; color: var(--muted); font: 10px ui-monospace, monospace; }
.toggle-field { display: flex; align-items: center; gap: 9px; }
.toggle-field input { width: 16px; min-height: 16px; accent-color: var(--cyan); }
.toggle-field > span { margin: 0 !important; text-transform: none !important; }

.configuration-dialog-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 23px; border-top: 1px solid var(--line); }
.form-error { margin-right: auto; color: #ff8294; font-size: 10px; }

.endpoint-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 9px;
}

.endpoint-control-row input { min-width: 0; }

.endpoint-control-row .compact-button {
  min-height: 39px;
  white-space: nowrap;
}

.tile-preview-panel,
.column-mapping-section,
.openapi-import {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0d1218;
}

.tile-preview-panel > header,
.column-mapping-section > header,
.openapi-import {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.tile-preview-panel > header,
.column-mapping-section > header { border-bottom: 1px solid var(--line); }
.tile-preview-panel strong { color: var(--muted); font: 10px ui-monospace, monospace; }
.column-mapping-section p,
.openapi-import p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }

.tile-preview-panel pre {
  max-height: 280px;
  margin: 0;
  padding: 13px;
  overflow: auto;
  color: #cbd2d9;
  font: 10px/1.5 ui-monospace, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detected-array-paths {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.array-path-button {
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--cyan) 30%, var(--line));
  border-radius: 3px;
  background: var(--accent-dim);
  color: var(--cyan);
  font: 9px ui-monospace, monospace;
  cursor: pointer;
}

.column-mapping-head,
.column-mapping-row {
  display: grid;
  grid-template-columns: minmax(120px, .7fr) minmax(180px, 1.3fr) 30px;
  gap: 8px;
  align-items: center;
}

.column-mapping-head {
  padding: 9px 12px 3px;
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}

.column-mapping-list { display: grid; gap: 7px; padding: 8px 12px 12px; }
.column-mapping-row input { min-height: 34px; }
.remove-column-mapping { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 3px; background: transparent; color: var(--muted); cursor: pointer; }
.remove-column-mapping:hover { border-color: #66303a; color: #ff8294; }

.openapi-import-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
}

.openapi-import-copy { flex: 0 1 230px; }

.openapi-file-control {
  display: grid;
  min-width: 250px;
  min-height: 39px;
  flex: 1 1 320px;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #0a0f15;
}

.configuration-form-grid .openapi-file-input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.openapi-file-button {
  display: grid;
  min-height: 37px;
  padding: 0 12px;
  place-items: center;
  border-right: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: 600 10px ui-monospace, monospace;
  cursor: pointer;
  white-space: nowrap;
}

.openapi-file-button:hover {
  background: var(--accent-dim);
  color: var(--cyan);
}

.openapi-file-input:focus-visible + .openapi-file-button {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}

.openapi-file-name {
  min-width: 0;
  padding: 0 11px;
  overflow: hidden;
  color: var(--muted);
  font: 10px ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1120px) {
  .dashboard-tile,
  .dashboard-tile[data-width="medium"] { grid-column: span 6; }
  .dashboard-tile[data-width="large"] { grid-column: 1 / -1; }
  .api-dashboard-toolbar { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 680px) {
  .api-dashboard-actions { width: 100%; flex-wrap: wrap; }
  .api-dashboard-actions .updated-label { flex-basis: 100%; }
  .dashboard-tile,
  .dashboard-tile[data-width] { grid-column: 1 / -1; }
  .configuration-form-grid { grid-template-columns: 1fr; }
  .field-span-2 { grid-column: auto; }
  .endpoint-control-row { grid-template-columns: 1fr; }
  .endpoint-control-row .compact-button { width: 100%; }
  .openapi-import { align-items: stretch; flex-direction: column; }
  .openapi-import-copy { flex-basis: auto; }
  .openapi-import-actions { align-items: stretch; flex-wrap: wrap; justify-content: flex-start; }
  .openapi-file-control { min-width: 100%; flex-basis: 100%; }
  .column-mapping-head { display: none; }
  .column-mapping-row { grid-template-columns: 1fr 30px; }
  .column-mapping-row .column-path { grid-column: 1; }
  .column-mapping-row .remove-column-mapping { grid-column: 2; grid-row: 1 / span 2; }
}
