:root {
  --navy: #c4785a;
  --navy-2: #d18464;
  --blue: #e7b48c;
  --green: #e7b48c;
  --green-d: #b86a4e;
  --red: #e31b23;
  --ink: #f4f1ea;
  --muted: #a8b0bc;
  --line: rgba(255, 170, 110, .22);
  --bg: #1b2029;
  --card: #16181e;
  --amber: #e7b48c;
  --shadow: 0 18px 40px rgba(0, 0, 0, .45);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; color-scheme: dark; }
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%; }

.lamp-login {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 28px 16px 36px;
  color: #f4f1ea;
  background: #1b2029;
  transition: background .45s ease;
}
.lamp-login.on {
  background:
    radial-gradient(ellipse at 38% 58%, rgba(255, 186, 96, .2), transparent 36%),
    #242933;
}
.lamp-scene { position: relative; width: 230px; height: 360px; transition: width .4s ease; }
.lamp-login.on .lamp-scene { width: 560px; }
.lamp { position: absolute; left: 28px; top: 18px; width: 176px; height: 320px; }
.zzz { position: absolute; right: 6px; top: 18px; color: #aeb6c2; font-weight: 750; letter-spacing: .08em; transition: opacity .3s ease; }
.zzz span { display: inline-block; margin-left: 3px; animation: floatz 2.2s ease-in-out infinite; }
.zzz span:nth-child(2) { animation-delay: .3s; font-size: 13px; }
.zzz span:nth-child(3) { animation-delay: .6s; font-size: 11px; }
.lamp-login.on .zzz { opacity: 0; }
@keyframes floatz {
  0% { transform: translateY(6px); opacity: .2; }
  40% { opacity: .9; }
  100% { transform: translateY(-16px); opacity: 0; }
}
.shade {
  position: relative;
  width: 168px;
  height: 108px;
  margin-left: 4px;
  background: linear-gradient(#66717d, #4d565f);
  clip-path: polygon(10% 0, 90% 0, 100% 100%, 0 100%);
  border-radius: 10px 10px 6px 6px;
  transition: background .35s ease, filter .35s ease;
  z-index: 2;
}
.lamp-login.on .shade { background: linear-gradient(#f6d7bc, #e7b48c); filter: drop-shadow(0 10px 16px rgba(255, 176, 80, .25)); }
.face { position: absolute; left: 0; right: 0; top: 42px; height: 36px; }
.lamp-lid, .lamp-eye { position: absolute; top: 0; }
.lamp-lid:nth-child(1), .lamp-eye:nth-child(3) { left: 52px; }
.lamp-lid:nth-child(2), .lamp-eye:nth-child(4) { right: 52px; }
.lamp-lid { width: 18px; height: 8px; border-bottom: 3px solid #2c3138; border-radius: 0 0 14px 14px; }
.lamp-eye, .lamp-mouth { display: none; }
.lamp-eye { width: 16px; height: 18px; background: #2c3138; border-radius: 50%; position: absolute; }
.lamp-eye:after { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: white; top: 3px; left: 3px; }
.lamp-mouth { width: 22px; height: 10px; border-bottom: 3px solid #2c3138; border-radius: 0 0 16px 16px; position: absolute; left: 50%; top: 22px; transform: translateX(-50%); }
.lamp-login.on .lamp-lid { display: none; }
.lamp-login.on .lamp-eye, .lamp-login.on .lamp-mouth { display: block; }
.beam {
  position: absolute;
  left: 18px;
  top: 102px;
  width: 140px;
  height: 150px;
  background: linear-gradient(rgba(255, 214, 140, .55), rgba(255, 214, 140, 0));
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
}
.lamp-login.on .beam { opacity: 1; }
.stem { width: 16px; height: 118px; margin: -6px auto 0; background: linear-gradient(#d7dde6, #8e98a6); border-radius: 8px; position: relative; z-index: 1; }
.foot { width: 92px; height: 16px; margin: -2px auto 0; background: linear-gradient(#e7edf4, #9aa3b0); border-radius: 50%; }
.cord {
  position: absolute;
  left: 8px;
  top: 78px;
  width: 36px;
  height: 110px;
  border: 0;
  padding: 0;
  background: transparent;
  color: #c5ccd6;
  touch-action: none;
}
.cord-line { position: absolute; left: 16px; top: 0; width: 2px; height: 78px; background: #b7c0cc; border-radius: 2px; }
.cord-bead { position: absolute; left: 9px; top: 74px; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #c5ced8 45%, #8b95a3); box-shadow: 0 2px 4px rgba(0,0,0,.35); }
.cord-hint { position: absolute; left: 28px; top: 76px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #9aa3b2; }
.lamp-login.on .cord-hint { opacity: 0; }
.lamp-card {
  position: absolute;
  left: 248px;
  top: 36px;
  width: 300px;
  padding: 26px 22px 18px;
  border-radius: 18px;
  background: rgba(18, 20, 26, .78);
  border: 1px solid rgba(255, 156, 92, .45);
  box-shadow: 0 0 0 1px rgba(255, 120, 60, .12), 0 18px 40px rgba(0,0,0,.45), 0 0 36px rgba(255, 140, 70, .16);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity .45s ease, transform .45s ease;
}
.lamp-login.on .lamp-card { opacity: 1; transform: none; pointer-events: auto; }
.lamp-card h2 { margin: 0 0 16px; text-align: center; font-size: 22px; font-weight: 700; }
.lamp-card .field { color: #d5dbe3; margin-bottom: 12px; }
.lamp-card .field span { font-weight: 600; font-size: 13px; }
.lamp-card input {
  background: #2a303a;
  border: 1px solid #3c4450;
  color: white;
  border-radius: 8px;
}
.lamp-card input::placeholder { color: #8b95a3; }
.lamp-card .eye { color: #c5ccd6; }
.lamp-card .eye:hover { color: white; background: transparent; }
.lamp-card .btn {
  width: 100%;
  margin-top: 6px;
  background: #c4785a;
  border-radius: 8px;
  box-shadow: 0 3px 0 #8d5340;
  transform: translateY(-1px);
}
.lamp-card .btn:hover { background: #d18464; }
.lamp-card .btn:active { transform: translateY(0); box-shadow: none; }
.lamp-brand { margin: 0; text-align: center; }
.lamp-brand img { width: min(280px, 72vw); height: auto; background: transparent; mix-blend-mode: screen; }
.lamp-card .lamp-app { display: block; margin-top: 14px; text-align: center; color: #e7b48c; font-size: 14px; text-decoration: none; }

.shell { height: 100%; display: flex; }
.sidebar {
  width: 272px; flex: none; background: #12151c; color: white;
  display: flex; flex-direction: column; overflow: auto;
  border-right: 1px solid var(--line);
}
.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;
}
a.nav-btn { text-decoration: none; font: inherit; cursor: pointer; box-sizing: border-box; }
.nav-btn:hover { background: rgba(255,255,255,.06); }
.nav-btn.active { background: rgba(196, 120, 90, .22); color: white; box-shadow: inset 3px 0 0 #c4785a; }
.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: #161a22; 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: #2a303a; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #e7b48c, #c4785a); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.steps button, .steps a { text-align: left; text-decoration: none; }
.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 #c4785a; }
.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: #16181e; }
.register-sheet { background: #16181e; padding: 8px; }
.register { width: 100%; border-collapse: collapse; border: 2px solid rgba(255, 156, 92, .45); }
.register th { background: #c4785a; color: white; text-transform: none; letter-spacing: 0; text-align: center; font-size: 13px; }
.register td { border: 1px solid rgba(255, 156, 92, .22); text-align: center; padding: 7px 6px; }
.register td.name { text-align: left; white-space: nowrap; }
.register tfoot td { font-weight: 750; background: #241c18; }
.register input.sheet-advance, .register input.day-advance, .register input.sheet-cell { width: 108px; max-width: 100%; text-align: right; font-weight: 650; padding: 4px 6px; }
.register input.sheet-cell[type="time"] { width: 112px; text-align: center; }
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: #1e232c; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 176, 120, .08); }
.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: #2a303a; color: #d5dbe3; }
.badge.green { background: rgba(134, 192, 67, .18); color: #c6e6a2; }
.badge.amber { background: rgba(231, 180, 140, .2); color: #f0d2b4; }
.badge.red { background: rgba(227, 27, 35, .2); color: #ffb4b8; }
.badge.blue { background: rgba(231, 180, 140, .16); color: #f6d7bc; }
.badge.gray { background: #2a303a; color: #c5ccd6; }

.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: #3d8f4a; }
.btn.green:hover { background: #327a3d; }
.btn.ghost { background: #2a303a; color: #f4f1ea; }
.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: #d5dbe3; }
.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: white; background: transparent; }
.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 var(--line); }
.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: #2a303a; color: #a8b0bc; }
.switch.on { background: var(--navy); color: white; }
input, select, textarea {
  width: 100%; border: 1px solid #3c4450; border-radius: 10px; padding: 10px 12px; background: #2a303a; color: #f4f1ea;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(196, 120, 90, .55); border-color: #c4785a; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pay-rates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 8px; }
.pay-rates div { background: #1c2129; border: 1px solid rgba(255, 156, 92, .35); border-radius: 12px; padding: 10px 12px; }
.pay-rates span { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.pay-rates b { display: block; margin-top: 4px; color: #f6d7bc; font-size: 18px; }
.extra-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 0 12px; }
.extra-summary div { background: #1c2129; border: 1px solid rgba(255, 156, 92, .35); border-radius: 12px; padding: 10px 12px; }
.extra-summary span { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.extra-summary b { display: block; margin-top: 4px; color: #f6d7bc; font-size: 18px; }
.register td.extra-wage { background: rgba(231, 180, 140, .12); font-weight: 750; }
.span-2 { grid-column: span 2; }
.check { display: flex; gap: 8px; align-items: center; }
.check input { width: auto; }
.search { max-width: 280px; }
.emp-pick { position: relative; flex: 1; min-width: 220px; max-width: 340px; }
.emp-pick input { width: 100%; }
.emp-results { position: absolute; z-index: 8; left: 0; right: 0; top: calc(100% + 4px); background: #1c2129; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 280px; overflow: auto; padding: 6px; }
.emp-results button { display: block; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 8px; padding: 8px 10px; color: #f4f1ea; }
.emp-results button:hover, .emp-results button:focus { background: rgba(196, 120, 90, .18); }
.emp-results p { margin: 8px 10px; }
.att-month input, .att-month select { width: 100%; min-width: 88px; padding: 4px 6px; }
.att-month input[type="time"] { min-width: 112px; }
.att-month td.row-actions, td.row-actions { white-space: nowrap; }

.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: #16181e; color: #f4f1ea; border: 1px solid rgba(255, 156, 92, .35); border-radius: 18px; padding: 18px; box-shadow: 0 0 36px rgba(255, 140, 70, .12), 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: #2a303a; color: #f4f1ea; border: 0; border-radius: 999px; padding: 8px 12px; }
.tabs button.active { background: #c4785a; 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: #1c2129; border-left: 4px solid #c4785a; padding: 10px 12px; border-radius: 8px; color: #d5dbe3; }

.payslip { background: white; color: #1c2434; padding: 8px; }
.payslip-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; border-bottom: 3px solid #1a2370; 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 #e3e8f0; padding: 6px 0; }
.slip-table tr.slip-sum td { font-weight: 750; color: #1a2370; border-bottom: 2px solid #1a2370; }
.slip-net { margin-top: 12px; background: #1a2370; color: white; border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; }
.slip-note { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.slip-note div { background: #f7faf5; border: 1px solid #d7e7b6; border-radius: 12px; padding: 10px 12px; min-width: 0; }
.slip-note span { display: block; color: var(--muted); font-size: 12px; font-weight: 650; line-height: 1.35; }
.slip-note b { display: block; margin-top: 6px; color: var(--navy); font-size: 16px; }
.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: #c4785a; 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; }
  .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: 720px) {
  .lamp-scene, .lamp-login.on .lamp-scene { width: 100%; height: auto; display: flex; flex-direction: column; align-items: center; }
  .lamp { position: relative; left: auto; top: auto; }
  .lamp-card { position: relative; left: auto; top: auto; }
  .lamp-login:not(.on) .lamp-card { display: none; }
}
@media (max-width: 700px) {
  .form-grid, .pay-rates { 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; margin: 12px; color: #1c2434; color-scheme: light; }
  .payslip { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
