:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-subtle: #f0eee8;
  --border: #dcd8ce;
  --border-strong: #57534e;
  --text: #14171f;
  --muted: #57534e;
  --primary: #14171f;
  --accent: #d97706;
  --accent-soft: #fef3c7;
  --accent-text: #92400e;
  --safe: #0f766e;
  --danger-text: #b91c1c;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(20, 23, 31, 0.05);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pe-container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.pe-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.pe-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.pe-brand-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.pe-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.pe-brand:hover {
  text-decoration: none;
}

.pe-brand .gf-site-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: block;
}

.pe-brand-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--safe);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.pe-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  font-weight: 600;
}

.pe-nav a {
  color: var(--muted);
  padding: 8px 2px;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.pe-nav a:hover,
.pe-nav a[aria-current='page'] {
  color: var(--text);
  text-decoration: none;
}

.pe-nav a[aria-current='page'] {
  border-bottom-color: var(--accent);
}

/* Main Hero & Split Header */
.pe-main {
  padding: 32px 0 64px;
}

.pe-hero {
  margin-bottom: 20px;
}

.pe-hero-split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
}

.pe-hero-main {
  max-width: 66ch;
}

.pe-eyebrow {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-text);
}

.pe-hero h1 {
  margin: 0 0 8px;
  font-size: 36px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

.pe-lead {
  margin: 0;
  max-width: 66ch;
  font-size: 16px;
  color: var(--muted);
}

.pe-cross-bar {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.pe-cross-bar a {
  font-weight: 600;
}

/* Technical Ledger Workbench Shell */
.pe-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.pe-inst-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  padding: 8px 16px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.pe-inst-caveat {
  color: var(--muted);
}

.pe-inst-live {
  color: var(--safe);
  font-weight: 600;
}

.pe-bench-split {
  display: grid;
  grid-template-columns: minmax(0, 7.5fr) minmax(0, 4.5fr);
}

.pe-drop-bay {
  min-width: 0;
  padding: 24px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.pe-dropzone {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 24px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.pe-dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pe-drop-title {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
}

.pe-drop-sub {
  margin: 0 0 16px;
  max-width: 58ch;
  font-size: 14px;
  color: var(--muted);
}

.pe-drop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pe-drop-aux {
  margin-top: 12px;
}

.pe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.pe-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pe-btn-primary {
  background: var(--primary);
  color: var(--surface);
}

.pe-btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.pe-btn-accent {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.pe-btn-accent:hover:not(:disabled) {
  background: var(--surface);
}

.pe-btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.pe-btn-secondary:hover:not(:disabled) {
  background: var(--surface-subtle);
}

.pe-btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.pe-btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface);
}

.pe-btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

.pe-status {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* Right Toned-Down Spec Panel */
.pe-anatomy-panel {
  min-width: 0;
  padding: 20px;
  background: var(--bg);
}

.pe-anatomy-details {
  margin: 0;
}

.pe-anatomy-title {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.pe-anatomy-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pe-guard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.pe-guard-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.pe-guard-list strong {
  color: var(--text);
  font-weight: 600;
}

.pe-cap-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.pe-error {
  margin: 16px 24px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--danger-text);
  color: var(--danger-text);
  font-size: 14px;
}

/* Loaded Workspace Area */
.pe-workspace {
  padding: 24px;
  border-top: 1px solid var(--border);
}

.pe-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.pe-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.pe-stat-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.pe-stat-val {
  display: block;
  font-size: 16px;
  font-family: var(--font-mono);
  color: var(--text);
  word-break: break-word;
}

.pe-export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  margin-bottom: 16px;
}

.pe-export-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.pe-opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

.pe-opt select {
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.pe-check {
  cursor: pointer;
  font-weight: 500;
}

.pe-col-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--surface);
}

.pe-col-picker summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.pe-col-picker-actions {
  display: inline-flex;
  gap: 12px;
}

.pe-viewer-export {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  background: var(--bg);
}

.pe-viewer-export > summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.pe-viewer-export-body {
  margin-top: 12px;
}

.pe-viewer-export-body .pe-export-bar {
  margin-bottom: 0;
}

.pe-link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pe-link-btn:hover {
  color: var(--text);
}

.pe-col-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pe-col-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 14px;
  cursor: pointer;
}

.pe-col-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}

.pe-type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

/* Tabs & Tables */
.pe-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.pe-tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.pe-tab.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.pe-tab-spacer {
  flex: 1;
}

.pe-search {
  min-width: 220px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
}

.pe-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.pe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

.pe-table th,
.pe-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: nowrap;
}

.pe-table th {
  background: var(--surface-subtle);
  font-weight: 600;
  color: var(--text);
}

.pe-th-name {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 4px;
}

.pe-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.pe-row-num {
  color: var(--muted);
}

.pe-null {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.pe-empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 24px 12px;
}

.pe-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

.pe-pager-btns {
  display: flex;
  gap: 8px;
}

.pe-meta-list {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 8px 16px;
  margin: 16px 0 0;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}

.pe-meta-list dt {
  font-weight: 600;
  color: var(--muted);
}

.pe-meta-list dd {
  margin: 0;
  word-break: break-word;
}

.pe-pro-probe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
}

.pe-pro-msg {
  color: var(--safe);
  font-weight: 600;
}

/* Content Sections (Varied rhythm) */
.pe-section {
  margin-top: 48px;
}

.pe-section h2 {
  margin: 0 0 16px;
  font-size: 28px;
  line-height: 1.2;
  color: var(--text);
}

.pe-section h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.3;
}

.pe-prose {
  margin: 0 0 16px;
  max-width: 70ch;
  color: var(--muted);
}

.pe-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.pe-steps li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.pe-step-num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.pe-steps p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.pe-compat-table td {
  white-space: normal;
}

.pe-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.pe-asymmetric-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
}

.pe-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.pe-card p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.pe-code-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.pe-compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.pe-code-wrap {
  position: relative;
  margin-top: 12px;
}

.pe-code {
  margin: 0;
  padding: 12px 72px 12px 12px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
}

.pe-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pe-copy-btn:hover {
  background: var(--surface-subtle);
}

.pe-copy-btn.is-copied {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.pe-card p.pe-code-note {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

.pe-code-cta,
.pe-compare-summary {
  margin-top: 16px;
  margin-bottom: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* FAQ Accordion */
.pe-faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 72ch;
}

.pe-faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.pe-faq-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.pe-faq-item p {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* Legal Prose */
.pe-legal-prose {
  max-width: 70ch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.pe-legal-prose h2 {
  margin: 24px 0 8px;
  font-size: 22px;
}

.pe-legal-prose h2:first-child {
  margin-top: 0;
}

.pe-legal-prose p {
  margin: 0 0 12px;
  color: var(--muted);
}

/* Footer */
.pe-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 32px 0;
  font-size: 14px;
  color: var(--muted);
}

.pe-footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.pe-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.pe-footer-disclaimer {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  max-width: 84ch;
}

@media (max-width: 640px) {
  .pe-container {
    padding: 0 16px;
  }
  .pe-header-inner {
    flex-wrap: wrap;
    min-height: 48px;
    padding: 6px 0;
    gap: 8px;
  }
  .pe-brand {
    font-size: 16px;
    gap: 6px;
  }
  .pe-brand .gf-site-icon {
    width: 24px;
    height: 24px;
  }
  .pe-brand-badge {
    display: none;
  }
  .pe-nav {
    gap: 10px;
    font-size: 12px;
  }
  .pe-main {
    padding: 16px 0 48px;
  }
  .pe-hero {
    margin-bottom: 12px;
  }
  .pe-eyebrow {
    margin-bottom: 4px;
  }
  .pe-hero h1 {
    font-size: 28px;
    margin-bottom: 6px;
  }
  .pe-lead {
    font-size: 14px;
    line-height: 1.45;
  }
  .pe-cross-bar {
    font-size: 14px;
  }
  .pe-inst-strip {
    padding: 6px 12px;
  }
  .pe-inst-caveat {
    display: none;
  }
  .pe-bench-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .pe-drop-bay {
    padding: 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    gap: 8px;
  }
  .pe-dropzone {
    padding: 16px;
  }
  .pe-drop-title {
    font-size: 18px;
    margin-bottom: 6px;
  }
  .pe-drop-sub {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 12px;
  }
  .pe-drop-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .pe-anatomy-panel {
    padding: 12px 16px;
  }
  .pe-workspace {
    padding: 16px;
  }
  .pe-export-cta {
    width: 100%;
  }
  .pe-export-cta .pe-btn {
    width: 100%;
  }
  .pe-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pe-steps,
  .pe-split-grid,
  .pe-asymmetric-grid,
  .pe-compare-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .pe-meta-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .pe-search {
    width: 100%;
    min-width: 0;
  }
}
