/* ============================================================
   Components — buttons, tabs, tables, chips, modal, toast, menu
   ============================================================ */

/* ---------- buttons ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;height:32px;padding:4px 14px;
  border-radius:var(--radius);font-size:13px;line-height:1;white-space:nowrap;
  transition:background .15s,border-color .15s,color .15s,box-shadow .15s;
}
.btn:disabled{opacity:.45;cursor:not-allowed}
.btn-primary{background:var(--blue);color:#fff}
.btn-primary:hover:not(:disabled){background:var(--blue-hover)}
.btn-danger{background:var(--red);color:#fff}
.btn-danger:hover:not(:disabled){background:#FF7875}
.btn-success{background:#389E0D;color:#fff}
.btn-success:hover:not(:disabled){background:#52C41A}
.btn-ghost{border:1px solid var(--blue);color:var(--blue);background:#fff}
.btn-ghost:hover{background:var(--blue-bg)}
.btn-outline{border:1px solid var(--border-input);color:var(--text);background:#fff}
.btn-outline:hover{border-color:var(--blue);color:var(--blue)}
.btn-lg{height:38px;padding:0 22px;font-size:14px}
.btn-md{height:34px;padding:0 18px}
.btn-sm{height:26px;font-size:12px;padding:2px 10px}

/* ---------- segmented control ---------- */
.seg{display:inline-flex;border:1px solid var(--border-input);border-radius:var(--radius);overflow:hidden}
.seg button{padding:4px 14px;font-size:13px;background:#fff;color:var(--text-3);border-right:1px solid var(--border-input)}
.seg button:last-child{border-right:0}
.seg button.on{color:var(--blue);box-shadow:inset 0 0 0 1px var(--blue);border-radius:var(--radius)}

/* ---------- tabs ---------- */
.tabs{display:flex;align-items:center;border-bottom:1px solid var(--border);padding:0 8px;gap:2px}
.tab{
  display:flex;align-items:center;gap:8px;padding:12px 16px;height:46px;font-size:14px;
  border-bottom:2px solid transparent;color:var(--text);
}
.tab:hover{color:var(--blue)}
.tab.on{color:var(--blue);font-weight:500;border-bottom-color:var(--blue);background:linear-gradient(180deg,var(--blue-bg-2),#fff)}
.tab .cnt{background:var(--blue-bg);color:var(--blue);font-size:12px;border-radius:var(--radius);padding:1px 7px;min-width:22px;text-align:center}
.tab-actions{margin-left:auto;display:flex;align-items:center;gap:10px;padding-right:8px}

/* ---------- form controls ---------- */
.select,.inp{
  display:flex;align-items:center;justify-content:space-between;gap:10px;height:36px;
  border:1px solid var(--border-input);border-radius:var(--radius);padding:0 10px;font-size:14px;background:#fff;
  cursor:pointer;transition:border-color .15s,box-shadow .15s;width:100%;
}
.select:hover,.inp:hover{border-color:var(--blue-hover)}
.select.focus,.inp.focus{border-color:var(--blue);box-shadow:0 0 0 2px rgba(22,119,255,.12)}
.inp-lg{height:42px;padding:0 12px}
.inp .val{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.inp.placeholder .val{color:var(--text-4)}
.inp .caret,.select .caret{color:var(--text-3);flex:0 0 auto;display:flex}
.field{min-width:0}
.field > label{display:block;font-size:14px;margin-bottom:6px}
.field > label .req{color:var(--red)}
textarea.inp{height:auto;padding:8px 12px;resize:vertical;display:block;cursor:text}

/* native-looking dropdown menu */
/* The menu is a flex COLUMN so the optional search row stays pinned while
   .menu-list takes the remaining height and scrolls. Shell.menu sets an explicit
   `height` only when the natural height exceeds the free space beside the anchor,
   which is what stops a 44-item list rendering 1695px tall and escaping the
   viewport. Without min-height:0 the flex child refuses to shrink and overflows
   the box instead of scrolling. */
.menu{
  position:absolute;z-index:70;min-width:190px;background:#fff;border:1px solid var(--border-2);
  border-radius:var(--radius);box-shadow:0 6px 20px rgba(0,0,0,.12);padding:4px;display:none;
  flex-direction:column;overflow:hidden;
}
.menu.open{display:flex}
.menu-list{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden}
.menu button{
  display:block;width:100%;text-align:left;padding:9px 12px;font-size:14px;border-radius:var(--radius);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.menu button[hidden]{display:none}
.menu button:hover{background:var(--blue-bg);color:var(--blue)}
.menu button.sel{background:var(--blue-bg);color:var(--blue)}
.menu-find{
  display:flex;align-items:center;gap:7px;padding:6px 9px;margin:0 0 4px;flex:0 0 auto;
  border-bottom:1px solid var(--border);
}
.menu-find svg{width:14px;height:14px;flex:0 0 auto;color:var(--text-3)}
.menu-find input{
  flex:1;min-width:0;border:0;outline:0;background:none;font-size:13.5px;color:var(--text);
  font-family:inherit;padding:2px 0;
}
.menu-find input::placeholder{color:var(--text-3)}
.menu-list::-webkit-scrollbar{width:9px}
.menu-list::-webkit-scrollbar-thumb{background:var(--border-2);border-radius:9px;border:2px solid #fff}

/* ---------- tables ---------- */
.tbl-wrap{overflow:auto}
thead th{
  background:#fff;font-size:11.5px;font-weight:600;text-transform:uppercase;letter-spacing:.2px;color:var(--text);
  text-align:left;padding:10px 14px;height:52px;white-space:nowrap;border-bottom:1px solid var(--border);
  vertical-align:middle;
}
thead th.c{text-align:center}
thead th.r{text-align:right}
tbody td{
  font-size:13.5px;padding:8px 14px;height:var(--row-h);border-bottom:1px solid var(--border);
  background:#fff;white-space:nowrap;
}
tbody td.c{text-align:center}
tbody td.r{text-align:right}
tbody tr:hover td{background:#FAFAFB}
tbody tr.is-new td{background:#F0F9EB;animation:rowIn .5s ease}
tbody tr.is-new:hover td{background:#E8F6DF}
@keyframes rowIn{from{background:#D9F0C4}to{background:#F0F9EB}}
tbody tr.picked td{background:var(--blue-bg)}
.sort-ico{color:var(--text-4);font-size:10px;letter-spacing:-1px}
.sortable{display:inline-flex;align-items:center;gap:6px}
.ck{width:15px;height:15px;accent-color:var(--blue);cursor:pointer}

.pager{display:flex;align-items:center;justify-content:flex-end;gap:22px;padding:14px 20px;font-size:13px;color:var(--text-2)}
.pager .rpp{display:flex;align-items:center;gap:8px}
.pager .arrows{display:flex;align-items:center;gap:6px;color:var(--text-4)}
.pager .arrows button{width:24px;height:24px;border-radius:var(--radius)}
.pager .arrows button.on{color:var(--text-2)}
.pager .arrows button.on:hover{background:var(--hover);color:var(--blue)}

/* ---------- status dots ---------- */
.dots{display:inline-flex;gap:4px}
.dot{width:10px;height:10px;border-radius:50%;background:#D9D9D9}
.dot.g{background:var(--green)}
.dot.r{background:var(--red)}
.dot.a{background:var(--amber)}
.xbtn{color:var(--red);font-size:15px;line-height:1;padding:2px 6px;border-radius:var(--radius)}
.xbtn:hover{background:#FFF1F0}

/* ---------- chips ---------- */
.chip{display:inline-flex;align-items:center;border-radius:var(--radius);font-size:12px;padding:2px 10px;line-height:18px}
.chip-present{background:var(--present-bg)}
.chip-absent{background:var(--absent-bg)}
.chip-paid{background:var(--paidleave-bg)}
.chip-unpaid{background:var(--unpaid-bg)}
.chip-off{background:var(--offday-bg)}
.chip-holiday{background:var(--holiday-bg)}
.chip-pend-corr{background:var(--pending-corr-bg)}
.chip-nd{background:var(--blue-bg);color:var(--blue);font-size:11px;padding:1px 6px;margin-left:6px}

/* ---------- modal ---------- */
.overlay{
  position:fixed;inset:0;background:rgba(0,0,0,.45);display:none;place-items:center;z-index:60;padding:20px;
}
.overlay.on{display:grid}
.modal{
  width:756px;max-width:100%;max-height:90vh;overflow:auto;background:#fff;border-radius:var(--radius-lg);
  padding:22px 26px 26px;box-shadow:0 12px 40px rgba(0,0,0,.22);
}
.modal.sm{width:460px}
.modal-head{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:22px;gap:16px}
.modal-head h3{font-size:19px;font-weight:500}
.modal-head .x{color:var(--red);font-size:19px;line-height:1;padding:2px 6px;border-radius:var(--radius)}
.modal-head .x:hover{background:#FFF1F0}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px 32px}
@media (max-width:640px){ .grid2{grid-template-columns:1fr} }
.modal-actions{display:flex;justify-content:flex-end;gap:12px;margin-top:26px}

/* ---------- toast ---------- */
.toasts{position:fixed;top:16px;left:50%;transform:translateX(-50%);z-index:90;display:grid;gap:8px;justify-items:center}
.toast{
  display:flex;align-items:center;gap:10px;background:#fff;border:1px solid var(--border-2);
  border-radius:var(--radius);box-shadow:0 6px 22px rgba(0,0,0,.14);padding:10px 16px;font-size:14px;
  animation:toastIn .22s ease;
}
.toast .ic{width:18px;height:18px;border-radius:50%;display:grid;place-items:center;color:#fff;font-size:11px;flex:0 0 18px}
.toast.ok .ic{background:var(--green)}
.toast.info .ic{background:var(--blue)}
.toast.warn .ic{background:var(--amber)}
@keyframes toastIn{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:none}}

/* ---------- bulk action bar ---------- */
.bulkbar{
  display:none;align-items:center;gap:14px;padding:12px 24px;background:var(--blue-bg);
  border-bottom:1px solid #BAE0FF;
}
.bulkbar.on{display:flex}
.bulkbar .sel-count{font-size:14px;font-weight:500;color:var(--blue)}
.bulkbar .spacer{flex:1}
.bulkbar .inp{width:280px;height:32px;background:#fff}

/* ---------- date picker ----------
   Opened by Shell.datepicker from any `date` field. Positioned by the same
   Shell.place() as the option lists, so it clamps to the viewport too.
   NOTE: the live picker's own chrome was never captured — this is the house
   style on the standard month-grid shape, and is logged as a gap. */
.datepick{
  position:absolute;z-index:70;width:258px;background:#fff;border:1px solid var(--border-2);
  border-radius:var(--radius);box-shadow:0 6px 20px rgba(0,0,0,.12);padding:10px;display:none;
}
.datepick.open{display:block}
.dp-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.dp-head b{font-size:13.5px;font-weight:600;color:var(--text)}
.dp-nav{width:26px;height:26px;display:grid;place-items:center;border-radius:var(--radius);color:var(--text-2)}
.dp-nav:hover{background:var(--hover);color:var(--blue)}
.dp-dow{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;margin-bottom:2px}
.dp-dow span{
  text-align:center;font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.2px;
  color:var(--text-3);padding:3px 0;
}
.dp-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}
.dp-d{
  height:30px;display:grid;place-items:center;border-radius:var(--radius);font-size:13px;color:var(--text);
  font-variant-numeric:tabular-nums;
}
.dp-d:hover:not(:disabled){background:var(--blue-bg);color:var(--blue)}
.dp-d.out{color:var(--text-3);opacity:.45;cursor:default}
/* today is ringed, the selection is filled — a day can be both */
.dp-d.today{box-shadow:inset 0 0 0 1px var(--blue);color:var(--blue);font-weight:600}
.dp-d.sel{background:var(--blue);color:#fff;font-weight:600}
.dp-d.sel.today{box-shadow:inset 0 0 0 1px #fff}
.dp-foot{margin-top:8px;padding-top:8px;border-top:1px solid var(--border);text-align:center}
.dp-today{font-size:12.5px;font-weight:500;color:var(--blue);padding:3px 10px;border-radius:var(--radius)}
.dp-today:hover{background:var(--blue-bg)}
