:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e2e6ed;
  --text: #1c2431;
  --muted: #6b7686;
  --primary: #1f4e79;
  --primary-light: #e8f0f8;
  --low: #2f9e5f;
  --medium: #e0a53b;
  --high: #d0473f;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(20, 30, 50, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Sarabun", "Leelawadee UI", "Tahoma", system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px;
  flex: 0 0 264px;
  background: #16334f;
  color: #cfdcea;
  padding: 0 0 32px;
  overflow-y: auto;
}

.brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 8px; background: #2c6fa8;
  display: grid; place-items: center; color: #fff; font-weight: 700; letter-spacing: .5px;
}
.brand-title { color: #fff; font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 11px; color: #90a9c4; }

.nav-group {
  padding: 18px 18px 6px; font-size: 11px; letter-spacing: .4px;
  text-transform: uppercase; color: #7f9ab8;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; color: #cfdcea; font-size: 13.5px;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-link.active { background: #2c6fa8; color: #fff; font-weight: 500; }
.nav-icon { width: 18px; text-align: center; opacity: .85; }
.nav-badge {
  background: #d0473f; color: #fff; border-radius: 10px;
  padding: 1px 7px; font-size: 11px; font-weight: 600;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 24px; position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-weight: 600; font-size: 15px; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 14px; }
.user-meta { text-align: right; line-height: 1.3; }
.user-meta strong { display: block; font-size: 13px; }
.user-meta span { font-size: 11px; color: var(--muted); }
.menu-toggle { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; }

.content { padding: 24px; flex: 1; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 4px; font-size: 20px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.page-head .spacer { flex: 1; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px;
}
.card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 10px;
}
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.p0 { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-sub { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.stat.accent-low .stat-value { color: var(--low); }
.stat.accent-medium .stat-value { color: var(--medium); }
.stat.accent-high .stat-value { color: var(--high); }
.stat.accent-primary .stat-value { color: var(--primary); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td {
  border-bottom: 1px solid var(--border); padding: 9px 12px;
  text-align: left; vertical-align: top;
}
table.data thead th {
  background: #f7f9fc; font-weight: 600; font-size: 12px; color: #44506a;
  position: sticky; top: 0; white-space: nowrap;
}
table.data tbody tr:hover { background: #fafbfd; }
table.data td.num, table.data th.num { text-align: center; white-space: nowrap; }
.group-row td {
  background: var(--primary-light); font-weight: 600; color: var(--primary); font-size: 13px;
}
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 11px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-low { background: #e4f4ea; color: var(--low); }
.badge-medium { background: #fcf2df; color: #a97613; }
.badge-high { background: #fbe7e6; color: var(--high); }
.badge-none, .badge-muted { background: #eef1f5; color: var(--muted); }
.badge-ok { background: #e4f4ea; color: var(--low); }
.badge-warn { background: #fcf2df; color: #a97613; }
.badge-info { background: #e5eefa; color: #1f5fa8; }
.badge-danger { background: #fbe7e6; color: var(--high); }

/* ---------- forms ---------- */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: #3c4759; }
.form-row .hint { font-weight: 400; color: var(--muted); font-size: 11.5px; }
input[type=text], input[type=password], input[type=date], input[type=number],
select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #ccd3dd; border-radius: 6px;
  font-family: inherit; font-size: 13.5px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #b9d3ec; border-color: var(--primary); }
textarea { min-height: 80px; resize: vertical; }

.btn {
  display: inline-block; padding: 8px 16px; border-radius: 6px; border: 1px solid transparent;
  background: var(--primary); color: #fff; font-size: 13.5px; font-family: inherit;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: #17608f; text-decoration: none; color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-ghost { background: transparent; color: var(--primary); border-color: #c3d2e2; }
.btn-ghost:hover { background: var(--primary-light); color: var(--primary); }
.btn-danger { background: var(--high); }
.btn-danger:hover { background: #b33a33; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .form-row { margin-bottom: 0; min-width: 160px; }

.alert { padding: 11px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13.5px; }
.alert-success { background: #e4f4ea; color: #1d6b3d; border: 1px solid #b7e0c6; }
.alert-error { background: #fbe7e6; color: #9c332c; border: 1px solid #f0c0bc; }
.alert-info { background: #e5eefa; color: #1f5fa8; border: 1px solid #bfd6ef; }

/* ---------- mini 3x3 matrix ---------- */
.mini-matrix { border-collapse: separate; border-spacing: 2px; margin: 0 auto; }
.mini-matrix td.mm-cell {
  position: relative; border-radius: 3px; padding: 0;
  width: 15px; height: 15px;
}
.mini-matrix-md td.mm-cell { width: 26px; height: 26px; border-radius: 4px; }
.mini-matrix-lg td.mm-cell { width: 42px; height: 42px; border-radius: 5px; }
.mm-low { background: #cdead8; }
.mm-medium { background: #f7e3bd; }
.mm-high { background: #f3cbc8; }

.mm-dot {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 9px; height: 9px; border-radius: 50%; display: block;
}
.mini-matrix-md .mm-dot { width: 13px; height: 13px; }
.mini-matrix-lg .mm-dot { width: 18px; height: 18px; }
.mm-gross { background: #fff; border: 2.5px solid #45516b; }
.mm-net { background: #16334f; border: 2.5px solid #16334f; }
.mm-both {
  background: #16334f; border: 2.5px solid #fff;
  box-shadow: 0 0 0 2px #45516b;
}

.mm-legend { display: flex; gap: 14px; align-items: center; font-size: 11.5px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.mm-legend > span { display: flex; align-items: center; gap: 5px; }
.mm-legend .mm-dot { position: static; transform: none; }
.mm-legend .mm-axis { color: #9aa4b2; }

/* ---------- compact risk table (14" friendly) ---------- */
table.risk-compact { font-size: 13px; }
table.risk-compact td { vertical-align: middle; }
table.risk-compact tr.risk-row { cursor: pointer; }
table.risk-compact tr.risk-row:hover, table.risk-compact tr.risk-row.hover { background: #f3f7fb; }
table.risk-compact tr.risk-row.open { background: var(--primary-light); }
.risk-title { font-weight: 600; line-height: 1.45; }
.risk-desc { color: var(--muted); font-size: 11.5px; margin-top: 2px; line-height: 1.45; }
.risk-no-cell { font-weight: 700; color: var(--primary); white-space: nowrap; }
.expand-caret { display: inline-block; width: 14px; color: var(--muted); transition: transform .15s; }
tr.risk-row.open .expand-caret { transform: rotate(90deg); }

.level-move { display: flex; align-items: center; gap: 5px; justify-content: center; white-space: nowrap; }
.level-move .arrow { color: var(--muted); font-size: 11px; }

/* แถวรายละเอียดที่กางออก */
tr.detail-row > td { background: #fbfcfe; padding: 0; border-bottom: 2px solid var(--border); }
tr.detail-row.hidden { display: none; }
.detail-wrap { padding: 18px 20px; }
.prose { font-size: 12.5px; line-height: 1.7; }
.muted-dash { color: #9aa4b2; }

/* ---------- รายละเอียดความเสี่ยงแบบลำดับเดียว (ขั้นต้น -> ตอบสนอง -> คงเหลือ) ---------- */
.risk-flow { display: flex; flex-direction: column; gap: 0; }
.flow-objective {
  background: var(--primary-light); border-radius: 7px; padding: 9px 13px; margin-bottom: 14px;
  font-size: 13px; color: #24466b; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
}
.flow-objective strong { color: var(--primary); }
.flow-step { display: grid; grid-template-columns: 34px 1fr; gap: 14px; position: relative; }
.flow-step:not(:last-child)::before {
  content: ''; position: absolute; left: 16px; top: 34px; bottom: -2px;
  width: 2px; background: #d5e1ee;
}
.flow-num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; position: relative; z-index: 1;
}
.flow-body {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; margin-bottom: 14px; min-width: 0;
}
.flow-title { font-weight: 700; font-size: 14px; color: var(--primary); margin-bottom: 12px; }
.flow-title span { font-weight: 400; font-size: 11.5px; color: var(--muted); margin-left: 6px; }

.flow-levels { display: flex; gap: 18px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.flow-levels .mini-matrix { margin: 0; }
.flow-level-items { display: flex; gap: 22px; flex-wrap: wrap; }
.flow-level-item { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.flow-level-label { font-size: 11.5px; color: var(--muted); }
.flow-level-note { font-size: 11px; color: var(--muted); }

.flow-sub { font-size: 12px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
table.flow-table { font-size: 12.5px; }
table.flow-table th, table.flow-table td { padding: 7px 10px; }
.th-note { font-weight: 400; font-size: 10.5px; color: var(--muted); }
.flow-na { font-size: 11.5px; color: #9aa4b2; margin-top: 6px; }
.flow-reason { padding: 10px 12px; border-radius: 6px; font-size: 12.5px; line-height: 1.7; }
.flow-reason.is-gross { background: #f7f9fc; }
.flow-reason.is-net { background: #f0f6f2; }

/* ---------- edit history ---------- */
.history-item { border-left: 2px solid var(--border); padding: 0 0 14px 14px; position: relative; }
.history-item::before {
  content: ''; position: absolute; left: -5px; top: 4px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
}
.history-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.history-field { font-weight: 600; font-size: 12.5px; margin-bottom: 5px; }
.history-change { display: grid; grid-template-columns: 1fr 24px 1fr; gap: 8px; align-items: start; font-size: 12.5px; }
.history-old { background: #fbe9e7; padding: 7px 10px; border-radius: 5px; line-height: 1.6; }
.history-new { background: #e8f4ec; padding: 7px 10px; border-radius: 5px; line-height: 1.6; }
.history-arrow { text-align: center; color: var(--muted); padding-top: 7px; }
.history-reason { font-size: 12px; color: #55607a; margin-top: 6px; font-style: italic; }

/* ---------- assessment calculator (Module 2) ---------- */
.assess-calc {
  display: grid; grid-template-columns: 1fr 160px 220px; gap: 18px;
  align-items: start; background: #f7f9fc; border: 1px solid var(--border);
  border-radius: 8px; padding: 14px;
}
.assess-inputs { display: grid; gap: 10px; }
.assess-inputs .form-row { margin-bottom: 0; }

.assess-result {
  text-align: center; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 10px;
}
.assess-score { font-size: 34px; font-weight: 700; line-height: 1; color: var(--primary); }
.assess-label { font-size: 11px; color: var(--muted); margin-top: 4px; }
.assess-verdict {
  margin-top: 9px; font-size: 11.5px; font-weight: 600;
  padding: 5px 8px; border-radius: 5px; line-height: 1.4;
}
.assess-verdict.need-rca { background: #fbe7e6; color: var(--high); }
.assess-verdict.no-rca { background: #e4f4ea; color: var(--low); }
.assess-verdict.unset { background: #eef1f5; color: var(--muted); }

.assess-gridwrap { text-align: center; }
.assess-gridtitle { font-size: 11px; color: var(--muted); margin-bottom: 5px; }
table.score-grid { border-collapse: collapse; margin: 0 auto; font-size: 11px; }
table.score-grid th, table.score-grid td {
  border: 1px solid #d5dce6; width: 28px; height: 24px; text-align: center; padding: 0;
}
table.score-grid th { background: #eef2f7; color: #55607a; font-weight: 600; }
table.score-grid th.corner { background: #dde4ed; font-size: 9.5px; }
.sg-ok { background: #eaf6ee; color: #3d7a54; }
.sg-rca { background: #fdeceb; color: #a8433c; }
.sg-active { outline: 2.5px solid var(--primary); outline-offset: -2.5px; font-weight: 700; }

@media (max-width: 1200px) {
  .assess-calc { grid-template-columns: 1fr; }
  .assess-result, .assess-gridwrap { max-width: 260px; }
}

/* ---------- RCA 5 Whys board ---------- */
.rca-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.why-col {
  flex: 0 0 260px; background: #f7f9fc; border: 1px solid var(--border);
  border-radius: 8px; padding: 10px;
}
.why-col-head {
  font-weight: 600; font-size: 12.5px; color: var(--primary);
  margin-bottom: 9px; display: flex; align-items: center; gap: 7px;
}
.why-count {
  background: #dde7f1; color: var(--primary); border-radius: 9px;
  padding: 1px 7px; font-size: 11px;
}

.why-node {
  background: #fff; border: 1px solid var(--border); border-left: 3px solid #2c6fa8;
  border-radius: 6px; padding: 9px; margin-bottom: 9px;
}
.why-node.is-root { border-left-color: var(--high); background: #fffaf9; }
.why-node-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.why-node-head .spacer { flex: 1; }
.why-label {
  background: var(--primary); color: #fff; border-radius: 4px;
  padding: 1px 6px; font-size: 10.5px; font-weight: 600;
}
.why-label.sm { background: #8aa2bb; font-size: 10px; }
.why-x {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 13px; padding: 0 3px; line-height: 1;
}
.why-x:hover { color: var(--high); }

textarea.why-cause { font-size: 12.5px; min-height: 58px; margin-bottom: 7px; }

.why-parents {
  background: #f4f7fa; border-radius: 5px; padding: 7px 8px; margin-bottom: 7px;
}
.why-parents-title { font-size: 10.5px; color: var(--muted); margin-bottom: 5px; }
.why-parent {
  display: flex; align-items: flex-start; gap: 5px;
  font-size: 11.5px; line-height: 1.45; margin-bottom: 4px; cursor: pointer;
}
.why-parent input { width: auto; margin-top: 2px; }
.why-hint { font-size: 10.5px; color: var(--muted); margin-top: 4px; }

.why-root-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; cursor: pointer; margin-bottom: 7px;
}
.why-root-toggle input { width: auto; }
.why-next { width: 100%; font-size: 11.5px; padding: 4px; }
.why-add { width: 100%; font-size: 11.5px; border-style: dashed; }

/* เส้นเชื่อมและโหมดลากเส้น */
.rca-board { position: relative; }
.rca-board .why-col { position: relative; }
.why-node { position: relative; }
svg.rca-lines { position: absolute; top: 0; left: 0; z-index: 2; pointer-events: none; overflow: visible; }
.rca-edge-line { fill: none; stroke: #7f9ab8; stroke-width: 2; }
.rca-edge-hit { fill: none; stroke: transparent; stroke-width: 12; }
.mode-drag .rca-edge-hit { pointer-events: stroke; cursor: pointer; }
.mode-drag .rca-edge:hover .rca-edge-line { stroke: var(--high); stroke-width: 3; }
.rca-edge-temp { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-dasharray: 6 4; }

.why-port {
  position: absolute; top: 36px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2.5px solid #7f9ab8; z-index: 3; display: none;
}
.why-port-in { left: -8px; }
.why-port-out { right: -8px; }
.mode-drag .why-port { display: block; }
.mode-drag .why-port-out { background: var(--primary); border-color: var(--primary); cursor: crosshair; touch-action: none; }
.mode-drag .why-port-out:hover { transform: scale(1.25); }
.mode-drag .list-only, .mode-list .drag-only { display: none; }
.is-dragging { user-select: none; }
.why-node.drop-ok { outline: 2px dashed #9dbbd9; outline-offset: 2px; }
.why-node.drop-hover { outline: 2.5px solid var(--primary); background: var(--primary-light); }

.rca-tip {
  position: absolute; z-index: 5; background: #1c2431; color: #fff; font-size: 11.5px;
  padding: 4px 9px; border-radius: 5px; pointer-events: none; white-space: nowrap;
}

.mode-toggle { display: inline-flex; border: 1px solid #c3d2e2; border-radius: 7px; overflow: hidden; margin-left: 10px; }
.mode-toggle button {
  background: #fff; border: 0; padding: 5px 12px; font-family: inherit; font-size: 12.5px;
  color: var(--primary); cursor: pointer;
}
.mode-toggle button + button { border-left: 1px solid #c3d2e2; }
.mode-toggle button.active { background: var(--primary); color: #fff; font-weight: 600; }
.mode-toggle a { padding: 5px 12px; font-size: 12.5px; color: var(--primary); background: #fff; text-decoration: none; }
.mode-toggle a + a { border-left: 1px solid #c3d2e2; }
.mode-toggle a.is-on { background: var(--primary); color: #fff; font-weight: 600; }

/* มุมมองอ่านอย่างเดียวของผังสาเหตุ */
.why-view-col { flex: 0 0 240px; }
.why-view-node {
  background: #fff; border: 1px solid var(--border); border-left: 3px solid #2c6fa8;
  border-radius: 6px; padding: 9px; margin-bottom: 9px; font-size: 12.5px; line-height: 1.6;
}
.why-view-node.is-root { border-left-color: var(--high); background: #fffaf9; }
.why-from { font-size: 10.5px; color: var(--muted); margin-top: 5px; }

/* ---------- วัตถุประสงค์ด้านคุณภาพ (หน้าตารางประเมินความเสี่ยง) ---------- */
.obj-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.obj-chip { background: var(--primary-light); color: #24466b; border-radius: 6px; padding: 5px 10px; font-size: 12.5px; }
.obj-chip strong { color: var(--primary); margin-right: 3px; }
.obj-add { display: flex; gap: 10px; align-items: center; margin: 0; flex-wrap: wrap; }

/* ---------- งานค้างของฉัน (หน้าภาพรวม) ---------- */
.my-work { border-top: 3px solid var(--primary); }
.my-work-empty { color: var(--low); font-size: 13.5px; }
.my-work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.my-work-group { border: 1px solid var(--border); border-left: 3px solid var(--muted); border-radius: 7px; padding: 10px 12px; }
.my-work-group.tone-high { border-left-color: var(--high); }
.my-work-group.tone-medium { border-left-color: var(--medium); }
.my-work-group.tone-info { border-left-color: #2c6fa8; }
.my-work-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.my-work-title span {
  background: #eef1f5; border-radius: 9px; padding: 1px 7px; font-size: 11px; margin-left: 4px; color: var(--muted);
}
.my-work-item { display: block; padding: 6px 7px; border-radius: 5px; color: var(--text); text-decoration: none; }
.my-work-item:hover { background: #f3f7fb; text-decoration: none; }
.my-work-item.is-late .my-work-sub strong { color: var(--high); }
.my-work-text { font-size: 12.5px; line-height: 1.45; }
.my-work-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.my-work-more { font-size: 11.5px; color: var(--muted); padding: 4px 7px; }

/* ---------- Module 2 : ขั้นตอนการสอบทาน ---------- */
.wf-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.wf-step {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px;
  border-radius: 20px; background: #eef1f5; color: var(--muted); font-size: 12.5px;
}
.wf-dot {
  width: 22px; height: 22px; border-radius: 50%; background: #cfd6e0; color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.wf-step.done { background: #e4f4ea; color: #1d6b3d; }
.wf-step.done .wf-dot { background: var(--low); }
.wf-step.current { background: var(--primary); color: #fff; font-weight: 600; }
.wf-step.current .wf-dot { background: #fff; color: var(--primary); }

.resp-group { border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.resp-group-title { font-weight: 700; font-size: 13.5px; color: var(--primary); margin-bottom: 10px; }
.resp-group-title span { font-weight: 400; font-size: 11.5px; color: var(--muted); margin-left: 6px; }

table.err-form { font-size: 12px; }
table.err-form th, table.err-form td { border: 1px solid #d5dce6; padding: 6px 7px; }
table.err-form th { text-align: center; white-space: normal; }
table.err-form th.grp { background: #e6ecf3; }

/* ---------- incident sources ---------- */
.source-group { background: #f7f9fc; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.source-group-title { font-weight: 600; font-size: 12.5px; color: var(--primary); margin-bottom: 8px; }
.source-option {
  display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.5;
  padding: 5px 0; cursor: pointer;
}
.source-option input { width: auto; margin-top: 3px; }

/* ---------- approval banner ---------- */
.approval-banner {
  background: #fff6e5; border: 1px solid #f0d9a8; color: #7a5a12;
  padding: 12px 15px; border-radius: 7px; margin-bottom: 16px; font-size: 13px; line-height: 1.6;
}
.approval-banner strong { color: #5f4509; }

/* ---------- risk form ---------- */
.assess-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: #fcfdfe; }
.assess-title { font-weight: 600; font-size: 13.5px; margin-bottom: 12px; color: var(--primary); }
.assess-title .hint { font-weight: 400; color: var(--muted); font-size: 11.5px; margin-left: 6px; }

.section-divider {
  margin: 22px 0 12px; padding-top: 16px; border-top: 1px solid var(--border);
  font-weight: 600; font-size: 13.5px; color: #3c4759;
}
.section-divider .hint { font-weight: 400; color: var(--muted); font-size: 11.5px; margin-left: 6px; }

.impact-row {
  display: grid; grid-template-columns: 190px 110px 1fr; gap: 12px;
  align-items: start; margin-bottom: 10px;
}
.impact-row .impact-label { font-size: 13px; padding-top: 8px; }
.impact-row textarea { min-height: 44px; }

.response-item {
  position: relative; border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px; background: #fcfdfe;
}
.resp-remove {
  position: absolute; top: 10px; right: 10px; background: none; border: 1px solid #e0c4c2;
  color: var(--high); border-radius: 5px; padding: 3px 10px; font-size: 12px;
  cursor: pointer; font-family: inherit;
}
.resp-remove:hover { background: #fbe7e6; }

.checkbox-row { display: flex; gap: 18px; flex-wrap: wrap; padding-top: 4px; }
.checkbox-row label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; cursor: pointer; }
.checkbox-row input[type=checkbox] { width: auto; }

select.auto-filled { background: #e4f4ea; transition: background .4s; }

/* ---------- risk matrix ---------- */
.matrix { border-collapse: collapse; }
.matrix th, .matrix td { border: 1px solid var(--border); padding: 0; text-align: center; }
.matrix th { background: #f7f9fc; font-size: 12px; padding: 8px; font-weight: 600; }
.matrix td.cell { width: 120px; height: 84px; vertical-align: middle; }
.matrix td.cell .count { font-size: 22px; font-weight: 700; }
.matrix td.cell .cell-label { font-size: 10.5px; opacity: .75; }
.cell-low { background: #e4f4ea; color: #1d6b3d; }
.cell-medium { background: #fcf2df; color: #8a5f0f; }
.cell-high { background: #fbe7e6; color: #9c332c; }

/* กด Ctrl+P ที่หน้าใดก็ได้ ซ่อนเมนูออก */
@media print {
  .no-print, .sidebar, .topbar { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
}

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: #16334f; padding: 20px; }
.auth-card { background: #fff; border-radius: 12px; padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.auth-card h1 { margin: 0 0 4px; font-size: 19px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }

/* ---------- gantt ---------- */
table.gantt { font-size: 12.5px; }
table.gantt th.period, table.gantt td.period {
  width: 34px; min-width: 34px; padding: 0 1px; text-align: center;
  border-left: 1px solid #c3ccd8;
}
table.gantt td, table.gantt th { border-bottom-color: #c3ccd8; }
table.gantt th.year-start, table.gantt td.year-start { border-left: 2px solid #6f7d92; }
table.gantt th.year-head { border-left: 2px solid #6f7d92; font-size: 11.5px; color: #2b3a50; background: #eef2f7; }
table.gantt thead th.period { font-size: 10.5px; padding: 6px 2px; color: #3f4b60; }
table.gantt th.period.is-today, table.gantt td.period.is-today { background: #fff8e8; }
table.gantt td { vertical-align: middle; }

.gantt-bar-cell { padding: 0 2px; }
.gantt-bar {
  height: 19px; border-radius: 4px; display: flex; align-items: center;
  justify-content: center; color: #fff; font-size: 10.5px; white-space: nowrap;
  overflow: hidden; padding: 0 5px;
}
.bar-planned { background: #90a9c4; }
.bar-progress { background: #2c6fa8; }
.bar-done { background: var(--low); }
.bar-late { background: var(--high); }

.gantt-empty { text-align: center; }
.gantt-nodate { font-size: 10.5px; color: #9aa4b2; font-style: italic; }

.gantt-legend {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  padding: 11px 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted);
}
.gantt-legend span { display: flex; align-items: center; gap: 6px; }
.gantt-legend i { width: 16px; height: 10px; border-radius: 3px; display: block; }
.gantt-legend .gantt-note { color: #9aa4b2; font-style: italic; }

@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  .menu-toggle { display: block; }
}

/* ---------- เกณฑ์การประเมินความเสี่ยง ---------- */
.matrix-config { border-collapse: separate; border-spacing: 4px; }
.matrix-config th { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 4px 8px; text-align: center; }
.matrix-config .mc-axis { writing-mode: vertical-rl; transform: rotate(180deg); }
.matrix-config td.mm-cell { width: 96px; height: 54px; text-align: center; border-radius: 6px; font-weight: 600; font-size: 13px; }
.matrix-config td.mm-cell select { width: 84px; padding: 4px 6px; font-size: 12.5px; background: rgba(255,255,255,.85); }
.criteria-title { font-weight: 600; margin-bottom: 8px; }
.criteria-table td, .criteria-table th { vertical-align: top; font-size: 12.5px; }
.criteria-table th { background: #f3f6fa; }
.criteria-note { font-size: 12px; color: var(--muted); line-height: 1.7; margin-top: 10px; white-space: normal; }
.criteria-edit textarea { width: 100%; min-width: 150px; font-size: 12.5px; }
.criteria-edit th textarea { font-weight: 600; background: #f7f9fc; }
.criteria-hint { margin: 4px 0 12px; font-size: 12.5px; }
.criteria-hint > summary { cursor: pointer; color: #1f5fa8; font-weight: 500; width: fit-content; }
.criteria-hint[open] > summary { margin-bottom: 8px; }
.criteria-compact .criteria-table td, .criteria-compact .criteria-table th { font-size: 11.5px; padding: 6px 8px; }

/* ---------- Incident ในฟอร์มประเมินความเสี่ยง ---------- */
.incident-pick { border: 1px solid var(--border); border-radius: 8px; max-height: 300px; overflow-y: auto; }
.incident-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 12.5px; line-height: 1.55; }
.incident-row:last-child { border-bottom: 0; }
.incident-row:hover { background: #f7f9fc; }
.incident-row input { width: auto; margin-top: 3px; flex: none; }
.incident-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 3px; color: var(--muted); font-size: 11.5px; }
.incident-hint { font-size: 12.5px; margin: 8px 0 14px; min-height: 4px; }

/* ---------- ข้อเสนอแก้ Risk profile (คำตอบรายงานการสอบทาน) ---------- */
.rp-head, .rp-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; }
.rp-head { margin: 6px 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.rp-head .hint { font-weight: 400; }
.rp-block { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.rp-label { font-size: 12.5px; font-weight: 600; color: var(--primary); margin-bottom: 8px; }
.rp-cur { background: #f5f7fa; border-radius: 6px; padding: 9px 11px; font-size: 12.5px; line-height: 1.6; min-height: 38px; }
.rp-cols select { width: auto; min-width: 96px; }
.rp-cols [data-rp="objective_id"] { width: 100%; }
.rp-resp-row { border: 1px dashed #c9d3df; border-radius: 6px; padding: 8px; margin-bottom: 8px; display: grid; gap: 6px; }
.rp-resp-top { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rp-resp-top input[type=text] { flex: 1; min-width: 80px; }
.rp-newno input { max-width: 260px; }
@media (max-width: 900px) { .rp-head, .rp-cols { grid-template-columns: 1fr; } .rp-head div:last-child { display: none; } }

/* ---------- ปุ่มเมนูแบบกดแล้วมีตัวเลือก (เช่น พิมพ์ตาราง) ---------- */
.menu-btn { position: relative; }
.menu-btn > summary { list-style: none; cursor: pointer; }
.menu-btn > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 230px; background: #fff;
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(20, 40, 70, .14); padding: 6px 0; }
.menu-list a { display: block; padding: 8px 14px; font-size: 13px; color: var(--text); text-decoration: none; white-space: nowrap; }
.menu-list a:hover { background: #f1f5fa; color: var(--primary); }

/* รายการย่อยใต้ชื่อความเสี่ยง (ชื่อหลายบรรทัด) — แสดงครบทุกบรรทัด */
.risk-sub { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.risk-sub li { margin: 1px 0; }

/* ---------- รายละเอียดความเสี่ยง 2 กลุ่ม : ความเสี่ยงและการตอบสนอง / ระดับความเสี่ยง ---------- */
table.rg1 { min-width: 760px; }
table.rg1 th { vertical-align: bottom; }
table.rg1 td { vertical-align: top; }
.rg1-risk { width: 27%; }
.rg1-ctrl { width: 128px; }
.rg1-unit { width: 16%; }
.rg1-rep { width: 17%; }
td.rg1-riskcell { background: #f7f9fc; border-right: 1px solid var(--border); }
.rg-risk-head { font-weight: 600; color: var(--text); }
.rg-no { color: var(--primary); font-weight: 700; margin-right: 2px; }
.rg-desc { margin-top: 6px; color: var(--muted); font-size: 12px; }
.rg-freq { color: var(--muted); margin-top: 3px; }
.rg2-top { display: grid; grid-template-columns: auto 1fr 1fr; gap: 14px; align-items: stretch; }
.rg2-matrix { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 10px; }
.rg2-matrix .mini-matrix { margin: 0; }
.rg2-matrix .mm-legend { flex-direction: column; gap: 4px; align-items: flex-start; }
.rg2-stage { border-radius: 7px; padding: 11px 13px; min-width: 0; }
.rg2-stage.is-gross { background: #f7f9fc; border: 1px solid #e1e8f1; }
.rg2-stage.is-net { background: #f0f6f2; border: 1px solid #d7e8dd; }
.rg2-stage-h { font-weight: 700; font-size: 13px; color: var(--primary); margin-bottom: 8px; }
.rg2-stage-h span { font-weight: 400; font-size: 11px; color: var(--muted); margin-left: 4px; }
.rg2-lv { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.rg2-x { color: #9aa4b2; }
.rg2-reason-h { font-size: 11.5px; color: var(--muted); font-weight: 600; margin: 10px 0 3px; }
table.rg2-basis { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 12.5px; }
table.rg2-basis th { width: 120px; text-align: left; font-weight: 600; color: var(--primary); padding: 6px 8px 6px 0; vertical-align: top; white-space: nowrap; }
table.rg2-basis td { padding: 6px 0; line-height: 1.7; border-bottom: 1px dashed var(--border); }
table.rg2-basis tr:last-child td { border-bottom: 0; }
.rg-net-basis { margin-top: 4px; color: var(--muted); font-size: 12px; }
table.ev-table { width: 100%; border-collapse: collapse; font-size: 12.5px; line-height: 1.6; table-layout: fixed; }
table.ev-table col.ev-c-grp { width: 130px; }
table.ev-table col.ev-c-label { width: 290px; }
table.ev-table th, table.ev-table td { border: 1px solid #d3dbe6; padding: 7px 10px; vertical-align: top; text-align: left; }
table.ev-table th.ev-top { background: #fff3a6; text-align: center; font-weight: 600; }
table.ev-table th.ev-grp { font-weight: 700; font-size: 13px; vertical-align: middle; }
table.ev-table th.ev-grp span { display: block; font-weight: 400; font-size: 11px; margin-top: 3px; opacity: .85; }
/* โอกาสในการเกิด — โทนฟ้า */
table.ev-table th.ev-like { background: #9fc5e8; color: #0b3a63; border-color: #7eaedb; }
table.ev-table th.ev-sub { background: #cfe2f3; color: #1f4e79; font-size: 12px; font-weight: 700; padding: 5px 10px; border-color: #b3cfea; }
table.ev-table tr.ev-r-like th.ev-label { background: #e8f1fa; border-color: #c9dbee; }
table.ev-table tr.ev-r-like td { background: #f7fbff; border-color: #c9dbee; }
/* คำอธิบายผลกระทบ — โทนส้ม */
table.ev-table th.ev-imp { background: #f4b183; color: #6e3210; border-color: #e59a67; }
table.ev-table tr.ev-r-imp th.ev-label { background: #fde9dc; border-color: #f1d3bf; }
table.ev-table tr.ev-r-imp td { background: #fff8f3; border-color: #f1d3bf; }
/* เส้นแบ่งระหว่างสองส่วน */
table.ev-table tr.ev-sec-start > th, table.ev-table tr.ev-sec-start > td { border-top: 3px solid #5b6b80; }
table.ev-table th.ev-label { font-weight: 600; color: #2f3a4a; }
table.ev-table tr.is-empty th.ev-label { font-weight: 400; color: #8793a3; }
table.ev-table tr.is-empty td { color: #9aa4b2; }
table.ev-table .ev-na { color: #9aa4b2; }
@media (max-width: 700px) { table.ev-table col.ev-c-grp { width: 90px; } table.ev-table col.ev-c-label { width: 150px; } }
.rg-criteria { margin-top: 14px; }
.rg-crit-title { font-weight: 600; font-size: 12.5px; color: var(--primary); margin: 10px 0 6px; }
@media (max-width: 900px) { .rg2-top { grid-template-columns: 1fr; } }
.menu-list .menu-sec { padding: 8px 14px 3px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: none; }
.menu-list .menu-sec:not(:first-child) { border-top: 1px solid var(--border); margin-top: 4px; }

.resp-divider { display: flex; align-items: center; gap: 10px; }
.resp-divider .spacer { flex: 1; }

/* ตารางประเมินความเสี่ยง: กลุ่ม 1 อยู่ในแถว — เมทริกซ์เล็กที่มุมขวาบนของช่องความเสี่ยง */
table.risk-compact td { vertical-align: top; }
table.risk-compact td.risk-cell { border-right: 1px solid var(--border); }
table.risk-compact tr.risk-row-more > td { border-top: 1px dashed #dde4ee; }
.risk-corner-matrix { float: right; margin: 0 0 6px 10px; }
.risk-corner-matrix .mini-matrix { margin: 0; }
.rg-levels-only { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }

/* ป้ายที่กดได้ (เช่น มีคำขอแก้ไขรออนุมัติ -> หน้าอนุมัติ) */
a.badge-link { text-decoration: none; cursor: pointer; }
a.badge-link:hover { filter: brightness(.94); text-decoration: underline; }

/* ข้อย่อยในช่องข้อความ (การตอบสนอง / หน่วยงาน / รายงาน) — แยกบรรทัดละข้อ มีเส้นคั่น */
.rl-head { font-weight: 700; color: var(--primary); margin-bottom: 3px; }
.rl-list { display: flex; flex-direction: column; }
.rl-item { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 4px 0; }
.rl-item + .rl-item { border-top: 1px dashed #dfe5ee; }
.rl-mark { font-weight: 600; color: var(--primary); min-width: 12px; white-space: nowrap; }
.rl-text { min-width: 0; }

/* เส้นแบ่งให้ชัดขึ้น: ระหว่างข้อย่อย / ระหว่างการตอบสนอง / ระหว่างความเสี่ยง */
.rl-item + .rl-item { border-top: 1px solid #b4c2d3; }
.rl-item { padding: 5px 0; }
table.risk-compact tr.risk-row-more > td { border-top: 1px solid #9fb0c5; }
table.risk-compact tr.risk-row:not(.risk-row-more) > td { border-top: 2px solid #7f93ab; }
table.risk-compact tr.group-row > td { border-top: 2px solid #7f93ab; }
table.risk-compact td.risk-cell { border-right: 1px solid #b4c2d3; }
table.risk-compact tr.risk-row > td + td { border-left: 1px solid #dbe2eb; }
table.rg1 td { border-color: #b4c2d3; }

/* Module 5 — สถานะการสื่อสารรายปี + ไฟล์แนบ */
.comm-years { display: flex; gap: 10px; flex-wrap: wrap; }
.comm-year { min-width: 128px; border: 1px solid var(--border); border-left: 4px solid #c3ccd8; border-radius: 7px; padding: 8px 11px; background: #fbfcfe; }
.comm-year .cy-year { font-weight: 700; font-size: 13px; margin-bottom: 5px; }
.comm-year .cy-year span { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.comm-year .cy-note { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.comm-year.is-done { border-left-color: #2e8b57; background: #f2faf5; }
.comm-year.is-missing { border-left-color: #c0392b; background: #fdf3f2; }
.comm-year.is-now { box-shadow: 0 0 0 2px #1f5fa833; }
.comm-file { margin-top: 4px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.comm-addfile { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.comm-addfile input[type=file] { font-size: 11.5px; max-width: 260px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--high); cursor: pointer; font-size: 12px; text-decoration: underline; }

/* แท็บแยกหน้าที่ (เช่น ทะเบียนสื่อสาร: บันทึกการสื่อสาร / ตั้งค่า) */
.view-tabs { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.view-tab { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 3px; padding: 12px 16px; border: 1px solid var(--border);
  border-radius: 9px; background: #fff; color: var(--text); text-decoration: none; }
.view-tab strong { font-size: 14px; }
.view-tab span { font-size: 12px; color: var(--muted); }
.view-tab:hover { border-color: #9fb3cc; background: #f7fafd; }
.view-tab.active { border: 2px solid var(--primary); background: var(--primary-light); padding: 11px 15px; }
.view-tab.active strong { color: var(--primary); }
table.comm-log-table tr.is-missing > td:first-child { box-shadow: inset 3px 0 0 #c0392b; }
table.comm-log-table tr.is-done > td:first-child { box-shadow: inset 3px 0 0 #2e8b57; }

/* ตารางประเมินความเสี่ยง: ปุ่มกาง/ยุบที่เห็นชัด + แถวที่กางออกมีกรอบสีเชื่อมกับแถวความเสี่ยง */
.expand-btn { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--primary); background: #fff; color: var(--primary);
  font-size: 14px; line-height: 1; cursor: pointer; display: grid; place-items: center; transition: transform .15s, background .15s; }
.expand-btn:hover { background: var(--primary-light); }
tr.risk-row.open .expand-btn { transform: rotate(180deg); background: var(--primary); color: #fff; }
.expand-link { margin-top: 10px; background: var(--primary-light); border: 1px solid #b7cbe4; color: var(--primary); border-radius: 999px;
  padding: 5px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.expand-link:hover { background: #d7e5f5; }
.expand-link .when-open { display: none; }
tr.risk-row.open .expand-link .when-open { display: inline; }
tr.risk-row.open .expand-link .when-closed { display: none; }
tr.risk-row.open .expand-link { background: var(--primary); border-color: var(--primary); color: #fff; }
table.risk-compact tr.risk-row.open > td { background: #e6eff9; }
tr.detail-row > td { background: #eaf1f9; border-bottom: 3px solid var(--primary); }
tr.detail-row .detail-wrap { border-left: 5px solid var(--primary); margin-left: 12px; padding: 16px 18px 18px; }

/* Risk Matrix: กดช่องเพื่อกรองรายการด้านล่าง */
.matrix td.cell { padding: 0; }
.matrix td.cell .cell-link { display: flex; flex-direction: column; justify-content: center; height: 100%; min-height: 84px;
  color: inherit; text-decoration: none; cursor: pointer; transition: transform .1s, box-shadow .1s; }
.matrix td.cell .cell-link:hover { box-shadow: inset 0 0 0 2px #1f5fa888; }
.matrix td.cell.is-selected { box-shadow: inset 0 0 0 4px var(--primary); }
.matrix td.cell.is-dim { opacity: .45; }
.matrix td.cell.is-dim:hover { opacity: .8; }
.matrix-filter { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#risk-list { scroll-margin-top: 80px; }

/* การ์ดตัวเลขที่กดได้ -> กรองรายการด้านล่าง */
a.stat-link { display: block; color: inherit; text-decoration: none; cursor: pointer; transition: box-shadow .12s, transform .12s; }
a.stat-link:hover { box-shadow: 0 0 0 2px #1f5fa855; transform: translateY(-1px); }
a.stat-link.is-selected { box-shadow: 0 0 0 3px var(--primary); }
#incident-list { scroll-margin-top: 80px; }

/* Module 1.1 Change Request — กล่องแก้ไข เดิม -> ใหม่ */
.tf-side-title { font-size: 12px; font-weight: 700; color: var(--primary); text-transform: none; margin-bottom: 8px; }
.cr-block { margin-top: 16px; border: 1px solid #b7cbe4; border-radius: 8px; background: #f6f9fd; }
.cr-block > summary { cursor: pointer; padding: 11px 14px; font-size: 13.5px; color: var(--primary); list-style: none; }
.cr-block > summary::-webkit-details-marker { display: none; }
.cr-block > summary::before { content: '▸ '; }
.cr-block[open] > summary::before { content: '▾ '; }
.cr-block > summary span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.cr-block > summary em { font-style: normal; margin-left: 6px; }
.cr-block[open] > summary { border-bottom: 1px solid #d3e0ef; }
.cr-block > .rp-editor { padding: 12px 14px; background: #fff; border-radius: 0 0 8px 8px; }

/* ticket ประเด็น — แถบขั้นตอน */
.ticket-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.ticket-step { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; background: #fff;
  border: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.ticket-step span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #e9eef5; color: #5b6b80; font-weight: 700; font-size: 12px; }
.ticket-step.is-done { color: #1d6b3d; border-color: #bfe0cb; background: #f2faf5; }
.ticket-step.is-done span { background: #2e8b57; color: #fff; }
.ticket-missing { background: #fdf6e7; border: 1px solid #f0dcae; border-radius: 7px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; }
.ticket-missing ul { margin: 6px 0 0; padding-left: 20px; }
.tf-issue-text { background: #fbe9e7; padding: 10px 12px; border-radius: 6px; line-height: 1.65; border-left: 3px solid var(--high); }
.comm-decision .checkbox-row { margin-bottom: 8px; }

/* เกณฑ์ในการประเมิน Root Cause */
.rca-crit-title { font-weight: 700; color: var(--primary); margin: 4px 0 8px; font-size: 13.5px; }
table.rca-crit-table th { text-align: center; vertical-align: middle; background: #f3f6fa; font-size: 12px; }
table.rca-crit-table td { vertical-align: top; font-size: 12.5px; }
table.rca-crit-table td.rca-score-cell { text-align: center; vertical-align: middle; background: #f7f9fc; border-right: 1px solid var(--border); }
table.rca-crit-table td.rca-mark { text-align: center; vertical-align: middle; font-weight: 700; font-size: 14px; }
td.rca-mark-yes { color: #1d6b3d; }
td.rca-mark-no { color: #b0322a; }
td.rca-mark-na { color: #9aa4b2; font-size: 11.5px !important; font-weight: 500 !important; }
table.rca-crit-table textarea, table.rca-crit-table select, table.rca-crit-table input { width: 100%; font-size: 12px; }
