/* UAD36 exporter — temporary URAR36 styling. Vanilla CSS, no framework. */

:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --fg: #1d2430;
  --muted: #637083;
  --border: #d5dde8;
  --border-strong: #b7c4d6;
  --accent: #174a7c;
  --accent-2: #2368a2;
  --accent-soft: #e6f0f8;
  --ok: #26724a;
  --warn: #966f18;
  --error-bg: #fff1f1;
  --error-fg: #8b1e1e;
  --code-bg: #edf1f5;
  --shadow: 0 10px 26px rgba(22, 34, 51, 0.08);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.urar36-app {
  min-height: 100vh;
}

.topbar {
  min-height: 64px;
  padding: 12px 24px;
  background: #263445;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-size: 18px;
  font-weight: 700;
}

.order-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  color: #cbd6e4;
  font-size: 12px;
}

.order-line span {
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.26);
}

.order-line span:last-child {
  border-right: 0;
}

.top-actions,
.builder-actions,
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  min-height: 34px;
  padding: 7px 13px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  border-color: var(--accent-2);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(35, 104, 162, 0.25);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button.ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}

button[type="submit"],
#fill-joshua-btn {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

button[type="submit"]:hover,
#fill-joshua-btn:hover {
  background: var(--accent-2);
}

.subject-strip {
  display: grid;
  grid-template-columns: minmax(240px, 1.35fr) minmax(180px, 1fr) minmax(260px, 1.2fr) minmax(160px, 0.75fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

.subject-strip > div {
  background: var(--surface);
  padding: 14px 24px;
  min-width: 0;
}

.label,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.subject-strip strong {
  display: block;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tabs a {
  color: var(--muted);
  text-decoration: none;
  padding: 13px 16px;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  font-weight: 650;
}

.tabs a.active,
.tabs a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(520px, 1fr) 320px;
  align-items: start;
  gap: 18px;
  padding: 18px 24px 28px;
}

.module-nav,
.review-rail {
  position: sticky;
  top: 84px;
  align-self: start;
}

.module-nav {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.module-nav-title {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 800;
}

.module-list {
  display: grid;
}

.module-nav a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.module-nav a:last-child {
  border-bottom: 0;
}

.module-nav a:hover {
  background: var(--accent-soft);
}

.module-nav span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}

.module-nav b {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.module-nav a.status-ready b {
  color: var(--ok);
}

.module-nav a.status-started b,
.module-nav a.status-pending b {
  color: var(--warn);
}

.module-nav a.status-optional b {
  color: var(--muted);
}

.module-nav a.status-included b {
  color: var(--accent);
}

.work-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.section-head h1 {
  margin: 3px 0 0;
  font-size: 20px;
  line-height: 1.2;
}

.research-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

.research-panel > div {
  min-width: 0;
  background: var(--surface);
  padding: 14px 16px;
}

.research-panel strong {
  display: block;
  margin-top: 2px;
}

.research-panel p,
.workbench-panel p,
.placeholder-band p {
  margin: 4px 0 0;
  color: var(--muted);
}

.workbench-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

.workbench-panel > div {
  min-width: 0;
  background: #fbfcfd;
  padding: 13px 16px;
}

.workbench-panel strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.load-bar {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.load-control {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.load-control > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.load-status {
  margin: 8px 0 0;
  min-height: 1em;
  color: var(--muted);
  font-size: 12px;
}

.load-status.success { color: var(--ok); }
.load-status.error { color: var(--error-fg); }

#active-starter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

#active-starter-row p {
  margin: 0;
}

#active-starter-name {
  color: var(--accent);
}

form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 18px 20px 22px;
}

form > *,
.report-section,
.comparison-scroll {
  min-width: 0;
}

form.report-page {
  gap: 16px;
  padding: 18px;
  background: #e8ecf1;
}

fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin: 0;
  background: var(--surface);
}

legend {
  padding: 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

label > span > em {
  color: var(--error-fg);
  font-style: normal;
  margin-left: 2px;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--fg);
}

input:focus,
select:focus {
  background: var(--surface);
}

.report-page > fieldset,
.report-section {
  background: #fff;
  border: 1px solid #29313b;
  border-radius: 0;
}

.report-page > fieldset {
  position: relative;
  gap: 0 18px;
  padding: 38px 12px 12px;
}

.report-page > fieldset legend {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 6px 10px;
  background: #303841;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.report-page > fieldset label {
  grid-template-columns: 148px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 35px;
  padding: 3px 0;
  border-bottom: 1px solid #d9dee6;
}

.report-page > fieldset label > span {
  color: #2e343c;
  font-size: 11px;
  font-weight: 750;
}

.report-page > fieldset input,
.report-page > fieldset select {
  min-height: 28px;
  padding: 3px 5px;
  border: 0;
  border-bottom: 1px solid #aab3bf;
  border-radius: 0;
  background: #fff;
}

.report-page > fieldset.setup-fieldset {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-page > fieldset.setup-fieldset label {
  grid-template-columns: 118px minmax(0, 1fr);
}

.report-page > fieldset.setup-fieldset .checkbox-control {
  grid-template-columns: 18px minmax(0, 1fr);
  align-content: center;
}

.checkbox-control input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  align-self: center;
}

.checkbox-control span {
  color: #2e343c;
}

.profile-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #29313b;
}

#profile-tag-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
}

.report-section-title {
  padding: 7px 10px;
  background: #222831;
  color: #fff;
  font-size: 13px;
  font-weight: 850;
}

.comparison-scroll {
  overflow-x: auto;
  border-top: 1px solid #29313b;
}

.sales-comparison-grid {
  display: grid;
  grid-template-columns: 176px repeat(5, minmax(150px, 1fr));
  min-width: 1120px;
  background: #29313b;
  gap: 1px;
  font-size: 12px;
}

.grid-corner,
.grid-column-heading,
.grid-band,
.grid-row-label,
.grid-cell {
  min-width: 0;
}

.grid-corner,
.grid-column-heading {
  min-height: 34px;
  padding: 8px;
  background: #3a424c;
  color: #fff;
  font-weight: 800;
  text-align: center;
}

.grid-corner {
  text-align: left;
}

.grid-column-heading.optional-column,
.grid-cell.optional-column {
  background: #f5f6f8;
}

.grid-column-heading.optional-column {
  color: #202833;
}

.grid-band {
  grid-column: 1 / -1;
  min-height: 28px;
  padding: 6px 8px;
  background: #d9dee5;
  color: #222831;
  font-weight: 850;
}

.grid-row-label {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 8px;
  background: #eef1f5;
  color: #202833;
  font-weight: 800;
}

.grid-cell {
  min-height: 36px;
  padding: 5px 6px;
  background: #fff;
}

.grid-cell input {
  width: 100%;
  min-height: 26px;
  padding: 3px 4px;
  border: 0;
  border-bottom: 1px solid #aab3bf;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
}

.grid-cell output {
  display: block;
  min-height: 26px;
  padding: 4px 2px;
  color: #202833;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.subdued-cell,
.summary-cell,
.layout-only-cell {
  color: #657080;
  font-weight: 750;
}

.summary-cell {
  background: #fbfcfd;
}

.layout-only-cell {
  background: #f7f8fa;
}

.photo-cell {
  padding: 6px;
}

.photo-box {
  display: grid;
  place-items: center;
  min-height: 84px;
  border: 1px solid #aab3bf;
  background:
    linear-gradient(135deg, transparent 49%, #c5ccd6 49%, #c5ccd6 51%, transparent 51%),
    linear-gradient(45deg, transparent 49%, #c5ccd6 49%, #c5ccd6 51%, transparent 51%),
    #f7f8fa;
  color: #576273;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.anchor-target {
  display: block;
  position: relative;
  top: -104px;
  height: 0;
  overflow: hidden;
}

.profile-section-panel {
  border: 1px solid #29313b;
  background: #fff;
}

.profile-section-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: #d9dee6;
}

.profile-section-card {
  min-width: 0;
  padding: 10px 12px;
  background: #fff;
}

.profile-section-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.profile-section-card span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.actions {
  justify-content: flex-end;
  padding-top: 2px;
}

.review-rail {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.rail-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}

.rail-section h2 {
  margin: 3px 0 12px;
  font-size: 16px;
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

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

dl div:last-child {
  border-bottom: 0;
}

dt {
  color: var(--muted);
  font-weight: 650;
}

dd {
  margin: 0;
  font-weight: 750;
  text-align: right;
}

#validate-btn {
  width: 100%;
  margin-top: 12px;
}

.rail-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.review-queue {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.review-queue:empty {
  display: none;
}

.review-queue li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.review-queue li:last-child {
  border-bottom: 0;
}

.review-queue span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.review-queue b {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.status-ok {
  color: var(--ok);
}

.status-bad {
  color: var(--error-fg);
}

.status-warn {
  color: var(--warn);
}

#status {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

#changes {
  list-style: none;
  max-height: 340px;
  overflow: auto;
  padding: 0;
  margin: 0 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

#changes li {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

#changes li:last-child {
  border-bottom: 0;
}

#changes .section {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

#download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  width: 100%;
  min-width: 0;
  padding: 7px 12px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 750;
  overflow-wrap: anywhere;
  text-align: center;
}

#download-link:hover {
  background: var(--accent-2);
}

details {
  margin-top: 12px;
}

details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

pre {
  max-height: 360px;
  overflow: auto;
  background: var(--code-bg);
  padding: 12px;
  border-radius: 6px;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

code {
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 4px;
}

.error-panel {
  background: var(--error-bg);
  border-color: #efc7c7;
}

.error-panel h2,
#error-message {
  color: var(--error-fg);
}

#error-message {
  background: var(--surface);
}

.placeholder-band {
  margin: 0 24px 18px 302px;
  max-width: calc(100% - 666px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
}

.pdf-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.pdf-actions strong {
  margin-right: auto;
}

.pdf-actions a {
  color: var(--accent);
  font-weight: 750;
  text-decoration: none;
}

.pdf-frame {
  display: block;
  width: 100%;
  height: 720px;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
}

@media (max-width: 1180px) {
  .subject-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .review-rail {
    grid-column: 2;
    position: static;
  }

  .placeholder-band {
    margin-left: 262px;
    max-width: none;
  }
}

@media (max-width: 820px) {
  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .builder-actions {
    justify-content: flex-start;
  }

  .subject-strip,
  .research-panel,
  .workbench-panel,
  .workspace,
  fieldset,
  .report-page > fieldset.setup-fieldset,
  .profile-section-list {
    grid-template-columns: 1fr;
  }

  .report-page > fieldset label,
  .report-page > fieldset.setup-fieldset label {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .report-page > fieldset.setup-fieldset .checkbox-control {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .sales-comparison-grid {
    min-width: 1040px;
  }

  .workspace {
    padding: 14px;
  }

  .module-nav {
    position: static;
  }

  .review-rail {
    grid-column: auto;
  }

  .placeholder-band {
    margin: 0 14px 14px;
  }

  .tabs {
    padding: 0 14px;
  }
}
