/* Loan & Share Management System — prototype design tokens + components */
:root {
  --navy: #163a63;
  --blue: #2563eb;
  --blue-h: #1d4ed8;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --line: #eef2f6;
  --text: #172b4d;
  --muted: #64748b;
  --success: #15803d;
  --warning: #b7791f;
  --danger: #c53030;
  --success-bg: #ecf7ef;
  --warning-bg: #fdf5e6;
  --warning-ink: #8a5a12;
  --danger-bg: #fcefef;
  --info-bg: #edf3fe;
  --neutral-bg: #f1f5f9;
  --radius: 10px;
  --gap: 16px;
  --side: 240px;
  --top: 72px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'IBM Plex Sans Thai', system-ui, -apple-system, sans-serif; font-size: 14px; line-height: 1.55; color: var(--text); background: var(--bg); }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-h); text-decoration: underline; }
h1, h2, h3 { margin: 0; }
code { font-size: 12.5px; background: var(--neutral-bg); padding: 1px 5px; border-radius: 4px; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 16px; height: 16px; }
.ic.xs { width: 14px; height: 14px; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pre { white-space: pre-line; }
.nowrap { white-space: nowrap; }
.t-success { color: var(--success); }
.t-warning { color: var(--warning-ink); }
.t-danger { color: var(--danger); }
.t-muted { color: var(--muted); }

/* ---------- Shell ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--navy); color: #c7d3e3; display: flex; flex-direction: column; z-index: 40; }
.brand { height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); flex: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: #fff; color: var(--navy); display: grid; place-items: center; font-weight: 600; font-size: 13px; letter-spacing: 0.02em; flex: none; }
.brand-name { color: #fff; font-weight: 600; font-size: 14px; line-height: 1.3; }
.brand-sub { font-size: 11px; color: #93a8c3; }
.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav a, .nav .nav-group { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 7px 10px; border-radius: 6px; color: #c7d3e3; background: none; border: 0; cursor: pointer; text-align: left; font-size: 14px; text-decoration: none; }
.nav a:hover, .nav .nav-group:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, 0.13); color: #fff; font-weight: 500; }
.nav .nav-group.has-active { color: #fff; }
.nav .caret { margin-left: auto; transition: transform 0.15s; opacity: 0.7; }
.nav-grp:not(.open) .caret { transform: rotate(-90deg); }
.nav-grp:not(.open) .nav-sub { display: none; }
.nav-sub a { padding-left: 38px; font-size: 13.5px; min-height: 34px; }
.nav-count { margin-left: auto; background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 11px; line-height: 18px; padding: 0 6px; border-radius: 9px; min-width: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.nav-count.danger { background: #b83232; }
.nav-count.warn { background: #9a6a1a; }
.sidebar-foot { padding: 12px 18px; font-size: 11.5px; color: #93a8c3; border-top: 1px solid rgba(255, 255, 255, 0.08); line-height: 1.45; }
.sidebar-foot b { color: #e3ebf5; font-weight: 500; }
.scrim { display: none; }
.main-col { margin-left: var(--side); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: var(--top); position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 24px; }
.tb-title { min-width: 0; flex: 1; }
.crumbs { font-size: 12px; color: var(--muted); display: flex; gap: 4px; align-items: center; white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--muted); }
.crumbs .ic { opacity: 0.6; }
.tb-h { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.4; }
.tb-search { position: relative; width: 340px; }
.tb-search .search-field { position: relative; }
.tb-search input { width: 100%; height: 38px; padding: 0 44px 0 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.tb-search input:focus { outline: 2px solid #bfd3fb; border-color: var(--blue); background: #fff; }
.tb-search .search-field > .ic { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.kbd { position: absolute; right: 10px; top: 9px; font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; background: #fff; }
.tb-search .search-close { display: none; }
.search-pop { position: absolute; top: 46px; left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1); max-height: 440px; overflow: auto; padding: 6px; z-index: 60; }
.sr-group { font-size: 11.5px; color: var(--muted); padding: 8px 10px 4px; font-weight: 500; }
.sr-item { display: flex; flex-direction: column; padding: 7px 10px; border-radius: 6px; color: var(--text); }
.sr-item:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.sr-item small { color: var(--muted); font-size: 12px; }
.icon-btn { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 8px; background: #fff; display: grid; place-items: center; cursor: pointer; position: relative; color: var(--text); flex: none; }
.icon-btn:hover { background: var(--bg); }
.icon-btn .dot { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.only-mobile { display: none !important; }
.tb-menu { position: relative; }
.profile-btn { display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; padding: 4px 6px; border-radius: 8px; text-align: left; }
.profile-btn:hover { background: var(--bg); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #e6ecf5; color: var(--navy); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.profile-text { display: flex; flex-direction: column; line-height: 1.3; max-width: 170px; }
.profile-text b { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-text span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.proto-tag { font-size: 11px; color: var(--warning-ink); background: var(--warning-bg); border: 1px solid #f1dfba; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.content { flex: 1; width: 100%; max-width: 1600px; margin: 0 auto; padding: 24px; min-width: 0; }

/* ---------- Menus ---------- */
.menu { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1); min-width: 260px; padding: 6px; z-index: 60; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu-head.row { flex-direction: row; justify-content: space-between; align-items: center; }
.menu-head span { font-size: 12px; color: var(--muted); }
.menu-label { font-size: 11.5px; color: var(--muted); padding: 6px 10px 2px; }
.menu-item { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; font-size: 13.5px; color: var(--text); }
.menu-item:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.menu-item small { display: block; font-size: 11.5px; color: var(--muted); }
.menu-item.on { color: var(--blue); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }
#bell-menu { width: 360px; }
.menu-notif { display: flex; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 6px; text-align: left; cursor: pointer; }
.menu-notif:hover { background: var(--bg); }
.menu-notif span:last-child { display: flex; flex-direction: column; min-width: 0; }
.menu-notif b { font-weight: 500; font-size: 13px; }
.menu-notif small { font-size: 12px; color: var(--muted); }
.menu-foot { display: block; text-align: center; padding: 8px; border-top: 1px solid var(--line); margin-top: 4px; font-size: 13px; }
.ndot { width: 8px; height: 8px; border-radius: 50%; background: transparent; margin-top: 7px; flex: none; }
.unread .ndot { background: var(--blue); }

/* ---------- Page ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.ph-text { min-width: 0; flex: 1 1 320px; }
.page-title { font-size: 26px; font-weight: 600; line-height: 1.35; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-title .badge { font-size: 12.5px; }
.title-sub { font-size: 18px; font-weight: 400; color: var(--muted); }
.page-sub { color: var(--muted); margin: 4px 0 0; }
.ph-actions, .quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: var(--gap); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--border); min-height: 54px; flex-wrap: wrap; }
.card-t { font-size: 16px; font-weight: 600; }
.card-b { padding: 16px 18px; }
.card-foot { padding: 10px 18px; border-top: 1px solid var(--line); text-align: center; }
.pad { padding: 18px; }
.sub-t { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-label { font-size: 13px; font-weight: 600; color: var(--navy); padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }

/* KPI */
.kpi { display: block; padding: 16px 18px; color: var(--text); text-align: left; cursor: pointer; transition: border-color 0.15s; font: inherit; width: 100%; }
.kpi:hover { border-color: #a9bcd6; text-decoration: none; color: var(--text); }
.kpi.on { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.kpi-l { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kpi-v { font-size: 32px; font-weight: 600; line-height: 1.25; margin: 8px 0 4px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-v small { font-size: 15px; font-weight: 500; color: var(--muted); }
.kpi-sm .kpi-v { font-size: 24px; margin: 6px 0 2px; }
.kpi-c { font-size: 12px; color: var(--muted); line-height: 1.5; }
.stat { padding: 14px 16px; }
.stat-v { font-size: 22px; font-weight: 600; margin: 4px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-strip { display: flex; flex-wrap: wrap; gap: 0; }
.summary-strip > div { flex: 1 1 160px; padding: 12px 18px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip span { font-size: 12px; color: var(--muted); }
.summary-strip b { font-size: 18px; font-weight: 600; }
.wizard .summary-strip, .tab-body .summary-strip { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 14px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-weight: 500; cursor: pointer; white-space: nowrap; color: var(--text); font-size: 14px; text-decoration: none; }
.btn:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-h); border-color: var(--blue-h); color: #fff; }
.btn-danger { color: var(--danger); border-color: #efc7c7; }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #a82828; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-act { width: 32px; height: 32px; border: 1px solid transparent; border-radius: 7px; background: transparent; display: inline-grid; place-items: center; color: var(--muted); cursor: pointer; vertical-align: middle; }
.icon-act:hover { background: var(--neutral-bg); color: var(--text); border-color: var(--border); }
.icon-act.t-success { color: var(--success); }
.link-btn { border: 0; background: none; padding: 0; color: var(--blue); cursor: pointer; font-size: inherit; }
.link-btn:hover { text-decoration: underline; color: var(--blue-h); }
:focus-visible { outline: 2px solid #8fb2f8; outline-offset: 1px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 22px; vertical-align: middle; }
.b-success { background: var(--success-bg); color: var(--success); }
.b-warning { background: var(--warning-bg); color: var(--warning-ink); }
.b-danger { background: var(--danger-bg); color: var(--danger); }
.b-info { background: var(--info-bg); color: var(--blue-h); }
.b-neutral { background: var(--neutral-bg); color: #475569; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 10px 14px; background: #fafbfd; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:not(.empty-row):hover { background: #fafbfd; }
.tbl .r { text-align: right; }
.tbl .c { text-align: center; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }
.sort-ind { margin-left: 4px; font-size: 10px; opacity: 0.45; }
.sort-ind.on { opacity: 1; color: var(--blue); }
.tbl tfoot td { font-weight: 600; background: #fafbfd; border-top: 1px solid var(--border); }
.tbl tr.row-danger td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.tbl tr.row-current td { background: #f7faff; }
.td-actions { text-align: right; white-space: nowrap; }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 12px; color: var(--muted); line-height: 1.45; }
.tx-type { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ev { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); white-space: nowrap; }
.empty-row td { padding: 0; }
.schedule-wrap { max-height: 460px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.schedule-wrap th { position: sticky; top: 0; }
.tbl.report td, .tbl.report th { white-space: nowrap; }
.tbl.perm td { padding: 8px 14px; }

/* Toolbar & filters */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.search-box { position: relative; flex: 1 1 240px; max-width: 360px; }
.search-box .ic { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.search-box .input { width: 100%; padding-left: 34px; }
.input, .select { height: 38px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; background: #fff; min-width: 0; max-width: 100%; }
.select { padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.select-sm { height: 32px; font-size: 13px; }
textarea.input { height: auto; padding: 8px 12px; min-height: 64px; resize: vertical; }
.input:focus, .select:focus { outline: 2px solid #bfd3fb; outline-offset: 0; border-color: var(--blue); }
.input:disabled, .select:disabled { background: var(--neutral-bg); color: var(--muted); }
.input.readonly { display: flex; align-items: center; background: var(--neutral-bg); color: var(--muted); }
.input.file { padding: 6px 10px; height: auto; }
.date-f { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.date-f .input, .date-f .select { height: 36px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-btn { border: 0; background: #fff; padding: 0 10px; height: 34px; cursor: pointer; font-size: 13px; border-right: 1px solid var(--border); }
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { background: var(--bg); }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); gap: 10px; flex-wrap: wrap; }
.pg-btns { display: flex; gap: 4px; align-items: center; }
.pg-btn { min-width: 32px; height: 32px; padding: 0 6px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.pg-btn:hover:not(:disabled) { background: var(--bg); }
.pg-btn.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pg-gap { padding: 0 2px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid .full, .form-grid > .alert { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 500; }
.field-label em { color: var(--danger); font-style: normal; margin-left: 2px; }
.field-hint { font-size: 12px; color: var(--muted); }
.field-error { font-size: 12px; color: var(--danger); }
.field-error:empty { display: none; }
.invalid { border-color: var(--danger) !important; }
.input-affix { position: relative; display: flex; }
.input-affix .input { width: 100%; padding-right: 48px; text-align: right; }
.input-affix span { position: absolute; right: 12px; top: 9px; color: var(--muted); font-size: 13px; pointer-events: none; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--blue); flex: none; }
.radio-cards { display: grid; gap: 8px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--blue); background: #f6f9ff; }
.radio-card input { margin-top: 4px; accent-color: var(--blue); }
.radio-card span { display: flex; flex-direction: column; }
.radio-card small { color: var(--muted); font-size: 12px; }
.form-foot { display: flex; justify-content: flex-end; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.pay-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.pay-info > div { background: #fafbfd; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pay-info span { font-size: 11.5px; color: var(--muted); }
.pay-info b { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.confirm-msg { margin: 0 0 14px; line-height: 1.65; }

/* Alerts */
.alert { display: flex; gap: 10px; padding: 10px 14px; border-radius: 8px; font-size: 13px; border: 1px solid; line-height: 1.6; align-items: flex-start; }
.alert > .ic { margin-top: 2px; }
.alert-info { background: #f2f6fe; border-color: #d6e2fa; color: #1e3a6e; }
.alert-warn { background: #fef9ef; border-color: #f2e0b9; color: #6e4a10; }
.alert-danger { background: #fdf2f2; border-color: #f2cccc; color: #962828; }
.form-alert { margin-bottom: 14px; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; padding: 0 10px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 13px 12px 11px; border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--blue); border-bottom-color: var(--blue); }
.tab-cnt { font-size: 11px; background: var(--neutral-bg); color: var(--muted); border-radius: 9px; padding: 0 6px; line-height: 18px; font-variant-numeric: tabular-nums; }
.tab.on .tab-cnt { background: var(--info-bg); color: var(--blue-h); }
.tab-body { min-height: 120px; }
.tab-tools { display: flex; justify-content: flex-end; padding: 12px 18px 0; min-height: 12px; }

/* Misc components */
.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 9px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.bar { height: 6px; background: #e9eef5; border-radius: 3px; overflow: hidden; margin-top: 6px; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--blue); }
.bar-success > i { background: var(--success); }
.bar-danger > i { background: var(--danger); }
.progress-box { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.fu-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-size: 13px; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty.small { padding: 18px; font-size: 13px; }
.empty-t { font-weight: 600; color: var(--text); margin-bottom: 4px; font-size: 14.5px; }
.empty-a { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.alist { list-style: none; margin: 0; padding: 0; }
.alist li { display: flex; gap: 12px; align-items: center; padding: 10px 18px 10px 14px; border-bottom: 1px solid var(--line); }
.alist li:last-child { border-bottom: 0; }
.a-mark { width: 3px; align-self: stretch; border-radius: 2px; background: var(--border); flex: none; }
.a-mark.t-danger { background: var(--danger); }
.a-mark.t-warning { background: var(--warning); }
.a-mark.t-info { background: var(--blue); }
.a-main { flex: 1; min-width: 0; }
.a-kind { font-size: 11.5px; color: var(--muted); }
.a-title { font-weight: 500; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-sub { font-size: 12px; color: var(--muted); }
.a-side { display: flex; align-items: center; gap: 10px; flex: none; }
.a-amt { font-weight: 600; font-size: 14px; }
.chart-box { position: relative; width: 100%; }
.chart-note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.chart-error { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--border); border-radius: 8px; padding: 16px; }
.chart-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: center; }
.legend-list { display: flex; flex-direction: column; gap: 8px; }
.lg-row { display: grid; grid-template-columns: 10px 1fr auto 40px; gap: 8px; align-items: center; font-size: 13px; }
.lg-dot { width: 10px; height: 10px; border-radius: 2px; }
.lg-v { font-weight: 600; text-align: right; }
.lg-p { color: var(--muted); text-align: right; font-size: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline.pad { padding: 14px 18px; }
.timeline li { position: relative; padding: 0 0 14px 16px; border-left: 1px solid var(--border); margin-left: 4px; font-size: 13.5px; }
.timeline li::before { content: ''; position: absolute; left: -4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: #b5c3d6; }
.timeline li:last-child { padding-bottom: 0; }
.tl-meta { font-size: 12px; color: var(--muted); margin-bottom: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.doc-list { list-style: none; margin: 0; padding: 8px 18px; }
.doc-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.doc-list .doc-row:last-child { border-bottom: 0; }
.doc-row span { display: flex; flex-direction: column; min-width: 0; }
.doc-row small { font-size: 12px; color: var(--muted); }
.evidence-img { max-width: 100%; max-height: 260px; border: 1px solid var(--border); border-radius: 8px; display: block; margin-bottom: 6px; }
.tx-amount { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 16px; }
.tx-amount b { font-size: 26px; font-weight: 600; }
.tx-amount.in b { color: var(--success); }
.tx-amount span { color: var(--muted); }
.check-strip { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.check-strip > div { flex: 1 1 140px; padding: 12px 18px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.check-strip > div:last-child { border-right: 0; }
.check-strip span { font-size: 12px; color: var(--muted); }
.check-strip b { font-size: 16px; }
.payout-box { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: #fafbfd; }
.payout-box.ready { background: #fbf8ef; }
.payout-box .sub-t { margin-bottom: 2px; }
.nlist { list-style: none; margin: 0; padding: 0; }
.nlist li { display: flex; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.nlist li.unread { background: #f8fbff; }
.nlist li.resolved { opacity: 0.75; }
.n-main { flex: 1; min-width: 0; }
.n-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 3px; }
.n-title { font-weight: 500; color: var(--text); }
.n-detail { font-size: 13px; color: var(--muted); }
.n-acts { display: flex; gap: 4px; align-items: center; flex: none; }
.channel { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* Wizard */
.steps { display: flex; list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
.step { flex: 1; display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 2px solid transparent; color: var(--muted); white-space: nowrap; margin-bottom: -1px; font-weight: 500; }
.step.on { border-color: var(--blue); color: var(--text); }
.step.done { color: var(--success); }
.step-n { width: 24px; height: 24px; border-radius: 50%; border: 1px solid currentColor; display: grid; place-items: center; font-size: 12px; flex: none; }
.step.on .step-n { background: var(--blue); border-color: var(--blue); color: #fff; }
.wiz-body { padding: 20px; }
.wiz-tools { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.wiz-ctx { margin-bottom: 16px; padding: 10px 14px; background: var(--bg); border-radius: 8px; }
.wiz-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pick { border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 10px 12px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.pick:hover { border-color: #a9bcd6; }
.pick.on { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); background: #f6f9ff; }
.pick small { color: var(--muted); font-size: 12px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; animation: fade 0.12s ease-out; }
.modal-bg.out { opacity: 0; transition: opacity 0.12s; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2); }
.modal.lg { max-width: 780px; }
.modal.sm { max-width: 440px; }
.modal-h { padding: 14px 18px 14px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-t { font-size: 17px; font-weight: 600; }
.modal-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.modal-b { padding: 18px 20px; overflow-y: auto; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Toast */
#toast-root { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: calc(100vw - 32px); }
.toast { background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--success); border-radius: 8px; padding: 10px 10px 10px 12px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12); font-size: 13.5px; width: 380px; max-width: 100%; display: flex; gap: 10px; align-items: flex-start; animation: tin 0.18s ease-out; }
.toast > div { flex: 1; }
.toast > .ic { color: var(--success); margin-top: 2px; }
.toast.t-danger { border-left-color: var(--danger); }
.toast.t-danger > .ic { color: var(--danger); }
.toast.t-info { border-left-color: var(--blue); }
.toast.t-info > .ic { color: var(--blue); }
.toast.out { opacity: 0; transform: translateY(6px); transition: all 0.18s; }
.toast-x { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Skeleton / error */
.sk { background: #e9eef5; border-radius: 6px; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.error-state { border-color: #f2cccc; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 440px; }
.login-card .card-b { padding: 24px; }
.login-brand { display: flex; gap: 12px; align-items: center; }
.login-brand .brand-mark { background: var(--navy); color: #fff; }
.login-name { font-weight: 600; font-size: 17px; }

/* ---------- Responsive ---------- */
@media (max-width: 1439px) {
  .g-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tb-search { width: 280px; }
  .kpi-v { font-size: 30px; }
}
@media (max-width: 1199px) {
  .g-12 > .span-4, .g-12 > .span-5, .g-12 > .span-6, .g-12 > .span-7, .g-12 > .span-8 { grid-column: 1 / -1; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-text { display: none; }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: none; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(15, 23, 42, 0.25); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); z-index: 35; }
  .main-col { margin-left: 0; }
  .only-mobile { display: grid !important; }
  .topbar { padding: 0 16px; gap: 10px; height: 64px; }
  .tb-search { display: none; }
  body.search-open .tb-search { display: block; position: fixed; left: 0; right: 0; top: 0; width: auto; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--border); z-index: 70; }
  body.search-open .tb-search input { height: 42px; padding-right: 48px; }
  body.search-open .tb-search .search-field > .ic { top: 13px; }
  body.search-open .search-pop { top: 62px; left: 16px; right: 16px; max-height: calc(100vh - 90px); }
  body.search-open .kbd { display: none; }
  body.search-open .tb-search .search-close { display: grid; position: absolute; right: 4px; top: 4px; border: 0; width: 34px; height: 34px; }
  .proto-tag { display: none; }
  .content { padding: 16px; }
  .g-3 { grid-template-columns: 1fr; }
  .g-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 719px) {
  .page-title { font-size: 22px; }
  .page-head { margin-bottom: 16px; }
  .ph-actions, .quick-actions { width: 100%; }
  .quick-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .quick-actions .btn { white-space: normal; height: auto; min-height: 38px; padding: 6px 10px; line-height: 1.3; }
  .ph-actions .btn { flex: 1 1 auto; }
  .kpi-v { font-size: 28px; }
  .kpi-sm .kpi-v, .stat-v { font-size: 20px; }
  .g-4, .g-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat, .kpi { padding: 12px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dt { margin-top: 8px; font-size: 12px; }
  .chart-split { grid-template-columns: 1fr; }
  .search-box { max-width: none; flex-basis: 100%; }
  .toolbar { padding: 12px 14px; }
  .toolbar > .select, .toolbar > .date-f { flex: 1 1 140px; }
  .date-f .input { flex: 1; min-width: 0; }
  .summary-strip > div { flex: 1 1 45%; border-bottom: 1px solid var(--line); }
  .card-h, .card-b, .pad { padding-left: 14px; padding-right: 14px; }
  .alist li { padding: 10px 14px 10px 10px; flex-wrap: wrap; }
  .a-side { width: 100%; justify-content: space-between; padding-left: 15px; }
  /* tables → list cards */
  .tbl.cardable thead { display: none; }
  .tbl.cardable, .tbl.cardable tbody, .tbl.cardable tr, .tbl.cardable td { display: block; width: 100%; }
  .tbl.cardable tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .tbl.cardable tr:last-child { border-bottom: 0; }
  .tbl.cardable td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .tbl.cardable td > * { min-width: 0; }
  .tbl.cardable td.td-actions > .cv { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .tbl.cardable td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; padding-top: 1px; }
  .tbl.cardable td[data-label='']::before { display: none; }
  .tbl.cardable td.td-primary { display: block; text-align: left; font-size: 14.5px; padding-bottom: 4px; }
  .tbl.cardable td.td-primary::before { display: none; }
  .tbl.cardable td.td-actions { justify-content: flex-end; padding-top: 6px; }
  .tbl.cardable tr.empty-row { padding: 0; }
  .tbl.cardable tr.empty-row td { display: block; text-align: center; }
  .tbl.cardable tr.empty-row td::before { display: none; }
  .tbl.cardable tr.row-danger { box-shadow: inset 3px 0 0 var(--danger); }
  .tbl.cardable tr.row-danger td:first-child { box-shadow: none; }
  .tbl.cardable .bar { width: 90px; }
  .tbl.cardable tfoot { display: block; }
  .pagination { padding: 10px 14px; }
  .nlist li { flex-wrap: wrap; padding: 12px 14px; }
  .n-acts { width: 100%; justify-content: flex-end; }
  .wiz-body { padding: 14px; }
  .step { padding: 12px; }
  .step span:last-child { display: none; }
  .step.on span:last-child { display: inline; }
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal, .modal.lg, .modal.sm { max-width: none; border-radius: 12px 12px 0 0; max-height: 94vh; }
  .modal-b { padding: 16px; }
  .modal-f { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; }
  #toast-root { left: 16px; right: 16px; bottom: 16px; }
  .toast { width: 100%; }
  #bell-menu { width: calc(100vw - 32px); position: fixed; right: 16px; top: 60px; }
  .menu { max-width: calc(100vw - 32px); }
  .tb-h { font-size: 16px; }
  .crumbs { display: none; }
}
@media (max-width: 400px) {
  .g-4, .g-5 { grid-template-columns: 1fr 1fr; }
  .kpi-sm .kpi-v, .stat-v { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Printable documents ---------- */
.modal.xl { max-width: 900px; }
#print-root { display: none; }
.print-stage { background: #eef1f5; padding: 16px; border-radius: 8px; overflow-x: auto; }
.print-doc { position: relative; background: #fff; width: 100%; max-width: 794px; min-height: 600px; margin: 0 auto; padding: 40px 44px; color: #111827; font-size: 13px; line-height: 1.6; border: 1px solid var(--border); }
.print-doc h3 { font-size: 14px; font-weight: 600; margin: 18px 0 6px; color: #111827; }
.pd-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--navy); padding-bottom: 12px; margin-bottom: 14px; }
.pd-biz { font-size: 17px; font-weight: 600; color: var(--navy); }
.pd-small { font-size: 11.5px; color: #4b5563; }
.pd-meta { text-align: right; flex: none; }
.pd-title { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.pd-meta table { margin-left: auto; border-collapse: collapse; font-size: 12.5px; }
.pd-meta td { padding: 1px 0 1px 12px; }
.pd-kv { width: 100%; border-collapse: collapse; margin: 6px 0 12px; }
.pd-kv td { padding: 4px 0; vertical-align: top; border-bottom: 1px dotted #d1d5db; }
.pd-kv td:first-child { width: 30%; color: #4b5563; padding-right: 12px; }
.pd-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-variant-numeric: tabular-nums; }
.pd-table th, .pd-table td { border: 1px solid #cbd5e1; padding: 5px 8px; }
.pd-table th { background: #f1f5f9; font-weight: 600; font-size: 12px; text-align: left; }
.pd-table .r { text-align: right; }
.pd-table .c { text-align: center; }
.pd-table tfoot td { background: #f8fafc; }
.pd-terms { margin: 4px 0 8px; padding-left: 20px; }
.pd-terms li { margin-bottom: 3px; }
.pd-draft { border: 1px dashed #d4a64a; background: #fffaf0; color: #7a5410; font-size: 11.5px; padding: 6px 10px; border-radius: 4px; margin-bottom: 8px; }
.pd-sign { display: flex; justify-content: space-around; gap: 16px; margin-top: 44px; text-align: center; font-size: 12.5px; flex-wrap: wrap; }
.pd-sign > div { min-width: 180px; }
.pd-line { border-bottom: 1px solid #111827; height: 34px; margin-bottom: 6px; }
.pd-foot { margin-top: 24px; padding-top: 8px; border-top: 1px solid #e5e7eb; font-size: 11px; color: #6b7280; text-align: center; }
.pd-void { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg); font-size: 96px; font-weight: 600; color: rgba(197, 48, 48, 0.14); border: 6px solid rgba(197, 48, 48, 0.14); padding: 0 30px; pointer-events: none; }
@media (max-width: 719px) {
  .print-stage { padding: 0; background: none; }
  .print-doc { padding: 20px 16px; min-height: 0; }
  .pd-head { flex-direction: column; }
  .pd-meta { text-align: left; }
  .pd-meta table { margin-left: 0; }
  .pd-meta td { padding: 1px 12px 1px 0; }
}
@page { size: A4; margin: 12mm; }
@media print {
  body { background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  #print-root .print-doc { border: 0; padding: 0; max-width: none; min-height: 0; }
  .pd-table, .pd-kv, .pd-sign { break-inside: avoid; }
}

/* ---------- บัตรผ่อน (บนจอ) ---------- */
.icards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); gap: 16px; padding: 16px 18px; align-items: start; }
.icard { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; overflow: hidden; }
.ic-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 16px 18px 0; }
.ic-name { font-size: 16px; font-weight: 600; color: var(--text); }
.ic-name:hover { color: var(--blue); }
.ic-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ic-acts { display: flex; gap: 6px; align-items: center; flex: none; }
.ic-sum { display: grid; grid-template-columns: auto 1fr auto; gap: 28px; padding: 16px 18px 18px; align-items: end; }
.ic-lbl { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.ic-big { font-size: 28px; font-weight: 600; line-height: 1.15; letter-spacing: -.01em; }
.ic-max { font-size: 13px; font-weight: 500; color: var(--muted); margin-right: 6px; letter-spacing: 0; }
.ic-when { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ic-mid { font-size: 13px; color: var(--muted); }
.ic-mid b { font-size: 16px; color: var(--text); font-weight: 600; }
.ic-prog .bar { height: 4px; margin-top: 8px; }
.ic-recv { text-align: right; }
.ic-alert { margin: 0 18px 12px; padding: 8px 12px; border-left: 3px solid var(--danger); background: #fdf6f6; color: var(--danger); font-size: 13px; font-weight: 500; }
.sched { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.sched th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 8px 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: #fafbfd; }
.sched td { padding: 9px 18px; border-bottom: 1px solid var(--line); }
.sched tr:last-child td { border-bottom: 0; }
.sched .r { text-align: right; }
.sched td:first-child, .sched th:first-child { width: 56px; }
.sched tr.is-done td { color: #8a97a8; }
.sched tr.is-next td { font-weight: 600; color: var(--text); background: #f7faff; }
.sched tr.is-next td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
.sched tr.is-late td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.amt-max { font-size: 11.5px; font-weight: 400; color: var(--muted); margin-right: 5px; }
.amt-in { color: var(--success); font-weight: 600; }
.pay-ok { color: var(--success); font-weight: 400; }
.pay-next { color: var(--blue); font-weight: 600; }
.pay-late { color: var(--danger); font-weight: 600; }
.pay-part { color: var(--warning-ink); font-weight: 400; }
.pay-muted { color: #b4bfcc; }
.ic-foot { font-size: 12px; color: var(--muted); padding: 10px 18px; border-top: 1px solid var(--line); }
.modal-b .icard { border: 0; border-radius: 0; }
.modal-b .icard .ic-top, .modal-b .icard .ic-sum { padding-left: 0; padding-right: 0; }
@media (max-width: 719px) {
  .icards { padding: 12px; gap: 12px; }
  .ic-top { padding: 14px 14px 0; }
  .ic-sum { grid-template-columns: 1fr 1fr; gap: 14px 18px; padding: 14px; }
  .ic-prog { grid-column: 1 / -1; order: 3; }
  .ic-big { font-size: 24px; }
  .ic-alert { margin: 0 14px 12px; }
  .sched th, .sched td { padding: 9px 10px; }
  .sched td:first-child, .sched th:first-child { width: 40px; padding-left: 14px; }
}

/* ---------- บัตรผ่อน (พิมพ์) ---------- */
.pcard { color: #111827; }
.pc-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #111827; padding-bottom: 8px; }
.pc-biz { font-size: 12.5px; color: #4b5563; }
.pc-title { font-size: 22px; font-weight: 600; line-height: 1.2; }
.pc-no { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pc-info { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 10px 0; border-bottom: 1px solid #d1d5db; }
.pc-info span { display: block; font-size: 11px; color: #6b7280; }
.pc-info b { display: block; font-size: 13.5px; font-weight: 600; }
.pc-info small { font-size: 11.5px; color: #4b5563; }
.pc-contact { font-size: 12px; color: #374151; padding: 6px 0; border-bottom: 1px solid #d1d5db; }
.igrid { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 12px; font-variant-numeric: tabular-nums; }
.igrid td, .igrid th { border: 1px solid #9ca3af; }
.ig-label { width: 54px; font-size: 11px; font-weight: 500; color: #4b5563; text-align: center; line-height: 1.3; }
.ig-cell { padding: 5px 6px 0; height: 74px; vertical-align: top; }
.ig-top { display: flex; justify-content: space-between; font-size: 10.5px; color: #6b7280; }
.ig-top b { color: #111827; font-size: 12px; }
.ig-amt { text-align: center; font-size: 14px; font-weight: 600; margin-top: 4px; }
.ig-sign { margin-top: 8px; border-top: 1px dotted #9ca3af; height: 20px; font-size: 10.5px; text-align: center; padding-top: 2px; }
.ig-ok { color: #15803d; }
.ig-empty { background: #f9fafb; }
.pc-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 10.5px; color: #6b7280; margin-top: 8px; }
.print-stage .pcard { min-width: 680px; }
@page card { size: A4 landscape; margin: 10mm; }
@media print { #print-root .pcard { page: card; } }
.amt-est { color: #9aa6b6; }
