/* Western States Wildfire design system tokens (tokens.json).
   The system is light-only, so the app is too. */
:root {
  --brand: #4f706a;
  --on-brand: #ffffff;
  --ink: #3a3a3a;
  --ink-muted: #717171;
  --divider-glyph: #a9a9aa;
  --paper: #ffffff;
  --panel: #f1f1f1;
  --hairline: #dcdedf;
  --hairline-light: #e5e5e5;
  --overlay: rgba(0, 0, 0, 0.85);

  --space-2: 2px;
  --space-3: 3px;
  --space-4: 4px;
  --space-5: 5px;
  --space-7: 7px;
  --space-9: 9px;
  --space-10: 10px;
  --space-11: 11px;
  --space-12: 12px;
  --space-15: 15px;
  --space-20: 20px;

  --radius-panel: 8px;
  --radius-image: 5px;
  --border-hairline: 1px;
  --border-title: 3px;

  --font-sans: "Barlow", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* App additions: the report system has no interactive or error states. */
  --brand-strong: #3f5a55; /* hover/active on `brand`; white on it is 7.6:1 */
  --danger: #a1352c; /* validation text on `paper` (6.9:1) and `panel` (6.1:1) */
  --control-border: #8a8a8a; /* input borders, 3.4:1 on `paper` */
  --page-max: 1280px;
  --gutter: 16px;

  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
}

h1,
h2,
h3,
h4,
p,
dl,
dd {
  margin: 0;
}

a {
  color: var(--brand);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--brand-strong);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* App header: logo + report-title treatment */

.app-header {
  border-bottom: var(--border-hairline) solid var(--hairline);
  background: var(--paper);
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-12) var(--gutter);
}

.lockup {
  display: flex;
  align-items: center;
  min-width: 0;
}

.logo {
  display: block;
  width: clamp(140px, 30vw, 220px);
  height: auto;
  flex: none;
}

.app-title {
  border-left: var(--border-title) solid var(--panel);
  margin-left: var(--space-20);
  padding: var(--space-5) 0 var(--space-5) var(--space-20);
  color: var(--brand);
  font-size: 23px;
  font-weight: 500;
  white-space: nowrap;
}

.auth-controls {
  display: flex;
  align-items: center;
  flex: none;
}

/* Page layout: the report's 14-column grid, 8 main / 6 side */

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-20) var(--gutter) 48px;
}

.layout {
  display: grid;
  gap: 32px var(--space-20);
}

.layout-main {
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
}

.layout-side {
  min-width: 0;
}

@media (min-width: 1100px) {
  .layout {
    grid-template-columns: repeat(14, minmax(0, 1fr));
    gap: var(--space-20);
  }

  .layout-main {
    grid-column: 1 / span 8;
  }

  .layout-side {
    grid-column: 9 / span 6;
    align-self: start;
  }
}

.section {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.notice {
  max-width: 40rem;
  margin: 48px auto;
  padding: var(--space-20);
  background: var(--panel);
  border-radius: var(--radius-panel);
  text-align: center;
}

/* SectionHeader */

.section-header {
  margin: 0;
  background: var(--brand);
  color: var(--on-brand);
  padding: var(--space-7) var(--space-12);
  border-radius: var(--radius-panel);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

/* ResponseBlock */

.response-block {
  background: var(--panel);
  border-radius: var(--radius-panel);
  padding: var(--space-12) var(--space-12) var(--space-15);
}

.response-heading {
  margin: 0 0 var(--space-10);
  padding: 0 var(--space-5) var(--space-10);
  border-bottom: var(--border-hairline) solid var(--hairline);
  color: var(--ink);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
}

.response-heading .count {
  color: var(--ink-muted);
  font-size: 16px;
  font-weight: 400;
}

.subheader {
  display: inline-block;
  width: fit-content;
  margin: var(--space-10) 0 var(--space-3);
  padding: var(--space-4) var(--space-7);
  background: var(--brand);
  color: var(--on-brand);
  border-radius: var(--radius-panel);
  font-size: 13.6px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* QuestionRow, used for definition lists */

.questions {
  display: flex;
  flex-direction: column;
}

.question {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-12);
  padding: var(--space-11) var(--space-4);
  border-bottom: var(--border-hairline) solid var(--hairline);
}

.question:last-child {
  border-bottom: none;
}

.question-text {
  color: var(--ink);
  font-weight: 400;
}

.response {
  color: var(--ink);
  font-weight: 500;
  text-align: right;
  overflow-wrap: anywhere;
}

.horizontal-divider {
  color: var(--divider-glyph);
  padding: 0 var(--space-3);
}

.horizontal-divider::after {
  content: "| ";
}

/* Forms */

.lookup-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
}

.lookup-row {
  display: flex;
  gap: var(--space-10);
}

.lookup-row input {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 28rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-20);
}

.form-grid {
  display: grid;
  gap: var(--space-12) var(--space-20);
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid .span-all {
    grid-column: 1 / -1;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: var(--space-7) var(--space-10);
  border: var(--border-hairline) solid var(--control-border);
  border-radius: var(--radius-image);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 400;
}

input:hover,
select:hover {
  border-color: var(--ink-muted);
}

input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 0;
  border-color: var(--brand);
}

input[aria-invalid="true"] {
  border-color: var(--danger);
}

input[type="number"] {
  font-variant-numeric: tabular-nums;
}

.hint {
  color: var(--ink-muted);
  font-size: 14px;
}

.field-error {
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
}

.field-error:empty {
  display: none;
}

/* Line items */

.line-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
}

.line-items .subheader {
  margin-top: 0;
}

#line-items {
  display: flex;
  flex-direction: column;
}

.line-item {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-10) var(--space-12);
  align-items: start;
  padding: var(--space-12) 0;
  border-bottom: var(--border-hairline) solid var(--hairline);
}

.line-item-description {
  grid-column: 1 / -1;
}

.line-item .remove-line-item {
  grid-column: 1 / -1;
  justify-self: start;
}

@media (min-width: 720px) {
  .line-item {
    grid-template-columns: minmax(0, 1fr) 9rem 9rem auto;
  }

  .line-item-description,
  .line-item .remove-line-item {
    grid-column: auto;
  }

  /* Align the quiet button with the inputs, below the label row. */
  .line-item .remove-line-item {
    margin-top: 24px;
  }
}

.line-items-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-12);
  padding-top: var(--space-7);
}

.total {
  display: flex;
  align-items: baseline;
  gap: var(--space-12);
}

.total-label {
  color: var(--ink-muted);
}

.total-value {
  font-size: 20px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: var(--space-12);
  border-top: var(--border-hairline) solid var(--hairline);
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: var(--space-7) var(--space-15);
  border: var(--border-hairline) solid var(--brand);
  border-radius: var(--radius-panel);
  background: var(--brand);
  color: var(--on-brand);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.button:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.button-secondary {
  background: var(--paper);
  color: var(--brand);
  border-color: var(--brand);
}

.button-secondary:hover {
  background: var(--paper);
  color: var(--brand-strong);
  border-color: var(--brand-strong);
}

.button-quiet {
  min-height: 40px;
  padding: var(--space-7) var(--space-10);
  background: transparent;
  border-color: transparent;
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.button-quiet:hover {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
}

.button-small {
  min-height: 32px;
  padding: var(--space-3) var(--space-10);
  font-size: 14px;
}

/* Lookup results */

.results {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.results:empty {
  display: none;
}

.results-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-5) var(--space-12);
  padding: var(--space-10) var(--space-5) 0;
}

.results-summary h3 {
  font-size: 20px;
  font-weight: 500;
}

.results-summary p {
  color: var(--ink-muted);
}

.table-wrap {
  overflow-x: auto;
  margin: 0 calc(-1 * var(--space-4));
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-11) var(--space-7);
  border-bottom: var(--border-hairline) solid var(--hairline);
}

tbody tr:last-child td {
  border-bottom: none;
}

th {
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  color: var(--ink);
}

td.numeric,
th.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.strong {
  font-weight: 500;
}

td.mono {
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-wrap: anywhere;
}

td.action {
  text-align: right;
  vertical-align: middle;
}

td .not-available {
  color: var(--ink-muted);
}

td.empty {
  color: var(--ink-muted);
  text-align: center;
  padding: var(--space-20);
}

.url {
  display: inline-block;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* API reference */

.layout-side {
  gap: var(--space-12);
}

.doc {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
}

.doc .response-heading {
  margin-bottom: 0;
}

.doc p {
  padding: 0 var(--space-5);
}

.doc .subheader {
  margin-bottom: 0;
}

.doc .question {
  padding-block: var(--space-7);
}

.doc .question-text {
  font-family: var(--font-mono);
  font-size: 14px;
}

pre {
  margin: 0;
  overflow-x: auto;
  padding: var(--space-10) var(--space-12);
  border: var(--border-hairline) solid var(--hairline);
  border-radius: var(--radius-image);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

pre code {
  font-size: inherit;
}

pre.endpoint {
  font-weight: 600;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Dialogs */

dialog {
  width: min(44rem, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: none;
  border-radius: var(--radius-panel);
  background: var(--paper);
  color: var(--ink);
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog::backdrop {
  background: var(--overlay);
  opacity: 0.6;
}

dialog > .section-header {
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  padding: var(--space-12) var(--space-20);
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  padding: var(--space-15) var(--space-20);
  overflow: auto;
}

.dialog-body pre {
  max-height: 60vh;
  background: var(--panel);
  border: none;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-10);
  padding: var(--space-12) var(--space-20);
  border-top: var(--border-hairline) solid var(--hairline);
}

.error-message {
  font-family: var(--font-mono);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.link-response {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-5);
}

/* Small screens */

@media (max-width: 560px) {
  .lockup {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

  .logo {
    width: 140px;
  }

  .app-title {
    border-left: none;
    margin-left: 0;
    padding: 0;
    font-size: 18px;
  }

  .lookup-row {
    flex-direction: column;
  }

  .lookup-row input {
    max-width: none;
  }

  .question {
    flex-direction: column;
    gap: var(--space-2);
  }

  .response {
    text-align: left;
  }

  .link-response {
    align-items: flex-start;
  }

  .form-actions .button {
    width: 100%;
  }
}
