/* Attendance and deductions: layouts follow the Figma desktop and phone frames. */
body[data-page="attendance"] .attendance-intro{margin:0 0 14px}
body[data-page="attendance"] .module-tabs{border-bottom:0;gap:18px;margin-bottom:14px}
body[data-page="attendance"] .module-tab{padding:4px 0;border-radius:0;font-weight:600;font-size:13px}
body[data-page="attendance"] .attendance-controls{grid-template-columns:minmax(0,1fr);gap:12px;margin-bottom:16px}
body[data-page="attendance"] .attendance-controls.has-primary-action .attendance-primary-action{justify-self:end;margin:0}
body[data-page="attendance"] .attendance-controls .location-filter-bar{width:100%;border-radius:9px;background:#fff}
body[data-page="attendance"] .attendance-roster{padding:24px;border:0;border-radius:10px;box-shadow:none}
body[data-page="attendance"] .attendance-roster .table th{height:36px;padding:0 0 12px;color:#8294b2;font-size:12px}
body[data-page="attendance"] .attendance-roster .table td{height:90px;padding:14px 0;vertical-align:top}
body[data-page="attendance"] .attendance-roster .attendance-manage-cell .primary{background:transparent;color:var(--company-link,#4376f6);padding:0;min-height:0}
body[data-page="attendance"] .deduction-management{border:0;background:transparent;box-shadow:none;padding:0}
body[data-page="attendance"] .deduction-management>.section-head{margin-bottom:14px}
body[data-page="attendance"] .deduction-summary{display:none}
body[data-page="attendance"] .deduction-management>.table-wrap{overflow:visible}
body[data-page="attendance"] .deduction-management>.table-wrap>.table,body[data-page="attendance"] .deduction-management>.table-wrap>.table tbody{display:block;width:100%;min-width:0!important}
body[data-page="attendance"] .deduction-management>.table-wrap>.table thead,body[data-page="attendance"] .deduction-management>.table-wrap>.table colgroup{display:none}
body[data-page="attendance"] .deduction-management>.table-wrap>.table tr{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;padding:20px 24px;margin:0 0 14px;background:#fff;border-radius:10px}
body[data-page="attendance"] .deduction-management>.table-wrap>.table td{display:flex;align-items:center;justify-content:space-between;gap:12px;grid-column:1/-1;min-width:0;padding:13px 0;border-top:1px solid #e8edf5;border-bottom:0;white-space:normal}
body[data-page="attendance"] .deduction-management>.table-wrap>.table td:first-child{border:0;display:block;padding:0 0 16px;color:#253552}
body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(2)::before{content:'เงินเบิก'}
body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(3)::before{content:'ค่าชุด'}
body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(4)::before{content:'ประกันสังคม'}
body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(5)::before{content:'หักอื่น'}
body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(2)::before,body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(3)::before,body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(4)::before,body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(5)::before{flex:1;color:#253552}
body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(n+2):nth-child(-n+5) small{display:none}
body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(6){grid-column:1;border-top:1px solid #e8edf5;text-align:left;justify-content:flex-start}
body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(6)::before{content:'รวมยอดหัก';margin-right:5px}
body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(7){grid-column:2;justify-content:flex-end}
@media(max-width:700px){
 body[data-page="attendance"] .attendance-controls.has-primary-action .attendance-primary-action{justify-self:start}
 body[data-page="attendance"] .attendance-roster{padding:0;background:transparent}
 body[data-page="attendance"] .attendance-roster .table td{height:auto;padding:8px 0}
 body[data-page="attendance"] .deduction-management>.table-wrap>.table tr{padding:17px}
 body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(6),body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(7){grid-column:1/-1}
 body[data-page="attendance"] .deduction-management>.table-wrap>.table td:nth-child(7){border-top:0;justify-content:flex-start;padding-top:0}
}
/* One compact row per employee; details remain in the existing editor. */
.deduction-person-list{display:grid;gap:10px}
.deduction-person-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 20px;background:#fff;border-radius:10px}
.deduction-person-info{min-width:0}.deduction-person-name{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.deduction-person-name b{color:#253552;overflow-wrap:anywhere}.deduction-person-name button{padding:2px 4px;border:0;background:transparent;color:var(--company-link)}
.deduction-person-info>small,.deduction-person-total small{display:block;color:#8294b2;font-size:12px;margin-top:4px}.deduction-person-total{text-align:right;white-space:nowrap}.deduction-person-total strong{color:#253552}
@media(max-width:700px){.deduction-person-row{padding:14px;gap:8px}.deduction-person-total{font-size:12px}.deduction-person-name{gap:6px}}
.deduction-person-breakdown{display:flex;flex-wrap:wrap;gap:5px 16px;margin-top:9px;color:#7184a1;font-size:12px;line-height:1.5}
.deduction-person-breakdown b{color:#344965;font-weight:600;white-space:nowrap}
@media(max-width:700px){.deduction-person-row{align-items:flex-start}.deduction-person-breakdown{gap:4px 10px}}
.deduction-person-name .primary{padding:7px 12px;background:var(--company-accent);color:var(--company-on-accent,#fff);border-radius:8px;font-weight:600}

/* Attendance statuses stay distinct even when the company accent changes. */
body[data-page="attendance"] .calendar-scroll .calendar-day[data-status="work"]{background:#d7f3dc;border-color:#76c989}
body[data-page="attendance"] .calendar-scroll .calendar-day[data-status="double"]{background:#176b47;border-color:#10583a}
body[data-page="attendance"] .calendar-scroll .calendar-day[data-status="off"]{background:#fff0a8;border-color:#e0bd42}
body[data-page="attendance"] .calendar-scroll .calendar-day[data-status="leave"],body[data-page="attendance"] .calendar-scroll .calendar-day[data-status="absent"]{background:#ffd6d5;border-color:#e88484}
body[data-page="attendance"] .calendar-scroll .calendar-day[data-status="double"] .calendar-day-head strong,body[data-page="attendance"] .calendar-scroll .calendar-day[data-status="double"] .calendar-day-head small,body[data-page="attendance"] .calendar-scroll .calendar-day[data-status="double"] .calendar-field{color:#fff}
.attendance-status-legend{display:flex;flex-wrap:wrap;gap:8px 18px;margin:0 0 15px;color:#536782;font-size:12px}
.attendance-status-legend span{display:inline-flex;align-items:center;gap:6px}
.attendance-status-legend i{width:14px;height:14px;border-radius:4px;border:1px solid transparent}
.attendance-status-legend .status-work{background:#d7f3dc;border-color:#76c989}
.attendance-status-legend .status-double{background:#176b47;border-color:#10583a}
.attendance-status-legend .status-off{background:#fff0a8;border-color:#e0bd42}
.attendance-status-legend .status-leave{background:#ffd6d5;border-color:#e88484}

/* Unified attendance-to-payroll flow, with company accent for primary actions. */
body[data-page="attendance"] .attendance-flow-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:18px 0;border:0}
body[data-page="attendance"] .attendance-flow-tabs .module-tab{padding:12px 16px;border:1px solid #b6c5dd;border-radius:9px;background:#fff;color:#30476a;font-size:14px;font-weight:700}
body[data-page="attendance"] .attendance-flow-tabs .module-tab.active{background:var(--company-accent,#ff7900);color:var(--company-on-accent,#fff);border-color:var(--company-accent,#ff7900)}
body[data-page="attendance"] .attendance-controls .location-filter-bar{border:1px solid #cbd7e9;background:#fff}
body[data-page="attendance"] .attendance-controls input,body[data-page="attendance"] .attendance-controls select{background:#f1f6ff;border:1px solid #b3c3dc;color:#233a5f}
body[data-page="attendance"] .attendance-roster,body[data-page="attendance"] .deduction-person-row,body[data-page="attendance"] .finance-pay-progress,body[data-page="attendance"] .finance-employee-detail{border:1px solid #cbd7e9;box-shadow:0 4px 14px #18396512}
body[data-page="attendance"] .attendance-roster .attendance-manage-cell .primary{background:var(--company-accent,#ff7900);color:var(--company-on-accent,#fff);padding:9px 14px;border-radius:8px;font-weight:700}
body[data-page="attendance"] .finance-pay-progress{padding:20px;border-radius:12px;background:#fff;margin:16px 0}
body[data-page="attendance"] .finance-pay-progress>div:first-child b,body[data-page="attendance"] .finance-pay-progress>div:first-child small{display:block}
body[data-page="attendance"] .finance-pay-formula{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;margin:18px 0}
body[data-page="attendance"] .finance-pay-formula>div{background:#eef4ff;border-radius:9px;padding:12px}
body[data-page="attendance"] .finance-pay-formula small,body[data-page="attendance"] .finance-pay-formula strong{display:block}
body[data-page="attendance"] .finance-pay-formula strong{color:#203a60;font-size:18px;margin:5px 0}
body[data-page="attendance"] .finance-pay-formula .finance-formula-total{background:#dff3e6}
@media(max-width:700px){body[data-page="attendance"] .attendance-flow-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}body[data-page="attendance"] .attendance-flow-tabs .module-tab{padding:10px 5px;font-size:12px;white-space:normal}body[data-page="attendance"] .finance-pay-formula{grid-template-columns:repeat(2,minmax(0,1fr))}body[data-page="attendance"] .finance-pay-progress{padding:15px}}

@media (min-width:701px){
 body[data-page="attendance"] .attendance-roster .table{min-width:880px}
 body[data-page="attendance"] .attendance-roster .table th:nth-child(5),
 body[data-page="attendance"] .attendance-roster .table td:nth-child(5){padding-right:12px}
 body[data-page="attendance"] .attendance-roster .table th:nth-child(6),
 body[data-page="attendance"] .attendance-roster .table td:nth-child(6){padding-left:16px}
}
.person-filter-bar{display:grid;grid-template-columns:repeat(3,minmax(120px,1fr)) minmax(180px,2fr) auto;gap:10px;align-items:end;padding:15px;background:#fff;border:1px solid #dce5f0;border-radius:10px;margin:14px 0}
.person-filter-bar label{display:grid;gap:5px;font-size:12px;color:#516884;font-weight:600}.person-filter-bar input,.person-filter-bar select{width:100%;min-width:0;padding:10px;border:1px solid #c7d4e5;border-radius:8px;background:#f7f9fd;color:#253b5f}.person-filter-bar button{min-height:40px}.person-filter-note{margin:8px 0 14px}
@media(max-width:850px){.person-filter-bar{grid-template-columns:repeat(2,minmax(0,1fr))}.person-filter-bar label:nth-child(4){grid-column:1/-1}.person-filter-bar button{justify-self:start}}

/* Thai date picker: keep the native input for form values and validation. */
.thai-date-control{display:block;position:relative;min-width:0}.thai-date-control>input[type="date"]{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;overflow:hidden}.thai-date-trigger{display:flex!important;align-items:center;justify-content:space-between;gap:10px;width:100%;min-height:42px;text-align:left;padding:9px 12px;border:1px solid #cbd8e8;border-radius:8px;background:#f7f9fd;color:#223c61;font:inherit}.thai-date-trigger::after{content:'▦';font-size:17px;color:var(--company-link,#3569b8)}.thai-date-trigger:focus-visible{outline:3px solid #85b6ff;outline-offset:2px}.thai-date-trigger:disabled{opacity:.65;cursor:not-allowed}
.thai-date-popup{position:fixed;z-index:9999;padding:14px;background:#fff;color:#203453;border:1px solid #c8d7e9;border-radius:12px;box-shadow:0 10px 36px #142c4f40;font-size:14px}.thai-date-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.thai-date-head button,.thai-date-footer button{border:0;background:#edf3fd;color:#214e89;border-radius:8px;padding:7px 12px;font:inherit;cursor:pointer}.thai-date-head button{font-size:21px;line-height:1}.thai-date-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:3px;text-align:center}.thai-date-grid button{min-width:0;min-height:36px;border:0;border-radius:8px;background:transparent;color:#233c5f;font:inherit;cursor:pointer}.thai-date-grid button:hover{background:#e6efff}.thai-date-grid button.today{box-shadow:inset 0 0 0 2px #5a88bf;font-weight:700}.thai-date-grid button.selected{background:var(--company-accent,#ff7900);color:var(--company-on-accent,#fff);font-weight:700}.thai-date-grid button:disabled,.thai-date-footer button:disabled{opacity:.35;cursor:not-allowed}.thai-date-weekdays{color:#607795;font-size:12px;font-weight:700;margin-bottom:6px}.thai-date-footer{display:flex;justify-content:space-between;margin-top:10px}
@media(max-width:700px){
 body[data-page="attendance"] .payroll-roster>.card{padding:15px}
 body[data-page="attendance"] .payroll-roster .table-wrap{overflow:visible;border:0}
 body[data-page="attendance"] .payroll-roster .table,body[data-page="attendance"] .payroll-roster tbody{display:block;width:100%;min-width:0!important}
 body[data-page="attendance"] .payroll-roster thead,body[data-page="attendance"] .payroll-roster colgroup{display:none}
 body[data-page="attendance"] .payroll-roster tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 14px;margin:10px 0;padding:13px;border:1px solid #dbe5f1;border-radius:10px;background:#fff}
 body[data-page="attendance"] .payroll-roster td{display:flex;justify-content:space-between;align-items:center;gap:8px;min-width:0;padding:8px 0;border:0;white-space:normal;text-align:right;font-size:12px}
 body[data-page="attendance"] .payroll-roster td::before{content:attr(data-label);color:#667c9c;text-align:left;font-size:11px}
 body[data-page="attendance"] .payroll-roster td:first-child{display:block;grid-column:1/-1;text-align:left;border-bottom:1px solid #eef2f7;padding-bottom:10px}
 body[data-page="attendance"] .payroll-roster td:first-child::before,body[data-page="attendance"] .payroll-roster td:last-child::before{display:none}
 body[data-page="attendance"] .payroll-roster td:last-child{grid-column:1/-1;justify-content:flex-end;border-top:1px solid #eef2f7;margin-top:5px;padding-top:10px}
}
