:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #152033;
  --muted: #64748b;
  --line: #d9e1ea;
  --accent: #0f7b8f;
  --accent-strong: #085d6d;
  --good: #027a48;
  --warn: #b42318;
  --soft: #e8f5f7;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
  background: #263238;
  color: #ffffff;
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.18);
}

.eyebrow {
  margin: 0 0 4px;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0.72;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.1;
}

.iconButton,
button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.iconButton {
  width: auto;
  min-width: 72px;
  padding: 0 14px;
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 20px clamp(12px, 3vw, 32px) 32px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.inputPanel {
  display: grid;
  gap: 16px;
  padding: clamp(16px, 3vw, 24px);
}

.gridTwo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.field {
  display: grid;
  grid-template-rows: auto 46px 16px;
  gap: 7px;
  min-width: 0;
}

.field textarea {
  grid-row: 2 / span 2;
}

.welcomePanel {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.welcomePanel h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.12;
}

.welcomePanel p:last-child {
  margin: 0;
  max-width: 64ch;
  color: var(--muted);
  line-height: 1.5;
}

.calculatorFields {
  display: grid;
  gap: 16px;
}

.photoCapture {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.photoPreviewWrap {
  display: grid;
  gap: 10px;
}

.photoPreviewWrap img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.photoPreviewWrap button {
  justify-self: start;
  min-height: 38px;
  padding: 0 12px;
  background: #475569;
  font-size: 14px;
}

label,
.toggle span {
  color: #102033;
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #b8c2cc;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 3px solid rgba(15, 123, 143, 0.25);
  outline-offset: 2px;
}

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

.field:has(textarea) {
  grid-template-rows: auto auto;
}

small {
  min-height: 16px;
  color: var(--good);
  font-size: 12px;
}

small.error {
  color: var(--warn);
}

.toggle {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.toggle input {
  min-height: auto;
  width: 18px;
  height: 18px;
}

.toggle strong {
  color: var(--accent-strong);
  font-size: 14px;
}

.verticalFields,
.headrailFields {
  display: grid;
  gap: 16px;
}

.verticalOptions {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.verticalOptions h2 {
  margin: 0;
  font-size: 18px;
}

.optionRows {
  display: grid;
  gap: 8px;
}

.optionRow {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1.5fr) 92px;
  gap: 8px;
  align-items: center;
}

.optionRow span {
  justify-self: end;
  color: var(--accent-strong);
  font-weight: 800;
}

[hidden] {
  display: none !important;
}

.resultPanel {
  align-self: start;
  overflow: hidden;
}

.resultHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}

output {
  display: block;
  color: var(--accent-strong);
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 800;
  line-height: 1;
}

#bandBadge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent-strong);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
}

.breakdown {
  margin: 0;
  padding: 8px 22px 18px;
}

.breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.breakdown dt {
  color: var(--muted);
  font-weight: 700;
}

.breakdown dd {
  margin: 0;
  text-align: right;
  font-weight: 800;
}

.breakdown .totalLine {
  border-bottom: 0;
  color: var(--accent-strong);
  font-size: 20px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 22px 18px;
}

.actions button {
  padding: 0 14px;
}

.actions button:nth-child(2) {
  background: #475569;
}

.note {
  margin: 0;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
    padding-top: 12px;
  }

  .resultPanel {
    position: static;
    order: -1;
  }

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

  .optionRow {
    grid-template-columns: 1fr;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }

  .optionRow span {
    justify-self: start;
  }

  .resultHead {
    align-items: stretch;
    flex-direction: column;
  }

  #bandBadge {
    width: fit-content;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .topbar,
  .inputPanel,
  .actions {
    display: none;
  }

  .layout {
    display: block;
    padding: 0;
  }

  .panel {
    border: 0;
    box-shadow: none;
  }
}
