html, body {
  margin: 0;
  padding: 0;
}

form {
  display: block;
  width: 100%;
  max-width: inherit;
  margin: 0;
  padding: 0 7px 0 0;
  box-sizing: border-box;
}

/* === Container & Layout === */
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: top;

  min-height: 100vh;
  width: 100%;
  max-width: 400px;          /* 📱 Mobile default */
  margin: 0 auto;
  padding: 0 3px;
  box-sizing: border-box;
  text-align: center;
  gap: 15px;
  overflow-x: auto;          /* prevent overflow on small screens */
}


/* 🎯 ADD THIS NEW RULE: Overrides Flexbox for the chart area */
.container .chart-section {
    width: 100%;
    max-width: none; /* Crucial for allowing the chart to use the full 400px width */
    padding: 0;
    margin: 0;
    align-self: stretch; /* Makes sure it spans the full width of the container */
}


/* --- Responsive scaling --- */
@media (min-width: 768px) {
  .container {
    max-width: 700px;        /* 🖥 Tablet */
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1000px;       /* 💻 Desktop */
  }
}

/* ✅ Optional full-width layout (use <div class="container wide">) */
.container.wide {
  max-width: 100%;
  padding: 0 10px;
}

/* === Buttons === */
.button {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: bold;
  color: var(--text-color, #000);

  display: inline-block;
  vertical-align: bottom;
  width: var(--btn-width, 300px);
  max-width: 100%;
  min-height: var(--btn-min-height, 50px);
  padding: 8px 12px;
  line-height: 1.3;
  white-space: normal;
  word-break: break-word;

  background: linear-gradient(
    to bottom,
    var(--grad-top, #dff5fb) 0%,
    var(--grad-mid, #c5e5ed) 50%,
    var(--grad-bottom, #97b5bd) 100%
  );

  border-radius: 6px;
  border: 1px solid var(--border-color, #1b4b63);

  box-shadow:
    0 2px 4px rgba(0,0,0,0.15),
    inset 0 1px 0 rgba(255,255,255,0.4);

  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
  cursor: pointer;
  transition: filter 0.2s, box-shadow 0.2s;
}

.button:hover { filter: brightness(0.90); }

.button.blue {
  --grad-top: #dff5fb;
  --grad-mid: #8ecae6;
  --grad-bottom: #219ebc;
  --border-color: #1b4b63;
  --text-color: #00394d;
}

.button.red {
  --grad-top: #fce0e0;
  --grad-mid: #f38181;
  --grad-bottom: #d43737;
  --border-color: #9b1f1f;
  --text-color: #4d0000;
}

.button.gray {
  --grad-top: #f2f2f2;
  --grad-mid: #d9d9d9;
  --grad-bottom: #bfbfbf;
  --border-color: #808080;
  --text-color: #333333;
}

.button.green {
  --grad-top: #e0f5e8;
  --grad-mid: #8fd694;
  --grad-bottom: #3a9d5d;
  --border-color: #2e703f;
  --text-color: #063d1e;
}


.button.wide {
  --btn-width: 400px;
}

/* === Inputs & Labels === */
label {
  display: block;
  font-size: 0.85em;
  margin-bottom: 3px;
  text-align: left;
}

.textbox {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  display: inline-block;
  width: var(--tb-width, 400px);
  max-width: var(--tb-max-width, 100%);
  padding: 8px 12px;
  margin: 0 3px 8px;
  border: var(--tb-border-width, 2px) solid var(--tb-border-color, #ccc);
  border-radius: var(--tb-radius, 6px);
  box-sizing: border-box;
  background-color: var(--tb-bg, #fff);
  color: var(--tb-color, #000);
}

.textbox.short {
  --tb-width: 300px;
  --tb-max-width: 100%;
}

.textbox.red {
  --tb-border-width: 3px;
  --tb-border-color: #c00;
}

.textbox.red.short {
  --tb-width: 300px;
  --tb-max-width: 100%;
  --tb-border-width: 3px;
  --tb-border-color: #c00;
}

.textbox::placeholder {
  color: #748eb3;
  opacity: 1;
}

.textbox.red::placeholder {
  color: #d00;
  opacity: 1;
}

/* === Field Wrappers === */
.field-short {
  display: inline-block;
  text-align: left;
  width: auto;
  margin: 0 auto;
}

.field-short .textbox.short {
  width: 300px;
  max-width: 100%;
  display: block;
  margin: 0;
}

.field-short label {
  display: block;
  font-size: 0.85em;
  margin-bottom: 3px;
}

/* === Warning Message === */
.warning {
  display: inline-block;
  align-items: center;
  gap: 8px;
  background-color: #ffe6e6;
  border: 1px solid #ff4d4d;
  border-radius: 6px;
  color: #b20000;
  font-weight: bold;
  font-size: 1.2em;
  padding: 10px 14px;
  margin: 0 8px;
  box-sizing: border-box;
  width: 400px;
  max-width: 100%;
}

.warning::before {
  content: "⚠️";
  font-size: 1.2em;
  line-height: 1;
}

/* === Tables === */
table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  background: #fff;
  margin-bottom: 10px;
  table-layout: auto;
  font-size: 1rem; /* base size for desktop */
}

th, td {
  padding: 8px 12px;
  text-align: left;
  word-wrap: break-word;
}

/* 🧾 Wide table variant (use <table class="wide-table">) */
.wide-table {
  width: 100%;
  max-width: none;
}

/* 📱 Responsive scaling (no horizontal scroll) */
@media (max-width: 800px) {
  table {
    font-size: 0.9rem;
  }
}

@media (max-width: 600px) {
  table {
    font-size: 0.85rem;
    transform: scale(0.95);
    transform-origin: top center;
  }
}

@media (max-width: 450px) {
  table {
    font-size: 0.8rem;
    transform: scale(0.9);
    transform-origin: top center;
  }
}

.hyphenate {
  display: inline-block;
  width: 100%;              /* 👈 give the browser a wrapping context */
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;   /* 👈 stronger hint */
  hyphens: auto;
  -webkit-hyphens: auto;    /* 👈 for Safari/Chrome */
  -ms-hyphens: auto;        /* 👈 legacy Edge */
}

/* === Report tables === */
.report-table {
  width: 100%;
}

.report-row {
  margin-bottom: 10px;
}

.mini-table {
  width: 100%;
  max-width: 400px;
  border-collapse: collapse;
  background: #fff;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.mini-table td {
  padding: 4px 8px;
  text-align: left;
  word-wrap: break-word;
}

/* 📱 mobile / desktop toggle */
.report-row.desktop { display: none; }
.report-row.mobile { display: block; }

@media (min-width: 768px) {
  .report-row.desktop { display: block; }
  .report-row.mobile { display: none; }
}
