/*
  School Billing Variance Calculator
  Clean, modern, minimal (Stripe/Notion/Linear-inspired)
*/

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800&family=Inter:wght@400;500;600&display=swap');

:root{
  --color-bg: #fbfaf7;
  --color-surface: #ffffff;
  --color-surface-2: #f6f4ee;
  --color-text: #2a2a2a;
  --color-muted: #5f6368;
  --color-border: rgba(34, 36, 38, 0.12);
  --color-border-strong: rgba(34, 36, 38, 0.18);

  --color-primary: #6d28d9;      /* friendly purple */
  --color-primary-ink: #4c1d95;
  --color-primary-soft: rgba(109, 40, 217, 0.12);

  --color-success: #1f7a4a;
  --color-success-soft: rgba(31, 122, 74, 0.12);
  --color-warning: #b15a00;
  --color-warning-soft: rgba(177, 90, 0, 0.12);
  --color-danger: #b42318;
  --color-danger-soft: rgba(180, 35, 24, 0.12);
  --color-neutral: #4b5563;
  --color-neutral-soft: rgba(75, 85, 99, 0.12);

  --shadow: 0 10px 30px rgba(18, 18, 18, 0.08);
  --shadow-sm: 0 2px 10px rgba(18, 18, 18, 0.06);
  --radius: 16px;
  --radius-sm: 12px;

  --font-heading: 'Nunito', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;

  --container: 1200px;
}

*{ box-sizing: border-box; }

html, body{ height: 100%; }

body{
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--color-text);
  background:
    radial-gradient(1000px 600px at 20% -10%, rgba(109, 40, 217, 0.10), transparent 60%),
    radial-gradient(900px 600px at 90% 0%, rgba(177, 90, 0, 0.08), transparent 55%),
    var(--color-bg);
}

img{ max-width: 100%; height: auto; }

a{ color: inherit; text-decoration: none; }

p{ margin: 0 0 1rem; max-width: 70ch; color: var(--color-muted); }

h1, h2, h3{
  font-family: var(--font-heading);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  color: #242424;
}

h1{
  font-size: clamp(2.4rem, 4vw, 3.2rem);
  font-weight: 800;
}

h2{
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  font-weight: 800;
}

h3{
  font-size: clamp(1.15rem, 1.7vw, 1.35rem);
  font-weight: 800;
}

.small{ font-size: 0.95rem; color: var(--color-muted); }

.container{
  width: min(var(--container), calc(100% - 2rem));
  margin-inline: auto;
}

.skip-link{
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transform: translateY(-150%);
  transition: transform 0.2s ease;
  z-index: 1000;
}

.skip-link:focus{ transform: translateY(0); }

/* Header */
.site-header{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 250, 247, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(34, 36, 38, 0.08);
}

.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0;
  gap: 1rem;
}

.brand{
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 240px;
}

.mark{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(47, 111, 106, 0.20), rgba(47, 111, 106, 0.05)),
    #fff;
  border: 1px solid rgba(109, 40, 217, 0.25);
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
  display: grid;
  place-items: center;
}

.mark svg{ width: 22px; height: 22px; color: var(--color-primary); }

.brand-title{
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-sub{
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-top: 0.1rem;
}

/* Nav (single nav) */
.nav{
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-toggle{
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.nav-toggle-btn{
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--color-text);
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
  cursor: pointer;
  user-select: none;
}

.burger{
  width: 18px;
  height: 12px;
  position: relative;
  display: inline-block;
}

.burger span{
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #3a3a3a;
  border-radius: 999px;
}

.burger span:nth-child(1){ top: 0; }
.burger span:nth-child(2){ top: 5px; opacity: 0.9; }
.burger span:nth-child(3){ top: 10px; }

.nav-links{
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-links a{
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  color: var(--color-muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-links a:hover{
  background: rgba(109, 40, 217, 0.10);
  color: var(--color-primary-ink);
}

.nav-links a[aria-current="page"]{
  background: var(--color-primary-soft);
  color: var(--color-primary-ink);
  border: 1px solid rgba(109, 40, 217, 0.22);
}

@media (max-width: 860px){
  .brand{ min-width: auto; }
  .nav-toggle-btn{ display: inline-flex; }

  .nav-links{
    position: absolute;
    right: 1rem;
    top: 70px;
    width: min(360px, calc(100vw - 2rem));
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 0.6rem;
    display: grid;
    gap: 0.25rem;
    transform: translateY(-6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .nav-links a{
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
  }

  #nav-toggle:checked ~ .nav-links{
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
}

/* Main */
.main{
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(3rem, 7vw, 5rem);
}

.hero{
  padding: clamp(1.5rem, 4vw, 2.5rem) 0 clamp(1.5rem, 4vw, 2.5rem);
}

.hero-grid{
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: start;
}

.hero p{ max-width: 70ch; }

.kpi-strip{
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(34, 36, 38, 0.10);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

.kpi{
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  padding: 0.75rem 0;
}

.kpi + .kpi{ border-top: 1px solid rgba(34, 36, 38, 0.08); }

.kpi .label{
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6b7280;
}

.kpi .value{
  font-family: var(--font-heading);
  font-weight: 800;
  color: #2b2b2b;
}

@media (max-width: 980px){
  .hero-grid{ grid-template-columns: 1fr; }
}

.dashboard{
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 980px){
  .dashboard{ grid-template-columns: 1fr; }
}

.panel{
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(34, 36, 38, 0.10);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
}

.panel-header{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-header h2{
  margin: 0;
}

.form{
  display: grid;
  gap: 1rem;
}

.field{
  display: grid;
  gap: 0.4rem;
}

.field label{
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: #3f3f3f;
  font-weight: 600;
}

.input{
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(34, 36, 38, 0.14);
  background: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
}

.input:focus-within{
  border-color: rgba(109, 40, 217, 0.45);
  box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.14);
}

.input .prefix{
  color: #6b7280;
  font-weight: 600;
}

input[type="number"]{
  width: 100%;
  border: none;
  outline: none;
  font: inherit;
  color: var(--color-text);
  background: transparent;
}

.hint{
  font-size: 0.92rem;
  color: #6b7280;
  margin-top: 0.15rem;
}

.actions{
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.btn{
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.18);
}

.btn-primary{
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(109, 40, 217, 0.18);
}

.btn-primary:hover{
  background: #5b21b6;
}

.btn-secondary{
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(34, 36, 38, 0.14);
  color: #3a3a3a;
}

.btn-secondary:hover{
  background: rgba(246, 244, 238, 0.9);
  border-color: rgba(34, 36, 38, 0.18);
}

@media (prefers-reduced-motion: no-preference){
  .btn:hover{ transform: translateY(-1px); }
}

/* Info section */
.info{
  margin-top: clamp(2rem, 5vw, 3.5rem);
}

.info-card{
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(34, 36, 38, 0.10);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.info-head{
  padding: 1.25rem clamp(1.25rem, 2.5vw, 1.75rem);
  background:
    linear-gradient(180deg, rgba(109, 40, 217, 0.08), transparent 70%),
    #fff;
  border-bottom: 1px solid rgba(34, 36, 38, 0.08);
}

.info-head h2{ margin: 0 0 0.35rem; }

.prose{
  padding: 1.25rem clamp(1.25rem, 2.5vw, 1.75rem) 1.5rem;
}

.prose p{ color: var(--color-muted); }

.prose ul{
  margin: 0 0 1rem;
  padding-left: 1.15rem;
  color: var(--color-muted);
  max-width: 75ch;
}

.prose li{ margin: 0.35rem 0; }

.tier-list{
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.5rem;
}

.tier-list li{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(109, 40, 217, 0.18);
  background: rgba(109, 40, 217, 0.06);
}

.tier-list strong{ color: var(--color-primary-ink); }

.tier-list .arrow{ color: rgba(76, 29, 149, 0.75); }

@media (max-width: 560px){
  .tier-list li{ flex-direction: column; align-items: flex-start; }
}

/* Results card */
.results-card{
  background: #fff;
  border: 1px solid rgba(34, 36, 38, 0.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.results-head{
  padding: 1.25rem clamp(1.25rem, 2.5vw, 1.75rem);
  background:
    linear-gradient(180deg, rgba(109, 40, 217, 0.10), transparent 70%),
    #fff;
  border-bottom: 1px solid rgba(34, 36, 38, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.results-head h2{ margin: 0; }

.badge{
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-neutral{ background: var(--color-neutral-soft); border-color: rgba(75, 85, 99, 0.22); color: #374151; }
.badge-success{ background: var(--color-success-soft); border-color: rgba(31, 122, 74, 0.22); color: #155e37; }
.badge-warning{ background: var(--color-warning-soft); border-color: rgba(177, 90, 0, 0.22); color: #7a3b00; }
.badge-danger{ background: var(--color-danger-soft); border-color: rgba(180, 35, 24, 0.22); color: #7a1c14; }

.dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.75;
}

.results-body{
  padding: 1.25rem clamp(1.25rem, 2.5vw, 1.75rem) 1.5rem;
}

.results-message{
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px dashed rgba(34, 36, 38, 0.22);
  background: rgba(246, 244, 238, 0.6);
  color: #5b5b5b;
  margin-bottom: 1rem;
}

.alert{
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(180, 35, 24, 0.22);
  background: rgba(180, 35, 24, 0.08);
  color: #6b1a14;
  margin-bottom: 1rem;
}

.kv{
  display: grid;
  gap: 0.75rem;
}

.row{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(34, 36, 38, 0.08);
}

.row:last-child{ border-bottom: none; }

.key{
  color: #5d6166;
}

.val{
  font-weight: 700;
  color: #2b2b2b;
  text-align: right;
}

.val.muted{ font-weight: 600; color: #6b7280; }

.val.positive{ color: #155e37; }
.val.negative{ color: #7a1c14; }

.footer{
  padding: clamp(2rem, 5vw, 3rem) 0;
  border-top: 1px solid rgba(34, 36, 38, 0.10);
  background: rgba(246, 244, 238, 0.65);
}

.footer-grid{
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
  align-items: start;
}

.footer h3{ margin-bottom: 0.5rem; }

.footer a{
  color: #3f3f3f;
  text-decoration: underline;
  text-decoration-color: rgba(109, 40, 217, 0.35);
  text-underline-offset: 3px;
}

.footer a:hover{ text-decoration-color: rgba(109, 40, 217, 0.75); }

.legal{
  margin-top: 1rem;
  color: #6b7280;
  font-size: 0.95rem;
}

@media (max-width: 860px){
  .footer-grid{ grid-template-columns: 1fr; }
}
