/* Regulyst Framework Studio — brand: navy #0d1b4f · mid blue #1b4fa0 · accent #4da3ff */
:root {
  --navy: #0d1b4f;
  --blue: #1b4fa0;
  --accent: #4da3ff;
  --ink: #16213a;
  --muted: #5b6478;
  --line: #dfe5f0;
  --bg: #f7f9fd;
  --card: #ffffff;
  --ok: #1d7a4f;
  --bad: #b3261e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.top {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  background: var(--navy);
  color: #fff;
}
.logo { height: 34px; width: 34px; border-radius: 7px; background: #fff; }
.wordmark { font-size: 18px; font-weight: 650; letter-spacing: .2px; }
.wordmark em { font-style: normal; font-weight: 400; opacity: .85; }

main { flex: 1; width: 100%; max-width: 1060px; margin: 0 auto; padding: 28px 20px 60px; }
.screen { animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

h1 { font-size: clamp(26px, 4.5vw, 40px); line-height: 1.15; color: var(--navy); margin: 18px 0 10px; }
h2 { font-size: clamp(22px, 3.5vw, 30px); color: var(--navy); margin: 10px 0 8px; }
h3 { color: var(--navy); margin: 26px 0 6px; }
.sub { color: var(--muted); max-width: 62ch; margin: 6px 0 18px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }

.privacy {
  background: #eef4ff; border: 1px solid #cfdcf6; border-left: 4px solid var(--blue);
  border-radius: 8px; padding: 10px 14px; font-size: 14px; color: var(--ink);
  max-width: 72ch;
}
.privacy a { color: var(--blue); }

.dropzone {
  margin-top: 14px; border: 2px dashed var(--line); border-radius: 12px;
  background: var(--card); transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--accent); background: #f0f7ff; }
.dropzone textarea {
  display: block; width: 100%; border: 0; resize: vertical; border-radius: 12px 12px 0 0;
  padding: 14px 16px; font: 14px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--ink); background: transparent; outline: none; min-height: 170px;
}
.dropzone-foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding: 10px 14px;
}
.filebtn {
  display: inline-block; cursor: pointer; font-size: 14px; font-weight: 600;
  color: var(--blue); border: 1px solid var(--blue); border-radius: 8px; padding: 7px 14px;
}
.filebtn:hover { background: #eef4ff; }
.filebtn input { display: none; }

.inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 18px 0; }
.inputs label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 650; color: var(--navy); }
.inputs input, .inputs select {
  font: 15px/1.4 inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink);
}
.inputs input:focus, .inputs select:focus, .dropzone textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.cta {
  font: 600 16px/1 inherit; color: #fff; background: var(--blue); border: 0; border-radius: 10px;
  padding: 14px 26px; cursor: pointer; transition: background .15s;
}
.cta:hover { background: var(--navy); }
.cta:disabled { background: #9db2d6; cursor: default; }
.ghost {
  font: 600 15px/1 inherit; color: var(--blue); background: transparent;
  border: 1px solid var(--line); border-radius: 10px; padding: 13px 22px; cursor: pointer;
}
.ghost:hover { border-color: var(--blue); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0 8px; }

.error { color: var(--bad); font-weight: 600; }
.notice {
  background: #fdf6e7; border: 1px solid #f0dfb2; border-left: 4px solid #d9a520;
  border-radius: 8px; padding: 9px 13px; font-size: 14px; max-width: 78ch;
}

/* progress */
.stages { display: flex; gap: 20px; list-style: none; padding: 0; margin: 14px 0 10px; flex-wrap: wrap; }
.stages li { color: var(--muted); font-size: 14px; padding-left: 22px; position: relative; }
.stages li::before {
  content: ''; position: absolute; left: 0; top: 3px; width: 14px; height: 14px;
  border: 2px solid var(--line); border-radius: 50%; background: var(--card);
}
.stages li.active { color: var(--navy); font-weight: 650; }
.stages li.active::before { border-color: var(--accent); animation: pulse 1.2s infinite; }
.stages li.done { color: var(--ok); }
.stages li.done::before { border-color: var(--ok); background: var(--ok); }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(77, 163, 255, .25); } }

.progressbar { height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; margin: 6px 0 8px; }
#progress-fill { height: 100%; width: 3%; background: linear-gradient(90deg, var(--blue), var(--accent)); transition: width .5s ease; }

/* the live-building framework + review view share the clause card */
.clause {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; margin: 10px 0; animation: rise .3s ease;
}
.clause-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.clause-num { font-weight: 750; color: var(--blue); white-space: nowrap; }
.clause-name { font-weight: 650; color: var(--navy); }
.clause-desc { color: var(--muted); font-size: 14px; margin: 3px 0 0; }
.badge {
  font-size: 12px; font-weight: 700; border-radius: 20px; padding: 2px 10px; white-space: nowrap;
}
.badge.machinery { background: #fdeaea; color: var(--bad); }
.badge.pending { background: #eef4ff; color: var(--blue); }
.badge.count { background: #e8f3ec; color: var(--ok); }
.control { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 8px; }
.control-title { font-weight: 600; }
.control-num { color: var(--blue); font-weight: 700; margin-right: 8px; }
.control-desc { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.reqs { margin: 6px 0 0; padding-left: 20px; font-size: 14px; color: var(--ink); }
.reqs li { margin: 2px 0; }
.reqs .req-name { font-weight: 600; }

/* refine findings */
.finding {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; margin: 12px 0;
}
.finding.trust { border-left: 4px solid var(--bad); }
.finding.cleanup { border-left: 4px solid #d9a520; }
.finding-label { font-weight: 700; color: var(--navy); }
.finding-why { font-size: 14px; color: var(--muted); margin: 4px 0 8px; }
.finding-evidence {
  background: #f4f6fb; border-radius: 8px; padding: 8px 12px; font-size: 13.5px; margin: 8px 0;
}
.finding-evidence .headline { font-weight: 650; color: var(--ink); }
.finding-evidence ul { margin: 6px 0 0; padding-left: 18px; }
.finding-opts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.opt {
  font: 600 14px/1 inherit; border-radius: 8px; padding: 9px 14px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
}
.opt.selected { border-color: var(--blue); background: #eef4ff; color: var(--blue); }
.opt .tag { font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 6px; }
.all-clear {
  background: #e8f3ec; border: 1px solid #bcdcc8; border-left: 4px solid var(--ok);
  border-radius: 8px; padding: 12px 16px; color: var(--ink);
}

/* downloads */
.downloads { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0 8px; }
.dl {
  display: block; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; cursor: pointer; font: inherit;
}
.dl:hover { border-color: var(--accent); }
.dl .dl-name { font-weight: 700; color: var(--blue); }
.dl .dl-meta { font-size: 13px; color: var(--muted); }

.trial {
  margin-top: 34px; background: var(--navy); color: #fff; border-radius: 14px; padding: 22px 24px;
}
.trial h3 { color: #fff; margin-top: 0; }
.trial .sub { color: #c6d2ee; }
.trial .inputs label { color: #c6d2ee; }
.trial .privacy { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); color: #dfe7f8; }
.trial .privacy a { color: var(--accent); }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 18px; }

@media (max-width: 640px) {
  main { padding: 18px 14px 40px; }
  .stages { gap: 12px; flex-direction: column; }
  .actions .cta, .actions .ghost { width: 100%; }
  .cta { width: 100%; }
}

/* ═══════════ Traceability view — ported from the product's regulatoryTraceability.css ═══════════
   Same tokens, class names, spacing and accents as the in-product component (rt-*), so the free
   tool's output is recognisably the SAME view. Sections that need org data render as the product's
   own empty-section treatment (dashed, muted, italic guide) — deliberately, as labelled absences. */
.rt {
  --rt-brand: #0a2f5a;
  --rt-bg: #f4f6f9;
  --rt-card: #ffffff;
  --rt-border: #e5e8ee;
  --rt-text: #181b20;
  --rt-text-muted: #6b7280;
  --rt-accent-risk: #d97706;
  --rt-accent-control: #2563eb;
  --rt-accent-monitor: #059669;
  --rt-accent-evidence: #7c3aed;
  --rt-accent-business: #0891b2;
  --rt-accent-framework: #475569;
  --rt-accent-req: #6366f1;
  --rt-accent-owner: #0a2f5a;
  --rt-radius: 0.625rem;
  display: grid; grid-template-columns: minmax(260px, 340px) 1fr;
  border: 1px solid var(--rt-border); border-radius: var(--rt-radius);
  overflow: hidden; background: var(--rt-bg); min-height: 480px; margin: 14px 0;
}
.rt-tree-panel { background: var(--rt-card); border-right: 1px solid var(--rt-border); display: flex; flex-direction: column; min-height: 0; }
.rt-tree-title { padding: 0.75rem 1rem; font-weight: 700; font-size: 0.85rem; color: var(--rt-brand); border-bottom: 1px solid var(--rt-border); text-transform: uppercase; letter-spacing: 0.5px; }
.rt-tree-scroll { overflow-y: auto; max-height: 560px; padding: 0.25rem 0; }
.rt-tree-list { list-style: none; margin: 0; padding: 0; }
.rt-tree-row { display: flex; align-items: center; gap: 0.25rem; padding: 0.35rem 0.5rem; cursor: pointer; border-left: 3px solid transparent; }
.rt-tree-row:hover { background: #f8fafc; }
.rt-tree-row-selected { background: #eff6ff; border-left-color: var(--rt-accent-control); }
.rt-tree-row-selected .rt-tree-label-text { font-weight: 600; }
.rt-tree-toggle { background: none; border: none; cursor: pointer; padding: 2px 4px; border-radius: 3px; color: var(--rt-text-muted); font-size: 0.7rem; width: 20px; flex-shrink: 0; }
.rt-tree-toggle:hover { background: #e2e8f0; }
.rt-tree-toggle-spacer { width: 20px; flex-shrink: 0; }
.rt-tree-label { background: none; border: none; cursor: pointer; padding: 0; text-align: left; font-family: inherit; flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.3rem; }
.rt-tree-label-text { font-size: 0.8rem; font-weight: 500; color: var(--rt-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-tbadge { font-size: 0.55rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px; padding: 0.1rem 0.3rem; border-radius: 3px; flex-shrink: 0; line-height: 1; }
.rt-tbadge-reg    { background: #f1f5f9; color: var(--rt-accent-framework); }
.rt-tbadge-clause { background: #ecfeff; color: var(--rt-accent-business); }
.rt-tbadge-ctrl   { background: #eff6ff; color: var(--rt-accent-control); }
.rt-tbadge-req    { background: #eef2ff; color: var(--rt-accent-req); }
.rt-indent-1 { padding-left: 1.35rem; }
.rt-indent-2 { padding-left: 2.55rem; }
.rt-indent-3 { padding-left: 3.75rem; }

.rt-detail-panel { min-width: 0; overflow-y: auto; max-height: 640px; padding: 1.25rem 1.5rem; background: var(--rt-bg); }
.rt-node-badge { display: inline-block; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--rt-accent-control); background: #eff6ff; padding: 0.15rem 0.5rem; border-radius: 4px; margin-bottom: 0.4rem; }
.rt-detail-title { font-size: 1.05rem; font-weight: 700; color: var(--rt-text); margin: 0 0 0.2rem; }
.rt-detail-desc { font-size: 0.85rem; color: var(--rt-text-muted); margin: 0 0 1rem; }

.rt-chain { position: relative; padding-left: 1.5rem; }
.rt-chain::before { content: ''; position: absolute; left: 0.625rem; top: 0; bottom: 0; width: 2px; background: var(--rt-border); }
.rt-chain-section { position: relative; background: var(--rt-card); border: 1px solid var(--rt-border); border-radius: var(--rt-radius); margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.04); border-left: 4px solid var(--rt-border); }
.rt-chain-section::before { content: ''; position: absolute; left: -1.5rem; top: 1.1rem; width: 1rem; height: 2px; background: var(--rt-border); }
.rt-section-control    { border-left-color: var(--rt-accent-control); }
.rt-section-monitoring { border-left-color: var(--rt-accent-monitor); }
.rt-section-evidence   { border-left-color: var(--rt-accent-evidence); }
.rt-section-risk       { border-left-color: var(--rt-accent-risk); }
.rt-section-policy     { border-left-color: var(--rt-accent-business); }
.rt-section-owner      { border-left-color: var(--rt-accent-owner); }
.rt-section-approval   { border-left-color: var(--rt-accent-req); }
.rt-section-empty { opacity: 0.7; border-style: dashed; }
.rt-empty-guide { font-size: 0.82rem; color: var(--rt-text-muted); margin: 0; font-style: italic; }
.rt-section-header { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--rt-border); }
.rt-section-header h3 { font-size: 0.85rem; font-weight: 700; color: var(--rt-text); margin: 0; letter-spacing: 0.2px; }
.rt-section-body { padding: 0.75rem 1rem; }
.rt-count { background: var(--rt-brand); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 999px; margin-left: auto; }
.rt-count-empty { background: #cbd5e1; }
.rt-item { padding: 0.4rem 0; border-bottom: 1px dashed var(--rt-border); font-size: 0.85rem; }
.rt-item:last-child { border-bottom: 0; }
.rt-item-num { color: var(--rt-accent-control); font-weight: 700; margin-right: 0.5rem; }
.rt-item-desc { color: var(--rt-text-muted); font-size: 0.8rem; margin-top: 0.1rem; }
.rt-product-note { font-size: 0.78rem; color: var(--rt-text-muted); padding: 0.35rem 0 0; }

@media (max-width: 760px) {
  .rt { grid-template-columns: 1fr; }
  .rt-tree-panel { border-right: 0; border-bottom: 1px solid var(--rt-border); }
  .rt-tree-scroll { max-height: 260px; }
}

/* Bring-your-own-key panel */
.keypanel {
  margin: 16px 0 14px; background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--accent); border-radius: 12px; padding: 16px 18px; max-width: 78ch;
}
.keypanel-title { margin: 0 0 6px; font-size: 17px; }
.keypanel-line { margin: 0 0 10px; color: var(--muted); font-size: 14.5px; }
.keypanel-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 650; color: var(--navy); max-width: 480px; }
.keypanel-label input {
  font: 15px/1.4 ui-monospace, Consolas, monospace; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}
.keypanel-label input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.keypanel-status { font-size: 13.5px; font-weight: 600; margin: 6px 0 2px; min-height: 18px; }
.keypanel-status.ok { color: var(--ok); }
.keypanel-status.bad { color: var(--bad); }
.keypanel-facts { margin: 8px 0; padding-left: 18px; font-size: 14px; color: var(--ink); }
.keypanel-facts li { margin: 5px 0; }
.keypanel-facts a { color: var(--blue); }
.keypanel-promise {
  margin: 10px 0 0; font-size: 13.5px; color: var(--ink);
  background: #eef4ff; border-radius: 8px; padding: 9px 12px;
}
