/* Mursam HRMS — theme taken from the Mursam logo:
   deep indigo M, violet-to-electric-purple S, charcoal wordmark. */
:root {
  --brand-950: #140a4d;
  --brand-900: #1d0f6b;
  --brand-800: #2a1690;
  --brand-700: #3b1fc0;
  --brand-600: #4f28e0;
  --brand-500: #6236f0;
  --brand-400: #7c56f7;
  --brand-200: #cfc2fd;
  --brand-100: #ece6ff;
  --brand-50: #f6f3ff;
  --grad: linear-gradient(135deg, var(--brand-900) 0%, var(--brand-600) 60%, var(--brand-400) 100%);

  --ink: #2f2f35;
  --ink-2: #5b5b66;
  --ink-3: #8b8b96;
  --line: #e6e4ef;
  --bg: #f7f6fb;
  --card: #ffffff;

  --ok: #11845b;   --ok-bg: #e3f6ee;
  --warn: #a15c00; --warn-bg: #fff2dc;
  --bad: #c0283a;  --bad-bg: #fde8eb;
  --info: var(--brand-700); --info-bg: var(--brand-100);
  --muted-bg: #efeef4;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 10, 77, .06), 0 4px 16px rgba(20, 10, 77, .06);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-600); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.25; color: var(--ink); }
h1 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0 0 .75em; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--brand-950); color: #d9d3ff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .brand { padding: 18px 20px 14px; background: #fff; border-bottom: 3px solid var(--brand-600); }
.side .brand img { display: block; max-width: 180px; max-height: 52px; width: auto; height: auto; object-fit: contain; }
.side .brand span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--brand-600); margin-top: 4px; }
.side nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.side nav .grp { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #8d82d6; padding: 14px 12px 6px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: #d9d3ff; text-decoration: none; font-weight: 600; }
.side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side nav a.on { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(79, 40, 224, .35); }
.side nav a svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.side .who { padding: 14px 20px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12px; }
.side .who b { display: block; color: #fff; font-size: 13px; }
.side .who button { margin-top: 8px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 28px 32px 40px; max-width: 1280px; width: 100%; flex: 1; }
.foot { padding: 12px 32px 20px; font-size: 12px; color: var(--ink-3); }
.foot .bad { color: var(--bad); font-weight: 700; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(20, 10, 77, .4); }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .topbar img { height: 26px; }
  .content { padding: 18px 16px 32px; }
  .foot { padding: 12px 16px 20px; }
}

/* ---------- cards, grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card > h2:first-child { margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.grid.k4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat { padding: 18px 20px; }
.stat .label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.stat .value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.stat.hero { background: var(--grad); color: #fff; border: 0; }
.stat.hero .label { color: var(--brand-200); }

/* ---------- buttons, forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 13.5px var(--font); padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--brand-200); background: var(--brand-50); }
.btn.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 2px 10px rgba(79, 40, 224, .3); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: #f4c3ca; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand-600); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.lg { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.side .btn { background: transparent; color: #d9d3ff; border-color: rgba(255, 255, 255, .15); }

.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; }
.form .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; }
.field .hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.field .err { font-size: 12px; color: var(--bad); margin-top: 4px; font-weight: 600; }
.field.has-err input, .field.has-err select { border-color: var(--bad); }
input, select, textarea { width: 100%; font: 14px var(--font); color: var(--ink); padding: 9px 11px; border: 1px solid #d8d5e6; border-radius: 9px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
input[type=checkbox] { width: auto; accent-color: var(--brand-600); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; color: var(--brand-800); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); background: var(--brand-50); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #fbfaff; }
.tbl tr.click { cursor: pointer; }
.tbl th.num { text-align: right; }
.tbl tfoot td { font-weight: 800; background: var(--brand-50); }
.empty { padding: 36px 20px; text-align: center; color: var(--ink-3); }

.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { background: var(--muted-bg); color: var(--ink-2); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { font: 600 13.5px var(--font); background: none; border: 0; padding: 10px 14px; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--brand-700); border-bottom-color: var(--brand-600); }

.notice { padding: 12px 16px; border-radius: 10px; background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-900); margin-bottom: 16px; }
.notice.warn { background: var(--warn-bg); border-color: #f5d9a8; color: #6b3d00; }
.notice.bad { background: var(--bad-bg); border-color: #f4c3ca; color: #7d1422; }
.notice.ok { background: var(--ok-bg); border-color: #b7e6d2; color: #0b5a3e; }

/* ---------- modal, toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 10, 77, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 60; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(20, 10, 77, .35); }
.modal.wide { max-width: 920px; }
.modal header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal header h2 { margin: 0; }
.modal .body { padding: 20px 22px; }
.modal footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-3); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; max-width: calc(100vw - 32px); }
.toast { background: var(--brand-950); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 600; max-width: 420px; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
.toast.warn { background: #8a4f00; }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .art { background: var(--grad); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: flex-end; position: relative; overflow: hidden; }
.auth .art::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 70px solid rgba(255, 255, 255, .07); right: -160px; top: -140px; }
.auth .art h2 { color: #fff; font-size: 34px; font-weight: 800; letter-spacing: -.02em; max-width: 420px; }
.auth .art p { color: var(--brand-200); max-width: 420px; }
.auth .panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: #fff; }
.auth form { width: 100%; max-width: 360px; display: grid; gap: 14px; }
.auth .logo { width: 210px; margin-bottom: 8px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth .art { display: none; } }

/* ---------- check-in (phone) ---------- */
.checkin { max-width: 460px; margin: 0 auto; }
.clock { text-align: center; padding: 26px 20px; background: var(--grad); color: #fff; border-radius: 18px; box-shadow: 0 10px 30px rgba(79, 40, 224, .3); }
.clock .t { font-size: 46px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.clock .d { color: var(--brand-200); font-weight: 600; }
.punch-state { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.punch-state .card { padding: 14px 16px; text-align: center; }
.punch-state b { display: block; font-size: 20px; }
.camera { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; margin-bottom: 12px; }
.camera video, .camera img { width: 100%; height: 100%; object-fit: cover; display: block; }
.btn.block { width: 100%; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { font-size: 11px; font-weight: 700; color: var(--ink-3); text-align: center; }
.cal .day { border: 1px solid var(--line); border-radius: 8px; padding: 6px; min-height: 64px; font-size: 11px; background: #fff; }
.cal .day b { font-size: 13px; }
.cal .day.blank { border: 0; background: none; }

@media print {
  .side, .topbar, .foot, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; }
  body { background: #fff; }
}

/* ---------- phones: notch / status bar (home-screen app and Android app) ---------- */
@supports (padding: env(safe-area-inset-top)) {
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
  .auth .panel { padding-top: max(32px, env(safe-area-inset-top)); }
  .side { padding-top: env(safe-area-inset-top); }
  .content, .foot { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
}
