:root {
  --wine: #853546;
  --wine-dark: #652536;
  --ink: #202c3c;
  --muted: #59697b;
  --line: #dbe2e9;
  --bg: #f1f4f8;
  --paper: #fff;
  font:
    15px/1.5 'Noto Sans Thai',
    Thonburi,
    Tahoma,
    system-ui,
    sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: #2864a4;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid #c6d0dc;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
button:hover,
.button:hover {
  background: #eaf0f6;
  text-decoration: none;
}
.primary {
  background: var(--wine);
  border-color: var(--wine);
  color: white;
}
.primary:hover {
  background: var(--wine-dark);
  color: white;
}
.small {
  font-size: 13px;
  min-height: 30px;
  padding: 4px 9px;
}
.full {
  width: 100%;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
input:not([type='checkbox']),
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 39px;
  padding: 7px 10px;
  border: 1px solid #bfcbd8;
  border-radius: 6px;
  background: white;
  color: var(--ink);
}
input[type='checkbox'] {
  width: 17px;
  height: 17px;
  accent-color: var(--wine);
  flex-shrink: 0;
}
input[type='number'] {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
input[readonly] {
  background: #edf1f5;
}
textarea {
  resize: vertical;
}
label {
  display: grid;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
  color: #425368;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
textarea:focus-visible {
  outline: 3px solid #6daee9;
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
small {
  font-size: 12px;
  color: var(--muted);
}
td small {
  display: block;
  margin-top: 2px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 27px;
  line-height: 1.3;
  margin-bottom: 6px;
}
h2 {
  font-size: 18px;
  margin-bottom: 12px;
}
h3 {
  font-size: 16px;
}
p {
  margin-bottom: 12px;
}
.muted {
  color: var(--muted);
}
.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.workspace {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px 14px;
  background: #fff;
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
}
.brand:hover {
  text-decoration: none;
}
.brand-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  flex-shrink: 0;
}
.brand b {
  display: block;
  font-size: 17px;
  color: var(--wine);
  margin-top: 4px;
}
.nav-label {
  display: none;
}
.sidebar nav {
  display: grid;
  gap: 5px;
}
.sidebar nav a {
  padding: 10px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #43536a;
}
.sidebar nav a span {
  font-size: 18px;
  width: 20px;
}
.sidebar nav a.active {
  background: #f6e9ed;
  color: #702a3b;
  font-weight: 700;
  box-shadow: inset 3px 0 var(--wine);
}
.sidebar nav a:hover {
  background: #eef2f7;
  text-decoration: none;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.sidebar-bottom strong,
.sidebar-bottom small {
  display: block;
}
.text-button {
  border: 0;
  background: none;
  padding: 5px 0;
  color: var(--wine);
  font-size: 13px;
}
.main {
  min-width: 0;
}
.topbar {
  min-height: 52px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #526176;
  font-size: 13px;
}
.role-pill {
  background: #eef2f6;
  border-radius: 15px;
  padding: 3px 11px;
}
main {
  padding: 24px 28px;
  max-width: 1600px;
  margin: auto;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page-heading p {
  color: var(--muted);
  margin: 0;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 18px;
  min-width: 0;
}
.panel.compact {
  padding: 0;
}
.compact > .section-title {
  padding: 12px 15px;
  margin: 0;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.section-title h2,
.section-title p {
  margin: 0;
}
.section-title p {
  font-size: 13px;
  color: var(--muted);
}
.table-wrap {
  max-width: 100%;
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
  text-align: left;
}
th {
  background: #edf2f7;
  font-weight: 700;
  color: #43566d;
  white-space: nowrap;
}
td,
th {
  padding: 9px 11px;
  border-bottom: 1px solid #e5eaf0;
  vertical-align: middle;
}
tbody tr:hover > td {
  background: #f8fafc;
}
tbody:last-child tr:last-child td {
  border-bottom: 0;
}
.person-link {
  font-weight: 700;
  color: #273b53;
}
.people-table td {
  padding: 8px 12px;
}
.people-table td:last-child {
  text-align: right;
}
.filters,
.toolbar,
.person-context {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.filters label {
  min-width: 160px;
  margin: 0;
}
.filters > .button,
.filters > button {
  min-height: 39px;
  margin: 0;
}
.filters .grow {
  flex: 1;
}
.filters .check {
  min-width: 0;
  align-self: center;
}
.inline-form {
  display: flex;
  gap: 8px;
  align-items: end;
}
.inline-form label {
  min-width: 160px;
}
.person-context {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: 10px;
}
.person-context > span {
  font-size: 14px;
  color: var(--muted);
}
.check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 400;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  margin: 12px 0;
}
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 13px;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}
fieldset:disabled input,
fieldset:disabled select {
  background: #f5f7fa;
}
form > label {
  margin: 12px 0;
}
.pagination {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 12px;
  font-size: 13px;
  color: var(--muted);
}
.empty {
  padding: 35px 20px;
  text-align: center;
  color: var(--muted);
}
.empty h2 {
  color: var(--ink);
}
.section-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}
.section-links a {
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 7px;
}
.person-overview,
.two-column {
  display: grid;
  align-items: start;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.person-overview .panel {
  margin-bottom: 18px;
}
.profile-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 20px;
  font-size: 14px;
  margin: 0;
}
.profile-facts dt {
  color: var(--muted);
}
.profile-facts dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.net-number {
  font-size: 32px;
  font-weight: 700;
  margin: 5px 0 16px;
  font-variant-numeric: tabular-nums;
}
.net-number small {
  font-size: 14px;
  font-weight: 400;
}
.history-compact {
  max-height: min(260px, 40svh);
  overflow: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  scrollbar-width: thin;
  scrollbar-color: #8999ac #edf2f7;
}
.history-compact thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.history-compact td,
.history-compact th {
  padding: 6px 8px;
  font-size: 13px;
  white-space: nowrap;
}
.history-all {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
}
.history {
  padding: 0;
  list-style: none;
}
.history li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
}
.history small {
  display: block;
}
.status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0 16px;
}
.status-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 13px;
  color: inherit;
  border: 1px solid transparent;
}
.status-chip b {
  font-size: 20px;
}
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 5px;
  background: #e9eef4;
  color: #4a5b70;
  white-space: nowrap;
}
.present,
.issued {
  background: #e5f4ea;
  color: #23623c;
}
.late,
.draft,
.preview {
  background: #fff0ce;
  color: #805400;
}
.leave,
.vacation {
  background: #e4eefc;
  color: #204e92;
}
.absent {
  background: #fde6e6;
  color: #a32828;
}
.review,
.personal {
  background: #ede8fa;
  color: #614198;
}
.off,
.inactive {
  background: #e9edf2;
  color: #5c6877;
}
.holiday {
  background: #fde5ed;
  color: #a03357;
}
.season {
  background: #e1f3ef;
  color: #206b5c;
}
.sick {
  background: #fff0dc;
  color: #865010;
}
.notice,
.demo-banner,
.warning,
.error {
  padding: 11px 14px;
  border-radius: 7px;
  margin-bottom: 16px;
  font-size: 14px;
}
.notice {
  background: #e6f3eb;
  color: #276241;
}
.demo-banner {
  background: #e8eef7;
  color: #415d83;
}
.warning {
  background: #fff2d5;
  color: #815900;
}
.error {
  background: #fbe6e6;
  color: #a12222;
}
.payroll-grid {
  min-width: 950px;
}
.payroll-grid td {
  padding: 6px 8px;
  height: 48px;
}
.payroll-grid td input[type='number'] {
  min-height: 32px;
  width: 95px;
  padding: 5px 7px;
  font-size: 14px;
  border-color: #d6dee8;
}
.payroll-grid td:nth-child(2) {
  min-width: 180px;
}
.payroll-grid td:last-child {
  min-width: 130px;
}
.payroll-grid td:last-child > a {
  display: inline-block;
  margin-left: 5px;
  font-size: 12px;
}
.payroll-grid th {
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.payroll-grid tbody[data-dirty='true'] > tr:first-child > td {
  background: #fff8e5;
}
.payroll-grid .net-cell {
  font-weight: 700;
  color: #194f3c;
}
.payroll-grid .row-details {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  padding: 12px;
  background: #f3f6fb;
}
.payroll-grid .row-details input {
  width: 100% !important;
}
.payroll-scroll {
  max-height: 620px;
}
.batch-bar {
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  bottom: 0;
  padding: 13px 16px;
  background: #fff;
  box-shadow: 0 -3px 15px #20304412;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-top: 12px;
}
.batch-bar > [role='status'] {
  flex: 1;
  min-width: 180px;
  font-size: 13px;
}
.batch-bar details {
  width: 100%;
}
.batch-bar details label {
  margin: 8px 0;
}
.batch-bar details input:not([type='checkbox']) {
  max-width: 450px;
}
.row-details label {
  font-size: 12px;
}
.report-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.report-summary strong {
  font-size: 21px;
}
.payslip {
  max-width: 1000px;
  margin: 0 auto 20px;
  background: white;
  border: 1px solid var(--line);
  padding: 20px 25px;
  border-radius: 6px;
  overflow: auto;
}
.slip-letterhead {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 15px;
}
.payslip h2 {
  text-align: center;
  font-size: 21px;
  margin-bottom: 15px;
}
.payslip h2 small {
  font-size: 14px;
}
.slip-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 20px;
  margin-bottom: 18px;
  font-size: 13px;
}
.slip-info b {
  margin-left: 8px;
}
.slip-table {
  min-width: 520px;
  font-size: 13px;
}
.slip-table th,
.slip-table td {
  padding: 8px;
  border: 1px solid #cbd4df;
}
.slip-table .total {
  font-weight: bold;
  background: #edf2f7;
}
.slip-net {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin: 20px 0;
  font-size: 13px;
}
.slip-net strong {
  font-size: 16px;
}
.slip-version {
  font-size: 11px;
  text-align: right;
  color: #69788b;
}
.slip-note {
  font-size: 13px;
}
.print-tools {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-bottom: 16px;
}
.schedule-table {
  min-width: 690px;
  text-align: center;
}
.schedule-table td {
  font-size: 13px;
  padding: 10px 7px;
}
.schedule-table th:first-child {
  text-align: left;
}
.day-off {
  font-weight: 600;
  color: #627084;
}
.schedule-card.selected {
  border-color: #c27b8d;
  box-shadow: 0 0 0 2px #85354613;
}
.schedule-card h2 {
  margin: 0;
}
.rule-grid {
  display: flex;
  gap: 30px;
}
.rule-grid span,
.rule-grid strong {
  display: block;
}
.calendar-legend {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 13px;
}
.event {
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 4px;
  display: block;
  line-height: 1.35;
  border-left: 3px solid currentColor;
}
.event span {
  display: block;
  font-weight: 400;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.weekday {
  background: #edf2f7;
  padding: 7px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
}
.calendar-day,
.calendar-blank {
  min-height: 104px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px;
  min-width: 0;
}
.calendar-blank {
  background: #f8fafc;
}
.day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-height: 27px;
  min-width: 27px;
  font-size: 13px;
  border: 0;
  border-radius: 50%;
  font-weight: 700;
  background: transparent;
  margin-bottom: 4px;
}
.calendar-day .event {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}
.calendar-day.has-event {
  background: #fbfcff;
}
.calendar-day button:hover {
  background: #dce8f8;
}
#calendar-editor {
  scroll-margin-top: 20px;
}
details > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 6px 0;
  color: #345776;
}
details[open] > summary {
  margin-bottom: 12px;
}
details {
  margin-top: 12px;
}
.narrow {
  max-width: 620px;
}
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px #2c405513;
  width: 100%;
  max-width: 410px;
  padding: 30px;
  border-radius: 12px;
}
.login-card .brand {
  margin-bottom: 28px;
}
.login-card h1 {
  font-size: 23px;
  margin-bottom: 20px;
}
.login-card label {
  margin: 14px 0;
}
.login-card .primary {
  margin-top: 8px;
}
.import-disclosure {
  margin: 0;
  position: relative;
}
.import-panel {
  position: absolute;
  right: 0;
  z-index: 3;
  width: 440px;
  max-width: 90vw;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 8px 35px #20304420;
  padding: 18px;
  border-radius: 10px;
}
.import-panel form {
  margin-bottom: 15px;
}
.upload-box {
  border: 1px dashed var(--line);
  padding: 18px;
}
.source-record {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.pay-hero {
  background: white;
  border: 1px solid var(--line);
  padding: 22px;
  border-radius: 10px;
  margin-bottom: 18px;
}
.pay-hero h2 {
  font-size: 30px;
}
.toolbar-summary {
  font-size: 14px;
}
.history small {
  color: var(--muted);
}
@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 180px minmax(0, 1fr);
  }
  main {
    padding: 20px;
  }
  .sidebar {
    padding: 18px 10px;
  }
  .brand {
    font-size: 18px;
  }
  .brand-logo {
    width: 40px;
    height: 40px;
  }
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .payroll-grid .row-details {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}
@media (max-width: 760px) {
  .workspace {
    display: block;
  }
  .sidebar {
    height: auto;
    position: static;
    padding: 12px;
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    gap: 10px;
  }
  .sidebar .brand {
    flex: 1;
  }
  .sidebar nav {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    order: 3;
    overflow: auto;
    gap: 5px;
  }
  .sidebar nav a {
    flex-shrink: 0;
    padding: 7px 9px;
    font-size: 13px;
  }
  .sidebar-bottom {
    margin: 0;
    border: 0;
    padding: 0;
    text-align: right;
    font-size: 12px;
  }
  .sidebar-bottom strong,
  .sidebar-bottom small {
    display: none;
  }
  .sidebar-bottom .text-button {
    font-size: 12px;
  }
  .topbar {
    display: none;
  }
  main {
    padding: 16px 12px;
  }
  .page-heading {
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
  }
  h1 {
    font-size: 24px;
  }
  .page-heading p {
    font-size: 13px;
  }
  .page-heading > .actions {
    width: 100%;
  }
  .panel {
    padding: 13px;
    border-radius: 8px;
    margin-bottom: 14px;
  }
  .filters {
    gap: 10px;
  }
  .filters label {
    min-width: 130px;
    flex: 1;
  }
  .filters .check {
    flex-basis: 100%;
    font-size: 13px;
  }
  .filters button {
    align-self: end;
  }
  .person-overview,
  .two-column {
    display: block;
  }
  .person-context {
    gap: 9px;
    padding: 10px;
  }
  .person-context > span {
    font-size: 12px;
  }
  .section-links {
    gap: 5px;
  }
  .section-links a {
    font-size: 13px;
    padding: 6px 9px;
  }
  .section-title {
    align-items: flex-start;
  }
  .section-title h2 {
    font-size: 16px;
  }
  .section-title > a {
    font-size: 12px;
    white-space: nowrap;
  }
  .status-chip {
    padding: 5px 8px;
    font-size: 12px;
  }
  .status-chip b {
    font-size: 18px;
  }
  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .form-footer {
    align-items: flex-start;
    flex-direction: column;
  }
  .calendar-day,
  .calendar-blank {
    min-height: 77px;
    padding: 3px;
  }
  .calendar-day .event {
    font-size: 10px;
    padding: 3px 2px;
    border-left-width: 2px;
  }
  .calendar-day .event span {
    font-size: 10px;
  }
  .calendar-legend {
    gap: 4px;
  }
  .calendar-legend .event {
    font-size: 11px;
  }
  .day-number {
    min-width: 22px;
    min-height: 22px;
    font-size: 12px;
  }
  .weekday {
    padding: 5px 1px;
    font-size: 12px;
  }
  .payslip {
    padding: 12px;
    max-width: 100%;
  }
  .slip-info {
    grid-template-columns: 1fr;
    font-size: 12px;
  }
  .slip-net {
    display: block;
  }
  .slip-net strong {
    display: block;
    margin-top: 12px;
  }
  .batch-bar {
    position: static;
    padding: 12px;
    gap: 10px;
  }
  .batch-bar > [role='status'] {
    flex-basis: 100%;
  }
  .payroll-grid .row-details {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }
  .login-card {
    padding: 24px;
  }
  .people-table {
    min-width: 680px;
  }
  .report-summary {
    flex-wrap: wrap;
    gap: 8px;
  }
  .history-compact > a {
    flex-wrap: wrap;
  }
  .import-panel {
    left: 0;
    right: auto;
  }
}
@media print {
  @page {
    size: A4;
    margin: 12mm;
  }
  .sidebar,
  .topbar,
  .print-tools,
  .page-heading,
  .report-summary,
  .report-edit,
  .section-links,
  .batch-bar,
  footer,
  .demo-banner,
  .notice,
  .warning,
  .panel,
  .person-context {
    display: none !important;
  }
  .workspace,
  .main,
  main {
    display: block;
    padding: 0;
    margin: 0;
    max-width: none;
    background: white;
  }
  .payslip {
    display: block !important;
    width: 100%;
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 0;
    overflow: visible;
    font-size: 12px;
  }
  .slip-letterhead {
    width: 100%;
    margin-bottom: 12px;
  }
  .slip-info {
    grid-template-columns: 1fr 1fr;
    font-size: 12px;
  }
  .slip-table {
    min-width: 0;
    width: 100%;
    font-size: 12px;
  }
  .slip-table th,
  .slip-table td {
    padding: 6px;
  }
  .slip-net {
    display: flex;
    margin: 16px 0;
  }
  .slip-net strong {
    font-size: 14px;
  }
  .payslip h2 {
    font-size: 18px;
  }
  .slip-version {
    font-size: 10px;
  }
  .payslip,
  table,
  tr {
    break-inside: avoid;
  }
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body {
    background: white;
  }
}

.payroll-grid .sticky-person {
  position: sticky;
  left: 0;
  z-index: 1;
  background: white;
  min-width: 168px;
}
.payroll-grid th:nth-child(2) {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #edf2f7;
}
.payroll-grid .row-details {
  position: sticky;
  left: 0;
  width: min(900px, calc(100vw - 290px));
}
.row-details > strong {
  grid-column: 1 / -1;
}
@media (max-width: 1100px) {
  .payroll-grid .row-details {
    width: calc(100vw - 244px);
  }
}
@media (max-width: 760px) {
  .payroll-grid .row-details {
    width: calc(100vw - 64px);
  }
}

.row-warning {
  display: block;
  color: #945700;
  font-size: 12px;
  margin-top: 3px;
}

.calendar-agenda,
.mobile-hint {
  display: none;
}
@media (max-width: 600px) {
  .mobile-hint {
    display: block;
    color: #536783;
    font-size: 12px;
    padding: 0 14px;
  }
  .calendar-day {
    min-height: 62px;
  }
  .calendar-grid .event {
    height: 9px;
    width: 18px;
    padding: 0;
    margin: 3px 0;
    overflow: hidden;
    font-size: 0;
    border-radius: 3px;
  }
  .calendar-grid .event span {
    display: none;
  }
  .calendar-agenda {
    display: grid;
    gap: 6px;
    margin-top: 12px;
  }
  .calendar-agenda h3 {
    margin: 5px 0;
    font-size: 14px;
  }
  .agenda-event {
    padding: 8px;
  }
  .agenda-event strong,
  .agenda-event small {
    display: block;
  }
}

/* One restrained weekday palette shared by calendar and work schedules. */
.dow-1 {
  --day-bg: #fff4c6;
  --day-ink: #725900;
}
.dow-2 {
  --day-bg: #fbe0eb;
  --day-ink: #8d345a;
}
.dow-3 {
  --day-bg: #dff1e5;
  --day-ink: #286244;
}
.dow-4 {
  --day-bg: #ffe9d3;
  --day-ink: #8b4c14;
}
.dow-5 {
  --day-bg: #deeffb;
  --day-ink: #275e89;
}
.dow-6 {
  --day-bg: #eae3f7;
  --day-ink: #62428c;
}
.dow-0 {
  --day-bg: #f9dfdf;
  --day-ink: #9a3636;
}
.weekday[class*='dow-'],
.schedule-table th[class*='dow-'],
td[class*='dow-'] {
  background: var(--day-bg);
  color: var(--day-ink);
}
.calendar-day .day-number {
  background: var(--day-bg);
  color: var(--day-ink);
}
.sidebar nav a span {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 26px;
}
.menu-icon {
  width: 26px;
  height: 26px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.late-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(28px, 1fr));
  gap: 4px;
  min-width: 112px;
  text-align: center;
}
.late-counts .late-count {
  position: relative;
  padding: 5px 4px;
  border-radius: 5px;
}
.band-1 {
  background: #fff4cf;
  color: #715600;
}
.band-2 {
  background: #ffe6d0;
  color: #8a470c;
}
.band-3 {
  background: #f8dfe3;
  color: #9a3345;
}
.band-labels {
  font-weight: 400;
  font-size: 10px;
  margin-top: 4px;
}
.late-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0 14px;
}
.late-summary .late-count {
  border-radius: 6px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.late-summary .late-count > span {
  flex: 1 1 100%;
  font-size: 12px;
}
.late-summary b {
  font-size: 18px;
}
.report-attendance h3 {
  font-size: 13px;
  margin: 12px 0 4px;
}
.calendar-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
  border: 1px solid #d6dee8;
  border-radius: 16px;
  padding: 24px;
  color: #263347;
  box-shadow: 0 24px 80px #101b3340;
}
.calendar-dialog::backdrop {
  background: #17253a80;
}
.dialog-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.dialog-heading h2 {
  margin: 0;
  font-size: 22px;
}
.dialog-close {
  border: 0;
  background: #eef2f7;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  padding: 0;
  min-height: 36px;
  font-size: 26px;
  color: #43536a;
}
.calendar-dialog .actions {
  margin-top: 20px;
  justify-content: flex-end;
}
.calendar-dialog .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 600px) {
  .calendar-dialog {
    padding: 20px;
  }
  .calendar-dialog .form-grid {
    grid-template-columns: 1fr;
  }
  .dialog-heading h2 {
    font-size: 20px;
  }
  .late-summary .late-count {
    padding: 8px;
  }
}
@media print {
  .calendar-dialog {
    display: none !important;
  }
  .late-summary {
    margin: 5px 0 10px;
    gap: 6px;
  }
  .late-summary .late-count {
    padding: 5px 9px;
  }
  .late-summary b {
    font-size: 14px;
  }
}

.late-note {
  font-size: 11px;
  color: #59697f;
  margin: 5px 0 12px;
}
.compact > .late-note {
  padding: 0 14px;
}

.table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-block: 1px solid #e1e7ee;
  background: #f8fafc;
}
.horizontal-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 100px;
  max-width: 420px;
  flex: 1;
}
.horizontal-controls[hidden] {
  display: none;
}
.horizontal-controls button {
  padding: 4px 10px;
  min-height: 32px;
  font-size: 18px;
}
.horizontal-controls input[type='range'] {
  flex: 1;
  min-width: 40px;
  width: 100%;
  accent-color: #86334a;
  height: 24px;
  padding: 0;
  border: 0;
  cursor: ew-resize;
}
.table-controls > button {
  margin-left: auto;
  white-space: nowrap;
  padding: 6px 10px;
}
.table-wrap::-webkit-scrollbar {
  height: 12px;
  width: 12px;
}
.table-wrap::-webkit-scrollbar-track {
  background: #e7edf4;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: #98a8bd;
  border: 2px solid #e7edf4;
  border-radius: 7px;
}
.has-full-table {
  overflow: hidden;
}
[data-expandable].full-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #f1f4f8;
  border-radius: 0;
  padding: 16px;
  margin: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  overflow: auto;
}
.full-view .payroll-scroll {
  max-height: calc(100dvh - 240px);
}
.full-view .table-controls {
  position: sticky;
  top: 0;
  z-index: 6;
}
.full-view .batch-bar {
  position: sticky;
  bottom: 0;
}
@media print {
  .table-controls {
    display: none !important;
  }
}

.full-view .payroll-grid .row-details {
  width: min(1050px, calc(100vw - 64px));
}

.file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 24px 16px;
  min-height: 180px;
  text-align: center;
  border: 2px dashed #abb9c9;
  border-radius: 12px;
  background: #f5f8fc;
  color: #536782;
  cursor: pointer;
}
.file-drop input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  cursor: pointer;
}
.file-drop strong {
  color: #314763;
  font-size: 16px;
}
.file-drop small {
  max-width: 100%;
  overflow-wrap: anywhere;
}
.file-drop:focus-within,
.file-drop.dragging {
  border-color: #87384c;
  background: #fbf0f4;
  outline: 2px solid #e5cbd3;
}
.file-drop.file-error {
  border-color: #c13e50;
  color: #a72b3d;
  background: #fff2f2;
}

.settings-dialog {
  width: min(940px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
  border: 1px solid #d6dee8;
  border-radius: 16px;
  padding: 24px;
  color: #263347;
  box-shadow: 0 24px 80px #101b3340;
}
.settings-dialog::backdrop {
  background: #17253a80;
}
.settings-dialog > .dialog-heading {
  position: sticky;
  top: 0;
  z-index: 5;
  background: white;
  padding-bottom: 12px;
}
.settings-dialog .panel {
  border: 0;
  padding: 0;
  box-shadow: none;
  margin: 12px 0;
}
.schedule-seasons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}
.schedule-season .table-wrap table {
  min-width: 380px;
}
.schedule-season input[type='time'] {
  min-width: 88px;
  padding: 6px;
}
.schedule-season td,
.schedule-season th {
  padding: 7px;
}
.schedule-season h3 {
  font-size: 16px;
  margin: 0 0 10px;
}
tbody tr:hover > td.off {
  background: #e9edf2;
  color: #5c6877;
}
tbody tr:hover > td[class*='dow-'] {
  background: var(--day-bg);
  color: var(--day-ink);
}
.calendar-day .day-number:hover {
  background: var(--day-bg);
  color: var(--day-ink);
  box-shadow: 0 0 0 2px currentColor;
}
@media (max-width: 760px) {
  .schedule-seasons {
    grid-template-columns: 1fr;
  }
  .settings-dialog {
    padding: 18px;
  }
}
@media print {
  .settings-dialog {
    display: none !important;
  }
}

.table-controls[hidden] {
  display: none;
}

.permission-roles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.permission-roles b {
  color: #7b3043;
}
.permission-roles p {
  margin: 5px 0 0;
  color: #536782;
  font-size: 13px;
}
@media (max-width: 700px) {
  .permission-roles {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.permission-form {
  display: flex;
  align-items: center;
  gap: 8px;
}
.permission-form select {
  min-width: 126px;
}
.permissions-table {
  min-width: 660px;
}

.permissions-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: white;
  min-width: 180px;
}
.permissions-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #edf2f7;
}
@media (max-width: 700px) {
  .permissions-table {
    min-width: 0;
  }
  .permissions-table thead {
    display: none;
  }
  .permissions-table tbody {
    display: block;
  }
  .permissions-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px 12px;
    gap: 7px 12px;
    border-bottom: 1px solid var(--line);
  }
  .permissions-table td {
    padding: 0;
    border: 0;
    min-width: 0;
  }
  .permissions-table td:first-child {
    position: static;
    min-width: 0;
    max-width: none;
    grid-column: 1;
    grid-row: 1;
  }
  .permissions-table td:nth-child(4) {
    grid-column: 2;
    grid-row: 1;
    color: var(--muted);
    font-size: 12px;
  }
  .permissions-table td:nth-child(2),
  .permissions-table td:nth-child(3) {
    grid-column: 1 / -1;
  }
  .permissions-table td:nth-child(2) {
    font-size: 12px;
    color: var(--muted);
    overflow-wrap: anywhere;
  }
  .permissions-table td:nth-child(2)::before {
    content: 'ชื่อเข้าใช้: ';
  }
  .permission-form select {
    flex: 1;
    min-width: 0;
  }
  .permission-form button {
    flex-shrink: 0;
  }
}

.note-button {
  min-height: 30px;
  padding: 4px 6px;
  margin-top: 4px;
  color: var(--muted);
}
.note-button.has-note {
  color: var(--wine);
  background: #f6e9ed;
}
.report-note-popover {
  width: min(440px, calc(100vw - 32px));
  max-height: 75dvh;
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  box-shadow: 0 12px 40px #202c3c30;
}
.report-note-popover h3 {
  padding-right: 30px;
}
.report-note-popover .dialog-close {
  float: right;
}
.report-note-popover p,
.slip-note {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.report-note-popover small {
  display: block;
  margin-top: 10px;
}
@media print {
  .slip-note,
  .report-note-popover {
    display: none !important;
  }
}

.person-note-heading {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}
.person-note-heading .person-link {
  flex: 1;
  min-width: 0;
}
.person-note-heading .note-button {
  margin: 0;
  flex-shrink: 0;
}
.bonus-percent {
  font-size: 11px;
  margin-bottom: 5px;
}
.bonus-percent input {
  min-width: 85px;
}

.status-edit {
  display: inline-flex;
  text-decoration: none;
  border-radius: 7px;
}
.status-edit:focus-visible {
  outline: 3px solid #7faccd;
  outline-offset: 3px;
}
.partial-leave {
  display: block;
  color: #89520c;
  white-space: nowrap;
  font-weight: 600;
}
.reason-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 20px;
}
.reason-choices button {
  padding: 6px 12px;
  font-size: 0.9rem;
}
.leave-span-fields {
  padding: 12px 0 18px;
}
.leave-span-fields > label {
  max-width: 300px;
}
