/**
 * ABIMS documentation — stationery theme (admin + index scroll sections)
 * Index landing: docs-home.css (load after this on index.html only)
 */

@import url("https://fonts.googleapis.com/css2?family=Courier+Prime:ital,wght@0,400;0,700;1,400&family=Instrument+Serif:ital@0;1&family=Newsreader:ital,opsz,wght@0,400..600;1,400..600&display=swap");

:root {
  --docs-ground: #efe9dd;
  --docs-ground-2: #e5ded0;
  --docs-ink: #141c2b;
  --docs-ink-2: #4a5364;
  --docs-muted: #767e8c;
  --docs-accent: #2c4a8f;
  --docs-hairline: rgba(20, 28, 43, 0.16);
  --docs-font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --docs-font-mono: "Courier Prime", "Courier New", monospace;
  --docs-nav-h: 60px;
  --docs-max-copy: 50vw;
  --docs-page-pad: clamp(20px, 4vw, 48px);
  /* กลางระหว่างสเกลเดิม (12px) กับรอบที่ใหญ่เกิน */
  --docs-text-base: clamp(15px, 0.3vw + 14px, 18px);
  --docs-text-sm: clamp(14px, 0.25vw + 13px, 16px);
  --docs-text-xs: clamp(12px, 0.2vw + 11px, 14px);
  --docs-text-kicker: clamp(12px, 0.2vw + 11px, 13px);
  --docs-h1: clamp(2.35rem, 4.8vw + 0.65rem, 4.25rem);
  --docs-h2: clamp(1.85rem, 3.4vw + 0.55rem, 3rem);
  --docs-h3: clamp(1.45rem, 2.2vw + 0.4rem, 2rem);
}

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* --- Stationery scope (not index landing viewport) --- */

body.docs-stationery,
.docs-main--stationery {
  font-family: var(--docs-font-mono);
  font-size: var(--docs-text-base);
  font-weight: 500;
  line-height: 1.75;
  letter-spacing: 0.04em;
  color: var(--docs-ink);
  -webkit-font-smoothing: antialiased;
}

body.docs-stationery {
  margin: 0;
  min-height: 100vh;
  background: var(--docs-ground);
}

.docs-stationery a,
.docs-main--stationery a {
  color: var(--docs-accent);
  text-decoration: none;
  border-bottom: 1px solid var(--docs-hairline);
}

.docs-stationery a:hover,
.docs-main--stationery a:hover {
  border-bottom-color: var(--docs-accent);
}

.docs-stationery h1,
.docs-stationery h2,
.docs-stationery h3,
.docs-main--stationery h1,
.docs-main--stationery h2,
.docs-main--stationery h3 {
  font-family: var(--docs-font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--docs-ink);
}

.docs-stationery h1,
.docs-main--stationery h1 {
  font-size: var(--docs-h1);
  margin: 0 0 1rem;
}

.docs-stationery h2,
.docs-main--stationery h2 {
  font-size: var(--docs-h2);
  font-weight: 600;
  margin: 0 0 0.85rem;
}

.docs-stationery h3,
.docs-main--stationery h3 {
  font-size: var(--docs-h3);
  margin: 0 0 0.6rem;
}

.docs-stationery .docs-accent-phrase,
.docs-main--stationery .docs-accent-phrase {
  font-style: italic;
  color: var(--docs-accent);
}

.docs-stationery .docs-kicker,
.docs-main--stationery .docs-kicker {
  font-family: var(--docs-font-mono);
  font-size: var(--docs-text-kicker);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--docs-muted);
  margin: 0 0 1.25rem;
}

.docs-stationery .docs-lede,
.docs-main--stationery .docs-lede {
  max-width: 38em;
  color: var(--docs-ink);
  font-weight: 500;
  margin: 0 0 1.5rem;
}

.docs-lede--compact {
  margin-top: -0.35rem;
  margin-bottom: 1rem;
  font-size: var(--docs-text-sm);
}

/* --- Nav (admin / inner pages) --- */

body.docs-stationery .docs-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  min-height: var(--docs-nav-h);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
  padding: 10px var(--docs-page-pad);
  background: color-mix(in srgb, var(--docs-ground) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--docs-hairline);
}

@media (min-width: 720px) {
  body.docs-stationery .docs-nav {
    flex-wrap: nowrap;
    height: var(--docs-nav-h);
    padding: 0 var(--docs-page-pad);
  }
}

body.docs-stationery .docs-nav__brand {
  font-family: var(--docs-font-display);
  font-size: clamp(1.25rem, 0.5vw + 1.1rem, 1.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--docs-ink);
  border: none;
}

body.docs-stationery .docs-nav__brand span {
  color: var(--docs-accent);
}

body.docs-stationery .docs-nav__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 18px;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

@media (min-width: 720px) {
  body.docs-stationery .docs-nav__links {
    width: auto;
  }
}

body.docs-stationery .docs-nav__links a {
  font-size: var(--docs-text-kicker);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--docs-ink);
  border: none;
}

body.docs-stationery .docs-nav__links a:hover {
  color: var(--docs-accent);
}

.docs-stationery .docs-btn,
.docs-main--stationery .docs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  font-family: var(--docs-font-mono);
  font-size: var(--docs-text-sm);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 0;
  border: 1px solid var(--docs-ink);
  background: transparent;
  color: var(--docs-ink);
  cursor: pointer;
  text-decoration: none;
}

.docs-stationery .docs-btn:hover,
.docs-main--stationery .docs-btn:hover {
  border-color: var(--docs-accent);
  color: var(--docs-accent);
}

.docs-stationery .docs-btn--accent,
.docs-main--stationery .docs-btn--accent {
  border-color: var(--docs-accent);
  color: var(--docs-accent);
}

.docs-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

body.docs-stationery .docs-main {
  padding-top: calc(var(--docs-nav-h) + 12px);
}

@media (max-width: 719px) {
  body.docs-stationery .docs-main {
    padding-top: calc(var(--docs-nav-h) + 52px);
  }
}

/* --- Hero (admin) --- */

body.docs-stationery .docs-hero {
  min-height: calc(100vh - var(--docs-nav-h));
  background: var(--docs-ground-2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: clamp(32px, 6vh, 72px) var(--docs-page-pad) 0;
}

body.docs-stationery .docs-hero__copy {
  max-width: var(--docs-max-copy);
}

body.docs-stationery .docs-hero__specs {
  margin-top: auto;
  padding: 20px 0 28px;
  border-top: 1px solid var(--docs-hairline);
  font-size: var(--docs-text-sm);
  color: var(--docs-muted);
}

/* Hero compact — ไม่เต็มจอ (Role, Database, ฯลฯ) */
body.docs-stationery .docs-hero.docs-hero--compact {
  min-height: 0;
  padding: clamp(28px, 4vh, 48px) var(--docs-page-pad) clamp(20px, 3vh, 32px);
}

body.docs-stationery .docs-hero.docs-hero--compact .docs-hero__specs {
  margin-top: 1.25rem;
  padding: 16px 0 0;
  max-width: var(--docs-max-copy);
}

body.docs-stationery.docs-page-roles .docs-hero.docs-hero--compact .docs-btn {
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 600;
}

.docs-hero__hint {
  color: var(--docs-ink-2);
  font-size: var(--docs-text-sm);
  font-weight: 500;
  max-width: 42em;
  line-height: 1.65;
}

.docs-role-principle {
  margin: 0 0 clamp(28px, 4vw, 40px);
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid var(--docs-hairline);
  background: var(--docs-ground-2);
  border-radius: 2px;
}

.docs-role-principle h3 {
  font-family: var(--docs-font-display);
  font-size: clamp(1.2rem, 1.8vw + 0.5rem, 1.55rem);
  font-weight: 600;
  margin: 0 0 0.65rem;
  color: var(--docs-ink);
}

.docs-role-principle .docs-lede {
  margin-bottom: 1rem;
}

.docs-role-principle .docs-rows {
  margin: 0;
}

.docs-role-principle .docs-row {
  border-bottom-color: rgba(20, 28, 43, 0.1);
}

.docs-role-principle .docs-row:last-child {
  border-bottom: none;
}

/* --- Database field tables --- */

.docs-db-scroll {
  overflow-x: auto;
  margin-top: 1rem;
  -webkit-overflow-scrolling: touch;
}

.docs-db-table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  font-size: var(--docs-text-sm);
  font-weight: 500;
  line-height: 1.5;
}

.docs-db-table th,
.docs-db-table td {
  padding: 10px 12px;
  border: 1px solid var(--docs-hairline);
  text-align: left;
  vertical-align: top;
}

.docs-db-table th {
  font-family: var(--docs-font-display);
  font-weight: 600;
  background: var(--docs-ground-2);
  color: var(--docs-ink);
}

.docs-db-table code {
  font-size: 0.92em;
}

.docs-db-pre {
  margin: 1rem 0 0;
  padding: 1rem 1.15rem;
  background: var(--docs-ground-2);
  border: 1px solid var(--docs-hairline);
  font-family: var(--docs-font-mono);
  font-size: var(--docs-text-sm);
  font-weight: 500;
  line-height: 1.65;
  white-space: pre-wrap;
  color: var(--docs-ink);
}

.docs-db-overview {
  display: grid;
  gap: clamp(16px, 3vw, 24px);
  margin-top: 1.25rem;
}

@media (min-width: 720px) {
  .docs-db-overview {
    grid-template-columns: repeat(3, 1fr);
  }
}

.docs-db-cluster {
  padding: clamp(14px, 2.5vw, 20px);
  border: 1px solid var(--docs-hairline);
  background: var(--docs-ground);
  border-radius: 2px;
}

.docs-db-cluster h4 {
  font-family: var(--docs-font-display);
  font-size: clamp(1.05rem, 1.2vw + 0.5rem, 1.25rem);
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--docs-ink);
}

.docs-db-cluster p {
  margin: 0 0 0.65rem;
  font-size: var(--docs-text-sm);
  font-weight: 500;
  line-height: 1.6;
  color: var(--docs-ink-2);
}

.docs-db-cluster ul {
  margin: 0;
  padding-left: 1.15em;
  font-size: var(--docs-text-sm);
  font-weight: 500;
  line-height: 1.55;
  color: var(--docs-ink);
}

.docs-db-cluster li {
  margin-top: 4px;
}

.docs-db-cluster--hub {
  background: var(--docs-ground-2);
  border-color: rgba(44, 74, 143, 0.28);
}

.docs-db-flow-arrow {
  display: block;
  margin: 0.35rem 0 0.5rem;
  font-size: var(--docs-text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--docs-accent);
}

.docs-db-admin-card {
  margin-top: 1rem;
  padding: clamp(16px, 2.5vw, 22px);
  border: 1px solid var(--docs-hairline);
  background: var(--docs-ground-2);
}

.docs-db-admin-card dl {
  margin: 0.75rem 0 0;
  display: grid;
  gap: 8px 16px;
  grid-template-columns: minmax(7rem, auto) 1fr;
  font-size: var(--docs-text-sm);
  font-weight: 500;
}

.docs-db-admin-card dt {
  color: var(--docs-ink-2);
}

.docs-db-admin-card dd {
  margin: 0;
  color: var(--docs-ink);
}

body.docs-stationery .docs-wordmark {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-family: var(--docs-font-display);
  font-size: clamp(48px, 12vw, 140px);
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 0.85;
  color: var(--docs-ink);
  transform: translateY(0.12em);
  user-select: none;
  pointer-events: none;
}

/* --- Sections --- */

.docs-stationery .docs-section,
.docs-main--stationery .docs-section {
  padding: clamp(48px, 8vh, 96px) var(--docs-page-pad);
  border-bottom: 1px solid var(--docs-hairline);
}

.docs-stationery .docs-section--ground-2,
.docs-main--stationery .docs-section--ground-2 {
  background: var(--docs-ground-2);
}

.docs-stationery .docs-two-col,
.docs-main--stationery .docs-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
}

@media (max-width: 768px) {
  .docs-stationery .docs-two-col,
  .docs-main--stationery .docs-two-col {
    grid-template-columns: 1fr;
  }

  body.docs-stationery .docs-hero__copy {
    max-width: none;
  }
}

.docs-stationery .docs-rows,
.docs-main--stationery .docs-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--docs-hairline);
}

.docs-stationery .docs-row,
.docs-main--stationery .docs-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px 24px;
  padding: clamp(18px, 2vw, 22px) 0;
  border-bottom: 1px solid var(--docs-hairline);
  align-items: baseline;
}

.docs-stationery .docs-row__label,
.docs-main--stationery .docs-row__label {
  font-size: var(--docs-text-kicker);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--docs-accent);
  grid-column: 1 / -1;
}

.docs-stationery .docs-row__desc,
.docs-main--stationery .docs-row__desc {
  color: var(--docs-ink);
  font-weight: 500;
}

.docs-stationery .docs-row__notes,
.docs-main--stationery .docs-row__notes {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--docs-text-sm);
  line-height: 1.55;
}

.docs-stationery .docs-row__notes li,
.docs-main--stationery .docs-row__notes li {
  position: relative;
  margin-top: 6px;
  padding-left: 1.1em;
  color: var(--docs-ink-2);
  font-weight: 500;
}

.docs-stationery .docs-row__notes li::before,
.docs-main--stationery .docs-row__notes li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--docs-ink-2);
}

.docs-stationery .docs-row__value,
.docs-main--stationery .docs-row__value {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--docs-ink);
}

@media (max-width: 560px) {
  .docs-stationery .docs-row,
  .docs-main--stationery .docs-row {
    grid-template-columns: 1fr;
  }

  .docs-stationery .docs-row__value,
  .docs-main--stationery .docs-row__value {
    text-align: left;
  }
}

.docs-rows--spaced {
  margin-top: clamp(24px, 4vw, 40px);
}

.docs-row__value a.docs-portal {
  font-size: var(--docs-text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
}

.docs-section__intro {
  max-width: 36em;
}

.docs-url {
  display: block;
  margin-top: 6px;
  font-size: var(--docs-text-sm);
  letter-spacing: 0.04em;
  word-break: break-all;
  color: var(--docs-ink);
}

.docs-url a {
  border-bottom-color: transparent;
}

/* --- Cards & flow --- */

.docs-stationery .docs-cards,
.docs-main--stationery .docs-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 20px);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 768px) {
  .docs-stationery .docs-cards,
  .docs-main--stationery .docs-cards {
    grid-template-columns: 1fr;
  }
}

.docs-main--stationery .docs-cards--index {
  margin-top: clamp(20px, 3vw, 32px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}

.docs-main--stationery .docs-card--featured {
  border-color: rgba(44, 74, 143, 0.35);
  background: color-mix(in srgb, var(--docs-accent) 6%, var(--docs-ground-2));
}

.docs-section--ground-2 .docs-card--featured {
  background: color-mix(in srgb, var(--docs-accent) 8%, var(--docs-ground));
}

.docs-stationery .docs-card,
.docs-main--stationery .docs-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
  padding: clamp(16px, 3vw, 24px);
  border: 1px solid var(--docs-hairline);
  background: var(--docs-ground);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.docs-stationery .docs-section--ground-2 .docs-card,
.docs-main--stationery .docs-section--ground-2 .docs-card {
  background: var(--docs-ground-2);
}

.docs-stationery a.docs-card:hover,
.docs-main--stationery a.docs-card:hover {
  border-color: var(--docs-accent);
  transform: translateY(-2px);
}

.docs-stationery a.docs-card,
.docs-main--stationery a.docs-card {
  border-bottom: 1px solid var(--docs-hairline);
}

.docs-card__role {
  font-size: var(--docs-text-kicker);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--docs-accent);
}

.docs-stationery .docs-card h3,
.docs-main--stationery .docs-card h3 {
  margin: 0;
  font-size: var(--docs-h3);
}

.docs-stationery .docs-card p,
.docs-main--stationery .docs-card p {
  margin: 0;
  flex: 1;
  color: var(--docs-ink-2);
  font-size: var(--docs-text-base);
  line-height: 1.65;
  letter-spacing: 0.03em;
}

.docs-card__meta {
  font-size: var(--docs-text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--docs-muted);
}

.docs-card--soon {
  pointer-events: none;
  opacity: 0.72;
}

.docs-card--downloads {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.docs-card__downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.docs-card__dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  font-size: var(--docs-text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--docs-ink);
  background: var(--docs-surface, #fff);
  border: 1px solid var(--docs-hairline);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.docs-card__dl:hover {
  border-color: var(--docs-accent, #2563eb);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

.docs-stationery .docs-flow,
.docs-main--stationery .docs-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: clamp(24px, 4vw, 40px);
  border: 1px solid var(--docs-hairline);
}

@media (max-width: 640px) {
  .docs-stationery .docs-flow,
  .docs-main--stationery .docs-flow {
    grid-template-columns: 1fr;
  }
}

.docs-flow__step {
  padding: clamp(18px, 2.5vw, 24px) clamp(18px, 2vw, 22px);
  border-right: 1px solid var(--docs-hairline);
}

.docs-flow__step:last-child {
  border-right: none;
}

@media (max-width: 640px) {
  .docs-flow__step {
    border-right: none;
    border-bottom: 1px solid var(--docs-hairline);
  }
}

.docs-flow__step strong {
  display: block;
  font-family: var(--docs-font-display);
  font-size: clamp(1.05rem, 1.2vw + 0.85rem, 1.3rem);
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--docs-ink);
}

.docs-flow__step span {
  font-size: var(--docs-text-base);
  font-weight: 500;
  color: var(--docs-ink);
  line-height: 1.65;
}

/* --- Demo panel --- */

.docs-demo--spaced {
  margin-top: clamp(40px, 6vw, 64px);
}

/* --- Admin dashboard chart preview (docs index) --- */

.docs-dash-charts__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(16px, 3vw, 24px);
  margin-top: clamp(24px, 4vw, 40px);
}

@media (min-width: 960px) {
  .docs-dash-charts__grid {
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    align-items: stretch;
  }
}

.docs-dash-chart-card {
  border: 1px solid var(--docs-hairline);
  background: var(--docs-ground);
  padding: clamp(18px, 3vw, 24px);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.docs-section--ground-2 .docs-dash-chart-card,
.docs-main--stationery .docs-section--ground-2 .docs-dash-chart-card {
  background: var(--docs-ground-2);
}

.docs-dash-chart-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 12px;
}

.docs-dash-chart-card__title {
  font-family: var(--docs-font-display);
  font-size: clamp(1.1rem, 1.5vw + 0.5rem, 1.35rem);
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--docs-ink);
}

.docs-dash-chart-card__sub {
  margin: 0;
  font-size: var(--docs-text-sm);
  font-weight: 500;
  color: var(--docs-ink-2);
  line-height: 1.5;
  max-width: 28em;
}

.docs-dash-charts__caption {
  margin: clamp(20px, 3vw, 28px) 0 0;
  max-width: 42em;
  font-size: var(--docs-text-sm);
  font-weight: 500;
  line-height: 1.6;
  color: var(--docs-ink-2);
}

.docs-dash-charts__caption strong {
  font-weight: 700;
  color: var(--docs-ink);
}

.docs-dash-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  font-size: var(--docs-text-xs);
  font-weight: 700;
  color: var(--docs-ink-2);
}

.docs-dash-chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.docs-dash-chart-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.docs-dash-chart-legend__dot--room {
  background: #8b5cf6;
}

.docs-dash-chart-legend__dot--equip {
  background: #3b82f6;
}

.docs-dash-chart-host {
  flex: 1;
  min-height: 260px;
}

.docs-dash-chart-host--donut {
  min-height: 300px;
}

.docs-stationery .docs-demo__panel,
.docs-main--stationery .docs-demo__panel {
  border: 1px solid var(--docs-hairline);
  background: var(--docs-ground);
  padding: clamp(20px, 4vw, 40px);
}

.docs-demo__svg {
  display: block;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.docs-demo__svg path.docs-draw {
  fill: none;
  stroke: var(--docs-accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.docs-demo__svg path.docs-draw--muted {
  stroke-opacity: 0.35;
}

.docs-demo__facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--docs-hairline);
  font-size: var(--docs-text-sm);
  color: var(--docs-muted);
}

.docs-demo__facts strong {
  color: var(--docs-ink);
}

@media (max-width: 640px) {
  .docs-demo__facts {
    grid-template-columns: 1fr;
  }
}

/* --- Role tabs (roles.html) --- */

body.docs-stationery .docs-role-nav {
  position: sticky;
  top: var(--docs-nav-h);
  z-index: 95;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 10px var(--docs-page-pad);
  border-bottom: 1px solid var(--docs-hairline);
  background: color-mix(in srgb, var(--docs-ground) 94%, transparent);
  backdrop-filter: blur(10px);
  list-style: none;
}

body.docs-stationery .docs-role-nav a {
  padding: 10px 20px;
  font-size: var(--docs-text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--docs-ink-muted);
  border: 1px solid transparent;
}

body.docs-stationery .docs-role-nav a:hover {
  color: var(--docs-ink);
}

body.docs-stationery .docs-role-nav a.is-active {
  color: var(--docs-accent);
  border-color: var(--docs-hairline);
  background: var(--docs-ground-2);
}

.docs-role-panel--hidden {
  display: none !important;
}

body.docs-stationery .docs-nav__links a[aria-current="page"] {
  color: var(--docs-accent);
}

/* --- TOC (admin) --- */

body.docs-stationery.docs-page-roles .docs-toc {
  top: calc(var(--docs-nav-h) + 52px);
}

body.docs-stationery .docs-toc {
  position: sticky;
  top: calc(var(--docs-nav-h) + 8px);
  z-index: 90;
  margin: 0;
  padding: 12px var(--docs-page-pad);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--docs-hairline);
  background: color-mix(in srgb, var(--docs-ground) 92%, transparent);
  backdrop-filter: blur(10px);
  list-style: none;
}

@media (max-width: 719px) {
  body.docs-stationery .docs-toc {
    top: calc(var(--docs-nav-h) + 48px);
  }
}

body.docs-stationery .docs-toc a {
  flex: 0 0 auto;
  padding: 10px 16px;
  font-size: var(--docs-text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--docs-hairline);
  color: var(--docs-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--docs-hairline);
}

body.docs-stationery .docs-toc a:hover,
body.docs-stationery .docs-toc a.is-active {
  border-color: var(--docs-accent);
  color: var(--docs-accent);
}

/* Database: many table tabs — single horizontal row, scroll synced on click */
body.docs-stationery.docs-page-database .docs-toc {
  flex-wrap: nowrap;
  justify-content: flex-start;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

body.docs-stationery.docs-page-database .docs-section[id] {
  scroll-margin-top: calc(var(--docs-nav-h) + 96px);
}

.docs-er-figure {
  margin: 1rem 0 1.5rem;
  padding: 12px;
  border: 1px solid var(--docs-hairline);
  background: #fff;
  overflow-x: auto;
}

.docs-er-figure a {
  display: block;
  line-height: 0;
}

.docs-er-figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.docs-er-figure figcaption {
  margin-top: 10px;
  font-size: var(--docs-text-xs);
  color: var(--docs-ink-2);
  line-height: 1.5;
  text-align: center;
}

body.docs-stationery.docs-page-database #er-diagram h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: var(--docs-h3);
}

/* --- Close / footer --- */

.docs-stationery .docs-close,
.docs-main--stationery .docs-close {
  padding: clamp(48px, 10vh, 120px) var(--docs-page-pad) 0;
}

.docs-close__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 2rem;
}

.docs-stationery .docs-footer-strip,
.docs-main--stationery .docs-footer-strip {
  margin-top: clamp(40px, 8vh, 80px);
  padding: 16px 0;
  border-top: 1px solid var(--docs-hairline);
  font-size: var(--docs-text-sm);
  color: var(--docs-muted);
}

/* --- Motion (stationery sections only) --- */

html.docs-motion .docs-stationery .docs-reveal,
html.docs-motion .docs-main--stationery .docs-reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

html.docs-motion .docs-stationery .docs-reveal.is-visible,
html.docs-motion .docs-main--stationery .docs-reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html.docs-motion .docs-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.docs-diagram {
  margin: 1.5rem 0;
  padding: 20px;
  border: 1px solid var(--docs-hairline);
  background: var(--docs-ground-2);
  overflow-x: auto;
}

/* --- Data dictionary (database.html) — sidebar + ตาราง 3.x แบบเอกสารบทที่ 3 --- */

body.docs-stationery .docs-dd {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
}

.docs-dd__nav {
  position: sticky;
  top: calc(var(--docs-nav-h) + 16px);
  max-height: calc(100vh - var(--docs-nav-h) - 32px);
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid var(--docs-hairline);
  background: color-mix(in srgb, var(--docs-ground) 70%, #fff);
  font-size: var(--docs-text-xs);
  letter-spacing: 0;
  line-height: 1.5;
}

.docs-dd__nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-dd__nav-title {
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--docs-ink);
}

.docs-dd__nav li.g > span {
  display: block;
  margin: 10px 0 4px;
  font-weight: 700;
  color: var(--docs-ink);
}

.docs-dd__nav li a {
  display: block;
  padding: 3px 6px;
  color: var(--docs-ink-2);
  text-decoration: none;
  border-bottom: 0;
}

.docs-dd__nav li a:hover {
  background: var(--docs-ground-2);
  color: var(--docs-accent);
}

.docs-dd__nav code {
  font-size: 0.95em;
  color: var(--docs-muted);
}

.docs-dd__main {
  min-width: 0;
  padding: clamp(20px, 3vw, 36px) clamp(18px, 3vw, 40px);
  border: 1px solid var(--docs-hairline);
  background: color-mix(in srgb, var(--docs-ground) 55%, #fff);
}

.docs-dd__main h2 {
  margin-top: 0;
}

.docs-dd-intro {
  margin: 0 0 1.5rem;
  text-indent: 2.5em;
  letter-spacing: 0;
  line-height: 1.9;
  color: var(--docs-ink-2);
}

body.docs-stationery .docs-dd-grp {
  margin: 2.25rem 0 0.75rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--docs-hairline);
  font-family: var(--docs-font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--docs-ink-2);
  scroll-margin-top: calc(var(--docs-nav-h) + 20px);
}

.docs-dd-block {
  margin: 0 0 2rem;
  scroll-margin-top: calc(var(--docs-nav-h) + 20px);
}

.docs-dd-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.docs-dd-copy {
  font: inherit;
  font-size: var(--docs-text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 14px;
  border: 1px solid var(--docs-accent);
  background: transparent;
  color: var(--docs-accent);
  cursor: pointer;
}

.docs-dd-copy:hover {
  background: var(--docs-accent);
  color: #fff;
}

.docs-dd-copy.is-done {
  border-color: #1a7f37;
  color: #1a7f37;
  background: transparent;
}

.docs-dd-cap,
.docs-dd-tdesc {
  margin: 0 0 6px;
  letter-spacing: 0;
  line-height: 1.6;
}

.docs-dd-tdesc {
  margin-bottom: 12px;
  color: var(--docs-ink-2);
}

.docs-dd-tname {
  color: var(--docs-accent);
  font-weight: 700;
}

.docs-dd-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.docs-dd-table {
  width: 100%;
  min-width: 40rem;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fff;
  font-size: var(--docs-text-sm);
  letter-spacing: 0;
  line-height: 1.5;
  word-break: break-word;
}

.docs-dd-table th,
.docs-dd-table td {
  padding: 8px 10px;
  border: 1px solid rgba(20, 28, 43, 0.35);
  text-align: center;
  vertical-align: top;
}

.docs-dd-table th {
  font-family: var(--docs-font-display);
  font-weight: 600;
  background: var(--docs-ground-2);
  color: var(--docs-ink);
}

.docs-dd-table td.f {
  font-family: var(--docs-font-mono);
}

.docs-dd-table td.d {
  text-align: left;
}

.docs-dd-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--docs-ground) 35%, #fff);
}

@media (max-width: 1100px) {
  body.docs-stationery .docs-dd {
    grid-template-columns: 1fr;
  }

  .docs-dd__nav {
    display: none;
  }
}

@media print {
  .docs-nav,
  .docs-toc,
  .docs-dd__nav,
  .docs-dd-tools {
    display: none !important;
  }

  body.docs-stationery .docs-dd {
    display: block;
    padding: 0;
  }

  .docs-dd__main {
    border: 0;
    padding: 0;
    background: #fff;
  }

  .docs-dd-block {
    break-inside: avoid;
  }
}

/* --- Report figures (report_images.html) — การ์ดภาพบทที่ 3 + ดูภาพเต็ม --- */

.docs-figs__filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.docs-figs__filter button {
  font: inherit;
  font-size: var(--docs-text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 8px 16px;
  border: 1px solid var(--docs-hairline);
  background: transparent;
  color: var(--docs-ink);
  cursor: pointer;
}

.docs-figs__filter button.is-on,
.docs-figs__filter button:hover {
  border-color: var(--docs-accent);
  color: var(--docs-accent);
}

.docs-figs__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: clamp(16px, 2.5vw, 28px);
}

.docs-fig {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--docs-hairline);
  background: color-mix(in srgb, var(--docs-ground) 55%, #fff);
}

.docs-fig[hidden] {
  display: none;
}

.docs-fig__thumb {
  display: block;
  height: 240px;
  padding: 12px;
  border: 0;
  border-bottom: 1px solid var(--docs-hairline);
  background: #fff;
  cursor: zoom-in;
}

.docs-fig__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.docs-fig__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px 18px 18px;
  letter-spacing: 0;
}

.docs-fig__num {
  margin: 0;
  font-weight: 700;
  color: var(--docs-accent);
}

body.docs-stationery .docs-fig__title {
  margin: 2px 0 6px;
  font-family: var(--docs-font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0;
}

.docs-fig__desc {
  margin: 0 0 6px;
  color: var(--docs-ink-2);
  line-height: 1.6;
}

.docs-fig__meta {
  margin: 0 0 14px;
  font-size: var(--docs-text-xs);
  color: var(--docs-muted);
}

.docs-fig__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

body.docs-stationery .docs-fig__btn {
  font: inherit;
  font-size: var(--docs-text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 6px 12px;
  border: 1px solid var(--docs-accent);
  background: transparent;
  color: var(--docs-accent);
  text-decoration: none;
  cursor: pointer;
}

body.docs-stationery .docs-fig__btn:hover,
body.docs-stationery .docs-fig__btn--primary {
  background: var(--docs-accent);
  color: #fff;
}

.docs-fig-dialog {
  width: min(96vw, 1600px);
  height: min(92vh, 1100px);
  padding: 0;
  border: 1px solid var(--docs-hairline);
  background: var(--docs-ground);
  color: var(--docs-ink);
}

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

.docs-fig-dialog::backdrop {
  background: rgba(20, 28, 43, 0.55);
}

.docs-fig-dialog__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--docs-hairline);
  letter-spacing: 0;
}

.docs-fig-dialog__bar span {
  display: flex;
  gap: 8px;
}

.docs-fig-dialog__view {
  flex: 1;
  overflow: auto;
  background: #fff;
}

.docs-fig-dialog__view img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.docs-fig-dialog__view.is-actual img {
  width: auto;
  height: auto;
  max-width: none;
}
