/* User portal additions on top of /admin/assets/admin.css (same theme tokens) */
input[type=email], input[type=tel] { width: 100%; min-width: 0; min-height: 42px; padding: 10px 12px; border: 1px solid #d8e2dc; border-radius: 6px; background: #fff; color: var(--ink); font-size: 13px; transition: border-color .16s, box-shadow .16s; }
.login input[type=email], .login input[type=tel] { min-height: 46px; }
.hint { display: block; color: var(--muted); font-size: 11px; line-height: 1.6; }
.hint .icon { width: 14px; height: 14px; }
label + .password-field { margin-top: 7px; }
.login .hint { margin-top: -14px; }
.login .form-step .hint { margin-top: -6px; }
.text-link { display: inline-flex; align-items: center; align-self: center; gap: 6px; font-size: 12px; text-decoration: none; }
.text-link .icon { width: 15px; height: 15px; }

.login-shell.wide { max-width: 560px; }
.identity-chip { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: #f7faf8; }
.identity-chip > .icon { color: var(--accent); }
.identity-chip span { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.identity-chip small { font-size: 11px; }
.identity-chip strong { font-size: 14px; letter-spacing: .5px; }
.identity-chip a { font-size: 12px; font-weight: 600; text-decoration: none; }
.form-step { display: flex; flex-direction: column; gap: 14px; min-width: 0; margin: 0; padding: 0; border: 0; }
.form-step + .form-step { padding-top: 20px; border-top: 1px solid var(--line); }
.form-step legend { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 0; font-size: 14px; font-weight: 600; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.steps { margin: 0; padding-left: 20px; font-size: 13px; }
.steps li + li { margin-top: 6px; }

img.account-avatar { object-fit: cover; }
.profile-panel { flex-direction: row; align-items: center; gap: 20px; }
.profile-avatar { display: grid; place-items: center; flex: 0 0 72px; width: 72px; height: 88px; border-radius: 8px; background: #ecf2ef; color: #91a397; object-fit: cover; }
.profile-avatar .icon { width: 30px; height: 30px; stroke-width: 1.3; }
.profile-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.profile-copy > strong { font-size: 17px; font-weight: 650; }
.profile-copy > span { color: var(--muted); font-size: 12px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 8px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 12px; }
.profile-meta li { display: inline-flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.profile-meta .icon { width: 14px; height: 14px; color: var(--accent); }

.menu-group { margin-bottom: 28px; }
.menu-group h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 16px; }
.menu-group-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.menu-group-icon .icon { width: 16px; height: 16px; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.menu-card { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); text-decoration: none; transition: border-color .16s, box-shadow .16s, transform .16s; }
.menu-card:hover { border-color: #b7c9bf; box-shadow: 0 6px 20px #24392b0d; transform: translateY(-1px); }
.menu-icon { position: relative; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 10px; background: #e8f2ed; color: #348061; }
.menu-alert { position: absolute; z-index: 1; top: -7px; right: -9px; min-width: 18px; height: 18px; padding: 0 5px; border: 2px solid #fff; border-radius: 999px; background: #d08925; color: #fff; font-size: 11px; font-weight: 700; line-height: 14px; text-align: center; }
.notice-list { margin-bottom: 18px; }
.notice-list h2 { display: flex; align-items: center; gap: 8px; }
.notice-list ul { margin: 0; padding-left: 18px; }
.notice-list li + li { margin-top: 6px; }
.live-notices { position: fixed; z-index: 80; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 36px)); }
.live-notice { padding: 12px 14px; border: 1px solid #ead7b0; border-radius: 8px; background: #fffaf1; box-shadow: 0 8px 24px #24392b1f; color: var(--ink); }
.live-notice strong { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.live-notice strong .icon { width: 16px; height: 16px; color: #d08925; }
.live-notice p { margin: 0; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.live-notice-actions { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; }
.live-notice-actions a { font-weight: 600; }
.live-notice-close { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; }
@media print { .live-notices { display: none !important; } }
.menu-icon .icon { width: 22px; height: 22px; }
.group-finance .menu-icon, .group-finance .menu-group-icon { background: #faf0da; color: #ac8638; }
.group-general .menu-icon, .group-general .menu-group-icon { background: #edf0fc; color: #6974ad; }
.menu-copy { display: flex; flex-direction: column; flex: 1; gap: 4px; }
.menu-copy strong { font-size: 15px; font-weight: 600; line-height: 1.5; }
.menu-copy span { color: var(--muted); font-size: 12px; }
.menu-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid #edf1ee; color: var(--muted); }
.menu-foot .icon { width: 16px; height: 16px; transition: transform .16s, color .16s; }
.menu-card:hover .menu-foot .icon { color: var(--accent); transform: translateX(3px); }
.badge.muted-badge { background: #f1f3f2; color: var(--muted); }

.alert.note { display: flex; align-items: center; gap: 8px; border-color: #d7e3f0; background: #f2f7fc; color: #3b5876; }
.alert.note .icon { width: 16px; height: 16px; }
.kp7-person { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 26px; }
.kp7-photo { width: 160px; height: 200px; border: 1px solid var(--line); border-radius: 6px; object-fit: cover; background: #eaf0ec; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 20px; margin: 0; }
.info-grid dt { margin-bottom: 2px; color: var(--muted); font-size: 11px; }
.info-grid dd { margin: 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
table.data td.num { text-align: right; white-space: nowrap; }
.account-form > button { align-self: flex-start; }

.payroll-page main { max-width: 1500px; }
.payroll-heading-copy { display: flex; align-items: center; gap: 14px; }
.payroll-heading-icon { display: grid; place-items: center; flex: 0 0 52px; height: 52px; border: 1px solid #d2e5db; border-radius: 14px; background: #eaf4ee; color: var(--accent); }
.payroll-heading-icon .icon { width: 25px; height: 25px; }
.payroll-private { display: inline-flex; align-items: center; gap: 6px; color: #567368; font-size: 11px; white-space: nowrap; }
.payroll-private .icon { width: 14px; height: 14px; }
.payroll-filter { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(100px, 130px) minmax(140px, 175px) auto; align-items: end; gap: 14px; margin-bottom: 22px; padding: 20px 24px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.payroll-filter-title { display: flex; align-items: center; align-self: center; gap: 12px; }
.payroll-filter-title > .icon { color: var(--accent); width: 22px; height: 22px; }
.payroll-filter-title strong, .payroll-filter-title small { display: block; }
.payroll-filter-title strong { font-size: 13px; font-weight: 600; }
.payroll-filter-title small { margin-top: 2px; font-size: 11px; }
.payroll-filter button { min-height: 42px; }
.payroll-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 28px; }
.payroll-metric { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.payroll-metric > div { min-width: 0; }
.payroll-metric-icon { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 10px; background: #edf6f0; color: #257450; }
.payroll-metric > div > span { font-size: 11px; color: #657970; }
.payroll-metric strong { display: block; margin-top: 5px; font-size: clamp(17px, 1.8vw, 25px); line-height: 1.3; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.payroll-metric strong small { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 400; }
.payroll-metric-deduction .payroll-metric-icon { background: #fcf1e8; color: #9d6135; }
.payroll-metric-net { background: #176b52; border-color: #176b52; color: #fff; }
.payroll-metric-net .payroll-metric-icon { background: #ffffff1c; color: #fff; }
.payroll-metric-net > div > span, .payroll-metric-net small { color: #d6ece3; }
.payroll-document { padding: 22px; border: 1px solid #dce5e1; border-radius: 14px; background: #edf2ef; }
.payroll-screen-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 0 20px; }
.payroll-screen-actions strong { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.payroll-screen-actions strong .icon { color: var(--accent); }
.payroll-screen-actions span { display: block; margin: 4px 0 0 26px; color: #60736a; font-size: 11px; }
.payroll-screen-actions button { flex-shrink: 0; }
.payroll-scroll-hint { display: none; }
.payroll-slip { width: min(100%, 850px); margin: 0 auto; padding: 32px 36px; border: 1px solid #d8e0dc; border-radius: 3px; background: #fff; box-shadow: 0 4px 18px #24392b0b; color: #202c26; font-size: 12px; line-height: 1.6; }
.payroll-paper-head { margin-bottom: 20px; }
.payroll-letterhead { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 12px; }
.payroll-seal { display: block; flex-shrink: 0; width: 112px; height: 112px; object-fit: contain; }
.payroll-letterhead > div { text-align: right; }
.payroll-letterhead strong { display: block; font-size: 13px; font-weight: 600; }
.payroll-letterhead span { display: block; margin-top: 3px; color: #66756d; font-size: 11px; }
.payroll-paper-head h2 { margin: 0; font-size: 19px; font-weight: 650; text-align: center; }
.payroll-period { margin: 4px 0 0; text-align: center; font-size: 13px; }
.payroll-recipient { margin: 0 0 5px; }
.payroll-recipient strong { margin-left: 6px; font-weight: 600; }
.payroll-intro { margin: 0; }
.payroll-table-scroll { overflow-x: auto; margin-top: 12px; }
.payroll-statement { width: 100%; min-width: 640px; border-collapse: collapse; table-layout: fixed; color: #24332b; font-size: 12px; line-height: 1.5; }
.payroll-statement .payroll-item-col { width: 33%; }
.payroll-statement .payroll-amount-col { width: 17%; }
.payroll-statement th, .payroll-statement td { height: 27px; padding: 4px 7px; border: 1px solid #aebbb3; vertical-align: middle; overflow-wrap: anywhere; }
.payroll-statement thead th { padding-block: 8px; background: #eef4f0; font-size: 11px; font-weight: 650; text-align: center; white-space: nowrap; }
.payroll-statement th:nth-child(3), .payroll-statement td:nth-child(3) { border-left: 2px solid #8b9e92; }
.payroll-statement tbody tr:nth-child(even) { background: #fafcfb; }
.payroll-statement .payroll-row-number { color: #6d7e73; font-variant-numeric: tabular-nums; }
.payroll-statement .payroll-amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.payroll-statement .payroll-zero { color: #6d7e73; }
.payroll-statement tfoot th { text-align: center; }
.payroll-statement tfoot th, .payroll-statement tfoot td { padding-block: 7px; background: #f1f5f2; font-weight: 600; }
.payroll-statement .payroll-net-row td:empty { background: #fff; }
.payroll-statement .payroll-net-row th, .payroll-statement .payroll-net-row td:last-child { background: #e4f0e9; color: #14583f; font-weight: 700; border-bottom: 3px double #667f6e; }
.payroll-signature { width: 52%; margin: 30px 0 0 auto; text-align: center; break-inside: avoid; }
.payroll-signature p { margin: 5px 0; }
.payroll-help { display: flex; align-items: flex-start; justify-content: center; gap: 7px; margin: 18px 0 0; color: #60736a; font-size: 11px; }
.payroll-help .icon { width: 15px; height: 15px; margin-top: 2px; }

@media screen and (max-width: 1180px) {
	.payroll-metric { align-items: flex-start; flex-direction: column; padding: 16px; }
	.payroll-document { padding: 18px; }
	.payroll-slip { padding: 26px 22px; }
}
@media screen and (max-width: 800px) {
	.payroll-private { white-space: normal; }
	.payroll-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.payroll-filter-title, .payroll-filter button { grid-column: 1 / -1; }
	.payroll-scroll-hint { display: flex; align-items: center; gap: 6px; margin: -6px 0 12px; color: #60736a; font-size: 11px; }
	.payroll-scroll-hint .icon { width: 15px; height: 15px; }
}

@media (max-width: 600px) {
	.field-pair, .kp7-person, .menu-grid { grid-template-columns: 1fr; }
	.panel { padding: 16px; }
	.profile-panel { flex-wrap: wrap; }
	.profile-panel > .button { width: 100%; }
	.menu-card { padding: 16px; }
	.account-form > button { align-self: stretch; }
}

@media screen and (max-width: 600px) {
	.payroll-heading-icon { flex-basis: 44px; height: 44px; border-radius: 12px; }
	.payroll-heading-copy { gap: 10px; }
	.payroll-filter { padding: 16px; gap: 12px; }
	.payroll-summary { gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 20px; }
	.payroll-metric-net { grid-column: 1 / -1; flex-direction: row; align-items: center; }
	.payroll-metric strong { font-size: 21px; }
	.payroll-metric strong small { margin-left: 4px; }
	.payroll-document { padding: 12px; border-radius: 10px; }
	.payroll-screen-actions { flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
	.payroll-screen-actions button { width: 100%; }
	.payroll-slip { padding: 18px 12px; }
	.payroll-letterhead { gap: 10px; }
	.payroll-seal { width: 84px; height: 84px; }
	.payroll-letterhead strong { font-size: 11px; }
	.payroll-paper-head h2 { font-size: 16px; }
	.payroll-signature { width: 100%; font-size: 11px; }
}

/* ก.พ.7 paper-form view */
.kp7-paper { --kp7-ink: #1b1b1b; --kp7-fill: #1f3d8a; display: flex; flex-direction: column; gap: 24px; }
.kp7-sheet { max-width: 1000px; width: 100%; margin: 0 auto; padding: 36px 40px; border: 1px solid var(--line); border-radius: 4px; background: #fff; box-shadow: 0 4px 22px #24392b0d; color: var(--kp7-ink); font-size: 13px; line-height: 1.55; }
.kp7-title { margin: 18px 0 6px; font-size: 14px; font-weight: 600; text-align: center; }
.kp7-sheet > .kp7-title:first-child { margin-top: 0; }
.kp7-subtitle { margin: 18px 0 6px; font-size: 13px; font-weight: 600; }
.kp7-table { width: 100%; border-collapse: collapse; table-layout: fixed; border-top: 1.5px solid var(--kp7-ink); border-bottom: 1.5px solid var(--kp7-ink); }
.kp7-table th { padding: 6px 6px; border-bottom: 1.5px solid var(--kp7-ink); font-weight: 500; text-align: center; vertical-align: middle; line-height: 1.35; }
.kp7-table td { height: 25px; padding: 3px 6px; border-bottom: 1px dotted #6d6d6d; color: var(--kp7-fill); vertical-align: top; overflow-wrap: anywhere; }
.kp7-table th + th, .kp7-table td + td { border-left: 1px solid var(--kp7-ink); }
.kp7-table td small { display: block; color: #5a6a8f; font-size: 11px; }
.kp7-table .center { text-align: center; }
.kp7-table .num { text-align: right; white-space: nowrap; }
.kp7-table .kp7-gap { border-left-width: 1px; border-bottom: 0; }
.kp7-table td.kp7-gap + td, .kp7-table th.kp7-gap + th { border-left: 1px solid var(--kp7-ink); }
.kp7-line { flex: 1; min-width: 40px; min-height: 1.55em; padding: 0 6px; border-bottom: 1px dotted #6d6d6d; color: var(--kp7-fill); overflow-wrap: anywhere; }
.kp7-head { display: flex; align-items: flex-end; gap: 16px; margin: 34px 0 10px; font-size: 15px; font-weight: 500; }
.kp7-head > span { display: flex; align-items: flex-end; flex: 1; gap: 4px; }
.kp7-head > strong { margin-left: auto; font-weight: 500; white-space: nowrap; }
.kp7-fields { display: grid; grid-template-columns: 1.25fr 1fr 1fr; grid-template-rows: repeat(3, auto); grid-auto-flow: column; border-top: 1.5px solid var(--kp7-ink); border-bottom: 1.5px solid var(--kp7-ink); }
.kp7-field { display: flex; align-items: flex-end; gap: 6px; min-width: 0; padding: 8px 10px; border-bottom: 1px solid var(--kp7-ink); }
.kp7-field:nth-child(3n) { border-bottom: 0; }
.kp7-field:nth-child(n+4) { border-left: 1px solid var(--kp7-ink); }
.kp7-no { flex: 0 0 auto; min-width: 22px; }
.kp7-field > span:not(.kp7-line):not(.kp7-prefix):not(.kp7-row), .kp7-row > span:not(.kp7-line) { white-space: nowrap; }
.kp7-row .kp7-line { min-width: 0; }
.kp7-prefix { display: inline-flex; flex-direction: column; align-items: center; font-size: 11px; line-height: 1.25; color: #8a8a8a; }
.kp7-prefix .on { color: var(--kp7-fill); font-weight: 700; text-decoration: underline; }
.kp7-stack { flex-direction: column; align-items: stretch; gap: 4px; }
.kp7-row { display: flex; align-items: flex-end; gap: 6px; }
.kp7-paren { padding-left: 28px; }
.kp7-paren::before { content: "("; }
.kp7-paren::after { content: ")"; }
.kp7-learning-narrow { display: none; }
.kp7-table .kp7-group th { padding: 3px 6px; border-bottom: 1px solid var(--kp7-ink); background: #f4f6f5; font-weight: 600; }
.kp7-table tbody .kp7-group th { border-top: 1px solid var(--kp7-ink); }
.kp7-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 22px; }
.kp7-sign p { display: flex; align-items: flex-end; gap: 4px; margin: 0 0 8px; }
.kp7-sign p.center { justify-content: center; }
.kp7-foot { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 14px; margin-top: 18px; }
.kp7-foot > span:not(.kp7-no) { display: flex; align-items: flex-end; gap: 4px; flex: 1 1 150px; }
.kp7-foot > span.grow { flex: 2 1 260px; }
.kp7-table td.num small { white-space: normal; }
.kp7-scroll { overflow-x: auto; }

@media screen and (max-width: 760px) {
	.kp7-sheet { padding: 20px 14px; font-size: 12px; }
	.kp7-fields { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; }
	.kp7-field, .kp7-field:nth-child(3n) { border-bottom: 1px solid var(--kp7-ink); }
	.kp7-field:last-child { border-bottom: 0; }
	.kp7-field:nth-child(n+4) { border-left: 0; }
	.kp7-learning-wide { display: none; }
	.kp7-learning-narrow { display: table; }
	.kp7-positions { min-width: 640px; }
	.kp7-sign { grid-template-columns: 1fr; gap: 16px; }
	.kp7-head { flex-wrap: wrap; font-size: 13px; }
	.kp7-head > span { flex-basis: 100%; }
}

@media print {
	@page { size: A4 portrait; margin: 10mm; }
	body { background: #fff; font-size: 11px; }
	.topbar, .skip-link, .breadcrumb, .page-heading, .alert.note, .site-footer { display: none !important; }
	main { margin: 0; padding: 0; max-width: none; animation: none; }
	.payroll-page main { max-width: none; }
	.payroll-filter, .payroll-summary, .payroll-screen-actions, .payroll-scroll-hint, .payroll-help { display: none !important; }
	.payroll-document { padding: 0; border: 0; border-radius: 0; background: #fff; }
	.payroll-slip { width: 100%; max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; color: #000; font-size: 10pt; line-height: 1.35; }
	.payroll-paper-head { margin-bottom: 3mm; }
	.payroll-letterhead { margin-bottom: 2mm; }
	.payroll-seal { width: 28mm; height: 28mm; }
	.payroll-letterhead strong { font-size: 10pt; }
	.payroll-letterhead span { font-size: 9pt; color: #000; }
	.payroll-paper-head h2 { font-size: 14pt; }
	.payroll-period { margin-top: 1mm; font-size: 10pt; }
	.payroll-recipient, .payroll-intro { margin: 1mm 0; }
	.payroll-table-scroll { overflow: visible; margin-top: 2mm; }
	.payroll-statement { width: 100%; min-width: 0; color: #000; font-size: 9pt; line-height: 1.2; }
	.payroll-statement th, .payroll-statement td { height: 5mm; padding: 0.6mm 1.5mm; border: 0.2mm solid #333; }
	.payroll-statement thead th { padding-block: 1mm; font-size: 9pt; }
	.payroll-statement th:nth-child(3), .payroll-statement td:nth-child(3) { border-left: 0.3mm solid #333; }
	.payroll-statement thead th, .payroll-statement tbody tr:nth-child(even), .payroll-statement tfoot th, .payroll-statement tfoot td { background: #fff; }
	.payroll-statement .payroll-zero, .payroll-statement .payroll-row-number { color: #000; }
	.payroll-statement tfoot { display: table-row-group; }
	.payroll-statement tfoot th, .payroll-statement tfoot td { padding-block: 1mm; }
	.payroll-statement .payroll-net-row th, .payroll-statement .payroll-net-row td:last-child { color: #000; background: #fff; border-bottom: 0.6mm double #333; }
	.payroll-statement tr { break-inside: avoid; }
	.payroll-signature { width: 52%; margin-top: 8mm; font-size: 10pt; }
	.kp7-paper { gap: 0; }
	.kp7-sheet { max-width: none; padding: 0; border: 0; border-radius: 0; box-shadow: none; break-after: page; }
	.kp7-sheet:last-child { break-after: auto; }
	.kp7-table tr { break-inside: avoid; }
	.kp7-scroll { overflow: visible; }
	.kp7-learning-wide { display: table !important; }
	.kp7-learning-narrow { display: none !important; }
	.kp7-fields { grid-template-columns: 1.25fr 1fr 1fr !important; grid-template-rows: repeat(3, auto) !important; grid-auto-flow: column !important; }
	.kp7-table td { color: #000; }
	.kp7-table .kp7-group th { background: none; }
	.kp7-line { color: #000; }
	.kp7-sheet { font-size: 10.5px; line-height: 1.35; }
	.kp7-title { margin: 8px 0 3px; font-size: 11.5px; }
	.kp7-table th { padding: 2px 4px; }
	.kp7-table td { height: 17px; padding: 1px 4px; }
	.kp7-table td small { font-size: 9px; }
	.kp7-head { margin: 14px 0 4px; font-size: 12px; }
	.kp7-field { padding: 4px 6px; }
	.kp7-prefix { font-size: 9px; }
	.kp7-sign { margin-top: 10px; gap: 24px; }
	.kp7-sign p { margin-bottom: 3px; }
}

/* News: personal notices */
.nav-count { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 10px; background: #d08925; color: #fff; font-size: 11px; font-weight: 600; text-align: center; }
.news-list { display: flex; flex-direction: column; gap: 14px; }
.news-item { display: flex; gap: 14px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.news-item.notice { border-left: 4px solid #d08925; background: #fffaf0; }
.news-icon { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 8px; background: #faf0da; color: #ac8638; }
.news-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.news-copy h2 { margin: 0; font-size: 16px; }
.news-copy p { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.news-tag { color: #a8650f; font-size: 11px; font-weight: 600; }
.news-copy .text-link { align-self: flex-start; }
.news-board { display: flex; flex-direction: column; gap: 14px; margin-bottom: 22px; }
.news-board > h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; }
.news-board > h2 .icon { width: 18px; height: 18px; color: var(--accent); }
.news-item.announce { border-left: 4px solid var(--accent); }
.news-item.announce.fresh { background: #f3faf6; }
.news-item.announce .news-icon { background: var(--accent-soft); color: var(--accent); }
.news-body { white-space: pre-wrap; }
.news-meta { color: var(--muted); font-size: 12px; }
.news-new { display: inline-flex; margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; vertical-align: 1px; }
.news-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.news-photos a { flex: 1 1 160px; max-width: 240px; }
.news-photos img { width: 100%; height: 140px; object-fit: cover; border-radius: 6px; background: #eef3f0; }

.profile-copy > .profile-affiliation { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; color: var(--ink); font-size: 13px; }
.profile-affiliation > .icon { width: 15px; height: 15px; color: var(--accent); }
.profile-affiliation > span:first-of-type { color: var(--muted); }
.profile-affiliation strong { font-weight: 600; }

/* ลายมือชื่ออิเล็กทรอนิกส์ */
.sig-steps { margin: 0; padding-left: 20px; color: var(--ink); font-size: 13px; line-height: 1.8; }
.sig-code { max-width: 220px; font-size: 22px !important; font-weight: 600; letter-spacing: 6px; text-align: center; font-variant-numeric: tabular-nums; }
.sig-claim > button, .sig-waiting form button { align-self: flex-start; }
.sig-device { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; background: #f7faf8; }
.sig-device div { display: flex; flex-direction: column; }
.sig-device strong { font-size: 15px; }
.sig-device small { font-size: 12px; }
.sig-pulse { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: sig-pulse 1.4s ease-out infinite; }
@keyframes sig-pulse { 0% { box-shadow: 0 0 0 0 rgba(23, 107, 82, .45); } 100% { box-shadow: 0 0 0 12px rgba(23, 107, 82, 0); } }
@media (prefers-reduced-motion: reduce) { .sig-pulse { animation: none; } }
.sig-preview { display: grid; place-items: center; min-height: 150px; padding: 18px; border: 1px dashed #c9d6cf; border-radius: 6px;
	background: linear-gradient(transparent calc(100% - 38px), #b9c6bf calc(100% - 38px), #b9c6bf calc(100% - 37px), transparent calc(100% - 37px)), #fff; }
.sig-preview .signature-img { max-width: 100%; max-height: 140px; }
.danger-text { color: var(--danger) !important; }
/* Signature drawn over a dotted "ลงชื่อ" line; absolutely placed so the line keeps its height on paper */
.sig-on-line { position: relative; }
.sig-on-line .signature-img { position: absolute; left: 50%; bottom: -0.45em; height: 2.8em; max-width: 100%; transform: translateX(-50%); object-fit: contain; pointer-events: none; }
/* Signing in the browser (iPad + Apple Pencil, phone, mouse) */
.sig-pad { position: relative; width: 100%; max-width: 760px; aspect-ratio: 936 / 474; border: 1px solid #c9d6cf; border-radius: 8px; background: #fff;
	touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overflow: hidden; }
.sig-pad::after { content: ""; position: absolute; left: 7%; right: 4%; bottom: 22%; border-bottom: 1px dashed #b9c6bf; pointer-events: none; }
.sig-pad canvas { position: relative; z-index: 1; display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.sig-pad-x { position: absolute; left: 3%; bottom: 23%; color: #b9c6bf; font-size: 18px; pointer-events: none; }
.sig-pad-hint { position: absolute; inset: 0 0 auto; padding-top: 18%; color: #a3b1aa; font-size: 15px; text-align: center; pointer-events: none; }
.sig-draw-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.sig-draw-actions button { min-height: 44px; }
.sig-draw-actions [data-sig-save] { margin-left: auto; }
/* "เซ็นที่นี่" on an empty ลงชื่อ line of a document; never printed */
.sig-here { position: absolute; left: 50%; bottom: 2px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border: 1px solid var(--accent); border-radius: 999px;
	background: #fff; color: var(--accent); font-size: 12px; font-weight: 600; line-height: 1.4; text-decoration: none; white-space: nowrap; transform: translateX(-50%); }
.sig-here:hover, .sig-here:focus-visible { background: var(--accent); color: #fff; }
.sig-here .icon { width: 13px; height: 13px; }
@media print { .sig-here { display: none !important; } }
.sig-draw-actions button:disabled { cursor: not-allowed; }
/* Beside an existing signature: small, at the line's right end so the signature stays visible */
.sig-here.sig-redo { left: auto; right: 0; bottom: 3px; padding: 1px 8px; font-size: 11px; font-weight: 500; background: rgba(255, 255, 255, .92); transform: none; z-index: 1; }
/* Empty ลงชื่อ line of your own document: choose stored signature or sign live (screen only) */
.sig-choices { position: absolute; left: 50%; bottom: 2px; display: flex; gap: 6px; white-space: nowrap; transform: translateX(-50%); z-index: 1; }
.sig-choices .sig-here { position: static; transform: none; }
.sig-options { display: grid; gap: 22px; }
.sig-option .sig-preview { max-width: 520px; }
.sig-current-doc .sig-preview { max-width: 520px; min-height: 110px; }
@media print { .sig-choices { display: none !important; } }
@media print { .alert { display: none !important; } }
/* Signing popup on documents (buttons on the ลงชื่อ line are <button>s: undo the global button look) */
button.sig-here { min-height: 0; gap: 4px; padding: 3px 10px; border: 1px solid var(--accent); border-radius: 999px; background: #fff; color: var(--accent); font-size: 12px; font-weight: 600; line-height: 1.4; }
button.sig-here:hover, button.sig-here:focus-visible { background: var(--accent); color: #fff; }
button.sig-here.sig-redo { padding: 1px 8px; font-size: 11px; font-weight: 500; background: rgba(255, 255, 255, .92); }
button.sig-here.sig-redo:hover { background: var(--accent); }
.sig-just-signed .signature-img { animation: sig-pop .5s ease-out; }
@keyframes sig-pop { from { opacity: 0; transform: translateX(-50%) scale(.9); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
@media (prefers-reduced-motion: reduce) { .sig-just-signed .signature-img { animation: none; } }
.sig-dialog { width: min(820px, 96vw); max-height: 96vh; padding: 0; border: 0; border-radius: 12px; box-shadow: 0 20px 60px rgba(16, 40, 32, .3); color: var(--ink); }
.sig-dialog::backdrop { background: rgba(20, 32, 28, .55); }
.sig-dialog-body { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px 22px; }
.sig-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sig-dialog-head h2 { margin: 0; font-size: 18px; }
.sig-dialog-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.sig-dialog .sig-pad { max-width: none; }
.sig-dialog-change { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.sig-dialog-change[hidden] { display: none; }

/* Staff chat: the frame stays inside the screen; lists and messages scroll inside it */
.chat-page { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.chat-page .topbar { flex: 0 0 auto; }
.chat-page main { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.chat-page .breadcrumb, .chat-page .page-heading, .chat-page .alert, .chat-page .site-footer { flex: 0 0 auto; }
.chat-page .site-footer { margin-top: 12px; }
.chat-shell { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); flex: 1 1 auto; min-height: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.chat-side { min-height: 0; overflow-x: hidden; overflow-y: auto; border-right: 1px solid var(--line); background: #fbfcfb; }
.chat-side section { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.chat-side section + section { border-top: 1px solid var(--line); }
.chat-side h2 { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.chat-side h2 > .icon { color: var(--accent); }
.chat-threads, .chat-people { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.chat-thread, .chat-person { display: flex; gap: 8px; align-items: center; min-width: 0; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.chat-person { flex-direction: column; align-items: flex-start; gap: 0; }
.chat-thread:hover, .chat-person:hover { background: #f4f7f5; }
.chat-thread.active, .chat-person.active { background: var(--accent-soft); color: var(--accent); }
.chat-thread-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.chat-thread strong, .chat-person strong { font-size: 13px; font-weight: 600; }
.chat-preview { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread.active .chat-preview, .chat-person small { color: var(--muted); font-size: 11px; }
.chat-thread-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.chat-thread-meta .nav-count { margin-left: 0; }
.chat-thread-meta time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: #fff; }
.chat-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 100%; padding: 32px; text-align: center; }
.chat-placeholder > .icon { width: 36px; height: 36px; color: var(--accent); }
.chat-placeholder h2 { font-size: 16px; }
.chat-with { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-with strong, .chat-with span { display: block; }
.chat-with span { color: var(--muted); font-size: 12px; }
.chat-back { display: none; }
.chat-log { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 16px; background: #f6f8f7; }
.chat-bubble { align-self: flex-start; max-width: min(78%, 520px); padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; background: #fff; }
.chat-bubble.mine { align-self: flex-end; border-color: #d2e5db; border-radius: 12px 12px 4px 12px; background: var(--accent-soft); }
.chat-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-bubble.sticker { padding: 2px 4px; border-color: transparent; background: transparent; }
.chat-bubble.sticker.mine { border-color: transparent; background: transparent; }
.chat-sticker-text { font-size: 64px; line-height: 1.15; letter-spacing: 2px; }
.chat-inline-icon { width: 1.15em; height: 1.15em; margin: 0 1px; vertical-align: -3px; }
.chat-bubble time { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.chat-bubble.mine time { text-align: right; }
.chat-file { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; font-weight: 600; text-decoration: none; }
.chat-file img { display: block; width: 100%; max-width: 220px; max-height: 180px; border-radius: 8px; object-fit: cover; }
.chat-file small { display: block; color: var(--muted); font-weight: 400; }
.chat-file.expired { color: var(--muted); font-weight: 500; }
.chat-compose { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--line); }
.chat-field { position: relative; border-radius: 6px; background: #fff; }
.chat-field textarea { position: relative; z-index: 1; min-height: 72px; color: transparent; caret-color: var(--ink); background: transparent; line-height: 1.5; }
.chat-field textarea::placeholder { color: #929c98; }
.chat-body-preview { position: absolute; z-index: 0; inset: 1px; overflow: hidden; padding: 10px 12px; color: var(--ink); font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; pointer-events: none; }
.chat-compose-row { display: flex; align-items: center; gap: 10px; }
.chat-compose-row input[type=file] { flex: 1; min-width: 0; }
.chat-compose-row button[type=submit] { flex: 0 0 auto; }
.chat-picker { display: flex; flex-direction: column; gap: 8px; max-height: 240px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: auto; }
.chat-symbol-tabs { display: flex; gap: 6px; position: sticky; top: -10px; z-index: 1; margin: -10px -10px 0; padding: 10px; background: #fff; }
.chat-symbol-tabs button { flex: 1; min-height: 32px; padding: 4px 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 12px; font-weight: 600; }
.chat-symbol-tabs button:hover { background: #f0f4f2; color: var(--ink); }
.chat-symbol-tabs button[aria-selected="true"], .chat-symbol-tabs button[aria-selected="true"]:hover { border-color: #d2e5db; background: var(--accent-soft); color: var(--accent); }
.chat-symbol-label { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.chat-symbol-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
button.chat-symbol { min-height: 36px; padding: 2px; border: 0; background: transparent; color: inherit; font-size: 22px; font-weight: 400; line-height: 1; }
button.chat-symbol:hover { background: #f0f4f2; }
.chat-icon-grid button.chat-symbol { color: var(--accent); }
.chat-icon-grid .icon { width: 20px; height: 20px; }
.chat-sticker-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
button.chat-sticker-button { flex-direction: column; gap: 2px; min-height: 76px; border-radius: 10px; font-size: 34px; }
button.chat-sticker-button small { color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.3; }
@media (max-width: 800px) {
    .chat-symbol-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .chat-sticker-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .chat-sticker-text { font-size: 52px; }
}
.chat-form-error { margin: 0; color: var(--danger); font-size: 12px; }
.chat-closed { margin: 0; padding: 14px 16px; }
@media (max-width: 800px) {
    .chat-shell { display: flex; flex-direction: column; }
    .chat-shell.is-open .chat-side { display: none; }
    .chat-shell:not(.is-open) .chat-main { display: none; }
    .chat-shell.is-open .chat-main, .chat-shell:not(.is-open) .chat-side { flex: 1 1 auto; min-height: 0; }
    .chat-back { display: inline-flex; }
    .chat-side { border-right: 0; }
}
