/* ==========================================================================
   Dharma Design System — Medicine Buddha (药师) theme
   Version: 1.2.0-medical
   Scope: Intro Site + Registration Form + Payment + PDF attachment
   Accent: lapis lazuli blue (琉璃蓝)
   ========================================================================== */

:root {
  /* Brand palette — Medicine Buddha lapis */
  --ds-primary: #1a4d8c;
  --ds-primary-strong: #0f2f5c;
  --ds-primary-light: #2d76bd;
  --ds-red: #b03a2e;
  --ds-gold: #4aa3d9;
  --ds-gold-light: #9ed4f2;
  --ds-gold-nav: #b8d9f0;

  /* Actions & chrome */
  --ds-btn-primary-bg: #1e5aa8;
  --ds-btn-primary-bg-hover: #164a8c;
  --ds-btn-primary-bg-active: #0f3668;
  --ds-footer-bg: #0d1f3c;
  --ds-banner-bg: #0a1628;

  /*
   * Shared banner geometry (1920×640 source art).
   * Form: .ds-banner-frame + .ds-banner-photo → height = --ds-form-banner-h
   * Intro site: .ds-intro-banner-h + nav (--ds-intro-nav-h) = --ds-form-banner-h
   */
  --ds-banner-aspect-w: 1920;
  --ds-banner-aspect-h: 640;
  --ds-form-banner-h: calc(100vw * var(--ds-banner-aspect-h) / var(--ds-banner-aspect-w));
  --ds-intro-nav-h: 5.25rem;
  --ds-intro-banner-h: max(0px, calc(var(--ds-form-banner-h) - var(--ds-intro-nav-h)));

  /* Intro site layout */
  --ds-intro-font-family:
    "Noto Serif SC", "Songti SC", "PingFang SC", "Microsoft YaHei", Georgia, serif;
  --ds-intro-page-max: 54rem;
  --ds-intro-section-gap: 5rem;
  --ds-intro-section-gap-tight: 4.5rem;
  --ds-intro-title-gap: 1.75rem;
  --ds-intro-block-gap: 1.75rem;
  --ds-intro-title-line-max: 7.5rem;

  /* Semantic surfaces & borders */
  --ds-accent-soft: rgba(26, 77, 140, 0.12);
  --ds-text-warm: #4a6280;
  --ds-surface-warm: #f0f6fb;
  --ds-surface-cream: #f7fbfe;
  --ds-surface-highlight: #eaf4fb;
  --ds-border-warm: #c5d9eb;
  --ds-border-subtle: rgba(15, 47, 92, 0.12);
  --ds-notice-bg: #eef6fc;
  --ds-notice-border: #7eb8e0;
  --ds-notice-text: #1a4d8c;
  --ds-danger: #dc3545;
  --ds-lang-active-text: #0f2f5c;
  --ds-offering-hint: #2f7bc4;
  --ds-offering-head-bg: #eaf3fa;
  --ds-autofill-bg: #e8f2fa;

  /* Layout & stacking */
  --ds-layout-max: 1400px;
  --ds-z-sticky-nav: 1030;
  --ds-z-back-top: 1080;
  --ds-nav-h-mobile: 4.2rem;

  /* Neutrals */
  --ds-bg: #f4f7fb;
  --ds-surface: #ffffff;
  --ds-surface-soft: #f7fbfe;
  --ds-border: #d0e0ef;
  --ds-text: #2a3f56;
  --ds-text-muted: #5a6f85;
  --ds-text-light: #62778c;

  /* Typography */
  --ds-font-family:
    "Noto Sans SC",
    "Microsoft YaHei",
    "微软雅黑",
    "PingFang SC",
    Arial,
    sans-serif;
  --ds-font-size-body: 15px;
  --ds-line-height-body: 1.65;
  --ds-font-size-title: clamp(22px, 4.5vw, 36px);
  --ds-font-size-card-title: 22px;
  --ds-font-size-section-title: 19px;

  /* Spacing / radius / shadow */
  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 20px;
  --ds-space-6: 24px;
  --ds-space-7: 32px;
  --ds-space-8: 40px;

  --ds-radius-sm: 6px;
  --ds-radius-md: 8px;
  --ds-radius-lg: 12px;

  --ds-shadow-sm: 0 2px 10px rgba(15, 47, 92, 0.06);
  --ds-shadow-md: 0 4px 18px rgba(26, 77, 140, 0.14);
}

/* Medicine offering tables — single-name rows */
.dh-merit-table {
  table-layout: fixed;
  width: 100%;
}

.ds-table.dh-merit-table .ds-col-num {
  width: 40px;
  text-align: center;
}

.dh-merit-table .dh-col-action {
  width: 44px;
  padding-left: 4px !important;
  padding-right: 4px !important;
  text-align: center;
  white-space: nowrap;
}

.dh-merit-table .dh-col-names {
  width: auto;
}

.dh-merit-table .dh-remove-btn,
.dh-entry-card .dh-remove-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.dh-merit-table .dh-remove-btn i,
.dh-entry-card .dh-remove-btn i {
  font-size: 14px;
}

/* Multi-name offerings (会主灯 / 药师灯) — card layout */
.dh-entry-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 4px;
}

.dh-entry-card {
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface-soft);
  padding: 16px 18px 18px;
}

.dh-entry-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ds-border-warm);
}

.dh-entry-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
}

.dh-entry-card__index {
  font-size: 15px;
  font-weight: 600;
  color: var(--ds-text);
  line-height: 1.2;
}

.dh-name-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 14px;
  align-items: end;
}

.dh-name-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.dh-name-field--suffix {
  justify-content: flex-end;
}

.dh-name-field--suffix .dh-name-suffix {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 4px;
}

.dh-name-field__label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ds-text-muted);
  letter-spacing: 0.04em;
}

.dh-name-field .form-control {
  width: 100%;
  font-size: 15px;
  padding: 9px 12px;
}

/* Single-name table cells */
.dh-name-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.dh-name-grid .form-control {
  flex: 1 1 220px;
  min-width: 180px;
  font-size: 15px;
  padding: 8px 12px;
}

.dh-name-suffix {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 600;
  color: var(--ds-primary);
  white-space: nowrap;
  padding: 0 6px;
}

@media (max-width: 991.98px) {
  .dh-name-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .dh-name-fields {
    grid-template-columns: 1fr;
  }

  .dh-entry-card {
    padding: 14px;
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

body.ds-body {
  margin: 0;
  font-family: var(--ds-font-family);
  font-size: var(--ds-font-size-body);
  line-height: var(--ds-line-height-body);
  color: var(--ds-text);
  background: var(--ds-bg);
}

body.ds-body a {
  color: var(--ds-primary-light);
}

body.ds-body a:hover {
  color: var(--ds-primary);
}

body.ds-body a:focus-visible {
  outline: 2px solid var(--ds-primary);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.ds-main-wrap {
  width: 100%;
  max-width: var(--ds-layout-max);
  margin: 0 auto;
  padding: 0 var(--ds-space-8) 60px;
}

.ds-main-wrap.ds-main-wrap--compact {
  padding-top: 0;
  padding-bottom: 0;
}

.ds-hero {
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   Banner
   -------------------------------------------------------------------------- */

/*
 * Legacy cover banner — prefer .ds-banner-frame + .ds-banner-photo on new pages.
 * @deprecated
 */
.ds-banner {
  position: relative;
  width: 100%;
  height: clamp(220px, 36vw, 480px);
  min-height: 240px;
  overflow: hidden;
  background-color: var(--ds-banner-bg);
}

.ds-banner-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.ds-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.1) 50%,
    transparent 100%
  );
}

/* Banner — Form pages (full image height = --ds-form-banner-h at 1920×640) */
.ds-banner-frame {
  position: relative;
  width: 100%;
  background: var(--ds-banner-bg);
}

.ds-banner-photo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
}

@media (max-width: 991.98px) {
  .ds-banner {
    height: auto;
    aspect-ratio: 21 / 9;
    min-height: 200px;
    max-height: 48vh;
  }
}

@media (max-width: 991.98px) and (orientation: portrait) {
  .ds-banner {
    aspect-ratio: 4 / 3;
    max-height: 56vh;
    min-height: clamp(160px, 52vw, 320px);
  }
  .ds-banner-img {
    object-position: center top;
  }
}

/* --------------------------------------------------------------------------
   Header / title / language toggle
   -------------------------------------------------------------------------- */

.ds-lang-toggle {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 40px;
  background: var(--ds-surface-warm);
}

.ds-lang-toggle button {
  min-height: 44px;
  border: 1.5px solid var(--ds-primary);
  background: transparent;
  color: var(--ds-primary);
  border-radius: var(--ds-radius-sm);
  padding: 7px 22px;
  font-size: var(--ds-font-size-body);
  cursor: pointer;
  transition:
    background-color 0.2s,
    border-color 0.2s,
    color 0.2s;
}

.ds-lang-toggle button:hover,
.ds-lang-toggle button.ds-active {
  background: var(--ds-gold-nav);
  color: var(--ds-lang-active-text);
}

.ds-lang-toggle button:focus-visible {
  outline: 2px solid var(--ds-primary);
  outline-offset: 2px;
}

.ds-page-title {
  text-align: center;
  padding: 16px 16px 12px;
  margin-bottom: 22px;
}

.ds-page-title--spaced {
  margin-bottom: 28px;
}

.ds-page-title .ds-temple-name {
  color: var(--ds-primary-strong);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 4px;
  margin: 0 0 10px;
}

.ds-page-title h1 {
  margin: 0 0 8px;
  font-size: var(--ds-font-size-title);
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--ds-primary);
}

.ds-page-subtitle {
  color: var(--ds-text-muted);
  font-size: 17px;
}

.ds-page-subtitle--large {
  margin-top: 24px;
  margin-bottom: 32px;
  font-size: 20px;
  font-weight: 400;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Card / blocks
   -------------------------------------------------------------------------- */

.ds-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 32px 36px;
  margin-bottom: var(--ds-space-6);
  box-shadow: var(--ds-shadow-sm);
}

.ds-card--soft-info {
  background: var(--ds-surface-soft);
  border-color: var(--ds-border-warm);
}

.ds-card--soft-info .ds-card-title {
  margin-bottom: 14px;
}

.ds-card--soft-info .ds-event-info {
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 0;
}

.ds-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 28px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ds-border-warm);
  color: var(--ds-primary-strong);
  font-size: var(--ds-font-size-card-title);
  font-weight: 700;
}

.ds-optional-tag {
  font-size: 15px;
  color: var(--ds-text-light);
  font-weight: 400;
}

.ds-event-info {
  background: var(--ds-surface-soft);
  border: 1px solid var(--ds-border-warm);
  border-radius: var(--ds-radius-md);
  padding: 16px 20px;
  margin-bottom: 22px;
  font-size: 15px;
  line-height: 2;
  color: var(--ds-text-muted);
}

.ds-event-info p {
  margin: 0;
}

.ds-event-contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
}

.ds-event-contact-row span {
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Form fields
   -------------------------------------------------------------------------- */

.ds-label {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 500;
}

.ds-label.ds-required::after {
  content: " *";
  color: var(--ds-danger);
}

.ds-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 6px;
}

.ds-radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 15px;
}

.ds-radio-option input {
  width: 17px;
  height: 17px;
  accent-color: var(--ds-primary);
}

/* --------------------------------------------------------------------------
   Package cards
   -------------------------------------------------------------------------- */

.ds-package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.ds-package-card {
  position: relative;
  text-align: center;
  user-select: none;
  cursor: pointer;
  background: #fff;
  border: 2px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 20px 16px;
  transition:
    background-color 0.2s,
    border-color 0.2s,
    box-shadow 0.2s;
}

.ds-package-card:hover {
  border-color: var(--ds-primary-light);
  box-shadow: 0 4px 16px rgba(74, 163, 217, 0.25);
}

.ds-package-card.ds-active {
  border-color: var(--ds-primary);
  background: linear-gradient(135deg, var(--ds-surface-highlight), var(--ds-surface));
  box-shadow: var(--ds-shadow-md);
}

.ds-package-check {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ds-primary);
  color: #fff;
  font-size: 12px;
}

.ds-package-card.ds-active .ds-package-check {
  display: flex;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.ds-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--ds-radius-md);
  padding: 14px 56px;
  background: var(--ds-btn-primary-bg);
  color: #fff;
  text-decoration: none;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 3px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

/* Anchor buttons: beat body.ds-body a link color */
body.ds-body a.ds-btn-primary,
body.ds-body a.ds-btn-primary:link,
body.ds-body a.ds-btn-primary:visited,
body.ds-body a.ds-btn-primary:hover,
body.ds-body a.ds-btn-primary:active,
body.ds-body a.ds-btn-primary:focus {
  color: #fff;
  text-decoration: none;
}

.ds-btn-primary:hover {
  background: var(--ds-btn-primary-bg-hover);
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(26, 77, 140, 0.3);
}

.ds-btn-primary:active {
  background: var(--ds-btn-primary-bg-active);
}

.ds-btn-primary:focus-visible {
  outline: 2px solid var(--ds-primary-strong);
  outline-offset: 3px;
}

.ds-btn-primary--compact {
  padding: 12px 34px;
  letter-spacing: normal;
}

.ds-required-mark {
  color: var(--ds-danger);
}

/* --------------------------------------------------------------------------
   Table system
   -------------------------------------------------------------------------- */

.ds-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 15px;
}

.ds-table th,
.ds-table td {
  border: 1px solid var(--ds-border);
  padding: 9px 8px;
  vertical-align: middle;
}

.ds-table thead th {
  background: var(--ds-surface-highlight);
  color: var(--ds-primary);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.ds-table .ds-col-num {
  width: 36px;
  text-align: center;
  color: var(--ds-text-light);
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   Notices
   -------------------------------------------------------------------------- */

.ds-notice {
  margin-bottom: 20px;
  padding: 14px 18px;
  border: 1px solid var(--ds-notice-border);
  border-left: 4px solid var(--ds-gold);
  border-radius: 0 var(--ds-radius-md) var(--ds-radius-md) 0;
  background: var(--ds-notice-bg);
  color: var(--ds-notice-text);
  font-size: 14px;
  line-height: 1.9;
}

/* --------------------------------------------------------------------------
   Xiaodao form module
   -------------------------------------------------------------------------- */

.dh-card-block {
  margin-bottom: 24px;
}

.dh-offering-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 16px;
  background: var(--ds-offering-head-bg);
  border-left: 4px solid var(--ds-gold);
  border-radius: var(--ds-radius-sm);
}

.dh-offering-head .dh-offering-title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ds-primary);
}

.dh-offering-head .dh-offering-hint {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--ds-offering-hint);
}

.dh-form-control {
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  font-size: 15px;
  padding: 8px 10px;
}

.dh-form-control:focus {
  border-color: var(--ds-primary-light);
  box-shadow: 0 0 0 0.2rem rgba(26, 77, 140, 0.2);
}

.dh-date-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dh-remove-btn {
  border: 1px solid var(--ds-red);
  color: var(--ds-red);
  background: transparent;
  border-radius: 6px;
  padding: 4px 10px;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.dh-remove-btn:hover {
  background: var(--ds-red);
  color: #fff;
}

.dh-remove-btn:focus-visible {
  outline: 2px solid var(--ds-red);
  outline-offset: 2px;
}

.dh-autofilled-field {
  background: var(--ds-autofill-bg);
}

.entry-add-btn {
  margin-top: 12px;
  font-size: 15px;
}

.dh-submit-wrap {
  text-align: center;
  padding-top: 10px;
}

.dh-memorial-table .dh-col-index {
  width: 44px;
}

.dh-memorial-table .dh-col-action,
.dh-lamp-table .dh-col-action,
.dh-food-table .dh-col-action {
  width: 72px;
  white-space: nowrap;
}

.dh-lamp-table .dh-col-qty,
.dh-food-table .dh-col-qty {
  width: 120px;
}

.dh-card-block .table-responsive {
  margin-bottom: 14px;
}

.dh-card-block .ds-notice {
  margin-top: 12px;
  margin-bottom: 8px;
}

.dh-card-block .ds-notice + .ds-notice {
  margin-top: 0;
}

.dh-card-block .entry-add-btn {
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Payment result module
   -------------------------------------------------------------------------- */

.dh-result-wrap {
  width: 100%;
  max-width: var(--ds-layout-max);
  margin: 0 auto;
  padding: 0 40px 60px;
}

.dh-result-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 36px 40px;
  box-shadow: var(--ds-shadow-sm);
}

.dh-result-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.dh-result-icon--success {
  background: linear-gradient(135deg, var(--ds-gold-light) 0%, var(--ds-gold) 100%);
  box-shadow: 0 6px 24px rgba(74, 163, 217, 0.3);
}

.dh-result-icon--failed {
  background: linear-gradient(135deg, #e8a09a 0%, var(--ds-red) 100%);
  box-shadow: 0 6px 24px rgba(176, 58, 46, 0.2);
}

.dh-result-icon i {
  font-size: 34px;
  color: #fff;
}

.dh-result-title {
  margin-bottom: 6px;
  font-size: 24px;
  font-weight: 700;
}

.dh-result-title--success {
  color: var(--ds-primary);
}

.dh-result-title--failed {
  color: var(--ds-red);
}

.dh-result-greeting {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.8;
}

.dh-result-text {
  line-height: 1.8;
  margin-bottom: 18px;
}

.dh-result-text--lg {
  margin-bottom: 20px;
}

.dh-result-accent {
  color: var(--ds-primary);
}

.dh-ref-card {
  background: var(--ds-surface-soft);
  border-left: 4px solid var(--ds-gold);
  border-radius: 0 var(--ds-radius-md) var(--ds-radius-md) 0;
  padding: 12px 14px;
}

.dh-ref-label {
  font-size: 13px;
  color: var(--ds-text-muted);
}

.dh-ref-number {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
  color: var(--ds-primary);
  letter-spacing: 2px;
}

.dh-divider {
  border: none;
  border-top: 1px solid var(--ds-border);
  margin: 24px 0;
}

.dh-blessing {
  background: var(--ds-surface-soft);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  padding: 20px 18px;
  text-align: center;
}

.dh-blessing-zh {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--ds-primary);
  font-weight: 600;
  line-height: 1.9;
}

.dh-blessing-en {
  margin: 0;
  font-size: 14px;
  color: var(--ds-text-muted);
  font-style: italic;
  line-height: 1.8;
}

.dh-help-title {
  margin-bottom: 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ds-primary-strong);
}

.dh-help-box {
  background: var(--ds-surface-soft);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  padding: 18px 20px;
}

.dh-help-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--ds-text-muted);
  line-height: 1.7;
  font-size: 14px;
}

.dh-help-item:last-child {
  margin-bottom: 0;
}

.dh-help-item i {
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--ds-gold);
  font-size: 16px;
}

.dh-help-item a {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   Language toggle visibility helpers
   -------------------------------------------------------------------------- */

[data-lang-en] {
  display: none;
}

body.lang-en [data-lang-zh] {
  display: none !important;
}

body.lang-en [data-lang-en] {
  display: block;
}

body.lang-en .inline-lang[data-lang-en],
body.lang-en span[data-lang-en] {
  display: inline;
}

.dh-hidden-en [data-lang-en] {
  display: none;
}

body.lang-en .dh-hidden-en [data-lang-zh] {
  display: none;
}

body.lang-en .dh-hidden-en [data-lang-en] {
  display: inline;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.ds-site-footer {
  background: var(--ds-footer-bg);
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.9rem;
  line-height: 1.75;
  padding: 2.5rem 0 2rem;
}

.ds-site-footer a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
}

body.ds-body .ds-site-footer a,
body.ds-body .ds-site-footer a:visited {
  color: rgba(255, 255, 255, 0.92);
}

.ds-site-footer a:hover,
body.ds-body .ds-site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

body.ds-body .ds-site-footer a:focus-visible {
  outline-color: #fff;
}

.ds-site-footer-main {
  margin-bottom: 2rem;
}

.ds-site-footer-org {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  margin: 0 0 0.35rem;
}

.ds-site-footer-org-en {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  margin: 0;
}

.ds-site-footer-address {
  font-style: normal;
  font-size: 0.88rem;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.84);
  margin: 0;
}

.ds-site-footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
}

.ds-site-footer-copyright {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
}

/* --------------------------------------------------------------------------
   PDF attachment module (optional)
   Add class `ds-attachment` on <body>
   -------------------------------------------------------------------------- */

body.ds-body.ds-attachment {
  width: 100%;
  max-width: 210mm;
  margin: 0 auto;
  padding: 18mm 20mm 20mm;
  background: #fff;
  color: #333;
  font-size: 14px;
  line-height: 1.7;
  page: attachment;
}

body.ds-body.ds-attachment .ds-table {
  font-size: 13px;
  table-layout: fixed;
}

body.ds-body.ds-attachment .ds-table th,
body.ds-body.ds-attachment .ds-table td {
  padding: 8px 10px;
  border-color: #ccc;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: break-word;
}

body.ds-body.ds-attachment .ds-table thead th {
  background: #fff;
  color: #333;
  white-space: normal;
}

body.ds-body.ds-attachment .ds-table .ds-col-num {
  width: 28px;
  text-align: center;
  color: #333;
}

.ds-attachment-header {
  text-align: right;
  padding-bottom: 16px;
  border-bottom: 1px solid #ccc;
  margin-bottom: 24px;
}

.ds-attachment-header img {
  width: 200px;
  max-width: 200px;
  height: auto;
}

.ds-attachment-title {
  text-align: center;
  margin-bottom: 22px;
}

.ds-attachment-title h1 {
  margin: 0 0 4px;
  font-size: 24px;
  letter-spacing: 6px;
}

.ds-attachment-subtitle {
  font-size: 14px;
  letter-spacing: 1px;
}

.ds-attachment-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 32px;
  margin-bottom: 24px;
}

.ds-attachment-info-item {
  display: flex;
  font-size: 14px;
  line-height: 1.8;
}

.ds-attachment-info-label {
  min-width: 150px;
  white-space: nowrap;
}

.ds-attachment-info-value {
  font-weight: 600;
}

.ds-attachment-section {
  margin-bottom: 22px;
}

.ds-attachment-section-title {
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 700;
}

@page attachment {
  size: A4;
  margin: 18mm 20mm 20mm;
}

@media print {
  body.ds-body.ds-attachment {
    width: auto;
    padding: 0;
  }

  .ds-attachment-header,
  .ds-attachment-title,
  .ds-attachment-info-grid,
  .ds-attachment-section {
    page-break-inside: avoid;
  }

  .ds-attachment-section-title {
    page-break-after: avoid;
  }

  thead {
    display: table-header-group;
  }

  body.ds-body.ds-attachment tr {
    page-break-inside: avoid;
  }
}

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

@media (max-width: 900px) {
  .ds-main-wrap {
    padding: 20px 20px 50px;
  }

  .dh-result-wrap {
    padding: 0 20px 50px;
  }

  .ds-site-footer {
    padding: 28px 20px;
  }

  body.ds-body.ds-attachment {
    padding-right: 20px;
    padding-left: 20px;
  }

  .ds-attachment-info-grid {
    grid-template-columns: 1fr;
  }

  .ds-attachment-info-label {
    min-width: 0;
    white-space: normal;
  }
}

@media (max-width: 576px) {
  .ds-main-wrap {
    padding: 14px 12px 40px;
  }

  .dh-date-group {
    grid-template-columns: 1fr;
  }

  .ds-card {
    padding: 18px 14px;
  }

  .ds-package-grid {
    grid-template-columns: 1fr;
  }

  .ds-lang-toggle {
    padding: 12px 16px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .dh-result-wrap {
    padding: 0 12px 40px;
  }

  .dh-result-card {
    padding: 26px 18px;
  }

  .dh-result-icon {
    width: 64px;
    height: 64px;
  }

  .dh-result-icon i {
    font-size: 28px;
  }

  .dh-ref-number {
    font-size: 18px;
  }

  .ds-table {
    font-size: 13px;
  }

  .ds-table th,
  .ds-table td {
    padding: 6px;
  }

  .dh-name-grid .form-control {
    flex-basis: 100%;
    min-width: 0;
  }

  .ds-site-footer {
    padding: 24px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ds-lang-toggle button,
  .ds-btn-primary,
  .ds-package-card,
  .dh-remove-btn {
    transition: none;
  }
}
