:root {
  color-scheme: light;
  --navy: #0a2342;
  --navy-2: #11315c;
  --gold: #ffc400;
  --gold-soft: #fff4cc;
  --ink: #1b2a41;
  --muted: #5a6b82;
  --line: #e3e9f2;
  --line-strong: #c6d1df;
  --canvas: #f5f7fb;
  --surface: #ffffff;
  --success: #147a52;
  --success-soft: #e8f7f0;
  --warning: #925900;
  --warning-soft: #fff4d6;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: "IBM Plex Sans Thai", sans-serif;
  font-size: 13px;
  line-height: 1.35;
}

button, input, select, textarea { font-family: inherit; }
a { color: var(--navy-2); }
a:hover { color: var(--navy); }

.topbar {
  min-height: 48px;
  padding: 0 16px;
  background: var(--navy);
  color: #fff;
  border-bottom: 3px solid var(--gold);
  box-shadow: none;
}
.brand-stack { display: grid; gap: 0; }
.brand-stack .brand {
  color: #fff;
  font-family: Poppins, "IBM Plex Sans Thai", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
}
.brand-stack small { color: #bfcde0; font-size: 10px; }
.user { margin-left: auto; gap: 13px; }
.user span { line-height: 1.25; }
.user span b { font-size: 13px; font-weight: 600; }
.user small { color: #bfcde0; font-size: 11px; }
.user > a { color: #e8eef7; font-size: 12px; }

.container { max-width: none; margin: 0; padding: 12px 16px 20px; }
.workspace-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 8px;
}
.workspace-head h1 { margin: 1px 0 0; font-size: clamp(21px, 2.2vw, 27px); font-weight: 600; line-height: 1.1; }
.workspace-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.eyebrow { color: var(--navy-2); font-family: Poppins, sans-serif; font-size: 9px; font-weight: 600; letter-spacing: .15em; }
.workspace-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.workspace-actions form { margin: 0; }

.btn, button {
  min-height: 31px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--navy);
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
}
.btn.primary, button.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover, button.primary:hover { background: var(--navy-2); }

.job-strip {
  display: grid;
  grid-template-columns: 210px minmax(180px, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid #efd97b;
  border-left: 4px solid var(--gold);
  background: #fffbeb;
}
.job-strip > div:first-child { display: flex; gap: 8px; }
.job-strip b { color: var(--navy); }
.job-strip [data-job-stage], .job-strip small { color: var(--muted); }
.job-strip .progress { height: 6px; background: #eadfb7; }
.job-strip .progress span { background: var(--navy); }

.filter-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}
input, select, textarea { border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; color: var(--ink); }
.filter-bar input, .filter-bar select { flex: 0 0 140px; width: 140px; min-height: 30px; padding: 4px 7px; border-radius: 3px; font-size: 11px; }
.filter-bar .filter-search { flex-basis: 250px; width: 250px; }
.filter-bar .filter-year { flex-basis: 74px; width: 74px; }
.filter-bar .provider-filter { flex: 1 0 230px; width: auto; }
.filter-submit { min-height: 30px; padding-inline: 11px; background: var(--gold); border-color: #e6b100; color: var(--navy); }
.filter-submit:hover { background: #f2ba00; }
.clear-filter { padding: 7px 4px; color: var(--muted); font-size: 12px; white-space: nowrap; }

.document-register {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0 0 6px 6px;
  overflow: visible;
}
.table-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 34px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
}
.table-title b { color: var(--navy); font-size: 13px; }
.table-title span { color: var(--muted); font-size: 10px; }
.document-register .table-wrap { max-height: calc(100vh - 190px); min-height: 420px; overflow: auto; }
table { font-variant-numeric: tabular-nums; }
.evidence-table { width: 100%; min-width: 1080px; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 11px; }
.evidence-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 28px;
  padding: 4px 7px;
  background: #eef2f7;
  color: #45566d;
  border-bottom: 1px solid var(--line-strong);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .045em;
  text-transform: none;
}
.evidence-table td { height: 32px; padding: 3px 7px; vertical-align: middle; border-bottom: 1px solid var(--line); }
.evidence-table tbody tr:hover { background: #f8faff; }
.evidence-table tbody tr:last-child td { border-bottom: 0; }
.select-col { width: 32px; text-align: center; }
.date-col { width: 72px; }
.provider-col { width: 220px; }
.document-col { width: 180px; }
.validation-col { width: 64px; }
.select-col input { width: 14px; height: 14px; accent-color: var(--navy); }
.date-cell { color: var(--muted); font-size: 10px; }
.provider-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider-cell b { color: var(--navy); font-weight: 600; }
.provider-cell small { color: var(--muted); }
.document-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-cell > b { font-family: Poppins, "IBM Plex Sans Thai", sans-serif; color: var(--navy); font-size: 10.5px; font-weight: 600; }
.document-cell > small { color: var(--muted); }
.amount-col { width: 82px; text-align: right; font-weight: 600; }
.workflow-col { width: 128px; }
.workflow-state { color: var(--muted); white-space: nowrap; }
.workflow-state form { display: inline-block; margin: 0 5px 0 0; vertical-align: middle; }
.workflow-state input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--navy); cursor: pointer; }
.workflow-state:nth-last-child(2) input[type="checkbox"] { accent-color: var(--success); }
.workflow-state input[disabled] { cursor: default; opacity: 1; }
.workflow-state > span { color: var(--ink); font-size: 10px; vertical-align: middle; }
.action-col { width: 68px; text-align: right; }
.row-download { display: inline; padding: 1px 0; font-size: 10.5px; font-weight: 600; }
.has-issue { box-shadow: inset 3px 0 var(--danger); }
.validation-text { color: var(--success); white-space: nowrap; font-size: 10px; }
.validation-text.is-issue { color: var(--danger); font-weight: 600; }
.muted { color: var(--muted); }
.editable-date { cursor: pointer; border-bottom: 1px dashed var(--line-strong); }
.editable-date:hover { color: var(--navy); border-color: var(--navy); }

.badge { padding: 1px 6px; border: 1px solid var(--line); border-radius: 999px; background: #f3f5f8; color: #526174; font-size: 10px; }
.badge-paid, .badge-pass, .badge-ready, .badge-complete, .badge-reimbursed, .badge-reimbursable { color: var(--success); border-color: #a9dfc7; background: var(--success-soft); }
.badge-warning, .badge-open, .badge-pending, .badge-needs-review, .badge-needs-login, .badge-submitted { color: var(--warning); border-color: #efd790; background: var(--warning-soft); }
.badge-fail, .badge-failed, .badge-void, .badge-uncollectible, .badge-not-related, .badge-rejected { color: var(--danger); border-color: #efb6b1; background: var(--danger-soft); }

.document-cell a { color: var(--navy); font-family: Poppins, "IBM Plex Sans Thai", sans-serif; font-size: 10.5px; font-weight: 600; text-decoration: none; }
.document-cell a:hover { text-decoration: underline; }

.row-preview { font-size: 14px; text-decoration: none; opacity: .45; cursor: pointer; }
.row-preview:hover { opacity: 1; }

.preview-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.preview-modal[hidden] { display: none; }
.preview-backdrop { position: absolute; inset: 0; background: rgba(10,35,66,.55); }
.preview-content { position: relative; width: min(90vw, 900px); height: 85vh; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 20px 60px rgba(10,35,66,.3); }
.preview-close-btn { position: absolute; top: 8px; right: 10px; z-index: 2; width: 32px; height: 32px; border: none; border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.preview-close-btn:hover { background: rgba(0,0,0,.7); }
.preview-frame { width: 100%; height: 100%; border: none; }

.bulk-bar {
  min-height: 36px;
  padding: 3px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--navy);
  background: #fff8d8;
  border-bottom: 1px solid #ead06e;
  font-size: 11px;
}
.bulk-bar[hidden] { display: none; }
.bulk-bar button { min-height: 28px; padding: 3px 9px; background: var(--gold); border-color: #e6b100; color: var(--navy); }

.panel, .card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--navy) 0%, #132d54 100%); }
.auth-body .container { width: 100%; max-width: 440px; padding: 20px; }
.login-shell { border-top: 5px solid var(--gold); background: #fff; padding: 32px 28px 24px; }
.login-shell h1 { color: var(--navy); font-weight: 600; font-size: 20px; margin: 0; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-mark { width: 40px; height: 40px; border-radius: 8px; background: var(--navy); color: var(--gold); display: flex; align-items: center; justify-content: center; font-family: Poppins, sans-serif; font-size: 20px; font-weight: 700; flex-shrink: 0; }
.login-subtitle { color: var(--muted); font-size: 12px; margin: 0 0 20px; }
.login-shell .field { margin-bottom: 14px; }
.login-shell .field label { font-size: 12px; font-weight: 600; color: var(--ink); }
.login-shell .field input { width: 100%; padding: 10px 12px; font-size: 14px; }
.login-btn { width: 100%; min-height: 40px; font-size: 14px; margin-top: 4px; }
.login-footer { text-align: center; margin: 16px 0 0; font-size: 12px; }
.login-footer a { color: var(--muted); }
.login-footer a:hover { color: var(--navy); }

@media (max-width: 1180px) {
  .filter-bar { overflow-x: auto; }
}

@media (max-width: 720px) {
  .topbar { padding: 10px 14px; }
  .user span { display: none; }
  .container { padding: 16px 12px 28px; }
  .workspace-head { display: grid; align-items: start; }
  .workspace-actions { justify-content: flex-start; }
  .filter-bar { overflow-x: auto; }
  .table-title { align-items: flex-start; }
  .table-title > div:first-child { display: grid; gap: 1px; }
  .job-strip { grid-template-columns: 1fr; }
  .document-register .table-wrap { max-height: calc(100vh - 330px); }
}

/* 2026-10-14: document column icon + PDF on one centred line; quiet bulk actions */
.doc-actions { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; vertical-align: middle; }
.doc-actions .row-preview { display: inline-flex; align-items: center; line-height: 0; }
.doc-actions .row-preview svg { display: block; }
.bulk-actions { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; }
.bulk-bar .bulk-quiet { background: none; border: 0; color: inherit; text-decoration: underline; text-underline-offset: 2px; padding: 3px 6px; min-height: 0; font-weight: 500; cursor: pointer; }
.bulk-bar .bulk-quiet:hover { color: var(--navy); }

/* Manual Upload Modal & Form */
.upload-modal { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 16px; }
.upload-modal[hidden] { display: none; }
.upload-backdrop { position: absolute; inset: 0; background: rgba(10,35,66,.65); backdrop-filter: blur(2px); }
.upload-content { position: relative; width: min(94vw, 720px); max-height: 92vh; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 24px 64px rgba(10,35,66,.35); display: flex; flex-direction: column; }
.upload-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; background: var(--navy); color: #fff; border-bottom: 3px solid var(--gold); }
.upload-modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; color: #fff; }
.upload-close-btn { background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; line-height: 1; padding: 0 4px; opacity: .8; }
.upload-close-btn:hover { opacity: 1; }
.upload-modal-body { padding: 20px; overflow-y: auto; max-height: calc(92vh - 65px); }

.manual-upload-form .req { color: var(--danger); }
.manual-upload-form .field { margin-bottom: 12px; }
.manual-upload-form label { display: block; margin-bottom: 4px; font-size: 11.5px; font-weight: 600; color: var(--ink); }
.manual-upload-form input, .manual-upload-form select, .manual-upload-form textarea { width: 100%; min-height: 32px; padding: 5px 9px; font-size: 12px; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; }
.manual-upload-form input:focus, .manual-upload-form select:focus, .manual-upload-form textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 2px rgba(17,49,92,.15); }

.dropzone { position: relative; border: 2px dashed var(--line-strong); border-radius: 8px; padding: 18px 12px; background: #fafcff; text-align: center; cursor: pointer; transition: all .15s ease-in-out; }
.dropzone:hover, .dropzone.is-dragover { border-color: var(--navy); background: #f0f5fc; }
.dropzone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.dropzone-body { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); }
.dropzone-body svg { color: var(--navy-2); margin-bottom: 2px; }
.dropzone-prompt b { color: var(--navy); }
.dropzone-sub { font-size: 10.5px; color: var(--muted); }
.file-name-badge { margin-top: 6px; padding: 3px 10px; border-radius: 4px; background: var(--success-soft); color: var(--success); font-weight: 600; font-size: 11px; border: 1px solid #a9dfc7; word-break: break-all; }
.file-name-badge[hidden] { display: none; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 12px; }
.custom-provider-fields { padding: 8px 12px; background: #f7f9fd; border-radius: 6px; border: 1px dashed #c0d1e5; margin-bottom: 12px; }
.custom-provider-fields[hidden] { display: none; }

.upload-fx-box { margin: 12px 0 16px; padding: 10px 14px; border-radius: 6px; background: #fffbeb; border: 1px solid #f2db84; border-left: 4px solid var(--gold); }
.fx-box-title { font-size: 10.5px; font-weight: 700; color: var(--warning); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.fx-box-content { font-size: 12px; color: var(--navy); }
.fx-box-content .fx-highlight { font-size: 14px; font-weight: 700; color: var(--navy); }
.fx-box-content .fx-rate-tag { display: inline-block; padding: 1px 6px; border-radius: 3px; background: #faecc0; font-size: 10.5px; font-weight: 600; color: #754400; margin-left: 6px; }

.upload-form-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.btn-submit-upload { min-height: 36px; padding: 6px 18px; font-size: 13px; font-weight: 600; }

@media (max-width: 600px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; gap: 0; }
  .upload-content { width: 98vw; max-height: 96vh; }
  .upload-modal-body { padding: 14px; }
}

