@font-face {
  font-family: "Prompt";
  src: url("../vendor/Prompt-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Prompt";
  src: url("../vendor/Prompt-Medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Prompt";
  src: url("../vendor/Prompt-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  --pea-purple: #74045f;
  --pea-purple-dark: #560047;
  --pea-purple-soft: #f7eff5;
  --pea-gold: #c7911b;
  --pea-gold-dark: #76520b;
  --pea-gold-soft: #fbf6e9;
  --ink: #252127;
  --muted: #6d6870;
  --line: #e5e1e5;
  --line-strong: #d4ced4;
  --surface: #ffffff;
  --surface-subtle: #f8f7f8;
  --page: #f5f4f5;
  --success: #237a4b;
  --danger: #ad2f37;
  --warning: #8b5d08;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: "Prompt", "Noto Sans Thai", Tahoma, sans-serif;
  font-size: 0.95rem;
  line-height: 1.65;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid rgba(116, 4, 95, 0.24);
  outline-offset: 2px;
}

.container {
  max-width: 1180px;
}

.shadow-sm {
  box-shadow: none !important;
}

.demo-ribbon {
  min-height: 32px;
  padding: 5px 20px;
  border-top: 4px solid var(--pea-gold);
  color: #575158;
  background: #f2eff2;
  text-align: center;
  font-size: 0.72rem;
}

.demo-ribbon span {
  margin-right: 8px;
  color: var(--pea-purple);
  font-weight: 600;
}

.environment-badge {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 6px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  vertical-align: 1px;
}

.environment-development {
  color: var(--pea-gold-dark);
  background: var(--pea-gold-soft);
}

.environment-production {
  color: var(--pea-purple);
  background: var(--pea-purple-soft);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.header-inner {
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  object-fit: contain;
}

.brand strong,
.brand small,
.user-chip strong,
.user-chip small {
  display: block;
}

.brand strong {
  color: var(--pea-purple);
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.25;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
}

.main-nav {
  margin-left: auto;
  display: flex;
  align-items: stretch;
  gap: 2px;
  align-self: stretch;
}

.main-nav a {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #575158;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
}

.main-nav a::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 3px;
  background: transparent;
}

.main-nav a:hover,
.main-nav a.is-active {
  color: var(--pea-purple);
}

.main-nav a.is-active::after {
  background: var(--pea-gold);
}

.nav-logout {
  display: flex;
  align-items: center;
}

.nav-logout button {
  padding: 0 12px;
  border: 0;
  color: #716b72;
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
}

.nav-logout button:hover {
  color: var(--pea-purple);
}

.user-chip {
  min-width: 165px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.user-chip strong {
  font-size: 0.76rem;
  font-weight: 500;
}

.user-chip small {
  color: var(--muted);
  font-size: 0.67rem;
}

.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(116, 4, 95, 0.15);
  border-radius: 50%;
  color: var(--pea-purple);
  background: var(--pea-purple-soft);
  font-weight: 600;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--pea-purple);
  background: var(--surface);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
}

.page-shell {
  min-height: calc(100vh - 190px);
  padding-top: 40px;
  padding-bottom: 64px;
}

.flash-stack {
  margin-bottom: 20px;
}

.flash-stack .alert {
  border: 1px solid currentColor;
  border-radius: var(--radius);
  font-size: 0.83rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr);
  gap: 44px;
  align-items: center;
  padding: 36px 40px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--pea-purple);
  border-radius: var(--radius);
  background: var(--surface);
}

.hero h1 {
  max-width: 740px;
  margin: 7px 0 10px;
  color: var(--ink);
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.hero p {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.hero-actions {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  display: block;
  color: var(--pea-purple);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.035em;
}

.workflow-card {
  padding: 20px 22px;
  border-left: 3px solid var(--pea-gold);
  background: var(--surface-subtle);
}

.workflow-card ol {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.workflow-card li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.workflow-card li:last-child {
  border-bottom: 0;
}

.workflow-card li b {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--pea-purple);
  font-size: 0.68rem;
}

.workflow-card li span,
.workflow-card li small {
  display: block;
}

.workflow-card li span {
  font-size: 0.78rem;
  font-weight: 500;
}

.workflow-card li small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 400;
}

.hero-compact {
  grid-template-columns: 1fr auto;
}

.hero-compact h1 {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
}

.flow-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.flow-mini span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--pea-purple);
  background: var(--pea-purple-soft);
  font-size: 0.72rem;
  font-weight: 500;
}

.flow-mini b {
  color: var(--pea-gold-dark);
  font-size: 0.75rem;
}

.btn {
  border-radius: 6px;
  font-weight: 500;
}

.btn-primary {
  --bs-btn-bg: var(--pea-purple);
  --bs-btn-border-color: var(--pea-purple);
  --bs-btn-hover-bg: var(--pea-purple-dark);
  --bs-btn-hover-border-color: var(--pea-purple-dark);
  --bs-btn-active-bg: var(--pea-purple-dark);
  --bs-btn-active-border-color: var(--pea-purple-dark);
  --bs-btn-focus-shadow-rgb: 116, 4, 95;
}

.btn-outline-dark {
  --bs-btn-color: var(--pea-purple);
  --bs-btn-border-color: var(--pea-purple);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--pea-purple);
  --bs-btn-hover-border-color: var(--pea-purple);
  --bs-btn-active-bg: var(--pea-purple-dark);
  --bs-btn-active-border-color: var(--pea-purple-dark);
}

.btn-light {
  --bs-btn-color: #4f494f;
  --bs-btn-bg: #f2f0f2;
  --bs-btn-border-color: #e4e0e4;
  --bs-btn-hover-bg: #e8e5e8;
  --bs-btn-hover-border-color: #d9d4d9;
}

.btn-lg {
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric-grid article {
  padding: 20px 24px;
  border-right: 1px solid var(--line);
}

.metric-grid article:last-child {
  border-right: 0;
}

.metric-grid span,
.metric-grid small,
.metric-grid strong {
  display: block;
}

.metric-grid span {
  color: var(--muted);
  font-size: 0.75rem;
}

.metric-grid strong {
  margin: 2px 0;
  color: var(--pea-purple);
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.3;
}

.metric-grid small {
  color: #89838a;
  font-size: 0.65rem;
}

.section-card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-heading h2,
.section-card h2 {
  margin: 3px 0 0;
  font-size: 1.16rem;
  font-weight: 600;
}

.section-heading a,
.api-link {
  color: var(--pea-purple);
  font-size: 0.76rem;
  font-weight: 500;
  text-decoration: none;
}

.section-heading a:hover,
.api-link:hover {
  text-decoration: underline;
}

.request-list {
  display: grid;
}

.request-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) auto minmax(120px, 0.5fr) 18px;
  gap: 18px;
  align-items: center;
  padding: 16px 4px;
  border-top: 1px solid var(--line);
  text-decoration: none;
}

.request-row:first-child {
  border-top: 0;
}

.request-row > div small,
.request-row > div strong,
.request-row > div span {
  display: block;
}

.request-row > div small {
  color: var(--pea-purple);
  font-size: 0.66rem;
  font-weight: 600;
}

.request-row > div strong {
  margin: 2px 0;
  font-size: 0.88rem;
  font-weight: 500;
}

.request-row > div span,
.category {
  color: var(--muted);
  font-size: 0.72rem;
}

.request-row:hover strong {
  color: var(--pea-purple);
}

.row-arrow {
  color: var(--pea-purple);
}

.status,
.urgency {
  display: inline-flex;
  width: max-content;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 0.66rem;
  font-weight: 500;
}

.status-new {
  color: #7b5505;
  background: #fff8e4;
  border-color: #ead9a6;
}

.status-in_review {
  color: var(--pea-purple);
  background: var(--pea-purple-soft);
  border-color: #ddc6d8;
}

.status-in_progress {
  color: #155f70;
  background: #edf7f8;
  border-color: #c7e2e5;
}

.status-need_info {
  color: #8a4e19;
  background: #fff3e8;
  border-color: #ecd2b9;
}

.status-completed {
  color: #1f6e45;
  background: #edf8f1;
  border-color: #c8e4d3;
}

.status-rejected {
  color: #982d36;
  background: #fff0f1;
  border-color: #edc7ca;
}

.status-lg {
  padding: 6px 10px;
  font-size: 0.73rem;
}

.urgency-normal {
  color: #5c565d;
  background: #f5f3f5;
  border-color: #dfdbdf;
}

.urgency-high {
  color: #7b5505;
  background: #fff8e4;
  border-color: #ead9a6;
}

.urgency-urgent {
  color: #982d36;
  background: #fff0f1;
  border-color: #edc7ca;
}

.persona-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.persona-card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--pea-purple);
  border-radius: var(--radius);
  background: var(--surface);
}

.persona-card.role-manager,
.persona-card.role-admin {
  border-top-color: var(--pea-gold);
}

.persona-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.avatar-lg {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
}

.role-badge,
.rule-chip,
.human-badge {
  padding: 4px 8px;
  border: 1px solid #dfd0dc;
  border-radius: 4px;
  color: var(--pea-purple);
  background: var(--pea-purple-soft);
  font-size: 0.66rem;
  font-weight: 500;
}

.persona-card h2 {
  margin: 16px 0 1px;
  font-size: 1rem;
  font-weight: 600;
}

.persona-card > p {
  color: var(--muted);
  font-size: 0.74rem;
}

.persona-card form {
  margin-top: auto;
}

.plain-list,
.check-list {
  margin: 10px 0 20px;
  padding: 0;
  list-style: none;
  color: #5d575e;
  font-size: 0.72rem;
  line-height: 1.85;
}

.plain-list li::before,
.check-list li::before {
  content: "•";
  margin-right: 8px;
  color: var(--pea-gold-dark);
  font-weight: 600;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}

.page-heading h1 {
  max-width: 820px;
  margin: 4px 0 5px;
  color: var(--ink);
  font-size: clamp(1.65rem, 3.2vw, 2.35rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.rule-chip {
  white-space: nowrap;
  color: var(--pea-gold-dark);
  background: var(--pea-gold-soft);
  border-color: #ead9a6;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.65fr);
  gap: 18px;
}

.form-label {
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.form-control,
.form-select {
  border-color: var(--line-strong);
  border-radius: 6px;
  padding: 0.66rem 0.75rem;
  font-size: 0.84rem;
}

.form-control-lg {
  min-height: 46px;
  font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--pea-purple);
  box-shadow: 0 0 0 0.2rem rgba(116, 4, 95, 0.11);
}

.form-text {
  color: #7d777e;
  font-size: 0.68rem;
}

.teaching-panel {
  padding: 24px;
  border: 1px solid #e8d8ad;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--pea-gold-soft);
}

.teaching-panel h2 {
  margin: 4px 0 14px;
  font-size: 1.08rem;
  font-weight: 600;
}

.number-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.number-list li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 4px 8px;
  padding: 11px 0;
  border-top: 1px solid rgba(118, 82, 11, 0.18);
  counter-increment: list-item;
}

.number-list li::before {
  content: counter(list-item);
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  grid-row: 1 / span 2;
  border-radius: 50%;
  color: #fff;
  background: var(--pea-purple);
  font-size: 0.64rem;
  font-weight: 600;
}

.number-list b,
.number-list span {
  grid-column: 2;
}

.number-list b {
  font-size: 0.77rem;
  font-weight: 500;
}

.number-list span {
  color: var(--muted);
  font-size: 0.69rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.detail-grid small,
.detail-grid strong,
.detail-grid span {
  display: block;
}

.detail-grid small {
  color: var(--muted);
  font-size: 0.67rem;
}

.detail-grid strong {
  margin-top: 2px;
  font-size: 0.83rem;
  font-weight: 500;
}

.detail-grid span {
  color: var(--muted);
  font-size: 0.7rem;
}

.section-card hr {
  margin: 22px 0;
  border-color: var(--line);
  opacity: 1;
}

.preserve-lines {
  white-space: pre-line;
  color: #4f4a50;
  font-size: 0.82rem;
  line-height: 1.8;
}

.attachment-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
}

.file-icon {
  width: 38px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--pea-purple);
  background: var(--pea-purple-soft);
  font-size: 0.57rem;
  font-weight: 600;
}

.attachment-card strong,
.attachment-card small {
  display: block;
}

.attachment-card strong {
  font-size: 0.78rem;
  font-weight: 500;
}

.attachment-card small {
  color: var(--muted);
  font-size: 0.64rem;
}

.attachment-card:hover {
  border-color: var(--pea-purple);
  background: var(--pea-purple-soft);
}

.api-link {
  display: inline-block;
  margin-top: 18px;
}

.timeline {
  margin-top: 16px;
}

.timeline article {
  position: relative;
  display: grid;
  grid-template-columns: 15px 1fr;
  gap: 10px;
  padding-bottom: 18px;
}

.timeline article::before {
  content: "";
  position: absolute;
  top: 11px;
  bottom: 0;
  left: 4px;
  width: 1px;
  background: var(--line-strong);
}

.timeline article:last-child::before {
  display: none;
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--pea-purple);
  box-shadow: 0 0 0 1px var(--pea-purple);
}

.timeline strong {
  font-size: 0.77rem;
  font-weight: 500;
}

.timeline p {
  margin: 2px 0;
  color: #565057;
  font-size: 0.73rem;
}

.timeline small {
  color: #868087;
  font-size: 0.62rem;
}

.filter-bar {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.9fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.filter-bar label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: var(--surface-subtle);
}

.table thead th {
  padding: 12px 16px;
  color: #625c63;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line-strong);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.table tbody td {
  padding: 14px 16px;
  border-color: var(--line);
  color: #4e494f;
  font-size: 0.74rem;
}

.table td strong,
.table td small {
  display: block;
}

.table td strong {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 500;
}

.table td small {
  color: var(--muted);
  font-size: 0.62rem;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

.review-main {
  display: grid;
  gap: 18px;
}

.sticky-card {
  position: sticky;
  top: 106px;
}

.ai-card {
  border-left: 3px solid var(--pea-gold);
}

.ai-result-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.ai-result-grid > div {
  padding: 16px;
  border-left: 1px solid var(--line);
  background: var(--surface-subtle);
}

.ai-result-grid > div:first-child {
  border-left: 0;
}

.ai-result-grid small,
.ai-result-grid strong,
.ai-result-grid span {
  display: block;
}

.ai-result-grid small {
  color: var(--pea-purple);
  font-size: 0.64rem;
  font-weight: 600;
}

.ai-result-grid strong {
  margin: 5px 0;
  font-size: 0.78rem;
  font-weight: 500;
}

.ai-result-grid span {
  color: var(--muted);
  font-size: 0.62rem;
}

.ai-result-grid p {
  margin: 5px 0 0;
  color: #4f494f;
  font-size: 0.74rem;
  line-height: 1.7;
}

.control-note {
  margin: 14px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--pea-gold);
  color: #5e4a1f;
  background: var(--pea-gold-soft);
  font-size: 0.7rem;
}

.btn-ai {
  color: #fff;
  background: var(--pea-purple);
  border-color: var(--pea-purple);
}

.btn-ai:hover,
.btn-ai:focus {
  color: #fff;
  background: var(--pea-purple-dark);
  border-color: var(--pea-purple-dark);
}

.terminal-state {
  padding: 13px;
  border: 1px solid #c8e4d3;
  border-radius: 6px;
  color: #1f6e45;
  background: #edf8f1;
}

.terminal-state p {
  margin: 3px 0 0;
  font-size: 0.7rem;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.report-wide {
  grid-column: 1 / -1;
}

.bar-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.bar-list > div {
  display: grid;
  grid-template-columns: 140px 1fr 28px;
  gap: 10px;
  align-items: center;
}

.bar-list span,
.bar-list strong {
  font-size: 0.72rem;
}

.bar-list strong {
  color: var(--pea-purple);
  font-weight: 600;
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 2px;
  background: #ece8ec;
}

.bar-track i {
  display: block;
  height: 100%;
  background: var(--pea-purple);
}

.bar-teal .bar-track i {
  background: var(--pea-gold);
}

.summary-table {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 17px;
}

.summary-table > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.73rem;
}

.summary-table strong {
  color: var(--pea-purple);
  font-weight: 600;
}

.report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.report-filter-card {
  margin-bottom: 18px;
  padding: 20px 22px;
}

.report-filter-heading,
.chart-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.report-filter-heading {
  margin-bottom: 15px;
}

.report-filter-heading h2,
.chart-heading h2 {
  margin: 2px 0 0;
  font-size: 1rem;
}

.filter-count {
  padding: 4px 8px;
  border: 1px solid #ead9a6;
  border-radius: 4px;
  color: var(--pea-gold-dark);
  background: var(--pea-gold-soft);
  font-size: 0.65rem;
  font-weight: 500;
}

.report-filter {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px 12px;
}

.report-filter label > span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
}

.report-filter-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 3px;
}

.filter-warning {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 9px 11px;
  border-left: 3px solid var(--pea-gold);
  color: var(--warning);
  background: var(--pea-gold-soft);
  font-size: 0.68rem;
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.report-kpi-grid article {
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}

.report-kpi-grid article:last-child {
  border-right: 0;
}

.report-kpi-grid span,
.report-kpi-grid strong,
.report-kpi-grid small {
  display: block;
}

.report-kpi-grid span {
  color: var(--muted);
  font-size: 0.7rem;
}

.report-kpi-grid strong {
  margin: 2px 0;
  color: var(--pea-purple);
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.25;
}

.report-kpi-grid small {
  color: #888188;
  font-size: 0.63rem;
}

.report-kpi-grid .kpi-priority strong {
  color: var(--pea-gold-dark);
}

.report-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.report-chart {
  min-width: 0;
  padding: 22px;
}

.chart-heading {
  min-height: 42px;
  margin-bottom: 15px;
}

.chart-heading > span {
  color: var(--muted);
  font-size: 0.62rem;
}

.report-unit-card {
  grid-column: 1 / -1;
}

.trend-chart {
  height: 210px;
  display: grid;
  grid-template-columns: repeat(var(--trend-columns), minmax(28px, 1fr));
  gap: 6px;
  align-items: end;
  padding: 16px 4px 0;
  border-bottom: 1px solid var(--line-strong);
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 100% 25%;
}

.trend-column {
  height: 100%;
  display: grid;
  grid-template-rows: 18px minmax(0, 1fr) 24px;
  align-items: end;
  justify-items: center;
  min-width: 0;
}

.trend-column strong {
  color: var(--pea-purple);
  font-size: 0.68rem;
  font-weight: 600;
}

.trend-column i {
  width: min(26px, 68%);
  min-height: 6px;
  border-radius: 3px 3px 0 0;
  background: var(--pea-purple);
}

.trend-column:last-child i {
  background: var(--pea-gold);
}

.trend-column span {
  padding-top: 5px;
  color: var(--muted);
  white-space: nowrap;
  font-size: 0.6rem;
}

.urgency-chart {
  padding-top: 19px;
}

.urgency-track {
  height: 13px;
  display: flex;
  overflow: hidden;
  border-radius: 3px;
  background: #ece8ec;
}

.urgency-segment {
  height: 100%;
}

.urgency-segment-normal,
.urgency-dot-normal {
  background: var(--pea-purple);
}

.urgency-segment-high,
.urgency-dot-high {
  background: var(--pea-gold);
}

.urgency-segment-urgent,
.urgency-dot-urgent {
  background: var(--danger);
}

.urgency-list {
  display: grid;
  margin-top: 20px;
}

.urgency-list > div,
.status-legend > div {
  display: grid;
  grid-template-columns: 1fr auto 38px;
  gap: 9px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.urgency-list > div:last-child,
.status-legend > div:last-child {
  border-bottom: 0;
}

.urgency-list span,
.status-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
}

.urgency-dot,
.status-legend i {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  display: inline-block;
  border-radius: 50%;
}

.urgency-list strong,
.status-legend strong {
  color: var(--ink);
  font-size: 0.73rem;
  font-weight: 600;
}

.urgency-list small,
.status-legend small {
  color: var(--muted);
  text-align: right;
  font-size: 0.62rem;
}

.status-chart-layout {
  min-height: 220px;
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 20px;
  align-items: center;
}

.status-donut-wrap {
  position: relative;
  width: 178px;
  height: 178px;
}

.status-donut {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.status-donut-bg,
.status-donut-segment {
  fill: none;
  stroke-width: 5;
}

.status-donut-bg {
  stroke: #eee9ed;
}

.status-donut-segment {
  stroke-linecap: butt;
}

.status-donut-wrap > div {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.status-donut-wrap > div strong,
.status-donut-wrap > div span {
  display: block;
}

.status-donut-wrap > div strong {
  color: var(--pea-purple);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.2;
}

.status-donut-wrap > div span {
  color: var(--muted);
  font-size: 0.62rem;
}

.status-legend {
  display: grid;
}

.dashboard-bar-list,
.unit-chart {
  display: grid;
  gap: 13px;
}

.dashboard-bar-list > div,
.unit-chart > div {
  display: grid;
  grid-template-columns: minmax(105px, 0.8fr) minmax(120px, 1.4fr) 50px;
  gap: 11px;
  align-items: center;
}

.dashboard-bar-list span,
.unit-chart span,
.dashboard-bar-list strong,
.unit-chart strong {
  font-size: 0.68rem;
}

.dashboard-bar-list strong,
.unit-chart strong {
  color: var(--pea-purple);
  font-weight: 600;
  text-align: right;
}

.dashboard-bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 2px;
  background: #ece8ec;
}

.dashboard-bar-track i {
  display: block;
  height: 100%;
  min-width: 3px;
  background: var(--pea-purple);
}

.unit-chart {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.unit-chart > div {
  grid-template-columns: minmax(105px, 0.8fr) minmax(100px, 1fr) 62px;
}

.unit-chart .dashboard-bar-track i {
  background: var(--pea-gold);
}

.report-empty {
  min-height: 190px;
  display: grid;
  place-content: center;
  gap: 3px;
  color: var(--muted);
  text-align: center;
}

.report-empty strong {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 500;
}

.report-empty span {
  font-size: 0.67rem;
}

.empty-state {
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 500;
}

.empty-state p {
  margin: 3px 0 0;
  font-size: 0.7rem;
}

.empty-state.compact {
  padding: 22px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--surface-subtle);
}

.error-card {
  max-width: 620px;
  margin: 50px auto;
  padding: 40px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--pea-purple);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.error-code {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 50%;
  color: #fff;
  background: var(--pea-purple);
  font-size: 1.35rem;
  font-weight: 600;
}

.error-card h1 {
  margin: 5px 0;
  font-size: 1.6rem;
  font-weight: 600;
}

.error-card p {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-shell {
  max-width: 900px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.75fr);
  margin: 10px auto;
  border: 1px solid var(--line);
  border-top: 4px solid var(--pea-purple);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.auth-card,
.auth-aside {
  padding: 38px;
}

.auth-card h1 {
  margin: 5px 0;
  font-size: 1.75rem;
  font-weight: 600;
}

.auth-intro {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.8rem;
}

.auth-link {
  margin: 20px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.72rem;
}

.auth-link a {
  color: var(--pea-purple);
  font-weight: 500;
}

.auth-aside {
  border-left: 1px solid #ead9a6;
  background: var(--pea-gold-soft);
}

.auth-aside h2 {
  margin: 4px 0 16px;
  font-size: 1.12rem;
  font-weight: 600;
}

.auth-aside .plain-list {
  margin-bottom: 0;
}

.form-check-input:checked {
  border-color: var(--pea-purple);
  background-color: var(--pea-purple);
}

.form-check-label {
  color: #5e585f;
  font-size: 0.72rem;
}

.admin-subnav {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.admin-subnav a {
  padding: 7px 12px;
  border-radius: 4px;
  color: #5f5960;
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 500;
}

.admin-subnav a:hover,
.admin-subnav a.is-active {
  color: var(--pea-purple);
  background: var(--pea-purple-soft);
}

.admin-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-metric-grid article {
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}

.admin-metric-grid article:last-child {
  border-right: 0;
}

.admin-metric-grid span,
.admin-metric-grid strong,
.admin-metric-grid small {
  display: block;
}

.admin-metric-grid span {
  color: var(--muted);
  font-size: 0.68rem;
}

.admin-metric-grid strong {
  color: var(--pea-purple);
  font-size: 1.65rem;
  font-weight: 600;
}

.admin-metric-grid small {
  color: #8b858c;
  font-size: 0.62rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.admin-wide {
  grid-column: 1 / -1;
}

.admin-user-list {
  display: grid;
}

.admin-user-list > a {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
}

.admin-user-list > a:first-child {
  border-top: 0;
}

.admin-user-list strong,
.admin-user-list small {
  display: block;
}

.admin-user-list strong {
  font-size: 0.78rem;
  font-weight: 500;
}

.admin-user-list small {
  color: var(--muted);
  font-size: 0.62rem;
}

.account-state {
  display: inline-flex;
  width: max-content;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 0.63rem;
  font-weight: 500;
}

.state-pending {
  color: #7b5505;
  background: #fff8e4;
  border-color: #ead9a6;
}

.state-active {
  color: #1f6e45;
  background: #edf8f1;
  border-color: #c8e4d3;
}

.state-disabled {
  color: #746d75;
  background: #f2f0f2;
  border-color: #dcd7dc;
}

.admin-user-filter {
  grid-template-columns: 1.4fr 0.75fr 0.75fr auto;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.admin-side-stack {
  display: grid;
  gap: 18px;
}

.account-controls {
  display: flex;
  gap: 22px;
  margin: 22px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
}

.permission-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.permission-list li {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.permission-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.permission-list code,
.permission-list span {
  display: block;
}

.permission-list code {
  color: var(--pea-purple);
  font-size: 0.64rem;
}

.permission-list span {
  color: var(--muted);
  font-size: 0.68rem;
}

.audit-filter {
  grid-template-columns: 1fr 1fr auto;
}

.audit-table code {
  color: var(--pea-purple);
  font-size: 0.65rem;
}

.metadata-code {
  display: block;
  max-width: 320px;
  overflow-wrap: anywhere;
  color: #625c63 !important;
  white-space: normal;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 21px;
  padding-bottom: 28px;
  border-top: 1px solid var(--line);
  color: #7c767d;
  font-size: 0.66rem;
}

@media (max-width: 1100px) {
  .persona-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero-compact {
    grid-template-columns: 1fr;
  }

  .workflow-card {
    max-width: 520px;
  }

  .review-layout {
    grid-template-columns: 1fr;
  }

  .sticky-card {
    position: static;
  }

  .ai-result-grid {
    grid-template-columns: 1fr;
  }

  .ai-result-grid > div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .ai-result-grid > div:first-child {
    border-top: 0;
  }

  .filter-bar {
    grid-template-columns: 1fr 1fr;
  }

  .filter-bar button {
    min-height: 44px;
  }

  .user-chip {
    display: none;
  }

  .admin-metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-metric-grid article:nth-child(2) {
    border-right: 0;
  }

  .admin-metric-grid article:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .report-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .report-unit-card {
    grid-column: auto;
  }
}

@media (max-width: 820px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 8px;
  }

  .nav-toggle {
    display: block;
  }

  .main-nav {
    display: none;
    order: 3;
    width: 100%;
    margin-left: 0;
    padding: 4px 0 10px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav a {
    min-height: 40px;
    padding: 0 10px;
  }

  .main-nav a::after {
    right: 10px;
    left: 10px;
  }

  .nav-logout {
    min-height: 40px;
  }

  .nav-logout button {
    padding: 0 10px;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 0.9rem;
  }

  .demo-ribbon {
    padding-inline: 12px;
    font-size: 0.65rem;
  }

  .brand-logo {
    width: 60px;
    height: 60px;
  }

  .brand strong {
    font-size: 0.88rem;
  }

  .brand small {
    font-size: 0.63rem;
  }

  .page-shell {
    padding-top: 24px;
    padding-bottom: 42px;
  }

  .hero {
    gap: 25px;
    padding: 24px;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .flow-mini {
    gap: 5px;
  }

  .metric-grid,
  .persona-grid,
  .two-column,
  .detail-grid,
  .report-grid,
  .summary-table,
  .auth-shell,
  .admin-grid,
  .admin-metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    border: 0;
    gap: 8px;
    background: transparent;
  }

  .metric-grid article {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .report-wide {
    grid-column: auto;
  }

  .report-actions,
  .report-actions .btn {
    width: 100%;
  }

  .report-filter {
    grid-template-columns: 1fr;
  }

  .report-filter-actions {
    grid-column: auto;
    justify-content: stretch;
  }

  .report-filter-actions .btn {
    flex: 1;
  }

  .report-kpi-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    border: 0;
    background: transparent;
  }

  .report-kpi-grid article {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .trend-chart {
    grid-template-columns: repeat(var(--trend-columns), 38px);
    justify-content: start;
    overflow-x: auto;
  }

  .status-chart-layout {
    grid-template-columns: 1fr;
  }

  .status-donut-wrap {
    margin: 0 auto;
  }

  .unit-chart {
    grid-template-columns: 1fr;
  }

  .admin-wide {
    grid-column: auto;
  }

  .admin-metric-grid {
    border: 0;
    gap: 8px;
    background: transparent;
  }

  .admin-metric-grid article,
  .admin-metric-grid article:nth-child(2),
  .admin-metric-grid article:nth-child(-n + 2) {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .auth-card,
  .auth-aside {
    padding: 24px;
  }

  .auth-aside {
    border-top: 1px solid #ead9a6;
    border-left: 0;
  }

  .admin-subnav {
    overflow-x: auto;
  }

  .admin-user-filter,
  .audit-filter {
    grid-template-columns: 1fr;
  }

  .account-controls {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .request-row {
    grid-template-columns: 1fr auto;
  }

  .request-row .category,
  .row-arrow {
    display: none;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .bar-list > div {
    grid-template-columns: 105px 1fr 24px;
  }

  .section-card,
  .teaching-panel {
    padding: 20px;
  }

  .section-heading {
    flex-direction: column;
    gap: 8px;
  }

  .site-footer {
    flex-direction: column;
    gap: 4px;
  }
}
