/* ============================================================ */
/* Lab 16 — microNIDS · per-lab styles                           */
/* Same shape as lab-14 (microRAG) — patterns are stable.        */
/* ============================================================ */

.course-frame {
  font-family: var(--serif); font-size: 17px; line-height: 1.65;
  color: var(--ink-soft); margin: 10px 0 24px 0;
  padding: 6px 0 6px 16px; border-left: 3px solid var(--accent-soft);
}
.course-frame strong { color: var(--ink); }
body.presentation-mode .course-frame {
  font-size: 22px; padding-left: 22px; margin: 14px 0 32px 0;
}

.time-tag {
  display: inline-block; margin-left: 10px; padding: 2px 8px;
  font-family: var(--sans); font-size: 11px; font-weight: 500;
  text-transform: none; letter-spacing: 0; color: var(--ink-mute);
  background: var(--bg-elev); border: 1px solid var(--rule);
  border-radius: 10px; vertical-align: 2px;
}

pre.term-snippet {
  background: #14110d; color: #e8e1d5;
  font-family: var(--mono); font-size: 13px; line-height: 1.55;
  padding: 14px 18px; border-radius: 6px;
  overflow-x: auto; margin: 14px 0;
}
pre.term-snippet .term-comment { color: #6fab5c; }
pre.term-snippet .term-cmd     { color: #f6efe1; }

.msp {
  background: #faf8f2;
  border: 1px solid #e6e2d6;
  border-radius: 6px;
  padding: 12px 14px;
  margin: 18px 0;
}
.msp-rows { display: flex; flex-direction: column; }
.msp-row {
  display: grid; grid-template-columns: 1.2fr 1.4fr 2fr;
  gap: 14px; padding: 6px 0;
  border-bottom: 1px dashed #d8d2c0;
  font-size: 13px;
}
.msp-row:last-child { border-bottom: none; }
.msp-row.msp-head {
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-mute);
}
.msp-row span code {
  background: var(--bg-elev); padding: 1px 5px;
  border-radius: 3px; font-size: 0.92em;
}
.msp-foot {
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid var(--rule);
  font-family: var(--serif); font-size: 13px;
  color: var(--ink-soft); font-style: italic;
}
@media (max-width: 760px) {
  .msp-row { grid-template-columns: 1fr; gap: 4px; }
  .msp-row.msp-head { display: none; }
}

.exercise {
  background: var(--bg-elev);
  border-left: 3px solid var(--accent-soft);
  padding: 10px 14px;
  border-radius: 0 5px 5px 0;
  margin: 18px 0;
}
.exercise-q {
  display: block;
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); margin-bottom: 5px;
}
.exercise details { margin-top: 8px; }
.exercise summary { cursor: pointer; font-weight: 700; color: var(--ink-soft); }
.exercise details[open] summary { margin-bottom: 6px; }

.inline-dl {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  font-family: var(--mono); font-size: 0.82rem;
  background: var(--accent); color: white;
  border-radius: 4px;
  text-decoration: none; font-weight: 700;
  vertical-align: 1px;
  transition: filter 150ms;
}
.inline-dl:hover { filter: brightness(1.08); color: white; }

.code-download {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin: 12px 0 18px;
  padding: 10px 14px;
  background: #f4eee0;
  border: 1px solid #e1d9be;
  border-radius: 6px;
}
.code-download-label {
  font-family: var(--sans); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-mute);
}
.code-download-btn {
  font-family: var(--mono); font-size: 0.92rem;
  background: var(--accent); color: white;
  padding: 5px 12px; border-radius: 4px;
  text-decoration: none; font-weight: 700;
  transition: filter 150ms;
}
.code-download-btn:hover { filter: brightness(1.08); }
.code-download-hint {
  font-family: var(--serif); font-size: 14px;
  font-style: italic; color: var(--ink-soft);
}
.code-download-hint code { font-size: 0.92em; }

main table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 14px;
}
main table thead { border-bottom: 2px solid var(--rule); }
main table th {
  text-align: left;
  font-family: var(--sans);
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-mute);
  padding: 8px 10px;
}
main table td {
  padding: 8px 10px;
  border-bottom: 1px dashed #d8d2c0;
  vertical-align: top;
}
main table tr:last-child td { border-bottom: none; }

/* Shared mini-button */
.btn-mini {
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  background: var(--bg-elev); border: 1px solid var(--rule);
  color: var(--ink-soft);
  padding: 5px 10px; border-radius: 4px;
  cursor: pointer; transition: all 120ms;
}
.btn-mini:hover { background: white; border-color: var(--accent-soft); }
.btn-mini.active { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.btn-mini.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }

/* ============================================================ */
/* Widget 1 · interactive pipeline                                */
/* ============================================================ */
#viz-pipeline { padding: 16px 18px; }
.pipe-flow {
  display: flex; align-items: stretch; gap: 6px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.pipe-stage {
  flex: 1; min-width: 110px;
  background: #fff8e8;
  border: 1px solid #e7d9a8;
  border-radius: 8px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 150ms;
}
.pipe-stage:hover { background: #fff0c8; border-color: #d8c478; }
.pipe-stage.active {
  background: var(--accent); color: white; border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(177, 74, 46, 0.25);
}
.pipe-stage-num {
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; opacity: 0.7;
  margin-bottom: 4px;
}
.pipe-stage-label {
  font-family: var(--serif); font-size: 17px; font-weight: 700;
  margin-bottom: 4px;
}
.pipe-stage-sub {
  font-family: var(--mono); font-size: 11px;
  opacity: 0.75;
}
.pipe-arrow {
  align-self: center;
  font-size: 22px; font-weight: 700;
  color: var(--ink-mute);
  margin: 0 -2px;
}
@media (max-width: 760px) {
  .pipe-flow { flex-direction: column; }
  .pipe-arrow { transform: rotate(90deg); margin: 0; }
}
.pipe-detail {
  background: white;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 14px 16px;
}
.pipe-detail-row {
  display: grid; grid-template-columns: 1fr 1.3fr;
  gap: 18px;
  margin-bottom: 14px;
}
@media (max-width: 760px) { .pipe-detail-row { grid-template-columns: 1fr; } }
.pipe-detail-head {
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-mute); margin-bottom: 6px;
}
.pipe-detail-block p {
  font-family: var(--serif); font-size: 14px; line-height: 1.5;
  color: var(--ink-soft); margin: 0;
}
.pipe-detail-block pre {
  background: #14110d; color: #e8e1d5;
  font-family: var(--mono); font-size: 12px;
  padding: 10px 12px; border-radius: 5px;
  margin: 0; overflow-x: auto; line-height: 1.45;
}
.pipe-detail-snap {
  margin-top: 6px; padding-top: 10px;
  border-top: 1px dashed var(--rule);
}
.pipe-snap {
  background: #f7f3e6; color: #3d3a30;
  font-family: var(--mono); font-size: 12px;
  padding: 10px 12px; border-radius: 5px;
  margin: 0; overflow-x: auto; line-height: 1.5;
  white-space: pre;
}
.pipe-controls {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--rule);
}
.pipe-hint {
  margin-left: auto;
  font-family: var(--serif); font-size: 13px; font-style: italic;
  color: var(--ink-mute);
}

/* ============================================================ */
/* Widget 2 · feature importance                                  */
/* ============================================================ */
#viz-features { padding: 14px 16px; }
.fi-bars { display: flex; flex-direction: column; gap: 5px; }
.fi-row {
  display: grid; grid-template-columns: 220px 1fr 60px;
  gap: 10px; align-items: center;
  padding: 5px 8px;
  background: white;
  border: 1px solid var(--rule); border-radius: 4px;
  cursor: pointer; transition: all 120ms;
}
.fi-row:hover { background: #fff8e8; border-color: var(--accent-soft); }
.fi-row.active { background: var(--accent); color: white; border-color: var(--accent); }
.fi-name {
  font-family: var(--mono); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fi-bar-track {
  background: var(--bg-elev); height: 18px; border-radius: 2px;
  position: relative; overflow: hidden;
}
.fi-bar-fill {
  background: linear-gradient(90deg, #c93838, #ee9774);
  height: 100%; border-radius: 2px;
}
.fi-row.active .fi-bar-fill { background: linear-gradient(90deg, #ffd9c5, #fff8e8); }
.fi-val {
  font-family: var(--mono); font-size: 11px; text-align: right;
}
.fi-explain {
  margin-top: 12px; padding: 10px 14px;
  background: var(--bg-elev); border-left: 3px solid var(--accent-soft);
  border-radius: 0 4px 4px 0;
  font-family: var(--serif); font-size: 13px; line-height: 1.55;
  color: var(--ink-soft);
}
.fi-explain strong { color: var(--ink); }

/* ============================================================ */
/* Widget 3 · live perturbation simulator                         */
/* ============================================================ */
#viz-perturbation { padding: 14px 16px; }
.pt-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  margin-bottom: 14px;
}
@media (max-width: 760px) { .pt-grid { grid-template-columns: 1fr; } }
.pt-sliders { display: flex; flex-direction: column; gap: 10px; }
.pt-slider {
  display: grid; grid-template-columns: 1fr 60px;
  gap: 6px; align-items: center;
}
.pt-slider-label {
  font-family: var(--mono); font-size: 12px;
  color: var(--ink-mute);
  display: flex; justify-content: space-between;
  grid-column: 1 / -1;
}
.pt-slider-label strong { color: var(--ink); }
.pt-slider input[type=range] { width: 100%; grid-column: 1 / -1; }
.pt-meta {
  display: flex; gap: 12px; font-family: var(--mono); font-size: 10px;
  color: var(--ink-mute); grid-column: 1 / -1;
}

.pt-result {
  background: white; border: 1px solid var(--rule);
  border-radius: 6px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 14px;
  align-items: center; justify-content: center;
}
.pt-score-ring {
  width: 140px; height: 140px;
  position: relative;
}
.pt-verdict {
  font-family: var(--serif); font-size: 22px; font-weight: 700;
  text-align: center;
}
.pt-verdict.attack { color: #c93838; }
.pt-verdict.benign { color: #1a7a3a; }
.pt-score-text {
  font-family: var(--mono); font-size: 14px;
  color: var(--ink-mute); text-align: center;
}
.pt-reset {
  margin-top: 4px;
}
.pt-explain {
  padding: 10px 14px;
  background: var(--bg-elev); border-left: 3px solid var(--accent-soft);
  border-radius: 0 4px 4px 0;
  font-family: var(--serif); font-size: 13px; line-height: 1.55;
  color: var(--ink-soft);
}

/* ============================================================ */
/* Widget 4 · defense coverage matrix                            */
/* ============================================================ */
#viz-defenses { padding: 14px 16px; }
.dm-grid {
  display: grid;
  grid-template-columns: 200px repeat(4, 1fr);
  gap: 5px; margin-bottom: 12px;
}
.dm-corner { background: transparent; }
.dm-rowhead, .dm-colhead {
  background: var(--bg-elev);
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  color: var(--ink-mute);
  text-align: center; padding: 8px 6px;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
}
.dm-rowhead { font-family: var(--mono); text-align: left; }
.dm-cell {
  background: white;
  border: 1px solid var(--rule);
  font-family: var(--mono); font-size: 14px; font-weight: 700;
  text-align: center; padding: 12px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 120ms;
}
.dm-cell:hover { transform: scale(1.02); }
.dm-cell.active { outline: 3px solid var(--accent); outline-offset: 1px; }
.dm-cell.dm-high { background: #fde0d2; color: #6f1e0e; }
.dm-cell.dm-mid  { background: #fbe7a8; color: #6b4d05; }
.dm-cell.dm-low  { background: #d5e6dc; color: #1a3a28; }
.dm-explain {
  padding: 10px 14px;
  background: var(--bg-elev); border-left: 3px solid var(--accent-soft);
  border-radius: 0 4px 4px 0;
  font-family: var(--serif); font-size: 13px; line-height: 1.55;
  color: var(--ink-soft);
}
.dm-explain strong { color: var(--ink); }

/* Production-stack callout */
.prod-stack {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin: 18px 0;
}
.prod-card {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent-soft);
  border-radius: 5px;
  padding: 10px 14px;
}
.prod-card-head {
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); margin-bottom: 6px;
}
.prod-card p {
  margin: 0; font-family: var(--serif);
  font-size: 13px; line-height: 1.5;
  color: var(--ink-soft);
}
.prod-card code { font-size: 0.9em; background: white; padding: 1px 4px; border-radius: 2px; }
