/* AI-Powered Material Description Generator - styles. Colors meet a 4.5:1 contrast ratio on their backgrounds. */
:root {
  --text: #1b1f24;
  --muted: #555e68;
  --border: #c9d1d9;
  --input-border: #6b7682;
  --panel: #f6f8fa;
  --page: #f2f4f7;
  --title: #12355b;
  --brand-green: #007934;   /* the green in the A. O. Smith logo */
  --primary: #0b5cad;
  --primary-dark: #08457f;
  --focus: #ffbf47;
  --error-bg: #fdecee;
  --error-text: #8a0014;
  --warning-bg: #fff4e5;
  --warning-text: #6b4100;
  --success-bg: #e8f5ea;
  --success-text: #1a5c2a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--page);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: #fff;
  color: var(--primary);
}

/* Header: logo on the left, title centered on the page, user and Sign out on the right.
   White, so the logo's black lettering stays readable. */
.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.625rem 1.5rem;
  background: #fff;
  border-bottom: 4px solid var(--brand-green);
}
.header-logo { grid-column: 1; grid-row: 1; justify-self: start; }
.header-logo img { display: block; width: auto; height: 36px; }
.app-title {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  color: var(--title);
  font-size: 1.3125rem;
  font-weight: 600;
  text-align: center;
}
.user-area {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  font-size: 0.875rem;
}
#user-name { overflow-wrap: anywhere; }

/* Body: a centered column. When a result is shown, Sources sit to its left (see the media queries). */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 56rem) minmax(0, 1fr);
  column-gap: 1.5rem;
  align-items: start;
  padding: 1.5rem;
}
.layout:focus { outline: none; }
.content { grid-column: 2; grid-row: 1; min-width: 0; }
.sources {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  width: 100%;
  max-width: 20rem;
  position: sticky;
  top: 1rem;
}

.card {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}
section { margin-bottom: 2rem; }
section.card { margin-bottom: 1.5rem; }

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.75rem; }
h3 { font-size: 1.0625rem; margin: 1.25rem 0 0.5rem; }
h2:focus { outline: none; }

.field { margin-bottom: 1rem; }
label, legend { display: block; margin-bottom: 0.25rem; font-weight: 600; }
.optional { font-weight: 400; color: var(--muted); }
textarea, input[type="text"], input[type="password"], input[type="email"], input[type="file"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: #fff;
  color: inherit;
  font: inherit;
}
.help { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.9375rem; }
#corrected-description { text-transform: uppercase; }   /* app.js upper-cases the value when it's saved */

fieldset {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.choice { display: flex; align-items: center; gap: 0.5rem; margin: 0.25rem 0; }
.choice label { margin: 0; font-weight: 400; }
.choice input { width: 1.125rem; height: 1.125rem; }

button {
  padding: 0.5rem 1.25rem;
  border: 2px solid var(--primary);
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
button:hover { border-color: var(--primary-dark); background: var(--primary-dark); }
button.secondary { background: #fff; color: var(--primary); }
button.secondary:hover { background: #eef4fb; color: var(--primary-dark); }
button.small { padding: 0.25rem 0.75rem; font-size: 0.9375rem; }
button:disabled { opacity: 0.6; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.actions.center { justify-content: center; }   /* Sign in and Submit */

/* Example requests under the Request box: selecting one fills the box. */
.examples { margin: -0.25rem 0 1.25rem; }
.examples-heading { margin: 0 0 0.5rem; font-weight: 600; }
.example-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 0.75rem 1.5rem; }
.example-group-title { margin: 0 0 0.375rem; color: var(--muted); font-size: 0.875rem; font-weight: 600; }
.example-list { display: flex; flex-direction: column; align-items: flex-start; gap: 0.375rem; margin: 0; padding: 0; list-style: none; }
.example-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; }
button.example {
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--input-border);
  border-radius: 1rem;
  background: var(--panel);
  color: var(--primary);
  font-size: 0.875rem;
  text-align: left;
}
button.example:hover { border-color: var(--primary-dark); background: #eef4fb; color: var(--primary-dark); }
.example-note { color: var(--muted); font-size: 0.8125rem; }

/* Sign-in card: a narrower box, centered in the body. */
.card.signin { max-width: 30rem; margin-left: auto; margin-right: auto; }
/* The authenticator code: the Code label and the box are centered in the card, and so are the digits. */
.code-field { text-align: center; }
.signin input.code {
  display: block;
  max-width: 10rem;
  margin: 0 auto;
  letter-spacing: 0.15em;
  text-align: center;
}
ol.steps { margin: 0.5rem 0 1rem; padding-left: 1.25rem; }
ol.steps li { margin: 0.375rem 0; }
/* The authenticator setup QR code, centered: black on white with its light margin (quiet zone). app.js sets its
   size in whole pixels per module; on narrow screens it shrinks to fit. */
.qr { margin: 0.5rem 0 0.5rem -1.25rem; }   /* spans the whole card (the list is indented 1.25rem), so it's centered */
.qr svg {
  display: block;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  box-sizing: content-box;     /* the border goes outside, so the modules keep their whole-pixel size */
  border: 1px solid var(--border);
  forced-color-adjust: none;   /* stays black on white in Windows high-contrast themes, so it can still be scanned */
}
.key-fallback { margin-top: 0.5rem; }
.key-fallback summary { color: var(--primary); cursor: pointer; text-decoration: underline; }
.key-fallback summary:hover { color: var(--primary-dark); }
.key-fallback[open] summary { margin-bottom: 0.25rem; }
.key-fallback p { margin: 0.25rem 0; }
.secret {
  display: block;
  margin: 0.375rem 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  font-size: 1rem;
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
  user-select: all;
}

/* Result card header: the heading on the left, New request on the right. */
.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.panel-header h2 { margin: 0; }

.alert {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid currentColor;
  border-radius: 4px;
  background: var(--panel);
}
.alert.error { background: var(--error-bg); color: var(--error-text); }
.alert.warning { background: var(--warning-bg); color: var(--warning-text); }
.alert.success { background: var(--success-bg); color: var(--success-text); }
.alert p { margin: 0; }

/* Popup for a refused prompt (the request API's SENSITIVE_PROMPT answer): centered over a dimmed page. */
dialog.guard-dialog {
  width: min(34rem, calc(100% - 2rem));
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-top: 6px solid var(--warning-text);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.25);
}
dialog.guard-dialog::backdrop { background: rgba(16, 24, 40, 0.55); }
.guard-dialog h2 { margin: 0 0 0.75rem; color: var(--warning-text); }
.guard-dialog p { margin: 0 0 0.75rem; }
.guard-dialog ul { margin: 0 0 0.75rem; padding-left: 1.25rem; font-weight: 600; }
.guard-dialog .actions { margin-top: 1.25rem; }
/* How Nova Pro read the prompt ("Read as: ..."), set apart from the explanation. */
.guard-dialog .guard-read {
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  overflow-wrap: anywhere;
}
/* Phones: tighter, so the whole popup usually fits without scrolling. When it still scrolls, app.js opens it at
   the heading instead of the button. */
@media (max-width: 30rem) {
  dialog.guard-dialog { width: calc(100% - 1.5rem); padding: 1rem; font-size: 0.9375rem; line-height: 1.4; }
  .guard-dialog h2 { font-size: 1.125rem; margin-bottom: 0.5rem; }
  .guard-dialog p, .guard-dialog ul { margin-bottom: 0.5rem; }
  .guard-dialog .actions { margin-top: 0.75rem; }
}

.status { font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: Consolas, "Courier New", monospace; }

.block { margin-top: 1.25rem; padding-top: 0.25rem; border-top: 1px solid var(--border); }
.description {
  margin: 0.25rem 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  font-size: 1.375rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
/* The recommended description, centered in the result. */
.description-hero { text-align: center; }
.description-hero .description { width: fit-content; max-width: 100%; margin: 0.5rem auto; padding: 0.625rem 1.25rem; }
.description-hero .actions { justify-content: center; margin-top: 0.5rem; }

/* Tables fit the card. The horizontal scroll is only a fallback for phone-sized screens. */
.table-wrap { margin: 0.5rem 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
caption { padding: 0.25rem 0; font-weight: 600; text-align: left; }
th, td { padding: 0.375rem 0.5rem; border: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--panel); }
ul.evidence { margin: 0; padding-left: 1rem; }
/* Long values without spaces (SCREW,SHC,M4X14,STL) may wrap anywhere, so no column pushes the table wider. */
table.attributes td, table.materials td { overflow-wrap: anywhere; }
table.attributes .badge, table.materials .badge, table.materials .mono { overflow-wrap: normal; white-space: nowrap; }

/* Existing and similar materials: fixed column widths, and the description takes the rest of the width.
   min-width keeps the description readable; only screens narrower than that scroll. */
table.materials { table-layout: fixed; min-width: 34rem; font-size: 0.875rem; }
table.materials th, table.materials td { padding: 0.375rem; }
table.materials col.col-material { width: 5.75rem; }
table.materials col.col-match { width: 9.5rem; }
table.materials col.col-plant { width: 3.25rem; }
table.materials col.col-type { width: 3.5rem; }
table.materials col.col-status { width: 3.75rem; }
.match-detail { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.8125rem; }

.badge {
  display: inline-block;
  padding: 0 0.5rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge.good { background: var(--success-bg); color: var(--success-text); }
.badge.warn { background: var(--warning-bg); color: var(--warning-text); }
.badge.bad { background: var(--error-bg); color: var(--error-text); }
.badge.neutral { background: #fff; color: var(--muted); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0.5rem 0; }
dl.facts dt { font-weight: 600; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
ul.findings li { margin: 0.25rem 0; }

/* Sources: label above value, so the details fit the narrow left column. */
.sources.card { padding: 1.25rem 1rem; }
.sources h2 { font-size: 1.125rem; }
.sources dl.facts { grid-template-columns: minmax(0, 1fr); gap: 0; margin: 0; }
.sources dl.facts dt { margin-top: 0.625rem; font-size: 0.875rem; }
.sources dl.facts dt:first-child { margin-top: 0; }
.sources dl.facts dd { font-size: 0.875rem; }
.sources dl.facts dd:first-of-type { font-size: 0.8125rem; }   /* the 32-character request ID stays on one line */

.site-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}
.site-footer p { margin: 0.375rem 0; }   /* the SAP note, then the team credit and the contact link */
.site-footer a, .back-link a, .support-sent a { color: var(--primary); }
.site-footer a:hover, .back-link a:hover, .support-sent a:hover { color: var(--primary-dark); }

/* The contact link opens the ServiceNow request form in a new tab. The icon shows that, and screen readers hear
   "(opens ServiceNow in a new tab)". nowrap keeps the icon on the same line as the link text. */
.site-footer a { white-space: nowrap; }
.new-tab-icon { width: 0.75em; height: 0.75em; margin-left: 0.25em; vertical-align: -0.05em; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap;
}

/* Support page (support.html): a centered card like the sign-in card, a little wider. Not on the site now: the
   page is parked in aws/parked/jira-support. These rules stay so it works again if it's moved back. */
.card.support, .back-link { max-width: 40rem; margin-left: auto; margin-right: auto; }
.back-link { margin-top: 0; margin-bottom: 0.75rem; }
.support-sent { margin-top: 0.5rem; padding: 1rem 1.25rem; border-left: 4px solid currentColor; border-radius: 4px;
  background: var(--success-bg); color: var(--success-text); }
.support-sent h2 { margin: 0 0 0.25rem; font-size: 1.125rem; }
.support-sent p { margin: 0; color: var(--text); }
.support-sent .actions { align-items: center; }

/* Header on narrower screens: logo and user on the first row, the title centered on the second. */
@media (max-width: 75rem) {
  .site-header { grid-template-columns: auto minmax(0, 1fr); }
  .header-logo { grid-column: 1; grid-row: 1; }
  .user-area { grid-column: 2; grid-row: 1; }
  .app-title { grid-column: 1 / -1; grid-row: 2; }
}

/* Medium screens (below 1536 px): the side columns are too narrow for Sources, so the body and Sources
   form one centered group, Sources on the left. Without Sources the body is centered on its own. */
@media (max-width: 95.9375rem) {
  .layout { grid-template-columns: minmax(0, 56rem); justify-content: center; }
  .content { grid-column: 1; }
  .layout.has-sources { grid-template-columns: 17rem minmax(0, 56rem); }
  .layout.has-sources .content { grid-column: 2; }
  .sources { max-width: none; }
}

/* Small screens: one column; Sources follow the result. */
@media (max-width: 60rem) {
  .layout, .layout.has-sources { grid-template-columns: minmax(0, 1fr); }
  .content, .layout.has-sources .content { grid-column: 1; }
  .sources { grid-column: 1; grid-row: 2; justify-self: stretch; position: static; }
}

@media (max-width: 40rem) {
  .layout { padding: 1rem; }
  .card { padding: 1rem; }
  .app-title { font-size: 1.125rem; }
  .description { font-size: 1.125rem; }
  dl.facts { grid-template-columns: 1fr; }
}
