*{box-sizing:border-box}body{margin:0;font-family:'Sarabun',sans-serif;color:#153d5b}body.admin-locked>.container{display:none}[hidden]{display:none!important}button,input{font:inherit}button{cursor:pointer}button:disabled,input:disabled{opacity:.55;cursor:default}.history-shell{width:100%;max-width:1000px;position:relative;z-index:1;margin:0 auto}.history-nav{display:flex;align-items:center;justify-content:space-between;gap:14px;font-size:12px}.history-nav a{color:#366e91;text-decoration:none}.history-nav span{font-size:10px;letter-spacing:1.6px;color:#678699}.history-nav button,.secondary-button{border:1px solid #cde2ef;background:#ffffffb8;color:#366e91;padding:10px 14px;border-radius:12px;min-height:42px}.history-heading{margin:34px 0 24px}.history-heading h1{font-size:32px;margin:10px 0}.history-heading p{font-size:14px;color:#58768c}.history-badge{font-size:12px;background:#fff9;padding:7px 12px;border-radius:20px;color:#357f9d}.filter-card,.daily-result,.monthly-result{padding:26px;background:linear-gradient(145deg,#fff,#f8fcff);border:1px solid #fff;border-radius:24px;box-shadow:0 12px 34px #286d9510;margin-bottom:20px}.filter-grid{display:grid;grid-template-columns:1.4fr 1fr;gap:26px}label{display:block;font-size:13px;font-weight:600;margin-bottom:9px}input{display:block;width:100%;min-height:48px;border:1px solid #c4dfe9;border-radius:12px;padding:11px 14px;background:#f9fcff;color:#214d6a;margin-bottom:12px}input:focus{outline:3px solid #228cb51c;border-color:#469fc4}.employee-list{display:flex;gap:8px;flex-wrap:wrap;max-height:190px;overflow:auto}.employee-option{padding:10px 14px;min-height:44px;border:1px solid #d4e7f1;border-radius:12px;background:#f3f9ff;color:#396780;overflow-wrap:anywhere}.employee-option[aria-pressed=true]{background:#207dab;color:#fff;border-color:#207dab}.small-note{font-size:12px;color:#5e7d92;line-height:1.7}.secondary-button{margin:2px 6px 4px 0;font-size:12px}#report-status{font-size:13px;margin:14px 0 0}#report-status[data-error=true]{color:#b33246}.result-heading{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:22px}.result-heading h2{font-size:22px;margin:4px 0;overflow-wrap:anywhere}.result-heading p{font-size:13px;color:#608098;margin:4px 0}.count-pill{font-size:12px;color:#287996;background:#e9f7fc;padding:8px 12px;border-radius:20px;white-space:nowrap}.time-slots{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:13px}.time-slot{border:1px solid #d9eaf5;background:linear-gradient(145deg,#edf8ff,#f8fcff);border-radius:18px;padding:18px 14px}.time-slot span{font-size:12px;color:#5c7f96}.time-slot strong{display:block;font-size:26px;color:#216887;margin:12px 0 6px;font-variant-numeric:tabular-nums}.time-slot small{font-size:11px;color:#60849a}.time-slot.is-empty{background:#f5f8fa;border-style:dashed}.time-slot.is-empty strong{color:#91a7b6}.table-scroll{overflow-x:auto}table{width:100%;border-collapse:collapse;text-align:left;white-space:nowrap;font-size:13px}th{background:#edf6fc;padding:12px;color:#436c86;font-weight:600}td{border-bottom:1px solid #e9f0f5;padding:11px 12px;font-variant-numeric:tabular-nums}td button{border:0;background:transparent;color:#1c729d;padding:7px 0;font:inherit;text-decoration:underline;text-underline-offset:3px}tr.selected-day td{background:#eaf7ff}.empty-state{text-align:center;padding:20px;color:#63839a}.history-footer{text-align:center;font-size:12px;color:#6a899e;padding:8px}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}@media(max-width:650px){body{padding:22px 14px}.history-nav span{display:none}.history-heading{margin:26px 0 20px}.history-heading h1{font-size:27px}.filter-grid{grid-template-columns:1fr;gap:16px}.filter-card,.daily-result,.monthly-result{padding:20px 16px}.time-slots{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.time-slot strong{font-size:24px}.result-heading{align-items:flex-start}.result-heading h2{font-size:20px}}

/* Clear date and large navigation targets. */
.history-nav{flex-wrap:wrap}
.history-nav .history-back,.history-back-bottom{display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:50px;padding:12px 20px;border:1px solid #16618a;border-radius:14px;background:linear-gradient(120deg,#117aab,#205990);color:#fff;font-size:16px;font-weight:700;text-decoration:none;box-shadow:0 5px 14px #206a9426}
.history-nav .history-back span{display:inline;color:inherit;font-size:24px;letter-spacing:0;line-height:1}
.history-back:hover{filter:brightness(1.08)}
.history-back:focus-visible{outline:3px solid #08618d;outline-offset:4px}
.selected-date-card{margin-top:16px;padding:16px 20px;border:1px solid #a8d4ed;border-left:5px solid #1785b4;border-radius:16px;background:linear-gradient(110deg,#e3f4ff,#f0fbff)}
.date-caption{display:block;color:#356780;font-size:14px;font-weight:600;margin-bottom:6px}
.result-heading #selected-date{font-size:clamp(23px,3.4vw,30px);font-weight:700;color:#12557b;line-height:1.4;margin:0}
#daily-result>.result-heading{align-items:flex-start}
#daily-result>.result-heading>div{flex:1;min-width:0}
.history-back-bottom{display:flex;width:fit-content;min-width:200px;margin:24px auto 18px}
@media(max-width:650px){#daily-result>.result-heading{flex-wrap:wrap}#daily-result>.result-heading>div{flex-basis:100%}.selected-date-card{padding:14px}.history-back-bottom{width:100%}.history-nav .history-back{padding:12px 16px}}

select#employee-query{font:inherit;width:100%;min-height:52px;padding:12px;border:1px solid #9fc9e1;border-radius:12px;background:#fff;color:#153d5b}.time-slot.is-normal,td.is-normal{background:#e6f5ec;color:#146b3b}.time-slot.is-late,td.is-late{background:#ffeded;color:#af2635}.time-slot.is-normal strong{color:#146b3b}.time-slot.is-late strong{color:#af2635}

.time-slot.is-absent,td.is-absent{background:#111!important;color:#fff!important}.time-slot.is-absent strong,.time-slot.is-absent span,.time-slot.is-absent small{color:#fff!important}

.time-slot.is-holiday,td.is-holiday{background:#e5edf5!important;color:#35536e!important}.time-slot.is-holiday strong,.time-slot.is-holiday span{color:#35536e!important}

.notes-heading,.notes-cell{min-width:280px;width:32%;max-width:480px}.notes-cell{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7;vertical-align:top;padding:14px 16px}

.notes-cell textarea{width:100%;min-width:260px;min-height:90px;resize:vertical;font:inherit;line-height:1.6;padding:10px;border:1px solid #a4cbe2;border-radius:10px;box-sizing:border-box}.notes-cell .note-save{background:#176b96;color:white;text-decoration:none;border-radius:10px;padding:10px 14px;min-height:44px;margin-top:8px}.notes-cell .note-save:disabled{opacity:.5}

/* Compact notes editor */
.notes-heading,.notes-cell{min-width:180px;width:22%;max-width:260px}.notes-cell{padding:9px 10px;line-height:1.45}.notes-cell textarea{min-width:160px;min-height:52px;height:52px;font-size:12px;line-height:1.45;padding:7px 8px;border-radius:8px}.notes-cell .note-save{font-size:11px;padding:7px 10px;min-height:34px;margin-top:5px}.notes-cell .small-note{font-size:11px;line-height:1.45;margin:5px 0 0;white-space:normal}

/* Two visible text lines; long notes scroll inside the field. */
.notes-cell textarea{font-size:12px;line-height:18px;height:52px;min-height:52px;max-height:52px;padding:7px 8px;box-sizing:border-box;overflow-y:scroll;overflow-x:hidden;resize:none;white-space:pre-wrap;overflow-wrap:anywhere;scrollbar-gutter:stable}

/* Compact daily rows */
.monthly-result td{padding:6px 9px;vertical-align:middle;font-size:12px}.monthly-result th{padding:9px}.monthly-result td button{padding:4px 0}.notes-cell{padding:6px 8px!important}.note-controls{display:flex;align-items:center;gap:6px}.notes-cell .note-controls textarea{flex:1;min-width:120px;width:120px;font-size:12px;line-height:16px;height:42px;min-height:42px;max-height:42px;padding:4px 6px;overflow-y:scroll;resize:none}.notes-cell .note-controls .note-save{flex:none;min-height:34px;padding:6px 8px;margin:0;font-size:10px;border-radius:8px}.notes-cell .small-note:empty{display:none}.notes-cell .small-note{margin:3px 0 0;font-size:10px;line-height:1.3}

/* Give notes the remaining width and keep status columns narrow. */
.monthly-result table{table-layout:fixed;min-width:850px}.monthly-result th:nth-child(1){width:155px}.monthly-result th:nth-child(2),.monthly-result th:nth-child(3){width:85px}.monthly-result th:nth-child(4),.monthly-result th:nth-child(5){width:72px}.monthly-result td:nth-child(4),.monthly-result td:nth-child(5){padding-left:6px;padding-right:6px}.monthly-result .notes-heading,.monthly-result .notes-cell{width:auto;min-width:0;max-width:none}.notes-cell .note-controls textarea{width:100%;min-width:0;flex:1 1 0}.notes-cell .note-controls .note-save{flex:0 0 auto}

/* Equal-width columns, larger one-line viewport for notes. */
.monthly-result table{table-layout:fixed;min-width:1080px}.monthly-result table th:nth-child(n),.monthly-result table td:nth-child(n){width:16.666667%;min-width:0;max-width:none}.notes-cell .note-controls textarea{font-size:16px;line-height:22px;height:32px;min-height:32px;max-height:32px;padding:4px 6px;box-sizing:border-box;overflow-y:scroll;overflow-x:hidden;white-space:pre-wrap;overflow-wrap:anywhere;resize:none}.notes-cell .note-controls{flex-wrap:wrap}.notes-cell .note-controls textarea{flex:1 1 100%;width:100%}.notes-cell .note-controls .note-save{margin:0;min-height:30px;padding:5px 8px}

/* Compact time/status columns; leave more space for notes. */
.monthly-result table{min-width:740px}.monthly-result table th:nth-child(1),.monthly-result table td:nth-child(1){width:155px}.monthly-result table th:nth-child(2),.monthly-result table td:nth-child(2),.monthly-result table th:nth-child(3),.monthly-result table td:nth-child(3){width:82px;padding-left:6px;padding-right:6px}.monthly-result table th:nth-child(4),.monthly-result table td:nth-child(4),.monthly-result table th:nth-child(5),.monthly-result table td:nth-child(5){width:72px;padding-left:5px;padding-right:5px}.monthly-result table th:nth-child(6),.monthly-result table td:nth-child(6){width:auto}

/* Keep note input and save button on the same row. */
.notes-cell .note-controls{display:flex;flex-wrap:nowrap;align-items:center;gap:6px}.notes-cell .note-controls textarea{flex:1 1 0;width:0;min-width:0}.notes-cell .note-controls .note-save{flex:0 0 auto;white-space:nowrap;margin:0}

/* Redistribute a little note space across the other columns. */
.monthly-result table{min-width:820px}.monthly-result table th:nth-child(1),.monthly-result table td:nth-child(1){width:18%}.monthly-result table th:nth-child(2),.monthly-result table td:nth-child(2),.monthly-result table th:nth-child(3),.monthly-result table td:nth-child(3){width:11%}.monthly-result table th:nth-child(4),.monthly-result table td:nth-child(4),.monthly-result table th:nth-child(5),.monthly-result table td:nth-child(5){width:10%}.monthly-result table th:nth-child(6),.monthly-result table td:nth-child(6){width:40%}

/* Preserve each field width when swapping status-in and time-out. */
.monthly-result table th:nth-child(3),.monthly-result table td:nth-child(3){width:10%;padding-left:5px;padding-right:5px}.monthly-result table th:nth-child(4),.monthly-result table td:nth-child(4){width:11%;padding-left:6px;padding-right:6px}
