:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --ink: #10243f;
  --muted: #5e6f86;
  --border: #d9e1e8;
  --green: #00a376;
  --green-dark: #007d61;
  --blue: #1b4977;
  --blue-soft: #e7eef5;
  --danger: #b42318;
  --shadow: 0 18px 46px rgba(16, 36, 63, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.app-shell {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.hero {
  min-height: 210px;
  display: flex;
  align-items: center;
  padding: 34px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(16, 36, 63, 0.92), rgba(27, 73, 119, 0.78)),
    url("https://www.pkfscs.co.uk/wp-content/uploads/2025/12/pkfscs-sage-experts2.jpg") center / cover;
  box-shadow: var(--shadow);
  color: #fff;
}

.eyebrow,
.tool-kicker {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #55e0bf;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
  line-height: 1.2;
}

h3 {
  font-size: 16px;
  line-height: 1.25;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.hero p {
  max-width: 760px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.86);
}

.toolbox {
  margin-top: 22px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.tab:hover {
  border-color: var(--green);
}

.tab.is-active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.form-panel,
.output-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-panel {
  padding: 22px;
}

.tool-heading {
  margin-bottom: 18px;
}

.tool-heading p:last-child {
  margin-bottom: 0;
}

.tool-form {
  display: grid;
  gap: 18px;
}

.tab-panel {
  display: none;
  gap: 16px;
}

.tab-panel.is-active {
  display: grid;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.check-field {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.check-field input {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 540px;
  resize: vertical;
  padding: 16px;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
}

input:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(0, 163, 118, 0.2);
  border-color: var(--green);
}

.form-section-title {
  margin: 4px 0 -2px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.choice-group {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  gap: 16px;
}

.choice-group legend {
  padding: 0 6px;
  font-size: 14px;
  font-weight: 700;
}

.choice-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.choice-group input {
  width: auto;
  height: auto;
}

.empty-state {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 125px;
  gap: 10px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.primary-action {
  background: var(--green);
  color: #fff;
}

.primary-action:hover {
  background: var(--green-dark);
}

.secondary-action {
  background: var(--blue-soft);
  color: var(--blue);
  border: 1px solid var(--border);
}

.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

.output-panel {
  overflow: hidden;
}

.output-header {
  padding: 18px 20px;
}

.output-header h2 {
  margin-bottom: 3px;
}

.output-header p {
  margin-bottom: 0;
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 36, 63, 0.58);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal h2 {
  margin-bottom: 8px;
}

.modal p {
  margin-bottom: 20px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 16px;
  }

  .hero {
    min-height: 180px;
    padding: 24px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }
}
