/* --------------------------------------------------------------------------
   Material inquiry & procurement list
   The sheet is measured against the original A4 PDF: 595pt wide, 84pt left
   margin, 412pt table width, 11pt body text, 16pt section headings.
   -------------------------------------------------------------------------- */

:root {
  --ink: #17181a;
  --ink-soft: #6b7078;
  --rule: #dee0e3;
  --paper: #ffffff;
  --backdrop: #e9ebee;
  --accent: #8a5a35;
  --accent-soft: #f8f1ea;
  --toolbar-ink: #1f2329;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-doc: Arial, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC",
    "Noto Sans SC", "Microsoft YaHei", "Noto Sans", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(1200px 640px at 18% -8%, #ffffff 0%, rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, #eef0f3 0%, var(--backdrop) 58%, #e5e7eb 100%);
  background-attachment: fixed;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

body.dialog-open {
  overflow: hidden;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

::selection {
  background: #ead9c7;
  color: #17181a;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  inset-block-start: -80px;
  inset-inline-start: 16px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--toolbar-ink);
  color: #fff;
  font: 500 13px/1 var(--font-ui);
  text-decoration: none;
  transition: inset-block-start 0.15s ease;
}

.skip-link:focus {
  inset-block-start: 14px;
}

/* --------------------------------------------------------------------------
   Toolbar
   -------------------------------------------------------------------------- */

.toolbar {
  position: fixed;
  inset-block-start: max(16px, env(safe-area-inset-top));
  inset-inline-end: max(20px, env(safe-area-inset-right));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 10px 34px rgba(15, 23, 42, 0.12);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
}

.toolbar__divider {
  width: 1px;
  height: 20px;
  margin: 0 2px;
  background: rgba(15, 23, 42, 0.12);
}

.tool-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #474c54;
  font: 500 12.5px/1 var(--font-ui);
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
}

.tool-button:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #111316;
}

.tool-button:active {
  background: rgba(15, 23, 42, 0.1);
}

.tool-button svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-button--language {
  gap: 8px;
  padding-inline: 13px;
  background: var(--toolbar-ink);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.tool-button--language:hover {
  background: #0e1013;
  color: #fff;
}

.tool-button--language:active {
  background: #000;
}

.tool-button--language:disabled {
  opacity: 0.55;
  cursor: progress;
}

.tool-button--language .globe {
  width: 16px;
  height: 16px;
  opacity: 0.9;
}

.tool-button--language .chevron {
  width: 13px;
  height: 13px;
  margin-inline-start: 1px;
  opacity: 0.55;
  stroke-width: 2;
}

.tool-button__native {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12.5px;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   A4-like sheet
   -------------------------------------------------------------------------- */

.page {
  display: flex;
  justify-content: center;
  padding: 92px 24px 76px;
}

.sheet {
  width: 595pt;
  max-width: 100%;
  padding: 88pt 99pt 64pt 84pt;
  background: var(--paper);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.035),
    0 2px 5px rgba(15, 23, 42, 0.05),
    0 24px 64px rgba(15, 23, 42, 0.13);
  font-family: var(--font-doc);
}

.sheet.is-loading {
  display: grid;
  min-height: 70vh;
  place-items: center;
}

.loading {
  display: grid;
  place-items: center;
}

.loading__ring {
  width: 28px;
  height: 28px;
  border: 2px solid #e7e8ea;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.doc-header {
  margin: 0 0 22pt;
}

.doc-title {
  margin: 0 0 36pt;
  margin-inline-end: 24.5pt;
  color: #0c0d0f;
  font-size: 26pt;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  text-wrap: balance;
}

.doc-note {
  max-width: 399pt;
  margin: 0;
  padding-inline-start: 4.5pt;
  border-inline-start: 1.5pt solid #bbbfc4;
  color: var(--ink-soft);
  font-size: 11pt;
  line-height: 1.4;
  text-wrap: pretty;
}

.doc-section {
  margin: 0;
}

.doc-section + .doc-section {
  margin-block-start: 11pt;
}

.doc-section h2 {
  margin-block: 0 11pt;
  margin-inline: 6pt 0;
  color: #0e0f11;
  font-size: 16pt;
  font-weight: 600;
  line-height: 1.4;
  text-wrap: balance;
}

.table-wrap {
  width: 100%;
}

.table-shell {
  position: relative;
}

.table-shell::after {
  content: "";
  display: none;
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  width: 26px;
  background: linear-gradient(to left, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.table-shell.has-overflow:not(.at-end)::after {
  display: block;
}

html[dir="rtl"] .table-shell::after {
  background: linear-gradient(to right, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0));
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

caption {
  text-align: start;
}

th,
td {
  padding: 8pt 5.5pt;
  border: 0.75pt solid var(--rule);
  color: var(--ink);
  font-size: 11pt;
  font-weight: 400;
  line-height: 1.41;
  text-align: start;
  vertical-align: middle;
  overflow-wrap: break-word;
  hyphens: auto;
}

thead th {
  color: #17181a;
}

tbody tr {
  transition: background-color 0.12s ease;
}

tbody tr:hover {
  background: #fcfcfb;
}

.cell-qty {
  unicode-bidi: isolate;
}

.cell-spec {
  letter-spacing: -0.01em;
}

/* Translated documents get a slightly wider purpose column so long Latin,
   Cyrillic, Arabic and Indic phrases stay readable. The Chinese originals and
   CJK translations keep the original five equal columns. */
html:not(:lang(zh-CN)):not(:lang(zh-TW)):not(:lang(ja)):not(:lang(ko)) .doc-section th:nth-child(1) {
  width: 10%;
}

html:not(:lang(zh-CN)):not(:lang(zh-TW)):not(:lang(ja)):not(:lang(ko)) .doc-section th:nth-child(2) {
  width: 23%;
}

html:not(:lang(zh-CN)):not(:lang(zh-TW)):not(:lang(ja)):not(:lang(ko)) .doc-section th:nth-child(3) {
  width: 19%;
}

html:not(:lang(zh-CN)):not(:lang(zh-TW)):not(:lang(ja)):not(:lang(ko)) .doc-section th:nth-child(4) {
  width: 15%;
}

html:not(:lang(zh-CN)):not(:lang(zh-TW)):not(:lang(ja)):not(:lang(ko)) .doc-section th:nth-child(5) {
  width: 33%;
}

html:not(:lang(zh-CN)):not(:lang(zh-TW)):not(:lang(ja)):not(:lang(ko)) .doc-section th,
html:not(:lang(zh-CN)):not(:lang(zh-TW)):not(:lang(ja)):not(:lang(ko)) .doc-section td {
  font-size: 10pt;
}

html:not(:lang(zh-CN)):not(:lang(zh-TW)):not(:lang(ja)):not(:lang(ko)) .doc-section thead th {
  font-size: 9.5pt;
}

.qty {
  unicode-bidi: isolate;
}

.qty__num,
.qty__unit {
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Language dialog
   -------------------------------------------------------------------------- */

.language-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: min(82vh, 720px);
  max-height: min(82dvh, 720px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 40px 120px rgba(15, 23, 42, 0.38);
  overflow: hidden;
}

.language-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in 0.2s cubic-bezier(0.2, 0.75, 0.25, 1);
}

.language-dialog::backdrop {
  background: rgba(16, 22, 31, 0.44);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.language-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 24px 14px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font: 600 10.5px/1.2 var(--font-ui);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.language-dialog__header h2 {
  margin: 0;
  font: 600 23px/1.2 var(--font-ui);
  letter-spacing: -0.015em;
}

.icon-button {
  appearance: none;
  display: grid;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #f2f3f5;
  color: #5c626a;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-button:hover {
  background: #e8eaed;
  color: #16181b;
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.language-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  margin: 0 24px 12px;
  padding: 0 14px;
  border: 1px solid #e7e8ea;
  border-radius: 13px;
  background: #f6f7f8;
  color: #8b9098;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.language-search:focus-within {
  border-color: #c4a184;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(138, 90, 53, 0.11);
}

.language-search svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.language-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #1b1d21;
  font: 400 14px/1.2 var(--font-ui);
}

.language-search input::placeholder {
  color: #9a9fa6;
}

.language-list {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  min-height: 0;
  padding: 0 16px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.language-option {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 9px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  text-align: start;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.language-option:hover {
  background: #f5f5f4;
}

.language-option[aria-current="true"] {
  background: var(--accent-soft);
}

.language-option[hidden] {
  display: none;
}

.language-option__text {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.language-option__native {
  overflow: hidden;
  color: #202226;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.language-option[aria-current="true"] .language-option__native {
  color: #6f431f;
}

.language-option__english {
  margin-block-start: 2px;
  overflow: hidden;
  color: #8b9098;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.language-option__check {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.language-option[aria-current="true"] .language-option__check {
  opacity: 1;
}

.language-empty {
  margin: 0;
  padding: 6px 24px 28px;
  color: #8b9098;
  font: 400 13.5px/1.5 var(--font-ui);
}

/* --------------------------------------------------------------------------
   Messages
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  inset-block-end: max(24px, env(safe-area-inset-bottom));
  inset-inline-start: 50%;
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--toolbar-ink);
  color: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.3);
  font: 400 13px/1.35 var(--font-ui);
  text-align: center;
  transform: translateX(-50%);
}

.toast[hidden] {
  display: none;
}

.doc-error {
  max-width: 440pt;
  padding: 20pt 0;
}

.doc-error h2 {
  margin: 0 0 10pt;
  font-size: 18pt;
  line-height: 1.3;
}

.doc-error p {
  margin: 0 0 8pt;
  color: var(--ink-soft);
  font-size: 11pt;
  line-height: 1.6;
}

.doc-error button {
  margin-block-start: 10pt;
  padding: 9pt 16pt;
  border: 0;
  border-radius: 999px;
  background: var(--toolbar-ink);
  color: #fff;
  font: 500 11pt/1 var(--font-ui);
  cursor: pointer;
}

.noscript {
  max-width: 595pt;
  margin: 0 auto 40px;
  padding: 24px 28px;
  border: 1px solid #e3d3bf;
  border-radius: 14px;
  background: #fffaf4;
  color: #5c4632;
  font: 400 14px/1.6 var(--font-ui);
}

.noscript a {
  font-weight: 600;
}

.notfound {
  padding: 88pt 84pt 80pt;
  font-family: var(--font-doc);
}

.notfound h1 {
  margin: 0 0 18pt;
  font-size: 26pt;
  font-weight: 600;
  line-height: 1.3;
}

.notfound p {
  max-width: 380pt;
  margin: 0 0 10pt;
  color: var(--ink-soft);
  font-size: 11pt;
  line-height: 1.6;
}

.notfound a {
  color: var(--accent);
  font-weight: 600;
  text-underline-offset: 3px;
}

/* Optional built-in page-view counter (configured in /admin). */
.site-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: -38px auto 34px;
  padding: 0 24px;
  color: #7d838b;
  font: 500 11.5px/1.2 var(--font-ui);
  letter-spacing: 0.02em;
}

.site-counter__dot {
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: #a87349;
}

.site-counter__value {
  color: #3c4148;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Language-specific typefaces
   -------------------------------------------------------------------------- */

html:lang(zh-CN) .sheet {
  font-family: Arial, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", sans-serif;
}

html:lang(zh-TW) .sheet {
  font-family: Arial, "Helvetica Neue", "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK TC",
    sans-serif;
}

html:lang(ja) .sheet {
  font-family: "Helvetica Neue", Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic",
    "Noto Sans CJK JP", "Noto Sans JP", sans-serif;
}

html:lang(ko) .sheet {
  font-family: "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR",
    "Noto Sans KR", sans-serif;
}

html:lang(ar) .sheet,
html:lang(fa) .sheet {
  font-family: "SF Arabic", "Geeza Pro", "Segoe UI", "Noto Naskh Arabic", "Noto Sans Arabic",
    Tahoma, sans-serif;
}

html:lang(hi) .sheet {
  font-family: "Noto Sans Devanagari", "Kohinoor Devanagari", "Nirmala UI", Mangal, Arial,
    sans-serif;
}

html:lang(th) .sheet {
  font-family: Thonburi, "Noto Sans Thai", "Leelawadee UI", Tahoma, Arial, sans-serif;
}

html:lang(ar) .language-dialog,
html:lang(fa) .language-dialog {
  font-family: "SF Arabic", "Geeza Pro", "Segoe UI", "Noto Naskh Arabic", "Noto Sans Arabic",
    Tahoma, var(--font-ui);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 660px) {
  .toolbar {
    inset-block-start: max(10px, env(safe-area-inset-top));
    inset-inline-end: max(10px, env(safe-area-inset-right));
    padding: 5px;
  }

  .tool-button {
    height: 34px;
  }

  .tool-button--aux {
    width: 34px;
    padding: 0;
  }

  .tool-button--aux .tool-button__label {
    display: none;
  }

  .tool-button--language {
    max-width: calc(100vw - 116px);
    padding-inline: 12px;
  }

  .tool-button__native {
    max-width: 148px;
  }
}

@media (max-width: 740px) {
  .page {
    padding: 76px 10px 32px;
  }

  .sheet {
    width: 100%;
    padding: 34px 20px 36px;
  }

  .doc-title {
    margin-block-end: 26pt;
    margin-inline-end: 0;
    font-size: 23pt;
  }

  .site-counter {
    margin: -10px auto 26px;
  }

  .doc-note {
    max-width: none;
  }

  .doc-section h2 {
    margin-inline-start: 0;
  }

  .table-wrap {
    margin-inline: -20px;
    padding-inline: 20px;
    padding-block-end: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 580px;
  }

  th,
  td {
    font-size: 10.5pt;
  }
}

@media (max-width: 560px) {
  .language-dialog {
    width: calc(100vw - 20px);
    max-height: 88vh;
    max-height: 88dvh;
    border-radius: 19px;
  }

  .language-dialog__header {
    padding: 20px 18px 12px;
  }

  .language-search {
    margin-inline: 18px;
  }

  .language-list {
    grid-template-columns: 1fr;
    padding: 0 10px 12px;
  }

  .language-empty {
    padding-inline: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* --------------------------------------------------------------------------
   Print: reproduce the PDF page geometry
   -------------------------------------------------------------------------- */

@page {
  size: A4;
  margin: 29.6mm 34.9mm 28mm 29.6mm;
}

@media print {
  html,
  body {
    background: #fff !important;
    scrollbar-gutter: auto;
  }

  body {
    min-height: auto;
    overflow: visible;
  }

  body.dialog-open {
    overflow: visible;
  }

  .toolbar,
  .language-dialog,
  .toast,
  .skip-link,
  .noscript,
  .loading,
  .site-counter {
    display: none !important;
  }

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

  .sheet {
    width: auto;
    max-width: none;
    padding: 0;
    box-shadow: none;
  }

  .sheet.is-loading {
    min-height: 0;
    display: block;
  }

  .doc-title {
    font-size: 26pt;
  }

  .doc-section h2 {
    break-after: avoid-page;
    page-break-after: avoid;
  }

  thead {
    display: table-header-group;
  }

  tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .table-wrap {
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .table-shell::after {
    display: none !important;
  }

  table {
    min-width: 0;
  }

  tbody tr:hover {
    background: transparent;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
