/* ============================================================
   APPSBRAINS — Sub-page Stylesheet
   Legal, Support, Contact & Account pages
   (loads AFTER css/styles.css — reuses its tokens)
   ============================================================ */

body.page { background: var(--white); }

/* ---------- Page header ---------- */
.page-hero {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: calc(var(--nav-height) + 72px) 0 56px;
}
.page-hero__inner { max-width: 720px; }

.page-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-faint);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.page-hero__badge i { font-size: 0.75rem; }

.page-hero h1 {
  font-size: clamp(1.95rem, 4vw, 2.85rem);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.033em;
  line-height: 1.1;
  margin-bottom: 18px;
}
.page-hero p { font-size: 1.05rem; color: var(--ink-muted); max-width: 640px; line-height: 1.65; }
.page-hero p a { color: var(--ink); border-bottom: 1px solid var(--line-strong); }

.page-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
  color: var(--ink-muted);
}
.page-hero__meta span { display: inline-flex; align-items: center; gap: 8px; }
.page-hero__meta i { color: var(--ink-faint); font-size: 0.78rem; }
.page-hero__meta a { color: var(--ink); }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  padding: 16px 0;
  font-size: 0.83rem;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--line);
  background: var(--white);
}
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; list-style: none; }
.breadcrumb li { display: inline-flex; align-items: center; gap: 8px; }
.breadcrumb a { color: var(--ink-muted); }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb li:not(:last-child)::after { content: '/'; color: var(--line-strong); }
.breadcrumb [aria-current] { color: var(--ink); font-weight: 500; }

/* ---------- Doc layout ---------- */
.doc {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 64px;
  align-items: start;
  padding: 64px 0 96px;
}
/* Grid children default to min-width:auto, which lets the wide tables inside
   .prose stretch the track past the viewport. Pin both tracks to zero. */
.doc > * { min-width: 0; }

.doc__toc {
  position: sticky;
  top: calc(var(--nav-height) + 28px);
  border-left: 1px solid var(--line);
  padding-left: 20px;
  max-height: calc(100vh - var(--nav-height) - 60px);
  overflow-y: auto;
}
.doc__toc h2 {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-bottom: 14px;
  font-weight: 700;
}
.doc__toc ol { list-style: none; display: flex; flex-direction: column; gap: 1px; }
.doc__toc a {
  display: block;
  padding: 5px 0;
  font-size: 0.855rem;
  color: var(--ink-muted);
  line-height: 1.45;
  transition: color var(--transition-fast);
}
.doc__toc a:hover { color: var(--ink); }
.doc__toc a.active { color: var(--ink); font-weight: 600; }

/* ---------- Prose ---------- */
.prose { max-width: 720px; width: 100%; color: var(--ink-soft); font-size: 0.98rem; line-height: 1.75; }
.prose > section { scroll-margin-top: calc(var(--nav-height) + 28px); }
.prose > section + section { margin-top: 52px; padding-top: 52px; border-top: 1px solid var(--line); }

.prose h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.022em;
  margin-bottom: 16px;
}
.prose h3 { font-size: 1.02rem; font-weight: 700; color: var(--ink); margin: 30px 0 10px; letter-spacing: -0.012em; }
.prose h4 { font-size: 0.94rem; font-weight: 700; color: var(--ink); margin: 22px 0 8px; }

.prose p { margin-bottom: 14px; }
.prose ul, .prose ol { margin: 0 0 16px 0; padding-left: 20px; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 7px; padding-left: 4px; }
.prose li::marker { color: var(--ink-faint); }
.prose a { color: var(--ink); border-bottom: 1px solid var(--line-strong); transition: border-color var(--transition); }
.prose a:hover { border-bottom-color: var(--ink); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose code {
  background: var(--bg-sunken);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 0.86em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
}
.prose hr { border: none; border-top: 1px solid var(--line); margin: 40px 0; }

/* ---------- Callout ---------- */
.callout {
  display: flex;
  gap: 13px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--ink);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--bg-section);
  margin: 22px 0;
  font-size: 0.93rem;
  line-height: 1.65;
}
.callout i { color: var(--ink-muted); font-size: 0.95rem; margin-top: 4px; flex-shrink: 0; }
.callout p:last-child { margin-bottom: 0; }

.callout--warn { border-left-color: #b45309; }
.callout--warn i { color: #b45309; }
.callout--danger { border-left-color: #b3261e; }
.callout--danger i { color: #b3261e; }
.callout--ok { border-left-color: #15803d; }
.callout--ok i { color: #15803d; }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 22px 0;
}
.prose table { width: 100%; border-collapse: collapse; font-size: 0.875rem; min-width: 520px; }
.prose thead { background: var(--bg-section); }
.prose th {
  text-align: left;
  padding: 11px 16px;
  font-weight: 700;
  color: var(--ink-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.prose td { padding: 13px 16px; border-top: 1px solid var(--line); vertical-align: top; line-height: 1.6; }
.prose tbody tr:first-child td { border-top: none; }

/* ---------- Support cards ---------- */
.support-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 64px 0 8px;
}
.support-card {
  background: var(--white);
  padding: 30px 28px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition);
}
.support-card:hover { background: #fbfbfc; }
.support-card:nth-child(3n) { border-right: none; }
.support-card:nth-last-child(-n+3) { border-bottom: none; }

.support-card__icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--ink);
  margin-bottom: 16px;
}
.support-card h3 { font-size: 1rem; font-weight: 700; color: var(--ink); margin-bottom: 8px; letter-spacing: -0.012em; }
.support-card p { color: var(--ink-muted); font-size: 0.89rem; line-height: 1.65; margin-bottom: 18px; flex-grow: 1; }
.support-card__link {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  transition: border-color var(--transition);
  word-break: break-word;
}
a.support-card__link:hover { border-bottom-color: var(--ink); }
span.support-card__link { border-bottom: none; color: var(--ink-muted); font-weight: 500; }
.support-card__link i { font-size: 0.7rem; }

/* ---------- FAQ ---------- */
.faq { max-width: 780px; margin: 0 auto; border-top: 1px solid var(--line); }
.faq__item { border-bottom: 1px solid var(--line); }

.faq__q {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 2px;
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  font-family: inherit;
  letter-spacing: -0.01em;
}
.faq__q i { color: var(--ink-faint); font-size: 0.75rem; transition: transform var(--transition); flex-shrink: 0; }
.faq__item.open .faq__q i { transform: rotate(180deg); }

.faq__a {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
  color: var(--ink-muted);
  font-size: 0.93rem;
  line-height: 1.72;
  padding: 0 2px;
}
.faq__item.open .faq__a { max-height: 760px; padding: 0 2px 22px; }
.faq__a p { margin-bottom: 10px; }
.faq__a p:last-child { margin-bottom: 0; }
.faq__a a { color: var(--ink); border-bottom: 1px solid var(--line-strong); }
.faq__a ul { list-style: disc; padding-left: 20px; margin: 10px 0; }
.faq__a li { margin-bottom: 6px; }
.faq__a strong { color: var(--ink); font-weight: 600; }

/* ---------- Section wrapper ---------- */
.page-section { padding: 80px 0; }
.page-section--alt { background: var(--bg-section); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.page-section__head { max-width: 620px; margin: 0 auto 44px; text-align: center; }
.page-section__head .section-label { justify-content: center; }
.page-section__head .section-title { margin-bottom: 12px; }
.page-section__head p { color: var(--ink-muted); }

/* ---------- Form card ---------- */
.form-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 34px;
  max-width: 680px;
  margin: 0 auto;
}
.form-card h3 { font-size: 1.12rem; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.form-card > p.form-card__sub { color: var(--ink-muted); font-size: 0.92rem; margin-bottom: 26px; }

.form-check {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.6;
  font-weight: 400;
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--ink);
  flex-shrink: 0;
  cursor: pointer;
}
.form-check a { color: var(--ink); border-bottom: 1px solid var(--line-strong); }
.form-check strong { font-weight: 600; color: var(--ink); }
.form-hint { font-size: 0.81rem; color: var(--ink-muted); }
.form-hint a { color: var(--ink); border-bottom: 1px solid var(--line-strong); }

/* ---------- Contact strip ---------- */
.contact-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0;
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.contact-strip__item {
  padding: 20px;
  border-right: 1px solid var(--line);
}
.contact-strip__item:last-child { border-right: none; }
.contact-strip__item i { color: var(--ink-faint); font-size: 0.9rem; margin-bottom: 10px; display: block; }
.contact-strip__item strong { display: block; color: var(--ink-muted); font-size: 0.76rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.contact-strip__item span,
.contact-strip__item a { color: var(--ink); font-size: 0.9rem; word-break: break-word; }
.contact-strip__item a { border-bottom: 1px solid var(--line-strong); }

/* ---------- Steps ---------- */
.steps { counter-reset: step; display: grid; gap: 0; margin: 24px 0; border-top: 1px solid var(--line); }
.step {
  display: flex;
  gap: 16px;
  padding: 20px 0;
  counter-increment: step;
  border-bottom: 1px solid var(--line);
}
.step::before {
  content: counter(step);
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink-muted);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.step h4 { font-size: 0.95rem; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.step p { color: var(--ink-muted); font-size: 0.89rem; margin: 0; }

/* ---------- Legal link row ---------- */
.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
  justify-content: center;
  padding: 32px 0 72px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.legal-links a {
  padding: 8px 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
  transition: color var(--transition-fast);
}
.legal-links a:hover { color: var(--ink); }
.legal-links a.current { color: var(--ink); font-weight: 600; }

/* ---------- 404 ---------- */
.notfound { min-height: 68vh; display: grid; place-items: center; padding: 160px 24px 96px; }
.notfound > div { max-width: 460px; }
.notfound__code {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 14px;
}
.notfound h1 { font-size: 1.75rem; font-weight: 700; color: var(--ink); letter-spacing: -0.028em; margin-bottom: 12px; }
.notfound p { color: var(--ink-muted); margin-bottom: 28px; line-height: 1.65; }
.notfound__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 36px; padding: 44px 0 76px; }
  .doc__toc {
    position: static;
    max-height: none;
    border-left: none;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 20px 0;
  }
  .doc__toc ol { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 24px; }

  .support-grid { grid-template-columns: 1fr 1fr; }
  .support-card:nth-child(3n) { border-right: 1px solid var(--line); }
  .support-card:nth-child(2n) { border-right: none; }
  .support-card:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .support-card:nth-last-child(-n+2) { border-bottom: none; }
}

@media (max-width: 640px) {
  .page-hero { padding: calc(var(--nav-height) + 44px) 0 40px; }
  .page-hero h1 { font-size: 1.75rem; }
  .page-hero p { font-size: 0.98rem; }

  .doc__toc ol { grid-template-columns: 1fr; }
  .prose > section + section { margin-top: 40px; padding-top: 40px; }

  .form-card { padding: 22px 20px; }
  .page-section { padding: 56px 0; }

  .support-grid { grid-template-columns: 1fr; }
  .support-card { border-right: none !important; border-bottom: 1px solid var(--line) !important; }
  .support-card:last-child { border-bottom: none !important; }

  .contact-strip { grid-template-columns: 1fr; }
  .contact-strip__item { border-right: none; border-bottom: 1px solid var(--line); }
  .contact-strip__item:last-child { border-bottom: none; }

  .legal-links { gap: 0 18px; }
}
