:root {
  --primary: #0B8A5F;
  --primary-dark: #07694A;
  --primary-soft: #E7F6EF;
  --accent: #059669;
  --accent-soft: #ECFDF5;
  --text: #111827;
  --text-muted: #4B5563;
  --bg: #F9FAFB;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 4px 16px rgba(17, 24, 39, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #34D399;
    --primary-dark: #6EE7B7;
    --primary-soft: #06281D;
    --accent: #34D399;
    --accent-soft: #052E24;
    --text: #F3F4F6;
    --text-muted: #9CA3AF;
    --bg: #0B0F19;
    --surface: #111827;
    --border: #1F2937;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 64px; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.15rem; color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 0.95rem; font-weight: 800;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  padding: 8px 12px; border-radius: 8px;
  font-size: 0.9rem; font-weight: 500; color: var(--text-muted);
}
.nav a:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* Hero */
.hero { padding: 72px 0 48px; text-align: center; }
.eyebrow {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em;
}
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.15; margin: 16px 0 12px; letter-spacing: -0.02em; }
.hero p { font-size: 1.15rem; color: var(--text-muted); max-width: 620px; margin: 0 auto; }
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 10px; font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--surface); }

/* Sections */
section { padding: 32px 0; }
.section-title { font-size: 1.6rem; margin: 0 0 8px; letter-spacing: -0.01em; }
.section-sub { color: var(--text-muted); margin: 0 0 24px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }
.icon {
  width: 40px; height: 40px; border-radius: 10px; margin-bottom: 12px;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-size: 1.2rem;
}

a.card { display: block; color: inherit; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--primary); transform: translateY(-2px); text-decoration: none; }
a.card .more { display: inline-block; margin-top: 10px; color: var(--primary); font-weight: 600; font-size: 0.9rem; }

.callout {
  border-radius: var(--radius); padding: 18px 20px; margin: 24px 0;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.callout strong { color: var(--accent); }

/* Legal document */
.doc-head { padding: 48px 0 8px; }
.doc-head h1 { font-size: clamp(1.9rem, 5vw, 2.5rem); margin: 10px 0 6px; letter-spacing: -0.02em; }
.doc-head p { color: var(--text-muted); margin: 0; }
.meta {
  display: grid; gap: 4px 24px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; margin: 24px 0; font-size: 0.9rem;
}
.meta span { color: var(--text-muted); }

.toc {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 8px;
}
.toc strong { display: block; margin-bottom: 6px; font-size: 0.9rem; }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 32px; font-size: 0.9rem; }
@media (max-width: 600px) { .toc ol { columns: 1; } }

.doc h2 {
  font-size: 1.25rem; margin: 40px 0 10px; padding-top: 8px; scroll-margin-top: 80px;
}
.doc h3 { font-size: 1.02rem; margin: 20px 0 6px; }
.doc p, .doc li { color: var(--text-muted); }
.doc strong { color: var(--text); }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin-bottom: 6px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 12px 0; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text); font-weight: 600; background: var(--surface); }
td { color: var(--text-muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; background: var(--primary-soft); color: var(--primary); padding: 2px 6px; border-radius: 6px; }

.steps { counter-reset: step; list-style: none; padding-left: 0 !important; }
.steps li { position: relative; padding-left: 40px; margin-bottom: 12px; }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-size: 0.8rem; font-weight: 700;
}

.contact-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin: 40px 0 0;
}
.contact-box h2 { margin-top: 0 !important; padding-top: 0 !important; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 64px; padding: 32px 0; font-size: 0.9rem; color: var(--text-muted); }
.site-footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--primary); }

/* Guide & Content Hub Extensions */
.breadcrumbs {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.85rem; color: var(--text-muted); margin: 24px 0 16px;
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); text-decoration: none; }
.breadcrumbs .sep { opacity: 0.5; font-size: 0.8rem; }
.breadcrumbs .current { color: var(--primary); font-weight: 600; }

.badge-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-size: 0.8rem; font-weight: 600;
}
.badge-warning {
  background: rgba(239, 68, 68, 0.12); color: #EF4444; border: 1px solid rgba(239, 68, 68, 0.25);
}
.badge-neutral {
  background: rgba(156, 163, 175, 0.15); color: var(--text-muted); border: 1px solid var(--border);
}

.article-header { padding: 24px 0 16px; }
.article-header h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.15; margin: 12px 0 16px; font-weight: 800; letter-spacing: -0.025em; }
.article-lead { font-size: 1.15rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 20px; }

.article-meta {
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin-bottom: 28px; font-size: 0.88rem; color: var(--text-muted);
}
.article-meta span { display: inline-flex; align-items: center; gap: 6px; }

.template-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin: 20px 0; box-shadow: var(--shadow); position: relative;
}
.template-card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px;
}
.template-title { font-weight: 700; font-size: 1.05rem; color: var(--text); margin: 0; }
.template-box {
  background: var(--bg); border: 1px dashed var(--border); border-radius: 10px;
  padding: 16px; font-size: 0.95rem; line-height: 1.6; color: var(--text); position: relative;
  font-family: inherit; white-space: pre-line;
}
.btn-copy {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 8px;
  background: var(--primary-soft); color: var(--primary); font-size: 0.85rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: all 0.2s;
}
.btn-copy:hover { background: var(--primary); color: #fff; }
.btn-copy.copied { background: #059669; color: #fff; }

.callout-box {
  border-radius: var(--radius); padding: 18px 22px; margin: 24px 0;
  background: var(--primary-soft); border-left: 4px solid var(--primary);
}
.callout-box h3 { margin: 0 0 8px; color: var(--primary-dark); font-size: 1.05rem; }
.callout-box p { margin: 0; font-size: 0.95rem; }

.callout-danger {
  background: rgba(239, 68, 68, 0.08); border-left: 4px solid #EF4444;
}
.callout-danger h3 { color: #DC2626; }

.cta-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.3); border-radius: 18px;
  padding: 32px 28px; margin: 40px 0; text-align: center;
}
.cta-banner h3 { font-size: 1.5rem; margin: 0 0 10px; font-weight: 800; }
.cta-banner p { color: var(--text-muted); max-width: 580px; margin: 0 auto 20px; font-size: 1rem; }

.sample-table {
  width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 0.9rem;
}
.sample-table th, .sample-table td {
  border: 1px solid var(--border); padding: 10px 14px; text-align: left;
}
.sample-table th { background: var(--surface); color: var(--text); font-weight: 700; }
.sample-table tr:nth-child(even) { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.sample-table .amount-in { color: #10B981; font-weight: 600; }
.sample-table .amount-out { color: #EF4444; font-weight: 600; }

.lang-switch {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 0.85rem; font-weight: 600; color: var(--text-muted);
}
.lang-switch:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
