/* ==========================================================
   Reset & Variables
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: #0f172a;
  background: #f8fafc;
}
:root {
  --accent: #2e8b57;
  --accent-dark: #236b43;
  --accent-light: #e8f5ee;
  --border: #e2e8f0;
  --muted: #64748b;
  --danger: #c0392b;
  --success: #2e8b57;
  --warning: #d97706;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.6rem; margin-top: 1.6em; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }

/* ==========================================================
   Layout
   ========================================================== */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.site-main { padding: 32px 0 64px; min-height: 60vh; }

.grid-3 { display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(2, 1fr); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* ==========================================================
   Header & Nav
   ========================================================== */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand {
  font-weight: 700; font-size: 1.15rem; color: var(--accent-dark);
  text-decoration: none;
}
.site-nav { display: flex; gap: 20px; align-items: center; }
.site-nav a { color: #334155; font-weight: 500; }
.site-nav a:hover { color: var(--accent-dark); text-decoration: none; }

.nav-toggle {
  display: none;
  background: transparent; border: 0; cursor: pointer; padding: 8px;
  flex-direction: column; gap: 4px;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px; background: #0f172a; border-radius: 2px;
}

/* ==========================================================
   Buttons
   ========================================================== */
.btn-primary, .btn-secondary, .btn-danger {
  display: inline-block; padding: 10px 20px; border-radius: 6px;
  font-weight: 600; cursor: pointer; border: 0; font-size: 1rem;
  transition: background .15s, color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); text-decoration: none; }
.btn-secondary {
  background: #fff; color: var(--accent-dark);
  border: 1px solid var(--accent);
}
.btn-secondary:hover { background: var(--accent-light); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #96291d; text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: .9rem; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn[disabled], button[disabled] { opacity: .5; cursor: not-allowed; }

/* ==========================================================
   Cards
   ========================================================== */
.card {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.card h3 { margin-top: 0; }
.card-icon {
  width: 48px; height: 48px; margin-bottom: 12px;
}

/* ==========================================================
   Forms
   ========================================================== */
.form-card {
  max-width: 480px; margin: 0 auto;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 28px;
}
.form-card.wide { max-width: 780px; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-weight: 600; margin-bottom: 4px; font-size: .95rem;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 12px; font-size: 1rem;
  border: 1px solid #cbd5e1; border-radius: 6px;
  background: #fff; font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46,139,87,.15);
}
.form-group textarea { min-height: 120px; resize: vertical; font-family: monospace; }
.form-hint { font-size: .85rem; color: var(--muted); margin-top: 4px; }

/* ==========================================================
   Flash messages
   ========================================================== */
.flash-container { margin-top: 16px; }
.flash {
  padding: 12px 16px; border-radius: 6px; margin-bottom: 8px;
  border-left: 4px solid;
}
.flash-success { background: var(--accent-light); border-color: var(--success); }
.flash-error   { background: #fee; border-color: var(--danger); }
.flash-info    { background: #eef4ff; border-color: #1e3a8a; }

/* ==========================================================
   Footer
   ========================================================== */
.site-footer {
  background: #fff; border-top: 1px solid var(--border);
  padding: 40px 0 20px; margin-top: 40px;
}
.footer-grid {
  display: grid; gap: 24px; grid-template-columns: 2fr 1fr 1fr 1fr;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 6px; }
.footer-grid a { color: #334155; }
.footer-bottom {
  margin-top: 24px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: .85rem; color: var(--muted);
}

/* ==========================================================
   Hero & counters
   ========================================================== */
.hero { padding: 40px 0; }
.hero-inner { display: grid; gap: 40px; grid-template-columns: 1.1fr 1fr; align-items: center; }
.hero h1 { font-size: 2.4rem; }
.hero p { font-size: 1.1rem; color: #334155; }
.hero-cta { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

.notice-banner {
  background: #fffbe6; border-left: 4px solid #d97706;
  padding: 12px 16px; border-radius: 6px; margin: 16px 0;
  font-size: .95rem;
}

.counters {
  display: grid; gap: 16px;
  grid-template-columns: repeat(3, 1fr); margin: 32px 0;
}
.counter-card {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 20px; text-align: center;
}
.counter-value { font-size: 2.25rem; font-weight: 700; color: var(--accent-dark); }
.counter-label { font-size: .9rem; color: var(--muted); margin-top: 4px; }
.counter-running { color: var(--warning); }
.counter-completed { color: var(--success); }
.counter-queue { color: var(--muted); }

/* ==========================================================
   Articles (guides, docs, legal)
   ========================================================== */
.article { max-width: 820px; margin: 0 auto; }
.article h2 { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.article .step {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 20px; margin-bottom: 20px;
}
.article .step-num {
  display: inline-block; width: 30px; height: 30px;
  background: var(--accent); color: #fff; border-radius: 50%;
  text-align: center; line-height: 30px; font-weight: 700;
  margin-right: 10px;
}
.article code {
  background: #eef; padding: 2px 6px; border-radius: 4px; font-size: .9em;
}
.article pre {
  background: #0f172a; color: #f8fafc; padding: 14px;
  border-radius: 6px; overflow-x: auto; font-size: .85em;
}

/* ==========================================================
   Tables (lists)
   ========================================================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f1f5f9; font-weight: 600; }
tr:hover td { background: #f8fafc; }

/* ==========================================================
   Pagination
   ========================================================== */
.pagination {
  display: flex; gap: 6px; align-items: center;
  margin: 20px 0; flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: inline-block; padding: 6px 12px; border-radius: 4px;
  border: 1px solid var(--border); color: #334155;
}
.pagination a:hover { background: var(--accent-light); text-decoration: none; }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination .disabled { color: var(--muted); }
.pagination-summary { font-size: .85rem; color: var(--muted); }

/* ==========================================================
   Step tracker (run page)
   ========================================================== */
.step-tracker {
  display: flex; gap: 8px; margin: 24px 0; overflow-x: auto;
}
.step-item {
  flex: 1; min-width: 120px; text-align: center; padding: 12px 8px;
  background: #f1f5f9; border-radius: 6px; font-size: .85rem;
  color: var(--muted); position: relative;
}
.step-item.active { background: var(--accent-light); color: var(--accent-dark); font-weight: 600; }
.step-item.done { background: var(--accent); color: #fff; }

/* ==========================================================
   Utilities
   ========================================================== */
.muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.w-100 { width: 100%; }
.nowrap { white-space: nowrap; }

/* ==========================================================
   Responsive — Tablet
   ========================================================== */
@media (max-width: 1024px) {
  .hero-inner { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================
   Responsive — Mobile
   ========================================================== */
@media (max-width: 767px) {
  h1 { font-size: 1.75rem; }
  .hero h1 { font-size: 1.75rem; }
  .site-main { padding: 20px 0 48px; }
  .container { padding: 0 16px; }

  .nav-toggle { display: flex; }
  .site-nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--border);
    padding: 16px 20px; flex-direction: column;
    align-items: flex-start; gap: 12px;
  }
  body.nav-open .site-nav { display: flex; }

  .grid-3, .grid-2, .counters { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }

  .form-card { padding: 20px; border-radius: 8px; }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn-primary, .hero-cta .btn-secondary { width: 100%; text-align: center; }
  .step-tracker { font-size: .8rem; }
  .step-item { min-width: 90px; padding: 8px 4px; }

  th, td { padding: 8px; font-size: .87rem; }
  .pagination { justify-content: center; }
}

/* ==========================================================
   Accessibility
   ========================================================== */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.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;
}