:root {
  --navy: #003366;
  --bg: #f5f7fa;
  --card: #fff;
  --border: #d8dee9;
  --text: #222;
  --muted: #5a6573;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) 1fr;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
}

aside {
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 1rem 1.1rem;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
}

aside h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: var(--navy);
}

aside .hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.checklist-item input {
  margin-top: 0.2rem;
}

.progress-wrap {
  margin: 0.75rem 0;
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: var(--navy);
  transition: width 0.2s;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

main {
  padding: 1.25rem 1.5rem 2rem;
}

.banner {
  background: #e8eef5;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.banner strong {
  color: var(--text);
}

h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  color: var(--navy);
}

.sub {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  aside {
    position: relative;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .grid2 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.card h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--navy);
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--muted);
}

input[type="text"],
select,
textarea {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
  margin-bottom: 0.65rem;
}

textarea {
  min-height: 72px;
  resize: vertical;
}

.field {
  margin-bottom: 0.25rem;
}

.radio-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.radio-row label {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  cursor: pointer;
}

input[type="file"] {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.btn {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-right: 0.5rem;
  margin-top: 0.25rem;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn.secondary {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--navy);
}

.results {
  display: none;
}

.results.visible {
  display: block;
}

.metric {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
}

.pre {
  background: #f0f2f5;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  overflow-x: auto;
  max-height: 220px;
  overflow-y: auto;
}

.actions {
  margin-top: 0.75rem;
}

.err {
  background: #fde8e8;
  border: 1px solid #e8a0a0;
  color: #8a1f1f;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: none;
}

.err.visible {
  display: block;
}

/* Contextual help (hover or keyboard focus on ?) */
.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.label-row > label {
  margin-bottom: 0;
  flex: 1;
}

.card-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.card-heading-row h3 {
  margin: 0;
}

.banner-help-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.help-tip {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 1px solid var(--navy);
  color: var(--navy);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: help;
  line-height: 1;
  outline: none;
}

.help-tip:hover,
.help-tip:focus {
  background: var(--navy);
  color: #fff;
}

.help-tip-panel {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  z-index: 200;
  top: calc(100% + 6px);
  left: 0;
  width: min(340px, calc(100vw - 2rem));
  max-height: min(70vh, 420px);
  overflow-y: auto;
  padding: 0.65rem 0.75rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text);
  cursor: default;
  text-align: left;
}

.help-tip-panel strong {
  color: var(--navy);
  display: block;
  margin-top: 0.35rem;
  margin-bottom: 0.15rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.help-tip-panel strong:first-child {
  margin-top: 0;
}

aside .help-tip-panel {
  left: auto;
  right: 0;
}

.help-tip:hover .help-tip-panel,
.help-tip:focus .help-tip-panel,
.help-tip:focus-within .help-tip-panel {
  visibility: visible;
  opacity: 1;
}

.checklist-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.35rem 0.5rem;
  align-items: start;
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
}

.checklist-item .checklist-text {
  min-width: 0;
}

aside .help-tip {
  margin-top: 0.1rem;
}

.actions .help-tip {
  vertical-align: middle;
  margin-left: 0.25rem;
}

.inline-help-line {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.run-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
