/* AgentMoney docs — matches dashboard index.html design tokens */
:root {
  --bg-dark: #0d0d0f;
  --bg-card: linear-gradient(145deg, #1a1a1e 0%, #25252a 50%, #1e1e22 100%);
  --metal-light: #c8c8cc;
  --metal-mid: #9a9aa0;
  --metal-dark: #6e6e74;
  --accent: #e8e8ec;
  --text: #e0e0e4;
  --text-muted: #888890;
  --border: rgba(200, 200, 204, 0.12);
  --sidebar-w: min(280px, 88vw);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Roboto', sans-serif;
  background: linear-gradient(165deg, #0a0a0c 0%, #0d0d0f 40%, #121215 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* --- mobile toggle button (hidden on desktop) --- */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--metal-mid);
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--border);
    max-height: none;
    padding: 0.65rem 0.85rem 0.75rem;
    gap: 0;
    overflow: visible;
  }
  .sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .sidebar-toggle {
    display: flex;
  }
  .sidebar-top .brand {
    font-size: 0.78rem;
    padding: 0.2rem 0.1rem;
  }
  .brand-sub {
    font-size: 0.58rem;
    margin-top: 0.1rem;
  }
  /* collapsible parts — hidden by default on mobile */
  .sidebar-collapsible {
    display: none;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 0.55rem;
  }
  .sidebar-collapsible.open {
    display: flex;
  }
  .search-input {
    padding: 0.45rem 0.55rem;
    font-size: 0.82rem;
  }
  .sidebar-inner {
    flex: 0 1 auto;
    max-height: min(50vh, 320px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 0.35rem;
    margin-top: 0.15rem;
  }
  .nav-label {
    margin: 0.15rem 0 0.25rem;
  }
  .nav a {
    padding: 0.38rem 0.45rem;
    font-size: 0.78rem;
  }
  /* prevent content from sliding under the sticky sidebar */
  .main-column {
    position: relative;
    z-index: 0;
  }
}

.sidebar {
  background: rgba(10, 10, 12, 0.92);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 100vh;
  overflow: hidden;
}

.sidebar-inner {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 0.25rem;
}

.brand {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  padding: 0.35rem 0.15rem;
}

.brand:hover {
  color: var(--metal-light);
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--metal-mid);
  text-transform: uppercase;
  margin-top: 0.2rem;
}

/* desktop: collapsible wrapper always visible */
.sidebar-collapsible {
  display: contents;
}

.search-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(30, 30, 34, 0.9);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
}

.search-input::placeholder {
  color: var(--metal-dark);
}

.search-input:focus {
  outline: none;
  border-color: rgba(200, 200, 204, 0.25);
  box-shadow: 0 0 0 2px rgba(232, 232, 236, 0.06);
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: min(320px, 50vh);
  overflow-y: auto;
  background: linear-gradient(145deg, #1a1a1e 0%, #222226 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  z-index: 50;
  display: none;
}

.search-results.open {
  display: block;
}

.search-hit {
  display: block;
  padding: 0.55rem 0.65rem;
  color: var(--metal-light);
  text-decoration: none;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.search-hit:last-child {
  border-bottom: none;
}

.search-hit:hover,
.search-hit:focus {
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent);
}

.search-hit span {
  display: block;
  color: var(--metal-mid);
  font-size: 0.7rem;
  margin-top: 0.2rem;
  line-height: 1.35;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--metal-dark);
  margin: 0.5rem 0 0.35rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav a {
  display: block;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  color: var(--metal-mid);
  text-decoration: none;
  font-size: 0.82rem;
  line-height: 1.3;
}

.nav a:hover {
  color: var(--metal-light);
  background: rgba(255, 255, 255, 0.04);
}

.nav a.active {
  color: var(--accent);
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 255, 255, 0.06) 0%, transparent 60%),
    rgba(40, 40, 44, 0.6);
  border: 1px solid var(--border);
}

.main-column {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem clamp(1rem, 4vw, 2.5rem) 3.5rem;
}

.main-inner {
  width: 100%;
  max-width: 900px;
  flex: 1;
}

.doc-pager {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
  margin: 0 0 1.15rem;
  flex-wrap: wrap;
}

.doc-pager-link {
  font-size: 0.8rem;
  color: var(--metal-mid);
  text-decoration: none;
  max-width: min(48%, 20rem);
  line-height: 1.35;
}

.doc-pager-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.doc-pager-next {
  text-align: right;
  margin-left: auto;
}

.doc-pager-muted {
  display: inline-block;
  min-height: 1.2em;
  flex: 0 0 auto;
  visibility: hidden;
  width: 0;
  overflow: hidden;
}

.doc {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 255, 255, 0.04) 0%, transparent 60%),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 2rem 2.25rem;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

.doc h1 {
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 1rem;
  line-height: 1.25;
}

.doc h2 {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--metal-light);
  margin: 1.75rem 0 0.65rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.doc h3 {
  font-weight: 500;
  font-size: 0.98rem;
  color: var(--metal-light);
  margin: 1.35rem 0 0.45rem;
}

.doc h4 {
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--metal-mid);
  margin: 1rem 0 0.35rem;
}

.doc p {
  margin: 0.65rem 0;
  color: var(--text);
}

.doc a {
  color: var(--metal-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.doc a:hover {
  color: var(--accent);
}

.doc ul,
.doc ol {
  margin: 0.6rem 0 0.6rem 1.25rem;
  color: var(--text);
}

.doc li {
  margin: 0.3rem 0;
}

.doc code {
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, monospace;
  font-size: 0.84em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.12em 0.35em;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.doc pre {
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  background: #0a0a0c;
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: 0.78rem;
  line-height: 1.45;
}

.doc pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

.doc blockquote {
  margin: 1rem 0;
  padding: 0.65rem 1rem;
  border-left: 3px solid rgba(200, 200, 204, 0.25);
  color: var(--metal-mid);
  font-size: 0.92rem;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 1rem 0;
}

.doc th,
.doc td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

.doc th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--metal-light);
  font-weight: 500;
}

.doc hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 1.5rem 0;
}

.site-footer {
  margin-top: 2.5rem;
  padding: 1.25rem 0 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  color: var(--metal-dark);
  text-align: center;
}

.site-footer a {
  color: var(--metal-mid);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--metal-light);
}
