/* Online Payroll — tema "buku kas kantor": kertas hangat, tinta pinus, aksen kuningan. */
:root {
  --paper: #f3ede2;
  --paper-deep: #e9dfcc;
  --surface: #fbf8f2;
  --ink: #1b2a29;
  --muted: #5b6764;
  --pine: #1f4a46;
  --pine-deep: #163532;
  --brass: #b5842b;
  --rust: #9c3d2b;
  --ok: #2e6b4f;
  --line: #d6c9b0;
  --focus: #e7b75a;

  --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 .4rem;
  letter-spacing: -.01em;
}
h1 { font-size: 1.85rem; }
h2 { font-size: 1.35rem; }

p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- Tombol & input ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 40px;
  padding: .5rem 1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.primary { background: var(--pine); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--pine-deep); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--paper-deep); }
.btn.danger { background: var(--rust); color: #fff; }
.btn.danger:hover:not(:disabled) { background: #7d2e1f; }
.btn.small { min-height: 32px; padding: .3rem .65rem; font-size: .85rem; }
.btn.block { width: 100%; }

input, select {
  width: 100%;
  min-height: 40px;
  padding: .5rem .65rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid #bfb29a;
  border-radius: 6px;
}
input:focus, select:focus { border-color: var(--pine); outline: 2px solid var(--focus); outline-offset: 0; }
input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--pine); }

label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
label .req { color: var(--rust); }

.stack { display: grid; gap: 1rem; }
.alert {
  margin: 0;
  padding: .6rem .8rem;
  border-left: 4px solid var(--rust);
  background: #f6e3dc;
  color: #6e2a1d;
  border-radius: 4px;
}

/* ---------- Halaman login ---------- */
.login-page { background: var(--paper); }

.login-layout {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.login-scene {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--pine);
  color: #f3ede2;
  overflow: hidden;
}
.scene-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}
.scene-copy {
  position: relative;
  padding: 2.5rem 3rem;
  background: linear-gradient(to top, rgba(22, 53, 50, .92) 40%, rgba(22, 53, 50, 0));
  padding-top: 6rem;
}
.scene-copy h1 { color: #f3ede2; max-width: 22ch; }
.scene-copy p { color: #d6e3dc; max-width: 48ch; margin: 0; }

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.login-card { width: min(100%, 380px); }
.login-card h2 { margin-top: .5rem; }

.brand-line {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-serif);
  font-weight: 700;
  margin: 0;
}

.logo {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--brass);
  color: #fff;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
}

@media (max-width: 860px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-scene { min-height: 260px; }
  .scene-copy { padding: 1.5rem; padding-top: 3.5rem; }
  .scene-copy h1 { font-size: 1.4rem; }
}

/* ---------- Shell aplikasi ---------- */
.shell {
  min-height: 100%;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem 1rem;
  background: var(--pine);
  color: #e8efe9;
}
.sidebar .brand { display: flex; gap: .7rem; align-items: center; padding: 0 .4rem; }
.sidebar .brand small { display: block; color: #a9c2b9; font-size: .8rem; }

.nav-group { display: grid; gap: .2rem; }
.nav-group h3 {
  font-family: var(--font-sans);
  font-size: .8rem;
  font-weight: 600;
  color: #a9c2b9;
  padding: 0 .6rem;
  margin: .6rem 0 .3rem;
}
.nav-link {
  display: block;
  padding: .55rem .75rem;
  border-radius: 6px;
  color: #e8efe9;
  text-decoration: none;
}
.nav-link:hover { background: var(--pine-deep); }
.nav-link[aria-current="page"] {
  background: var(--paper);
  color: var(--pine-deep);
  font-weight: 700;
}

.sidebar .logout { margin-top: auto; color: #f3ede2; border-color: #4f7a73; background: transparent; }
.sidebar .logout:hover:not(:disabled) { background: var(--pine-deep); }

.content {
  padding: 2rem clamp(1rem, 3vw, 2.5rem) 3rem;
  max-width: 1200px;
  width: 100%;
}
.content:focus { outline: none; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--ink);
}

.toolbar { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar input, .toolbar select { max-width: 320px; }

/* ---------- Tabel bergaris kas ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: .7rem .8rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
th {
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--paper);
  white-space: nowrap;
}
tbody tr:hover { background: #f6f0e3; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.actions, th.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: .35rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  background: var(--paper-deep);
  color: var(--ink);
}
.badge.ok { background: #d9ebe1; color: var(--ok); }
.badge.muted { background: var(--paper-deep); color: var(--muted); }

/* ---------- Dialog formulir ---------- */
dialog {
  width: min(96vw, 640px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(27, 42, 41, .25);
}
dialog::backdrop { background: rgba(22, 53, 50, .45); }
.dialog-head { padding: 1.1rem 1.4rem .6rem; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 1.15rem; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .9rem 1rem;
  padding: 1.1rem 1.4rem;
}
.form-grid .full { grid-column: 1 / -1; }
.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  padding-top: .4rem;
}
.form-error { grid-column: 1 / -1; margin: 0; }
.hint { font-size: .82rem; color: var(--muted); font-weight: 400; }

.inline-check { display: flex; align-items: center; gap: .5rem; font-weight: 600; }

.form-panel {
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.4rem;
}
.form-panel .form-grid { padding: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  max-width: min(90vw, 360px);
  padding: .8rem 1rem;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  z-index: 10;
}
.toast.error { background: var(--rust); }

/* ---------- Responsif ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding: 1rem; }
  .sidebar .logout { margin-top: 0; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
