* { box-sizing: border-box; }
body {
  margin: 0;
  background: #EEF0EA;
  color: #1B2A3D;
  font-family: 'Segoe UI', system-ui, sans-serif;
}
.serif { font-family: Georgia, 'Times New Roman', serif; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 190px;
  background: #1B2A3D;
  color: #EEF0EA;
  padding: 20px 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.brand {
  font-family: Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  padding: 0 8px 16px;
  border-bottom: 1px solid rgba(238,240,234,0.15);
  margin-bottom: 16px;
}
.brand-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #A67C3D;
  margin-top: 2px;
}
.navitem {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 5px; cursor: pointer;
  margin-bottom: 4px; font-size: 13.5px;
  color: rgba(238,240,234,0.75);
  border-left: 3px solid transparent;
}
.navitem.active {
  background: rgba(166,124,61,0.25);
  color: #F3F0E8;
  border-left: 3px solid #A67C3D;
}

.content { flex: 1; padding: 28px 32px; max-width: 1250px; }

h2.pagetitle { font-family: Georgia, serif; font-size: 22px; margin: 0 0 4px; }
.subtitle { color: #5B6B6A; font-size: 13px; margin-bottom: 18px; }

.card { background: #FDFCF8; border: 1px solid #DFDAC8; border-radius: 6px; padding: 16px; margin-bottom: 22px; }
.scrollx { overflow-x: auto; }

input, select {
  border: 1px solid #C9C2AD; background: #FDFCF8; border-radius: 3px;
  padding: 6px 8px; font-size: 13px; color: #1B2A3D; outline: none;
}
input:focus, select:focus { border-color: #2F5D50; box-shadow: 0 0 0 2px rgba(47,93,80,0.15); }
label.field { font-size: 12px; color: #5B6B6A; display: block; }
label.field input, label.field select { width: 100%; margin-top: 4px; }

.grid { display: grid; gap: 10px; margin-bottom: 12px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

table { border-collapse: collapse; width: 100%; }
th {
  text-align: left; font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase;
  color: #5B6B6A; padding: 7px 8px; border-bottom: 2px solid #1B2A3D; white-space: nowrap;
}
td { padding: 7px 8px; font-size: 13px; border-bottom: 1px solid #DFDAC8; vertical-align: middle; white-space: nowrap; }
tr.empty td { text-align: center; color: #5B6B6A; padding: 24px; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover { background: #F7F4E8; }
tr.rowlink.selected { background: #F3EEDD; }

.btn {
  cursor: pointer; border: none; border-radius: 4px; padding: 7px 12px;
  font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: #2F5D50; color: #F3F0E8; }
.btn-brass { background: #A67C3D; color: #FDFCF8; }
.btn-ghost { background: transparent; color: #8B3A3A; padding-left: 0; }

.link-edit { cursor: pointer; color: #2F5D50; font-size: 12px; margin-right: 10px; }
.link-remove { cursor: pointer; color: #8B3A3A; font-size: 12px; }

.error-box {
  margin-bottom: 16px; padding: 8px 12px; background: #F7E7E7; color: #8B3A3A;
  border-radius: 4px; font-size: 13px;
}

.payslip-stub {
  position: relative; background: #FDFCF8; border: 1px dashed #A67C3D;
  border-radius: 2px; padding: 28px; max-width: 640px;
}
.payslip-stub::before, .payslip-stub::after {
  content: ""; position: absolute; width: 18px; height: 18px;
  background: #EEF0EA; border-radius: 50%; top: 50%; transform: translateY(-50%);
}
.payslip-stub::before { left: -9px; }
.payslip-stub::after { right: -9px; }
.payslip-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 2px solid #1B2A3D; padding-bottom: 14px; margin-bottom: 18px;
}
.payslip-table td:last-child { text-align: right; }
.payslip-net {
  border-top: 2px solid #1B2A3D; padding-top: 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.stamp {
  display: inline-block; border: 3px solid #2F5D50; color: #2F5D50;
  font-weight: 800; letter-spacing: 0.1em; padding: 4px 14px;
  transform: rotate(-8deg); font-family: Georgia, serif; border-radius: 4px;
}

@media print {
  .no-print { display: none !important; }
  body { background: white !important; }
}

/* ---------- Login screen ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #EEF0EA;
}
.login-card {
  background: #FDFCF8;
  border: 1px solid #DFDAC8;
  border-radius: 8px;
  padding: 32px 28px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 4px 24px rgba(27,42,61,0.08);
}
.login-card .field input { width: 100%; margin-top: 6px; }

/* ---------- Sidebar footer (role badge + logout) ---------- */
.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(238,240,234,0.15);
}
.role-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #A67C3D;
  padding: 0 10px 8px;
}

/* ---------- Read-only hint for staff role ---------- */
.readonly-note {
  font-size: 12px;
  color: #A67C3D;
  background: #FBF3E3;
  border: 1px solid #E8D5A8;
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 14px;
  display: inline-block;
}

/* ---------- Branch picker ---------- */
.branch-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid #DFDAC8;
  border-radius: 5px;
  background: #FDFCF8;
  font-size: 14px;
  font-weight: 600;
  color: #1B2A3D;
  cursor: pointer;
}
.branch-option:hover { border-color: #2F5D50; background: #F3EEDD; }
