:root {
  --at-ink: #11181c;
  --at-muted: #56636b;
  --at-line: #cbd5d8;
  --at-soft: #f3f7f6;
  --at-accent: #0f766e;
  --at-blue: #1d4ed8;
  --at-gold: #9a5a08;
  --at-danger: #9f1239;
}

* { box-sizing: border-box; }

.at-page { min-width: 0; color: var(--at-ink); background: #fff; }
.at-page h1, .at-page h2, .at-page h3, .at-page p { letter-spacing: 0; }
.at-hero { padding: 34px 0 26px; border-bottom: 1px solid var(--at-line); background: #eaf3f0; }
.at-hero-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(310px, 460px); gap: 32px; align-items: end; }
.at-hero h1 { margin: 8px 0 12px; max-width: 18ch; font-size: clamp(36px, 5vw, 66px); line-height: 1; }
.at-hero p { max-width: 72ch; margin: 0; color: #334047; font-size: 17px; line-height: 1.6; }
.at-control { display: grid; gap: 8px; }
.at-control label { font-weight: 750; font-size: 14px; }
.at-select { width: 100%; min-height: 46px; padding: 10px 38px 10px 12px; border: 1px solid #7e9199; border-radius: 6px; background: #fff; color: var(--at-ink); font: inherit; }
.at-control-note { font-size: 13px !important; color: var(--at-muted) !important; }
.at-control-note a { font-weight: 750; }

.at-workspace { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(290px, .7fr); min-height: 680px; }
.at-main { min-width: 0; padding: 30px clamp(20px, 4vw, 58px) 48px max(20px, calc((100vw - 1240px) / 2)); }
.at-side { min-width: 0; padding: 30px max(20px, calc((100vw - 1240px) / 2)) 48px 28px; border-left: 1px solid var(--at-line); background: var(--at-soft); }
.at-chart-head h2 { margin: 0; font-size: 28px; line-height: 1.15; }
.at-chart-head p { margin: 8px 0 0; color: var(--at-muted); line-height: 1.55; }
.at-takeaway { margin: 20px 0; padding: 14px 16px; border-left: 4px solid var(--at-accent); background: #edf8f4; font-weight: 700; line-height: 1.5; }
.at-figure { margin: 0; min-width: 0; }
.at-figure img { display: block; width: 100%; height: auto; max-height: 720px; object-fit: contain; object-position: left top; border: 1px solid var(--at-line); background: #fff; }
.at-figure figcaption { margin-top: 9px; color: var(--at-muted); font-size: 13px; line-height: 1.5; }

.at-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.at-btn { min-height: 40px; padding: 8px 12px; border: 1px solid #7e9199; border-radius: 6px; background: #fff; color: var(--at-ink); font: 700 14px/1.1 inherit; cursor: pointer; }
.at-btn:hover { border-color: var(--at-accent); color: var(--at-accent); }
.at-btn.at-primary { border-color: var(--at-ink); background: var(--at-ink); color: #fff; }
.at-btn:focus-visible, .at-select:focus-visible, .at-side a:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }

.at-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--at-line); }
.at-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
.at-table th, .at-table td { padding: 10px 12px; border-bottom: 1px solid #dbe3e5; text-align: left; vertical-align: top; }
.at-table thead th { position: sticky; top: 0; background: #e9efee; color: #334047; font-size: 12px; text-transform: uppercase; }
.at-table tbody th { max-width: 240px; font-weight: 750; }
.at-table tbody tr:last-child > * { border-bottom: 0; }
.at-value { white-space: nowrap; font-weight: 800; }

.at-side section { padding: 0 0 22px; margin: 0 0 22px; border-bottom: 1px solid var(--at-line); }
.at-side section:last-child { border-bottom: 0; }
.at-side h2 { margin: 0 0 12px; font-size: 18px; }
.at-side h3 { margin: 16px 0 6px; font-size: 14px; }
.at-side p { margin: 0; color: #334047; line-height: 1.55; overflow-wrap: anywhere; }
.at-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--at-line); background: var(--at-line); }
.at-meta div { min-width: 0; padding: 12px; background: #fff; }
.at-meta strong { display: block; margin-bottom: 4px; font-size: 20px; }
.at-meta span { color: var(--at-muted); font-size: 12px; overflow-wrap: anywhere; }
.at-code { padding: 12px; border: 1px solid var(--at-line); background: #fff; color: #29353b; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.at-source-list { display: grid; gap: 8px; }
.at-source-list a { color: #0b5c56; font-weight: 700; }
.at-boundary { padding: 12px; border-left: 4px solid var(--at-gold); background: #fff8e8; }
.at-status { position: fixed; left: 50%; bottom: 20px; z-index: 20; transform: translateX(-50%); width: min(92vw, 560px); min-height: 0; padding: 0; text-align: center; }
.at-status:not(:empty) { padding: 10px 14px; border: 1px solid #1f2937; border-radius: 6px; background: #111827; color: #fff; }

@media (max-width: 880px) {
  .at-hero-inner, .at-workspace { grid-template-columns: 1fr; }
  .at-side { padding: 28px 20px 40px; border-top: 1px solid var(--at-line); border-left: 0; }
  .at-main { padding: 26px 20px 38px; }
}

@media (max-width: 520px) {
  .at-hero { padding: 24px 0 20px; }
  .at-hero-inner { gap: 22px; }
  .at-hero h1 { font-size: 40px; }
  .at-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .at-btn { width: 100%; }
  .at-meta { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  header, footer, .at-hero .at-control, .at-actions, .at-status { display: none !important; }
  .at-hero { padding: 0 0 16px; background: #fff; }
  .at-workspace { display: block; }
  .at-main, .at-side { padding: 18px 0; border: 0; background: #fff; }
  .at-figure img, .at-table-wrap { border-color: #555; }
  .at-table { min-width: 0; font-size: 10px; }
  .at-table th, .at-table td { padding: 5px; }
  .at-side section { break-inside: avoid; }
}
