/*
 * Cinnova theme for AdminLTE 4 / Bootstrap 5.
 * Hand written, not vendored. Light mode only for now.
 *
 * Load order (set in include/header_v2.php, admin_header_v2.php,
 * header_auth_v2.php): bootstrap -> adminlte -> font-awesome ->
 * assets/cinnova/fonts.css -> assets/cinnova/tokens.css -> this file.
 *
 * Every color here comes from a --cn-* token in tokens.css. A future dark
 * mode only needs to redefine those tokens, not edit these rules.
 *
 * Sections:
 *   1. Bootstrap / AdminLTE variable mapping
 *   2. Base typography
 *   3. Components (buttons, forms, cards, tables, badges, alerts, ...)
 *   4. Shell (sidebar, topbar, page header, footer)
 *   5. Auth split layout (login / reset password)
 *   6. Legacy ports (Tabler classes, custom.css utilities, attendance_v1 widgets)
 */

/* ------------------------------------------------------------------ */
/* 1. Bootstrap / AdminLTE variable mapping                            */
/* ------------------------------------------------------------------ */
:root {
  --bs-primary: var(--cn-primary);
  --bs-primary-rgb: var(--cn-primary-rgb);
  --bs-primary-text-emphasis: var(--cn-primary-strong);
  --bs-primary-bg-subtle: var(--cn-primary-tint);
  --bs-primary-border-subtle: var(--cn-primary-tint-2);

  --bs-body-font-family: var(--cn-font-body);
  --bs-body-color: var(--cn-text);
  --bs-emphasis-color: var(--cn-text-strong);
  --bs-secondary-color: var(--cn-text-muted);
  --bs-heading-color: var(--cn-text-strong);
  /* body.bg-body-tertiary is the page background behind the cards */
  --bs-tertiary-bg: var(--cn-bg);
  --bs-tertiary-bg-rgb: var(--cn-bg-rgb);
  --bs-body-bg: var(--cn-surface);
  --bs-secondary-bg: var(--cn-surface-hover);
  --bs-border-color: var(--cn-border);

  --bs-link-color: var(--cn-primary);
  --bs-link-color-rgb: var(--cn-primary-rgb);
  --bs-link-hover-color: var(--cn-primary-hover);
  --bs-link-hover-color-rgb: 89, 94, 228;
  --bs-focus-ring-color: rgba(var(--cn-primary-rgb), 0.25);

  --lte-sidebar-width: var(--cn-sidebar-width);
}

/* ------------------------------------------------------------------ */
/* 2. Base typography                                                  */
/* ------------------------------------------------------------------ */
body {
  font-family: var(--cn-font-body);
  color: var(--cn-text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--cn-font-heading);
  font-weight: 600;
  color: var(--cn-text-strong);
}
a { color: var(--cn-primary); text-decoration: none; }
a:hover { color: var(--cn-primary-hover); }
.cn-display { font-family: var(--cn-font-display); letter-spacing: -0.02em; }
.cn-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cn-text-muted);
}

/* ------------------------------------------------------------------ */
/* 3. Components                                                       */
/* ------------------------------------------------------------------ */

/* Buttons: fully rounded pills, press scales to .97 */
.btn {
  --bs-btn-border-radius: var(--cn-radius-pill);
  --bs-btn-font-weight: 700;
  --bs-btn-padding-x: 1.25rem;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .1s ease;
}
.btn-sm { --bs-btn-border-radius: var(--cn-radius-pill); --bs-btn-padding-x: 1rem; }
.btn-lg { --bs-btn-border-radius: var(--cn-radius-pill); --bs-btn-padding-x: 1.5rem; --bs-btn-font-size: 1rem; }
.btn:active { transform: scale(0.97); }
.btn-primary {
  --bs-btn-bg: var(--cn-primary);
  --bs-btn-border-color: var(--cn-primary);
  --bs-btn-hover-bg: var(--cn-primary-hover);
  --bs-btn-hover-border-color: var(--cn-primary-hover);
  --bs-btn-active-bg: var(--cn-primary-hover);
  --bs-btn-active-border-color: var(--cn-primary-hover);
  --bs-btn-disabled-bg: var(--cn-primary);
  --bs-btn-disabled-border-color: var(--cn-primary);
  --bs-btn-focus-shadow-rgb: var(--cn-primary-rgb);
}
.btn-outline-primary {
  --bs-btn-color: var(--cn-primary);
  --bs-btn-border-color: var(--cn-primary);
  --bs-btn-hover-bg: var(--cn-primary);
  --bs-btn-hover-border-color: var(--cn-primary);
  --bs-btn-active-bg: var(--cn-primary-hover);
  --bs-btn-active-border-color: var(--cn-primary-hover);
  border-width: 1.5px;
}
.btn-secondary, .btn-default, .btn-light {
  --bs-btn-color: var(--cn-text);
  --bs-btn-bg: var(--cn-surface);
  --bs-btn-border-color: var(--cn-border-input);
  --bs-btn-hover-color: var(--cn-primary-strong);
  --bs-btn-hover-bg: var(--cn-primary-tint);
  --bs-btn-hover-border-color: var(--cn-primary-tint);
  --bs-btn-active-color: var(--cn-primary-strong);
  --bs-btn-active-bg: var(--cn-primary-tint);
  --bs-btn-active-border-color: var(--cn-primary-tint);
}
/* attendance_v1.php check in/out buttons use .btn-main, which no stylesheet defined */
.btn-main {
  --bs-btn-color: var(--cn-text-inverse);
  --bs-btn-bg: var(--cn-primary);
  --bs-btn-border-color: var(--cn-primary);
  --bs-btn-hover-color: var(--cn-text-inverse);
  --bs-btn-hover-bg: var(--cn-primary-hover);
  --bs-btn-hover-border-color: var(--cn-primary-hover);
  --bs-btn-active-color: var(--cn-text-inverse);
  --bs-btn-active-bg: var(--cn-primary-hover);
  --bs-btn-active-border-color: var(--cn-primary-hover);
}

/* Form controls: pill inputs and selects, rounded (not pill) textareas */
.form-control,
.form-select {
  border-radius: var(--cn-radius-pill);
  border-color: var(--cn-border-input);
  color: var(--cn-text);
  padding-left: 1rem;
  padding-right: 1rem;
}
.form-select { padding-right: 2.25rem; }
textarea.form-control { border-radius: var(--cn-radius-md); }
.form-control:focus,
.form-select:focus {
  border-color: var(--cn-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--cn-primary-rgb), 0.18);
}
.form-label,
.col-form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--cn-text-muted);
}
.input-group-text {
  border-radius: var(--cn-radius-pill);
  border-color: var(--cn-border-input);
  background: var(--cn-surface);
  color: var(--cn-text-muted);
}
.form-check-input:checked {
  background-color: var(--cn-primary);
  border-color: var(--cn-primary);
}

/* Cards: flat white, 20px radius, no border (sits on the grey page) */
.card {
  --bs-card-border-width: 0;
  --bs-card-border-radius: var(--cn-radius-lg);
  --bs-card-inner-border-radius: var(--cn-radius-lg);
  --bs-card-cap-bg: transparent;
  --bs-card-bg: var(--cn-surface);
  box-shadow: none;
}
.card > .card-header {
  border-bottom: 1px solid var(--cn-row-line);
  padding: 1.25rem 1.5rem 1rem;
}
.card-title,
.card-header h3 {
  font-family: var(--cn-font-heading);
  font-size: 19px;
  font-weight: 600;
  color: var(--cn-text-strong);
}
.card-body { padding: 1.5rem; }

/* Tables: pill-shaped grey header row, hairline row separators */
.table:not(.table-bordered) {
  --bs-table-color: var(--cn-text);
  --bs-table-border-color: var(--cn-row-line);
  --bs-table-striped-bg: transparent;
  --bs-table-hover-bg: var(--cn-surface-hover);
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.table > thead > tr > th {
  background: var(--cn-bg);
  border-bottom: 0;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cn-text-muted);
  white-space: nowrap;
}
.table > thead > tr > th:first-child { border-radius: var(--cn-radius-pill) 0 0 var(--cn-radius-pill); }
.table > thead > tr > th:last-child { border-radius: 0 var(--cn-radius-pill) var(--cn-radius-pill) 0; }
.table > thead > tr > th:only-child { border-radius: var(--cn-radius-pill); }
.table > tbody > tr > td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--cn-row-line);
  border-top: 0;
}
/* Row status colors (attendance_v1.php and the attendance report pages).
   Bootstrap 5 paints td backgrounds over the tr, so the color goes on the cells. */
.table > tbody > tr.weekend > * { --bs-table-bg: var(--cn-neutral-bg); --bs-table-bg-type: transparent; color: var(--cn-text-muted); }
.table > tbody > tr.public-holiday > * { --bs-table-bg: var(--cn-holiday-row); --bs-table-bg-type: transparent; }
.table > tbody > tr.admin-granted-leaves > * { --bs-table-bg: var(--cn-primary-tint); --bs-table-bg-type: transparent; }
.table > tbody > tr.half_day > * { --bs-table-bg: var(--cn-danger-bg); --bs-table-bg-type: transparent; }

/* Check-in time colors by arrival window */
.cn-time-ontime,
.err.cn-time-ontime { color: var(--cn-time-ontime); font-weight: 600; }
.cn-time-grace,
.err.cn-time-grace { color: var(--cn-time-grace); font-weight: 600; }
.cn-time-late,
.err.cn-time-late { color: var(--cn-time-late); font-weight: 600; }

/* Badges: pills. .cn-badge--* are the design's status pairs. */
.badge { border-radius: var(--cn-radius-pill); font-weight: 600; }
.cn-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--cn-radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}
.cn-badge--success { background: var(--cn-success-bg); color: var(--cn-success-fg); }
.cn-badge--danger { background: var(--cn-danger-bg); color: var(--cn-danger-fg); }
.cn-badge--warning { background: var(--cn-warning-bg); color: var(--cn-warning-fg); }
.cn-badge--neutral { background: var(--cn-neutral-bg); color: var(--cn-neutral-fg); }
.cn-badge--primary { background: var(--cn-primary-tint); color: var(--cn-primary-strong); }

/* Alerts: 16px radius, borderless, tinted */
.alert {
  --bs-alert-border-radius: var(--cn-radius-md);
  --bs-alert-border-color: transparent;
  font-size: 15px;
  line-height: 1.45;
}
.alert-danger { --bs-alert-bg: var(--cn-danger-bg); --bs-alert-color: var(--cn-danger-text); }
.alert-success { --bs-alert-bg: var(--cn-success-bg); --bs-alert-color: var(--cn-success-fg); }
.alert-warning { --bs-alert-bg: var(--cn-warning-bg); --bs-alert-color: var(--cn-warning-fg); }
.alert-info { --bs-alert-bg: var(--cn-primary-tint); --bs-alert-color: var(--cn-primary-strong); }

/* Dropdowns, modals, pagination, nav pills */
.dropdown-menu {
  --bs-dropdown-border-radius: var(--cn-radius-md);
  --bs-dropdown-border-color: var(--cn-border);
  --bs-dropdown-link-active-bg: var(--cn-primary);
  --bs-dropdown-link-hover-bg: var(--cn-primary-tint);
  --bs-dropdown-link-hover-color: var(--cn-primary-strong);
  box-shadow: var(--cn-shadow-card);
  padding: 6px;
}
.dropdown-item { border-radius: var(--cn-radius-pill); padding: 8px 14px; }
.modal-content {
  --bs-modal-border-radius: var(--cn-radius-lg);
  --bs-modal-border-width: 0;
  box-shadow: var(--cn-shadow-card);
}
.pagination {
  --bs-pagination-active-bg: var(--cn-primary);
  --bs-pagination-active-border-color: var(--cn-primary);
  --bs-pagination-color: var(--cn-primary);
  --bs-pagination-hover-color: var(--cn-primary-hover);
  --bs-pagination-border-radius: var(--cn-radius-pill);
}
.nav-pills {
  --bs-nav-pills-border-radius: var(--cn-radius-pill);
  --bs-nav-pills-link-active-bg: var(--cn-primary);
}

/* Legacy Bootstrap 3 `.label .label-*` badges (my_requests.php, request_logs.php,
   the report pages) render as the design's status pills without touching each page. */
.label {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--cn-radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  background: var(--cn-neutral-bg);
  color: var(--cn-neutral-fg);
}
.label.label-success { background: var(--cn-success-bg); color: var(--cn-success-fg); }
.label.label-danger { background: var(--cn-danger-bg); color: var(--cn-danger-fg); }
.label.label-warning { background: var(--cn-warning-bg); color: var(--cn-warning-fg); }
.label.label-info,
.label.label-primary { background: var(--cn-primary-tint); color: var(--cn-primary-strong); }
.label.label-default { background: var(--cn-neutral-bg); color: var(--cn-neutral-fg); }

/* BS4 `.custom-select` (still used on many filter bars): match .form-select */
select.custom-select {
  appearance: none;
  min-height: 38px;
  padding: 0 36px 0 16px;
  border: 1px solid var(--cn-border-input);
  border-radius: var(--cn-radius-pill);
  background: var(--cn-surface) var(--cn-select-arrow) no-repeat right 14px center;
  color: var(--cn-text);
  font-size: 14px;
}

/* Filter bar + primary action row above a list card */
.cn-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

/* Row actions inside tables (BS3 `.btn-xs` - Detail / Edit / Delete etc.):
   the design renders these as inline text links, red for destructive ones. */
.table td .btn-xs,
.table td form .btn-xs {
  --bs-btn-padding-y: 4px;
  --bs-btn-padding-x: 0;
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: transparent;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: transparent;
  --bs-btn-active-border-color: transparent;
  --bs-btn-color: var(--cn-primary);
  --bs-btn-hover-color: var(--cn-primary-hover);
  --bs-btn-active-color: var(--cn-primary-hover);
  --bs-btn-font-size: 13px;
  --bs-btn-font-weight: 700;
  margin-right: 14px;
  box-shadow: none;
}
.table td .btn-xs:hover { text-decoration: underline; }
.table td .btn-danger.btn-xs {
  --bs-btn-color: var(--cn-time-late);
  --bs-btn-hover-color: var(--cn-danger-fg);
  --bs-btn-active-color: var(--cn-danger-fg);
}
.table td form { display: inline; }
/* Approval queues (hr_approvals.php, lead_approvals.php): the decision buttons are real
   pill buttons in the design - Approve solid brand, Reject outlined - not text links. */
.table td .rw-decision-form .btn-success.btn-xs,
.table td .rw-decision-form .btn-danger.btn-xs {
  --bs-btn-padding-y: 6px;
  --bs-btn-padding-x: 16px;
  --bs-btn-border-radius: var(--cn-radius-pill);
  margin: 6px 6px 0 0;
}
.table td .rw-decision-form .btn-success.btn-xs {
  --bs-btn-color: var(--cn-text-inverse);
  --bs-btn-bg: var(--cn-primary);
  --bs-btn-border-color: var(--cn-primary);
  --bs-btn-hover-color: var(--cn-text-inverse);
  --bs-btn-hover-bg: var(--cn-primary-hover);
  --bs-btn-hover-border-color: var(--cn-primary-hover);
  --bs-btn-active-color: var(--cn-text-inverse);
  --bs-btn-active-bg: var(--cn-primary-hover);
}
.table td .rw-decision-form .btn-danger.btn-xs {
  --bs-btn-color: var(--cn-time-late);
  --bs-btn-bg: var(--cn-surface);
  --bs-btn-border-color: var(--cn-border-input);
  --bs-btn-hover-color: var(--cn-danger-fg);
  --bs-btn-hover-bg: var(--cn-danger-bg);
  --bs-btn-hover-border-color: var(--cn-danger-bg);
  --bs-btn-active-bg: var(--cn-danger-bg);
}
.table td .rw-decision-form .btn-xs:hover { text-decoration: none; }
.table td .rw-decision-form textarea { border-radius: var(--cn-radius-md); }
.rw-qv-trigger { white-space: nowrap; font-weight: 600; }
.table td:has(> .btn-xs) { white-space: nowrap; }

/* Admin form sections (config.php, add_user.php, update_user.php):
   label-over-input fields laid out in an auto-fill grid inside a card. */
.cn-card-intro { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.cn-card-intro .cn-card-title { margin: 0; font-size: 19px; }
.cn-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px 20px;
}
.cn-field-grid--wide { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cn-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cn-field .form-label { margin: 0; }
.cn-field .form-control,
.cn-field .form-select,
.cn-field select.custom-select { width: 100% !important; height: 46px; font-size: 15px; }
.cn-field textarea.form-control { height: auto; }
.cn-field--full { grid-column: 1 / -1; }
.cn-req { color: var(--cn-time-late); }
.cn-hint { font-size: 12px; color: var(--cn-text-muted); }
/* Segmented pill (Stack Type Dev / Non-Dev): radios hidden, the checked one's label lifts */
.cn-segment {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  padding: 4px;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-bg);
}
.cn-segment input[type="radio"] { position: absolute; opacity: 0 !important; pointer-events: none; width: 1px; height: 1px; }
.cn-segment label {
  height: 38px;
  margin: 0 !important;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--cn-radius-pill);
  font-size: 14px;
  font-weight: 600 !important;
  color: var(--cn-text-muted);
}
.cn-segment input[type="radio"]:checked + label { background: var(--cn-surface); color: var(--cn-primary-strong); }

/* Permission switches: label left, switch right, hairline between rows */
.cn-toggle-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  column-gap: 32px;
}
.cn-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--cn-row-line);
  font-size: 15px;
  color: var(--cn-text);
  cursor: pointer;
  margin: 0;
}
.cn-toggle .form-check { margin: 0; padding: 0; min-height: 0; }
.cn-toggle .form-check-input { width: 48px; height: 28px; margin: 0; float: none; cursor: pointer; }

/* Employee form (update_user.php), per the "Employee Form" design: avatar header,
   sticky section pills with error counts, two-column field grid, bordered
   permission lists with On/Off state, time-bound permission periods, and a
   pill save bar that stays in view and reports unsaved changes / errors. */
.cn-emp-form { display: flex; flex-direction: column; gap: 20px; max-width: 1080px; }
.cn-emp-form > .card { margin: 0; }
.cn-emp-form .cn-form-section { scroll-margin-top: calc(var(--cn-topbar-height) + 72px); }
.cn-emp-form .cn-form-section .card-body { padding: 28px; }
.cn-emp-form .cn-card-intro { margin-bottom: 24px; }
.cn-emp-header .card-body { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 22px 28px; }
.cn-emp-avatar {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-primary);
  color: var(--cn-text-inverse);
  font-family: var(--cn-font-display);
  font-size: 20px;
  font-weight: 700;
}
.cn-emp-meta { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cn-emp-name { margin: 0; font-family: var(--cn-font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.cn-emp-badges { display: flex; flex-wrap: wrap; gap: 8px; }

.cn-section-nav {
  position: sticky;
  top: calc(var(--cn-topbar-height) + 8px);
  z-index: 4;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 6px;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-topbar-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.cn-section-nav::-webkit-scrollbar { display: none; }
.cn-section-pill {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--cn-radius-pill);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--cn-text);
  text-decoration: none;
  transition: background-color 0.18s ease;
}
.cn-section-pill:hover { background: var(--cn-primary-tint); color: var(--cn-text); }
.cn-section-pill.is-active { background: var(--cn-primary); color: var(--cn-text-inverse); }
.cn-section-pill.is-active:hover { background: var(--cn-primary-hover); }
.cn-section-err {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-time-late);
  color: var(--cn-text-inverse);
  font-size: 11px;
  font-weight: 700;
}

.cn-field-grid--half { grid-template-columns: repeat(auto-fill, minmax(max(240px, calc(50% - 12px)), 1fr)); gap: 22px 24px; }
.cn-field-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cn-field-head .form-label { margin: 0; }
.cn-field-error { font-size: 13px; color: var(--cn-danger-fg); }
.cn-emp-form .form-control.is-invalid { border-color: var(--cn-time-late); background-image: none; }
.cn-history-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--cn-primary);
  white-space: nowrap;
  cursor: pointer;
}
.cn-history-link:hover { color: var(--cn-primary-hover); }
.cn-change-date {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--cn-radius-md);
  background: var(--cn-primary-tint);
}
.cn-change-date label { margin: 0; font-size: 13px; color: var(--cn-text); }
.cn-change-date .form-control { height: 44px !important; }
.cn-subsection { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--cn-row-line); }
.cn-subsection-title { margin: 0 0 16px; font-family: var(--cn-font-heading); font-size: 16px; font-weight: 600; }
.cn-card-intro .cn-subsection-title { margin: 0; }

.cn-perm-list { display: flex; flex-direction: column; border: 1px solid var(--cn-border); border-radius: var(--cn-radius-md); overflow: hidden; }
.cn-perm { display: flex; flex-direction: column; gap: 14px; padding: 16px 20px; }
.cn-perm + .cn-perm { border-top: 1px solid var(--cn-border); }
.cn-timed.is-on { background: var(--cn-surface-hover); }
.cn-perm-row { display: flex; align-items: center; gap: 16px; }
.cn-perm-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cn-perm-label { margin: 0; font-size: 15px; font-weight: 600; color: var(--cn-text-strong); cursor: pointer; }
.cn-perm-desc { font-size: 13px; color: var(--cn-text-muted); }
.cn-perm-state { min-width: 24px; text-align: right; font-size: 13px; font-weight: 600; color: var(--cn-text-muted); }
.cn-perm-state.is-on { color: var(--cn-primary-strong); }
.cn-perm-switch { margin: 0; padding: 0; min-height: 0; flex: 0 0 auto; }
.cn-perm-switch .form-check-input { width: 48px; height: 28px; margin: 0; float: none; cursor: pointer; }
.cn-perm-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cn-perm-extra .form-label { margin: 0; font-size: 14px; }
.cn-perm-extra .cn-input-suffix { width: 120px; }
.cn-perm-extra .cn-field-error { flex-basis: 100%; }

.cn-input-suffix { position: relative; display: flex; align-items: center; }
.cn-input-suffix .form-control { width: 100% !important; padding-right: 40px; }
.cn-input-suffix > span { position: absolute; right: 18px; font-size: 14px; color: var(--cn-text-muted); pointer-events: none; }
.cn-input-suffix--wide .form-control { padding-right: 60px; }
.cn-input-suffix--button .form-control { padding-right: 52px; }
.cn-input-suffix > button {
  position: absolute;
  right: 5px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--cn-radius-pill);
  background: transparent;
  color: var(--cn-text-muted);
  cursor: pointer;
}
.cn-input-suffix > button:hover { background: var(--cn-bg); }

.cn-timed-body { display: flex; flex-direction: column; gap: 10px; }
.cn-period-list { display: flex; flex-direction: column; gap: 10px; }
.cn-period-list:empty { display: none; }
.cn-period-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) minmax(160px, 1.4fr) 44px;
  gap: 10px 12px;
  align-items: end;
}
.cn-period-row label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--cn-text-muted); }
.cn-period-row .form-control { height: 44px; }
.cn-period-row .cn-field-error { grid-column: 1 / -1; }
.cn-period-remove {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--cn-border);
  border-radius: var(--cn-radius-pill);
  background: var(--cn-surface);
  color: var(--cn-time-late);
  cursor: pointer;
}
.cn-period-remove:hover { background: var(--cn-danger-bg); }
@media (max-width: 575.98px) {
  .cn-period-row { grid-template-columns: 1fr 1fr; }
  .cn-period-row .cn-period-note { grid-column: 1 / 2; }
}
.cn-timed-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }
.cn-add-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 700;
  color: var(--cn-primary);
  cursor: pointer;
}
.cn-add-link:hover { color: var(--cn-primary-hover); }

.cn-password-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; margin-top: 24px; }
.cn-password-row .cn-field { flex: 1 1 280px; max-width: 400px; }
.cn-password-row > .btn { margin-top: 30px; height: 46px; }

.cn-save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 12px 12px 12px 24px;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.1);
}
.cn-save-dot { width: 8px; height: 8px; border-radius: var(--cn-radius-pill); background: var(--cn-border-input); }
.cn-save-text { flex: 1; min-width: 160px; font-size: 14px; font-weight: 600; color: var(--cn-text); }
.cn-save-bar.is-dirty .cn-save-dot { background: var(--cn-time-grace); }
.cn-save-bar.is-error .cn-save-dot { background: var(--cn-time-late); }
.cn-save-bar.is-error .cn-save-text { color: var(--cn-danger-fg); cursor: pointer; text-decoration: underline; }

.cn-history-modal .modal-content { border: 0; border-radius: var(--cn-radius-lg); padding: 12px; }
.cn-history-modal .modal-header { border: 0; }
.cn-history-modal .modal-title { margin: 0; font-family: var(--cn-font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.cn-history-table td:first-child { font-weight: 600; color: var(--cn-text-strong); }

/* .cn-form-grid: an existing <tr><td>Label:</td><td>control(s)</td></tr> form table
   (update_user.php) rendered as the design's label-over-field grid without rewriting
   the markup its scripts depend on. Rows holding nested tables (change date + history),
   textareas or the submit button span the full width. */
table.cn-form-grid { display: block; width: 100%; border: 0; }
table.cn-form-grid > tbody {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px 20px;
}
table.cn-form-grid > tbody > tr { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
table.cn-form-grid > tbody > tr.hidden { display: none !important; }
table.cn-form-grid > tbody > tr:has(table .datepicker),
table.cn-form-grid > tbody > tr:has(textarea),
table.cn-form-grid > tbody > tr:has(input[type="submit"]) { grid-column: 1 / -1; }
table.cn-form-grid .margin-sm { display: block; margin-top: 6px; font-size: 12px; color: var(--cn-text-muted); }
/* Stack Type radios as the segmented pill (radios hidden, checked label lifts) */
table.cn-form-grid td:has(> .stack-type-radio) {
  display: inline-flex !important;
  align-self: flex-start;
  gap: 4px;
  padding: 4px !important;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-bg);
}
table.cn-form-grid .stack-type-radio { position: absolute; opacity: 0 !important; pointer-events: none; width: 1px; height: 1px; }
table.cn-form-grid .stack-type-label {
  height: 38px;
  margin: 0 !important;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--cn-radius-pill);
  font-size: 14px;
  font-weight: 600 !important;
  color: var(--cn-text-muted);
}
table.cn-form-grid .stack-type-radio:checked + .stack-type-label { background: var(--cn-surface); color: var(--cn-primary-strong); }
table.cn-form-grid > tbody > tr > td {
  display: block;
  padding: 0 !important;
  border: 0;
  background: none;
  white-space: normal;
}
table.cn-form-grid > tbody > tr > td:first-child {
  font-size: 13px;
  font-weight: 600;
  color: var(--cn-text-muted);
}
table.cn-form-grid > tbody > tr > td:first-child:empty { display: none; }
table.cn-form-grid > tbody > tr > td:first-child .red { color: var(--cn-time-late); }
table.cn-form-grid .form-control,
table.cn-form-grid select.custom-select {
  width: 100% !important;
  max-width: 320px;
  height: 46px;
  font-size: 15px;
  margin-top: 0 !important;
}
table.cn-form-grid textarea.form-control { max-width: none; height: auto; min-height: 96px; padding: 14px 18px; border-radius: var(--cn-radius-lg); }
/* Nested "value | Change Date: | date | View History" tables become one wrapping row */
table.cn-form-grid table,
table.cn-form-grid table > tbody,
table.cn-form-grid table tr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  width: auto;
  border: 0;
}
table.cn-form-grid table td {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 !important;
  border: 0;
  font-size: 13px;
  color: var(--cn-text-muted);
}
table.cn-form-grid table td .form-control { width: 220px !important; }
table.cn-form-grid a[id*="opener"],
table.cn-form-grid a[id^="view_"] { font-size: 13px; font-weight: 600; }
/* Checkboxes drawn as the design's switches (pure CSS - names/values untouched) */
table.cn-form-grid input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
  margin: 0 10px 0 0;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-switch-off);
  cursor: pointer;
  transition: background-color .18s ease;
  vertical-align: middle;
}
table.cn-form-grid input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-switch-knob);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: left .18s ease;
}
table.cn-form-grid input[type="checkbox"]:checked { background: var(--cn-primary); }
table.cn-form-grid input[type="checkbox"]:checked::after { left: 23px; }
table.cn-form-grid input[type="checkbox"]:focus-visible { outline: 2px solid var(--cn-primary); outline-offset: 2px; }
table.cn-form-grid .flex { align-items: center; gap: 8px; }
/* Work Log / WFH / Remote Check-in "Add" buttons */
table.cn-form-grid .btn.block { display: inline-flex; width: auto; max-width: none; }

/* jQuery UI dialogs + datepicker (redmond theme from CDN on many pages) in the design's style */
.ui-dialog.ui-widget {
  padding: 0;
  border: 0;
  border-radius: var(--cn-radius-lg);
  box-shadow: var(--cn-shadow-card);
  font-family: var(--cn-font-body);
  overflow: hidden;
}
.ui-dialog .ui-dialog-titlebar {
  padding: 18px 20px 10px;
  border: 0;
  border-radius: 0;
  background: var(--cn-surface);
  color: var(--cn-text-strong);
  font-family: var(--cn-font-display);
  font-size: 20px;
  font-weight: 700;
}
.ui-dialog .ui-dialog-titlebar-close {
  border: 0;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-bg);
}
.ui-dialog .ui-dialog-content { padding: 8px 20px 16px; color: var(--cn-text); }
.ui-dialog .ui-dialog-buttonpane { border: 0; padding: 0 20px 16px; margin: 0; }
.ui-dialog .ui-dialog-buttonpane button {
  border: 0;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-primary);
  color: var(--cn-text-inverse);
  font-weight: 700;
  padding: 6px 18px;
}
.ui-widget-overlay { background: rgba(0, 0, 0, .4); opacity: 1; }
.ui-datepicker.ui-widget {
  border: 0;
  border-radius: var(--cn-radius-md);
  box-shadow: var(--cn-shadow-card);
  padding: 8px;
  font-family: var(--cn-font-body);
  font-size: 13px;
  /* Override redmond's white .ui-widget-content so dark mode doesn't put
     light day numbers on a white panel. */
  background: var(--cn-surface);
  color: var(--cn-text);
}
/* Pages load redmond's jquery-ui.css after this file, and its
   .ui-widget.ui-widget-content border ties .ui-datepicker.ui-widget on
   specificity, so the light-blue border won - one more class beats it. */
.ui-datepicker.ui-widget.ui-widget-content { border: 1px solid var(--cn-border); }
.ui-datepicker th { color: var(--cn-text-muted); }
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year {
  background: var(--cn-surface);
  color: var(--cn-text);
  border: 1px solid var(--cn-border-input);
  border-radius: var(--cn-radius-sm, 6px);
}
.ui-datepicker .ui-datepicker-header { border: 0; border-radius: var(--cn-radius-pill); background: var(--cn-bg); color: var(--cn-text-strong); }
.ui-datepicker td .ui-state-default { border: 0; border-radius: var(--cn-radius-pill); background: transparent; text-align: center; color: var(--cn-text); }
.ui-datepicker td .ui-state-hover { background: var(--cn-primary-tint); color: var(--cn-primary-strong); }
.ui-datepicker td .ui-state-active,
.ui-datepicker td .ui-state-highlight { background: var(--cn-primary); color: var(--cn-text-inverse); }

/* Two-list employee picker (multiselect.js) on config.php and bulk_privileges.php */
.cn-multiselect { margin-top: 20px; }
.cn-multiselect .row { align-items: center; row-gap: 12px; }
.cn-multiselect .col-sm-2 { display: flex; flex-direction: column; }
.cn-multiselect .col-sm-2 .btn-block:last-child { margin-bottom: 0; }
/* Phones: lists stack vertically, so the transfer buttons go in one row and point down/up */
@media (max-width: 575.98px) {
  .cn-multiselect .col-sm-2 { flex-direction: row; gap: 8px; }
  .cn-multiselect .col-sm-2 .btn-block { margin-bottom: 0; }
  .cn-multiselect .col-sm-2 .cn-icon { transform: rotate(90deg); }
}
/* Picker row inside a .cn-form-table: a plain full-width cell, not a field label */
.cn-form-table td:has(> .cn-multiselect) {
  padding: 0 !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  color: inherit !important;
}
.cn-form-table .cn-multiselect select[multiple] { width: 100% !important; max-width: none; }
.cn-multiselect select[multiple] {
  height: auto;
  min-height: 200px;
  padding: 8px;
  border-radius: var(--cn-radius-md);
}
.cn-multiselect .btn-block {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  --bs-btn-bg: var(--cn-bg);
  --bs-btn-hover-bg: var(--cn-primary-tint);
  --bs-btn-hover-color: var(--cn-primary-strong);
}

/* Card building blocks used by the redesigned pages */
.cn-card-title {
  margin: 0 0 20px;
  font-family: var(--cn-font-heading);
  font-size: 20px;
  font-weight: 600;
  color: var(--cn-text-strong);
}
.cn-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.cn-card-head .cn-card-title { margin: 0; }
.cn-muted-note { font-size: 13px; color: var(--cn-text-muted); margin: 0; }
.cn-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 16px;
}
.btn-link { --bs-btn-color: var(--cn-text-muted); --bs-btn-hover-color: var(--cn-primary); text-decoration: none; }

/* Switch (half-day, admin "Only Assigned Projects") */
.cn-switch { display: inline-flex; align-items: center; gap: 10px; padding-left: 0; margin: 0; }
.cn-switch .form-check-input { width: 2.6em; height: 1.4em; margin: 0; float: none; cursor: pointer; }
.cn-switch .form-check-label { font-size: 14px; color: var(--cn-text); cursor: pointer; }

/* .cn-form-table: label-over-control form built from the shared
   <tr><td>Label</td><td>control</td></tr> rows in include/request_form_fields.php.
   Cells go display:block so each row stacks; rows keep their table-row display
   because the type-toggle script shows/hides them with jQuery .show()/.hide(). */
.cn-form-table { width: 100%; border-collapse: collapse; }
.cn-form-table td {
  display: block;
  width: auto !important;
  padding: 0;
  border: 0;
  vertical-align: top !important;
}
.cn-form-table td:first-child {
  padding-top: 18px;
  padding-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cn-text-muted);
}
.cn-form-table td:first-child:empty { padding: 0; }
.cn-form-table td:last-child.text-muted,
.cn-form-table td:last-child .text-muted { font-size: 13px; color: var(--cn-text-muted); }
.cn-form-table td span[style*="#F00"] { color: var(--cn-time-late) !important; margin-left: 2px; }
.cn-form-table .form-control,
.cn-form-table .form-select,
.cn-form-table select.custom-select {
  width: 100% !important;
  max-width: 440px;
  height: 46px;
  font-size: 15px;
}
.cn-form-table textarea.form-control { max-width: none; height: auto; padding: 14px 18px; border-radius: var(--cn-radius-lg); }
.cn-form-table #half_day_period_wrap { margin-left: 0 !important; }
.cn-form-table #half_day_period_wrap .form-control { margin-top: 12px; }

/* "This request" card (new_request.php): big working-day count + balance list */
.cn-days { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.cn-days-value {
  font-family: var(--cn-font-display);
  font-size: 48px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--cn-primary);
}
.cn-days-label { font-size: 15px; color: var(--cn-text-muted); }
.cn-kv {
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 10px;
  column-gap: 16px;
  margin: 16px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--cn-row-line);
  font-size: 14px;
}
.cn-kv dt { font-weight: 400; color: var(--cn-text-muted); }
.cn-kv dd { margin: 0; font-weight: 700; color: var(--cn-text-strong); text-align: right; }
.cn-kv dd.is-brand { color: var(--cn-primary-strong); }
.cn-kv dd.is-danger { color: var(--cn-time-late); }

/* Approval-flow steps (new_request.php side card) */
.cn-steps { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 14px; counter-reset: cn-step; }
.cn-steps li {
  counter-increment: cn-step;
  display: grid;
  grid-template-columns: 28px 1fr;
  column-gap: 12px;
  align-items: center;
  font-size: 14px;
}
.cn-steps li::before {
  content: counter(cn-step);
  grid-row: span 2;
  width: 28px;
  height: 28px;
  border-radius: var(--cn-radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--cn-primary-tint);
  color: var(--cn-primary-strong);
}
.cn-steps li.is-current::before { background: var(--cn-primary); color: var(--cn-text-inverse); }
.cn-steps li strong { color: var(--cn-text-strong); }
.cn-steps li span { color: var(--cn-text-muted); }

/* .cn-detail-grid: the <tr><td><b>Label</b></td><td>value</td></tr> rows from
   rw_request_details_html() laid out as a label-over-value grid. */
table.cn-detail-grid { display: block; width: 100%; }
table.cn-detail-grid > tbody {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px 24px;
}
table.cn-detail-grid tr { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
table.cn-detail-grid td { display: block; padding: 0 !important; border: 0; }
table.cn-detail-grid td:first-child,
table.cn-detail-grid td:first-child b { font-size: 13px; font-weight: 400; color: var(--cn-text-muted); }
table.cn-detail-grid td:last-child { font-size: 15px; font-weight: 600; color: var(--cn-text-strong); overflow-wrap: anywhere; }

/* Approval timeline (request_detail.php): dot + connecting line per entry */
.cn-timeline { display: flex; flex-direction: column; }
.cn-timeline .timeline-row {
  position: relative;
  padding: 0 0 22px 30px;
  border: 0;
  margin: 0;
  font-size: 14px;
}
.cn-timeline .timeline-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-primary);
  box-shadow: 0 0 0 4px var(--cn-primary-tint);
}
.cn-timeline .timeline-row::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 24px;
  bottom: 4px;
  width: 2px;
  background: var(--cn-row-line);
}
.cn-timeline .timeline-row:last-child { padding-bottom: 0; }
.cn-timeline .timeline-row:last-child::after { display: none; }
.cn-timeline .timeline-row.is-bad::before { background: var(--cn-time-late); box-shadow: 0 0 0 4px var(--cn-danger-bg); }
.cn-timeline .timeline-row b { color: var(--cn-text-strong); font-weight: 600; }
.cn-timeline .timeline-row .when { font-size: 13px; color: var(--cn-text-muted); }

/* Profile photo upload (profile.php) */
.cn-avatar-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.cn-avatar-lg {
  width: 112px;
  height: 112px;
  border-radius: var(--cn-radius-pill);
  object-fit: cover;
  background: var(--cn-bg);
}
.cn-avatar-upload-field { flex: 1 1 220px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* DataTables (1.11 BS5 integration + the legacy jquery.dataTables.css pages) */
.dataTables_wrapper { font-size: 14px; }
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info { font-size: 13px; color: var(--cn-text-muted); }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  height: 40px;
  border: 1px solid var(--cn-border-input);
  border-radius: var(--cn-radius-pill);
  background-color: var(--cn-surface);
  color: var(--cn-text);
  font-size: 14px;
}
.dataTables_wrapper .dataTables_length select { padding: 0 30px 0 14px; margin: 0 6px; }
.dataTables_wrapper .dataTables_filter input {
  min-width: 220px;
  padding: 0 16px 0 38px;
  margin-left: 8px;
  background: var(--cn-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23444444' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center;
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  outline: none;
  border-color: var(--cn-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--cn-primary-rgb), 0.18);
}
/* legacy jquery.dataTables.css draws a heavy black rule under the header and above the footer */
table.dataTable thead th,
table.dataTable thead td { border-bottom: 0 !important; }
table.dataTable.no-footer { border-bottom: 1px solid var(--cn-row-line) !important; }
.dataTables_wrapper .dataTables_paginate { padding-top: 12px; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  min-width: 36px;
  height: 36px;
  padding: 0 12px !important;
  margin: 0 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0 !important;
  border-radius: var(--cn-radius-pill) !important;
  background: transparent !important;
  color: var(--cn-text) !important;
  font-size: 13px;
  font-weight: 600;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--cn-primary-tint) !important;
  color: var(--cn-primary-strong) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--cn-primary) !important;
  color: var(--cn-text-inverse) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  background: transparent !important;
  color: var(--cn-disabled) !important;
}
/* The BS5 integration renders .pagination > .page-item > .page-link: separate pills, no borders.
   The integration also wraps pager links in .paginate_button, so reset that wrapper here. */
.dataTables_wrapper .pagination { gap: 4px; }
.dataTables_wrapper .pagination .paginate_button { min-width: 0; height: auto; padding: 0 !important; margin: 0; background: transparent !important; }
.dataTables_wrapper .page-link {
  border: 0;
  border-radius: var(--cn-radius-pill) !important;
  min-width: 36px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--cn-text);
}
.dataTables_wrapper .page-item.active .page-link { background: var(--cn-primary); color: var(--cn-text-inverse); }
.dataTables_wrapper .page-item.disabled .page-link { background: transparent; color: var(--cn-disabled); }

/* ------------------------------------------------------------------ */
/* 4. Shell                                                            */
/* ------------------------------------------------------------------ */

/* Sidebar: white, hairline right border, pill nav rows */
.app-sidebar.cn-sidebar {
  --lte-sidebar-color: var(--cn-text);
  --lte-sidebar-hover-bg: var(--cn-primary-tint);
  --lte-sidebar-hover-color: var(--cn-primary-strong);
  --lte-sidebar-active-color: var(--cn-text-inverse);
  --lte-sidebar-menu-active-bg: var(--cn-primary);
  --lte-sidebar-menu-active-color: var(--cn-text-inverse);
  --lte-sidebar-submenu-color: var(--cn-text);
  --lte-sidebar-submenu-hover-bg: var(--cn-primary-tint);
  --lte-sidebar-submenu-hover-color: var(--cn-primary-strong);
  --lte-sidebar-submenu-active-bg: var(--cn-primary-tint);
  --lte-sidebar-submenu-active-color: var(--cn-primary-strong);
  background: var(--cn-surface);
  border-right: 1px solid var(--cn-border);
  box-shadow: none;
  display: flex;
  flex-direction: column;
}
.cn-sidebar .sidebar-brand {
  height: var(--cn-topbar-height);
  border-bottom: 0;
  justify-content: flex-start;
  padding: 0 28px;
  background: var(--cn-surface);
}
.cn-sidebar .brand-link { padding: 0; }
.cn-sidebar .brand-image.cn-brand-logo {
  width: 128px;
  height: auto;
  max-height: none;
  float: none;
  margin: 0;
  box-shadow: none;
  opacity: 1;
}
.cn-sidebar .sidebar-wrapper {
  flex: 1 1 auto;
  padding: 8px 16px 16px;
}
.cn-sidebar .sidebar-menu { gap: 6px; }
.cn-sidebar .sidebar-menu .nav-link {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: var(--cn-radius-pill);
  color: var(--cn-text);
  font-size: 15px;
  font-weight: 500;
}
.cn-sidebar .sidebar-menu .nav-link .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}
.cn-sidebar .sidebar-menu .nav-link:hover {
  background: var(--cn-primary-tint);
  color: var(--cn-primary-strong);
}
.cn-sidebar .sidebar-menu .nav-link.active,
.cn-sidebar .sidebar-menu .nav-link.active_setting {
  background: var(--cn-primary);
  color: var(--cn-text-inverse);
  font-weight: 600;
}
.cn-sidebar .sidebar-menu .nav-treeview { padding: 4px 0 2px 14px; }
.cn-sidebar .sidebar-menu .nav-treeview .nav-link {
  min-height: 40px;
  font-size: 14px;
}
.cn-sidebar .sidebar-menu .nav-treeview .nav-link .nav-icon { font-size: 8px; }
.cn-sidebar .sidebar-menu .nav-badge { font-size: 11px; }
.cn-sidebar-tagline {
  flex: 0 0 auto;
  padding: 16px 34px 32px;
  font-family: var(--cn-font-display);
  font-size: 26px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--cn-text);
}
.cn-sidebar-tagline span {
  display: block;
  width: 40px;
  height: 3px;
  margin-top: 14px;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-primary);
}
@media (max-height: 760px) {
  .cn-sidebar-tagline { display: none; }
}

/* Topbar: translucent, blurred, sticky */
.app-header.cn-topbar {
  position: sticky;
  top: 0;
  z-index: 1034;
  min-height: var(--cn-topbar-height);
  background: var(--cn-topbar-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--cn-border);
  padding: 0 16px;
}
.cn-topbar .nav-link {
  color: var(--cn-text);
  border-radius: var(--cn-radius-pill);
}
.cn-topbar .nav-link:hover { background: var(--cn-bg); }
.cn-topbar [data-lte-toggle="sidebar"] {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.cn-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px !important;
  font-size: 14px;
  font-weight: 600;
}
.cn-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-primary);
  color: var(--cn-text-inverse);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--cn-font-display);
  font-weight: 700;
  font-size: 14px;
  flex: 0 0 auto;
}
@media (max-width: 575.98px) {
  .cn-user-name { display: none; }
}

/* Page header: eyebrow, display title with a brand-blue second word, date pill */
.app-content-header.cn-page-head { padding: 32px 16px 8px; }
.cn-page-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.cn-page-title {
  margin: 6px 0 0;
  font-family: var(--cn-font-display);
  font-size: 40px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--cn-text-strong);
}
.cn-page-title span { color: var(--cn-primary); }
.cn-date-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-surface);
  font-size: 14px;
  color: var(--cn-text-muted);
}
@media (max-width: 575.98px) {
  .cn-page-title { font-size: 30px; }
}
.app-content { padding: 16px 16px 48px; }

/* Footer: quiet, on the page background */
.app-footer {
  background: transparent;
  border-top: 1px solid var(--cn-border);
  color: var(--cn-text-muted);
  font-size: 13px;
}

/* ------------------------------------------------------------------ */
/* 5. Auth split layout (login.php, reset_password*.php)               */
/* ------------------------------------------------------------------ */
/* AdminLTE's own .login-page rule forces a centered flex box that fights a
   full-bleed split layout, so it is overridden here. */
body.login-page {
  display: block;
  min-height: 100vh;
  margin: 0;
  background: var(--cn-surface);
}
.auth-split { min-height: 100vh; }
.auth-split-brand {
  min-height: 280px;
  padding: 48px clamp(24px, 5vw, 72px);
  background: var(--cn-gradient-hero);
  color: var(--cn-text-inverse);
}
@media (min-width: 992px) {
  .auth-split-brand { min-height: 100vh; }
}
/* Stacked (phone/tablet): short brand band on top, form fills the rest */
@media (max-width: 991.98px) {
  .auth-split { align-content: flex-start; }
  .auth-split-hero { padding: 24px 0; gap: 12px; }
  .auth-split-form-col { align-items: flex-start !important; }
}
.auth-split-logo {
  width: 140px;
  height: auto;
  display: block;
}
.auth-split-hero {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 520px;
  padding: 40px 0;
}
.auth-split-hero .cn-eyebrow { color: var(--cn-text-inverse); }
.auth-split-headline {
  font-family: var(--cn-font-display);
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.auth-split-tagline {
  margin: 0;
  max-width: 420px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--cn-text-inverse);
}
.auth-split-copy { font-size: 13px; }
.auth-split-form-col {
  background-color: var(--cn-surface);
  padding: 48px 24px;
}
.auth-split-form {
  max-width: 400px;
  width: 100%;
}
.auth-split-form .form-control { height: 48px; padding: 0 20px; font-size: 15px; }
.auth-split-form .btn-lg { height: 52px; }
.login-box-msg {
  padding: 0;
  text-align: left;
  font-size: 1.25rem;
  margin-bottom: 1.75rem;
  font-family: var(--cn-font-display);
  font-weight: 700;
  color: var(--cn-text-strong);
}
.auth-title {
  margin: 0 0 8px;
  font-family: var(--cn-font-display);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--cn-text-strong);
}
.auth-subtitle {
  margin: 0;
  font-family: var(--cn-font-body);
  font-size: 15px;
  font-weight: 400;
  color: var(--cn-text-muted);
}
.auth-link { font-size: 14px; font-weight: 600; }

/* ------------------------------------------------------------------ */
/* 6. Legacy ports                                                     */
/* ------------------------------------------------------------------ */

/*
 * Ported from assets/css/dashboard.css (the old Tabler/Bootstrap-4 theme).
 * Page BODIES throughout the app use these classes (.page-header,
 * .page-title, .row-cards, .row-deck, .table-vcenter, .card-table) even
 * though the surrounding shell was Bootstrap 3 - dashboard.css was the only
 * thing making them do anything. v2 shells stop loading dashboard.css, so
 * these are reimplemented here rather than stripped from every page.
 */
.page-header {
  display: flex;
  align-items: center;
  padding: 1.5rem 0;
  flex-wrap: wrap;
}
.page-title {
  margin: 0;
  font-family: var(--cn-font-heading);
  font-size: 22px;
  font-weight: 600;
  line-height: 2.5rem;
  color: var(--cn-text-strong);
}
.row-cards > .col,
.row-cards > [class*='col-'] {
  display: flex;
  flex-direction: column;
}
.row-deck > .col,
.row-deck > [class*='col-'] {
  display: flex;
  align-items: stretch;
}
.row-deck > .col .card,
.row-deck > [class*='col-'] .card {
  flex: 1 1 auto;
}
.table-vcenter td,
.table-vcenter th {
  vertical-align: middle;
}
.card-table {
  margin-bottom: 0;
}
.card-table tr:first-child td,
.card-table tr:first-child th {
  border-top: 0;
}
.card-table tr td:first-child,
.card-table tr th:first-child {
  padding-left: 1.5rem;
}
.card-table tr td:last-child,
.card-table tr th:last-child {
  padding-right: 1.5rem;
}
/* Tables flush inside a card get side padding so the pill header doesn't touch the card edge */
.card > .table-responsive,
.card > .card-table {
  padding: 8px 16px 12px;
}

/* Ported from css/custom.css: generic utility classes, not Bootstrap-3-specific. */
.flex {
  display: flex;
}
.mr-3 {
  margin-right: 0.75rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.w-full {
  width: 100%;
}
.text-xs {
  font-size: 0.75rem;
}
/* !important as in Bootstrap 3: scripts toggle .hidden on elements that also carry
   inline display styles (update_user.php #require_admin_approval). */
.hidden {
  display: none !important;
}
.text-white {
  color: #fff;
}
.block {
  display: block;
}
.wfh_add_btn {
  max-width: 50px;
}
.flex-auto {
  flex: auto;
}

/* Ported from css/custom.css: fold/expand table rows, app-specific, not BS3-tied. */
table.fold-table > tbody > tr.view td.clickable {
  cursor: pointer;
}
table.fold-table > tbody > tr.view td:first-child,
table.fold-table > tbody > tr.view th:first-child {
  position: relative;
  padding-left: 20px;
}
table.fold-table > tbody > tr.view td:first-child:before,
table.fold-table > tbody > tr.view th:first-child:before {
  position: absolute;
  top: 50%;
  left: 5px;
  width: 9px;
  height: 16px;
  margin-top: -8px;
  font: 16px fontawesome;
  color: var(--cn-text-muted);
  content: "";
  transition: all 0.3s ease;
}
table.fold-table > tbody > tr.view.open td:first-child:before,
table.fold-table > tbody > tr.view.open th:first-child:before {
  transform: rotate(-180deg);
  color: var(--cn-text);
}
table.fold-table > tbody > tr.fold {
  display: none;
}
table.fold-table > tbody > tr.fold.open {
  display: table-row;
}
.fold-content {
  padding: 0.5em;
}
.fold-content h3 {
  margin-top: 0;
}
.fold-content > table {
  border: 1px solid var(--cn-border);
  border-radius: var(--cn-radius-md);
}
.fold-content > table > tbody tr:nth-child(even) {
  background: var(--cn-bg);
}

/*
 * Ported from css/all.css: the employee-profile / goals / attendance-summary
 * widget block on attendance_v1.php (.employee, .goals-detail,
 * .remarks-wrapper, .pie-chart + its 3 doughnut-chart children). css/all.css
 * was only ever loaded by the old include/header.php, never header_v2.php.
 * Restyled as the redesign's right-column cards: profile card with round
 * photo, white 20px cards with Roboto 19px titles.
 *
 * .employee's picture/detail pair is flex with a sized, cropped image so a
 * full-resolution profile upload can't overflow the column.
 */
.employee {
  margin-bottom: 20px;
  padding: 24px;
  background: var(--cn-surface);
  border-radius: var(--cn-radius-lg);
}
.employee > .clearfix {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px;
}
.employee-pic {
  flex: 0 0 84px;
  max-width: 84px;
  margin: 0;
}
.employee-pic img {
  display: block;
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-bg);
}
.employee .employee-detail {
  display: block;
  flex: 1 1 200px;
  min-width: 0;
}
.employee .employee-detail strong {
  display: block;
  font-size: 21px;
  font-weight: 400;
  text-align: left;
}
.employee .employee-detail h2.name {
  margin: 0 0 6px;
  font-family: var(--cn-font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--cn-text-strong);
}
.employee .employee-detail .designation {
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--cn-row-line);
  color: var(--cn-primary-strong);
  font-size: 14px;
}
.employee .employee-detail p.attendance-rank {
  display: grid;
  grid-template-columns: minmax(90px, 40%) 1fr;
  align-items: center;
  column-gap: 12px;
  margin: 0 0 8px 0 !important;
  font-weight: 600;
  font-size: 14px;
  color: var(--cn-text);
}
.employee .employee-detail p.attendance-rank > span:first-child {
  font-weight: 400;
  color: var(--cn-text-muted);
}
.employee .employee-detail p.attendance-rank .cn-badge { justify-self: start; }
.goals-detail {
  background: var(--cn-surface);
  overflow: hidden;
  margin: 0 0 20px;
}
.goals-detail.card {
  margin-bottom: 20px;
}
.goals-detail h3,
.goals-detail > h3,
.remarks-wrapper h3,
.remarks-wrapper > h3 {
  margin: 0;
  padding: 24px 24px 8px;
  background: transparent;
  font-family: var(--cn-font-heading);
  font-size: 19px;
  font-weight: 600;
  color: var(--cn-text-strong);
  text-transform: none;
}
/* Leave Detail card: title + month picker header row (Bootstrap .row inside a card) */
.remarks-wrapper > .card-title.row {
  margin: 0;
  padding: 20px 24px 0;
  align-items: center;
  row-gap: 8px;
}
.remarks-wrapper > .card-title.row > [class*='col-'] { padding: 0; }
.remarks-wrapper > .card-title.row h3 { padding: 0; margin: 0 !important; }
.remarks-wrapper > .card-title.row .mb-3 { margin-bottom: 0 !important; }
/* "Leave History" trigger: full-width outlined pill, as in the redesign */
.submit-buttons > #my-button {
  display: flex;
  align-items: center;
  width: 100%;
  height: 48px;
  margin: 0 0 20px;
  padding: 0 20px;
  border: 1.5px solid var(--cn-primary);
  background: var(--cn-surface);
  color: var(--cn-primary);
  font-size: 14px;
}
.submit-buttons > #my-button:hover { background: var(--cn-primary); color: var(--cn-text-inverse); }
.goal-box {
  padding: 12px 24px;
  font-weight: 600;
}
.goals-notice {
  font-size: 12px;
  display: block;
  text-align: left;
  margin-top: 0;
  color: var(--cn-text-muted);
  padding: 0 24px 20px;
}
.remarks-wrapper {
  background: var(--cn-surface);
  overflow: hidden;
  margin: 0 0 20px;
}
.pie-chart {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 16px 8px;
  text-align: center;
  padding: 12px 16px 20px;
}
.pie-chart .pto-leaves,
.pie-chart .short-times,
.pie-chart .late-arrivals {
  float: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0;
  min-width: 0;
}
.pie-chart h2,
.pie-chart > .pto-leaves > h2,
.pie-chart > .short-times > h2 {
  margin: 0;
  font-family: var(--cn-font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--cn-text);
}
/* Attendance Overview rings (attendance_v1.php cnRing()): 104px SVG, 8px round-capped
   stroke starting at 12 o'clock, value centred in the display face, caption below. */
.cn-ring { position: relative; width: 104px; height: 104px; margin: 0 auto; }
.cn-ring svg { display: block; transform: rotate(-90deg); }
.cn-ring-track { fill: none; stroke: var(--cn-ring-track); stroke-width: 8; }
.cn-ring-fill { fill: none; stroke: var(--cn-primary); stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.cn-ring-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--cn-font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--cn-text-strong);
}
.cn-ring-caption { display: block; margin-top: 10px; font-size: 12px; color: var(--cn-text-muted); }
.cn-apply-leave { margin-left: 8px; font-size: 13px; font-weight: 600; }

/* attendance_v1.php right column: below xxl it stacks under the main column,
   so lay its cards out side by side instead of one long strip */
@media (min-width: 768px) and (max-width: 1399.98px) {
  .cn-side-col .graphical-report {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 20px;
    align-items: start;
  }
  .cn-side-col .graphical-report > * { min-width: 0; }
}

/*
 * Ported from css/all.css: the Date/Check In/Check Out/Duration summary strip
 * on attendance_v1.php. Restyled as the redesign's four stat cards: tinted
 * icon tile, small muted label above a bold display-font value. The label
 * span comes after the value in the markup, so the column is reversed.
 */
ul.time-logs {
  margin: 0 0 20px;
  padding: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  list-style: none;
}
.checkin-wrapper { container-type: inline-size; }
@container (min-width: 440px) { ul.time-logs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 920px) { ul.time-logs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
ul.time-logs li {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  justify-content: center;
  gap: 4px;
  min-height: 88px;
  padding: 20px 20px 20px 82px;
  border-radius: var(--cn-radius-lg);
  background: var(--cn-surface);
}
ul.time-logs li::before {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: var(--cn-radius-icon);
  content: "";
  background: var(--cn-primary-tint);
}
ul.time-logs li.time-in::before { background: var(--cn-success-bg); }
ul.time-logs li.time-in::after { background: var(--cn-success-fg); }
ul.time-logs li.time-out::before { background: var(--cn-danger-bg); }
ul.time-logs li.time-out::after { background: var(--cn-time-late); }
ul.time-logs li.duration::before { background: var(--cn-neutral-bg); }
ul.time-logs li.duration::after { background: var(--cn-text); }
ul.time-logs li strong {
  display: block;
  font-family: var(--cn-font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-bottom: 0;
  color: var(--cn-text-strong);
}
ul.time-logs li.date strong { white-space: nowrap; }
ul.time-logs li strong #tip_date {
  display: block !important;
  font-family: var(--cn-font-body);
  font-size: 12px;
  font-weight: 400;
  color: var(--cn-text-muted);
}
ul.time-logs li span.light-st {
  font-size: 13px;
  text-transform: none;
  font-weight: 400;
  color: var(--cn-text-muted);
  display: block;
}

/*
 * `.form-inline` compatibility shim. Bootstrap 3/4 shipped this class
 * (flex row of inline form controls); Bootstrap 5 removed it outright. At
 * least 14 converted pages still use `class="form-inline"` on filter-bar
 * forms (attendance_v1.php, team_member_report.php, my_requests.php,
 * request_logs.php, the report-listing pages), so one shim here fixes all.
 */
.form-inline {
  display: flex;
  flex-flow: row wrap;
  /* Bottom-align, not center: several filter bars stack a label above each
     input, so centering floated the button/select to the middle of the
     label+input block instead of lining up with the input itself. */
  align-items: flex-end;
  gap: 0.5rem;
}
/* Give the button the same height as the inputs, so bottom-aligned controls
   also share a top edge (btn-sm is otherwise ~7px shorter). */
.form-inline .form-control,
.form-inline select.custom-select,
.form-inline .btn {
  min-height: 38px;
}
.form-inline .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.form-inline .form-group,
.form-inline .mb-3 {
  /* !important needed: Bootstrap 5's .mb-3 utility is itself !important, and
     its leftover 1rem bottom margin pushes the fields above the Go button. */
  margin-bottom: 0 !important;
}
.form-inline label {
  font-size: 12px;
  font-weight: 600;
  color: var(--cn-text-muted);
}

/*
 * Ported from css/all.css: the Check In/Check Out button area on
 * attendance_v1.php (.checkin-wrapper .check-in .btn). The 198px width is
 * the size the user settled on after two explicit resize requests - keep
 * it. Restyled as a brand-blue pill per the redesign.
 */
.checkin-wrapper {
  width: 100%;
  display: block;
  overflow: hidden;
  padding: 0 12px 10px;
}
.checkin-wrapper strong.check-in-time {
  font-family: var(--cn-font-display);
  font-weight: 700;
  font-size: 40px;
  letter-spacing: -0.02em;
  text-align: center;
  display: block;
  color: var(--cn-text-strong);
}
.checkin-wrapper .check-in {
  text-align: center;
  display: block;
}
.checkin-wrapper .check-in .btn {
  border: none;
  font-weight: 700;
  color: var(--cn-text-inverse);
  font-size: 15px;
  background: var(--cn-primary);
  border-radius: var(--cn-radius-pill);
  width: 198px;
  max-width: 100%;
  height: 48px;
  text-transform: none;
  padding: 0 22px;
  margin: 13px auto 24px;
  box-shadow: none;
  transition: background-color .18s ease, transform .1s ease;
}
.checkin-wrapper .check-in .btn:hover,
.checkin-wrapper .check-in .btn:focus,
.checkin-wrapper .check-in .btn:active,
.checkin-wrapper .check-in .btn:visited {
  background: var(--cn-primary-hover);
  border: none;
  outline: none;
  color: var(--cn-text-inverse);
  text-shadow: none;
}
.checkin-wrapper .check-in .alert { text-align: left; }
.checkin-wrapper .check-in span {
  display: inline-block;
  padding-right: 8px;
  position: relative;
  vertical-align: baseline;
  top: 3px;
}

/* ------------------------------------------------------------------ */
/* 7. Dark-mode specifics (colors themselves come from tokens.css)     */
/* ------------------------------------------------------------------ */
/* The wordmark is black: swap to the white lockup on dark surfaces */
[data-bs-theme="dark"] .cn-brand-logo { content: url("../cinnova/cinnova-logo-white.svg"); }
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text { background-color: var(--cn-surface); color: var(--cn-text); }
[data-bs-theme="dark"] .form-control::placeholder { color: var(--cn-text-muted); }
/* Native date/time picker icon: the browser's own glyph can render black on
   the dark input (seen on employee_movement_report.php, request forms), so in
   dark mode swap it for an explicit light icon instead of relying on it. */
[data-bs-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-bs-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
[data-bs-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E6E6EA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
  cursor: pointer;
}
[data-bs-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E6E6EA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
  cursor: pointer;
}
[data-bs-theme="dark"] .dropdown-menu { --bs-dropdown-bg: var(--cn-surface); --bs-dropdown-link-color: var(--cn-text); }
[data-bs-theme="dark"] .app-footer { background: transparent; }

/* Topbar extras: approvals bell + theme toggle (include/cn_topbar_extras.php) */
.cn-topbar-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--cn-radius-pill);
  background: transparent;
  color: var(--cn-text);
  font-size: 18px;
}
.cn-topbar-btn:hover { background: var(--cn-bg); color: var(--cn-text); }
.cn-topbar-btn[aria-disabled="true"] { cursor: default; }
.cn-bell-badge {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--cn-radius-pill);
  background: var(--cn-primary);
  color: var(--cn-text-inverse);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--cn-surface);
}
.cn-theme-toggle .cn-icon-sun { display: none; }
[data-bs-theme="dark"] .cn-theme-toggle .cn-icon-sun { display: inline-block; }
[data-bs-theme="dark"] .cn-theme-toggle .cn-icon-moon { display: none; }

/* ------------------------------------------------------------------ */
/* 8. Icons (Lucide sprite - include/cn_icons.php)                     */
/* ------------------------------------------------------------------ */
.cn-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;          /* design: thin single-stroke */
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.25em;
}
.cn-date-pill .cn-icon { width: 16px; height: 16px; }
.cn-sidebar .sidebar-menu .nav-link .nav-icon.cn-icon { width: 20px; height: 20px; margin: 0; }
.cn-sidebar .sidebar-menu .nav-link p { padding-left: 12px; }
/* Submenu bullet: small dot instead of the old FA circle glyph */
.cn-sidebar .cn-dot {
  display: inline-block;
  width: 20px;
  height: 6px;
  background: radial-gradient(circle, currentColor 2.5px, transparent 3px) center / 6px 6px no-repeat;
  opacity: .55;
}
.cn-sidebar .nav-link.active .cn-dot { opacity: 1; }
/* Tree arrow: chevron-down closed, flips up when the menu is open */
.cn-sidebar .sidebar-menu .nav-arrow.cn-icon { width: 16px; height: 16px; transform: translateY(-50%) rotate(0deg); }
.cn-sidebar .sidebar-menu .menu-open > .nav-link .nav-arrow.cn-icon { transform: translateY(-50%) rotate(180deg); }
.cn-topbar .cn-icon { width: 21px; height: 21px; }
.dropdown-item .cn-icon { width: 16px; height: 16px; }

/* Attendance stat cards: Lucide glyph drawn in the tile's foreground color via mask */
ul.time-logs li::after {
  content: "";
  position: absolute;
  left: 33px;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translateY(-50%);
  background: var(--cn-primary-strong);
  -webkit-mask: var(--cn-stat-icon) center / contain no-repeat;
  mask: var(--cn-stat-icon) center / contain no-repeat;
}
ul.time-logs li.date { --cn-stat-icon: url("../cinnova/icons/calendar.svg"); }
ul.time-logs li.time-in { --cn-stat-icon: url("../cinnova/icons/log-in.svg"); }
ul.time-logs li.time-out { --cn-stat-icon: url("../cinnova/icons/log-out.svg"); }
ul.time-logs li.duration { --cn-stat-icon: url("../cinnova/icons/hourglass.svg"); }

/* Table row actions (view_emp / view_holiday / view_admin_granted_leave): icon-only links */
.cn-row-actions { white-space: nowrap; }
.cn-row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--cn-radius-pill);
  color: var(--cn-text-muted);
  text-decoration: none;
}
.cn-row-action + .cn-row-action { margin-left: 2px; }
.cn-row-action .cn-icon { width: 18px; height: 18px; }
.cn-row-action:hover { background: var(--cn-primary-tint); color: var(--cn-primary-strong); }
.cn-row-action.is-danger:hover { background: var(--cn-danger-bg); color: var(--cn-danger-fg); }
.cn-multiselect .btn-block .cn-icon,
.btn .cn-icon { width: 16px; height: 16px; vertical-align: -0.2em; }

/* .cn-form-table on the small admin forms (holiday / work schedule / admin-granted leave):
   no row rules, and the gijgo timepicker's clock addon sits beside its input. */
.cn-form-table > tbody > tr > td { border-bottom-width: 0; box-shadow: none; padding-left: 0; padding-right: 0; }
.cn-form-table .input-group:has(> .input-group-addon) {
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  max-width: 440px;
}
.cn-form-table .input-group:has(> .input-group-addon) > .form-control {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: var(--cn-radius-pill) !important;
}
.cn-form-table .input-group-addon { display: inline-flex; color: var(--cn-text-muted); cursor: pointer; }

/* Monthly Attendance Sheet (monthly_attendance_sheet.php): employee x day grid.
   Colors come from tokens.css status pairs, so dark mode follows automatically. */
.mas-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 0.875rem; color: var(--cn-text-muted); }
.mas-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.mas-scroll { max-height: 75vh; }
.mas-table { border-collapse: separate; border-spacing: 0; font-size: 0.8125rem; }
.mas-table > :not(caption) > * > * { padding: 6px 4px; border-bottom: 1px solid var(--cn-row-line); }
.mas-table thead th { position: sticky; top: 0; z-index: 2; background: var(--cn-surface); white-space: nowrap; }
.mas-table th.mas-day, .mas-table td.mas-day,
.mas-table th.mas-total, .mas-table td.mas-total { text-align: center; min-width: 36px; }
.mas-table th.mas-day { font-size: 0.6875rem; line-height: 1.2; color: var(--cn-text-muted); }
.mas-table .mas-weekend { background: var(--cn-neutral-bg); }
.mas-table th.mas-total { color: var(--cn-text-strong); }
.mas-table td.mas-total { font-weight: 600; }
/* Sticky employee column so names stay visible while scrolling the days. */
.mas-table .mas-emp { position: sticky; left: 0; z-index: 1; background: var(--cn-surface); min-width: 210px; max-width: 260px; }
.mas-table thead th.mas-emp { z-index: 3; }
.mas-person { display: flex; align-items: center; gap: 8px; }
.mas-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: 0 0 32px; }
.mas-initials { display: inline-flex; align-items: center; justify-content: center; background: var(--cn-primary-tint); color: var(--cn-primary-strong); font-size: 0.75rem; font-weight: 600; }
.mas-name { font-weight: 600; color: var(--cn-text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mas-desig { font-size: 0.75rem; color: var(--cn-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mas-cell { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; }
.mas-cell .cn-icon { width: 14px; height: 14px; }
.mas-present { background: var(--cn-success-bg); color: var(--cn-success-fg); }
.mas-absent  { background: var(--cn-danger-bg);  color: var(--cn-danger-fg); }
.mas-holiday { background: var(--cn-warning-bg); color: var(--cn-warning-fg); }
.mas-leave   { background: var(--cn-primary-tint); color: var(--cn-primary-strong); }
.mas-wfh     { background: var(--cn-neutral-bg); color: var(--cn-primary); border: 1px solid var(--cn-primary-tint-2); }
.mas-halfday { background: var(--cn-warning-bg); color: var(--cn-time-late); }
.mas-off     { color: var(--cn-text-muted); }
@media (max-width: 575.98px) {
  .mas-table .mas-emp { min-width: 150px; max-width: 170px; }
  .mas-avatar { display: none; }
}
