/* CaraCore-PDV Wiki (v1.0.13) — Unified style
   Goals:
   - Persistent sidebar shell (left)
   - Optional right TOC
   - Breadcrumbs
   - Simple search filter
   - Centralized legacy helpers for older pages (.card/.brand-bg/.callout-*)
*/

:root{
  --bg: #f8fafc;               /* slate-50 */
  --panel: #ffffff;
  --border: #e2e8f0;           /* slate-200 */
  --text: #0f172a;             /* slate-900 */
  --muted: #64748b;            /* slate-500 */
  --muted-2: #94a3b8;          /* slate-400 */

  --brand-a: #0b1f3a;
  --brand-b: #111827;
  --brand-c: #0f766e;

  --shadow-sm: 0 1px 2px rgba(2, 6, 23, 0.06);
  --shadow-md: 0 10px 25px rgba(2, 6, 23, 0.10);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;

  --sidebar-w: 292px;
  --toc-w: 300px;
  --topbar-h: 56px;

  --blue: #2563eb;
  --blue-50: #eff6ff;
  --amber: #d97706;
  --amber-50: #fffbeb;
  --green: #059669;
  --green-50: #ecfdf5;
}

html { scroll-behavior: smooth; }
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* -------------------------------------------------------------------------- */
/* Legacy helpers (keep old pages working while we refactor)                  */
/* -------------------------------------------------------------------------- */
.brand-bg { background: linear-gradient(135deg, var(--brand-a) 0%, var(--brand-b) 55%, var(--brand-c) 100%); }
.card { background: white; border: 1px solid #e5e7eb; border-radius: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.mono, .kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.callout-info { background: #e0f2fe; border-left: 4px solid #0284c7; }
.callout-warn { background: #fef3c7; border-left: 4px solid #f59e0b; }
.callout-ok { background: #d1fae5; border-left: 4px solid #10b981; }
.step-active { border-color: #10b981 !important; box-shadow: 0 0 0 3px rgba(16,185,129,0.18); }

/* -------------------------------------------------------------------------- */
/* Layout shell                                                               */
/* -------------------------------------------------------------------------- */
.wiki-shell { display: flex; min-height: 100vh; }
.wiki-sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.wiki-content { flex: 1; min-width: 0; }

/* Mobile: sidebar becomes drawer */
@media (max-width: 1024px) {
  .wiki-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transform: translateX(-102%);
    transition: transform 160ms ease;
    z-index: 60;
    box-shadow: var(--shadow-md);
  }
  .wiki-shell.is-sidebar-open .wiki-sidebar { transform: translateX(0); }
  .wiki-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    z-index: 50;
  }
  .wiki-shell.is-sidebar-open .wiki-backdrop { display: block; }
}

.wiki-topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
}
.wiki-topbar .wiki-topbar-title { display:flex; align-items:center; gap:10px; min-width:0; }
.wiki-topbar .wiki-topbar-title .wiki-title { font-weight: 800; font-size: 14px; color: var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.wiki-topbar .wiki-topbar-title .wiki-sub { font-size: 12px; color: var(--muted); }
.wiki-iconbox {
  height: 36px; width: 36px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-a) 0%, var(--brand-b) 55%, var(--brand-c) 100%);
  display:flex; align-items:center; justify-content:center;
  color: white;
  flex: 0 0 auto;
}
.wiki-btn {
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
}
.wiki-btn:hover { background: #f8fafc; }
.wiki-btn-primary {
  background: #0f172a;
  color: white;
  border-color: #0f172a;
}
.wiki-btn-primary:hover { background: #111827; }

/* Sidebar content */
.wiki-side-inner { padding: 16px; display:flex; flex-direction:column; gap:14px; }
.wiki-side-brand { display:flex; align-items:center; gap:10px; }
.wiki-side-brand .name { font-weight: 900; font-size: 14px; }
.wiki-side-brand .ver { font-size: 12px; color: var(--muted); }
.wiki-side-section-title { font-size: 11px; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }
.wiki-search {
  display:flex; align-items:center; gap:10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  background: #f8fafc;
}
.wiki-search input {
  border: none; outline: none; background: transparent;
  width: 100%;
  font-size: 14px;
  color: var(--text);
}
.wiki-nav { display:flex; flex-direction:column; gap:6px; }
.wiki-nav a {
  display:flex; align-items:center; gap:10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #0f172a;
  text-decoration:none;
  border: 1px solid transparent;
}
.wiki-nav a .label { font-weight: 800; font-size: 13px; }
.wiki-nav a .hint { font-size: 12px; color: var(--muted); }
.wiki-nav a:hover { background: #f1f5f9; border-color: #e2e8f0; }
.wiki-nav a.is-active { background: #0f172a; color: white; border-color: #0f172a; }
.wiki-nav a.is-active .hint { color: rgba(255,255,255,0.75); }
.wiki-nav a .pill {
  margin-left: auto;
  font-size: 11px;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: white;
}
.wiki-nav a.is-active .pill { border-color: rgba(255,255,255,0.35); color: rgba(255,255,255,0.85); background: transparent; }

/* Color chips */
.chip { display:inline-flex; align-items:center; gap:8px; border-radius: 999px; padding: 6px 10px; font-weight: 900; font-size: 12px; border: 1px solid var(--border); }
.chip-blue { background: var(--blue-50); color: #1d4ed8; border-color: #bfdbfe; }
.chip-amber { background: var(--amber-50); color: #92400e; border-color: #fde68a; }
.chip-green { background: var(--green-50); color: #065f46; border-color: #a7f3d0; }

/* Main grid with optional TOC */
.wiki-container { max-width: 1200px; margin: 0 auto; padding: 18px 18px 36px; }
.wiki-grid { display: grid; grid-template-columns: 1fr var(--toc-w); gap: 18px; align-items: start; }
.wiki-grid.no-toc { grid-template-columns: 1fr; }
@media (max-width: 1200px) { .wiki-container { max-width: 1040px; } }
@media (max-width: 1024px) { .wiki-grid { grid-template-columns: 1fr; } }

/* Breadcrumbs */
.wiki-breadcrumbs {
  display:flex; flex-wrap:wrap; align-items:center; gap:8px;
  font-size: 12px;
  color: var(--muted);
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.8);
  border-radius: 14px;
}
.wiki-breadcrumbs a { color: var(--muted); text-decoration: none; font-weight: 800; }
.wiki-breadcrumbs a:hover { text-decoration: underline; }
.wiki-breadcrumbs .sep { color: var(--muted-2); }
.wiki-breadcrumbs .current { color: var(--text); font-weight: 900; }

/* Cards */
.wiki-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.wiki-card:hover { box-shadow: var(--shadow-md); }
.wiki-card-body { padding: 18px; }
.wiki-hero {
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--brand-a) 0%, var(--brand-b) 55%, var(--brand-c) 100%);
  color: white;
  border: 1px solid rgba(255,255,255,0.10);
  padding: 22px;
}
.wiki-hero h1 { font-weight: 900; letter-spacing: -0.02em; }
.wiki-hero p { color: rgba(255,255,255,0.90); }

/* Profile cards (Index) */
.profile-card { border-radius: var(--radius-lg); border: 1px solid var(--border); background: white; padding: 18px; text-decoration:none; color: inherit; display:block; }
.profile-card:hover { box-shadow: var(--shadow-md); }
.profile-card .row { display:flex; align-items:flex-start; gap:12px; }
.profile-card .icon {
  height: 44px; width: 44px; border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  border: 1px solid var(--border);
  flex:0 0 auto;
}
.profile-card .title { font-weight: 900; font-size: 16px; }
.profile-card .desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.profile-card ul { margin-top: 12px; font-size: 13px; color: #334155; display:flex; flex-direction:column; gap:8px; padding-left: 0; list-style: none; }
.profile-blue .icon { background: var(--blue-50); border-color: #bfdbfe; color: #1d4ed8; }
.profile-amber .icon { background: var(--amber-50); border-color: #fde68a; color: #92400e; }
.profile-green .icon { background: var(--green-50); border-color: #a7f3d0; color: #065f46; }
.profile-indigo .icon { background: #e0e7ff; border-color: #c7d2fe; color: #4338ca; }

/* TOC */
.wiki-toc {
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 14px;
}
@media (max-width: 1024px) { .wiki-toc { position: relative; top: 0; } }
.wiki-toc-title { font-weight: 900; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.wiki-toc a,
.wiki-toc .wiki-toc-link {
  display:block;
  padding: 8px 10px;
  border-radius: 12px;
  text-decoration:none;
  color: #0f172a;
  font-weight: 800;
  font-size: 13px;
  border: 1px solid transparent;
}
.wiki-toc a:hover { background: #f1f5f9; border-color: #e2e8f0; }
.wiki-toc a.is-active { background: #0f172a; color: white; border-color: #0f172a; }
.wiki-toc .sub { font-weight: 700; color: var(--muted); font-size: 12px; }

/* Content typography helpers */
.wiki-section { scroll-margin-top: calc(var(--topbar-h) + 14px); }
.wiki-main-content section[id] { scroll-margin-top: calc(var(--topbar-h) + 14px); }
.wiki-h2 { font-size: 22px; font-weight: 900; letter-spacing: -0.01em; }
.wiki-lead { color: var(--muted); margin-top: 6px; }

/* Footer */
.wiki-footer { padding: 26px 18px; color: var(--muted); font-size: 13px; }
.wiki-footer a { color: #0f172a; font-weight: 900; text-decoration: none; }
.wiki-footer a:hover { text-decoration: underline; }

/* Small utilities */
.hidden { display: none !important; }

