/**
 * IM Planning Admin — shared docs theme
 * Tokens align with howtodataclean.html + julia-batoro-securite blueprint (light editorial).
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #ffffff;
  --bg-soft:  #f9fafb;
  --bg-code:  #f3f4f6;
  --border:   #e5e7eb;
  --border-md:#d1d5db;
  --text:     #111827;
  --text-2:   #374151;
  --text-3:   #6b7280;
  --text-4:   #9ca3af;
  --accent:   #111827;
  --accent-h: #1f2937;
  --green:    #16a34a;
  --green-bg: #f0fdf4;
  --green-bd: #bbf7d0;
  --orange:   #ea580c;
  --orange-bg:#fff7ed;
  --blue:     #2563eb;
  --blue-bg:  #eff6ff;
  --red:      #dc2626;
  --radius:   8px;
  --radius-lg:12px;
  --mono:     'JetBrains Mono', ui-monospace, monospace;
  --sans:     'Inter', ui-sans-serif, system-ui, sans-serif;
}

html { scroll-behavior: smooth; font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.6; -webkit-font-smoothing: antialiased; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 3px; }

/* ---- NAVBAR ---- */
nav.top-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 24px;
  height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.nav-brand {
  display: flex; align-items: center; gap: 8px; text-decoration: none;
}
.nav-brand-tag {
  font-family: var(--mono); font-size: 0.68rem; font-weight: 500;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em;
}
.nav-brand-sep { color: var(--border-md); }
.nav-brand-name { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.nav-links { display: flex; gap: 24px; }
.nav-links a {
  font-size: 0.82rem; color: var(--text-3); text-decoration: none;
  transition: color 120ms;
}
.nav-links a:hover { color: var(--text); }
.nav-cta {
  font-size: 0.8rem; font-weight: 600; color: #fff;
  background: var(--accent); border: none; border-radius: var(--radius);
  padding: 7px 16px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; transition: background 120ms;
}
.nav-cta:hover { background: var(--accent-h); }

/* ---- LAYOUT ---- */
.page-wrap { max-width: 1100px; margin: 0 auto; padding: 80px 24px 80px; }
.two-col {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 56px;
  align-items: start;
}

/* ---- TOC ---- */
.toc-wrap { position: sticky; top: 76px; }
.toc-heading {
  font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-4); margin-bottom: 10px; padding-left: 8px;
}
.toc-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 8px; border-radius: 6px; border-left: 2px solid transparent;
  text-decoration: none; transition: all 120ms; cursor: pointer;
}
.toc-item:hover { background: var(--bg-soft); }
.toc-item.active {
  border-left-color: var(--accent); background: var(--bg-soft);
}
.toc-item.active .toc-num,
.toc-item.active .toc-text { color: var(--text); }
.toc-num { font-family: var(--mono); font-size: 0.68rem; color: var(--text-4); min-width: 20px; }
.toc-text { font-size: 0.78rem; color: var(--text-3); line-height: 1.4; }
.toc-meta {
  margin-top: 24px; padding: 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-soft);
}
.toc-meta-label { font-family: var(--mono); font-size: 0.63rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-4); margin-bottom: 4px; }
.toc-meta-val { font-size: 0.73rem; color: var(--text-3); word-break: break-all; line-height: 1.5; }

/* ---- HERO ---- */
.hero { margin-bottom: 56px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-md); border-radius: 999px;
  padding: 4px 12px; margin-bottom: 20px;
}
.hero-badge-dot { width: 6px; height: 6px; background: var(--green); border-radius: 50%; }
.hero-badge-text { font-size: 0.72rem; font-weight: 500; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; }
.hero h1 {
  font-size: 2.6rem; font-weight: 700; color: var(--text);
  line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 16px;
}
.hero-subtitle {
  font-size: 1rem; color: var(--text-3); line-height: 1.75;
  max-width: 560px; margin-bottom: 28px;
}
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 36px; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff;
  font-size: 0.85rem; font-weight: 600;
  padding: 10px 18px; border-radius: var(--radius);
  text-decoration: none; border: none; cursor: pointer;
  transition: background 120ms;
}
.btn-primary:hover { background: var(--accent-h); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: var(--text-2);
  font-size: 0.85rem; font-weight: 500;
  padding: 10px 18px; border-radius: var(--radius);
  text-decoration: none; border: 1px solid var(--border-md); cursor: pointer;
  transition: all 120ms;
}
.btn-secondary:hover { border-color: var(--border-md); background: var(--bg-soft); }

/* Author row */
.author-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 28px; }
.author-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  border: 1px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--text-3);
}
.author-text { font-size: 0.84rem; color: var(--text-3); line-height: 1.55; }
.author-text strong { color: var(--text-2); }

/* Source cards grid */
.source-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.source-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; background: var(--bg);
  transition: border-color 150ms, box-shadow 150ms;
}
.source-card:hover { border-color: var(--border-md); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.source-card-title { font-size: 0.82rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.source-card-desc { font-size: 0.74rem; color: var(--text-3); margin-bottom: 10px; line-height: 1.5; }

/* ---- BADGES ---- */
.badge {
  display: inline-block; font-size: 0.62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 4px;
  border: 1px solid;
}
.badge-ref   { color: var(--text-3); border-color: var(--border); background: var(--bg-soft); }
.badge-doc   { color: var(--blue);   border-color: #bfdbfe;       background: var(--blue-bg); }
.badge-lib   { color: #7c3aed;       border-color: #ddd6fe;       background: #f5f3ff; }
.badge-req   { color: var(--green);  border-color: var(--green-bd);background: var(--green-bg); }
.badge-critique { color: var(--red);    border-color: #fecaca; background: #fef2f2; }
.badge-important{ color: var(--orange); border-color: #fed7aa; background: var(--orange-bg); }
.badge-note  { color: var(--blue);   border-color: #bfdbfe;       background: var(--blue-bg); }

/* ---- SECTION ANATOMY ---- */
section { margin-bottom: 0; }
.sec-label {
  font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-4); margin-bottom: 6px;
}
section h2 {
  font-size: 1.5rem; font-weight: 700; color: var(--text);
  letter-spacing: -0.015em; margin-bottom: 12px; line-height: 1.3;
}
section h3 {
  font-size: 0.92rem; font-weight: 600; color: var(--text);
  margin: 24px 0 8px;
}
section p {
  font-size: 0.9rem; color: var(--text-3); line-height: 1.75; margin-bottom: 10px;
}

.sec-divider { border: none; border-top: 1px solid var(--border); margin: 48px 0; }

/* ---- CODE BLOCKS ---- */
.code-wrap {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; margin: 14px 0; background: var(--bg-soft);
}
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.code-label {
  font-family: var(--mono); font-size: 0.68rem; color: var(--text-4);
}
.copy-btn {
  font-family: var(--mono); font-size: 0.68rem; color: var(--text-3);
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 4px; padding: 3px 10px; cursor: pointer; transition: all 120ms;
}
.copy-btn:hover { color: var(--text); border-color: var(--border-md); background: #fff; }
.copy-btn.copied { color: var(--green); border-color: var(--green-bd); background: var(--green-bg); }
pre {
  overflow-x: auto; padding: 14px 16px; margin: 0;
  background: var(--bg-soft);
}
code {
  font-family: var(--mono); font-size: 0.8rem; line-height: 1.75; color: var(--text-2);
}

/* Syntax */
.kw  { color: #7c3aed; }
.str { color: #16a34a; }
.cm  { color: var(--text-4); font-style: italic; }
.fn  { color: #2563eb; }
.num { color: var(--orange); }
.op  { color: var(--text-3); }

/* Inline code */
.ic {
  font-family: var(--mono); font-size: 0.8em;
  background: var(--bg-code); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; color: var(--text-2);
}

/* ---- TIP / WARN ---- */
.tip {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--green-bd); border-radius: var(--radius);
  background: var(--green-bg); padding: 12px 14px; margin: 14px 0;
}
.tip-icon { font-size: 0.85rem; flex-shrink: 0; margin-top: 1px; }
.tip p { font-size: 0.84rem; color: #166534; margin: 0; }
.warn-box {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid #fed7aa; border-radius: var(--radius);
  background: var(--orange-bg); padding: 12px 14px; margin: 14px 0;
}
.warn-box p { font-size: 0.84rem; color: #9a3412; margin: 0; }

/* ---- CHECKLIST ---- */
.check-item {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
.check-item:last-child { border-bottom: none; }
.check-box {
  width: 17px; height: 17px; min-width: 17px; margin-top: 2px;
  border-radius: 4px; border: 1.5px solid var(--border-md);
  display: flex; align-items: center; justify-content: center;
  background: #fff; transition: all 180ms;
}
.check-item.done .check-box { border-color: var(--green); background: var(--green-bg); }
.check-item.done .check-label { opacity: 0.45; text-decoration: line-through; }
.check-label { font-size: 0.86rem; color: var(--text-2); flex: 1; line-height: 1.5; }
.check-svg { display: none; }
.check-item.done .check-svg { display: block; }

/* Progress */
.progress-bar-bg { background: var(--border); border-radius: 99px; height: 3px; overflow: hidden; }
.progress-bar-fill { background: var(--green); height: 100%; border-radius: 99px; transition: width 280ms ease; }

/* Category label */
.cat-label {
  font-family: var(--mono); font-size: 0.65rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-4); margin: 20px 0 6px;
}

/* ---- MODULE CARDS ---- */
.module-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg); overflow: hidden;
  transition: box-shadow 150ms, border-color 150ms;
}
.module-card:hover { border-color: var(--border-md); box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.module-card-header { padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.module-card-body { padding: 14px 16px; }
.module-num { font-family: var(--mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-4); margin-bottom: 2px; }
.module-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.module-what { font-size: 0.82rem; color: var(--text-3); margin-bottom: 10px; line-height: 1.6; }
.module-how {
  font-size: 0.82rem; color: var(--text-2); line-height: 1.6;
  border-left: 2px solid var(--border-md); padding-left: 10px;
}

/* ---- STATS TABLE ---- */
.stats-wrap { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin: 18px 0; }
.stats-head { padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.stats-head-label { font-family: var(--mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-4); }
.stats-body { padding: 0 18px; }
.stats-row { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--border); }
.stats-row:last-child { border-bottom: none; }
.stats-label { font-size: 0.84rem; color: var(--text-3); }
.stats-value { font-family: var(--mono); font-size: 0.8rem; color: var(--text); }
.stats-value.green { color: var(--green); }

/* ---- FOOTER ---- */
footer { border-top: 1px solid var(--border); padding: 32px 24px; text-align: center; }
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-name { font-size: 0.82rem; font-weight: 600; color: var(--text-3); margin-bottom: 4px; }
.footer-tag { font-size: 0.75rem; color: var(--text-4); }

/* ---- FOLDER TREE ---- */
.folder-tree { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.folder-tree pre { background: var(--bg-soft); }

/* Responsive */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .toc-wrap { display: none; }
  .source-grid { grid-template-columns: repeat(2,1fr); }
  .hero h1 { font-size: 2rem; }
}
@media (max-width: 560px) {
  .source-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}

/* ---- LOGIC / PIPELINE (readability) ---- */
.logic-pipeline {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-2);
  margin: 0;
}
.flow-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  padding: 12px 14px;
  margin: 10px 0;
  background: var(--bg);
}
.flow-card h4 { font-size: 0.8rem; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.flow-card p { font-size: 0.84rem; margin: 0; }

/* ---- Site shell & hub (index) ---- */
.nav-spacer { height: 56px; }

.hub-page .page-wrap { padding-top: 32px; }
.hub-hero { margin-bottom: 40px; }
.hub-hero h1 {
  font-size: 2.4rem; font-weight: 700; color: var(--text);
  letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 12px;
}
.hub-hero-lead {
  font-size: 1rem; color: var(--text-3); line-height: 1.75; max-width: 640px; margin-bottom: 8px;
}
.hub-meta { font-size: 0.82rem; color: var(--text-4); margin-bottom: 28px; }

.hero-crosslink {
  margin-top: -12px;
  font-size: 0.92rem !important;
  max-width: 560px;
}
.hero-crosslink a { color: var(--blue); font-weight: 600; text-decoration: none; }
.hero-crosslink a:hover { text-decoration: underline; }

.hub-section-label {
  font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-4); margin: 40px 0 14px;
}
.hub-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px;
}
.hub-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 18px 16px; background: var(--bg);
  transition: border-color 150ms, box-shadow 150ms;
}
.hub-card:hover { border-color: var(--border-md); box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.hub-card h2 {
  font-size: 0.95rem; font-weight: 600; color: var(--text); margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.hub-card a.doc-link {
  display: block; font-size: 0.84rem; color: var(--text-2); text-decoration: none;
  padding: 8px 10px; margin: 0 -10px; border-radius: 6px;
  transition: background 120ms;
}
.hub-card a.doc-link:hover { background: var(--bg-soft); color: var(--text); }
.hub-card p.hub-note {
  font-size: 0.8rem; color: var(--text-3); line-height: 1.55; margin: 0;
}
.hub-pill {
  display: inline-block; font-size: 0.62rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 2px 8px; border-radius: 4px; margin-left: 8px;
  vertical-align: middle;
}
.hub-pill-new { color: var(--green); border: 1px solid var(--green-bd); background: var(--green-bg); }

/* ---- Logic section stepper ---- */
.logic-stepper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 18px 0 22px;
}
.logic-step {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 16px; background: var(--bg-soft);
}
.logic-step-num {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 600;
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logic-step-body strong {
  display: block; font-size: 0.88rem; font-weight: 600; color: var(--text); margin-bottom: 4px;
}
.logic-step-body p { font-size: 0.82rem; color: var(--text-3); margin: 0; line-height: 1.55; }

.flow-ascii { font-size: 0.72rem; line-height: 1.45; color: var(--text-2); }

/* ---- Legacy pages: align with light editorial shell ---- */
body.docs-shell {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0 0 48px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.docs-shell .header,
body.docs-shell > .header:first-of-type {
  background: var(--bg-soft) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none !important;
  position: relative;
}
.docs-shell .header h1,
.docs-shell .header h2,
.docs-shell .header p { color: var(--text) !important; }
.docs-shell .back-button {
  color: var(--text-2) !important;
  background: var(--bg) !important;
  border: 1px solid var(--border-md) !important;
}
.docs-shell .back-button:hover {
  background: var(--bg-soft) !important;
  border-color: var(--text-4) !important;
  transform: none;
}
.docs-shell .project-info,
.docs-shell [class*="container"]:not(.nav-inner) {
  border: 1px solid var(--border);
}
.docs-shell .workplan-table th {
  background: var(--accent) !important;
  color: #fff !important;
}
.docs-shell .workplan-table td { border-color: var(--border); color: var(--text-2); }
.docs-shell .task-number { color: var(--text-3) !important; }
.docs-shell .task-name { color: var(--text) !important; }
.docs-shell .tech-req { background: var(--blue-bg) !important; }
.docs-shell .outcome { background: var(--green-bg) !important; }
.docs-shell .report { background: var(--orange-bg) !important; }

.docs-shell h1, .docs-shell h2, .docs-shell h3 { color: var(--text); font-family: var(--sans); }
.docs-shell a { color: var(--blue); }
.docs-shell .footer, .docs-shell footer {
  border-top: 1px solid var(--border);
  color: var(--text-4);
  font-size: 0.82rem;
  margin-top: 32px;
  padding-top: 24px;
  text-align: center;
}

/* Center legacy page content under the shared nav */
body.docs-shell > *:not(nav):not(.nav-spacer) {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
}

.docs-content-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}
