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

:root {
  --bg:       #FFE3B3;
  --cream:    #F6F0FF;
  --cream2:   #D9C5EA;
  --border:   #CBB8DE;
  --text:     #2C2C2A;
  --muted:    #5F5E5A;
  --hint:     #888780;
  --red:      #A32D2D;
  --green:    #3B6D11;
  --title:    #90BE83;
  --font-mono: 'Courier New', Courier, monospace;
}

html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

#app {
  padding: 1.25rem;
  min-height: 100vh;
}

/* ===== CARD GRID ===== */

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(315px, 1fr));
  gap: 1.25rem;
  align-items: start;
  max-width: 1600px;
  margin: 0 auto;
}

@media (max-width: 700px) {
  #app { padding: 0.75rem; }
  .panel-grid { grid-template-columns: 1fr; }
}

/* ===== PANEL / CARD ===== */

.panel {
  background: var(--cream);
  border-radius: 12px;
  padding: 1.05rem 1.3125rem;
  box-shadow:
    0px 0.7px 1px rgba(44,44,42,0.07),
    0px 1.6px 2.3px rgba(44,44,42,0.05),
    0px 3.1px 4.4px rgba(44,44,42,0.042),
    0px 5.8px 8.1px rgba(44,44,42,0.035),
    0px 11.6px 16.4px rgba(44,44,42,0.028),
    0px 26px 36.8px rgba(44,44,42,0.02);
}

.calc-card h3 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--title);
  text-shadow:
    2px 2px 0px #fff,
    -2px -2px 0px #fff,
    2px -2px 0px #fff,
    -2px 2px 0px #fff;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.ftb-part-header {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0.75rem 0 0.25rem;
}

.ftb-part-header:first-of-type {
  margin-top: 0;
}

.ftb-divider {
  border: none;
  border-top: 2px solid var(--border);
  margin: 1.1rem 0;
}

.blank-card {
  min-height: 147px;
}

.section-subtitle {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hint);
  margin: 0.75rem 0 0.5rem;
}

.section-subtitle:first-of-type {
  margin-top: 0;
}

/* ===== TABLE ===== */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--hint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  font-family: var(--font-mono);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0,0,0,0.015); }

/* ===== FOOTER ===== */

#site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 0 1.25rem;
  font-size: 13px;
  color: var(--muted);
}

#site-footer .footer-dot {
  color: var(--hint);
}

#site-footer button,
#site-footer a {
  font: inherit;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
}

#site-footer button:hover,
#site-footer a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ===== SOURCES DIALOG ===== */

#sources-dialog {
  background: var(--cream);
  border: none;
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  max-width: 560px;
  width: 90%;
  max-height: 75vh;
  overflow-y: auto;
  box-shadow:
    0px 0.7px 1px rgba(44,44,42,0.07),
    0px 1.6px 2.3px rgba(44,44,42,0.05),
    0px 3.1px 4.4px rgba(44,44,42,0.042),
    0px 5.8px 8.1px rgba(44,44,42,0.035),
    0px 11.6px 16.4px rgba(44,44,42,0.028),
    0px 26px 36.8px rgba(44,44,42,0.02);
}

#sources-dialog::backdrop {
  background: rgba(0,0,0,0.45);
}

#sources-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

#sources-dialog-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

#sources-close {
  font-size: 20px;
  line-height: 1;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.25rem;
}

#sources-close:hover { color: var(--text); }

.sources-group {
  margin-bottom: 1.25rem;
}

.sources-group:last-child {
  margin-bottom: 0;
}

.sources-group h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hint);
  margin-bottom: 0.5rem;
}

.sources-group ul {
  list-style: none;
}

.sources-group li {
  margin-bottom: 0.4rem;
  font-size: 13px;
}

.sources-group a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border);
}

.sources-group a:hover {
  text-decoration-color: var(--text);
}
