/* Molecule Site — shared theme */
:root {
  --bg: #0b0d12;
  --panel: #141821;
  --panel-2: #1b2030;
  --border: #2a3142;
  --text: #f5f7fa;
  --muted: #8b93a7;
  --accent: #5eead4;
  --warn: #fbbf24;
  --nav-h: 60px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top nav ---------- */
header.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; background: rgba(11,13,18,0.94);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(8px);
}
header.nav .brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
header.nav .brand a { color: var(--text); }
header.nav .tabs { display: flex; gap: 6px; }
header.nav .tabs a {
  padding: 7px 14px; border-radius: 6px; font-size: 13px;
  color: var(--muted); border: 1px solid var(--border);
}
header.nav .tabs a.active, header.nav .tabs a:hover {
  background: var(--accent); color: #0b0d12; border-color: var(--accent);
  font-weight: 600; text-decoration: none;
}
header.nav .search-wrap { margin-left: auto; position: relative; }
header.nav input.search {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 12px; font-size: 13px; width: 280px;
  font-family: inherit;
}
header.nav input.search:focus { outline: 1px solid var(--accent); }

/* Molecules dropdown (dynamic submenu) */
.menu-mol { position: relative; }
.menu-mol > button {
  padding: 7px 14px; border-radius: 6px; font-size: 13px;
  color: var(--muted); border: 1px solid var(--border);
  background: transparent; cursor: pointer; font-family: inherit;
}
.menu-mol > button:hover { background: var(--panel-2); color: var(--text); }
.menu-mol .dropdown {
  display: none; position: absolute; top: 110%; left: 0;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px; width: 340px; max-height: 70vh;
  overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.menu-mol.open .dropdown { display: block; }
.menu-mol .dropdown input.filter {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 7px 10px; font-size: 12px; margin-bottom: 8px; font-family: inherit;
}
.menu-mol .dropdown .cat-group { margin-bottom: 6px; }
.menu-mol .dropdown .cat-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 6px 8px 2px;
}
.menu-mol .dropdown a.mol {
  display: block; padding: 6px 10px; border-radius: 4px;
  font-size: 13px; color: var(--text);
}
.menu-mol .dropdown a.mol:hover { background: var(--panel-2); text-decoration: none; }
.menu-mol .dropdown .none { color: var(--muted); font-size: 12px; padding: 8px; }

/* ---------- Blocks grid ---------- */
.container { max-width: 1320px; margin: 0 auto; padding: 24px 20px 80px; }
.page-intro { color: var(--muted); font-size: 14px; margin: 6px 0 20px; line-height: 1.5; }
.page-intro strong { color: var(--text); }
.count-line { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.count-line strong { color: var(--accent); }

.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px)  { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; display: flex;
  flex-direction: column; gap: 10px; transition: border-color .12s, transform .12s;
}
.card:hover { border-color: #3a4258; transform: translateY(-2px); }
.card .ctop { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card .name { font-size: 17px; font-weight: 700; line-height: 1.25; }
.card .name a { color: var(--text); }
.card .branded { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 2px; }
.card .pill {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  font-weight: 600; color: #0b0d12; white-space: nowrap;
}
.card .pill.status {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); font-weight: 500;
}
.card .field { font-size: 13px; line-height: 1.45; }
.card .field .lbl {
  color: var(--muted); font-size: 10px; text-transform: uppercase;
  letter-spacing: .05em; display: block; margin-bottom: 2px;
}
.card .benefits { color: #d4d9e5; }
.card .stack { color: var(--accent); font-weight: 500; }
.card .more { margin-top: auto; font-size: 13px; }

.sentinel { height: 40px; }
.loading { text-align: center; color: var(--muted); padding: 24px; font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }

/* ---------- Mindmap ---------- */
#map-wrap { position: absolute; inset: var(--nav-h) 0 0 0; overflow: hidden; }
#graph { position: absolute; inset: 0; }
#graph svg { width: 100%; height: 100%; display: block; }
.node circle { cursor: pointer; }
.node text {
  fill: #fff; font-size: 12px; font-weight: 500;
  paint-order: stroke; stroke: var(--bg); stroke-width: 4px;
  stroke-linejoin: round; pointer-events: all; cursor: pointer; user-select: none;
}
.node.root text { font-size: 16px; font-weight: 700; }
.node.category text { font-size: 13px; font-weight: 700; }
.link { stroke: #38415a; stroke-opacity: .55; }
#legend {
  position: absolute; top: 14px; left: 14px; z-index: 5;
  background: rgba(20,24,33,.92); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; max-width: 240px; backdrop-filter: blur(8px);
}
#legend h3 { margin: 0 0 8px; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; }
#legend .row { display: flex; align-items: center; gap: 8px; padding: 3px 0;
  cursor: pointer; user-select: none; font-size: 13px; }
#legend .row.muted { opacity: .35; }
#legend .sw { width: 12px; height: 12px; border-radius: 3px; }
#legend .lab { flex: 1; }
#legend .cnt { color: var(--muted); font-size: 11px; }

#tip {
  position: fixed; pointer-events: none; opacity: 0; z-index: 200;
  background: rgba(20,24,33,.97); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; max-width: 340px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5); transition: opacity .12s; backdrop-filter: blur(8px);
}
#tip h4 { margin: 4px 0 4px; font-size: 16px; }
#tip .br { color: var(--muted); font-size: 12px; font-style: italic; margin-bottom: 6px; }
#tip .ds { font-size: 12px; color: #c5cdd9; margin-bottom: 6px; }
#tip .sl { color: var(--muted); font-size: 10px; text-transform: uppercase;
  letter-spacing: .06em; margin-top: 8px; }
#tip .sn { font-size: 13px; color: var(--accent); font-weight: 600; }
#tip ul { margin: 4px 0 6px; padding-left: 18px; font-size: 12px; }
#tip .pill { display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* ---------- Molecule page ---------- */
.mol-page { max-width: 900px; margin: 0 auto; padding: 28px 20px 80px; }
.mol-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.mol-head h1 { margin: 0; font-size: 30px; }
.mol-head .branded { color: var(--muted); font-style: italic; font-size: 15px; margin-top: 4px; }
.mol-cat-pill { font-size: 12px; padding: 4px 12px; border-radius: 999px;
  font-weight: 600; color: #0b0d12; }
.sec { margin-top: 26px; }
.sec h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 0 0 8px; border-bottom: 1px solid var(--border);
  padding-bottom: 6px; }
.sec .body { font-size: 15px; line-height: 1.6; color: #d8dde7; }
.sec ul { margin: 6px 0; padding-left: 20px; line-height: 1.7; }
.sec .outcome { color: var(--accent); font-style: italic; margin-top: 8px; }
.backlink { font-size: 13px; color: var(--muted); margin-bottom: 18px; display: inline-block; }

.editable-panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px; margin-top: 14px;
}
.editable-panel textarea {
  width: 100%; min-height: 150px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
  font-size: 14px; font-family: inherit; line-height: 1.5; resize: vertical;
}
.editable-panel textarea:focus { outline: 1px solid var(--accent); }
.save-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: 6px; font-size: 13px; cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: #232a3e; }
.btn.primary { background: var(--accent); color: #0b0d12; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: #4dd9c2; }
.saved-flag { color: var(--accent); font-size: 12px; opacity: 0; transition: opacity .2s; }
.saved-flag.show { opacity: 1; }

table.dose {
  width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px;
}
table.dose th, table.dose td {
  border: 1px solid var(--border); padding: 8px 10px; text-align: left;
}
table.dose th { color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; font-weight: 600; background: var(--panel-2); }
table.dose td input {
  width: 100%; background: transparent; color: var(--text);
  border: none; font-size: 14px; font-family: inherit;
}
table.dose td input:focus { outline: 1px solid var(--accent); border-radius: 3px; }
table.dose td.num { width: 150px; }
table.dose td.del { width: 40px; text-align: center; }
table.dose td.del button {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: 16px; line-height: 1;
}
table.dose td.del button:hover { color: #ff6b6b; }
table.dose tfoot td { font-weight: 700; background: var(--panel-2); }
table.dose tfoot .total-val { color: var(--accent); }
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; line-height: 1.5; }

.io-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--border); }
.io-row .lbl { color: var(--muted); font-size: 12px; }
footer.site { text-align: center; color: var(--muted); font-size: 12px;
  padding: 30px 20px; border-top: 1px solid var(--border); margin-top: 40px; }
