/* ==========================================================================
   kanripress-vitals — Frontend styles
   Stripe-inspired Environmental Green Theme
   (準拠: kanripress-cdn-v2/design.md)
   フォントは OS 標準スタックを直接使用 (Google Fonts CDN を排除して
   LP レンダリング速度を優先)。同一オリジン 1 本のみで render-block する。
   ========================================================================== */

/* --- 1. Design Tokens --------------------------------------------------- */
:root {
  /* Green palette */
  --kp-green-50:  #f0fdf4;
  --kp-green-100: #dcfce7;
  --kp-green-200: #bbf7d0;
  --kp-green-300: #86efac;
  --kp-green-400: #4ade80;
  --kp-green-500: #22c55e;
  --kp-green-600: #16a34a;
  --kp-green-700: #15803d;
  --kp-green-800: #166534;
  --kp-green-900: #14532d;
  --kp-green-950: #052e16;

  /* Semantic: primary */
  --color-primary:       var(--kp-green-700);
  --color-primary-hover: var(--kp-green-800);
  --color-primary-light: var(--kp-green-100);
  --color-primary-bg:    var(--kp-green-50);

  /* Semantic: text — WCAG AA on white. Body は AAA (~10:1)、muted は AA (~7:1)。 */
  --color-heading: var(--kp-green-950);
  --color-label:   var(--kp-green-900);
  --color-body:    #334155;
  --color-muted:   #475569;

  /* Semantic: surface / border */
  --color-bg:           #ffffff;
  --color-surface:      #f8faf9;
  --color-border:       #e2e8f0;
  --color-border-green: #d1e7d8;
  --color-border-focus: var(--kp-green-400);

  /* Status */
  --color-success:        #22c55e;
  --color-success-text:   #15803d;
  --color-success-bg:     rgba(34,197,94,0.12);
  --color-success-border: rgba(34,197,94,0.3);

  --color-warning:        #f59e0b;
  --color-warning-text:   #92400e;
  --color-warning-bg:     rgba(245,158,11,0.12);
  --color-warning-border: rgba(245,158,11,0.3);

  --color-danger:        #ef4444;
  --color-danger-hover:  #dc2626;
  --color-danger-text:   #b91c1c;
  --color-danger-bg:     rgba(239,68,68,0.08);

  /* Shadows (green-tinted) */
  --shadow-xs: 0 1px 2px rgba(5,46,22,0.05);
  --shadow-sm: 0 1px 3px rgba(5,46,22,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(5,46,22,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 40px -20px rgba(5,46,22,0.18), 0 12px 24px -12px rgba(0,0,0,0.05);

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h:  56px;

  /* Motion */
  --ease-fast: 150ms ease;
  --ease-base: 200ms ease;

  /* Typography (OS 標準スタック; Inter Google Fonts は意図的に排除) */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
               "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans JP",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

/* prefers-reduced-motion: アニメーション・トランジションを実質的に無効化 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- 2. Base ------------------------------------------------------------ */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-body);
  background: var(--color-surface);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* --- 3. Accessibility --------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px; top: 0;
  z-index: 1000;
  padding: 8px 16px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 500;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.skip-link:focus { left: 50%; transform: translateX(-50%); }

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}
.form-input:focus-visible,
.form-textarea:focus-visible,
.form-select:focus-visible {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(21,128,61,0.25);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* --- 4. App Layout ------------------------------------------------------ */
.app-layout { display: flex; min-height: 100vh; }

/* --- 5. Sidebar --------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--color-bg);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform var(--ease-base);
}

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  min-height: var(--topbar-h);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-heading);
  font-weight: 500;
  font-size: 0.9375rem;
  letter-spacing: -0.02em;
}
.logo svg { flex-shrink: 0; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }

.nav-section-label {
  padding: 18px 20px 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-body);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  margin: 1px 8px;
  border-radius: var(--radius-md);
  color: var(--color-body);
  text-decoration: none;
  font-size: 0.9375rem;
  min-height: 40px;
  transition: background var(--ease-fast), color var(--ease-fast);
}
.sidebar-nav a:hover {
  background: var(--color-primary-bg);
  color: var(--color-heading);
  text-decoration: none;
}
.sidebar-nav a.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 500;
}
.sidebar-nav a .nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.6; }
.sidebar-nav a.active .nav-icon { opacity: 1; }

.nav-divider {
  height: 1px;
  margin: 12px 16px;
  background: var(--color-border);
}

.nav-admin-badge {
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
  letter-spacing: 0.04em;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--color-border);
  font-size: 0.8125rem;
  color: var(--color-body);
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--color-heading);
  border-radius: var(--radius-sm);
}
.sidebar-toggle:hover { background: var(--color-primary-bg); }

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 18px; height: 2px;
  background: currentColor;
  border-radius: 1px;
}
.hamburger { position: relative; }
.hamburger::before, .hamburger::after { content: ''; position: absolute; left: 0; }
.hamburger::before { top: -6px; }
.hamburger::after  { top:  6px; }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(5,46,22,0.3);
  z-index: 35;
}

/* --- 6. Main Wrapper / Topbar ------------------------------------------ */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0; z-index: 30;
  background: rgba(248,250,249,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  padding: 0 32px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar h1 {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--color-heading);
  letter-spacing: -0.01em;
  margin: 0;
}

.main-content {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px 48px;
}

/* --- 7. Typography ------------------------------------------------------ */
h1, h2, h3, h4 {
  color: var(--color-heading);
  letter-spacing: -0.01em;
  margin: 0;
}
h2, .heading-section {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
h3, .heading-sub {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
}

.text-muted { color: var(--color-muted); }
.text-body  { color: var(--color-body); }
.text-sm    { font-size: 0.875rem; }
.text-xs    { font-size: 0.8125rem; }
.text-mono  { font-family: var(--font-mono); }

.lead {
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--color-body);
  max-width: 60ch;
}
.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.3;
}
.page-header .meta {
  font-size: 0.875rem;
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}

/* --- 8. Cards ---------------------------------------------------------- */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.card-header { padding: 20px 24px 0; }
.card-title {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--color-heading);
  margin: 0;
}
.card-description {
  display: block;
  font-size: 0.9375rem;
  color: var(--color-body);
  margin-top: 4px;
  line-height: 1.55;
}
.card-body { padding: 16px 24px 24px; }
.card-body:first-child { padding-top: 24px; }
.card-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-size: 0.875rem;
  color: var(--color-body);
}

/* --- 9. Metric Cards --------------------------------------------------- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.metric-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
}
.metric-label {
  font-size: 0.9375rem;
  color: var(--color-body);
}
.metric-value {
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--color-heading);
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-feature-settings: "tnum";
  margin-top: 6px;
}
.metric-detail {
  font-size: 0.875rem;
  color: var(--color-body);
  margin-top: 4px;
}

/* --- 10. Buttons -------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--ease-fast), box-shadow var(--ease-fast);
  /* btn-block (width:100%) のとき、padding が親の content area からはみ出ない
     ようにする (content-box デフォルトだと padding が幅に加算されて border を
     越える)。 */
  box-sizing: border-box;
}
.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-sm);
  color: #fff;
  text-decoration: none;
}
.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-border-green);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--color-primary-bg);
  border-color: var(--color-primary);
  text-decoration: none;
}
.btn-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover:not(:disabled) {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}
.btn-sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 0.875rem;
}
.btn-block { width: 100%; }

/* --- 11. Forms ---------------------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-label);
  margin-bottom: 6px;
}
.form-hint {
  display: block;
  font-size: 0.875rem;
  color: var(--color-body);
  margin-top: 6px;
  line-height: 1.55;
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.4;
  color: var(--color-heading);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
}
.form-input,
.form-select { height: 40px; }
.form-textarea { padding: 8px 12px; line-height: 1.5; min-height: 80px; resize: vertical; }
.form-input::placeholder,
.form-textarea::placeholder { color: var(--color-muted); }
.form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.form-row .form-input { flex: 1; }

/* --- 12. Tables --------------------------------------------------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-body);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  white-space: nowrap;
}
.data-table td {
  padding: 18px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-heading);
  font-feature-settings: "tnum";
  vertical-align: top;
  line-height: 1.55;
}
.data-table.data-table-middle td { vertical-align: middle; }
.data-table.data-table-tight th { padding: 8px 10px; font-size: 0.75rem; }
.data-table.data-table-tight td { padding: 8px 10px; font-size: 0.8125rem; line-height: 1.4; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--color-primary-bg); }
.data-table tfoot td {
  border-top: 1px solid var(--color-border);
  border-bottom: none;
}

/* --- 13. Badges --------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border: 1px solid var(--color-success-border);
}
.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
  border: 1px solid var(--color-warning-border);
}
.badge-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  border: 1px solid rgba(239,68,68,0.2);
}
.badge-neutral {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* Score dot for vital indicators */
.score-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
}
.score-dot.good { background: var(--color-success); }
.score-dot.needs { background: var(--color-warning); }
.score-dot.poor { background: var(--color-danger); }

/* --- 14. Code ----------------------------------------------------------- */
pre {
  background: var(--kp-green-950);
  color: #e2e8f0;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  box-shadow: var(--shadow-md);
  margin: 0;
}
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
}
:not(pre) > code {
  background: var(--color-primary-bg);
  color: var(--color-primary-hover);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.85em;
}

/* --- 15. Plan Grid (design.md §9.2) ------------------------------------ */
/* design.md §1.5 アンチパターン: Lism `l--grid` の `--cols` 変数禁止 →
   生 CSS Grid を専用クラスで書く。 */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}
.plan-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1080px) {
  .plan-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .plan-grid,
  .plan-grid-3 { grid-template-columns: 1fr; }
}

.plan-card {
  position: relative;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: transform var(--ease-base), box-shadow var(--ease-base), border-color var(--ease-base);
}
.plan-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-green);
}
.plan-card.is-recommended:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px -12px rgba(21,128,61,0.35), var(--shadow-md);
}

.plan-card-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plan-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-heading);
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.3;
}
.plan-card-pitch {
  font-size: 0.875rem;
  color: var(--color-body);
  line-height: 1.55;
  margin: 0;
  min-height: 2.6em;
}

/* Hero price block: amount on top, unit below. */
.plan-price {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0 8px;
  border-top: 1px solid var(--color-border);
}
.plan-card.is-recommended .plan-price {
  border-top-color: var(--color-border-green);
}
.plan-price-amount {
  font-size: 2.625rem;
  font-weight: 600;
  color: var(--color-heading);
  font-feature-settings: "tnum";
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-top: 18px;
}
.plan-price-unit {
  font-size: 0.8125rem;
  color: var(--color-muted);
  letter-spacing: 0.01em;
  font-weight: 500;
}
.plan-price-pending {
  font-style: italic;
  color: var(--color-muted);
  font-size: 0.9375rem;
  margin-top: 18px;
}

/* プラン条件 (基本枠 / 超過 / 月額固定費 等) を簡潔な bullet で表示 */
.plan-bullets {
  list-style: none;
  margin: 0;
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.875rem;
  color: var(--color-heading);
}
.plan-card.is-recommended .plan-bullets {
  border-color: var(--color-border-green);
}
.plan-bullets li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.plan-bullet-icon {
  width: 8px;
  height: 8px;
  color: var(--color-primary);
  flex-shrink: 0;
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.plan-features li {
  font-size: 0.9375rem;
  line-height: 1.5;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--color-body);
}
.plan-feature-check {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Pricing card subscribe CTA — カード境界内に完全に収まるよう設計。
   ドロップシャドウやアニメーションでカード境界を越えないこと。
   形状はカード本体 (radius-lg 8px) と整合する角丸長方形。 */
.plan-cta {
  margin-top: auto;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius-md);
  padding: 0 20px;
  box-shadow: none;
  transition: background var(--ease-fast);
}
.plan-cta:hover:not(:disabled) {
  background: var(--color-primary-hover);
  box-shadow: none;
}

/* --- 15.5. Public LP (home / marketing) -------------------------------- */
.public-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.public-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
.public-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.public-header .logo svg { color: var(--color-primary); }
.public-header-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}
.public-header-nav a:not(.btn) {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-body);
  text-decoration: none;
}
.public-header-nav a:not(.btn):hover {
  color: var(--color-heading);
  text-decoration: none;
}
.public-header-nav .btn { font-size: 0.875rem; }

.public-main {
  flex: 1;
  width: 100%;
  /* セクション側で max-width / padding を持つので main 側はノークロップ */
}

/* LP セクション: 全幅背景 + 内側最大幅コンテナ。背景を交互で視覚的リズム。 */
.lp-section {
  padding: 88px 24px;
  background: var(--color-bg);
}
.lp-section-alt {
  background: var(--color-surface);
}
.lp-section-hero {
  padding: 80px 24px 88px;
  background:
    radial-gradient(ellipse 1100px 480px at 20% 0%, var(--color-primary-bg), transparent 60%),
    var(--color-bg);
}
.lp-inner {
  max-width: 1180px;
  margin: 0 auto;
}

/* Hero (2-column) */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
}
.hero-text { max-width: 560px; }
.hero-text h1 {
  font-size: 2.625rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.18;
  margin: 0;
  color: var(--color-heading);
}
@media (max-width: 920px) {
  .hero-text h1 { font-size: 2.125rem; }
}
.hero-text .lead { margin: 20px 0 0; }
.hero-cta {
  display: inline-flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.hero-bullets {
  margin-top: 24px;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--color-body);
}
.hero-bullets > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hero-bullets svg { width: 12px; height: 12px; color: var(--color-primary); flex-shrink: 0; }

.hero-visual { display: flex; flex-direction: column; gap: 12px; }
.hero-visual-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--color-muted);
  align-self: flex-start;
}
.hero-visual-note svg { width: 14px; height: 14px; color: var(--color-primary); flex-shrink: 0; }

/* Code preview card (Mac terminal風) */
.code-card {
  background: var(--kp-green-950);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  font-family: var(--font-mono);
}
.code-card-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  background: rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: relative;
}
.code-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.code-dot-r { background: #ff5f57; }
.code-dot-y { background: #febc2e; }
.code-dot-g { background: #28c840; }
.code-card-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(226,232,240,0.65);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.code-card-body {
  margin: 0;
  padding: 20px 22px;
  background: transparent;
  color: #e2e8f0;
  font-size: 0.8125rem;
  line-height: 1.75;
  overflow-x: auto;
  white-space: pre;
  box-shadow: none;
  border-radius: 0;
}

.section-title {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 40px;
}
.section-title h2 {
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.3;
  margin: 0;
  color: var(--color-heading);
}
.section-title .lead { margin: 14px auto 0; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  max-width: 980px;
  margin: 0 auto;
}
@media (max-width: 720px) {
  .features-grid { grid-template-columns: 1fr; }
}
.feature-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  transition: transform var(--ease-base), box-shadow var(--ease-base), border-color var(--ease-base);
}
.feature-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-green);
}
.lp-section-alt .feature-item {
  background: var(--color-bg);
}
.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 4px;
}
.feature-icon svg { width: 20px; height: 20px; }
.feature-item h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-heading);
  letter-spacing: -0.01em;
  line-height: 1.4;
  margin: 0;
}
.feature-item p {
  font-size: 0.9375rem;
  color: var(--color-body);
  line-height: 1.65;
  margin: 0;
}

.faq-list {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.faq-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--color-heading);
  font-size: 1rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '＋';
  color: var(--color-primary);
  font-weight: 400;
  font-size: 1.25rem;
  transition: transform var(--ease-fast);
}
.faq-item[open] summary::after { content: '−'; }
.faq-item p {
  font-size: 0.9375rem;
  color: var(--color-body);
  line-height: 1.7;
  margin-top: 12px;
}

/* PSI vs Vitals 比較テーブル */
.compare-table-wrap {
  max-width: 980px;
  margin: 0 auto 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-sm);
}
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  min-width: 600px;
}
.compare-table thead th {
  font-weight: 600;
  color: var(--color-heading);
  background: var(--color-surface);
  padding: 16px 18px;
  text-align: left;
  border-bottom: 2px solid var(--color-border);
  font-size: 0.875rem;
}
.compare-table thead th.compare-col-vitals-h {
  background: var(--color-primary);
  color: #fff;
  border-bottom-color: var(--color-primary);
}
.compare-table tbody th,
.compare-table tbody td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.compare-table tbody tr:last-child th,
.compare-table tbody tr:last-child td { border-bottom: 0; }
.compare-table tbody th {
  font-weight: 500;
  color: var(--color-label);
  width: 22%;
  white-space: nowrap;
}
.compare-row-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  margin-right: 10px;
  vertical-align: -4px;
  color: var(--color-primary);
}
.compare-row-icon svg { width: 100%; height: 100%; }
.compare-table .col-vitals {
  background: var(--color-primary-bg);
  color: var(--color-heading);
  font-weight: 500;
}
.compare-check {
  display: inline-block;
  width: 16px;
  height: 16px;
  color: var(--color-primary);
  margin-right: 6px;
  vertical-align: -3px;
}
.compare-note {
  text-align: center;
  max-width: 720px;
  margin: 24px auto 0;
}

/* How-it-works (3 ステップ) */
.howto-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0;
}
@media (max-width: 880px) {
  .howto-list { grid-template-columns: 1fr; }
}
.howto-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.howto-step {
  display: inline-flex;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-feature-settings: "tnum";
  box-shadow: 0 2px 6px rgba(21, 128, 61, 0.2);
}
.howto-item h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-heading);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.howto-item p {
  font-size: 0.9375rem;
  color: var(--color-body);
  line-height: 1.65;
  margin: 0;
}
.howto-item :not(pre) > code {
  font-size: 0.8125rem;
}

/* Howto step inline code block (step 1 のスニペット表示) */
.howto-code {
  margin: 16px 0 0;
  background: var(--kp-green-950);
  color: #e2e8f0;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  line-height: 1.7;
  overflow-x: auto;
  font-family: var(--font-mono);
  white-space: pre;
  box-shadow: none;
}

/* Howto step illustrations (step 2: data flow / step 3: tiny chart) */
.howto-illust {
  margin-top: auto;
  padding-top: 24px;
  height: 70px;
  display: flex;
  align-items: center;
}
.howto-illust-flow {
  gap: 14px;
  justify-content: center;
}
.howto-flow-pip {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0.35;
  animation: hflow 1.4s ease-in-out infinite;
}
.howto-flow-pip:nth-child(2) { animation-delay: 0.13s; }
.howto-flow-pip:nth-child(3) { animation-delay: 0.26s; }
.howto-flow-pip:nth-child(4) { animation-delay: 0.39s; }
.howto-flow-pip:nth-child(5) { animation-delay: 0.52s; }
.howto-flow-pip:nth-child(6) { animation-delay: 0.65s; }
@keyframes hflow {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.3); }
}
.howto-illust-chart {
  color: var(--color-primary);
  width: 100%;
}
.howto-illust-chart svg { display: block; width: 100%; }

.public-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  padding: 28px 32px;
}
.public-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--color-muted);
}
.public-footer a { color: var(--color-body); text-decoration: none; }
.public-footer a:hover { text-decoration: underline; color: var(--color-primary); }
.public-footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

/* おすすめプランの強調 (home / marketing 限定 — design.md §9.2.C)
   - 上端に primary 緑のアクセントストライプ (4px) を生やして注目を集める
   - border は 2px primary、shadow は強めに */
.plan-card.is-recommended {
  border: 2px solid var(--color-primary);
  background:
    linear-gradient(180deg, var(--color-primary-bg) 0%, transparent 80px),
    var(--color-bg);
  box-shadow: 0 12px 32px -12px rgba(21,128,61,0.28), var(--shadow-md);
  position: relative;
}
.plan-card.is-recommended::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  height: 4px;
  background: var(--color-primary);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}
.plan-ribbon {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 18px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  box-shadow: 0 6px 16px rgba(21,128,61,0.3);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .public-main { padding: 40px 16px 60px; }
  .public-header-inner { padding: 12px 16px; }
  .hero h1 { font-size: 1.75rem; }
  .section-title h2 { font-size: 1.5rem; }
}

/* --- 16. Page-specific: snippet copy box ------------------------------- */
.snippet-block {
  background: var(--kp-green-950);
  color: #e2e8f0;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  overflow-x: auto;
  position: relative;
}
.snippet-copy {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
}
.snippet-copy:hover { background: rgba(255,255,255,0.2); }

/* --- 16.5. Progress bar (PV usage etc) --------------------------------- */
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
  margin: 8px 0 4px;
}
.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 999px;
  transition: width var(--ease-base);
}
.progress-fill.warn { background: var(--color-warning); }
.progress-fill.danger { background: var(--color-danger); }

/* --- 17. Loading / empty states ---------------------------------------- */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--color-body);
  font-size: 0.9375rem;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-body);
}
.empty-state h3 {
  font-size: 1.125rem;
  margin-bottom: 8px;
  color: var(--color-heading);
}
.empty-state p { margin-top: 4px; max-width: 40ch; margin-inline: auto; }

/* --- 18. Toast notifications ------------------------------------------- */
.toast-container {
  position: fixed;
  right: 16px; bottom: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 100;
}
.toast {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  box-shadow: var(--shadow-md);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--color-heading);
  min-width: 240px;
  animation: toast-in var(--ease-base);
}
.toast.error { border-left-color: var(--color-danger); }
.toast.success { border-left-color: var(--color-success); }
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* --- 19. Responsive ---------------------------------------------------- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .main-wrapper { margin-left: 0; }
  .sidebar-backdrop.open { display: block; }
  .topbar { padding: 0 16px; }
  .main-content { padding: 16px 16px 32px; }
}
@media (max-width: 480px) {
  .metric-grid { grid-template-columns: 1fr; }
  .card-header, .card-body { padding-left: 16px; padding-right: 16px; }
}

/* --- 20. Reduced motion / Print --------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
@media print {
  .sidebar, .topbar, .sidebar-toggle, .toast-container, .btn { display: none; }
  .main-wrapper { margin-left: 0; }
}
