:root {
  --navy: #1a2370;
  --navy-2: #24337f;
  --blue: #2a3192;
  --green: #86c043;
  --green-d: #5c9428;
  --red: #e31b23;
  --ink: #1c2434;
  --muted: #5d6b82;
  --line: #e3e8f0;
  --bg: #eef2f7;
  --card: #ffffff;
  --amber: #9a6408;
  --shadow: 0 18px 50px rgba(20, 34, 77, 0.14);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
img { max-width: 100%; }

.login-screen { min-height: 100%; display: grid; grid-template-columns: 1.15fr 0.85fr; }
.login-hero {
  position: relative;
  color: white;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--navy);
  background-image:
    linear-gradient(rgba(134, 192, 67, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(134, 192, 67, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
  overflow: hidden;
}
.login-hero:before {
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 8px;
  background: linear-gradient(var(--green), var(--green) 70%, var(--red));
}
.hero-logo {
  width: min(280px, 70%);
  background: white;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.login-hero h1 { font-size: clamp(28px, 4vw, 46px); line-height: 1.15; margin: 24px 0 8px; max-width: 640px; }
.login-hero .tag { color: var(--green); letter-spacing: 0.14em; text-transform: uppercase; font-size: 13px; font-weight: 700; }
.login-hero .si { font-size: 18px; opacity: 0.9; margin-top: 0; }
.disciplines { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.disciplines span { border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 32px 24px; background: white; }
.login-card { width: min(440px, 100%); }
.login-card h2 { margin: 0 0 6px; font-size: 28px; }
.login-card .lead { color: var(--muted); margin: 0 0 22px; }
.demo-box { background: #f6f8ec; border: 1px solid #d7e7b6; border-radius: 14px; padding: 12px; margin-bottom: 18px; }
.demo-box p { margin: 0 0 8px; font-size: 13px; color: #3d5320; }
.demo-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.shell { height: 100%; display: flex; }
.sidebar {
  width: 272px; flex: none; background: var(--navy); color: white;
  display: flex; flex-direction: column; overflow: auto;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 18px 16px 10px; }
.brand img { width: 64px; height: 64px; border-radius: 12px; background: white; object-fit: cover; }
.brand h1 { font-size: 14px; line-height: 1.3; margin: 0; }
.brand p { margin: 3px 0 0; color: rgba(255,255,255,.68); font-size: 12px; }
.nav-group { margin: 16px 16px 6px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.45); }
.nav-btn {
  display: block; width: calc(100% - 16px); margin: 2px 8px; border: 0; background: transparent;
  color: rgba(255,255,255,.88); text-align: left; padding: 10px 12px; border-radius: 10px;
}
.nav-btn:hover { background: rgba(255,255,255,.06); }
.nav-btn.active { background: rgba(134, 192, 67, .18); color: white; box-shadow: inset 3px 0 0 var(--green); }
.side-foot { margin-top: auto; padding: 16px; font-size: 12px; color: rgba(255,255,255,.55); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 72px; flex: none; display: flex; align-items: center; gap: 12px;
  padding: 0 22px; background: white; border-bottom: 1px solid var(--line);
}
.topbar h2 { margin: 0; font-size: 20px; }
.topbar .sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }
.who { text-align: right; }
.who strong { display: block; font-size: 14px; }
.who span { color: var(--muted); font-size: 12px; }
.page { flex: 1; overflow: auto; padding: 22px 24px 48px; }
.backdrop { position: fixed; inset: 0; background: rgba(10, 16, 36, .45); z-index: 30; }
.menu-btn { display: none; }

.page-intro { color: var(--muted); margin: 0 0 16px; }
.toolbar, .row-actions, .modal-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { margin-bottom: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat, .card, .quick-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.stat { padding: 16px 18px; text-align: left; }
.stat b { display: block; font-size: 28px; color: var(--navy); }
.stat span, .muted { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1.3fr .7fr; gap: 14px; }
.card { padding: 16px 18px; margin-bottom: 14px; }
.card h3 { margin: 0 0 12px; font-size: 16px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 32px; gap: 8px; align-items: center; margin: 8px 0; font-size: 13px; }
.bar { height: 8px; background: #e7edf6; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.steps button { text-align: left; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.quick-card { padding: 18px; text-align: left; border-top: 4px solid var(--green); }
.quick-card strong { display: block; font-size: 18px; margin-bottom: 4px; }
.quick-card.red { border-top-color: var(--red); }
.quick-card.blue { border-top-color: var(--blue); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: white; }
.register-sheet { background: white; padding: 8px; }
.register { width: 100%; border-collapse: collapse; border: 2px solid #1a2370; }
.register th { background: #1a2370; color: white; text-transform: none; letter-spacing: 0; text-align: center; font-size: 13px; }
.register td { border: 1px solid #b7c6e2; text-align: center; padding: 7px 6px; }
.register td.name { text-align: left; white-space: nowrap; }
.register tfoot td { font-weight: 750; background: #eef2fb; }
.register input.sheet-advance, .register input.day-advance { width: 108px; max-width: 100%; text-align: right; font-weight: 650; padding: 4px 6px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: #f8fafc; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7faf5; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 650; text-transform: capitalize; background: #eef2f7; color: #415066; }
.badge.green { background: #e8f6d8; color: #3d6b12; }
.badge.amber { background: #fff3d6; color: var(--amber); }
.badge.red { background: #fde8ea; color: #b31622; }
.badge.blue { background: #e7e9fb; color: var(--blue); }
.badge.gray { background: #eef2f7; color: #415066; }

.btn {
  border: 0; border-radius: 10px; padding: 10px 14px; background: var(--navy); color: white; font-weight: 650;
}
.btn:hover { background: var(--navy-2); }
.btn.green { background: var(--green-d); }
.btn.green:hover { background: #4e8220; }
.btn.ghost { background: #eef2f8; color: var(--navy); }
.btn.danger { background: var(--red); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: wait; }
.linkish { background: none; border: 0; color: var(--blue); padding: 0; font-weight: 650; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #314056; }
.field span { font-weight: 650; }
.pass-wrap { position: relative; display: block; font-weight: 400; }
.pass-wrap input { padding-right: 44px; }
.eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: #5c6b82; display: grid; place-items: center; padding: 0; }
.eye:hover { color: var(--navy); background: #eef2f8; }
.eye .shut { display: none; }
.eye.on .open { display: none; }
.eye.on .shut { display: block; }
.ot-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid #e4ebf5; }
.ot-row .muted { margin: 4px 0 0; }
.epf-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0 2px; }
.epf-switch .muted { margin: 4px 0 0; }
.switch { min-width: 76px; border: 0; border-radius: 999px; padding: 8px 16px; font-weight: 750; background: #e7edf5; color: #5c6b82; }
.switch.on { background: var(--navy); color: white; }
input, select, textarea {
  width: 100%; border: 1px solid #d5ddeb; border-radius: 10px; padding: 10px 12px; background: white;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(134, 192, 67, .45); border-color: var(--green-d); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span-2 { grid-column: span 2; }
.check { display: flex; gap: 8px; align-items: center; }
.check input { width: auto; }
.search { max-width: 280px; }

.overlay { position: fixed; inset: 0; background: rgba(12, 20, 48, .48); display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; z-index: 60; overflow: auto; }
.modal { width: min(640px, 100%); background: white; border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.modal.lg { width: min(920px, 100%); }
.modal.sm { width: min(440px, 100%); }
.modal h3 { margin: 0 0 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { background: #e7edf6; color: var(--navy); border: 0; border-radius: 999px; padding: 8px 12px; }
.tabs button.active { background: var(--navy); color: white; }
.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.avatar, .avatar-lg {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--navy); color: white; font-weight: 700; object-fit: cover;
}
.avatar-lg { width: 84px; height: 84px; font-size: 28px; }
.pay-line { display: grid; grid-template-columns: 1fr 140px auto; gap: 8px; margin-bottom: 8px; }
.clock-box { display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; }
.clock-box strong { font-size: 32px; color: var(--navy); }
.guide ol { line-height: 1.7; }
.guide h3 { margin-bottom: 6px; }
.note { background: #f7faf5; border-left: 4px solid var(--green); padding: 10px 12px; border-radius: 8px; color: #314056; }

.payslip { background: white; color: var(--ink); padding: 8px; }
.payslip-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; border-bottom: 3px solid var(--navy); padding-bottom: 10px; }
.payslip-top img { width: 84px; height: 84px; object-fit: cover; }
.slip-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.slip-table td { border-bottom: 1px solid var(--line); padding: 6px 0; }
.slip-net { margin-top: 12px; background: var(--navy); color: white; border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 8px 0 14px; }
.perm-grid label { font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--green-d); color: white; border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); max-width: 320px; animation: toast-fade 3.6s ease forwards; }
.toast.err { background: var(--red); }
@keyframes toast-fade {
  0% { opacity: 0; transform: translateY(12px); }
  12% { opacity: 1; transform: translateY(0); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-8px); }
}
.loading, .error-box { padding: 24px; color: var(--muted); }

@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .login-screen { grid-template-columns: 1fr; }
  .login-hero { min-height: 320px; }
  .menu-btn { display: inline-flex; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-105%); transition: transform .18s ease; }
  .sidebar.open { transform: none; }
}
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page { padding: 16px 12px 32px; }
  .topbar { height: auto; min-height: 64px; padding: 10px 12px; }
  .who { display: none; }
  .perm-grid, .pay-line { grid-template-columns: 1fr; }
}
@media print {
  body.print-body { background: white; }
  .payslip { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
