:root {
    --green: #77C36B;
    --green-600: #5faf53;
    --green-700: #4b9640;
    --green-050: #eef7ec;
    --green-100: #dcefd8;
    --charcoal: #45494C;
    --charcoal-2: #3E4245;
    --ink: #2b2f31;
    --muted: #6b7175;
    --line: #e6eae6;
    --bg: #f6faf4;
    --card: #ffffff;
    --shadow-sm: 0 1px 2px rgba(62,66,69,.06), 0 2px 8px rgba(62,66,69,.05);
    --shadow-md: 0 6px 22px rgba(62,66,69,.10), 0 2px 6px rgba(62,66,69,.06);
    --shadow-lg: 0 20px 60px rgba(62,66,69,.16);
    --radius: 16px;
    --radius-sm: 10px;
    --sidebar-w: 296px;
    --maxw: 900px;
    --display: "Outfit", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  }

  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; scroll-padding-top: 24px; }
  body {
    margin: 0;
    font-family: var(--body);
    color: var(--ink);
    line-height: 1.65;
    font-size: 16px;
    background:
      radial-gradient(1100px 620px at 88% -6%, rgba(119,195,107,.20), transparent 60%),
      radial-gradient(900px 520px at -10% 12%, rgba(119,195,107,.14), transparent 55%),
      radial-gradient(1200px 800px at 50% 120%, rgba(69,73,76,.06), transparent 60%),
      var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  a { color: var(--green-700); text-decoration: none; }
  a:hover { text-decoration: underline; }
  img { max-width: 100%; display: block; }

  h1, h2, h3, h4 { font-family: var(--display); color: var(--charcoal-2); line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }

  /* ---------- Layout ---------- */
  .shell { display: flex; align-items: flex-start; gap: 0; max-width: 1360px; margin: 0 auto; }

  .toc {
    position: sticky; top: 0; align-self: flex-start;
    width: var(--sidebar-w); min-width: var(--sidebar-w);
    height: 100vh; overflow-y: auto;
    padding: 26px 18px 40px 26px;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255,255,255,.82), rgba(255,255,255,.6));
    backdrop-filter: blur(8px);
  }
  .toc-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
  .toc-brand img { width: 116px; height: auto; }
  .toc-brand small { display:block; color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-top: 2px; }
  .toc h2 { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; font-weight: 700; }
  .toc nav a {
    display: block; color: var(--charcoal); font-size: 14px; padding: 6px 12px; border-radius: 8px;
    text-decoration: none; font-weight: 500; border-left: 2px solid transparent;
  }
  .toc nav a:hover { background: var(--green-050); color: var(--green-700); text-decoration: none; }
  .toc nav a.sub { padding-left: 26px; font-size: 13px; color: var(--muted); font-weight: 500; }
  .toc nav a.sub:hover { color: var(--green-700); }

  .content { flex: 1; min-width: 0; padding: 0 40px 120px; }
  .wrap { max-width: var(--maxw); margin: 0 auto; }

  section { padding-top: 46px; margin-top: 8px; scroll-margin-top: 20px; }
  section + section { border-top: 1px solid var(--line); margin-top: 34px; }

  .eyebrow { display:inline-flex; align-items:center; gap:8px; font-family: var(--body); font-weight:700; font-size:12px; letter-spacing:.14em; text-transform: uppercase; color: var(--green-700); background: var(--green-050); border:1px solid var(--green-100); padding: 5px 12px; border-radius: 999px; margin-bottom: 14px; }
  h2.section-title { font-size: clamp(26px, 3.4vw, 38px); margin: 0 0 8px; }
  h3 { font-size: 22px; margin: 34px 0 10px; }
  h4 { font-size: 17px; margin: 22px 0 8px; color: var(--charcoal); }
  p { margin: 0 0 14px; }
  .lead { font-size: 18px; color: var(--charcoal); }
  ul, ol { margin: 0 0 16px; padding-left: 22px; }
  li { margin: 4px 0; }
  strong { color: var(--charcoal-2); }
  code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #eef2ee; color: var(--charcoal-2); padding: 2px 7px; border-radius: 6px; font-size: .88em; border: 1px solid var(--line); }

  /* ---------- Cover ---------- */
  .cover {
    position: relative; overflow: hidden;
    border-radius: 26px; margin: 26px 0 8px;
    padding: 68px 56px 60px;
    color: #fff;
    background:
      radial-gradient(820px 460px at 82% -10%, rgba(119,195,107,.55), transparent 60%),
      radial-gradient(700px 420px at -6% 108%, rgba(119,195,107,.35), transparent 55%),
      linear-gradient(140deg, #3E4245 0%, #45494C 46%, #363a3d 100%);
    box-shadow: var(--shadow-lg);
    scroll-margin-top: 0;
  }
  .cover::after {
    content:""; position:absolute; right:-60px; bottom:-80px; width:360px; height:360px;
    background: radial-gradient(circle at center, rgba(119,195,107,.22), transparent 68%);
    border-radius: 50%;
  }
  .cover-brand {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 18px;
    position: relative;
    z-index: 2;
    margin-bottom: 4px;
  }
  .cover-logo {
    background: transparent;
    display: block;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    line-height: 0;
  }
  .cover-logo img { width: 196px; height: auto; display: block; }
  .cover .eyebrow {
    margin: 0;
    align-self: center;
  }
  .cover h1 { color:#fff; font-size: clamp(40px, 6vw, 68px); margin: 26px 0 6px; font-weight: 900; letter-spacing: -.02em; position: relative; z-index: 2; }
  .cover > p { position: relative; z-index: 2; color: rgba(255,255,255,.86); max-width: 640px; }
  .cover .kicker { font-family: var(--display); font-weight:700; font-size: clamp(16px,2.2vw,22px); color: var(--green); letter-spacing:.02em; }
  .cover .subtitle { font-size: 18px; color: rgba(255,255,255,.86); max-width: 640px; margin-top: 10px; position: relative; z-index:2; }
  .cover-meta { display:flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; position: relative; z-index:2; }
  .cover-meta span {
    background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.18);
    color:#fff; padding: 8px 15px; border-radius: 999px; font-size: 13px; font-weight: 600;
    backdrop-filter: blur(4px);
  }
  .cover-meta .pill-green { background: var(--green); border-color: var(--green); color: #14320d; }

  /* ---------- Cards ---------- */
  .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px 24px; }
  .grid { display: grid; gap: 18px; }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }

  .stat { text-align: left; }
  .stat .num { font-family: var(--display); font-weight: 800; font-size: 34px; color: var(--green-700); line-height: 1; }
  .stat .lbl { color: var(--muted); font-size: 13px; margin-top: 6px; }

  .callout { border-left: 4px solid var(--green); background: linear-gradient(90deg, var(--green-050), rgba(238,247,236,.35)); border-radius: 12px; padding: 16px 20px; margin: 18px 0; }
  .callout.warn { border-left-color: #e0a52e; background: linear-gradient(90deg, #fdf5e4, rgba(253,245,228,.3)); }
  .callout.info { border-left-color: var(--charcoal); background: linear-gradient(90deg, #eef1f2, rgba(238,241,242,.3)); }
  .callout p:last-child { margin-bottom: 0; }
  .callout .tag { font-family: var(--display); font-weight: 700; color: var(--charcoal-2); display:block; margin-bottom: 2px; }

  /* ---------- Tables ---------- */
  .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin: 18px 0; }
  table { border-collapse: collapse; width: 100%; font-size: 14.5px; background:#fff; }
  th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
  thead th { background: var(--charcoal-2); color: #fff; font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing:.02em; border-bottom: none; }
  tbody tr:nth-child(even) { background: #fafcf9; }
  tbody tr:hover { background: var(--green-050); }
  td .yes { color: var(--green-700); font-weight: 700; }
  td .no { color: #c14b4b; font-weight: 700; }
  .role-chip { display:inline-block; font-family: ui-monospace, monospace; font-size: 12px; background:#eef2ee; border:1px solid var(--line); padding: 2px 8px; border-radius: 6px; color: var(--charcoal-2); }

  /* ---------- Badges ---------- */
  .badges { display:flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
  .badge { font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; border:1px solid var(--line); }
  .badge.web { background:#eef1f2; color: var(--charcoal-2); border-color:#dfe4e5; }
  .badge.app { background: var(--green-050); color: var(--green-700); border-color: var(--green-100); }
  .badge.both { background:#fff6e6; color:#9a6a12; border-color:#f2e2bf; }

  /* ---------- Journey Steps ---------- */
  .journey { counter-reset: step; margin: 22px 0 8px; }
  .step { position: relative; display: grid; grid-template-columns: 1fr; gap: 16px; padding: 0 0 30px 62px; }
  .step::before {
    counter-increment: step; content: counter(step);
    position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 50%;
    background: var(--green); color: #14320d; font-family: var(--display); font-weight: 800; font-size: 18px;
    display: grid; place-items: center; box-shadow: 0 4px 12px rgba(119,195,107,.4); z-index: 2;
  }
  .step::after { content:""; position:absolute; left: 19px; top: 44px; bottom: 6px; width: 2px; background: linear-gradient(var(--green-100), rgba(119,195,107,.12)); }
  .step:last-child::after { display: none; }
  .step .step-body h4 { margin: 6px 0 6px; font-size: 18px; }
  .step .step-body p { margin: 0 0 8px; color: var(--charcoal); }

  /* ---------- Browser frame ---------- */
  figure { margin: 16px 0 4px; }
  .browser { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-md); background:#fff; }
  .browser .chrome { display:flex; align-items:center; gap: 8px; background: #eef1f2; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .browser .dots { display:flex; gap: 6px; }
  .browser .dots i { width: 11px; height: 11px; border-radius: 50%; display:inline-block; }
  .browser .dots i:nth-child(1){ background:#ff5f57; }
  .browser .dots i:nth-child(2){ background:#febc2e; }
  .browser .dots i:nth-child(3){ background:#28c840; }
  .browser .url { flex:1; background:#fff; border:1px solid #e0e4e5; border-radius: 8px; padding: 5px 12px; font-size: 12.5px; color: var(--muted); font-family: ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .browser img { width: 100%; display:block; }
  figcaption { color: var(--muted); font-size: 13px; margin-top: 8px; text-align: center; }

  /* ---------- Phone frame ---------- */
  .phones { display:flex; flex-wrap: wrap; gap: 26px; margin: 20px 0 6px; justify-content: flex-start; }
  .phone-fig { width: 236px; }
  .phone {
    width: 236px; border-radius: 40px; background: #1f2224; padding: 10px;
    box-shadow: var(--shadow-lg); border: 2px solid #303436; position: relative;
  }
  .phone::before {
    content:""; position:absolute; top: 16px; left: 50%; transform: translateX(-50%);
    width: 92px; height: 22px; background:#1f2224; border-radius: 999px; z-index: 3;
  }
  .phone .screen { border-radius: 30px; overflow: hidden; background:#000; aspect-ratio: 1179 / 2556; }
  .phone .screen img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
  .phone-fig figcaption { margin-top: 10px; font-weight: 500; color: var(--charcoal); }

  /* ---------- Brand kit ---------- */
  .swatches { display:grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 16px 0; }
  .swatch { border:1px solid var(--line); border-radius: 14px; overflow:hidden; box-shadow: var(--shadow-sm); background:#fff; }
  .swatch .chip { height: 84px; }
  .swatch .meta { padding: 10px 12px; }
  .swatch .meta b { font-family: var(--display); display:block; font-size: 14px; }
  .swatch .meta span { color: var(--muted); font-size: 12px; font-family: ui-monospace, monospace; }
  .logo-showcase { display:flex; flex-wrap: wrap; gap: 16px; margin: 16px 0; }
  .logo-tile { flex:1; min-width: 200px; border:1px solid var(--line); border-radius: 14px; padding: 24px; display:grid; place-items:center; box-shadow: var(--shadow-sm); }
  .logo-tile.dark { background: var(--charcoal-2); }
  .logo-tile.light { background: #fff; }
  .logo-tile.soft { background: linear-gradient(135deg, var(--green-050), #fff); }
  .logo-tile img { max-height: 76px; width:auto; }
  .logo-tile small { grid-column: 1; text-align:center; color: var(--muted); font-size:11px; margin-top:12px; letter-spacing:.1em; text-transform: uppercase; }

  /* ---------- Misc ---------- */
  .anchor-list { columns: 2; column-gap: 32px; }
  .anchor-list a { display:block; padding: 5px 0; }
  @media (max-width: 720px){ .anchor-list { columns: 1; } }

  .footer { margin-top: 60px; padding: 30px 0 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; text-align:center; }
  .footer strong { color: var(--charcoal-2); }
  .kbd { font-family: ui-monospace, monospace; font-size:12px; border:1px solid var(--line); border-bottom-width:2px; border-radius:6px; padding:1px 6px; background:#fff; }

  .toc-toggle { display: none; }

  /* ---------- Responsive ---------- */
  @media (max-width: 1080px){
    .toc { display: none; }
    .content { padding: 0 22px 90px; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .swatches { grid-template-columns: repeat(2, 1fr); }
  }
  @media (max-width: 640px){
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .cover { padding: 44px 26px; }
    .content { padding: 0 16px 70px; }
    .step { padding-left: 52px; }
    .step::before { width: 34px; height:34px; font-size: 15px; }
    .step::after { left: 16px; }
  }

  /* ---------- RTL (Arabic / Urdu) ---------- */
  html[dir="rtl"] body {
    text-align: right;
  }
  html[dir="rtl"] .toc {
    border-right: none;
    border-left: 1px solid var(--line);
    padding: 26px 26px 40px 18px;
  }
  html[dir="rtl"] .toc nav a {
    border-left: none;
    border-right: 2px solid transparent;
  }
  html[dir="rtl"] .toc nav a.sub {
    padding-left: 12px;
    padding-right: 26px;
  }
  html[dir="rtl"] .note-box,
  html[dir="rtl"] .warn-box,
  html[dir="rtl"] .callout {
    border-left: none;
    border-right: 4px solid var(--green);
  }
  html[dir="rtl"] .warn-box,
  html[dir="rtl"] .callout.warn {
    border-right-color: #f59e0b;
  }
  html[dir="rtl"] .callout.info {
    border-right-color: var(--charcoal);
  }
  html[dir="rtl"] th,
  html[dir="rtl"] td {
    text-align: right;
  }
  html[dir="rtl"] .stat {
    text-align: right;
  }
  html[dir="rtl"] ul,
  html[dir="rtl"] ol {
    padding-left: 0;
    padding-right: 22px;
  }
  html[dir="rtl"] .step {
    padding-left: 0;
    padding-right: 62px;
  }
  html[dir="rtl"] .step::before {
    left: auto;
    right: 0;
  }
  html[dir="rtl"] .step::after {
    left: auto;
    right: 19px;
  }
  html[dir="rtl"] .phones {
    justify-content: flex-start;
  }
  html[dir="rtl"] .lang-switch {
    flex-direction: row;
  }
  @media (max-width: 640px) {
    html[dir="rtl"] .step {
      padding-right: 52px;
    }
    html[dir="rtl"] .step::after {
      right: 16px;
    }
  }

  /* ---------- Print ---------- */
  @media print {
    :root { --maxw: 100%; }
    body { background: #fff; font-size: 11.5pt; }
    .toc { display: none; }
    .content { padding: 0; }
    .shell { display: block; }
    .cover { color:#fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; break-after: page; box-shadow:none; }
    section { break-inside: avoid-page; }
    .card, .table-wrap, .browser, .phone, figure, .step { break-inside: avoid; }
    a { color: var(--charcoal-2); text-decoration: none; }
    .badge, .eyebrow, thead th, .step::before, .swatch .chip, .cover-meta span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    h2.section-title { break-after: avoid; }
    .footer { break-inside: avoid; }
  }
