:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #dbeafe;
  --color-accent: #f59e0b;
  --color-accent-light: #fef3c7;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-alt: #f1f5f9;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-border: #cbd5e1;
  --color-border-light: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  --max-width: 1160px;
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }

.skip-link {
  position: absolute; top: -100%; left: 1rem;
  background: var(--color-primary); color: #fff;
  padding: .5rem 1rem; border-radius: var(--radius-sm);
  z-index: 100; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* Header */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.logo {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: 1.2rem; color: var(--color-text);
}
.logo:hover, .logo:focus-visible { text-decoration: none; color: var(--color-primary); }

.nav-links { display: flex; list-style: none; gap: 1.5rem; }
.nav-links a { font-size: .9rem; font-weight: 500; color: var(--color-text-muted); }
.nav-links a:hover, .nav-links a:focus-visible { color: var(--color-primary); }

/* Hero */
.hero-section {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-bg) 100%);
  padding: 3.5rem 0 3rem;
}
.hero-content { max-width: 640px; }
.hero-content h1 { font-size: 2.2rem; font-weight: 800; line-height: 1.2; margin-bottom: .75rem; }
.hero-sub { font-size: 1.1rem; color: var(--color-text-muted); margin-bottom: 1.5rem; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .6rem 1.25rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; font-family: inherit;
  cursor: pointer; border: 2px solid transparent;
  transition: all var(--transition);
  text-decoration: none; line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus-visible { background: var(--color-primary-dark); }
.btn-ghost { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-ghost:hover, .btn-ghost:focus-visible { background: var(--color-primary-light); }
.btn-outline { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn-outline:hover, .btn-outline:focus-visible { border-color: var(--color-primary); color: var(--color-primary); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-preset { background: var(--color-surface-alt); color: var(--color-text); border-color: var(--color-border-light); }
.btn-preset:hover, .btn-preset:focus-visible { background: var(--color-primary-light); border-color: var(--color-primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Estimator Section */
.estimator-section { padding: 2.5rem 0; }
.estimator-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start;
}

.estimator-form-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}
.estimator-form-panel h2 { font-size: 1.3rem; margin-bottom: 1.25rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--color-text); }
.form-group input, .form-group select {
  padding: .55rem .75rem; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); font-size: .9rem; font-family: inherit;
  background: var(--color-surface); color: var(--color-text);
  transition: border-color var(--transition);
}
.form-group input:focus, .form-group select:focus {
  outline: 2px solid var(--color-primary); outline-offset: 1px; border-color: var(--color-primary);
}
.field-hint { font-size: .75rem; color: var(--color-text-muted); }

.preset-fieldset { border: 1px solid var(--color-border-light); border-radius: var(--radius-sm); padding: 1rem; margin-bottom: 1rem; }
.preset-fieldset legend { font-size: .85rem; font-weight: 600; padding: 0 .4rem; }
.preset-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }

.form-actions { display: flex; gap: .75rem; margin-top: 1.25rem; }
.form-error {
  margin-top: 1rem; padding: .75rem 1rem;
  background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius-sm);
  color: var(--color-danger); font-size: .85rem;
}

/* Results Panel */
.estimator-results-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 76px;
}
.estimator-results-panel h2 { font-size: 1.3rem; margin-bottom: 1rem; }

.results-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-bottom: 1rem;
}
.summary-card {
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm); padding: .75rem; text-align: center;
}
.summary-label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-muted); margin-bottom: .25rem; }
.summary-value { display: block; font-size: 1.25rem; font-weight: 700; color: var(--color-primary); }

.results-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.save-confirm { font-size: .8rem; color: var(--color-success); margin-bottom: .5rem; }

.results-table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.supply-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.supply-table th {
  text-align: left; padding: .5rem .6rem;
  background: var(--color-surface-alt); font-weight: 600;
  border-bottom: 2px solid var(--color-border);
}
.supply-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--color-border-light); }
.supply-table tr.school-covers td { color: var(--color-text-muted); text-decoration: line-through; opacity: .6; }
.supply-table input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

.empty-state { text-align: center; padding: 2rem 1rem; color: var(--color-text-muted); }
.empty-state p { font-size: .95rem; }

.midyear-note { background: var(--color-accent-light); border-radius: var(--radius-sm); padding: 1rem; margin-top: 1rem; }
.midyear-note h3 { font-size: .95rem; margin-bottom: .4rem; }
.midyear-note p { font-size: .85rem; margin-bottom: .4rem; }
.midyear-note ul { padding-left: 1.25rem; font-size: .85rem; }

/* Examples */
.examples-section { padding: 2.5rem 0; background: var(--color-surface); }
.examples-section h2 { font-size: 1.5rem; margin-bottom: .5rem; }
.section-intro { color: var(--color-text-muted); margin-bottom: 1.5rem; }
.example-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.example-card {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md); padding: 1.25rem;
}
.example-card h3 { font-size: 1rem; margin-bottom: .75rem; color: var(--color-primary); }
.example-card ul { padding-left: 1.25rem; font-size: .9rem; }
.example-card li { margin-bottom: .3rem; }

/* Tips */
.tips-section { padding: 2.5rem 0; }
.tips-section h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.tips-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.tips-block h3 { font-size: 1.05rem; margin-bottom: .5rem; margin-top: 1.25rem; }
.tips-block h3:first-child { margin-top: 0; }
.tips-block p { font-size: .9rem; color: var(--color-text-muted); line-height: 1.7; }

.faq-list dt { font-weight: 600; font-size: .95rem; margin-top: 1rem; }
.faq-list dd { font-size: .9rem; color: var(--color-text-muted); margin-bottom: 0; line-height: 1.7; }
.faq-list dt:first-child { margin-top: 0; }

.printable-grid-section {
  background: var(--color-primary-light);
  border-radius: var(--radius-md); padding: 1.25rem; margin-bottom: 2rem;
}
.printable-grid-section h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.printable-grid-section p { font-size: .9rem; color: var(--color-text-muted); }

.past-lists-section { margin-top: 1.5rem; }
.past-lists-section h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.past-lists-section p { font-size: .85rem; color: var(--color-text-muted); margin-bottom: .75rem; }
.past-lists { list-style: none; padding: 0; margin-bottom: 1rem; }
.past-lists li {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem .75rem; background: var(--color-surface-alt);
  border: 1px solid var(--color-border-light); border-radius: var(--radius-sm);
  margin-bottom: .4rem; font-size: .85rem;
}
.past-lists li .past-date { color: var(--color-text-muted); font-size: .75rem; }
.past-lists li .btn { margin-left: .5rem; }

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-light);
  padding: 1.5rem 0;
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; font-size: .85rem; color: var(--color-text-muted); }
.footer-links { display: flex; list-style: none; gap: 1rem; }
.footer-links a { color: var(--color-text-muted); }
.footer-links a:hover { color: var(--color-primary); }
.footer-note { font-size: .75rem; width: 100%; text-align: center; }

/* Print */
@media print {
  .site-header, .site-footer, .estimator-form-panel, .hero-section, .tips-section, .examples-section, .results-actions, .past-lists-section, .printable-grid-section { display: none !important; }
  body { background: #fff; }
  .estimator-section { padding: 0; }
  .estimator-layout { display: block; }
  .estimator-results-panel { position: static; box-shadow: none; border: none; padding: 0; }
  .results-summary { grid-template-columns: repeat(3, 1fr); }
  .supply-table { font-size: .8rem; }
}

/* Responsive */
@media (max-width: 900px) {
  .estimator-layout { grid-template-columns: 1fr; }
  .estimator-results-panel { position: static; }
  .example-grid { grid-template-columns: 1fr 1fr; }
  .tips-layout { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .header-inner { flex-direction: column; height: auto; padding: .75rem 0; gap: .5rem; }
  .nav-links { gap: 1rem; }
  .hero-content h1 { font-size: 1.6rem; }
  .form-row { grid-template-columns: 1fr; }
  .results-summary { grid-template-columns: 1fr; }
  .example-grid { grid-template-columns: 1fr; }
  .preset-buttons { flex-direction: column; }
  .footer-inner { flex-direction: column; text-align: center; }
}

/* Focus visible */
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
