:root {
  --ink: #15343b;
  --muted: #5e7378;
  --primary: #087f8c;
  --primary-dark: #075563;
  --accent: #5aba9f;
  --surface: #ffffff;
  --background: #eef6f5;
  --line: #d3e3e1;
  --warning-bg: #fff6dc;
  --warning-ink: #714f00;
  --danger: #b42318;
  --radius: 18px;
  --shadow: 0 10px 32px rgba(14, 62, 70, 0.11);
  --text-scale: 1;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  font-size: calc(16px * var(--text-scale));
  background: var(--background);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 280px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 5%, rgba(90, 186, 159, 0.18), transparent 28rem),
    linear-gradient(180deg, #f8fcfb 0, var(--background) 24rem);
  line-height: 1.5;
}

button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-header {
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 24px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 16px; }
.logo {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 6px 18px rgba(6, 73, 82, 0.18);
}

.eyebrow {
  margin: 0 0 1px;
  color: var(--primary);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.9rem, 5vw, 2.8rem); line-height: 1; letter-spacing: -.04em; }
.subtitle { margin: 4px 0 0; color: var(--muted); }
h2 { margin-bottom: 3px; font-size: 1.22rem; line-height: 1.25; }

.text-controls { display: flex; gap: 8px; }
.icon-button {
  min-width: 48px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--primary-dark);
  background: rgba(255,255,255,.92);
  font-weight: 800;
  cursor: pointer;
}

.layout {
  width: min(1120px, calc(100% - 32px));
  margin: 12px auto 36px;
  display: grid;
  grid-template-columns: minmax(300px, .78fr) minmax(470px, 1.22fr);
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(211, 227, 225, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 28px);
}

.results-card { grid-column: 2; grid-row: 1 / span 2; }
.note-card { padding: 20px 24px; }
.note-card h2 { font-size: 1rem; color: var(--primary-dark); }
.note-card p { margin-bottom: 0; font-size: .88rem; color: var(--muted); }

.section-heading { display: flex; gap: 12px; margin-bottom: 22px; }
.section-heading p { margin-bottom: 0; color: var(--muted); font-size: .9rem; }
.step {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: white;
  background: var(--primary);
  font-weight: 800;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 14px; }
.field-wide { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 7px; font-weight: 750; font-size: .88rem; }
.field small { display: block; margin-top: 5px; color: var(--muted); font-size: .74rem; }
input, select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #b8cecb;
  border-radius: 11px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}
input:focus, select:focus, button:focus-visible, .table-wrap:focus-visible {
  outline: 3px solid rgba(8, 127, 140, .22);
  outline-offset: 2px;
  border-color: var(--primary);
}
.input-suffix { position: relative; }
.input-suffix input { padding-right: 38px; }
.input-suffix span { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }

.info-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 22px 0 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}
.info-strip div { padding: 12px 8px; text-align: center; background: #f7fbfa; }
.info-strip span { display: block; min-height: 2.4em; color: var(--muted); font-size: .68rem; }
.info-strip strong { display: block; margin-top: 3px; color: var(--primary-dark); font-size: .88rem; }

.message, .warning {
  margin: 12px 0 0;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: .83rem;
}
.message { color: var(--danger); background: #fef3f2; border: 1px solid #fecdca; }
.warning { color: var(--warning-ink); background: var(--warning-bg); border: 1px solid #f0d98c; }

.actions { display: flex; gap: 10px; margin-top: 18px; }
.button {
  min-height: 48px;
  flex: 1;
  border-radius: 12px;
  padding: 11px 14px;
  border: 1px solid transparent;
  font-weight: 800;
  cursor: pointer;
}
.button.primary { color: #fff; background: var(--primary); }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { color: var(--primary-dark); background: #fff; border-color: #aac7c4; }
.button:active { transform: translateY(1px); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: -4px 0 14px; color: var(--muted); font-size: .78rem; }
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.mix-dot { background: var(--primary); }
.dna-dot { background: #9c6ade; }

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
}
table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: .85rem; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
th { color: #fff; background: var(--primary-dark); text-align: right; font-size: .75rem; }
th:first-child, td:first-child { text-align: left; }
th span { font-weight: 500; opacity: .82; }
td { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:nth-child(even) { background: #f7fbfa; }
tbody tr.template-row { background: #f7f2ff; }
.component-name { display: block; font-weight: 700; }
.component-note { display: block; color: var(--muted); font-size: .7rem; font-weight: 400; }
.volume-input {
  width: 86px;
  min-height: 38px;
  padding: 6px 8px;
  text-align: right;
  border-radius: 8px;
}
tfoot td { background: #e8f4f2; font-weight: 850; border-bottom: 0; }

.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.summary-grid article { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f7fbfa; }
.summary-grid span, .summary-grid small { display: block; }
.summary-grid span { color: var(--muted); font-size: .76rem; }
.summary-grid strong { display: block; margin: 3px 0; color: var(--primary-dark); font-size: 1.25rem; }
.summary-grid small { color: var(--muted); font-size: .67rem; }

footer { padding: 0 20px 28px; text-align: center; color: var(--muted); font-size: .78rem; }
footer p { margin: 0; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .results-card { grid-column: 1; grid-row: auto; }
  .app-header { padding-inline: 18px; }
}

@media (max-width: 520px) {
  .app-header { align-items: flex-start; }
  .logo { width: 68px; height: 68px; }
  .subtitle { font-size: .82rem; }
  .text-controls { flex-direction: column; }
  .icon-button { min-width: 44px; min-height: 36px; font-size: .8rem; }
  .layout { width: min(100% - 20px, 1120px); gap: 12px; }
  .card { padding: 18px 15px; border-radius: 15px; }
  .form-grid, .summary-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .info-strip { grid-template-columns: 1fr; }
  .info-strip span { min-height: auto; }
  .actions { flex-direction: column; }
}

@media print {
  body { background: #fff; }
  .app-header, .controls-card, .note-card, footer, .text-controls, .results-card .actions { display: none !important; }
  .layout { display: block; width: 100%; margin: 0; }
  .results-card { box-shadow: none; border: 0; padding: 0; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; }
}
.suite-home-link {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.66rem 1rem;
  border: 1px solid rgba(41, 216, 255, 0.55);
  border-radius: 999px;
  background: rgba(3, 16, 29, 0.95);
  color: #f5f9fc;
  font: 700 0.84rem/1 Arial, sans-serif;
  text-decoration: none;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(12px);
  -webkit-tap-highlight-color: transparent;
}

.suite-home-link:hover {
  border-color: #29d8ff;
  color: #73e8ff;
}

.suite-home-link:focus-visible {
  outline: 3px solid #9eea43;
  outline-offset: 3px;
}
