/* UP-IBC — a quiet workspace for project review */
:root {
  --purple: #563780;
  --purple-dark: #3e235f;
  --purple-soft: #eee8f5;
  --purple-faint: #f8f5fc;
  --ink: #242632;
  --text: #414653;
  --muted: #6d6b79;
  --border: #e8e9ef;
  --border-strong: #d9dbe5;
  --surface: #ffffff;
  --canvas: #f5f6fa;
  --green: #317f63;
  --green-soft: #eaf5ef;
  --amber: #9b701f;
  --amber-soft: #fbf3df;
  --blue: #3a6f9b;
  --blue-soft: #eaf2fb;
  --red: #ac4e56;
  --red-soft: #fbecee;
  --radius: 14px;
  --shadow: 0 3px 12px rgb(31 25 48 / 3%);
  --font: 'Leelawadee UI', 'Noto Sans Thai', Tahoma, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.65; color: var(--text); background: var(--canvas); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
button, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .48; }
button:not(:disabled), a, input, select, textarea { transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, color .16s ease; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid #ac8ad7; outline-offset: 3px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #aa8acb !important; box-shadow: 0 0 0 3px rgb(122 81 171 / 10%); }
a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.5; font-weight: 650; }
h1 { font-size: 30px; letter-spacing: -.6px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }
[hidden], .hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }
.text-purple { color: var(--purple); }
.text-success { color: var(--green); }
.text-danger { color: var(--red); }

/* Shell */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 240px; display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--border); padding: 29px 17px 18px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 11px 29px; }
.brand-mark { width: 43px; height: 47px; display: grid; place-items: center; flex-shrink: 0; border-radius: 12px; background: var(--purple); color: #fff; font-weight: 750; font-size: 17px; letter-spacing: -1px; box-shadow: inset 0 -3px 0 rgb(0 0 0 / 9%); }
.brand-mark svg { width: 28px; height: 28px; }
.brand-copy { min-width: 0; }
.brand-copy strong, .brand-copy b { display: block; font-size: 20px; color: var(--purple-dark); letter-spacing: .5px; line-height: 1.4; }
.brand-copy small, .brand-copy span { display: block; font-size: 9px; letter-spacing: .8px; color: #878190; line-height: 1.7; }
.workspace-label { margin: 0 13px 14px; color: #9b96a3; font-size: 11px; font-weight: 600; }
.nav-links { display: flex; flex-direction: column; gap: 5px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 47px; padding: 11px 14px; background: none; border: 1px solid transparent; border-radius: 10px; text-align: left; font-size: 13px; color: #777280; font-weight: 500; }
.nav-item:hover { background: #f7f5fa; color: var(--purple); }
.nav-item.active { color: var(--purple); background: var(--purple-soft); font-weight: 650; }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 19px; height: 19px; }
.nav-count { margin-left: auto; min-width: 21px; height: 21px; padding: 1px 6px; border-radius: 6px; background: #f0edf3; color: #80728d; font-size: 10px; line-height: 19px; text-align: center; }
.active .nav-count { background: #ded0ee; color: var(--purple); }
.sidebar-bottom { margin-top: auto; padding: 30px 9px 0; }
.demo-tag { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 6px; color: #92702e; background: #fbf4e6; font-size: 10px; font-weight: 600; }
.demo-tag::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #c7a55a; }
.role-switcher { margin-top: 16px; }
.role-switcher label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 7px; }
.role-switcher select { width: 100%; height: 39px; padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; font-size: 11px; color: var(--text); }
.profile-row { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.profile-row strong { display: block; font-size: 12px; font-weight: 600; }
.profile-row small { display: block; font-size: 10px; color: var(--muted); }
.avatar { display: inline-flex; justify-content: center; align-items: center; width: 33px; height: 33px; border-radius: 50%; background: #eee8f5; color: var(--purple); font-size: 11px; font-weight: 650; flex-shrink: 0; }
.workspace { margin-left: 240px; min-height: 100vh; }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 76px; gap: 22px; padding: 16px 34px; background: #fff; border-bottom: 1px solid var(--border); }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 12px; color: #94919b; }
.breadcrumbs strong, .breadcrumbs b { color: #57505f; font-weight: 550; }
.breadcrumbs svg { width: 13px; height: 13px; color: #b9b5bf; }
.topbar-tools { display: flex; align-items: center; gap: 13px; }
.search-box { position: relative; display: flex; align-items: center; color: #9d98a6; }
.search-box > svg { position: absolute; left: 12px; width: 16px; pointer-events: none; }
.search-box input { width: 228px; height: 38px; padding: 8px 12px 8px 36px; font-size: 11px; border: 1px solid #eeeef3; border-radius: 8px; background: #fafafd; }
.search-box input::placeholder { color: #aaa5b0; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; position: relative; width: 36px; height: 36px; background: transparent; border: 1px solid transparent; border-radius: 9px; color: #81788d; }
.icon-button:hover { background: var(--purple-faint); color: var(--purple); }
.icon-button .notification-dot { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: #b58c42; border: 1px solid #fff; }
.main-content { width: 100%; max-width: 1640px; margin: 0 auto; padding: 31px 34px 45px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { font-size: 10px; font-weight: 650; color: #967eb0; letter-spacing: 1.2px; margin-bottom: 6px; text-transform: uppercase; }
.page-subtitle { margin-top: 7px; font-size: 12px; color: #94909c; line-height: 1.9; }
.heading-actions { display: flex; gap: 9px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.prototype-note { font-size: 10px; color: #a09aa7; margin-top: 20px; line-height: 1.8; }
.mobile-menu { display: none; }

/* Buttons and labels */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 16px; border: 1px solid var(--border-strong); border-radius: 9px; font-weight: 550; font-size: 12px; text-align: center; background: #fff; color: #615b6b; line-height: 1.55; text-decoration: none; }
.button svg { width: 16px; height: 16px; }
.button:hover:not(:disabled) { border-color: #b7a5ca; color: var(--purple); background: #fcfaff; text-decoration: none; }
.button.primary { background: var(--purple); border-color: var(--purple); color: #fff; box-shadow: 0 3px 7px rgb(86 55 128 / 12%); }
.button.primary:hover:not(:disabled) { background: var(--purple-dark); border-color: var(--purple-dark); color: #fff; }
.button.secondary { background: #fff; border-color: #e0d8eb; color: var(--purple); }
.button.ghost { background: transparent; border-color: transparent; color: #81708f; box-shadow: none; }
.button.ghost:hover:not(:disabled) { background: var(--purple-soft); }
.button.danger { background: var(--red-soft); border-color: #f0d8dd; color: var(--red); }
.button.small { min-height: 32px; padding: 6px 11px; font-size: 11px; border-radius: 7px; }
.button.full-width { width: 100%; }
.link-button { background: none; border: none; padding: 0; color: var(--purple); font-size: 12px; font-weight: 550; text-align: left; text-underline-offset: 4px; }
.link-button:hover { text-decoration: underline; }
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 4px 8px; background: #f0f0f4; color: #777482; font-size: 10px; font-weight: 550; line-height: 1.5; border-radius: 6px; white-space: nowrap; }
.badge[data-tone='purple'] { background: var(--purple-soft); color: #765299; }
.badge[data-tone='amber'] { background: var(--amber-soft); color: var(--amber); }
.badge[data-tone='green'] { background: var(--green-soft); color: var(--green); }
.badge[data-tone='blue'] { background: var(--blue-soft); color: var(--blue); }
.badge[data-tone='red'] { background: var(--red-soft); color: var(--red); }
.badge[data-tone='gray'] { background: #eff0f4; color: #86838e; }
.route-badge { display: inline-flex; align-items: center; justify-content: center; width: 25px; height: 25px; flex-shrink: 0; border-radius: 7px; background: #f1eef7; border: 1px solid #e8e1f1; color: #8c73a5; font-size: 11px; font-weight: 650; }
.reference-pill { display: inline-block; padding: 3px 7px; color: #8a769f; background: #f4f0f9; border-radius: 5px; font-size: 10px; font-weight: 550; margin: 3px 4px 0 0; }

/* Dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; margin-bottom: 24px; }
.stat-card { position: relative; min-width: 0; min-height: 130px; padding: 20px 21px 17px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); text-align: left; }
button.stat-card:hover { border-color: #cbbbdc; background: #fefcff; }
.stat-label { display: block; font-size: 11px; color: #96909e; padding-right: 29px; }
.stat-value { display: block; font-size: 30px; line-height: 1.4; letter-spacing: -.5px; font-weight: 650; color: #343140; margin: 7px 0 4px; font-variant-numeric: tabular-nums; }
.stat-caption { display: block; font-size: 10px; color: #a6a0ad; }
.stat-icon { position: absolute; right: 20px; top: 19px; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; background: #f4f0f9; color: #9d86b5; border-radius: 9px; }
.stat-card:nth-child(2) .stat-icon { background: #fcf4e4; color: #bc9752; }
.stat-card:nth-child(3) .stat-icon { background: #edf3fb; color: #8aa5c0; }
.stat-card:nth-child(4) .stat-icon { background: #eaf5ef; color: #73a58c; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 286px; align-items: start; gap: 22px; }
.dashboard-grid > * { min-width: 0; }
.dashboard-grid > aside, .side-stack, .detail-main { display: flex; flex-direction: column; gap: 20px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; overflow: hidden; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 22px 16px; }
.card-title { color: #45404e; font-size: 14px; font-weight: 650; }
.card-header .muted { font-size: 11px; }
.card-body { padding: 3px 22px 22px; }
.card-footer { padding: 13px 22px; border-top: 1px solid #f1eff5; background: #fdfcfe; font-size: 11px; color: #a19aa9; }
.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 12px; margin-bottom: 24px; box-shadow: var(--shadow); }
.card .pipeline { border: 0; margin: 0; box-shadow: none; padding: 7px 0 18px; }
.pipeline-stage { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: center; padding: 2px 6px; text-align: center; background: transparent; border: 0; }
.pipeline-stage + .pipeline-stage { border-left: 1px solid #eeebf2; }
.pipeline-count { display: block; color: #5f4d76; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pipeline-label { font-size: 11px; color: #99909f; }
.pipeline-dot { width: 6px; height: 6px; border-radius: 50%; background: #d3c5e0; display: inline-block; margin-right: 5px; }
.pipeline-stage:last-child .pipeline-dot { background: #9bbdaa; }
.pipeline-stage:hover:not(:disabled) .pipeline-label { color: var(--purple); }
.tabs, .detail-tabs { display: flex; gap: 22px; padding: 0 22px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.tab { position: relative; flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px; padding: 13px 0 15px; background: transparent; border: 0; color: #99929f; font-size: 11px; font-weight: 500; white-space: nowrap; }
.tab.active { color: var(--purple); font-weight: 650; }
.tab.active::after { content: ''; position: absolute; height: 2px; inset: auto 0 -1px; background: var(--purple); border-radius: 3px; }
.tab span { font-size: 10px; color: inherit; }
.tab:hover { color: var(--purple); }
.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 22px; }
.filter-row > .search-box { flex: 1; max-width: 300px; }
.filter-row .search-box input { width: 100%; background: #fff; font-size: 11px; }
.filter-row select { max-width: 170px; height: 36px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 7px; color: #8c8295; background: #fff; font-size: 11px; }
.table-wrap { width: 100%; overflow: auto; }
.projects-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 11px; }
.projects-table th { background: #fafafd; font-weight: 500; color: #aaa4b0; font-size: 10px; padding: 11px 13px; border-top: 1px solid #f0eef5; border-bottom: 1px solid #f0eef5; white-space: nowrap; }
.projects-table td { padding: 17px 13px; border-bottom: 1px solid #f2f0f6; vertical-align: middle; }
.projects-table th:first-child, .projects-table td:first-child { padding-left: 22px; }
.projects-table th:last-child, .projects-table td:last-child { padding-right: 19px; }
.projects-table tr:last-child td { border-bottom: 0; }
.projects-table tbody tr { transition: background .15s; }
.projects-table tbody tr:hover { background: #fcfaff; }
.project-title { display: block; max-width: 335px; color: #605568; font-size: 12px; font-weight: 550; line-height: 1.7; text-align: left; background: transparent; border: 0; padding: 0; }
button.project-title:hover { color: var(--purple); text-decoration: underline; text-underline-offset: 3px; }
.project-id { display: block; font-size: 10px; color: #b0a7b7; margin-top: 5px; letter-spacing: .1px; }
.owner-cell { color: #948a9e; font-size: 10px; }
.owner-cell strong { display: block; font-size: 11px; color: #807489; font-weight: 500; }
.due-date { font-size: 10px; white-space: nowrap; color: #a399ac; }
.row-action { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; color: #aa9bb7; border: 0; border-radius: 7px; background: transparent; }
.row-action:hover { color: var(--purple); background: var(--purple-soft); }
.task-list { padding: 0 20px; }
.task-item { width: 100%; display: flex; align-items: flex-start; gap: 11px; padding: 15px 0; background: transparent; border: 0; border-bottom: 1px solid #efedf4; text-align: left; }
.task-item:last-child { border-bottom: 0; }
.task-icon { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 31px; height: 33px; background: #f5f0fa; color: #9b7bb6; border-radius: 8px; }
.task-icon svg { width: 16px; height: 16px; }
.task-text { min-width: 0; flex: 1; font-size: 11px; color: #71667d; line-height: 1.8; }
.task-text strong { display: block; font-size: 12px; font-weight: 550; color: #6b5f77; }
.task-text p { margin: 3px 0; }
.task-meta { color: #b1a5bd; font-size: 10px; margin-top: 4px; }
.task-item:hover .task-text strong { color: var(--purple); }
.guide-card { position: relative; border: 1px solid #e5dced; border-radius: var(--radius); background: linear-gradient(135deg, #f0e9f7, #faf7fd); padding: 22px; color: #8a729c; }
.guide-card h3 { font-size: 15px; color: #694984; margin-bottom: 8px; }
.guide-card p { font-size: 11px; line-height: 1.9; color: #9b86ad; }
.guide-card .button, .guide-card .link-button { margin-top: 16px; }
.guide-card > svg { width: 25px; height: 25px; margin-bottom: 13px; color: #9e83b8; }
.mini-progress { height: 5px; border-radius: 99px; overflow: hidden; background: #eee8f5; margin: 11px 0; }
.mini-progress > span { display: block; height: 100%; border-radius: inherit; background: #bca3d6; }
.section-label { display: block; font-size: 11px; font-weight: 550; color: #9e93a9; margin: 21px 0 12px; }
.empty-state { padding: 39px 24px; text-align: center; color: #a49aad; font-size: 12px; }
.empty-state > svg { width: 34px; height: 34px; margin-bottom: 13px; color: #c2b4d0; }
.empty-state h3 { font-size: 15px; color: #84758f; margin-bottom: 6px; }
.empty-state .button { margin-top: 16px; }

/* Project detail */
.back-link { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: #92839f; padding: 0; font-size: 11px; margin-bottom: 15px; }
.back-link:hover { color: var(--purple); }
.back-link svg { width: 14px; height: 14px; }
.project-heading { margin-bottom: 23px; }
.project-heading h1 { font-size: 25px; margin: 6px 0 9px; max-width: 920px; }
.project-heading .project-id { margin: 0; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.detail-grid > * { min-width: 0; }
.detail-sidebar { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 22px; }
.stepper { display: flex; gap: 0; padding: 24px 20px; margin-bottom: 22px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.step { position: relative; flex: 1; min-width: 89px; display: flex; align-items: center; flex-direction: column; gap: 8px; color: #aaa2b2; font-size: 10px; text-align: center; padding: 0 5px; }
.step::before { position: absolute; content: ''; top: 13px; left: 0; right: 0; height: 1px; background: #e9e3f0; }
.step:first-child::before { left: 50%; }
.step:last-child::before { right: 50%; }
.step > span:first-child, .step-number, .step-circle { display: grid; place-items: center; position: relative; z-index: 1; width: 27px; height: 27px; border-radius: 50%; background: #f8f6fa; border: 1px solid #e6dfee; color: #b5a7c1; font-size: 10px; line-height: 1; }
.step.done { color: #9b86ae; }
.step.done > span:first-child, .step.done .step-number, .step.done .step-circle { background: #eee6f6; color: #9372b0; border-color: #e6d9f1; }
.step.current { color: var(--purple); font-weight: 600; }
.step.current > span:first-child, .step.current .step-number, .step.current .step-circle { background: var(--purple); border-color: var(--purple); color: #fff; box-shadow: 0 0 0 4px #f3edf9; }
.step svg { width: 13px; height: 13px; }
.detail-tabs { margin-bottom: 0; }
.detail-main .card-body { padding-top: 21px; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 21px 28px; }
.info-item { font-size: 12px; color: #665b72; min-width: 0; overflow-wrap: anywhere; }
.info-item label { display: block; font-size: 10px; color: #a49aaf; margin-bottom: 6px; }
.info-item p { line-height: 1.9; }
.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-option { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 12px 13px; background: #fff; border: 1px solid #e9e2ef; border-radius: 9px; color: #887299; text-align: left; font-size: 12px; }
.action-option strong { font-size: 12px; font-weight: 550; }
.action-option small, .action-option p { font-size: 10px; color: #a396af; }
.action-option.active { background: #f7f1fd; border-color: #bba3d2; color: var(--purple); box-shadow: 0 0 0 2px #f8f4fc; }
.action-option:hover:not(:disabled) { background: #faf7fd; border-color: #c4afd7; }
.action-option.blocked { background: #fcfbfd; color: #9d92a6; border-style: dashed; }
.action-reason { font-size: 10px; line-height: 1.85; color: #ae8c60; margin-top: 5px; }
.action-form { margin-top: 17px; padding-top: 16px; border-top: 1px solid var(--border); }
.action-form h4 { font-size: 13px; margin-bottom: 13px; color: #725a89; }
.action-form .field { margin-bottom: 13px; }
.action-form .button.primary { width: 100%; }
.notice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid #e6ddee; background: #f7f3fb; color: #8e749f; border-radius: 9px; padding: 13px 15px; font-size: 11px; line-height: 1.9; margin: 0 0 16px; }
.notice svg { margin-top: 2px; width: 16px; height: 16px; }
.notice.info { background: #f1f6fb; border-color: #e0eaf5; color: #6583a3; }
.notice.warning { background: #fdf7eb; border-color: #f0e5cc; color: #a58b56; }
.notice.success { background: #eef7f2; border-color: #dcece2; color: #6b9a83; }
.notice strong { display: block; font-weight: 600; }
.notice p + p { margin-top: 5px; }
.check-list { display: flex; flex-direction: column; }
.check-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid #f1edf5; color: #8e7c9d; font-size: 11px; }
.check-item:last-child { border: 0; }
.check-item strong { display: block; color: #80718e; font-size: 11px; font-weight: 550; }
.check-item small { display: block; color: #afa0ba; font-size: 10px; margin-top: 4px; }
.check-symbol { flex-shrink: 0; display: grid; place-items: center; width: 19px; height: 19px; border: 1px solid #e6d8b9; border-radius: 50%; background: #fcf6e8; color: #c0a76f; font-size: 10px; }
.check-item.ok .check-symbol, .check-symbol.ok { background: #e8f3ed; border-color: #d7eade; color: #72a58b; }
.document-list { display: flex; flex-direction: column; gap: 9px; }
.document-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid #ede6f3; border-radius: 9px; min-width: 0; }
.document-row > svg { color: #a58ab9; width: 22px; height: 22px; }
.document-row > div { min-width: 0; flex: 1; }
.document-row strong { display: block; font-size: 11px; font-weight: 550; color: #7f6d8d; overflow-wrap: anywhere; }
.document-row small { font-size: 10px; color: #b1a2bd; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline-item { position: relative; padding: 0 0 24px 25px; margin-left: 7px; border-left: 1px solid #e8dfee; }
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline-dot { position: absolute; left: -5px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: #d4c0e4; border: 2px solid #fff; box-shadow: 0 0 0 1px #e3d5ef; }
.timeline-content strong { font-size: 12px; font-weight: 550; color: #7d688e; }
.timeline-content p { font-size: 11px; color: #9a87a9; margin-top: 6px; line-height: 1.85; overflow-wrap: anywhere; }
.timeline-content small, .timeline-content time { display: block; color: #b3a4bf; font-size: 10px; margin-top: 5px; }
.event-list { display: flex; flex-direction: column; gap: 12px; }
.event-item { padding: 15px; border: 1px solid #e9e0f1; border-radius: 10px; background: #fdfbff; }
.event-item h4 { font-size: 12px; color: #7c5e92; }
.event-item p { font-size: 11px; color: #9e86ae; margin-top: 6px; }

/* Forms */
.form-shell { max-width: 930px; margin: 0 auto; }
.form-section { background: #fff; padding: 25px 28px 28px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 18px; box-shadow: var(--shadow); }
.form-section > h2, .form-section > h3 { display: flex; gap: 11px; align-items: center; font-size: 16px; margin-bottom: 21px; }
.section-number { display: inline-grid; place-items: center; flex-shrink: 0; width: 27px; height: 27px; border-radius: 8px; background: #f0e8f8; color: #9269b3; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field { min-width: 0; }
.field > label { display: block; font-size: 11px; color: #8a789a; font-weight: 550; margin-bottom: 7px; }
.field input:not([type='checkbox']):not([type='radio']):not([type='file']), .field select, .field textarea { width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid #e4dcec; border-radius: 8px; background: #fff; color: #72647f; font-size: 12px; line-height: 1.7; }
.field input::placeholder, .field textarea::placeholder { color: #bfb2c9; }
.field textarea { min-height: 106px; resize: vertical; }
.field select { padding-right: 24px; }
.field input[type='date'] { color-scheme: light; }
.field input[type='checkbox'], .field input[type='radio'] { width: 16px; height: 16px; accent-color: var(--purple); vertical-align: middle; margin: 0 7px 2px 0; cursor: pointer; }
.field input[type='file'] { max-width: 100%; font-size: 11px; color: #9f8cae; }
.field input[type='file']::file-selector-button { font-family: inherit; border: 1px solid #dfd2e9; border-radius: 6px; padding: 7px 10px; background: #f5effa; color: #8b6aa6; margin-right: 10px; cursor: pointer; }
.field-help { display: block; font-size: 10px; line-height: 1.8; color: #b1a2be; margin-top: 6px; }
.field-error { display: block; font-size: 11px; color: var(--red); margin-top: 6px; line-height: 1.7; }
.field [aria-invalid='true'] { border-color: #d9a1ac !important; background: #fffbfc !important; }
.field.required label::after { content: ' *'; color: #b78fba; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 0 4px; }
.form-actions .muted { margin-right: auto; font-size: 11px; }
.wizard-steps { display: flex; gap: 12px; margin-bottom: 23px; padding: 0; }
.wizard-step { display: flex; gap: 8px; align-items: center; color: #b1a2be; font-size: 11px; }
.wizard-step.active { color: var(--purple); font-weight: 600; }
.wizard-step + .wizard-step::before { content: '›'; margin-right: 7px; color: #cebed9; font-size: 17px; }
.upload-area { display: block; padding: 25px 20px; border: 1px dashed #d5c5e2; background: #fcfaff; border-radius: 10px; text-align: center; color: #a38ab6; font-size: 12px; line-height: 1.9; }
.upload-area > svg { width: 26px; height: 26px; margin-bottom: 9px; }
.upload-area:hover { background: #f7f1fd; border-color: #ae91c5; }
.upload-area input { margin-top: 10px; max-width: 100%; }
.summary-box { padding: 17px 19px; background: #f8f4fc; border: 1px solid #e9dff2; border-radius: 10px; font-size: 12px; color: #9276a7; line-height: 1.9; }
.summary-box h3 { font-size: 14px; margin-bottom: 9px; color: #77598f; }
.split { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* Reference catalog */
.view-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.toggle-group { display: inline-flex; align-items: center; padding: 4px; border: 1px solid var(--border); border-radius: 9px; background: #fff; gap: 2px; }
.toggle-group button { padding: 7px 12px; background: none; border: 0; border-radius: 6px; color: #a190ae; font-size: 11px; }
.toggle-group button.active { background: #eee5f6; color: #835ba3; font-weight: 600; }
.workflow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.workflow-card { min-width: 0; padding: 23px 23px 21px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.workflow-card:hover { border-color: #d2c0e0; }
.workflow-code { display: inline-block; font-size: 10px; color: #a585bc; background: #f2eaf9; padding: 4px 8px; border-radius: 6px; font-weight: 650; letter-spacing: .5px; margin-bottom: 12px; }
.workflow-card h3 { font-size: 14px; color: #765f88; line-height: 1.8; margin-bottom: 9px; }
.workflow-card > p { font-size: 11px; color: #ac9ab9; line-height: 1.9; }
.workflow-meta { display: flex; flex-wrap: wrap; gap: 5px; font-size: 10px; color: #ac95bd; margin-top: 12px; }
.workflow-steps { padding: 12px 0 0 19px; margin: 13px 0 0; border-top: 1px solid #f1eaf6; color: #a58eb7; font-size: 10px; }
.workflow-steps li { padding: 0 0 9px 4px; line-height: 1.8; }
.workflow-steps li::marker { color: #bba5cc; font-size: 9px; }
.workflow-steps li strong { color: #8b6e9f; font-size: 11px; font-weight: 550; }
.workflow-steps li small { display: block; margin-top: 3px; color: #b5a3c1; }
.workflow-card .button, .workflow-card .link-button { margin-top: 15px; }
.form-catalog { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.form-card { display: flex; flex-direction: column; gap: 9px; min-width: 0; padding: 22px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.form-card > svg { width: 26px; height: 26px; color: #ac8cc5; margin-bottom: 5px; }
.form-card h3 { color: #85649d; font-size: 13px; line-height: 1.9; }
.form-card p { color: #b3a0c1; font-size: 11px; line-height: 1.8; }
.form-card .reference-pill { align-self: flex-start; }
.form-card .button, .form-card .link-button { margin-top: auto; align-self: flex-start; }

/* Overlays and feedback */
dialog.modal { width: min(590px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); margin: auto; padding: 0; border: 1px solid #e8dff0; border-radius: 17px; background: #fff; color: var(--text); box-shadow: 0 24px 100px rgb(41 20 60 / 18%); overflow-y: auto; }
dialog.modal::backdrop { background: rgb(39 28 51 / 31%); backdrop-filter: blur(3px); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 25px 17px; border-bottom: 1px solid #eee6f4; }
.modal-header h2 { font-size: 18px; color: #6b4a85; }
.modal-body { padding: 23px 25px; font-size: 12px; color: #987eaa; line-height: 1.9; }
.modal-body p + p { margin-top: 12px; }
.modal-body ul, .modal-body ol { padding-left: 22px; }
.modal-body li { margin: 8px 0; }
.modal-body .field { margin-bottom: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 25px; border-top: 1px solid #eee6f4; background: #fdfbff; }
.modal-close { display: inline-grid; place-items: center; width: 29px; height: 29px; border: 0; background: transparent; border-radius: 7px; color: #b09bc0; font-size: 21px; }
.modal-close:hover { color: var(--purple); background: #f3ecf9; }
.toast { position: fixed; z-index: 100; left: calc(50% + 120px); bottom: 26px; transform: translateX(-50%); max-width: calc(100vw - 40px); padding: 12px 20px; border-radius: 10px; background: #4c365f; color: #fff; font-size: 12px; box-shadow: 0 8px 25px rgb(49 28 67 / 20%); animation: toast-in .18s ease-out; }
@keyframes toast-in { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }

/* Keep supporting Thai text readable while retaining a quiet hierarchy. */
.workspace-label, .breadcrumbs, .page-subtitle, .prototype-note,
.stat-label, .stat-caption, .card-footer, .pipeline-label,
.project-id, .owner-cell, .due-date, .task-meta,
.section-label, .info-item label, .action-option small, .action-option p,
.check-item small, .document-row small, .timeline-content small,
.timeline-content time, .field-help, .workflow-meta, .workflow-steps li small,
.form-card p, .workflow-card > p { color: #736b7e; }
.page-subtitle, .guide-card p, .task-text, .timeline-content p,
.event-item p, .summary-box, .modal-body, .workflow-steps { color: #675b73; }
.projects-table th, .tab, .field > label, .filter-row select { color: #675d73; }
.badge[data-tone='gray'] { color: #615d6c; }
.badge[data-tone='purple'], .reference-pill, .route-badge, .workflow-code { color: #6e478e; }
.notice { color: #6d4d82; }
.notice.info { color: #426789; }
.notice.warning, .action-reason { color: #89651f; }
.notice.success { color: #397458; }
.empty-state, .step, .wizard-step { color: #7c7087; }
.field input::placeholder, .field textarea::placeholder, .search-box input::placeholder { color: #857a8f; opacity: 1; }
.field > label, .project-title, .task-text strong, .info-item { font-size: 13px; }
.field-help, .task-meta, .project-id, .owner-cell, .due-date,
.stat-caption, .check-item small, .document-row small,
.timeline-content small, .timeline-content time { font-size: 11px; }
.notice, .workflow-card > p, .form-card p, .workflow-steps,
.field input:not([type='checkbox']):not([type='radio']):not([type='file']),
.field select, .field textarea, .action-option { font-size: 13px; }
.form-section, .detail-main, .detail-sidebar, .card, .workflow-card, .form-card { overflow-wrap: anywhere; }

/* Narrow screens retain the working details, not a shrunken desktop. */
@media (min-width: 1600px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) 325px; gap: 25px; }
  .main-content { padding-left: 44px; padding-right: 44px; }
  .projects-table td { padding-top: 19px; padding-bottom: 19px; }
}
@media (max-width: 1230px) {
  .sidebar { width: 216px; padding-left: 13px; padding-right: 13px; }
  .workspace { margin-left: 216px; }
  .topbar { padding-left: 25px; padding-right: 25px; }
  .main-content { padding: 27px 25px 36px; }
  .stat-grid { gap: 12px; }
  .stat-card { padding: 17px; }
  .stat-icon { right: 15px; top: 16px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) 254px; gap: 17px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr) 290px; gap: 17px; }
  .workflow-grid, .form-catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .projects-table th, .projects-table td { padding-left: 10px; padding-right: 10px; }
  .projects-table th:first-child, .projects-table td:first-child { padding-left: 18px; }
  .project-title { min-width: 170px; }
  .search-box input { width: 185px; }
  .toast { left: calc(50% + 108px); }
}
@media (max-width: 1080px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-grid > aside, .dashboard-grid > .side-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 17px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-sidebar { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  h1 { font-size: 26px; }
  .page-heading { align-items: flex-start; }
  .heading-actions { padding-top: 5px; }
  .heading-actions .button { padding: 8px 11px; font-size: 11px; }
  .topbar .search-box { display: none; }
  .stat-grid { gap: 10px; }
  .stat-card { padding: 15px; }
  .stat-label { font-size: 10px; padding-right: 20px; }
  .stat-icon { width: 25px; height: 25px; right: 12px; top: 13px; }
  .stat-icon svg { width: 14px; height: 14px; }
  .stat-caption { font-size: 9px; }
}
@media (max-width: 760px) {
  .sidebar { width: 240px; transform: translateX(-100%); box-shadow: 12px 0 40px rgb(29 17 40 / 8%); transition: transform .2s ease; padding-top: 24px; }
  .sidebar.open, .app-shell.menu-open .sidebar, body.menu-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgb(32 20 45 / 22%); }
  .workspace { margin-left: 0; }
  .topbar { min-height: 64px; padding: 12px 19px; gap: 11px; }
  .mobile-menu { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: transparent; border: 0; border-radius: 7px; color: var(--purple); }
  .breadcrumbs { margin-right: auto; gap: 5px; font-size: 10px; }
  .topbar-tools { gap: 5px; }
  .topbar-tools .icon-button { width: 30px; height: 30px; }
  .main-content { padding: 23px 18px 32px; }
  .page-heading { align-items: flex-start; flex-wrap: wrap; gap: 14px; margin-bottom: 21px; }
  .page-heading h1 { font-size: 25px; }
  .eyebrow { font-size: 9px; }
  .page-subtitle { font-size: 11px; max-width: 500px; }
  .heading-actions { padding: 0; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-bottom: 18px; }
  .stat-card { min-height: 118px; padding: 17px; }
  .stat-icon { right: 16px; top: 15px; width: 28px; height: 28px; }
  .stat-label { font-size: 11px; }
  .stat-value { font-size: 27px; }
  .stat-caption { font-size: 10px; }
  .pipeline { margin-bottom: 19px; padding: 16px 7px; }
  .pipeline-label { font-size: 10px; }
  .pipeline-count { font-size: 21px; }
  .pipeline-dot { display: none; }
  .dashboard-grid { gap: 18px; }
  .dashboard-grid > aside, .dashboard-grid > .side-stack { gap: 14px; }
  .card-header { padding: 18px 18px 13px; }
  .card-title { font-size: 13px; }
  .card-body { padding: 4px 18px 19px; }
  .card-footer { padding: 12px 18px; }
  .tabs, .detail-tabs { padding-left: 18px; padding-right: 18px; gap: 22px; }
  .tab { font-size: 11px; padding-top: 11px; padding-bottom: 12px; }
  .filter-row { padding: 13px 18px; gap: 8px; }
  .filter-row select { max-width: 140px; }
  .projects-table { min-width: 650px; }
  .projects-table td { padding-top: 15px; padding-bottom: 15px; }
  .toast { left: 50%; bottom: 20px; width: max-content; font-size: 11px; }
  .project-heading h1 { font-size: 23px; }
  .stepper { margin-bottom: 18px; padding: 20px 13px; }
  .step { min-width: 74px; font-size: 9px; }
  .detail-sidebar { gap: 14px; }
  .workflow-grid, .form-catalog { gap: 14px; }
  .workflow-card, .form-card { padding: 19px; }
  .workflow-card h3 { font-size: 13px; }
  .form-section { padding: 21px; }
  .form-grid { gap: 17px; }
  .modal-header, .modal-body, .modal-footer { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 500px) {
  .main-content { padding: 21px 15px 30px; }
  .topbar { padding-left: 15px; padding-right: 15px; }
  .breadcrumbs { font-size: 10px; }
  .breadcrumbs > span:first-child { display: none; }
  .page-heading h1 { font-size: 24px; }
  .page-heading .heading-actions { width: 100%; }
  .page-heading .heading-actions .primary { flex: 1; }
  .stat-grid { gap: 10px; }
  .stat-card { padding: 15px; min-height: 115px; }
  .stat-icon { right: 12px; top: 12px; width: 25px; height: 25px; }
  .stat-label { font-size: 10px; }
  .stat-value { margin: 9px 0 4px; }
  .stat-caption { font-size: 9px; }
  .pipeline { padding: 16px 2px; }
  .pipeline-stage { padding-left: 3px; padding-right: 3px; }
  .pipeline-label { font-size: 9px; line-height: 1.65; }
  .pipeline-count { font-size: 19px; }
  .dashboard-grid > aside, .dashboard-grid > .side-stack, .detail-sidebar, .workflow-grid, .form-catalog { grid-template-columns: minmax(0, 1fr); }
  .task-list { padding-left: 18px; padding-right: 18px; }
  .info-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .form-section { padding: 20px 18px; }
  .form-section > h2, .form-section > h3 { font-size: 14px; gap: 9px; }
  .field input:not([type='checkbox']):not([type='radio']):not([type='file']), .field select, .field textarea { font-size: 14px; }
  .form-actions .button { flex: 1; }
  .form-actions .muted { width: 100%; }
  .filter-row { flex-wrap: wrap; }
  .filter-row > .search-box { min-width: 150px; }
  .filter-row select { max-width: 118px; font-size: 10px; }
  .filter-row .search-box input { font-size: 10px; }
  .view-toolbar { align-items: stretch; }
  .view-toolbar .search-box { width: 100%; }
  .view-toolbar .search-box input { width: 100%; }
  .view-toolbar .toggle-group { width: 100%; justify-content: space-between; }
  .toggle-group button { padding-left: 10px; padding-right: 10px; }
  .wizard-steps { gap: 4px; }
  .wizard-step { font-size: 10px; gap: 3px; }
  .wizard-step + .wizard-step::before { margin-right: 2px; }
  .modal-footer .button { flex: 1; }
  .document-row { gap: 9px; padding: 11px; }
  .notice { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .sidebar, .topbar, .heading-actions, .form-actions, .detail-sidebar, .toast, .back-link, .prototype-note { display: none !important; }
  .workspace { margin-left: 0; }
  .main-content { max-width: none; padding: 0; }
  body { background: #fff; }
  .card, .stat-card, .form-section, .workflow-card { box-shadow: none; break-inside: avoid; }
  .detail-grid, .dashboard-grid { display: block; }
  .table-wrap { overflow: visible; }
  .projects-table { min-width: 0; }
}

.brand-mark { line-height: 1; grid-template-rows: 1fr 1fr; padding: 7px 0; gap: 3px; }
.brand-mark span { font-size: 11px; letter-spacing: 1px; }
