:root {
  --primary: #696cff; --primary-dark: #5f61e6; --body-bg: #f5f5f9; --heading: #566a7f; --text: #697a8d;
  --menu-w: 260px; --bs-primary: #696cff; --bs-primary-rgb: 105,108,255; --bs-body-font-family: 'Sarabun', sans-serif;
}
body { font-family: 'Sarabun', sans-serif; background: var(--body-bg); color: var(--text); font-size: 15px; }
.mitr, h1, h2, h3, h4, h5, h6 { font-family: 'Mitr', 'Sarabun', sans-serif; font-weight: 400; color: var(--heading); }
a { color: var(--primary); } a:hover { color: var(--primary-dark); }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-dark); --bs-btn-hover-border-color: var(--primary-dark); --bs-btn-active-bg: #5a5cd0; --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); box-shadow: 0 .125rem .25rem rgba(105,108,255,.4); }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); --bs-btn-active-bg: var(--primary); }
.text-primary { color: var(--primary) !important; } .bg-primary { background-color: var(--primary) !important; } .border-primary { border-color: var(--primary) !important; }
.nav-pills .nav-link.active { background: var(--primary); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(105,108,255,.15); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.cursor-pointer { cursor: pointer; }

/* ---------- layout ---------- */
.layout-wrapper { display: flex; min-height: 100vh; }
.layout-menu { width: var(--menu-w); background: #fff; box-shadow: 0 .125rem .375rem rgba(161,172,184,.12); position: fixed; top: 0; bottom: 0; left: 0; z-index: 1040; overflow-y: auto; transition: transform .25s; }
.layout-page { flex: 1; margin-left: var(--menu-w); display: flex; flex-direction: column; min-width: 0; }
.app-brand { padding: 22px 24px 14px; }
.app-brand-logo { width: 40px; height: 40px; border-radius: 10px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; }
.app-brand-logo.big { width: 72px; height: 72px; font-size: 42px; border-radius: 18px; background: rgba(255,255,255,.2); }
.app-brand-text { margin-left: 10px; color: var(--heading); font-size: 18px; line-height: 1.1; } .app-brand-text small { font-size: 12px; color: var(--text); }
.menu-center { margin: 0 16px 6px; padding: 0 12px; font-size: 13px; color: var(--heading); font-weight: 500; line-height: 1.3; }
.menu-role { margin: 4px 16px 10px; padding: 6px 12px; border-radius: 6px; background: rgba(105,108,255,.08); color: var(--primary); font-size: 13px; }
.menu-inner { list-style: none; padding: 0 12px; margin: 0; }
.menu-link { display: flex; align-items: center; padding: 9px 14px; margin: 2px 0; border-radius: 6px; color: var(--text); text-decoration: none; }
.menu-link:hover { background: rgba(67,89,113,.05); color: var(--heading); }
.menu-item.active .menu-link { background: rgba(105,108,255,.16); color: var(--primary); font-weight: 500; }
.menu-icon { font-size: 20px; margin-right: 10px; }
.layout-navbar { display: flex; align-items: center; margin: 14px 24px 0; padding: 10px 20px; background: rgba(255,255,255,.95); border-radius: 8px; box-shadow: 0 0 .375rem .25rem rgba(161,172,184,.15); position: sticky; top: 10px; z-index: 1020; backdrop-filter: blur(6px); }
.navbar-title { color: var(--heading); max-width: 60%; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: rgba(105,108,255,.16); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.badge-notify { position: absolute; top: -4px; right: -8px; font-size: 10px; }
.content-wrapper { padding: 24px; flex: 1; }
.content-footer { padding: 14px 24px; font-size: 13px; color: #a1acb8; }
.menu-backdrop { display: none; }
@media (max-width: 1199.98px) {
  .layout-menu { transform: translateX(-100%); } .layout-page { margin-left: 0; }
  body.menu-open .layout-menu { transform: none; }
  body.menu-open .menu-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1030; }
  .layout-navbar, .content-wrapper { margin-left: 12px; margin-right: 12px; } .content-wrapper { padding: 16px 0; }
}

/* ---------- cards & badges ---------- */
.card { border: 0; border-radius: 8px; box-shadow: 0 2px 6px 0 rgba(67,89,113,.12); }
.card-header { background: transparent; border-bottom: 1px solid #eceef1; padding: 1rem 1.25rem; }
.card-header-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--text); padding: .9rem 1rem; }
.card-header-tabs .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }
.table > :not(caption) > * > * { padding: .7rem .9rem; }
.table thead th { font-size: 13px; text-transform: none; color: var(--heading); font-weight: 600; white-space: nowrap; }
.title-cell { max-width: 520px; }
.bg-label-primary { background: #e7e7ff !important; color: #696cff !important; }
.bg-label-secondary { background: #ebeef0 !important; color: #8592a3 !important; }
.bg-label-success { background: #e8fadf !important; color: #56a827 !important; }
.bg-label-info { background: #d7f5fc !important; color: #03c3ec !important; }
.bg-label-warning { background: #fff2d6 !important; color: #e69500 !important; }
.bg-label-danger { background: #ffe0db !important; color: #ff3e1d !important; }
.bg-label-dark { background: #dcdfe1 !important; color: #233446 !important; }
.badge { font-weight: 500; } .status-badge { white-space: normal; text-align: left; line-height: 1.3; }
.stat-icon { width: 48px; height: 48px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 26px; flex-shrink: 0; }
.stat-card { transition: transform .15s; } a .stat-card:hover { transform: translateY(-2px); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.detail-list dt { font-weight: 500; color: var(--heading); } .detail-list dd { margin-bottom: .7rem; }
.list-group-item.unread { background: #f7f7ff; }

/* ---------- wizard ---------- */
.wizard-steps { display: flex; gap: 8px; flex-wrap: wrap; }
.wizard-step { flex: 1; min-width: 150px; display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 8px; padding: 12px 14px; text-decoration: none; color: var(--text); box-shadow: 0 2px 6px rgba(67,89,113,.1); }
.wizard-step .num { width: 34px; height: 34px; border-radius: 8px; background: #ebeef0; display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; }
.wizard-step .label { line-height: 1.2; font-size: 13px; } .wizard-step .label small { font-size: 12px; }
.wizard-step.active { outline: 2px solid var(--primary); } .wizard-step.active .num { background: var(--primary); color: #fff; }
.wizard-step.done .num { background: #e8fadf; color: #56a827; }

/* ---------- progress stages ---------- */
.progress-stages { display: flex; justify-content: space-between; position: relative; }
.progress-stages::before { content: ''; position: absolute; top: 15px; left: 6%; right: 6%; height: 2px; background: #e4e6e8; }
.ps-item { position: relative; text-align: center; flex: 1; z-index: 1; }
.ps-dot { width: 32px; height: 32px; border-radius: 50%; background: #ebeef0; color: #8592a3; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; border: 3px solid #fff; }
.ps-label { display: block; font-size: 12px; margin-top: 4px; }
.ps-item.done .ps-dot { background: #71dd37; color: #fff; } .ps-item.current .ps-dot { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px rgba(105,108,255,.2); }
.ps-item.current .ps-label { color: var(--primary); font-weight: 600; }
@media (max-width: 767px) { .ps-label { display: none; } }

/* ---------- timeline / letters ---------- */
.timeline { list-style: none; padding-left: 18px; border-left: 2px solid #eceef1; margin: 0; }
.timeline-item { position: relative; padding: 0 0 18px 16px; }
.timeline-point { position: absolute; left: -26px; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px #d9dee3; }
.letter { border: 1px solid #eceef1; border-radius: 8px; padding: 14px; background: #fff; }
.letter-answer { border-left: 3px solid var(--primary); padding: 8px 12px; background: #f7f7ff; border-radius: 4px; }

/* ---------- chart ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 200px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar-stack { width: 70%; max-width: 46px; background: var(--primary); border-radius: 4px 4px 0 0; display: flex; flex-direction: column-reverse; overflow: hidden; min-height: 2px; }
.bar-approved { background: #71dd37; width: 100%; }
.bar-label { margin-top: 4px; } .bar-val { color: var(--heading); }

/* ---------- auth ---------- */
.auth-body { background: #fff; }
.auth-wrapper { display: flex; min-height: 100vh; }
.auth-side { flex: 1.1; background: linear-gradient(135deg, #696cff 0%, #8e90ff 60%, #a5a7ff 100%); align-items: center; justify-content: center; padding: 60px; }
.auth-side h2 { font-size: 30px; } .auth-features li { margin-bottom: 10px; font-size: 16px; } .auth-features i { color: #fff; margin-right: 6px; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px; background: var(--body-bg); }
.auth-card { width: 100%; max-width: 440px; background: #fff; padding: 36px; border-radius: 10px; box-shadow: 0 2px 6px rgba(67,89,113,.12); }

@media print {
  .layout-menu, .layout-navbar, .content-footer, .no-print, .btn { display: none !important; }
  .layout-page { margin: 0; } .content-wrapper { padding: 0; } .card { box-shadow: none; border: 1px solid #ddd; }
}
