
:root {
  --sidebar-width: 260px;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #273448;
  --border: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent2: #818cf8;
  --green: #4ade80;
  --yellow: #fbbf24;
  --red: #f87171;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SF Mono", "Fira Code", monospace;
  --radius: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: var(--font); display: flex; min-height: 100vh; }

/* Sidebar */
#sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.25s ease;
}
#sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--border);
}
.site-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  letter-spacing: -0.3px;
  text-decoration: none;
}
#sidebar-toggle {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.1rem; cursor: pointer; padding: 4px;
}
#sidebar-search { padding: 10px 12px; }
#search-input {
  width: 100%; padding: 6px 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 0.85rem;
}
#search-input::placeholder { color: var(--text-muted); }
#search-input:focus { outline: none; border-color: var(--accent); }

#nav-list { list-style: none; padding: 4px 0 24px; }
.nav-section > span {
  display: block;
  padding: 10px 14px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.nav-section > ul { list-style: none; }
.nav-section > ul li a {
  display: block;
  padding: 5px 14px 5px 22px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-section > ul li a:hover { color: var(--text); background: var(--surface2); }
.nav-section > ul li.active a {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(56,189,248,0.08);
}

/* Main */
#main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
#topbar {
  position: sticky; top: 0;
  background: rgba(15,23,42,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 10px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  z-index: 50;
}
#mobile-menu-btn {
  display: none;
  background: none; border: none; color: var(--text-muted);
  font-size: 1.1rem; cursor: pointer;
}
.breadcrumb { font-size: 0.82rem; color: var(--text-muted); flex: 1; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .current { color: var(--text); }
.page-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tag {
  padding: 2px 8px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600;
}
.tag-pharma { background: rgba(56,189,248,0.15); color: #38bdf8; }
.tag-device { background: rgba(129,140,248,0.15); color: #818cf8; }
.tag-consultant { background: rgba(74,222,128,0.15); color: #4ade80; }
.badge {
  padding: 2px 8px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; color: #0f172a;
}
.meta-updated { font-size: 0.75rem; color: var(--text-muted); }
.brand-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  white-space: nowrap;
  margin-left: auto;
}

/* Article */
article#content {
  max-width: 860px;
  margin: 0 auto;
  padding: 36px 32px 80px;
  width: 100%;
}
.page-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
  line-height: 1.3;
}
article h1 { display: none; } /* hide duplicate h1 inside content */
article h2 {
  font-size: 1.25rem; font-weight: 700;
  color: var(--text);
  margin: 36px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
article h3 { font-size: 1.05rem; font-weight: 700; color: var(--accent2); margin: 24px 0 8px; }
article h4 { font-size: 0.95rem; font-weight: 600; color: var(--text-muted); margin: 16px 0 6px; }
article p { line-height: 1.75; color: var(--text); margin-bottom: 12px; }
article ul, article ol { padding-left: 20px; margin-bottom: 12px; }
article li { line-height: 1.7; margin-bottom: 3px; }
article strong { color: #f8fafc; }
article em { color: var(--text-muted); }
article code {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px;
  font-family: var(--mono); font-size: 0.85em; color: #7dd3fc;
}
article pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: #94a3b8;
}
article pre code {
  background: none; border: none; padding: 0;
  color: inherit; font-size: inherit;
}
article blockquote {
  border-left: 3px solid var(--accent);
  margin: 16px 0; padding: 10px 16px;
  background: rgba(56,189,248,0.06);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
  font-style: italic;
}
article table {
  width: 100%; border-collapse: collapse;
  margin: 16px 0; font-size: 0.88rem;
}
article th {
  background: var(--surface2);
  padding: 8px 12px; text-align: left;
  font-weight: 600; font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
article td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  vertical-align: top;
  line-height: 1.55;
}
article tr:hover td { background: var(--surface2); }
article hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

/* Wiki links */
a.wiki-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed rgba(56,189,248,0.4);
}
a.wiki-link:hover { border-bottom-color: var(--accent); }
.dead-link { color: var(--red); font-size: 0.85em; opacity: 0.7; }

/* Responsive */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.5); }
  #main { margin-left: 0; }
  #mobile-menu-btn { display: block; }
  article#content { padding: 20px 16px 60px; }
  #topbar { padding: 10px 16px; }
  .page-title { font-size: 1.4rem; }
}

/* Search highlight */
mark { background: rgba(56,189,248,0.25); color: var(--text); border-radius: 2px; padding: 0 2px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
