/* jinji — beach palette
   teal    #4A8DA8  primary / actions
   sage    #9CBFB4  secondary / success
   cream   #E5DFC5  background
   rose    #D3ACA8  accents / badges
   mauve   #A48D93  muted text / borders
*/
:root {
  --teal: #4A8DA8;
  --teal-dark: #3A7189;
  --sage: #9CBFB4;
  --sage-light: #E3EEEA;
  --cream: #E5DFC5;
  --cream-light: #F4F0E2;
  --rose: #D3ACA8;
  --rose-light: #F1E2E0;
  --mauve: #A48D93;
  --ink: #3D3A38;
  --white: #FFFFFF;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans JP", sans-serif;
  background: var(--cream-light);
  color: var(--ink);
  font-size: 15px;
}

.jp-sub { color: var(--mauve); font-size: 0.95rem; margin: 0.1rem 0 0.5rem; letter-spacing: 0.15em; }
.jp-sub-inline { color: var(--mauve); font-size: 0.72em; font-weight: 400; margin-left: 0.5em; letter-spacing: 0.12em; }
.jp-inline { color: var(--mauve); font-size: 0.85em; font-weight: 400; }
.muted { color: var(--mauve); }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.9em; }

/* ---- Topbar ---- */
.topbar {
  background: var(--teal);
  color: var(--white);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1.4rem;
}
.topbar h1 { font-size: 1.15rem; margin: 0; font-weight: 600; }
.topbar .jp-sub-inline { color: var(--cream); }
.userbox { display: flex; align-items: center; gap: 0.7rem; }
.user-name { font-weight: 500; }
.badge-role {
  background: var(--sage);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.1rem 0.6rem;
  font-size: 0.78rem;
}

/* ---- Layout ---- */
.container { max-width: 1100px; margin: 1.4rem auto; padding: 0 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; }
.page-head h2 { margin: 0 0 0.2rem; font-size: 1.35rem; }

.filters { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.filters input[type="search"] { flex: 1 1 240px; }
.filters select { flex: 0 1 200px; }
.filter-check {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.9rem; color: var(--ink); cursor: pointer;
  padding: 0.35rem 0.7rem; background: var(--white);
  border: 1px solid var(--cream); border-radius: 6px;
  white-space: nowrap;
}
.filter-check input { accent-color: var(--teal); cursor: pointer; }

.th-action { width: 1%; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.cell-action { text-align: right; white-space: nowrap; }
.btn-edit {
  background: var(--white); color: var(--teal);
  border: 1px solid var(--teal); border-radius: 6px;
  padding: 0.2rem 0.7rem; font-size: 0.85rem; cursor: pointer;
}
.btn-edit:hover { background: var(--teal); color: var(--white); }

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--mauve);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--teal);
  outline-offset: 0;
  border-color: var(--teal);
}

/* ---- Buttons ---- */
button { font: inherit; cursor: pointer; border-radius: 6px; border: none; }
.btn-primary {
  background: var(--teal);
  color: var(--white);
  padding: 0.5rem 1.1rem;
  font-weight: 600;
}
.btn-primary:hover { background: var(--teal-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-ghost {
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
  padding: 0.4rem 0.9rem;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
}
.topbar .btn-ghost { color: var(--cream); }
.btn-close {
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--mauve);
  padding: 0 0.3rem;
}

/* ---- Table ---- */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--cream);
  border-radius: 10px;
  overflow-x: auto;
}
.staff-table { width: 100%; border-collapse: collapse; }
.staff-table th {
  text-align: left;
  background: var(--sage-light);
  color: var(--ink);
  font-weight: 600;
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--sage);
  white-space: nowrap;
}
.staff-table td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--cream);
  white-space: nowrap;
}
.staff-table tbody tr { cursor: pointer; }
.staff-table tbody tr:hover { background: var(--cream-light); }
.cell-name { white-space: normal; min-width: 180px; }
.empty-row { text-align: center; color: var(--mauve); padding: 1.5rem !important; cursor: default; }

/* ---- Status badges ---- */
.badge {
  display: inline-block;
  border-radius: 10px;
  padding: 0.12rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-aktif { background: var(--sage-light); color: #3E6E5F; }
.badge-probation { background: var(--cream); color: #7A6B3F; }
.badge-kontrak { background: #DDEAF1; color: var(--teal-dark); }
.badge-dirumahkan { background: var(--rose-light); color: #9A6B66; }
.badge-resign { background: #EEE9EA; color: var(--mauve); }
.badge-resign_pesangon { background: var(--rose-light); color: var(--mauve); border: 1px dashed var(--rose); }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(61, 58, 56, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  z-index: 100;
}
.modal-backdrop[hidden] { display: none; }
body.modal-open { overflow: hidden; }
.modal {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  padding: 1.2rem 1.4rem 1.4rem;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.modal-head h3 { margin: 0; font-size: 1.15rem; }

fieldset {
  border: 1px solid var(--cream);
  border-radius: 8px;
  margin: 0 0 1rem;
  padding: 0.8rem 1rem 1rem;
}
legend { font-weight: 600; padding: 0 0.4rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem 1rem; }
.field label { display: block; font-size: 0.85rem; margin-bottom: 0.25rem; color: var(--ink); }
.checkbox-field { display: flex; align-items: flex-end; padding-bottom: 0.3rem; }
.checkbox-field label { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.checkbox-field input { width: auto; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.4rem;
}
.form-error { color: #A6453C; font-size: 0.88rem; margin-right: auto; }

/* ---- Login ---- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(160deg, var(--teal) 0%, var(--sage) 55%, var(--cream) 100%);
}
.login-card {
  background: var(--white);
  border-radius: 14px;
  padding: 2.2rem 2.4rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 40px rgba(61, 58, 56, 0.18);
}
.login-card h1 { margin: 0; font-size: 1.5rem; color: var(--teal-dark); }
.login-tagline { color: var(--mauve); font-size: 0.9rem; margin-top: 0; }
.login-card label { display: block; margin: 0.9rem 0 0.3rem; font-size: 0.9rem; }
.login-card .btn-primary { width: 100%; margin-top: 1.3rem; padding: 0.6rem; }
.alert-error {
  background: var(--rose-light);
  color: #9A4A42;
  border: 1px solid var(--rose);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: stretch; }
}

/* ---------- Payroll (v1.4.0) ---------- */
.brand { display: flex; align-items: center; gap: 1.2rem; }
.mainnav { display: flex; gap: 0.8rem; }
.mainnav a { color: var(--cream); text-decoration: none; font-size: 0.92rem; padding: 0.15rem 0.4rem; border-radius: 4px; }
.mainnav a.active, .mainnav a:hover { background: rgba(255,255,255,0.15); }
.container-wide { max-width: 1500px; }
.payroll-bar .spacer { flex: 1; }
.inline-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; white-space: nowrap; }
.input-xs { width: 4.2rem; }
/* date inputs need room for the dd/mm/yyyy spinner — 4.2rem truncates them */
.input-date { width: 9.5rem; }
/* keeps the bank buttons and their two settings reading as one control */
.ctl-group {
  display: inline-flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.3rem 0.55rem; border: 1px solid var(--cream); border-radius: 8px;
  background: var(--cream-light);
}
.payroll-table { font-size: 0.85rem; }
.payroll-table th.th-num, .payroll-table td.td-num { text-align: right; white-space: nowrap; }
.payroll-table .in-num { width: 5.6rem; text-align: right; padding: 0.2rem 0.3rem; }
.payroll-table .strong { font-weight: 600; }
.payroll-table tfoot td { border-top: 2px solid var(--teal); }
.modal-sm { max-width: 460px; }
.ot-body { padding: 0 1.2rem 1.2rem; }
.ot-table { margin-bottom: 0.8rem; }
.ot-add { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.ot-add input[type="number"] { width: 5rem; }

/* ---------- Sticky headers + scrollable payroll table (v1.5.0) ---------- */
.topbar { position: sticky; top: 0; z-index: 60; }
.payroll-bar {
  position: sticky; top: 52px; z-index: 50;
  background: var(--cream-light);
  padding: 0.5rem 0;
  margin-bottom: 0.6rem;
}
.container-wide .table-wrap {
  max-height: calc(100vh - 215px);
  overflow: auto;
}
.container-wide .staff-table thead th {
  position: sticky; top: 0; z-index: 10;
}

/* ---------- Nav reorganisation (v1.9.30) ----------
   Pengguna moved out of .mainnav into the userbox as a gear icon;
   KTP and Tabel Gaji became sub-pages reached from Staff / Penggajian. */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  color: var(--cream);
  border: 1px solid transparent;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.icon-btn:hover { background: rgba(255,255,255,0.15); color: var(--white); }
.icon-btn.active { background: rgba(255,255,255,0.22); color: var(--white); }
.icon-btn:focus-visible { outline: 2px solid var(--white); outline-offset: 1px; }
.icon-btn svg { display: block; }

/* sub-page link that sits in a .filters bar and reads as a sibling control */
.filter-link {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.9rem; font-weight: 500;
  color: var(--teal); text-decoration: none;
  padding: 0.35rem 0.7rem;
  background: var(--white);
  border: 1px solid var(--cream);
  border-radius: 6px;
  white-space: nowrap;
}
.filter-link:hover { background: var(--sage-light); border-color: var(--teal); }
.filter-link .fl-arrow { font-size: 1.05em; line-height: 1; opacity: 0.75; }
/* variant used beside a heading rather than inside a filter bar */
.filter-link.fl-inline { margin-left: 0.75rem; vertical-align: middle; font-size: 0.8rem; }

/* Catatan slip button on the Penggajian table: filled when a note exists */
.btn-note-filled { background: #4A8DA8; color: #fff; border-color: #4A8DA8; }
