/* CCHRMS — Clean Professional Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --red:      #CC2B52;
  --red-d:    #a8183a;
  --red-l:    #fff0f3;
  --red-m:    rgba(204,43,82,.1);

  --bg:       #f4f5f7;
  --white:    #ffffff;
  --card:     #ffffff;

  --border:   #e8eaed;
  --border2:  #f0f1f3;

  --text:     #111827;
  --text2:    #374151;
  --text3:    #9ca3af;

  --green:    #059669;
  --green-l:  #ecfdf5;
  --blue:     #2563eb;
  --blue-l:   #eff6ff;
  --amber:    #d97706;
  --amber-l:  #fffbeb;
  --purple:   #7c3aed;
  --purple-l: #f5f3ff;

  --sidebar:  256px;
  --header:   60px;
  --r:        10px;
  --r2:       14px;
  --font:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --tr:       all .18s ease;
  --shadow:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow2:  0 4px 16px rgba(0,0,0,.08);
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-d); }

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar); flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto;
  z-index: 200; display: flex; flex-direction: column;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.sidebar-brand {
  padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: .75rem;
  border-bottom: 1px solid var(--border2); min-height: var(--header);
}
.brand-icon {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--red); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-weight: 800; font-size: .85rem; color: #fff; letter-spacing: -.02em;
}
.brand-name { font-size: .92rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; line-height: 1.1; }
.brand-sub  { font-size: .68rem; color: var(--text3); margin-top: .1rem; font-weight: 500; }

.sidebar-nav { padding: .5rem .75rem; flex: 1; }
.nav-section-label {
  padding: .8rem .5rem .25rem;
  font-size: .65rem; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .09em;
}
.nav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .58rem .75rem; border-radius: var(--r);
  color: var(--text2); font-size: .84rem; font-weight: 500;
  transition: var(--tr); cursor: pointer; margin-bottom: .1rem;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--red-l); color: var(--red); }
.nav-item .nav-icon {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; color: var(--text3); background: var(--bg); transition: var(--tr);
}
.nav-item:hover .nav-icon  { color: var(--text2); }
.nav-item.active .nav-icon { background: var(--red); color: #fff; }
.nav-item .nav-label { flex: 1; }
.nav-item .nav-badge {
  background: var(--red); color: #fff; font-size: .62rem; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

.sidebar-footer { padding: .85rem 1.25rem; border-top: 1px solid var(--border2); }
.sidebar-user   { display: flex; align-items: center; gap: .65rem; margin-bottom: .5rem; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--red-l); color: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; flex-shrink: 0;
  border: 1.5px solid rgba(204,43,82,.2);
}
.user-name  { font-size: .82rem; font-weight: 600; color: var(--text); line-height: 1.2; }
.user-role  { font-size: .68rem; color: var(--text3); }
.logout-btn {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; color: var(--red); font-weight: 500;
  padding: .3rem .6rem; border-radius: 6px; transition: var(--tr);
}
.logout-btn:hover { background: var(--red-l); }

/* ── Main ── */
.main { margin-left: var(--sidebar); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ── Topbar ── */
.topbar {
  height: var(--header); background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 1.5rem; gap: .75rem;
  position: sticky; top: 0; z-index: 90; box-shadow: var(--shadow);
}
.sidebar-toggle {
  display: none; background: none; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
  align-items: center; justify-content: center;
  color: var(--text2); font-size: 1rem; transition: var(--tr);
}
.sidebar-toggle:hover { background: var(--bg); }
.topbar-title      { flex: 1; font-size: 1rem; font-weight: 600; color: var(--text); letter-spacing: -.02em; }
.topbar-title small { font-size: .68rem; color: var(--text3); font-weight: 400; display: block; letter-spacing: 0; margin-top: .05rem; }
.topbar-user {
  display: flex; flex-direction: column; align-items: flex-end;
  white-space: nowrap; line-height: 1.3;
}
.topbar-user strong { color: var(--text); display: block; font-weight: 600; font-size: .82rem; }
.topbar-empid { font-size: .65rem; color: var(--text3); font-weight: 500; letter-spacing: .03em; }

/* ── Notifications ── */
.notif-wrap { position: relative; }
.notif-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--white); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; color: var(--text2); transition: var(--tr);
}
.notif-btn:hover { background: var(--bg); }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: #fff; font-size: .58rem; font-weight: 700;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--white);
}
.notif-drop {
  position: fixed;
  top: calc(var(--header) + 6px);
  right: 12px;
  width: 300px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r2); box-shadow: var(--shadow2);
  z-index: 500; display: none; overflow: hidden;
  max-height: 420px; overflow-y: auto;
}
.notif-wrap { position: relative; flex-shrink: 0; }

@media (max-width: 576px) {
  .notif-drop {
    right: 8px;
    left: 8px;
    width: auto;
  }
}
.notif-drop.show { display: block; }
.notif-drop-header {
  padding: .6rem 1rem; font-size: .68rem; color: var(--text3);
  font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  border-bottom: 1px solid var(--border2); background: var(--bg);
}
.notif-row              { padding: .7rem 1rem; border-bottom: 1px solid var(--border2); transition: var(--tr); }
.notif-row:last-child   { border-bottom: none; }
.notif-row:hover        { background: var(--bg); }
.notif-row-title        { font-size: .82rem; font-weight: 600; color: var(--text); }
.notif-row-msg          { font-size: .76rem; color: var(--text3); margin-top: .15rem; }
.notif-row-time         { font-size: .67rem; color: var(--text3); margin-top: .2rem; }
.notif-empty            { padding: 1.5rem; text-align: center; color: var(--text3); font-size: .82rem; }

/* ── Page ── */
.page        { padding: 1.5rem; animation: fadeUp .22s ease; }
.page-header { margin-bottom: 1.25rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; }
.page-title  { font-size: 1.35rem; font-weight: 700; color: var(--text); letter-spacing: -.03em; }
.page-title i { color: var(--red); margin-right: .35rem; font-size: 1.1rem; }
.page-sub    { font-size: .78rem; color: var(--text3); margin-top: .2rem; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stats-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stats-grid-3 { grid-template-columns: repeat(3, 1fr); }

.stat-card {
  background: var(--white); border-radius: var(--r2); padding: 1.1rem 1.25rem;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: .85rem;
  transition: var(--tr); position: relative; overflow: hidden;
}
.stat-card::before { display: none; }
.stat-card:hover   { box-shadow: var(--shadow2); transform: translateY(-1px); }

.stat-icon        { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0; }
.stat-icon.c-red    { background: var(--red-l);    color: var(--red); }
.stat-icon.c-green  { background: var(--green-l);  color: var(--green); }
.stat-icon.c-blue   { background: var(--blue-l);   color: var(--blue); }
.stat-icon.c-amber  { background: var(--amber-l);  color: var(--amber); }
.stat-icon.c-purple { background: var(--purple-l); color: var(--purple); }
.stat-val   { font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: -.03em; line-height: 1; }
.stat-label { font-size: .68rem; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-top: .2rem; }

/* ── Cards ── */
.card         { background: var(--white); border-radius: var(--r2); border: 1px solid var(--border); overflow: hidden; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card-header  { padding: .85rem 1.25rem; border-bottom: 1px solid var(--border2); display: flex; align-items: center; justify-content: space-between; background: var(--white); }
.card-header h6, .card-title { font-size: .9rem; font-weight: 600; color: var(--text); margin: 0; letter-spacing: -.01em; }
.card-body    { padding: 1.25rem; }
.card-footer  { padding: .75rem 1.25rem; border-top: 1px solid var(--border2); background: var(--bg); }

/* ── Profile Info ── */
.info-section      { background: var(--white); border: 1px solid var(--border); border-radius: var(--r2); overflow: hidden; margin-bottom: .75rem; box-shadow: var(--shadow); }
.info-section-head { background: var(--bg); padding: .65rem 1.25rem; border-bottom: 1px solid var(--border2); display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .82rem; color: var(--text); }
.info-section-head i { color: var(--red); font-size: .85rem; }
.info-row      { display: flex; align-items: flex-start; padding: .6rem 1.25rem; border-bottom: 1px solid var(--border2); }
.info-row:last-child { border-bottom: none; }
.info-label    { width: 155px; min-width: 155px; font-size: .7rem; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; padding-top: .1rem; }
.info-value    { flex: 1; font-size: .875rem; color: var(--text); }

/* ── Tables ── */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { color: var(--text); margin: 0; width: 100%; font-size: .84rem; }
.table thead th { background: var(--bg); color: var(--text3); font-size: .67rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; border-color: var(--border2); padding: .65rem 1rem; white-space: nowrap; }
.table tbody td { border-color: var(--border2); padding: .65rem 1rem; vertical-align: middle; color: var(--text); }
.table tbody tr:hover td { background: var(--bg); }
table.dataTable { border-collapse: collapse !important; }

/* ── Forms ── */
.form-label { font-size: .68rem; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .3rem; display: block; font-weight: 700; }
.form-control, .form-select {
  background: var(--white) !important; border: 1px solid var(--border) !important;
  color: var(--text) !important; border-radius: var(--r); font-size: .875rem;
  padding: .52rem .85rem; font-family: var(--font); transition: var(--tr);
}
.form-control:focus, .form-select:focus {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px rgba(204,43,82,.1) !important; outline: none;
}
.form-control::placeholder  { color: var(--text3) !important; }
.form-select option         { background: var(--white); color: var(--text); }
.input-group-text           { background: var(--bg) !important; border-color: var(--border) !important; color: var(--text3); }
.form-check-input           { border-color: var(--border); }
.form-check-input:checked   { background-color: var(--red); border-color: var(--red); }
textarea.form-control       { resize: vertical; min-height: 80px; }
.form-section               { background: var(--white); border: 1px solid var(--border); border-radius: var(--r2); padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.form-section-title         { font-size: .88rem; font-weight: 700; color: var(--text); border-bottom: 1px solid var(--border2); padding-bottom: .65rem; margin-bottom: 1rem; }
.form-section-title i       { color: var(--red); margin-right: .4rem; }

/* ── Buttons ── */
.btn { border-radius: var(--r); font-size: .83rem; padding: .48rem .95rem; transition: var(--tr); font-weight: 500; display: inline-flex; align-items: center; gap: .3rem; font-family: var(--font); cursor: pointer; letter-spacing: -.01em; }
.btn:active { transform: scale(.97); }
.btn-primary          { background: var(--red) !important; border: none !important; color: #fff !important; box-shadow: 0 1px 4px rgba(204,43,82,.3); }
.btn-primary:hover    { background: var(--red-d) !important; box-shadow: 0 3px 10px rgba(204,43,82,.35); }
.btn-outline-gold, .btn-outline-primary { border: 1.5px solid var(--red) !important; color: var(--red) !important; background: transparent !important; }
.btn-outline-gold:hover, .btn-outline-primary:hover { background: var(--red-l) !important; }
.btn-ghost            { background: var(--white); border: 1px solid var(--border); color: var(--text2); box-shadow: var(--shadow); }
.btn-ghost:hover      { background: var(--bg); color: var(--text); }
.btn-sm               { padding: .28rem .6rem; font-size: .75rem; border-radius: 7px; }
.btn-lg               { padding: .62rem 1.25rem; font-size: .9rem; }

/* ── Badges ── */
.badge                { font-size: .67rem; font-weight: 600; padding: .28rem .6rem; border-radius: 5px; }
.badge.bg-success     { background: var(--green-l) !important; color: var(--green); }
.badge.bg-danger      { background: var(--red-l)   !important; color: var(--red); }
.badge.bg-warning     { background: var(--amber-l) !important; color: var(--amber); }
.badge.bg-info        { background: var(--blue-l)  !important; color: var(--blue); }
.badge.bg-secondary   { background: var(--bg)      !important; color: var(--text3); border: 1px solid var(--border); }

/* ── Alerts ── */
.alert            { border-radius: var(--r); font-size: .84rem; padding: .75rem 1rem; border: 1px solid; }
.alert-success    { background: var(--green-l); border-color: #a7f3d0; color: #065f46; }
.alert-danger     { background: var(--red-l);   border-color: #fecdd3; color: #9b1239; }
.alert-warning    { background: var(--amber-l); border-color: #fde68a; color: #92400e; }
.alert-info       { background: var(--blue-l);  border-color: #bfdbfe; color: #1e40af; }
.btn-close        { opacity: .5; }
.btn-close:hover  { opacity: .9; }

/* ── Modal ── */
.modal-content        { background: var(--white); border: 1px solid var(--border); border-radius: var(--r2); box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.modal-header, .modal-footer { border-color: var(--border2); }
.modal-header         { background: var(--bg); }
.modal-title          { font-size: .95rem; font-weight: 700; color: var(--text); }
.modal-backdrop.show  { opacity: .4; }

/* ── DataTables ── */
div.dataTables_wrapper { color: var(--text); padding: 0; }

.dataTables_length,
.dataTables_filter {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 12px 15px;
}
.dataTables_length { float: left; }
.dataTables_filter { float: right; }
.dataTables_filter label,
.dataTables_length label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin: 0 !important;
  color: var(--text2);
}

.dataTables_filter input,
.dataTables_length select {
  background: var(--white) !important; border: 1px solid var(--border) !important;
  color: var(--text) !important; border-radius: 8px;
  padding: .28rem .6rem; font-family: var(--font);
}
.dataTables_filter input { min-width: 220px; }
.dataTables_info,
.dataTables_length label,
.dataTables_filter label { color: var(--text3); font-size: .76rem; }
.dataTables_info    { padding: 15px !important; text-align: left !important; }
.dataTables_paginate { padding: 10px 15px 15px !important; text-align: right !important; }
table.dataTable td.dataTables_empty {
  text-align: center !important; vertical-align: middle !important;
  padding: 30px !important; font-weight: 500; color: var(--text3);
}

.paginate_button              { border: 1px solid var(--border) !important; color: var(--text2) !important; border-radius: 7px !important; padding: .22rem .55rem !important; margin: 0 2px !important; background: var(--white) !important; font-size: .78rem !important; }
.paginate_button.current      { background: var(--red) !important; color: #fff !important; border-color: var(--red) !important; }
.paginate_button:hover:not(.current):not(.disabled) { background: var(--red-l) !important; color: var(--red) !important; border-color: var(--red) !important; }
.paginate_button.disabled     { opacity: .3 !important; }

/* ── Chat ── */
.chat-wrap      { display: flex; height: calc(100vh - var(--header) - 3rem); border-radius: var(--r2); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); }
.chat-list      { width: 220px; flex-shrink: 0; border-right: 1px solid var(--border2); overflow-y: auto; background: var(--bg); }
.chat-list-item { padding: .7rem 1rem; border-bottom: 1px solid var(--border2); cursor: pointer; transition: var(--tr); }
.chat-list-item:hover, .chat-list-item.active { background: var(--red-l); }
.chat-list-item .cname { font-size: .84rem; color: var(--text); font-weight: 500; }
.chat-list-item .csub  { font-size: .72rem; color: var(--text3); }
.chat-main      { flex: 1; display: flex; flex-direction: column; background: var(--white); }
.chat-head      { padding: .75rem 1rem; border-bottom: 1px solid var(--border2); font-weight: 600; color: var(--text); font-size: .85rem; background: var(--bg); }
.chat-msgs      { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; background: var(--bg); }
.msg            { max-width: 66%; padding: .6rem .95rem; border-radius: 16px; font-size: .84rem; line-height: 1.5; }
.msg-in         { background: var(--white); border: 1px solid var(--border2); align-self: flex-start; border-bottom-left-radius: 4px; color: var(--text); }
.msg-out        { background: var(--red); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg-time       { font-size: .66rem; opacity: .6; margin-top: .2rem; }
.chat-in-row    { padding: .65rem; border-top: 1px solid var(--border2); display: flex; gap: .5rem; background: var(--white); }

/* ── Announcements ── */
.ann-card  { background: var(--white); border: 1px solid var(--border); border-left: 4px solid var(--red); border-radius: var(--r2); padding: 1rem 1.1rem; margin-bottom: .75rem; box-shadow: var(--shadow); }
.ann-type  { font-size: .67rem; text-transform: uppercase; letter-spacing: .09em; color: var(--red); font-weight: 700; margin-bottom: .3rem; }
.ann-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: .3rem; letter-spacing: -.01em; }
.ann-meta  { font-size: .73rem; color: var(--text3); margin-bottom: .5rem; }
.ann-body  { font-size: .84rem; color: var(--text2); line-height: 1.65; }

/* ── Notification Page Items ── */
.notif-link { display: block; text-decoration: none; color: inherit; }
.notif-link:hover { text-decoration: none; color: inherit; }
.notif-page-item {
  display: flex; gap: .85rem; padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--border2); align-items: flex-start;
  transition: .2s ease;
}
.notif-page-item:last-child { border-bottom: none; }
.notif-page-item:hover      { background: var(--bg); }
.notif-icon-wrap    { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; background: var(--red-l); color: var(--red); display: flex; align-items: center; justify-content: center; font-size: .88rem; }
.notif-page-title   { font-size: .875rem; font-weight: 600; color: var(--text); margin-bottom: 4px; word-break: break-word; }
.notif-page-msg     { font-size: .78rem; color: var(--text3); margin-top: .15rem; word-break: break-word; overflow-wrap: break-word; line-height: 1.5; }
.notif-page-time    { font-size: .68rem; color: var(--text3); margin-top: 6px; }

/* ── Clock ── */
.clock-big { font-size: 2.8rem; font-weight: 700; color: var(--red); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }

/* ── SweetAlert2 ── */
.swal2-popup        { background: var(--white) !important; color: var(--text) !important; border: 1px solid var(--border) !important; border-radius: var(--r2) !important; box-shadow: 0 20px 60px rgba(0,0,0,.15) !important; }
.swal2-title        { color: var(--text) !important; font-family: var(--font) !important; font-size: 1.1rem !important; font-weight: 700 !important; letter-spacing: -.02em !important; }
.swal2-html-container { color: var(--text2) !important; font-family: var(--font) !important; }
.swal2-input        { background: var(--bg) !important; border-color: var(--border) !important; color: var(--text) !important; border-radius: var(--r) !important; font-family: var(--font) !important; }
.swal2-input:focus  { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(204,43,82,.1) !important; }
.swal2-confirm      { background: var(--red) !important; border: none !important; border-radius: var(--r) !important; font-family: var(--font) !important; font-weight: 600 !important; }
.swal2-cancel       { background: var(--white) !important; border: 1px solid var(--border) !important; color: var(--text) !important; border-radius: var(--r) !important; font-family: var(--font) !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }



/* ═══════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════ */

/* ── ≤991px (tablet + mobile) ── */
@media (max-width: 991px) {
  .sidebar          { transform: translateX(-100%); }
  .sidebar.open     { transform: translateX(0); box-shadow: 0 0 0 100vw rgba(0,0,0,.25); }
  .main             { margin-left: 0; }
  .sidebar-toggle   { display: flex; }
  /* bottom-nav handled by .bnav */
  .page             { padding: 1rem; padding-bottom: 72px !important; }
  .topbar           { padding: 0 1rem; gap: .5rem; }
  .topbar-user      { display: none; }

  .stats-grid       { grid-template-columns: repeat(2, 1fr) !important; gap: .75rem; }
  .stats-grid-4     { grid-template-columns: repeat(2, 1fr) !important; }
  .stats-grid-3     { grid-template-columns: repeat(3, 1fr) !important; }

  .dataTables_length,
  .dataTables_filter { float: none !important; width: 100%; padding: 8px 12px; }
  .dataTables_filter input { width: 100% !important; min-width: 0 !important; }
  .dataTables_info  { text-align: center !important; }
  .dataTables_paginate { text-align: center !important; }

  .notif-drop       { width: calc(100vw - 1.5rem); right: -2rem; }
}

/* ── ≤576px (mobile) ── */
@media (max-width: 576px) {
  .page             { padding: .85rem; padding-bottom: 72px !important; }
  .page-title       { font-size: 1.1rem; }

  /* Profile hero */
  .profile-hero     { flex-direction: column; text-align: center; padding: 1.25rem 1rem; gap: .85rem; border-radius: 10px !important; }
  .profile-hero h2  { font-size: 1.2rem !important; }
  .badge-readonly   { justify-content: center; }

  /* Info rows — stack */
  .info-row         { flex-direction: column; padding: .65rem 1rem; gap: .1rem; }
  .info-label       { width: 100% !important; min-width: unset !important; font-size: .65rem; }
  .info-value       { font-size: .875rem; }

  /* Stat cards */
  .stat-card        { padding: .85rem .9rem; gap: .6rem; }
  .stat-icon        { width: 36px; height: 36px; border-radius: 9px; font-size: .9rem; }
  .stat-val         { font-size: 1.15rem !important; }
  .stat-label       { font-size: .62rem; }

  /* Cards */
  .card-header      { padding: .75rem 1rem; }
  .card-body        { padding: 1rem; }
  .form-section     { padding: 1rem; }

  /* Tables */
  table.dataTable td, table.dataTable th { font-size: .78rem !important; padding: .5rem .65rem !important; }

  /* Clock */
  .clock-big        { font-size: 2rem; }

  /* Modal */
  .modal-dialog     { margin: .5rem; }

  /* Chat */
  .chat-list        { display: none; }

  /* Announcements */
  .ann-card         { padding: .85rem 1rem; }
  .ann-title        { font-size: .92rem; }
  .ann-body         { font-size: .82rem; }

  /* Notification items */
  .notif-page-item  { padding: 12px; align-items: flex-start; }
  .notif-icon-wrap  { width: 40px; height: 40px; min-width: 40px; font-size: .8rem; }
  .notif-page-title { font-size: .85rem; }
  .notif-page-msg   { font-size: .75rem; }
  .notif-page-time  { font-size: .68rem; }

  /* Doc grid */
  .doc-grid         { grid-template-columns: repeat(2, 1fr) !important; padding: .85rem; gap: .6rem; }

  /* Check-in buttons */
  #checkInBtn, #checkOutBtn { width: 100%; justify-content: center; margin-top: .5rem; }

  /* Topbar user compact */
  .topbar-user      { display: flex !important; }
  .topbar-user strong { font-size: .75rem; max-width: 90px; overflow: hidden; text-overflow: ellipsis; display: block; }
  .topbar-empid     { font-size: .6rem; }
}

/* ── Print ── */
@media print {
  .sidebar, .topbar, .bottom-nav, .no-print { display: none !important; }
  .main   { margin-left: 0 !important; }
  body    { background: #fff !important; }
}

/* ── Notification unread highlight ── */
.notif-unread {
  background: #fff8f9;
  border-left: 3px solid var(--red);
}
.notif-unread .notif-page-title {
  color: var(--red);
}

/* ══════════════════════════════════════
   BOTTOM NAV — Floating Pill
   ══════════════════════════════════════ */
.bnav {
  display: none;
  position: fixed;
  bottom: 12px;
  left: 12px; right: 12px;
  height: 64px;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
  padding: 0 8px;
  z-index: 1050;
  align-items: center;
  justify-content: space-around;
}

.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px 6px;
  text-decoration: none;
  color: var(--text3);
  transition: color .2s ease;
  position: relative;
  min-width: 0;
}

.bnav-icon {
  width: 36px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: transform .2s ease, color .2s ease;
  position: relative;
}

.bnav-label {
  font-size: .58rem;
  font-weight: 600;
  letter-spacing: .02em;
  transition: color .2s ease;
  white-space: nowrap;
}

/* Active state — icon pops up + underline dot */
.bnav-item.active { color: var(--red); }
.bnav-item.active .bnav-icon {
  color: var(--red);
  transform: translateY(-3px);
}
.bnav-item.active .bnav-label { color: var(--red); font-weight: 700; }
.bnav-item.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%; transform: translateX(-50%);
  width: 18px; height: 3px;
  background: var(--red);
  border-radius: 2px;
}

/* Tap */
.bnav-item:active .bnav-icon { transform: translateY(0) scale(.9); }

/* Badge */
.bnav-badge {
  position: absolute;
  top: -2px; right: -4px;
  background: var(--red); color: #fff;
  font-size: .5rem; font-weight: 700;
  min-width: 15px; height: 15px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 2px solid #fff;
}

@media (max-width: 991px) {
  .bnav { display: flex; }
  .page { padding-bottom: 88px !important; }
}

@media (max-width: 360px) {
  .bnav { bottom: 8px; left: 8px; right: 8px; }
  .bnav-label { font-size: .53rem; }
  .bnav-icon  { font-size: 1rem; }
}

/* ── Mobile: hide topbar, use bottom nav only ── */
@media (max-width: 991px) {
  .topbar-desktop {
    display: none !important;
  }
  .main {
    padding-top: 0;
  }
  .page {
    padding-top: 1rem !important;
  }
}

/* ── Live Notification Toast ── */
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-16px) scale(.92); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)     scale(1); }
}

/* ══════════════════════════════════════
   RESPONSIVE TABLE / CARD SYSTEM
   ══════════════════════════════════════ */

/* Desktop: show table, hide cards */
.desktop-table { display: block; }
.mobile-cards  { display: none; }

/* Mobile: hide table, show cards */
@media (max-width: 991px) {
  .desktop-table { display: none !important; }
  .mobile-cards  { display: block !important; }
}

/* Record Card */
.rec-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 1rem 1.1rem;
  margin-bottom: .65rem;
  box-shadow: var(--shadow);
}
.rec-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .65rem;
  gap: .5rem;
}
.rec-card-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.rec-card-sub {
  font-size: .72rem;
  color: var(--text3);
  margin-top: .1rem;
  font-family: monospace;
}
.rec-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem .75rem;
  margin-bottom: .75rem;
}
.rec-card-field {
  display: flex;
  flex-direction: column;
  gap: .05rem;
}
.rec-card-label {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  color: var(--text3);
}
.rec-card-val {
  font-size: .82rem;
  color: var(--text2);
  font-weight: 500;
}
.rec-card-actions {
  display: flex;
  gap: .4rem;
  padding-top: .65rem;
  border-top: 1px solid var(--border2);
  flex-wrap: wrap;
}
.rec-card-actions .btn {
  flex: 1;
  justify-content: center;
  font-size: .78rem;
  padding: .38rem .6rem;
  min-width: 0;
}

/* ══════════════════════════════════════
   PROFILE FORM — Mobile Layout
   ══════════════════════════════════════ */
.form-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.form-section h4 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border2);
  padding-bottom: .65rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.section-icon { color: var(--red); }
.text-crimson  { color: var(--red); }
.sig-canvas {
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  background: var(--bg);
  width: 100%;
  max-width: 400px;
  display: block;
  cursor: crosshair;
}

@media (max-width: 576px) {
  .form-section { padding: .85rem; }
  .form-section h4 { font-size: .84rem; }

  /* Stack all col-md-* to full width on mobile */
  .form-section .row > [class*="col-md-"] {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  /* Keep 2-col for small side-by-side fields */
  .form-section .row > .col-6,
  .form-section .row > .col-md-6.col-6 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }
  .sig-canvas { max-width: 100%; height: 100px; }
  .qual-row .col-md-3,
  .qual-row .col-md-2,
  .qual-row .col-md-1 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  .qual-row .col-md-1 { flex: 0 0 auto !important; width: auto !important; }
}

/* ══════════════════════════════════════
   BOTTOM NAV — "More" Drawer
   ══════════════════════════════════════ */
.bnav-more-drawer {
  display: none;
  position: fixed;
  bottom: 76px;
  left: 12px;
  right: 12px;
  background: var(--white);
  border-radius: var(--r2);
  box-shadow: 0 -4px 24px rgba(0,0,0,.12);
  border: 1px solid var(--border);
  z-index: 1049;
  padding: .75rem;
  animation: drawerUp .2s ease;
}
.bnav-more-drawer.open { display: grid; grid-template-columns: repeat(3,1fr); gap: .5rem; }
.drawer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: .85rem .4rem;
  border-radius: var(--r);
  text-decoration: none;
  color: var(--text3);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .01em;
  transition: var(--tr);
}
.drawer-item:hover  { background: var(--bg);    color: var(--text2); }
.drawer-item.active { background: var(--red-l); color: var(--red); }
.drawer-item.active .drawer-icon { background: var(--red-l); color: var(--red); }
.drawer-icon {
  width: 44px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: var(--bg);
  color: var(--text3);
  transition: var(--tr);
}
.drawer-item:hover .drawer-icon  { background: var(--border2); color: var(--text2); }
.drawer-item.active .drawer-icon { background: var(--red-l);   color: var(--red); }
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1048;
  background: transparent;
}
.drawer-overlay.open { display: block; }
@keyframes drawerUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Toggle Switch ── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--red) !important;
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ── Page Title Banner ── */
.page-header {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-d) 100%);
  border-radius: var(--r2);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  box-shadow: 0 4px 16px rgba(204,43,82,.25);
  position: relative;
  overflow: hidden;
}
.page-header::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.page-header::after {
  content: '';
  position: absolute;
  bottom: -20px; left: 30%;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
}
.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff !important;
  letter-spacing: -.02em;
  margin: 0;
  position: relative;
  z-index: 1;
}
.page-title i {
  color: rgba(255,255,255,.85) !important;
  margin-right: .4rem;
}
.page-sub {
  font-size: .75rem;
  color: rgba(255,255,255,.75);
  margin-top: .15rem;
}
.page-header .btn {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,.15) !important;
  border: 1.5px solid rgba(255,255,255,.3) !important;
  color: #fff !important;
  backdrop-filter: blur(4px);
}
.page-header .btn:hover {
  background: rgba(255,255,255,.25) !important;
}
.page-header .btn-primary {
  background: rgba(255,255,255,.2) !important;
}

@media (max-width: 576px) {
  .page-header { padding: .85rem 1rem; border-radius: var(--r); }
  .page-title  { font-size: 1rem; }
}
