.molbio-app {
  display: grid;
  grid-template-columns: 240px minmax(480px, 1fr) 300px;
  height: 100%;
  min-height: 0;
  background: var(--app-bg, #f7f8fb);
  color: var(--ink, #111827);
}

.molbio-sidebar,
.molbio-right {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--app-line, rgba(0,0,0,0.08));
  background: var(--app-bar, rgba(255,255,255,0.72));
  padding: 12px;
}

.molbio-right {
  border-right: 0;
  border-left: 1px solid var(--app-line, rgba(0,0,0,0.08));
}

.molbio-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.molbio-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.molbio-label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft, #5b6472);
  margin-bottom: 10px;
}

.molbio-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 8px 0 14px;
}

.molbio-nav {
  display: grid;
  gap: 5px;
}

.molbio-nav button {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 9px;
  border-radius: 6px;
  color: inherit;
  cursor: pointer;
}

.molbio-nav button:hover,
.molbio-nav button.active {
  background: var(--app-btn, rgba(255,255,255,0.86));
  border-color: var(--app-line, rgba(0,0,0,0.1));
}

.molbio-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--app-line, rgba(0,0,0,0.08));
  background: var(--app-bar, rgba(255,255,255,0.76));
}

.molbio-panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.molbio-toolbar,
.molbio-actions,
.molbio-ai-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.molbio-panel-body {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.molbio-status {
  border-top: 1px solid var(--app-line, rgba(0,0,0,0.08));
  color: var(--ink-soft, #5b6472);
  font-size: 12px;
  padding: 7px 12px;
}

.molbio-stack {
  display: grid;
  gap: 12px;
}

.molbio-seq-input,
.molbio-small-text,
.molbio-ai-input {
  min-height: 126px;
  resize: vertical;
  border: 1px solid var(--app-line, rgba(0,0,0,0.14));
  border-radius: 6px;
  padding: 10px;
  background: var(--app-input, #fff);
  color: inherit;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0;
}

.molbio-small-text { min-height: 82px; }
.molbio-ai-input { min-height: 110px; }

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

.molbio-metric,
.molbio-result,
.molbio-table-card,
.molbio-card,
.molbio-callout {
  border: 1px solid var(--app-line, rgba(0,0,0,0.09));
  border-radius: 8px;
  background: var(--app-input, #fff);
  padding: 10px;
}

.molbio-metric span {
  display: block;
  color: var(--ink-soft, #5b6472);
  font-size: 11px;
}

.molbio-metric strong {
  display: block;
  font-size: 18px;
  margin-top: 3px;
}

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

.molbio-result h3,
.molbio-table-card h3,
.molbio-card h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.molbio-result pre,
.molbio-alignment {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink, #111827);
}

.molbio-table-wrap {
  max-height: 280px;
  overflow: auto;
}

.molbio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.molbio-table th,
.molbio-table td {
  text-align: left;
  border-bottom: 1px solid var(--app-line, rgba(0,0,0,0.08));
  padding: 6px 7px;
  vertical-align: top;
}

.molbio-table th {
  position: sticky;
  top: 0;
  background: var(--app-input, #fff);
  z-index: 1;
}

.molbio-map-wrap {
  position: relative;
  min-height: 420px;
  border: 1px solid var(--app-line, rgba(0,0,0,0.08));
  border-radius: 8px;
  background: linear-gradient(180deg, #fafbfe 0%, #f3f6fb 100%);
  padding: 0;
  overflow: hidden;
}

.molbio-map-interactive-host {
  width: 100%;
  height: 100%;
  min-height: 420px;
  position: relative;
}

.molbio-map-viewport {
  width: 100%;
  height: 100%;
  min-height: 420px;
  overflow: hidden;
  cursor: grab;
  display: grid;
  place-items: center;
  touch-action: none;
}

.molbio-map-viewport.is-dragging {
  cursor: grabbing;
}

.molbio-map-svg-wrap {
  transform-origin: center center;
  will-change: transform;
}

.molbio-map-svg-wrap .molbio-plasmid-svg {
  width: 500px;
  height: 500px;
  max-width: none;
  max-height: none;
  display: block;
}

.molbio-map-hud {
  position: absolute;
  left: 10px;
  top: 8px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  font-size: 11px;
  color: var(--ink-soft, #5b6472);
  z-index: 2;
}

.molbio-map-hud-zoom {
  font-weight: 600;
  color: var(--ink, #111827);
}

.molbio-map-reset {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  font-size: 11px;
  padding: 4px 10px;
}

.molbio-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
  align-items: start;
}

.molbio-map-detail {
  border: 1px solid var(--app-line, rgba(0,0,0,0.08));
  border-radius: 8px;
  background: var(--app-input, #fff);
  padding: 10px 12px;
  min-height: 200px;
}

.molbio-map-detail h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.molbio-map-detail-text {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--ink-soft, #5b6472);
}

.molbio-map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--app-line, rgba(0,0,0,0.08));
  border-radius: 8px;
  background: var(--app-bar, rgba(255,255,255,0.72));
}

.molbio-map-opt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-soft, #5b6472);
}

.molbio-map-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.molbio-row-click {
  cursor: pointer;
}

.molbio-row-click:hover td {
  background: rgba(59, 130, 246, 0.08);
}

.molbio-plasmid-svg {
  width: min(500px, 100%);
  height: auto;
  max-height: 500px;
}

.molbio-map-bg {
  fill: #f8fafc;
  stroke: #e2e8f0;
  stroke-width: 1;
}

.molbio-map-ring {
  fill: none;
  stroke: #334155;
  stroke-width: 14;
  stroke-linecap: round;
}

.molbio-map-inner {
  fill: #ffffff;
  stroke: #e2e8f0;
  stroke-width: 1;
}

.molbio-map-feature {
  stroke-width: 10;
  stroke-linecap: round;
}

.molbio-map-arrow {
  opacity: 0.9;
}

.molbio-map-origin {
  fill: #f59e0b;
}

.molbio-map-tick {
  stroke: #94a3b8;
  stroke-width: 1;
}

.molbio-map-coord {
  font-size: 8px;
  fill: #94a3b8;
}

.molbio-site-line {
  stroke: #dc2626;
  stroke-width: 1.6;
}

.molbio-site-unique {
  stroke: #b91c1c;
  stroke-width: 2.4;
}

.molbio-map-enzyme {
  font-size: 8px;
  fill: #dc2626;
  font-weight: 600;
}

.molbio-map-enzyme.molbio-site-unique {
  font-weight: 800;
}

.molbio-cut-marker {
  fill: #dc2626;
}

.molbio-cut-marker.molbio-site-unique {
  fill: #b91c1c;
}

.molbio-base {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
}

.molbio-base-A { fill: #16a34a; }
.molbio-base-T { fill: #dc2626; }
.molbio-base-G { fill: #ca8a04; }
.molbio-base-C { fill: #2563eb; }
.molbio-base-U { fill: #9333ea; }
.molbio-base-N { fill: #6b7280; }

.molbio-map-pos {
  font-size: 6px;
  fill: #64748b;
}

.molbio-annot-tag {
  font-size: 8px;
  font-weight: 700;
}

.molbio-annot-sub {
  font-size: 6px;
  opacity: 0.85;
}

.molbio-annot-leader {
  opacity: 0.6;
}

.molbio-feat-boundary {
  opacity: 0.85;
}

.molbio-map-label {
  font-size: 9px;
  font-weight: 600;
}

.molbio-map-title {
  font-size: 14px;
  font-weight: 800;
  fill: var(--ink, #111827);
}

.molbio-map-sub {
  font-size: 11px;
  fill: var(--ink-soft, #5b6472);
}

.molbio-map-empty {
  font-size: 12px;
  fill: var(--ink-soft, #5b6472);
}

.molbio-linear-bar {
  fill: #334155;
}

.molbio-linear-map {
  position: relative;
  width: 92%;
  height: 84px;
  border-top: 8px solid #1f9d8a;
}

.molbio-linear-map span {
  position: absolute;
  top: -23px;
  min-width: 42px;
  height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 4px;
  padding: 2px 5px;
  background: #dff7f1;
  border: 1px solid #7bc9ba;
  font-size: 10px;
}

.molbio-list {
  margin: 0;
  padding-left: 22px;
}

.molbio-callout {
  color: var(--ink-soft, #5b6472);
}

.molbio-callout.warn {
  border-color: rgba(180, 83, 9, 0.25);
  background: rgba(251, 191, 36, 0.1);
  color: #92400e;
}

.molbio-ai-result {
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .molbio-app { grid-template-columns: 190px minmax(0, 1fr); }
  .molbio-right { display: none; }
  .molbio-metrics,
  .molbio-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .molbio-map-layout { grid-template-columns: 1fr; }
}

.dark .molbio-app {
  --app-bg: #10131a;
  --app-input: rgba(255,255,255,0.06);
  --app-bar: rgba(255,255,255,0.04);
  --app-line: rgba(255,255,255,0.12);
}

.molbio-demo-picker {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--app-line, rgba(0,0,0,0.08));
}

.molbio-primer-controls {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.molbio-gel-wrap {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--app-line, rgba(0,0,0,0.08));
  border-radius: 8px;
}

.molbio-annotation-editor {
  padding: 12px;
  border: 1px solid var(--app-line, rgba(0,0,0,0.08));
  border-radius: 8px;
  background: var(--app-input, rgba(0,0,0,0.02));
  display: grid;
  gap: 8px;
}

.molbio-muted {
  color: #64748b;
  font-size: 13px;
}

.btn.warn {
  color: #b91c1c;
  border-color: #fecaca;
}
