/* ============================================================
   FORGE left rail — DanielLab-style flow & placement, FORGE skin.
   Loaded ONLY on logged-in dashboard pages that mount
   <aside id="forge-nav" class="forge-rail">. Mirrors DL's left-nav
   structure + responsive collapse; keeps FORGE's dark identity
   (no color/font changes, no shadows — forge stays flat).
   ============================================================ */

.forge-rail {
  position: fixed;
  top: 0; left: 0;
  width: 232px;
  height: 100vh;
  background: var(--bg-surface, #0E1825);
  border-right: 1px solid var(--border, #1E2F45);
  display: flex;
  flex-direction: column;
  padding: 20px 0 14px;
  z-index: 50;
  overflow-y: auto;
}

.forge-rail-brand-wrap {
  padding: 0 18px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border, #1E2F45);
}
.forge-rail-brand {
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 17px; font-weight: 600;
  color: var(--text, #ECE8E1);
  text-decoration: none; letter-spacing: -0.01em;
}
.forge-rail-dot { color: var(--gold, #C9A55A); }

.forge-rail-nav {
  flex: 1;
  display: flex; flex-direction: column; gap: 2px;
  padding: 4px 12px;
}
.forge-rail-heading {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--text-dim, #4A6080);
  padding: 4px 14px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border, #1E2F45);
}
.forge-rail-link {
  position: relative;
  display: flex; align-items: center;
  font-family: var(--font-body, 'Figtree', system-ui, sans-serif);
  font-size: 14px; font-weight: 500;
  color: var(--text-muted, #7A8FA8);
  padding: 10px 14px;
  border-radius: 7px;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.forge-rail-link:hover {
  color: var(--text, #ECE8E1);
  background: var(--bg-elevated, #162236);
}
.forge-rail-link.is-current {
  color: var(--gold, #C9A55A);
  background: rgba(122,21,37, 0.10);
  font-weight: 600;
}
.forge-rail-link.is-current::before {
  content: '';
  position: absolute; left: 0; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--gold, #C9A55A);
}

/* Four-place rail: primaries are the places, children sit indented under them. */
.forge-rail-link--primary {
  color: var(--text, #ECE8E1);
  font-weight: 600;
  font-size: 14.5px;
}
.forge-rail-link--child {
  padding: 7px 14px 7px 28px;
  font-size: 13px;
}

.forge-rail-footer {
  padding: 14px 12px 0;
  margin-top: 8px;
  border-top: 1px solid var(--border, #1E2F45);
  display: flex; flex-direction: column; gap: 8px;
}
.forge-account-wrap { position: relative; }
.forge-rail-action {
  font-family: var(--font-body, 'Figtree', system-ui, sans-serif);
  font-size: 12px; font-weight: 500;
  color: var(--text-muted, #7A8FA8);
  background: none;
  border: 1px solid var(--border, #1E2F45);
  border-radius: 6px;
  padding: 8px 12px;
  text-align: left; width: 100%;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.forge-rail-action:hover {
  color: var(--text, #ECE8E1);
  border-color: var(--text-muted, #7A8FA8);
}

/* Account dropdown opens upward from the footer */
.forge-account-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-card, #111D2E);
  border: 1px solid var(--border, #1E2F45);
  border-radius: 8px;
  padding: 12px;
  z-index: 60;
}

/* Shift page content clear of the fixed rail */
body { margin-left: 232px; }

/* ── Responsive: collapse to a top bar (DL behavior) ─────────────── */
@media (max-width: 1024px) {
  body { margin-left: 0; }
  .forge-rail {
    position: sticky; top: 0; left: 0;
    width: 100%; height: auto;
    flex-direction: row; align-items: center;
    padding: 8px 12px;
    border-right: none; border-bottom: 1px solid var(--border, #1E2F45);
    overflow: visible;
  }
  .forge-rail-brand-wrap {
    padding: 0 12px 0 4px; margin: 0; border-bottom: none;
    border-right: 1px solid var(--border, #1E2F45);
  }
  .forge-rail-nav { flex-direction: row; gap: 2px; padding: 0 8px; overflow-x: auto; }
  /* No room for a section label in the horizontal top bar — the tool links just
     follow the rest inline; the group heading is a desktop-rail affordance. */
  .forge-rail-heading {
    border-top: none; margin: 0; padding: 8px 6px 8px 10px;
    align-self: center; white-space: nowrap;
    border-left: 1px solid var(--border, #1E2F45);
  }
  .forge-rail-link { padding: 8px 12px; white-space: nowrap; }
  .forge-rail-link.is-current::before { display: none; }
  .forge-rail-link.is-current { background: rgba(122,21,37, 0.12); }
  .forge-rail-footer {
    flex-direction: row; margin: 0; padding: 0 4px 0 8px;
    border-top: none; border-left: 1px solid var(--border, #1E2F45);
  }
  .forge-rail-action { width: auto; }
  .forge-account-dropdown { bottom: auto; top: calc(100% + 8px); left: auto; right: 8px; width: 240px; }
}

@media (max-width: 560px) {
  .forge-rail-brand-wrap { display: none; }
  .forge-rail-link { font-size: 13px; padding: 7px 10px; }
}
