:root {
  --ink: #17242f;
  --muted: #5c6872;
  --surface: #ffffff;
  --accent: #0b766e;
  --accent-dark: #07574f;
  --accent-light: #e6f4f2;
  --border: #cfdbd8;
  --shadow: 0 18px 45px rgba(23, 36, 47, 0.1);
  --radius: 18px;
}

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

body {
  background: #f6f8f7;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

/* Back link — centered */
.back-link {
  display: block;
  text-align: center;
  margin: 0 auto 28px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

/* Layout */
.tool-page, article.tool-page, main.tool-page {
  width: min(100% - 32px, 920px);
  margin: 0 auto;
  padding: 48px 0 40px;
}

/* Header */
.tool-header { margin-bottom: 28px; }
.eyebrow {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}
h2 { margin: 0 0 10px; font-size: 1.3rem; }
.tool-header p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

/* Cards */
.tool-card, .formula, .notice {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(23,36,47,0.06);
}
.tool-card { padding: 28px; }

/* Input grid */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.field { display: grid; gap: 8px; }
label { font-weight: 700; font-size: 0.92rem; }
input, select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--ink);
  background: #fbfdfc;
  font: inherit;
}
input:focus, select:focus {
  outline: 3px solid rgba(11, 118, 110, 0.18);
  border-color: var(--accent);
}

/* Result cards */
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}
.result {
  padding: 22px;
  border-radius: 14px;
  color: #effbf9;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}
.result.wide-result, .result:last-child { grid-column: 1 / -1; }
.result-value {
  margin: 3px 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.2;
}
.result-detail { color: #d4eeea; margin: 0; font-size: 0.92rem; }

/* Formula / notice sections */
.formula, .notice { margin-top: 22px; padding: 24px; }
.formula h2 { margin-bottom: 10px; }
.formula p, .notice p { margin-bottom: 10px; }
.formula p:last-child, .notice p:last-child { margin-bottom: 0; }
.notice {
  border-left: 5px solid #e1a64d;
  color: #4c3b1f;
  background: #fff9ed;
  box-shadow: none;
}

/* Tables */
.table-wrap { overflow-x: auto; margin-top: 16px; }
.coord-table, .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.coord-table th, .coord-table td,
.data-table th, .data-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.coord-table th, .data-table th {
  background: var(--accent-light);
  font-weight: 700;
}

/* Risk labels (tool overhang) */
.risk-label {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* Footer */
.tool-footer {
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
}

/* Print */
@media print {
  .back-link, .no-print { display: none !important; }
}

/* Responsive */
@media (max-width: 700px) {
  .tool-page { width: min(100% - 24px, 920px); padding-top: 30px; }
  .tool-card, .formula, .notice { padding: 20px; }
  .tool-grid, .result-grid { grid-template-columns: 1fr; }
}
