@import url('https://fonts.googleapis.com/css2?family=Red+Hat+Display:ital,wght@0,400;0,700;1,700&family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #f6f9fc;
  /* Soft blue-gray off-white matching site background */
  --surface: #ffffff;
  /* Pure white for headers and surfaces */
  --surface-2: #e9effc;
  --ink: #0a1931;
  /* Deep blue-navy */
  --muted: #475569;
  --faint: #94a3b8;
  --accent: #4261a8;
  /* Actionfi Slate Blue */
  --accent-hover: #334d85;
  --accent-bg: #f0f4fc;
  --line: #e2e8f0;

  --p1: #dc2626;
  --p1-bg: #fef2f2;
  --p2: #d97706;
  --p2-bg: #fffbeb;
  --p3: #2563eb;
  --p3-bg: #eff6ff;
  --p4: #64748b;
  --p4-bg: #f8fafc;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}


* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

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

::selection {
  background: var(--accent);
  color: #fff;
}

/* ---------- Header & Letterhead ---------- */
.letterhead {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: var(--transition);
}

.letterhead-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  height: 38px;
  width: auto;
  display: block;
}

.brand-addr {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.letterhead-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.letterhead-meta {
  text-align: right;
  font-size: 0.75rem;
  color: var(--muted);
}

.letterhead-meta .doc-title {
  color: var(--accent);
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  display: block;
  margin-bottom: 2px;
}


/* ---------- Page Layout ---------- */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 32px 100px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 64px;
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 32px 24px;
  }

  .toc {
    display: none;
  }
}

/* ---------- Navigation / TOC ---------- */
.toc {
  position: sticky;
  top: 96px;
  align-self: start;
  font-size: 0.85rem;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding-right: 12px;
}

/* Sleek custom scrollbar for TOC sidebar */
.toc::-webkit-scrollbar {
  width: 4px;
}
.toc::-webkit-scrollbar-track {
  background: transparent;
}
.toc::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}
.toc::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.toc-label {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 0.7rem;
  color: var(--faint);
  font-weight: 700;
  margin-bottom: 16px;
}

.toc-group {
  margin-bottom: 4px;
}

.toc-parent {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 0 6px 12px;
  border-left: 2px solid var(--line);
  transition: var(--transition);
  font-weight: 600;
}

.toc-parent:hover,
.toc-parent.active {
  color: var(--accent);
  border-color: var(--accent);
  padding-left: 16px;
}

.toc-sub-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 0;
  padding-left: 12px;
  margin-left: 1px;
  border-left: 1px solid var(--line);
}

.toc-group.active .toc-sub-list,
.toc-group:hover .toc-sub-list {
  max-height: 2000px;
  opacity: 1;
  margin-top: 4px;
  margin-bottom: 8px;
}

.toc-sub-list a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 0 4px 12px;
  font-size: 0.8rem;
  transition: var(--transition);
  font-weight: 400;
}

.toc-sub-list a:hover,
.toc-sub-list a.active {
  color: var(--accent);
  padding-left: 16px;
}

/* ---------- Main Content ---------- */
main {
  max-width: 760px;
}

.doc-head {
  margin-bottom: 28px;
}

h1 {
  font-family: 'Inter', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 12px;
  line-height: 1.25;
}

.doc-sub {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 24px;
  line-height: 1.6;
}

.intro {
  background: var(--accent-bg);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 40px;
}

.intro strong {
  color: var(--ink);
}

section.article-section {
  padding-top: 40px;
  margin-top: 40px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 96px;
}

section.article-section:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

h2 {
  font-family: 'Inter', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: var(--ink);
}

h2 .num {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--ink);
  display: flex;
  align-items: center;
}

h3 .num {
  color: var(--accent);
  font-weight: 700;
  margin-right: 8px;
}

p {
  margin: 0 0 16px;
  color: var(--muted);
}

.lede {
  font-size: 1.02rem;
  color: var(--muted);
}

ul.plain {
  margin: 0 0 20px;
  padding-left: 1.25em;
  color: var(--muted);
}

ul.plain li {
  margin-bottom: 8px;
}

/* Definitions list */
dl.defs {
  margin: 0 0 16px;
}

dl.defs>div {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  transition: var(--transition);
}

dl.defs>div:hover {
  background: var(--surface-2);
  padding-left: 8px;
  padding-right: 8px;
  border-radius: var(--radius-sm);
}

@media (max-width: 640px) {
  dl.defs>div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  dl.defs>div:hover {
    padding-left: 0;
    padding-right: 0;
    background: none;
  }
}

dl.defs dt {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}

dl.defs dd {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

/* Escalation paths */
.escalation {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0 32px;
}

@media (max-width: 840px) {
  .escalation {
    grid-template-columns: 1fr;
  }
}

.esc-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  position: relative;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.esc-step:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.esc-tier {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.esc-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--ink);
}

.esc-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.esc-step:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
  z-index: 10;
}

@media (max-width: 840px) {
  .esc-step:not(:last-child)::after {
    content: "↓";
    right: 50%;
    bottom: -15px;
    top: auto;
    transform: translateX(50%);
  }
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  background: var(--bg);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
  min-width: 100%;
  table-layout: fixed;
}

/* Equal/proportional desktop column widths */
table tr th:nth-child(1), table tr td:nth-child(1) {
  width: 28%;
}
table tr th:nth-child(2), table tr td:nth-child(2) {
  width: 36%;
}
table tr th:nth-child(3), table tr td:nth-child(3) {
  width: 36%;
}

/* 2-column tables */
table tr th:first-child:nth-last-child(2), table tr td:first-child:nth-last-child(2) {
  width: 45%;
}
table tr th:first-child:nth-last-child(2) ~ th, table tr td:first-child:nth-last-child(2) ~ td {
  width: 55%;
}

thead th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 700;
  padding: 14px 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  white-space: normal;
}

tbody td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: break-word;
  transition: var(--transition);
}

tbody tr:hover td {
  background: var(--surface);
  color: var(--ink);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody td.ink {
  color: var(--ink);
  font-weight: 500;
}

td.num,
th.num {
  font-variant-numeric: tabular-nums;
}

/* Chips / Status Indicators */
.chip {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  white-space: normal;
}

/* Service Credit Progress Bars */
.credit-bar-track {
  background: var(--surface-2);
  border-radius: 10px;
  height: 8px;
  width: 100%;
  min-width: 120px;
  overflow: hidden;
}

.credit-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 10px;
  transition: width 0.8s ease-out;
}

/* Footer */
footer.doc-footer {
  max-width: 760px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--faint);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Print Overrides */
@media print {

  .toc {
    display: none !important;
  }

  .shell {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .letterhead {
    background: none;
    position: relative;
    border-bottom: 2px solid #000;
  }

  .esc-step::after {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }
}

/* ---------- Portal Home page ---------- */
.portal-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 32px 100px;
}

.hero-banner {
  text-align: center;
  margin-bottom: 64px;
}

.hero-banner h1 {
  font-family: 'Inter', sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.hero-banner p {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.portal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 32px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.portal-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.portal-card-header {
  margin-bottom: 24px;
}

.portal-card-logo-placeholder {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 60px;
  margin-bottom: 20px;
}

.portal-card-logo-placeholder img {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.portal-card h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--ink);
}

.portal-card p {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.portal-card-footer {
  margin-top: 24px;
}

.portal-card .card-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  transition: var(--transition);
}

.portal-card:hover .card-link {
  color: var(--accent-hover);
  gap: 12px;
}

/* ---------- RUNMYBOT Brand Text Styling ---------- */
.rmb_run_p,
.rmb_my_p,
.rmb_bot_p {
  font-family: 'Red Hat Display', sans-serif;
  color: #394B99;
  line-height: inherit;
}

.rmb_run_p {
  font-style: italic;
  font-weight: 700;
}

.rmb_my_p {
  font-style: normal;
  font-weight: 400;
}

.rmb_bot_p {
  font-style: normal;
  font-weight: 700;
}

/* ---------- Installation Guide & Stepper Styles ---------- */
.stepper-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: relative;
  padding-left: 20px;
  margin-top: 32px;
}

.stepper-container::before {
  content: "";
  position: absolute;
  left: 37px;
  top: 24px;
  bottom: 24px;
  width: 2px;
  background: var(--line);
  z-index: 1;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px 28px 24px 72px;
  position: relative;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  z-index: 2;
  scroll-margin-top: 110px;
}

.step-card:hover {
  transform: translateX(4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.step-badge {
  position: absolute;
  left: 20px;
  top: 22px;
  width: 36px;
  height: 36px;
  background: var(--accent-bg);
  border: 2px solid var(--accent);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  z-index: 3;
  transition: var(--transition);
}

.step-card:hover .step-badge {
  background: var(--accent);
  color: #fff;
  transform: scale(1.05);
}

.step-card h3 {
  margin: 0 0 12px 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}

.step-details {
  font-size: 0.92rem;
  color: var(--muted);
}

.step-details p {
  margin-bottom: 12px;
}

.step-details ul {
  margin: 0 0 16px 0;
  padding-left: 20px;
}

.step-details li {
  margin-bottom: 8px;
}

.sub-step-title {
  font-weight: 700;
  color: var(--ink);
  margin-top: 16px;
  margin-bottom: 8px;
}

/* ---------- Flow Diagram Styles ---------- */
.diagram-container {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  margin-top: 32px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.diagram-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 500px;
}

.diagram-node {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  width: 100%;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
}

.diagram-node:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
  transform: translateY(-2px);
}

.diagram-node.hubspot {
  border-left: 4px solid #ff7a59; /* HubSpot Orange */
}

.diagram-node.rmb {
  border-left: 4px solid var(--accent);
}

.diagram-arrow {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 32px;
  color: var(--faint);
  font-size: 1.2rem;
  font-weight: 700;
}

.diagram-legend {
  display: flex;
  gap: 16px;
  margin-top: 24px;
  font-size: 0.8rem;
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-hubspot {
  background: #ff7a59;
}

.legend-rmb {
  background: var(--accent);
}

/* Quick access banner on index */
.guide-banner {
  background: linear-gradient(135deg, var(--surface) 0%, var(--accent-bg) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.guide-banner:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.guide-banner-content h2 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
}

.guide-banner-content p {
  margin: 0;
  font-size: 0.95rem;
}

.guide-banner-action .btn {
  background: var(--accent);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.guide-banner-action .btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .guide-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
  }
  .guide-banner-action {
    width: 100%;
  }
  .guide-banner-action .btn {
    width: 100%;
    justify-content: center;
  }
}

.step-screenshot {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.step-screenshot:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ---------- Lightbox Popup Modal Styles ---------- */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(10, 25, 49, 0.6); /* Slightly transparent dark navy */
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  max-width: 95%;
  width: 1100px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04), var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: zoom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes zoom {
  from {transform: scale(0.95); opacity: 0;}
  to {transform: scale(1); opacity: 1;}
}

.modal-card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
}

.modal-card-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  font-weight: 700;
}

.modal-close-btn {
  font-size: 28px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
  user-select: none;
}

.modal-close-btn:hover {
  color: var(--p1); /* Red accent on close hover */
  transform: scale(1.1);
}

.modal-card-body {
  padding: 24px;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: auto;
}

.modal-img-element {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE FIXES FOR INTEGRATION PAGES
   ========================================================================== */

/* Prevent horizontal overflow on mobile viewports only, preserving desktop sticky TOC */
@media (max-width: 960px) {
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Universal text break safety for long symbols and titles */
h1, h2, h3, h4, h5, h6, p, div, span, a, td, th, dt, dd, li, code {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Header & Letterhead Responsiveness */
@media (max-width: 768px) {
  .letterhead-inner {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .brand {
    gap: 12px;
    flex-wrap: wrap;
  }

  .brand-logo {
    height: 28px;
    width: auto;
  }

  .brand-addr {
    font-size: 0.7rem;
    line-height: 1.35;
    margin-top: 2px;
  }

  .letterhead-right {
    width: 100%;
    justify-content: flex-start;
  }

  .letterhead-meta {
    text-align: left;
    font-size: 0.72rem;
  }

  .letterhead-meta .doc-title {
    font-size: 0.9rem;
    display: inline-block;
    margin-right: 6px;
    margin-bottom: 0;
  }
}

/* Shell & Main Content Container Responsiveness */
@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 24px 16px 60px;
    width: 100%;
    max-width: 100%;
  }

  .toc {
    display: none !important;
  }

  main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 16px 12px 48px;
    gap: 20px;
  }
}

/* Typography Scaling for Mobile */
@media (max-width: 768px) {
  .doc-head {
    margin-bottom: 20px;
  }

  h1 {
    font-size: 1.45rem !important;
    line-height: 1.3 !important;
    margin-bottom: 12px !important;
    letter-spacing: -0.01em !important;
  }

  h2 {
    font-size: 1.2rem !important;
    line-height: 1.35 !important;
    margin-bottom: 16px !important;
    flex-wrap: wrap !important;
  }

  h3 {
    font-size: 1.05rem !important;
    line-height: 1.4 !important;
    margin: 24px 0 10px !important;
    flex-wrap: wrap !important;
  }

  .intro {
    padding: 14px 16px !important;
    font-size: 0.88rem !important;
    line-height: 1.5 !important;
    margin-bottom: 24px !important;
    border-left-width: 3px !important;
  }

  .doc-sub {
    font-size: 0.92rem !important;
    margin-bottom: 16px !important;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.3rem !important;
  }

  h2 {
    font-size: 1.12rem !important;
  }

  h3 {
    font-size: 0.98rem !important;
  }
}

/* Table Wrapper & Table Responsiveness */
.table-wrap {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto;
  margin: 14px 0 24px !important;
  box-sizing: border-box !important;
  border-radius: 8px;
  border: 1px solid var(--line);
}

@media (max-width: 768px) {
  .table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  table {
    font-size: 0.75rem !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  thead th {
    padding: 6px 6px !important;
    font-size: 0.68rem !important;
    white-space: normal !important;
    line-height: 1.25 !important;
    vertical-align: bottom !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    background: var(--bg) !important;
  }

  tbody td {
    padding: 8px 6px !important;
    font-size: 0.74rem !important;
    line-height: 1.35 !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    vertical-align: top !important;
  }

  tbody td.ink {
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    font-weight: 500 !important;
  }

  /* Proportional 100% column widths for 3-column tables */
  table tr th:nth-child(1), table tr td:nth-child(1) {
    width: 30% !important;
  }
  table tr th:nth-child(2), table tr td:nth-child(2) {
    width: 35% !important;
  }
  table tr th:nth-child(3), table tr td:nth-child(3) {
    width: 35% !important;
  }

  /* Proportional 100% column widths for 2-column tables */
  table tr th:first-child:nth-last-child(2), table tr td:first-child:nth-last-child(2) {
    width: 45% !important;
  }
  table tr th:first-child:nth-last-child(2) ~ th, table tr td:first-child:nth-last-child(2) ~ td {
    width: 55% !important;
  }
}

@media (max-width: 480px) {
  table {
    font-size: 0.72rem !important;
  }

  thead th {
    padding: 6px 4px !important;
    font-size: 0.62rem !important;
  }

  tbody td {
    padding: 6px 4px !important;
    font-size: 0.7rem !important;
  }
}

/* Image & Diagram Responsiveness */
.step-screenshot,
.article-section img {
  max-width: 100% !important;
  height: auto !important;
  box-sizing: border-box !important;
}

/* Footer Responsiveness */
@media (max-width: 768px) {
  footer.doc-footer {
    margin-top: 36px !important;
    padding-top: 16px !important;
  }

  footer.doc-footer > div {
    padding: 0 16px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
  }
}
