/* Payroll › Attendance tab: the attendance sheet (a small spreadsheet), its toolbar, checks and upload.
 * Builds on the tokens and components in css/app.css. Page-only classes are prefixed att-. */

.att { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.att-notices { display: flex; flex-direction: column; gap: var(--space-3); }
.att-notices:empty { display: none; }
.att-notice-list { margin: var(--space-1) 0 0; padding-left: var(--space-5); list-style: disc; }
.att-notice-list li { margin: 2px 0; overflow-wrap: anywhere; }
.att-notice-list li::marker { color: var(--text-subtle); }
.att-notice .callout-body { min-width: 0; }

/* ---------------------------------------------------------------- card header, toolbar, footer */

.att-card { min-width: 0; }
.att-card-head { align-items: flex-start; }
.att-card-head .card-heading { gap: var(--space-1); }
.att-source { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); }
.att-src { display: inline-flex; align-items: center; gap: var(--space-1-5); white-space: nowrap; }
.att-src .icon { color: var(--text-subtle); }

.att-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); flex-wrap: wrap;
  padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--border);
}
.att-toolbar-start, .att-toolbar-end { display: flex; align-items: center; gap: var(--space-1-5); flex-wrap: wrap; min-width: 0; }
.att-sep { width: 1px; height: 20px; margin: 0 var(--space-1); background: var(--border); }
.att-toolbar .menu-wrap .btn .count { margin-left: 2px; height: 18px; min-width: 18px; background: var(--primary-soft); color: var(--primary-soft-text); }

.att-status { display: flex; align-items: center; min-height: 30px; }
.att-status-item {
  display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  white-space: nowrap;
}
.att-status-item.is-muted { color: var(--text-muted); font-weight: var(--fw-regular); }
.att-status-item.is-ok { color: var(--success-text); }
.att-status-item.is-warning { color: var(--warning-text); }
.att-status-item.is-error { color: var(--danger-text); }
.att-status-item .btn-link { margin-left: var(--space-1); }
.att-status-text { max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.att-status-btn {
  height: 30px; padding: 0 var(--space-2-5); border: 1px solid transparent; border-radius: var(--radius-sm); background: none;
  font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-medium); cursor: pointer;
}
.att-status-btn.is-error { background: var(--danger-soft); border-color: var(--danger-border); }
.att-status-btn.is-warning { background: var(--warning-soft); border-color: var(--warning-border); }
.att-status-btn:hover { filter: brightness(.98); text-decoration: underline; text-underline-offset: 2px; }
.att-status-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.att-issues { padding: var(--space-4); border-top: 1px solid var(--border); }
.att-issues .issue-box { box-shadow: none; }
/* an issue with a direct fix ("Match…", "Add to sheet"): the button sits beside the issue, which may itself be a button */
.att-issue-has-add {
  display: flex; align-items: center; gap: var(--space-2); padding-right: var(--space-4); border-bottom: 1px solid var(--border-subtle);
}
.issue-list > li.att-issue-has-add:last-child { border-bottom: 0; }
.att-issue-has-add > .issue { flex: 1 1 auto; min-width: 0; border-bottom: 0; }
.att-issue-add { flex: none; }
/* after a paste placed by position: the rows it went into, in order */
.att-paste-check { display: flex; flex-direction: column; gap: var(--space-1-5); margin-top: var(--space-1); }
.att-paste-order { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin: 0; padding: 0; list-style: none; }
.att-paste-order li { display: inline-flex; align-items: baseline; gap: var(--space-1); color: var(--text); font-weight: var(--fw-medium); }
.att-paste-num {
  min-width: 18px; padding: 0 4px; border-radius: var(--radius-xs); background: var(--surface-3); color: var(--text-muted);
  font-size: 11px; font-weight: var(--fw-medium); text-align: center; font-variant-numeric: tabular-nums;
}
.att-paste-order .att-paste-more { color: var(--text-muted); font-weight: var(--fw-regular); }
.att-confirm-list { margin: 0; padding-left: var(--space-5); list-style: disc; display: flex; flex-direction: column; gap: var(--space-2); }
.att-confirm-list li::marker { color: var(--text-subtle); }
/* rates changed on the Employees page since the month was calculated (in the Recalculate confirmation) */
.att-rate-point p { margin: 0 0 var(--space-1); }
.att-rate-list { margin: 0; padding-left: var(--space-5); list-style: circle; font-variant-numeric: tabular-nums; }
.att-rate-list li { margin: 2px 0; overflow-wrap: anywhere; }

.att-card-foot { gap: var(--space-3); }
.att-foot-info { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
/* the grand total, for phones (the Total column is off to the right there) */
.att-foot-total { display: none; align-items: center; flex-wrap: wrap; gap: var(--space-1) var(--space-2); }
.att-foot-total-label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text); }
.att-foot-total-value { font-variant-numeric: tabular-nums; }
.att-foot-total-value.total-soft { padding: 2px var(--space-2); border-radius: var(--radius-sm); font-weight: var(--fw-semibold); }
.att-foot-total-note { font-size: var(--fs-xs); color: var(--text-muted); }
.att-save-state { display: flex; align-items: center; gap: var(--space-2); color: var(--text-muted); font-size: var(--fs-sm); min-width: 0; }
.att-save-state > span:nth-child(2) { color: var(--text); font-weight: var(--fw-medium); }
.att-save-count { padding-left: var(--space-2); margin-left: var(--space-1); border-left: 1px solid var(--border-strong); line-height: 1; }
.att-foot-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

/* ---------------------------------------------------------------- info bar ("formula bar") */

.att-info {
  display: flex; align-items: center; gap: var(--space-2); min-height: 36px; padding: var(--space-1-5) var(--space-4);
  border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); font-size: var(--fs-sm);
  line-height: var(--lh-snug); min-width: 0;
}
.att-info-icon { color: var(--text-subtle); flex: none; }
.att-info-where {
  flex: none; max-width: 42%; padding-right: var(--space-2-5); margin-right: var(--space-0-5); border-right: 1px solid var(--border-strong);
  color: var(--text); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.att-info-where:empty { display: none; }
.att-info-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* "Esc then Tab leaves the sheet": only while the keyboard is in the sheet */
.att-info-leave {
  display: none; flex: none; align-items: center; gap: var(--space-1); margin-left: auto; padding-left: var(--space-3);
  font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap;
}
.att-info-leave kbd { font-size: 11px; }
.att-grid-block.is-kbd:focus-within .att-info-leave { display: inline-flex; }
.att-info.is-danger .att-info-text, .att-info.is-danger .att-info-icon { color: var(--danger-text); }
.att-info.is-warning .att-info-text, .att-info.is-warning .att-info-icon { color: var(--warning-text); }
.att-info.is-flash { animation: att-info-flash .9s var(--ease); }
@keyframes att-info-flash { from { background-color: var(--primary-soft-hover); } }
.att-info.is-warning.is-flash { animation-name: att-info-flash-warn; }
@keyframes att-info-flash-warn { from { background-color: var(--warning-soft); } }

/* ---------------------------------------------------------------- the grid */

.att-grid-wrap {
  --w-name: 236px; --w-qty: 92px; --w-money: 124px; --w-text: 164px; --w-note: 200px; --w-total: 148px;
  --row-h: 40px; --group-h: 28px; --head-h: 36px;
  --att-edge: rgba(15, 23, 34, .09);
  --att-stripe: var(--border-subtle);
  position: relative; overflow: auto; background: var(--surface);
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  /* fill the window below the sheet's top (--att-top, measured by attendance.js) but leave room for the card
     footer (--att-below), so the sticky totals row and Save / Calculate are visible without scrolling the page */
  max-height: clamp(320px, calc(100vh - var(--att-top, 360px) - var(--att-below, 88px)), 1400px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .att-grid-wrap { --att-edge: rgba(0, 0, 0, .5); --att-stripe: var(--border); }
}
:root[data-theme="dark"] .att-grid-wrap { --att-edge: rgba(0, 0, 0, .5); --att-stripe: var(--border); }

.att-grid {
  table-layout: fixed; border-collapse: separate; border-spacing: 0; width: 100%;
  min-width: calc(var(--w-name) + 8 * var(--w-qty) + 3 * var(--w-money) + 2 * var(--w-text) + var(--w-note) + var(--w-total));
  font-size: var(--fs-base); color: var(--text);
}
.att-w-name { width: var(--w-name); }
.att-w-qty { width: var(--w-qty); }
.att-w-money { width: var(--w-money); }
.att-w-text { width: var(--w-text); }
.att-w-note { width: var(--w-note); }
.att-w-total { width: var(--w-total); }

.att-grid th, .att-grid td {
  padding: 0; height: var(--row-h); background-color: var(--surface); text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle); border-right: 1px solid var(--border-subtle);
}
.att-grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.att-grid .att-ge { border-right-color: var(--border); }

/* header: group row + column row, both sticky */
.att-grid thead th {
  position: sticky; z-index: 3; background-color: var(--surface-2); color: var(--text-muted);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); white-space: nowrap;
}
.att-groups th { top: 0; height: var(--group-h); padding: 0 var(--space-2-5); letter-spacing: .03em; text-transform: uppercase; font-size: 11px; color: var(--text-subtle); border-right-color: var(--border); }
/* the group label follows the scroll while any of its columns is visible */
.att-groups th.att-group > span {
  position: sticky; left: calc(var(--w-name) + var(--space-2-5)); right: calc(var(--w-total) + var(--space-2-5));
  display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
}
.att-heads th { top: var(--group-h); height: var(--head-h); border-bottom-color: var(--border); }
.att-grid thead .att-corner {
  left: 0; top: 0; z-index: 6; padding: 0 var(--space-3) 0 var(--space-4); vertical-align: bottom;
  border-bottom-color: var(--border); text-transform: none; letter-spacing: 0; font-size: var(--fs-xs); color: var(--text-muted);
}
.att-corner-label { display: flex; align-items: center; height: var(--head-h); }
.att-grid thead .att-total-head {
  right: 0; top: 0; z-index: 6; padding: 0 var(--space-3); text-align: right; vertical-align: bottom;
  border-bottom-color: var(--border); text-transform: none; letter-spacing: 0; font-size: var(--fs-xs); color: var(--accent-soft-text);
  background-color: var(--accent-soft);
}
.att-total-head > span { display: flex; align-items: center; justify-content: flex-end; height: var(--head-h); }

.att-colbtn {
  display: flex; align-items: center; width: 100%; height: 100%; padding: 0 var(--space-2-5); margin: 0;
  border: 0; border-radius: 0; background: none; color: inherit; font: inherit; letter-spacing: .01em; cursor: pointer; text-align: inherit;
}
.att-head.num .att-colbtn { justify-content: flex-end; }
.att-colbtn-text { position: relative; display: flex; min-width: 0; max-width: 100%; }
.att-colbtn-label { overflow: hidden; text-overflow: ellipsis; }
/* the chevron sits in the padding next to the label, so it never squeezes the label */
.att-colbtn-icon { position: absolute; top: 50%; left: 100%; margin: -6px 0 0 1px; opacity: 0; transition: opacity var(--dur-fast) var(--ease); }
.att-head.num .att-colbtn-icon { left: auto; right: 100%; margin: -6px 1px 0 0; }
.att-colbtn:hover { background: var(--surface-3); color: var(--text); }
.att-colbtn:hover .att-colbtn-icon, .att-colbtn:focus-visible .att-colbtn-icon, .att-colbtn[aria-expanded="true"] .att-colbtn-icon,
.att-head.is-active-col .att-colbtn-icon { opacity: .8; }
.att-colbtn[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.att-colbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: var(--radius-xs); }
.att-head.is-active-col .att-colbtn-icon { opacity: .8; }
.att-colbtn[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.att-colbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: var(--radius-xs); }
.att-head.is-active-col { color: var(--primary-text); box-shadow: inset 0 -2px 0 var(--primary-text); }

/* row header: name + section, sticky on the left */
.att-grid tbody .att-name, .att-grid tfoot .att-name { position: sticky; left: 0; z-index: 2; }
.att-name-cell { display: flex; align-items: center; gap: var(--space-2); height: calc(var(--row-h) - 1px); padding: 0 var(--space-1) 0 var(--space-1-5); min-width: 0; }
.att-rownum {
  flex: none; width: 22px; text-align: right; font-size: 11px; font-weight: var(--fw-medium); color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}
.att-name-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; line-height: 1.2; }
.att-nama { font-weight: var(--fw-semibold); font-size: var(--fs-sm); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-bagian { margin-top: 1px; font-size: var(--fs-xs); font-weight: var(--fw-regular); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-bagian.is-danger { display: flex; align-items: center; gap: 3px; color: var(--danger-text); font-weight: var(--fw-medium); }
.att-bagian.is-danger .icon { flex: none; }
.att-bagian.is-danger > span { overflow: hidden; text-overflow: ellipsis; }
.att-inactive { color: var(--warning-text); font-weight: var(--fw-medium); }
.att-rowmenu { flex: none; }
.att-rowmenu .btn { color: var(--text-subtle); --btn-h: 28px; width: 28px; }
.att-rowmenu .btn:hover, .att-rowmenu .btn[aria-expanded="true"] { color: var(--text); }
.att-rowmenu .btn:focus-visible { outline-offset: -2px; }

/* data cells */
.att-cell { position: relative; }
.att-input {
  display: block; width: 100%; height: calc(var(--row-h) - 1px); margin: 0; padding: 0 var(--space-3);
  border: 0; border-radius: 0; background: transparent; color: var(--text); font: inherit; font-size: var(--fs-base);
  font-variant-numeric: tabular-nums; text-overflow: ellipsis; caret-color: transparent; outline: none; box-shadow: none;
  -webkit-appearance: none; appearance: none;
}
.att-input:focus, .att-input:focus-visible { outline: none; }
.att-cell.num .att-input { text-align: right; }
.att-cell:not(.is-editing) .att-input::selection { background: transparent; }
.att-cell.is-editing .att-input { caret-color: var(--text); }
/* the active cell: an outline (not a shadow), so it also shows in forced colours */
.att-cell:focus-within { z-index: 1; outline: 2px solid var(--focus); outline-offset: -2px; }
.att-cell.is-editing { background-color: var(--surface); box-shadow: 0 0 0 3px var(--primary-ring); }

/* rows: hover, active, new */
.att-row:hover > td.att-cell:not(.is-na):not(.is-invalid):not(.is-ignored), .att-row:hover > th.att-name { background-color: var(--row-hover); }
.att-row.is-active > th.att-name { background-color: var(--row-selected); }
.att-row.is-active .att-rownum { color: var(--primary-text); }
.att-row.is-new > th, .att-row.is-new > td { animation: att-row-new 1.5s var(--ease); }
@keyframes att-row-new { from { background-color: var(--primary-soft-hover); } }
.att-cell.is-flash { animation: att-cell-flash 1.1s var(--ease); }
@keyframes att-cell-flash { from { background-color: var(--primary-soft-hover); } }

/* cells that don't apply to this person (no rate set) */
.att-cell.is-na {
  background-color: var(--surface-2);
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--att-stripe) 6px 7px);
}
.att-cell.is-na .att-input { color: var(--text-subtle); cursor: default; }
.att-cell.is-ignored { background-color: var(--warning-soft); background-image: none; }
.att-cell.is-ignored .att-input { color: var(--warning-text); text-decoration: line-through; text-decoration-thickness: 1px; }
.att-cell.is-invalid { background-color: var(--danger-soft); }
.att-cell.is-invalid .att-input { color: var(--danger-text); font-weight: var(--fw-medium); }
/* corner markers (like Excel's comment triangle) */
.att-cell.is-invalid::after, .att-cell.has-error::after, .att-cell.is-ignored::after, .att-cell.has-warning::after {
  content: ""; position: absolute; top: 0; right: 0; width: 0; height: 0; pointer-events: none;
  border-style: solid; border-width: 0 8px 8px 0; border-color: transparent var(--danger) transparent transparent;
}
.att-cell.is-ignored::after, .att-cell.has-warning::after { border-right-color: var(--warning); }
.att-cell.has-error:not(.is-invalid) { background-color: var(--danger-soft); }
@supports (background: color-mix(in srgb, red 50%, transparent)) {
  .att-cell.has-error:not(.is-invalid) { background-color: color-mix(in srgb, var(--danger-soft) 70%, var(--surface)); }
}

/* rows with problems (from the live check) */
.att-row.is-error > th.att-name { box-shadow: inset 3px 0 0 var(--danger); }
.att-row.is-warning > th.att-name { box-shadow: inset 3px 0 0 var(--warning); }
.att-row.is-unknown .att-nama { color: var(--danger-text); }

/* total column: sticky on the right, lime like the Excel "Total Gaji" */
.att-grid tbody .att-total, .att-grid tfoot .att-total { position: sticky; right: 0; z-index: 2; }
.att-grid tbody .att-total {
  padding: 0 var(--space-3); background-color: var(--accent-soft); color: var(--accent-soft-text);
  font-weight: var(--fw-semibold); white-space: nowrap; border-right: 0;
}
.att-total-val { transition: color var(--dur) var(--ease); }
/* being re-checked: muted (still AA) instead of faded */
.att-grid tbody .att-total.is-stale { color: var(--text-muted); font-weight: var(--fw-medium); }
.att-grid tbody .att-total.is-none { color: var(--text-subtle); font-weight: var(--fw-regular); }
.att-grid tbody .att-total.is-negative { color: var(--danger-text); }

/* footer: sums and the grand total, sticky at the bottom */
.att-grid tfoot th, .att-grid tfoot td {
  position: sticky; bottom: 0; z-index: 3; height: 40px; padding: 0 var(--space-3); background-color: var(--surface-2);
  border-top: 1px solid var(--border); border-bottom: 0; font-size: var(--fs-sm); color: var(--text-muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.att-grid tfoot .att-name { z-index: 5; padding-left: var(--space-4); }
.att-foot-label { font-weight: var(--fw-semibold); color: var(--text); }
.att-foot-count { margin-left: var(--space-2); font-weight: var(--fw-regular); color: var(--text-muted); }
.att-grid tfoot .att-total {
  z-index: 5; text-align: right; background-color: var(--accent); color: var(--on-accent); font-size: var(--fs-base);
  font-weight: var(--fw-bold); border-right: 0;
}
.att-grid tfoot .att-total.is-partial { background-color: var(--accent-soft); color: var(--accent-soft-text); font-weight: var(--fw-semibold); }
.att-grid tfoot .att-total.is-stale { background-color: var(--accent-soft); color: var(--text-muted); }
.att-ft { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; line-height: 1.15; }
.att-ft-note { font-size: 11px; font-weight: var(--fw-medium); color: var(--accent-soft-text); }
.att-grid tfoot .att-total.is-stale .att-ft-note { color: var(--text-muted); }

/* shadows on the sticky edges once the sheet scrolls sideways */
.att-grid .att-name::after, .att-grid .att-total::before {
  content: ""; position: absolute; top: 0; bottom: -1px; width: 10px; pointer-events: none; opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.att-grid .att-name::after { right: -11px; background: linear-gradient(to right, var(--att-edge), transparent); }
.att-grid .att-total::before { left: -11px; background: linear-gradient(to left, var(--att-edge), transparent); }
.att-grid-wrap.is-scrolled-x .att-name::after { opacity: 1; }
.att-grid-wrap:not(.is-scrolled-end) .att-total::before { opacity: 1; }

.att-grid-wrap { container-type: inline-size; }
.att-empty-row td { height: 132px; text-align: left; color: var(--text-muted); background: var(--surface); }
.att-empty-row:hover td { background: var(--surface); }
/* as wide as the visible part of the sheet (not the whole 2000px row), and stays there when scrolled */
.att-empty-inner {
  position: sticky; left: 0; display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  /* without container units (Safari 15) the first width applies: attendance.js measures the sheet */
  width: var(--att-wrap-w, 100%); width: 100cqw; max-width: 100%; padding: 0 var(--space-4); text-align: center; flex-wrap: wrap;
}
.att-empty-inner .icon { flex: none; color: var(--text-subtle); }
.att-empty-text a { font-weight: var(--fw-medium); }

/* ---------------------------------------------------------------- column popover (help + fill actions) */

.att-pop { min-width: 260px; max-width: min(340px, calc(100vw - 16px)); white-space: normal; }
.att-pop:focus { outline: none; }
.att-pop-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-2-5) var(--space-0-5); }
.att-pop-title { font-weight: var(--fw-semibold); color: var(--text); font-size: var(--fs-base); }
.att-pop-unit {
  flex: none; padding: 1px 6px; border-radius: var(--radius-full); background: var(--neutral-soft); color: var(--neutral-text);
  font-size: 11px; font-weight: var(--fw-medium);
}
.att-pop-text { padding: var(--space-0-5) var(--space-2-5) var(--space-2-5); color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.45; }
.att-pop-na { display: flex; align-items: flex-start; gap: var(--space-1-5); padding: 0 var(--space-2-5) var(--space-2-5); font-size: var(--fs-xs); color: var(--text-muted); }
.att-pop-na .icon { flex: none; margin-top: 1px; color: var(--text-subtle); }
.att-pop-actions { display: flex; flex-direction: column; }
.att-pop-item { align-items: flex-start; white-space: normal; padding-top: var(--space-2); padding-bottom: var(--space-2); }
.att-pop-item .icon { margin-top: 2px; }
.att-pop-item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.att-pop-item-title { font-weight: var(--fw-medium); }
.att-pop-item-desc { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.4; }
.att-pop-item.is-danger .att-pop-item-desc { color: var(--text-muted); }
.att-pop .menu-item:disabled { cursor: not-allowed; }

/* ---------------------------------------------------------------- Add employee menu */

/* The menu lives in <body>; its aria-label is the button's label. Long names wrap (shared .menu-item rules). */
.menu[aria-label="Add employee"] { max-width: min(360px, calc(100vw - 16px)); }

/* ---------------------------------------------------------------- shortcuts dialog */

.att-key-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6) var(--space-8); align-items: start; }
.att-key-group:first-child { grid-row: span 2; }
.att-key-title { margin: 0 0 var(--space-3); font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-subtle); letter-spacing: .03em; text-transform: uppercase; }
.att-keys { display: grid; grid-template-columns: minmax(min-content, 12.5em) minmax(0, 1fr); gap: var(--space-2-5) var(--space-4); margin: 0; align-items: baseline; }
.att-key-row { display: contents; }
.att-keys dt { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
.att-keys dd { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }
.att-key-combo { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.att-key-plus { color: var(--text-subtle); font-size: var(--fs-xs); }
.att-key-sep { color: var(--text-subtle); font-size: var(--fs-xs); margin: 0 2px; }

/* ---------------------------------------------------------------- upload card */

.att-upload-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: var(--space-4) var(--space-6); align-items: center; }
.att-upload-text { display: flex; flex-direction: column; gap: var(--space-1); }
.att-upload-title { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.att-upload-title .icon { color: var(--primary-text); }
.att-upload-sub { color: var(--text-muted); font-size: var(--fs-sm); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .att-upload-inner { grid-template-columns: minmax(0, 1fr); }
  .att-key-groups { grid-template-columns: minmax(0, 1fr); }
  .att-key-group:first-child { grid-row: auto; }
}

@media (max-width: 640px) {
  .att-grid-wrap { --w-name: 152px; --w-qty: 86px; --w-money: 112px; --w-text: 140px; --w-note: 164px; --w-total: 124px; max-height: max(320px, 72vh); }
  .att-foot-total { display: flex; }
  .att-foot-total[hidden] { display: none; }
  .att-info-leave { display: none !important; }
  /* "Match…" / "Add to sheet" goes under the message instead of squeezing it */
  .att-issue-has-add { flex-wrap: wrap; gap: 0; padding-bottom: var(--space-2-5); }
  .att-issue-has-add > .issue { flex-basis: 100%; padding-bottom: var(--space-1-5); }
  .att-issue-has-add .att-issue-add { margin-left: calc(var(--space-4) + 18px + var(--space-2-5)); }
  .att-keys { grid-template-columns: minmax(0, 1fr); gap: var(--space-1) 0; }
  .att-keys dd { margin-bottom: var(--space-2); }
  /* not enough room for two sticky columns: only the names stay put */
  .att-grid tbody .att-total, .att-grid tfoot .att-total, .att-grid thead .att-total-head { right: auto; }
  .att-grid tbody .att-total { position: static; }
  .att-grid .att-total::before { display: none; }
  .att-groups th.att-group > span { right: var(--space-2-5); }
  .att-rownum { display: none; }
  .att-name-cell { padding-left: var(--space-2-5); gap: var(--space-1); }
  .att-card-head .card-actions { width: 100%; }
  .att-toolbar { padding: var(--space-2) var(--space-3); }
  .att-toolbar-start { flex-wrap: nowrap; }
  /* icon + count only; the label stays for screen readers */
  .att-add .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .att-toolbar-end { width: 100%; justify-content: space-between; }
  /* narrow (a phone, or zoomed in): the cell on its own line and the whole explanation below it, never cut
     off (the title tooltip that holds it on a desktop is out of reach on touch); room for three lines so
     the sheet doesn't jump from cell to cell */
  .att-info {
    flex-direction: column; align-items: stretch; gap: 2px; padding-left: var(--space-3); padding-right: var(--space-3);
    min-height: calc(3 * 1.35em + 2 * var(--space-1-5));
  }
  .att-info-icon { display: none; }
  .att-info-where { max-width: none; padding-right: 0; margin-right: 0; border-right: 0; white-space: normal; overflow-wrap: anywhere; }
  .att-info-text { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  .att-issues { padding: var(--space-3); }
  .att-card-foot { flex-direction: column; align-items: stretch; }
  .att-foot-actions { width: 100%; }
  .att-foot-actions .btn { flex: 1 1 auto; }
}

/* forced colours (Windows contrast themes): backgrounds, shadows and the hatching are replaced by system
   colours, so the active cell, the cells that don't apply and the problem markers get system colours here */
@media (forced-colors: active) {
  .att-cell:focus-within { outline: 2px solid Highlight; outline-offset: -2px; }
  .att-cell.is-editing { outline-width: 3px; outline-offset: -3px; }
  .att-head.is-active-col .att-colbtn-label { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
  .att-row.is-active > th.att-name { outline: 1px solid Highlight; outline-offset: -1px; }
  /* not used for this person: hatched in GrayText; only system colours, as the cell opts out of the forcing */
  .att-cell.is-na {
    forced-color-adjust: none; background-color: Canvas; animation: none;
    background-image: repeating-linear-gradient(135deg, transparent 0 6px, GrayText 6px 7px);
    border-bottom-color: CanvasText; border-right-color: CanvasText;
  }
  .att-cell.is-na .att-input { color: GrayText; }
  .att-cell.is-ignored { background-color: Canvas; background-image: none; }
  .att-cell.is-ignored .att-input { color: CanvasText; }
  /* corner markers: an error is a filled triangle, a warning a hollow one */
  .att-cell.is-invalid::after, .att-cell.has-error::after, .att-cell.is-ignored::after, .att-cell.has-warning::after {
    forced-color-adjust: none; border-color: transparent CanvasText transparent transparent; border-width: 0 10px 10px 0;
  }
  .att-cell.is-ignored::after, .att-cell.has-warning::after {
    width: 9px; height: 9px; border: 0; border-top: 2px solid CanvasText; border-right: 2px solid CanvasText;
  }
  .att-cell.is-invalid .att-input { text-decoration: underline wavy; }
  .att-row.is-error > th.att-name, .att-row.is-warning > th.att-name { border-left: 3px solid CanvasText; }
}

/* touch screens: 16px inputs so iOS does not zoom in when a cell is focused */
@media (pointer: coarse) {
  .att-input { font-size: var(--fs-lg); }
}

@media print {
  .att-toolbar, .att-info, .att-upload, .att-card-foot, .att-rowmenu, .att-colbtn-icon { display: none !important; }
  .att-grid-wrap { max-height: none; overflow: visible; }
}

/* ---------------------------------------------------------------- from the Absensi Bot */

/* the menu button: a dot when a recap for this month is in Kaseer's inbox */
.att-absensi-dot { display: inline-flex; align-items: center; margin-left: -2px; }
.att-absensi-dot .dot { width: 7px; height: 7px; }
.att-absensi-menu { min-width: 280px; }

/* the merge confirmation */
.att-merge-modal .modal-body { display: flex; flex-direction: column; gap: var(--space-4); }
.att-merge-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.att-merge-point { display: flex; align-items: flex-start; gap: var(--space-3); }
.att-merge-icon {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-muted);
}
.att-merge-point.is-success .att-merge-icon { background: var(--success-soft); color: var(--success-text); }
.att-merge-point.is-warning .att-merge-icon { background: var(--warning-soft); color: var(--warning-text); }
.att-merge-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); padding-top: 3px; line-height: 1.5; }
.att-merge-text > p { overflow-wrap: anywhere; }
.att-merge-changes {
  list-style: none; margin: 0; padding: var(--space-2) var(--space-3); display: flex; flex-direction: column; gap: var(--space-1-5);
  background: var(--surface-2); border: 1px solid var(--border-subtle); border-radius: var(--radius); font-size: var(--fs-sm);
}
.att-merge-changes li { display: flex; flex-wrap: wrap; gap: 0 var(--space-2); line-height: 1.5; }
.att-merge-who { font-weight: var(--fw-semibold); min-width: 0; }
.att-merge-who::after { content: ":"; }
.att-merge-cells { min-width: 0; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.att-merge-cells strong { color: var(--text); font-weight: var(--fw-semibold); }
.att-merge-cell { white-space: nowrap; }
.att-merge-old { text-decoration: line-through; text-decoration-color: var(--text-subtle); }
.att-merge-more { color: var(--text-muted); }
.att-merge-names {
  list-style: none; margin: 0; padding: var(--space-1) 0 0; display: flex; flex-direction: column; gap: var(--space-2);
  max-height: 240px; overflow-y: auto;
}
/* a name in the recap that is not on the sheet: whom it is for */
.att-merge-choice {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1) var(--space-3); padding: var(--space-2) var(--space-3);
  background: var(--surface-2); border: 1px solid var(--border-subtle); border-radius: var(--radius);
}
.att-merge-choice-name { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; overflow-wrap: anywhere; }
.att-merge-choice-hint { font-size: var(--fs-xs); color: var(--text-muted); }
.att-merge-pick { flex: 1 1 220px; max-width: 100%; min-width: 0; }
.att-merge-note {
  display: flex; align-items: flex-start; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.5;
}
.att-merge-note .icon { flex: none; margin-top: 3px; color: var(--text-subtle); }

/* asking the Absensi Bot from the sheet, and waiting for its answer */
.att-ask { display: flex; flex-direction: column; gap: var(--space-3); }
.att-ask-text { line-height: 1.5; overflow-wrap: anywhere; }
.att-ask-text code { overflow-wrap: anywhere; white-space: normal; }
.att-ask-status { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-sm); color: var(--text-muted); }
.att-ask-time { font-variant-numeric: tabular-nums; color: var(--text-subtle); }
.att-ask-extra { display: flex; flex-direction: column; gap: var(--space-2); }
.att-ask-extra:empty { display: none; }
.att-ask-answer {
  margin: 0; padding: var(--space-2-5) var(--space-3); background: var(--surface-2); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap;
  overflow-wrap: anywhere; max-height: 220px; overflow: auto;
}
.att-ask-hint { font-size: var(--fs-sm); color: var(--text-muted); }
.att-merge-empty { font-style: normal; color: var(--text-subtle); }
