/* ─── PAGE CHROME (history / pricing / faq / settings) ─────────────────── */
.subpage {
  position: relative;
  min-height: calc(100vh - var(--nav-h));
}
.subpage > .mesh-bg { opacity: 0.5; }

.subpage-hero {
  padding: 80px 0 56px;
  text-align: center;
  position: relative;
}
.subpage-hero h1 { margin: 0; }
.subpage-hero .lead { margin: 20px auto 0; }

/* ─── HISTORY ─────────────────────────── */
.history {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - var(--nav-h));
  align-items: stretch;
}
.history .h-side {
  border-right: 1px solid var(--border);
  padding: 28px 18px;
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.history .h-side h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin: 24px 0 8px;
  font-weight: 500;
}
.history .h-side h4:first-child { margin-top: 0; }
.h-side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  margin: 0 -6px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
}
.h-side-item:hover { background: var(--surface-2); }
.h-side-item.active { background: var(--surface-2); color: var(--text); }
.h-side-item .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}
.h-side-item .dot { width: 6px; height: 6px; border-radius: 50%; }

.history .h-main {
  padding: 36px 48px 80px;
  max-width: 980px;
  width: 100%;
}
.h-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.h-search {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  height: 36px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-dim);
}
.h-search input { flex: 1; background: transparent; border: none; outline: none; }

.h-digest {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 36px;
}
.h-digest .card {
  padding: 22px 24px;
  position: relative;
}
.h-digest .digest-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.h-digest h3 { font-size: 22px; margin: 0 0 18px; font-weight: 600; letter-spacing: -0.025em; }
.h-digest .digest-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.h-digest .digest-stats .ds { display: grid; gap: 4px; }
.h-digest .digest-stats .n { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; }
.h-digest .digest-stats .l { font-size: 11.5px; color: var(--text-dim); }

/* GitHub-style contribution graph */
.contribs {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  margin-top: 10px;
}
.contribs > i {
  border-radius: 2px;
  background: var(--surface-3);
  aspect-ratio: 1;
}
.contribs > i[data-l="1"] { background: rgba(var(--accent-rgb),0.20); }
.contribs > i[data-l="2"] { background: rgba(var(--accent-rgb),0.42); }
.contribs > i[data-l="3"] { background: rgba(var(--accent-rgb),0.68); }
.contribs > i[data-l="4"] { background: var(--accent); }

.h-group {
  margin-bottom: 28px;
}
.h-group-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 10px;
  padding: 0 4px;
}
.h-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  margin-bottom: 4px;
}
.h-item:hover { background: var(--surface); border-color: var(--border); }
.h-item .src-icn {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.h-item.src-graph .src-icn { background: rgba(var(--accent-rgb),0.10); border-color: rgba(var(--accent-2-rgb),0.22); color: var(--accent-2); }
.h-item.src-play  .src-icn { background: rgba(55,200,171,0.10); border-color: rgba(55,200,171,0.22); color: var(--accent-fresh); }
.h-item.src-node  .src-icn { background: var(--surface-2); color: var(--text-soft); }
.h-item .title { font-weight: 500; color: var(--text); font-size: 14px; }
.h-item .preview {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.h-item .chips {
  display: flex; gap: 4px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.h-item .meta {
  font-size: 11.5px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  white-space: nowrap;
  display: flex; gap: 10px; align-items: center;
}
.h-item .resume {
  height: 26px;
  padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  color: var(--text-soft);
}
.h-item .resume:hover { background: var(--surface-3); color: var(--text); }
.h-item .pinned-mark { color: var(--accent-hi); font-size: 10px; }

/* ─── PRICING ─────────────────────────── */
.pricing-page {
  position: relative;
  padding-bottom: 100px;
}
.billing-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px;
  margin-top: 28px;
  gap: 2px;
}
.billing-toggle button {
  border: none; background: transparent;
  color: var(--text-dim);
  font-size: 13px; font-weight: 500;
  padding: 7px 18px;
  border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 8px;
}
.billing-toggle button.active { background: var(--surface-3); color: var(--text); }
.billing-toggle button .save { font-size: 10.5px; padding: 1px 6px; border-radius: 3px; background: rgba(var(--accent-rgb),0.18); color: var(--accent-2); }

.tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.tier {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 32px 28px;
  display: flex; flex-direction: column;
  position: relative;
}
.tier.featured {
  border-color: rgba(var(--accent-2-rgb),0.28);
  background: linear-gradient(180deg, rgba(var(--accent-rgb),0.06), rgba(var(--accent-rgb),0.01));
  box-shadow: 0 0 0 1px rgba(var(--accent-2-rgb),0.18);
}
.tier-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.tier .featured-badge {
  position: absolute; top: 28px; right: 28px;
  font-size: 10.5px; font-weight: 600;
  background: rgba(var(--accent-rgb),0.18); color: var(--accent-2);
  padding: 3px 8px; border-radius: 4px; letter-spacing: 0.04em;
}
.tier .price-row {
  display: flex; align-items: baseline; gap: 8px;
  margin: 22px 0 4px;
}
.tier .price {
  font-size: 44px; font-weight: 600; letter-spacing: -0.04em;
  font-feature-settings: "tnum";
}
.tier .price-unit { color: var(--text-dim); font-size: 14px; }
.tier .sub { font-size: 12.5px; color: var(--text-dim); }
.tier .cta { margin-top: 24px; }
.tier .cta button { width: 100%; justify-content: center; }
.tier .feat-list {
  list-style: none; padding: 0;
  margin: 28px 0 0;
  display: grid; gap: 14px;
}
.tier .feat-list li {
  display: flex; gap: 10px;
  font-size: 13.5px;
  color: var(--text-soft);
  align-items: flex-start;
}
.tier .feat-list li .check {
  width: 16px; height: 16px;
  flex: none; margin-top: 3px;
  color: var(--text-dim);
}
.tier.featured .feat-list li .check { color: var(--accent-2); }
.tier .feat-list .head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  padding-top: 6px;
  border-top: 1px solid var(--divider);
}

/* extras row */
.extras-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}
.extra-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px;
  display: flex; align-items: center; gap: 24px;
}
.extra-card .icn {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  flex: none;
}
.extra-card .copy { flex: 1; }
.extra-card .ttl { font-size: 15px; font-weight: 600; }
.extra-card .d { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.extra-card .price { font-family: var(--font-mono); font-size: 13px; color: var(--text); margin-top: 8px; }

/* compare table */
.compare {
  margin-top: 80px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.compare-row {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--divider);
  font-size: 13.5px;
}
.compare-row:last-child { border-bottom: none; }
.compare-row.head {
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 12px 24px;
}
.compare-row .label { color: var(--text); }
.compare-row .v { color: var(--text-soft); text-align: center; }
.compare-row .v .check { color: var(--accent-fresh); }
.compare-row .v .x { color: var(--text-faint); }
.compare-section {
  background: var(--bg-soft);
  padding: 10px 24px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--divider);
}

/* ─── FAQ ─────────────────────────── */
.faq-page {
  position: relative;
}
.faq-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 48px;
}
.faq-tabs button {
  height: 32px; padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12.5px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.faq-tabs button.active {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text);
}
.faq-list { max-width: 760px; margin: 0 auto; }
.faq-list details {
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
}
.faq-list summary {
  list-style: none;
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 16px; font-weight: 500;
  color: var(--text);
  letter-spacing: -0.015em;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary .ctrl {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 14px;
  color: var(--text-dim);
  transition: transform .2s;
}
.faq-list details[open] summary .ctrl { transform: rotate(45deg); color: var(--text); }
.faq-list .body {
  padding-top: 14px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.65;
  max-width: 640px;
}
.faq-list .body a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }

/* ─── SETTINGS ─────────────────────────── */
.settings {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - var(--nav-h));
  align-items: stretch;
}
.settings .s-side {
  border-right: 1px solid var(--border);
  padding: 28px 18px;
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.settings .s-side h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin: 24px 0 8px;
  font-weight: 500;
}
.settings .s-side h4:first-child { margin-top: 0; }
.s-side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  margin: 0 -6px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
}
.s-side-item:hover { background: var(--surface-2); }
.s-side-item.active { background: var(--surface-2); color: var(--text); }
.s-side-item .ic { color: var(--text-dim); }
.s-side-item.active .ic { color: var(--text); }
.s-side-item .badge-soon { margin-left: auto; }

.settings .s-main {
  padding: 48px 56px 100px;
  max-width: 780px;
  width: 100%;
}
.s-pageHead {
  display: flex; align-items: end; justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.s-pageHead h1 { font-size: 26px; font-weight: 600; margin: 0; letter-spacing: -0.025em; }
.s-pageHead .desc { color: var(--text-dim); font-size: 13.5px; margin-top: 6px; max-width: 480px; }

.s-section { margin-top: 36px; }
.s-section h3 { font-size: 14px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.005em; }
.s-section .sec-desc { color: var(--text-dim); font-size: 12.5px; margin: 0 0 18px; }

.s-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--divider);
}
.s-row:first-child { border-top: none; padding-top: 4px; }
.s-row .row-label { font-size: 13.5px; }
.s-row .row-hint { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.s-row .row-control { display: flex; align-items: center; gap: 10px; }

.s-input, .s-select {
  height: 32px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text);
  min-width: 220px;
}

.s-switch {
  width: 36px; height: 20px;
  background: var(--surface-3);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background .15s;
  flex: none;
}
.s-switch::after {
  content: ""; position: absolute;
  width: 14px; height: 14px;
  background: var(--text-dim);
  border-radius: 50%;
  top: 2px; left: 3px;
  transition: left .15s, background .15s;
}
.s-switch[data-on="1"] { background: var(--accent); border-color: var(--accent); }
.s-switch[data-on="1"]::after { left: 18px; background: white; }

.s-segmented {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 2px;
}
.s-segmented button {
  border: none; background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 5px;
  white-space: nowrap;
}
.s-segmented button.active { background: var(--surface-3); color: var(--text); }

.s-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6E73E6, #2A2D38);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 18px;
  color: white;
}

.kbd-row {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 10px 0;
  border-top: 1px solid var(--divider);
  font-size: 13px;
  align-items: center;
}
.kbd-row:first-child { border-top: none; }
.kbd-row .keys { display: flex; gap: 4px; }
.kbd-row .keys kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-soft);
}

.usage-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.usage-bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
