/* ============================================================
   Point Pi HRM — Design System
   CSS custom properties (tokens) + all component styles
   ============================================================ */

:root {
  /* Brand */
  --brand:     #1B9BD8;
  --brand-600: #1685BC;
  --brand-700: #126EA0;
  --brand-50:  #E8F6FD;
  --brand-100: #CCEAF7;

  /* Surfaces */
  --bg:        #F6F8FB;
  --surface:   #FFFFFF;
  --surface-2: #F9FAFC;
  --surface-3: #F1F4F9;

  /* Text */
  --ink:   #0F1A2A;
  --ink-2: #2C394B;
  --ink-3: #5B6878;
  --ink-4: #8A95A4;
  --ink-5: #B7BFCC;

  /* Lines */
  --line:   #E6EAF0;
  --line-2: #EFF2F6;

  /* Accents */
  --green:     #15A47B;
  --green-50:  #E5F6F0;
  --amber:     #E0A012;
  --amber-50:  #FCF3DF;
  --rose:      #E04A4A;
  --rose-50:   #FCE9E9;
  --violet:    #7A5AE0;
  --violet-50: #EFEBFC;
  --teal:      #149DB3;
  --teal-50:   #E4F4F7;

  /* Radius */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   22px;
  --r-pill: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(15,26,42,.04), 0 1px 0 rgba(15,26,42,.02);
  --shadow-md: 0 4px 14px rgba(15,26,42,.06), 0 1px 2px rgba(15,26,42,.03);
  --shadow-lg: 0 18px 40px -16px rgba(15,26,42,.18), 0 4px 12px rgba(15,26,42,.05);

  /* Typography */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ─── Base reset ─── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans) !important;
  background: var(--bg) !important;
  color: var(--ink) !important;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ─── Buttons ─── */
.hrm-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: background .12s, border-color .12s; line-height: 1.4;
  text-decoration: none !important;
}
.hrm-btn:hover { background: var(--surface-3); color: var(--ink); }
.hrm-btn-primary { background: var(--brand); color: #fff !important; border-color: var(--brand); }
.hrm-btn-primary:hover { background: var(--brand-600); color: #fff !important; }
.hrm-btn-ghost { border-color: transparent; background: transparent; color: var(--ink-3); }
.hrm-btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.hrm-btn-danger  { color: var(--rose); border-color: var(--rose-50); background: var(--rose-50); }
.hrm-btn-success { color: var(--green); border-color: var(--green-50); background: var(--green-50); }
.hrm-btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--r-sm); }
.hrm-btn-lg { padding: 11px 20px; font-size: 14px; }

/* ─── Cards ─── */
.hrm-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.hrm-card-pad    { padding: 20px; }
.hrm-card-pad-lg { padding: 24px; }
.hrm-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line-2);
}
.hrm-card-head h3   { margin: 0; font-size: 15px; font-weight: 600; }
.hrm-card-head .sub { color: var(--ink-3); font-size: 12.5px; }

/* ─── Stat tiles ─── */
.hrm-stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px 20px;
  position: relative; overflow: hidden;
}
.hrm-stat-label { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.hrm-stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.hrm-stat-meta  { font-size: 12px; color: var(--ink-4); margin-top: 4px; }
.hrm-stat-bar   { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); margin-top: 14px; overflow: hidden; }
.hrm-stat-bar .fill { height: 100%; border-radius: var(--r-pill); }
.hrm-stat-icon  {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}

/* ─── Pills ─── */
.hrm-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
}
.hrm-pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; flex-shrink: 0; }
.hrm-pill-green  { background: var(--green-50);  color: var(--green); }
.hrm-pill-amber  { background: var(--amber-50);  color: var(--amber); }
.hrm-pill-rose   { background: var(--rose-50);   color: var(--rose); }
.hrm-pill-blue   { background: var(--brand-50);  color: var(--brand-700); }
.hrm-pill-gray   { background: var(--surface-3); color: var(--ink-3); }
.hrm-pill-violet { background: var(--violet-50); color: var(--violet); }
.hrm-pill-teal   { background: var(--teal-50);   color: var(--teal); }

/* Status aliases */
.hrm-pill-approved { background: var(--green-50);  color: var(--green); }
.hrm-pill-pending  { background: var(--amber-50);  color: var(--amber); }
.hrm-pill-rejected { background: var(--rose-50);   color: var(--rose); }

/* Leave type aliases */
.hrm-pill-vacation  { background: var(--brand-50);  color: var(--brand-700); }
.hrm-pill-sick      { background: var(--rose-50);   color: var(--rose); }
.hrm-pill-wfh       { background: var(--violet-50); color: var(--violet); }
.hrm-pill-comp      { background: var(--teal-50);   color: var(--teal); }
.hrm-pill-parental  { background: var(--amber-50);  color: var(--amber); }

/* ─── Progress bar ─── */
.hrm-progress {
  height: 5px; border-radius: 999px;
  background: var(--line); overflow: hidden;
}
.hrm-progress .fill {
  height: 100%; border-radius: 999px;
  transition: width .4s ease;
}

/* ─── Table (shared alias: hrm-table = hrm-tbl) ─── */
.hrm-table-wrap { overflow-x: auto; }
.hrm-table,
.hrm-tbl { width: 100%; border-collapse: collapse; }
.hrm-table th,
.hrm-tbl th {
  text-align: left; font-size: 11.5px; font-weight: 600;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap;
}
.hrm-table td,
.hrm-tbl td {
  padding: 12px 16px; font-size: 13px; color: var(--ink-2);
  border-bottom: 1px solid var(--line-2);
}
.hrm-table tbody tr:last-child td,
.hrm-tbl tbody tr:last-child td { border-bottom: 0; }
.hrm-table tbody tr:hover td,
.hrm-tbl tbody tr:hover td { background: var(--surface-2); }
.hrm-emp-cell { display: flex; align-items: center; gap: 10px; }
.hrm-emp-info { display: flex; flex-direction: column; }
.hrm-emp-info strong { font-weight: 600; color: var(--ink); font-size: 13px; }
.hrm-emp-info small  { color: var(--ink-4); font-size: 11.5px; }

/* ─── Avatar ─── */
.hrm-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--violet) 100%);
  color: #fff; font-weight: 600; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; text-transform: uppercase; user-select: none;
}
.hrm-avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.hrm-avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.hrm-avatar-xl { width: 80px; height: 80px; font-size: 24px; border: 4px solid var(--surface); }

/* ─── Page header ─── */
.hrm-page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.hrm-page-title { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin: 0; color: var(--ink); }
.hrm-page-sub   { color: var(--ink-3); font-size: 13.5px; margin-top: 4px; margin-bottom: 0; }
.hrm-page-actions { display: flex; gap: 8px; align-items: center; }

/* ─── Form inputs ─── */
.hrm-input, .hrm-select, .hrm-textarea {
  width: 100%; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); font-size: 13.5px; color: var(--ink);
  font-family: inherit; outline: none;
  transition: border .12s, box-shadow .12s;
}
.hrm-input:focus, .hrm-select:focus, .hrm-textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50);
}
.hrm-textarea { resize: vertical; min-height: 80px; }
.hrm-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; display: block; }
.hrm-field { margin-bottom: 14px; }
.hrm-hint  { font-size: 11.5px; color: var(--ink-4); margin-top: 5px; }

/* ─── Icon button ─── */
.hrm-icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3); cursor: pointer; position: relative;
  transition: background .12s;
}
.hrm-icon-btn:hover { background: var(--surface-3); }
.hrm-icon-btn .notif-dot {
  position: absolute; top: 7px; right: 8px;
  width: 8px; height: 8px; background: var(--rose); border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ─── Notification panel ─── */
.hrm-notif-panel {
  width: 380px; background: var(--surface);
  border: 1px solid var(--line) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  overflow: hidden; padding: 0 !important;
}
.hrm-notif-panel .notif-header {
  padding: 14px 16px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
}
.hrm-notif-panel .notif-title    { font-size: 14px; font-weight: 600; color: var(--ink); }
.hrm-notif-panel .notif-subtitle { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }
.hrm-notif-scroll { max-height: 340px; overflow-y: auto; }
.hrm-notif-item {
  display: flex; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--line-2);
  text-decoration: none; color: var(--ink); transition: background .1s;
}
.hrm-notif-item:hover { background: var(--surface-2); }
.hrm-notif-item.unread { background: var(--brand-50); }
.hrm-notif-item.unread:hover { background: var(--brand-100); }
.hrm-notif-ic {
  width: 32px; height: 32px; border-radius: var(--r-md);
  background: var(--brand-50); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.hrm-notif-body .sub   { font-size: 13px; font-weight: 600; color: var(--ink); display: block; }
.hrm-notif-body .msg   { font-size: 12px; color: var(--ink-3); display: block; margin-top: 1px; }
.hrm-notif-body .ts    { font-size: 11px; color: var(--ink-4); display: block; margin-top: 3px; }
.hrm-notif-footer {
  padding: 10px 16px; border-top: 1px solid var(--line-2);
  display: flex; justify-content: space-between; align-items: center;
}

/* ─── Misc utility ─── */
.hrm-divider { height: 1px; background: var(--line-2); margin: 14px 0; }
.hrm-row  { display: flex; gap: 12px; align-items: center; }
.hrm-col  { display: flex; flex-direction: column; gap: 12px; }
.hrm-grid { display: grid; gap: 16px; }
.hrm-grid-4 { grid-template-columns: repeat(4, 1fr); }
.hrm-grid-3 { grid-template-columns: repeat(3, 1fr); }
.hrm-grid-2 { grid-template-columns: repeat(2, 1fr); }
.hrm-muted   { color: var(--ink-3); }
.hrm-muted-2 { color: var(--ink-4); }
.hrm-mono    { font-family: ui-monospace, "SFMono-Regular", monospace; font-size: 12px; }

/* ─── Alert / flash messages ─── */
.hrm-alert {
  padding: 12px 16px; border-radius: var(--r-md);
  font-size: 13px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.hrm-alert-success { background: var(--green-50); color: var(--green); border: 1px solid #b3e8d5; }
.hrm-alert-danger  { background: var(--rose-50);  color: var(--rose);  border: 1px solid #f5c0c0; }
.hrm-alert-warning { background: var(--amber-50); color: var(--amber); border: 1px solid #f0d499; }
.hrm-alert-info    { background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100); }

/* ─── Tab bar ─── */
.hrm-tab-bar {
  display: inline-flex; gap: 2px;
  background: var(--surface-3); padding: 3px; border-radius: var(--r-md);
}
.hrm-tab {
  background: transparent; border: none; padding: 7px 14px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-3);
  border-radius: calc(var(--r-md) - 3px); cursor: pointer;
  transition: all .12s;
}
.hrm-tab:hover, .hrm-tab.active {
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm);
}

/* ─── DataTables overrides ─── */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 6px 10px; font-size: 13px; font-family: inherit;
  background: var(--surface); color: var(--ink);
}
.dataTables_wrapper .dataTables_paginate .paginate_button { border-radius: var(--r-sm) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--brand) !important; color: #fff !important; border-color: var(--brand) !important;
}

/* ─── Responsive grid collapse ─── */
@media (max-width: 1100px) {
  .hrm-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .hrm-grid-4, .hrm-grid-3, .hrm-grid-2 { grid-template-columns: 1fr; }
  .hrm-page-head { flex-direction: column; align-items: flex-start; }
}

/* ─── Dark theme ─── */
[data-theme="dark"] {
  /* Surfaces */
  --bg:        #0D1117;
  --surface:   #161B22;
  --surface-2: #1C2230;
  --surface-3: #21293A;

  /* Text */
  --ink:   #E6EDF3;
  --ink-2: #CDD5DF;
  --ink-3: #8B949E;
  --ink-4: #6E7681;
  --ink-5: #484F58;

  /* Lines */
  --line:   #30363D;
  --line-2: #21262D;

  /* Brand tints adjusted for dark */
  --brand-50:  rgba(27,155,216,.13);
  --brand-100: rgba(27,155,216,.22);

  /* Accent tints adjusted for dark */
  --green-50:  rgba(21,164,123,.15);
  --amber-50:  rgba(224,160,18,.15);
  --rose-50:   rgba(224,74,74,.15);
  --violet-50: rgba(122,90,224,.15);
  --teal-50:   rgba(20,157,179,.15);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.35), 0 1px 0 rgba(0,0,0,.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.25);
  --shadow-lg: 0 18px 48px -16px rgba(0,0,0,.7), 0 4px 14px rgba(0,0,0,.35);
}

/* Dark: alert borders */
[data-theme="dark"] .hrm-alert-success { border-color: rgba(21,164,123,.3); }
[data-theme="dark"] .hrm-alert-danger  { border-color: rgba(224,74,74,.3); }
[data-theme="dark"] .hrm-alert-warning { border-color: rgba(224,160,18,.3); }
[data-theme="dark"] .hrm-alert-info    { border-color: rgba(27,155,216,.3); }

/* Dark: DataTables */
[data-theme="dark"] .dataTables_wrapper .dataTables_length select,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter input {
  background: var(--surface-2); color: var(--ink); border-color: var(--line);
}

/* Theme toggle icon transition */
.hrm-theme-toggle { transition: background .12s; }
.hrm-theme-toggle i { transition: transform .3s; }
.hrm-theme-toggle:hover i { transform: rotate(20deg); }
