/* =============================================================================
 * AVD on GCC High — Landing Zone Assessment Workshop
 * styles.css — focus-first, low-context-switch workshop UI
 * ========================================================================== */

/* ---------- Theme tokens ---------- */
:root {
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --mono: "Cascadia Code", "Consolas", ui-monospace, monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 8px 30px rgba(0,0,0,.28);
  --maxw: 1080px;
}

body[data-theme="dark"] {
  --bg: #1b2124;
  --bg-2: #222a2e;
  --panel: #2a3439;
  --panel-2: #333f45;
  --border: #3e4a51;
  --text: #e7ecef;
  --text-dim: #a2adb4;
  --accent: #5ab0ff;
  --accent-2: #8a7cff;
  --good: #3ecf8e;
  --warn: #ffb454;
  --rail: #171c1f;
}

body[data-theme="light"] {
  --bg: #eef2f8;
  --bg-2: #e3e9f3;
  --panel: #ffffff;
  --panel-2: #f4f7fc;
  --border: #d3ddec;
  --text: #14203a;
  --text-dim: #55688a;
  --accent: #0f6cbd;
  --accent-2: #6b4ce0;
  --good: #12855a;
  --warn: #b5730b;
  --rail: #f6f9fd;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 20px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.topbar__brand { display: flex; align-items: center; gap: 12px; }
.topbar__logo { color: var(--accent); display: grid; place-items: center; }
.topbar__titles h1 { font-size: 15px; margin: 0; letter-spacing: .2px; }
.topbar__titles p { margin: 2px 0 0; font-size: 11.5px; color: var(--text-dim); }
.topbar__actions { display: flex; align-items: center; gap: 8px; }
.engagement input {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: 7px 11px; border-radius: var(--radius-sm); font-size: 13px; width: 220px;
}
.engagement input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font); font-size: 13px; cursor: pointer;
  border-radius: var(--radius-sm); padding: 8px 14px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); transition: .15s;
}
.btn:hover { border-color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #04121f; font-weight: 600; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; }
.btn--icon { padding: 8px 10px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Progress ---------- */
.progress {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 20px; background: var(--bg-2); border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.progress__bar { flex: 1; height: 8px; background: var(--rail); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress__fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s; }
.progress__label { font-size: 12px; color: var(--text-dim); white-space: nowrap; }

/* ---------- Layout ---------- */
.layout {
  flex: 1 1 auto; display: grid;
  grid-template-columns: 244px minmax(0, 1fr) 300px;
  min-height: 0;
}
.layout.dock-collapsed { grid-template-columns: 244px minmax(0, 1fr) 44px; }

/* ---------- Rail ---------- */
.rail {
  background: var(--rail); border-right: 1px solid var(--border);
  padding: 12px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
}
.rail__item {
  display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
  background: transparent; border: 1px solid transparent; color: var(--text);
  padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
}
.rail__item:hover { background: var(--panel); }
.rail__item.is-active { background: var(--panel-2); border-color: var(--accent); }
.rail__icon { color: var(--accent); font-size: 15px; width: 18px; text-align: center; }
.rail__text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.rail__title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail__sub { font-size: 10.5px; color: var(--text-dim); }
.rail__badge {
  font-size: 10.5px; color: var(--text-dim); background: var(--bg);
  border: 1px solid var(--border); border-radius: 99px; padding: 1px 7px; white-space: nowrap;
}
.rail__badge.is-complete { color: #04121f; background: var(--good); border-color: var(--good); font-weight: 700; }

/* ---------- Workspace ---------- */
.workspace { overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.module { max-width: var(--maxw); width: 100%; margin: 0 auto; padding: 26px 32px 8px; flex: 1; }

.module__eyebrow { font-size: 11.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.module__title { margin: 6px 0 6px; font-size: 26px; }
.module__tagline { margin: 0 0 18px; color: var(--text-dim); font-size: 14.5px; max-width: 760px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  background: transparent; border: none; color: var(--text-dim); cursor: pointer;
  padding: 10px 14px; font-size: 13.5px; font-weight: 600; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.panel { display: none; animation: fade .18s ease; }
.panel.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Prose (overview) ---------- */
.prose { font-size: 14.5px; line-height: 1.65; max-width: 780px; }
.prose h2 { font-size: 20px; margin: 4px 0 10px; }
.prose h3 { font-size: 16px; margin: 22px 0 8px; color: var(--accent); }
.prose h4 { font-size: 14px; margin: 16px 0 6px; }
.prose p { margin: 10px 0; color: var(--text); }
.prose ul, .prose ol { margin: 8px 0 8px 4px; padding-left: 22px; }
.prose li { margin: 5px 0; }
.prose code { font-family: var(--mono); font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }
.prose a { color: var(--accent); }
.prose blockquote {
  margin: 14px 0; padding: 10px 14px; border-left: 3px solid var(--accent-2);
  background: var(--panel); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-dim);
}
.prose strong { color: var(--text); }

/* ---------- Phase panels / forms ---------- */
.phasebar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 16px;
}
.phasebar__blurb { margin: 0; font-size: 13px; color: var(--text-dim); }
.phasebar__meta { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--bg); border: 1px solid var(--border); border-radius: 99px; padding: 2px 10px; white-space: nowrap; }

.form { display: grid; gap: 16px; max-width: 820px; }
.q { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.q__label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.q__num { display: inline-block; min-width: 34px; margin-right: 8px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 999px; background: rgba(74,168,255,0.12); color: var(--accent); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; vertical-align: 1px; -webkit-user-select: all; user-select: all; }
.q__prefill { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: rgba(124,92,255,0.14); color: var(--accent-2); font-size: 10.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; vertical-align: 1px; }
.q__help { margin: 0 0 10px; font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.q__input {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 9px 11px; border-radius: var(--radius-sm); font-size: 13.5px; font-family: var(--font);
}
.q__input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.q__textarea { resize: vertical; min-height: 62px; line-height: 1.5; }
select.q__input { cursor: pointer; }

.q__options { display: grid; gap: 8px; margin-top: 4px; }
.report__actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 6px; }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { filter: brightness(1.06); border-color: var(--accent); }
.report__preview { margin-top: 12px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); max-height: 60vh; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 12.5px; line-height: 1.5; }
.library { position: fixed; top: 64px; right: 16px; z-index: 60; width: min(360px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.35); overflow: hidden; }
.library__head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.library__title { font-weight: 700; font-size: 13px; }
.library__list { max-height: 60vh; overflow: auto; padding: 6px; display: grid; gap: 6px; }
.library__empty { margin: 8px; color: var(--text-dim); font-size: 12.5px; }
.library__item { display: flex; align-items: stretch; gap: 6px; }
.library__open { flex: 1; text-align: left; display: grid; gap: 2px; padding: 8px 10px; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); cursor: pointer; }
.library__open:hover { border-color: var(--accent); }
.library__name { font-weight: 600; font-size: 13px; }
.library__meta { font-size: 11px; color: var(--text-dim); }
.library__del { width: 36px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: transparent; color: var(--text-dim); cursor: pointer; font-size: 13px; }
.library__del:hover { border-color: #e5484d; color: #e5484d; }
.opt {
  display: flex; align-items: center; gap: 9px; font-size: 13.5px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 11px; cursor: pointer;
}
.opt:hover { border-color: var(--accent); }
.opt input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---------- Module nav ---------- */
.module-nav {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; max-width: var(--maxw); width: 100%; margin: 0 auto;
  padding: 14px 32px; background: linear-gradient(0deg, var(--bg), transparent);
  border-top: 1px solid var(--border);
}
.module-nav__meta { font-size: 12px; color: var(--text-dim); }
.module-nav__meta span { color: var(--accent); font-weight: 700; }

/* ---------- Reference dock ---------- */
.dock { background: var(--bg-2); border-left: 1px solid var(--border); overflow-y: auto; display: flex; flex-direction: column; }
.dock__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px; position: sticky; top: 0; background: var(--bg-2); }
.dock__head h3 { margin: 0; font-size: 12.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim); }
.dock__body { padding: 6px 12px 20px; display: flex; flex-direction: column; gap: 8px; }
.dock-collapsed .dock__head h3, .dock-collapsed .dock__body { display: none; }
.dock-collapsed .dock__head { justify-content: center; }

.refcard {
  display: flex; flex-direction: column; gap: 3px; text-decoration: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; transition: .15s;
}
.refcard:hover { border-color: var(--accent); transform: translateY(-1px); }
.refcard__title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.35; }
.refcard__note { font-size: 11.5px; color: var(--text-dim); line-height: 1.4; }
.refcard__url { font-size: 10.5px; color: var(--accent); font-family: var(--mono); word-break: break-all; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel); border: 1px solid var(--accent); color: var(--text);
  padding: 11px 18px; border-radius: var(--radius); font-size: 13.5px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: .25s; z-index: 50;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-error { border-color: var(--warn); }

/* ---------- Scrollbars ---------- */
.rail::-webkit-scrollbar, .workspace::-webkit-scrollbar, .dock::-webkit-scrollbar { width: 10px; }
.rail::-webkit-scrollbar-thumb, .workspace::-webkit-scrollbar-thumb, .dock::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box;
}

/* ---------- Bandwidth estimator ---------- */
.calc {
  margin: 22px 0 4px; max-width: 780px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
}
.calc__head { margin-bottom: 12px; }
.calc__title { margin: 0 0 4px; font-size: 15px; color: var(--accent); }
.calc__sub { margin: 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.calc__sub a { color: var(--accent); }
.calc__table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
.calc__table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-dim); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--border);
}
.calc__table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.calc__table tr:last-child td { border-bottom: none; }
.calc__num { text-align: right; white-space: nowrap; }
.calc__wl { font-weight: 600; }
.calc__ex, .calc__ex-th { color: var(--text-dim); font-size: 12px; }
.calc__table .calc__subtotal { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.calc__input {
  width: 100%; max-width: 110px; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 6px 9px; border-radius: var(--radius-sm); font-size: 13px; font-family: var(--font); text-align: right;
}
.calc__input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.calc__controls { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; }
.calc__ctrl { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-dim); }
.calc__ctrl-label { font-weight: 600; }
.calc__ctrl .calc__input { max-width: 140px; text-align: left; }
.calc__results {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px;
}
.calc__metric {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
}
.calc__metric--accent { border-color: var(--accent); background: var(--panel-2); }
.calc__metric-value { font-size: 20px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.calc__metric--accent .calc__metric-value { color: var(--accent); }
.calc__metric-label { font-size: 11.5px; color: var(--text-dim); line-height: 1.35; }
.calc__note { margin: 0; font-size: 11.5px; color: var(--text-dim); line-height: 1.5; }

/* ---------- Bicep generator card ---------- */
.gencard {
  margin: 20px 0 4px; max-width: 780px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
}
.gencard__title { margin: 0 0 4px; font-size: 15px; color: var(--accent); }
.gencard__sub { margin: 0 0 12px; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.gencard__sub code { font-family: var(--mono); font-size: 11.5px; background: var(--panel-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }
.gencard__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gencard__select { max-width: 320px; }
.gencard__select option:disabled { color: var(--text-dim); }
.gencard__note { margin: 10px 0 0; font-size: 11.5px; color: var(--text-dim); line-height: 1.5; }
.badge-preview {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  vertical-align: middle; background: var(--warn); color: #1a1205; border: 1px solid transparent;
}
.btn--primary .badge-preview { background: rgba(4, 18, 31, .22); color: inherit; border-color: rgba(4, 18, 31, .28); }

/* ---------- Deploy modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(4, 8, 18, .6);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal {
  width: min(760px, 100%); background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin: auto;
}
.modal__title { margin: 0 0 6px; font-size: 17px; color: var(--accent); }
.modal__sub { margin: 0 0 14px; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.modal__sub code, .modal__note code { font-family: var(--mono); font-size: 11.5px; background: var(--panel-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }
.modal__form { display: flex; flex-direction: column; gap: 12px; }
.modal__field { display: flex; flex-direction: column; gap: 5px; }
.modal__label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.modal__help { margin: 0; font-size: 11.5px; color: var(--text-dim); line-height: 1.45; }
.modal__advanced { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--panel-2); }
.modal__advanced summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text); }
.modal__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.modal__note { margin: 4px 0 0; font-size: 11.5px; color: var(--text-dim); line-height: 1.5; }
.modal__previewwrap { margin-top: 14px; }
.modal__previewhead { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); font-weight: 700; margin-bottom: 6px; }
.modal__preview {
  margin: 0; padding: 12px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  max-height: 260px; overflow: auto; white-space: pre; font-family: var(--mono); font-size: 11.5px; line-height: 1.45; color: var(--text);
}
.modal__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.modal__status { font-size: 11.5px; color: var(--text-dim); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 200px minmax(0, 1fr); }
  .layout.dock-collapsed { grid-template-columns: 200px minmax(0, 1fr); }
  .dock { display: none; }
  .module { padding: 22px 24px 8px; }
}

@media (max-width: 860px) {
  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar__actions { flex-wrap: wrap; justify-content: flex-end; }
  .module__title { font-size: 22px; }
}

@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .rail {
    flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 8px; gap: 6px;
  }
  .rail__item { flex: 0 0 auto; padding: 7px 10px; }
  .rail__sub { display: none; }
  .rail__title { font-size: 12.5px; }

  .topbar { flex-wrap: wrap; }
  .topbar__brand { flex: 1 1 auto; min-width: 0; }
  .topbar__titles h1 { font-size: 14px; }
  .topbar__titles p { font-size: 11px; }
  .topbar__actions { width: 100%; gap: 6px; }
  .engagement { flex: 1 1 100%; order: -1; }
  .engagement input { width: 100%; }

  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; padding: 10px 12px; }

  .module { padding: 16px 16px 6px; }
  .module-nav { padding: 12px 16px; gap: 10px; }
  .prose, .module__tagline { max-width: none; }
  .calc, .gencard { padding: 14px; overflow-x: auto; }

  .library { top: 8px; right: 8px; left: 8px; width: auto; }
}

@media (max-width: 520px) {
  .topbar__actions .btn { padding: 7px 10px; font-size: 12px; }
  .module__title { font-size: 20px; }
  .module__tagline { font-size: 13.5px; }
  .progress { padding: 8px 14px; }
  .progress__label { font-size: 11px; }

  .gencard__row { gap: 8px; }
  .gencard__select { max-width: none; width: 100%; }
  .gencard__row .btn, .report__actions .btn, .modal__actions .btn { flex: 1 1 auto; text-align: center; }

  .calc__ex, .calc__ex-th { display: none; }

  .modal-overlay { padding: 14px 10px; }
  .modal { padding: 16px; }
  .modal__grid { grid-template-columns: 1fr; }
  .module-nav__meta { display: none; }
}
