:root {
  /* Matches the app's vault / ledger palette (see the app's TijoriColors.kt). */
  --gold: #C9A227;
  --gold-light: #E8CE6A;
  --gold-dark: #8A6D12;
  --charcoal: #1E2124;
  --charcoal-light: #2B2F33;
  --brass: #9C7A3C;

  --primary: #A8861A;          /* gold, darkened for text/links on cream (AA contrast) */
  --primary-dark: #8A6D12;
  --primary-light: rgba(201, 162, 39, 0.14);
  --on-primary: #1E2124;       /* gold buttons carry charcoal text, as in the app */
  --btn-bg: #C9A227;
  --btn-bg-hover: #B8931F;

  --success: #2E6B40;
  --warning: #B26A00;
  --danger: #C9302C;

  --bg: #FFFBF5;
  --surface: #FFFFFF;
  --surface-alt: #F5EFE1;
  --text: #1C1B1A;
  --text-muted: #4A4539;
  --border: #E1DBCB;
  --hover: #F5EFE1;

  --shadow: 0 4px 6px -1px rgba(30, 33, 36, 0.06);
  --shadow-lg: 0 20px 25px -5px rgba(30, 33, 36, 0.12);

  --radius: 12px;
  --radius-lg: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #E8CE6A;
    --primary-dark: #F3E5B7;
    --primary-light: rgba(232, 206, 106, 0.12);
    --bg: #1E2124;
    --surface: #2B2F33;
    --surface-alt: #25282B;
    --text: #E6E1D9;
    --text-muted: #B5AE9F;
    --border: #3A3D40;
    --hover: #33373B;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.45);
    --success: #52B788;
    --warning: #E0A040;
    --danger: #FFB4AB;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --primary: #E8CE6A;
  --primary-dark: #F3E5B7;
  --primary-light: rgba(232, 206, 106, 0.12);
  --bg: #1E2124;
  --surface: #2B2F33;
  --surface-alt: #25282B;
  --text: #E6E1D9;
  --text-muted: #B5AE9F;
  --border: #3A3D40;
  --hover: #33373B;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.45);
  --success: #52B788;
  --warning: #E0A040;
  --danger: #FFB4AB;
  color-scheme: dark;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header — charcoal band, like the app's home header */
.header {
  background: rgba(30, 33, 36, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.logo {
  font-size: 24px;
  font-weight: 700;
  color: #FFFFFF;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}

.logo-icon {
  width: 36px;
  height: 36px;
  display: block;
  border-radius: 9px;
}

.nav {
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--gold-light);
}

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  color: #FFFFFF;
  padding: 6px;
  cursor: pointer;
}

.nav-toggle svg { width: 26px; height: 26px; display: block; }

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--on-primary);
}

.btn-primary:hover {
  background: var(--btn-bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(201, 162, 39, 0.35);
}

.btn-secondary {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-secondary:hover {
  background: var(--btn-bg);
  border-color: var(--btn-bg);
  color: var(--on-primary);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
}

/* Footer */
.footer {
  background: var(--charcoal);
  color: rgba(255, 255, 255, 0.7);
  padding: 64px 0 24px;
  margin-top: 80px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 48px;
  margin-bottom: 48px;
}

.footer-section h4 {
  color: var(--gold-light);
  font-size: 16px;
  margin-bottom: 16px;
  font-weight: 600;
}

.footer-link {
  color: rgba(255, 255, 255, 0.7);
  display: block;
  margin-bottom: 12px;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: #FFFFFF;
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 14px;
}

.footer-bottom p {
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 4px;
}

/* Typography */
h1 {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 24px;
}

h2 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 20px;
}

h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

p {
  margin-bottom: 16px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: all 0.3s;
}

.card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}

/* ── Content pages (docs, learn, legal) ── */
.docs-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 60px;
}

.docs-container.single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 880px;
}

.sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.sidebar h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
}

.sidebar h3 + a { margin-top: 0; }

.sidebar a {
  display: block;
  padding: 6px 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
  font-size: 14px;
}

.sidebar a:hover,
.sidebar a.active {
  background: var(--hover);
  color: var(--text);
}

.sidebar .sidebar-group { margin-bottom: 24px; }

.content {
  background: var(--surface);
  padding: 48px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  min-width: 0;
}

.content h1 { font-size: 40px; margin-bottom: 8px; letter-spacing: -0.02em; }

.content h2 {
  font-size: 28px;
  margin: 40px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 90px;
}

.content h2:first-of-type { border-top: none; padding-top: 0; }
.content h3 { font-size: 20px; margin: 24px 0 12px; scroll-margin-top: 90px; }
.content p { margin-bottom: 16px; }
.content strong { color: var(--text); }

.content ul,
.content ol {
  margin: 16px 0 16px 24px;
  color: var(--text-muted);
}

.content li { margin-bottom: 8px; line-height: 1.7; }

.lead { font-size: 18px; color: var(--text) !important; margin-bottom: 32px; }
.updated { font-size: 14px; margin-bottom: 24px; }

.tip {
  background: var(--primary-light);
  border-left: 4px solid var(--gold);
  padding: 16px 18px;
  border-radius: var(--radius);
  margin: 24px 0;
  color: var(--text-muted);
  display: flow-root; /* sit beside floated screenshots instead of running under them */
}

.tip p:last-child { margin-bottom: 0; }
.tip strong { color: var(--text); }

.tip.warn {
  background: rgba(178, 106, 0, 0.1);
  border-left-color: var(--warning);
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}

.back-link:hover { text-decoration: underline; }

.table-wrap { overflow-x: auto; margin: 20px 0 28px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  vertical-align: top;
}

.data-table td:first-child {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.data-table tr:hover td { background: var(--hover); }

.next-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 40px;
}

.next-links a {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  transition: border-color 0.2s, background 0.2s;
}

.next-links a span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.next-links a:hover { border-color: var(--gold); background: var(--hover); }

.legal-disclaimer {
  font-size: 14px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 40px;
}

/* Responsive */
@media (max-width: 768px) {
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--charcoal);
    padding: 8px 16px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .nav.open { display: flex; }
  .nav-link { padding: 12px 4px; }
  .nav .btn { margin-top: 8px; }
  .nav-toggle { display: block; }

  h1 { font-size: 36px; }
  h2 { font-size: 28px; }

  .container { padding: 0 16px; }

  .docs-container { grid-template-columns: 1fr; gap: 24px; padding: 24px 16px; }
  .sidebar { position: static; }
  .content { padding: 24px 20px; }
  .content h1 { font-size: 32px; }
  .data-table td:first-child { white-space: normal; }
}
