/* DOC Public Portal — translated 1:1 from portal-mockup.html's <style>
   block (AGENTS.md rule 14: the mockup is the source of truth). Every
   `style="..."` attribute the mockup used has been converted to a class
   or a scoped selector here, since SEC-07's CSP has no `unsafe-inline`
   for style-src either. */

:root {
  --navy: #A92928;
  --navy-2: #c23a38;
  --navy-3: #520000;
  --gold: #F0A726;
  --gold-2: #FFA000;
  --gold-soft: #FFDDDD;
  --cream: #FBEAEA;
  --ink: #333333;
  --muted: #686868;
  --line: #E6DADA;
  --bg: #F6F6F6;
  --card: #fff;
  --chip: #FBEAEA;
  --badge: #FBEAEA;
  --badge-ink: #A92928;
  --fs: 16px;
}
* {
  box-sizing: border-box;
}
html {
  font-size: var(--fs);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Sarabun", system-ui, sans-serif;
  line-height: 1.55;
}
h1,
h2,
h3,
h4,
.btn,
.nav a,
.chip,
.brand b {
  font-family: "Prompt", "Sarabun", sans-serif;
}
a {
  color: inherit;
  text-decoration: none;
}
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Utility (replaces one-off inline `style=` attributes from the mockup) */
.mt-xs {
  margin-top: 4px;
}

/* Header */
header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.hdr {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 72px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand b {
  display: block;
  font-size: 1.2rem;
  color: var(--navy);
  line-height: 1.1;
}
.brand small {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}
.domain {
  padding-left: 18px;
  margin-left: 4px;
  border-left: 1px solid var(--line);
  color: var(--navy);
  font-size: 0.9rem;
}
.nav {
  display: flex;
  gap: 26px;
  margin-left: auto;
}
.nav a {
  font-size: 0.88rem;
  color: var(--ink);
  padding: 24px 0 22px;
  border-bottom: 2px solid transparent;
}
.nav a.on,
.nav a:hover {
  border-bottom-color: var(--gold);
  color: var(--navy);
}
/* was style="display:flex;align-items:center;gap:5px" on #navAsk */
#navAsk {
  display: flex;
  align-items: center;
  gap: 5px;
}
.fsz {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-left: 30px;
}
.fsz button {
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--navy);
  font-family: "Prompt";
  padding: 2px 4px;
  border-radius: 4px;
}
.fsz button.on {
  background: var(--chip);
}
/* was style="font-size:13px/17px/22px" per button */
.fsz button[data-fs="14px"] {
  font-size: 13px;
}
.fsz button[data-fs="16px"] {
  font-size: 17px;
}
.fsz button[data-fs="18px"] {
  font-size: 22px;
}
.burger {
  display: none;
  margin-left: auto;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 6px;
}

/* Hero */
.hero {
  position: relative;
  background: var(--navy-3);
  overflow: hidden;
  color: #fff;
  isolation: isolate;
}
.hero img.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 80% 88%;
  z-index: -2;
}
/* brand-red wash: solid behind the text, clear over the building */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(
      90deg,
      rgba(82, 0, 0, 0.94) 0%,
      rgba(130, 20, 20, 0.86) 30%,
      rgba(169, 41, 40, 0.45) 52%,
      rgba(169, 41, 40, 0) 74%
    ),
    linear-gradient(0deg, rgba(40, 0, 0, 0.35) 0%, rgba(40, 0, 0, 0) 35%);
}
.hero h1,
.hero p,
.phase {
  text-shadow: 0 1px 14px rgba(60, 0, 0, 0.35);
}
.hero .wrap {
  position: relative;
  padding-top: 30px;
  padding-bottom: 26px;
}
.phase {
  display: inline-block;
  background: var(--gold-soft);
  color: var(--navy);
  font: 600 0.78rem "Prompt";
  padding: 4px 14px;
  border-radius: 20px;
}
.hero h1 {
  margin: 12px 0 6px;
  font-size: 2.7rem;
  line-height: 1.18;
  font-weight: 700;
}
.hero h1 span {
  color: var(--gold-2);
  display: block;
}
.hero p {
  margin: 0 0 18px;
  font-size: 1.05rem;
  opacity: 0.95;
}
.search {
  display: flex;
  background: #fff;
  border-radius: 10px;
  padding: 4px;
  max-width: 600px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.search label {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 10px;
  padding: 0 12px;
  color: var(--muted);
}
.search input {
  border: 0;
  outline: 0;
  flex: 1;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: none;
  padding: 10px 0;
  min-width: 0;
}
.btn {
  border: 0;
  cursor: pointer;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: var(--navy-3);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 28px;
  border-radius: 8px;
}
.btn:hover {
  filter: brightness(1.05);
}

/* Sections */
main {
  background: #fff;
}
section {
  padding: 26px 0 6px;
}
.sec-h h2 {
  margin: 0;
  font-size: 1.55rem;
  color: var(--navy);
}
.sec-h p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
}
.groups {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.g {
  position: relative;
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 34px 14px 16px;
  box-shadow: 0 1px 2px rgba(16, 30, 60, 0.04);
  transition: 0.15s;
}
.g:hover {
  border-color: var(--gold);
  box-shadow: 0 6px 16px rgba(16, 30, 60, 0.08);
  transform: translateY(-1px);
}
.g .ic {
  height: 40px;
  color: var(--navy);
  margin-bottom: 6px;
}
.g .ic svg {
  height: 38px;
  width: auto;
}
.g h3 {
  margin: 0;
  font-size: 0.98rem;
  color: var(--navy);
  display: inline;
}
.g .row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
/* was style="margin-top:4px" on the second .row in a card */
.g .row + .row {
  margin-top: 4px;
}
.g p {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}
/* was style="margin:0" on the <p> nested inside a .row */
.g .row p {
  margin: 0;
}
.g .arr {
  position: absolute;
  right: 14px;
  top: 34px;
  color: var(--navy);
}
.badge {
  display: inline-block;
  background: var(--badge);
  color: var(--badge-ink);
  font: 500 0.68rem "Prompt";
  padding: 2px 8px;
  border-radius: 10px;
}

.pop {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--chip);
  border-radius: 10px;
  padding: 10px 16px;
  flex-wrap: wrap;
}
.pop h4 {
  margin: 0;
  font-size: 1.02rem;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 16px;
  border-right: 1px solid #c9d6ea;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #d8e2f1;
  border-radius: 20px;
  padding: 5px 26px 5px 14px;
  font-size: 0.82rem;
  color: var(--navy);
  cursor: pointer;
}
.chip:hover {
  border-color: var(--gold);
}
.chips {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.duo {
  display: grid;
  grid-template-columns: 2.3fr 1fr;
  gap: 14px;
  margin-top: 16px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.prison {
  position: relative;
  padding: 18px 20px;
  overflow: hidden;
}
.prison .map {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 36%;
  background: linear-gradient(90deg, #fff 0%, #eef3fa 30%);
}
.prison .map svg,
.prison .map img {
  height: 100%;
  width: 100%;
  object-fit: contain;
  object-position: center;
}
.prison .top {
  display: flex;
  gap: 14px;
  position: relative;
}
.prison h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--navy);
}
.prison p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.pf {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  position: relative;
  max-width: 64%;
}
.field {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d2dae6;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  flex: 1;
  color: var(--muted);
}
.field input,
.field select {
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 0.9rem;
  padding: 11px 0;
  flex: 1;
  background: none;
  color: var(--ink);
  min-width: 0;
  appearance: none;
}
.field select {
  color: var(--muted);
  cursor: pointer;
}
.opendata {
  padding: 16px 18px;
}
.opendata .top {
  display: flex;
  gap: 12px;
}
.opendata h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--navy);
}
.opendata p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.opendata ul {
  list-style: none;
  margin: 10px 0 12px;
  padding: 0;
}
.opendata li a {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.86rem;
  padding: 3px 0;
  color: var(--ink);
}
.opendata li a:hover {
  color: var(--navy);
  text-decoration: underline;
}
.btn-o {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--navy);
  border-radius: 8px;
  padding: 6px;
  font: 500 0.85rem "Prompt";
  color: var(--navy);
}
.btn-o:hover {
  background: var(--chip);
}

.prep {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--cream);
  border: 1px solid #f0dfae;
  border-radius: 10px;
  padding: 12px 22px;
  margin: 16px 0 22px;
}
.prep h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--navy);
}
.prep p {
  margin: 0;
  font-size: 0.85rem;
  color: #7E4B4B;
}
/* was style="font-size:1.6rem" on .prep's own .arr */
.prep .arr {
  margin-left: auto;
  color: var(--navy);
  font-size: 1.6rem;
}

footer {
  background: var(--navy);
  color: #dbe3f1;
  padding: 14px 0;
}
.ft {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.ft b {
  font-family: "Prompt";
  color: #fff;
  font-size: 1rem;
}
.ft small {
  display: block;
  font-size: 0.7rem;
  color: #F2DEE4;
}
/* was style="font-family:Prompt" on the department name span */
.ft-dept {
  font-family: "Prompt";
}
.ft nav {
  display: flex;
  gap: 26px;
  margin-left: auto;
  padding-left: 24px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.78rem;
}
.ft nav a:hover {
  color: var(--gold-2);
}
.ft .note {
  font-size: 0.72rem;
  opacity: 0.6;
}

/* Tablet */
@media (max-width: 1080px) {
  .nav {
    gap: 16px;
  }
  .domain {
    display: none;
  }
  .groups {
    grid-template-columns: repeat(2, 1fr);
  }
}
/* Mobile */
@media (max-width: 760px) {
  .wrap {
    padding: 0 16px;
  }
  .hdr {
    height: auto;
    padding: 10px 0;
    flex-wrap: wrap;
  }
  .brand small.d {
    display: block;
  }
  .nav,
  .fsz {
    display: none;
  }
  .burger {
    display: block;
  }
  header.open .nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    margin: 0;
  }
  header.open .nav a {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  header.open .fsz {
    display: flex;
    margin: 8px 0;
  }
  .hero img.bg {
    object-position: 70% 90%;
  }
  .hero::before {
    background: linear-gradient(
      180deg,
      rgba(82, 0, 0, 0.9),
      rgba(130, 20, 20, 0.8) 60%,
      rgba(169, 41, 40, 0.55)
    );
  }
  .hero h1 {
    font-size: 1.75rem;
  }
  .hero p {
    font-size: 0.92rem;
  }
  .search .btn {
    padding: 8px 16px;
  }
  .search input {
    font-size: 0.82rem;
  }
  .sec-h h2 {
    font-size: 1.25rem;
  }
  .sec-h p {
    font-size: 0.82rem;
  }
  .groups {
    gap: 10px;
  }
  .g {
    padding: 12px 26px 12px 12px;
  }
  .g p {
    display: none;
  }
  .g h3 {
    font-size: 0.82rem;
    display: block;
  }
  .g .arr {
    right: 10px;
    top: 22px;
  }
  .g .ic svg {
    height: 30px;
  }
  .pop h4 {
    border: 0;
    width: 100%;
    padding: 0;
  }
  .chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .chip {
    font-size: 0.72rem;
    padding: 5px 10px;
  }
  .duo {
    grid-template-columns: 1fr;
  }
  .prison .map {
    display: none;
  }
  .pf {
    max-width: none;
    flex-wrap: wrap;
  }
  .pf .field {
    flex: 1 1 40%;
  }
  .pf .btn {
    width: 100%;
  }
  .prep {
    padding: 12px 14px;
  }
  .ft nav {
    border: 0;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
    gap: 14px;
  }
  .chat-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .chat-fab {
    right: 16px;
    bottom: 16px;
  }
  .children-grid {
    grid-template-columns: 1fr;
  }
}

/* ======= Audience/topic detail pages (P1A-03, no mockup reference —
   built from the same navy/gold/Prompt/Sarabun system as the rest of
   this file) ======= */
.breadcrumb {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 18px 0;
}
.breadcrumb a {
  color: var(--navy);
}
.breadcrumb a:hover {
  text-decoration: underline;
}
.breadcrumb .sep {
  margin: 0 6px;
  color: #aab3c4;
}

.detail-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.detail-head .ic {
  height: 48px;
  color: var(--navy);
  flex: none;
}
.detail-head .ic svg {
  height: 44px;
  width: auto;
}
.detail-head h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--navy);
}
.detail-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.children-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 14px;
  margin: 18px 0 28px;
}

.block {
  margin: 0 0 20px;
}
.block-text p {
  margin: 0 0 10px;
  font-size: 0.95rem;
  line-height: 1.7;
}
.block-image figure {
  margin: 0;
}
.block-image img {
  width: 100%;
  border-radius: 10px;
  display: block;
}
.block-image figcaption,
.block-youtube figcaption {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}
.block-youtube .frame {
  position: relative;
  padding-top: 56.25%; /* 16:9 */
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.block-youtube iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.topic-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 8px 0 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.topic-meta b {
  color: var(--navy);
  font-family: "Prompt";
}

.topic-section {
  margin: 0 0 24px;
}
.topic-section h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: var(--navy);
}
.topic-section .body {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--ink);
}
.topic-section .body :is(ul, ol) {
  padding-left: 1.4em;
}

.legal-refs {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.legal-refs li a {
  font-size: 0.85rem;
  color: var(--navy);
  text-decoration: underline;
}

.related {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.related h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--navy);
}
.related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.related a {
  font-size: 0.88rem;
  color: var(--ink);
}
.related a:hover {
  color: var(--navy);
  text-decoration: underline;
}

/* ======= Search page (P1A-04, no mockup reference) ======= */
.search-bar {
  padding: 22px 0 6px;
}
.search-bar .search {
  max-width: 620px;
}
.search-summary {
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}
.search-results {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.search-results li {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
.search-results a {
  font-size: 1rem;
  color: var(--navy);
  font-family: "Prompt";
}
.search-results a:hover {
  text-decoration: underline;
}
.search-results mark {
  background: var(--gold-soft);
  color: var(--navy-3);
  padding: 0 2px;
  border-radius: 2px;
}
.search-empty {
  padding: 36px 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.92rem;
}
.pagination {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 24px 0 36px;
}
.pagination a,
.pagination span {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--navy);
}
.pagination .current {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ======= AI Chat ======= */
.chat-fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, var(--navy-2), var(--navy-3));
  color: #fff;
  border: 0;
  cursor: pointer;
  padding: 14px 20px 14px 16px;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(15, 31, 61, 0.35);
  font: 600 0.92rem "Prompt";
}
.chat-fab:hover {
  filter: brightness(1.08);
}
.chat-fab .dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold-2);
  border: 2px solid #fff;
}
.chat-panel {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 56;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: min(600px, calc(100vh - 56px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(10, 20, 45, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: 0.18s ease;
}
.chat-panel.open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}
.chat-head {
  background: linear-gradient(90deg, var(--navy-3), var(--navy));
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-head .ava {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-3);
  flex: none;
}
.chat-head b {
  font-family: "Prompt";
  font-size: 0.95rem;
  display: block;
}
.chat-head small {
  opacity: 0.8;
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  gap: 5px;
}
.chat-head small::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}
.chat-head .x {
  margin-left: auto;
  background: none;
  border: 0;
  color: #fff;
  opacity: 0.85;
  cursor: pointer;
  padding: 4px;
}
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}
.msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 0.87rem;
  line-height: 1.55;
}
.msg.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  border-top-left-radius: 4px;
}
.msg.user {
  align-self: flex-end;
  background: var(--navy);
  color: #fff;
  border-top-right-radius: 4px;
}
.msg.bot .src {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}
.msg.bot .src a {
  color: var(--navy-2);
  text-decoration: underline;
}
.chat-note {
  align-self: center;
  background: var(--cream);
  color: #7a5a12;
  border: 1px solid #f0dfae;
  font-size: 0.74rem;
  padding: 6px 12px;
  border-radius: 20px;
  text-align: center;
}
.chat-suggest {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 14px 10px;
}
.chat-suggest button {
  border: 1px solid #d8e2f1;
  background: #fff;
  color: var(--navy);
  font-size: 0.76rem;
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
}
.chat-suggest button:hover {
  border-color: var(--gold);
}
.chat-foot {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
}
.chat-input {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 4px 4px 12px;
}
.chat-input input {
  flex: 1;
  border: 0;
  background: none;
  outline: 0;
  font: inherit;
  font-size: 0.86rem;
  padding: 9px 0;
}
.chat-input button {
  border: 0;
  background: var(--navy);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-input button:disabled {
  opacity: 0.4;
  cursor: default;
}
.chat-disclaimer {
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  margin: 6px 0 0;
}
.typing {
  display: flex;
  gap: 4px;
  align-self: flex-start;
  padding: 10px 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  border-top-left-radius: 4px;
}
.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b9c3d6;
  animation: tb 1.1s infinite;
}
.typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.typing span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes tb {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* ======= Toast (core/errors.py-style transient message, was built via
   inline style.cssText in the mockup's demo() helper) ======= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font: 500 14px "Prompt";
  z-index: 60;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition: opacity 0.3s;
  opacity: 0;
}
/* ======= Prison directory (P1A-05, new pages /prisons and
   /prisons/{code} — not in portal-mockup.html as a full page, only as
   the homepage search widget; built in the same navy/gold visual
   language and reusing .pf/.field/.btn-o/.breadcrumb/.topic-meta/
   .topic-section from the pages the mockup does cover) ======= */
.prison-filters {
  max-width: 100%;
  flex-wrap: wrap;
}
.prison-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  gap: 12px;
}
.prison-item a {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.prison-item a:hover {
  border-color: var(--gold);
}
.prison-item h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--navy);
}
.prison-item-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.prison-item p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}
.prison-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 24px;
}
.prison-actions .btn-o {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.announce {
  border-radius: 10px;
  padding: 12px 16px;
  margin: 0 0 18px;
  font-size: 0.88rem;
  border: 1px solid transparent;
}
.announce b {
  display: block;
  font-family: "Prompt";
  margin-bottom: 4px;
}
.announce .body {
  color: inherit;
}
.announce-info {
  background: var(--badge);
  color: var(--badge-ink);
  border-color: #c7d9f5;
}
.announce-warning {
  background: var(--gold-soft);
  color: #7a5510;
  border-color: var(--gold);
}
.announce-critical {
  background: #fbe4e4;
  color: #9a1f1f;
  border-color: #e0a3a3;
}

@media (max-width: 760px) {
  .prison-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .prison-actions {
    flex-direction: column;
  }
}

.toast.show {
  opacity: 1;
}

/* ======= Language switch + guide pages (card layout "guide") =======
   Layout follows docs/design/foreign-guide/ (approved prototype), drawn
   with the tokens of this file. No inline styles anywhere (CSP). */
.langsw {
  display: flex;
  gap: 3px;
  background: var(--cream);
  padding: 3px;
  border-radius: 9px;
  flex: none;
}
.langsw a {
  padding: 4px 11px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}
.langsw a.on {
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(82, 0, 0, 0.12);
}
.langsw a:focus-visible,
.guide a:focus-visible,
.guide-hero a:focus-visible,
.guide-banner:focus-visible {
  outline: 3px solid var(--gold-2);
  outline-offset: 3px;
}

/* Home banner linking to a guide */
.guide-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 22px;
  padding: 16px 22px;
  background: linear-gradient(110deg, var(--cream), #fff7ee);
  border: 1px solid var(--line);
  border-left: 5px solid var(--navy);
  border-radius: 12px;
  color: var(--ink);
}
.guide-banner:hover {
  border-color: var(--navy-2);
  box-shadow: 0 6px 18px rgba(82, 0, 0, 0.08);
}
.guide-banner .ic {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--navy);
}
.guide-banner .ic svg {
  max-height: 38px;
  width: auto;
}
.guide-banner .txt {
  flex: 1;
  min-width: 0;
}
.guide-banner .txt b {
  display: block;
  color: var(--navy);
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.guide-banner .txt small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}
.guide-banner strong {
  flex: none;
  color: var(--navy);
  font-size: 0.9rem;
}

/* Markup produced by richtext.py (headings, lists, note box, buttons) */
.block-text h3 {
  font-size: 1.02rem;
  margin: 1.3em 0 0.5em;
  color: var(--ink);
}
.block-text ul {
  padding-left: 1.4em;
  margin: 0.5em 0 1.1em;
}
.block-text li {
  margin-bottom: 0.4em;
  font-size: 0.95rem;
  line-height: 1.7;
}
.block-text blockquote {
  margin: 1.1em 0;
  padding: 12px 16px;
  background: #f1f5f2;
  border-left: 4px solid #6b9a87;
  border-radius: 8px;
  color: #3f5c4e;
}
.block-text blockquote p {
  margin: 0;
  font-size: 0.88rem;
}
.block-text a {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.block-text a.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  margin: 4px 8px 4px 0;
  padding: 9px 16px;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--navy);
}
.block-text a.btn:hover {
  background: var(--navy-2);
}

.guide-hero {
  background: linear-gradient(110deg, #f5e4e2, #fff7ee);
  border-bottom: 1px solid var(--line);
  padding: 8px 0 40px;
}
.guide-hero-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 48px;
  align-items: center;
}
.guide .kicker,
.guide-hero .kicker {
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.guide-hero h1 {
  font-size: 2.1rem;
  line-height: 1.4;
  margin: 10px 0 14px;
  color: #98272b;
}
.guide-hero .lead p {
  margin: 0 0 8px;
  color: #70627d;
  max-width: 620px;
}
.guide-hero .hero-tags ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 18px 0 0;
}
.guide-hero .hero-tags li {
  font-size: 0.74rem;
  border: 1px solid #dbb8ad;
  border-radius: 20px;
  padding: 3px 12px;
  color: #985e51;
  margin: 0;
}
.start-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 32px rgba(82, 0, 0, 0.07);
}
.start-card h3 {
  font-size: 1.2rem;
  line-height: 1.5;
  margin: 0 0 8px;
}
.start-card p {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 14px;
}
.start-card a.btn {
  background: var(--gold-2);
  border-color: var(--gold-2);
  color: var(--navy-3);
}

.guide {
  padding-bottom: 36px;
}
.guide .topic-section {
  padding: 34px 0 28px;
}
.guide h2 {
  font-size: 1.55rem;
  line-height: 1.5;
  margin: 6px 0;
}
.guide .topic-section .sub {
  margin: 0 0 18px;
  font-size: 0.85rem;
  color: var(--muted);
}
.topic-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.topic {
  display: flex;
  flex-direction: column;
  padding: 20px 18px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
}
.topic:hover {
  border-color: var(--navy-2);
  box-shadow: 0 6px 18px rgba(82, 0, 0, 0.08);
  transform: translateY(-2px);
}
.topic .ic {
  height: 40px;
  color: var(--navy);
  margin-bottom: 10px;
}
.topic .ic svg {
  height: 36px;
  width: auto;
}
.topic h3 {
  font-size: 1rem;
  margin: 0 0 6px;
}
.topic p {
  flex: 1;
  margin: 0 0 14px;
  font-size: 0.8rem;
  color: var(--muted);
}
.topic .more {
  color: var(--navy);
  font-size: 0.8rem;
}

.guide-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.guide .contents {
  position: sticky;
  top: 90px;
  align-self: start;
  padding: 12px 0;
}
.guide .contents nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 14px;
}
.guide .contents nav a {
  font-size: 0.8rem;
  padding: 8px 12px;
  color: #81728e;
  border-radius: 7px;
  border-left: 2px solid transparent;
}
.guide .contents nav a:hover {
  color: var(--navy);
  background: var(--cream);
  border-left-color: var(--navy);
}
.contact-short {
  display: block;
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding: 16px 12px;
  color: #8c7f96;
  font-size: 0.8rem;
}
.contact-short b {
  display: block;
  color: var(--navy);
  margin-top: 4px;
}
.article {
  padding: 12px 0 30px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 90px;
}
.article:last-child {
  border-bottom: 0;
}
.article-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.section-num {
  background: #f5dfdc;
  color: var(--navy);
  border-radius: 9px;
  min-width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  margin-top: 8px;
}
.article h2 {
  margin: 4px 0 6px;
}
.article .description {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.contact-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  background: var(--cream);
  border-radius: 16px;
  padding: 30px 36px;
  margin: 24px 0 34px;
  scroll-margin-top: 90px;
}
.contact-section p {
  font-size: 0.88rem;
  color: #776782;
  margin: 0 0 10px;
}
.contact-details {
  padding-left: 30px;
  border-left: 1px solid #e2c9c5;
}
.contact-details strong {
  display: block;
  font-size: 1.75rem;
  color: var(--navy);
  letter-spacing: 0.03em;
  line-height: 1.3;
}
.contact-details a.btn {
  background: #fff;
  color: var(--navy);
  border: 1px solid #e2c9c5;
}
.contact-details p a.btn:first-child {
  background: var(--navy);
  color: #fff;
}
.faqs {
  max-width: 900px;
  margin: 0 auto 30px;
}
.faqs details {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 10px;
}
.faqs summary {
  padding: 15px 20px;
  cursor: pointer;
  font-size: 0.95rem;
  color: #574464;
}
.faqs details > p,
.faqs details > ul {
  padding: 0 20px 14px;
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}
.resources {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 26px;
  background: #fff;
}
.resource-text {
  display: flex;
  gap: 18px;
  align-items: center;
}
.resource-icon {
  font-size: 2rem;
  color: var(--navy);
}
.resources h3 {
  font-size: 1rem;
  margin: 0 0 3px;
}
.resources p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.resource-actions .block {
  margin: 0;
}
.editorial {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: #a092aa;
  font-size: 0.72rem;
  margin: 18px 0 0;
}

@media (max-width: 900px) {
  .topic-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .guide-hero-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .guide-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .guide .contents {
    position: static;
    padding: 0;
    overflow-x: auto;
  }
  .guide .contents > .kicker,
  .contact-short {
    display: none;
  }
  .guide .contents nav {
    flex-direction: row;
    gap: 7px;
    margin-top: 0;
    width: max-content;
  }
  .guide .contents nav a {
    white-space: nowrap;
    background: var(--cream);
    border: 0;
  }
  .contact-section {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 24px 20px;
  }
  .contact-details {
    padding: 18px 0 0;
    border-left: 0;
    border-top: 1px solid #e2c9c5;
  }
}
@media (max-width: 520px) {
  .guide-hero h1 {
    font-size: 1.6rem;
  }
  .guide-banner {
    flex-wrap: wrap;
    padding: 14px 16px;
  }
  .resources {
    flex-direction: column;
    align-items: flex-start;
  }
  .editorial {
    display: block;
  }
  .editorial span {
    display: block;
    margin-bottom: 4px;
  }
  .langsw a {
    padding: 4px 8px;
  }
}
@media print {
  .langsw,
  .guide .contents,
  .guide .topic-section {
    display: none;
  }
}
