/* ═══════════════════════════════════════════════════════════════════
   Rise Portal design system — 2026 refresh
   Warm cream canvas, ink-black surfaces, acid-lime accent, pill
   buttons, generous radii. Inspired by modern fintech SaaS (ruul.io).
   All selector hooks from the legacy stylesheet are preserved so the
   ~90 templates restyle without markup changes.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --sidebar-w:   248px;
  --topbar-h:    68px;

  /* palette */
  --canvas:      #f2efe9;   /* warm cream page background */
  --ink:         #16150f;   /* near-black, warm */
  --ink-soft:    #22211a;
  --card-bg:     #fffdf9;
  --border:      #e4dfd3;
  --text:        #1d1c15;
  --muted:       #777161;
  --accent:      #cdef4a;   /* acid lime */
  --accent-ink:  #1d2205;
  --accent-soft: #f2f9d8;

  /* status hues (warm-tuned) */
  --primary:     #2f2c22;   /* legacy var used widely — now ink */
  --success:     #3d8a4e;
  --warning:     #c07f14;
  --danger:      #cc4433;

  --sidebar-bg:  var(--ink);
  --sidebar-txt: #9d998c;
  --sidebar-act: var(--accent);

  --radius-card: 18px;
  --radius-ctl:  12px;
  --shadow-card: 0 1px 2px rgba(30, 26, 12, 0.05), 0 8px 24px -18px rgba(30, 26, 12, 0.25);
}

/* ── Reset / Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  background: var(--canvas);
  color: var(--text);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .stat-value, .sidebar-brand {
  font-family: 'Sora', 'Instrument Sans', 'Segoe UI', sans-serif;
  letter-spacing: -0.02em;
}

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

/* ── Sidebar (ink panel) ────────────────────────────────────────── */
.sidebar i { color: #fff !important; }
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 24px;
  color: #fff;
  font-size: 1.08rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand i { color: var(--accent) !important; }

.sidebar-menu {
  list-style: none;
  padding: 10px 10px 16px;
  margin: 0;
  flex: 1;
}
.menu-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: 14px 14px 6px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  color: var(--sidebar-txt);
  text-decoration: none;
  font-size: 0.88rem;
  border-radius: 10px;
  transition: all .18s;
}
.menu-item i { width: 18px; text-align: center; font-size: 0.9rem; }
.menu-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.menu-item.active { background: rgba(205,239,74,0.14); color: #fff; }

.cat-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  color: rgba(255,255,255,0.45);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .2s, background .2s;
  gap: 8px;
}
.cat-toggle:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.04); }
.cat-toggle.has-active { color: rgba(255,255,255,0.85); }
.cat-icon { width:16px; text-align:center; font-size:.8rem; }
.cat-label { flex:1; text-align:left; }
.cat-chevron { font-size: 0.6rem; transition: transform .25s; }
.cat-toggle[aria-expanded="true"] .cat-chevron { transform: rotate(90deg); }
.cat-toggle[aria-expanded="true"] { color: rgba(255,255,255,0.85); }

.sub-menu { list-style: none; padding: 0 0 2px; margin: 0; }
.sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 30px;
  color: var(--sidebar-txt);
  text-decoration: none;
  font-size: 0.86rem;
  border-radius: 10px;
  transition: all .18s;
}
.sub-item i { width:16px; text-align:center; font-size:0.82rem; }
.sub-item:hover { background: rgba(255,255,255,0.06); color:#fff; }
.sub-item.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.sub-item.active i { color: var(--accent-ink) !important; }

.sidebar-direct-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  color: var(--sidebar-txt);
  text-decoration: none;
  font-size: 0.88rem;
  border-radius: 10px;
  transition: all .18s;
}
.sidebar-direct-link i { width:16px; text-align:center; font-size:0.88rem; }
.sidebar-direct-link:hover { background: rgba(255,255,255,0.06); color:#fff; }
.sidebar-direct-link.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.sidebar-direct-link.active i { color: var(--accent-ink) !important; }

.sidebar-divider { border-top: 1px solid rgba(255,255,255,0.08); margin: 8px 4px; }

/* ── Main wrap / topbar / content ───────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--topbar-h);
  background: rgba(242, 239, 233, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.content-area { padding: 32px; flex: 1; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 16px 22px;
  font-size: 0.92rem;
  color: var(--text);
  border-top-left-radius: var(--radius-card) !important;
  border-top-right-radius: var(--radius-card) !important;
}
.card-body { padding: 22px; }
.card .table-responsive { border-radius: 0 0 var(--radius-card) var(--radius-card); }

/* ── Stat cards ─────────────────────────────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--accent-soft); color: #4a6b12; }
.stat-icon.green  { background: #e5f2e6; color: var(--success); }
.stat-icon.orange { background: #f9eed8; color: var(--warning); }
.stat-icon.purple { background: #ece8f7; color: #6a5aa8; }
.stat-value { font-size: 1.65rem; font-weight: 700; line-height: 1.05; }
.stat-label { font-size: 0.78rem; color: var(--muted); margin-top: 3px; }

/* ── Tables ─────────────────────────────────────────────────────── */
.table { --bs-table-bg: transparent; }
.emp-table thead th, .table thead th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  background: #efece2;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.emp-table tbody td {
  padding: 11px 14px;
  vertical-align: middle;
  border-bottom: 1px solid #efece4;
}
.emp-table tbody tr:last-child td { border-bottom: none; }
.emp-table tbody tr:hover, .table-hover tbody tr:hover { background: #faf8f1; }

.emp-thumb {
  width: 36px; height: 36px;
  border-radius: 12px;
  object-fit: cover;
}
.emp-avatar {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.id-badge {
  font-family: 'Consolas', monospace;
  font-size: 0.8rem;
  background: #eeeadd;
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--ink-soft);
}

.status-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 999px;
  letter-spacing: .02em;
}
.status-active        { background: var(--accent); color: var(--accent-ink); }
.status-inactive      { background: #e9e5da; color: #6d6759; }
.status-resigned      { background: #f6ddd8; color: #a8382c; }
.status-awol          { background: #f6e8c8; color: #8f6410; }
.status-probationary  { background: #e3ecd2; color: #4a6b12; }

/* ── Profile / details ──────────────────────────────────────────── */
.profile-photo {
  width: 120px; height: 120px;
  border-radius: 24px;
  object-fit: cover;
  border: 3px solid var(--card-bg);
  box-shadow: var(--shadow-card);
}
.profile-avatar {
  width: 120px; height: 120px;
  border-radius: 24px;
  background: var(--ink);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem;
  font-weight: 700;
}
.detail-table { width: 100%; }
.detail-table th, .detail-table td {
  padding: 9px 4px;
  border-bottom: 1px solid #efece4;
  font-size: 0.9rem;
}
.detail-table th {
  color: var(--muted);
  font-weight: 600;
  width: 42%;
}
.detail-table tr:last-child th,
.detail-table tr:last-child td { border-bottom: none; }

.leave-box {
  background: #f7f4ec;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
}
.leave-num   { font-size: 1.4rem; font-weight: 700; color: var(--ink); }
.leave-label { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

.photo-preview {
  width: 110px; height: 110px;
  border-radius: 20px;
  object-fit: cover;
}
.photo-placeholder {
  width: 110px; height: 110px;
  border-radius: 20px;
  background: #eeeadd;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
}

/* ── Forms ──────────────────────────────────────────────────────── */
.form-control, .form-select {
  border-radius: var(--radius-ctl);
  border: 1px solid var(--border);
  background-color: #fffdf9;
  font-size: 0.9rem;
  color: var(--text);
  padding: 8px 13px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(205,239,74,0.45);
  background-color: #fff;
}
.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.input-group-text {
  border-radius: var(--radius-ctl);
  border: 1px solid var(--border);
  background: #efece2;
  color: var(--muted);
}

/* ── Buttons (pills) ────────────────────────────────────────────── */
.btn {
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 7px 18px;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-sm { padding: 4px 13px; font-size: 0.8rem; }
.btn-lg { padding: 11px 26px; }

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
  background: #000;
  border-color: #000;
  color: var(--accent);
}
.btn-outline-primary {
  color: var(--ink);
  border-color: var(--ink);
}
.btn-outline-primary:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--accent);
}
.btn-success { background: #2e7a3f; border-color: #2e7a3f; }
.btn-success:hover { background: #256633; border-color: #256633; }
.btn-outline-success { color: #2e7a3f; border-color: #2e7a3f; }
.btn-outline-success:hover { background: #2e7a3f; border-color: #2e7a3f; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-outline-danger { color: var(--danger); border-color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); border-color: var(--danger); }
.btn-outline-secondary { color: var(--muted); border-color: var(--border); }
.btn-outline-secondary:hover { background: #eeeadd; border-color: var(--border); color: var(--ink); }
.btn-warning { background: #e9b949; border-color: #e9b949; color: #3d2e05; }
.btn-accent, .btn-lime {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-accent:hover, .btn-lime:hover { background: #bfe23a; border-color: #bfe23a; color: var(--accent-ink); }

/* ── Badges / alerts / modals / pagination ──────────────────────── */
.badge { border-radius: 999px; font-weight: 600; padding: 4px 10px; }
.alert {
  border-radius: 14px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}
.modal-content {
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: 0 24px 60px -24px rgba(30,26,12,.4);
}
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }
.page-link { color: var(--ink); border-color: var(--border); }
.page-item.active .page-link {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--accent);
}
.nav-tabs .nav-link { color: var(--muted); border: none; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active {
  color: var(--ink);
  background: transparent;
  border-bottom: 2px solid var(--ink);
  font-weight: 600;
}
.dropdown-menu {
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

/* ── Leave badges ───────────────────────────────────────────────── */
.leave-type-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 999px;
}
.leave-vacation-leave     { background: #dcebf5; color: #23617f; }
.leave-sick-leave         { background: #f6dde6; color: #97335c; }
.leave-mental-health-leave{ background: #e6e0f5; color: #584397; }

.balance-strip {
  display: flex;
  gap: 12px;
  background: #f7f4ec;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
}
.balance-item  { text-align: center; flex: 1; }
.balance-num   { font-size: 1.4rem; font-weight: 700; color: var(--ink); }
.balance-lbl   { font-size: 0.72rem; color: var(--muted); }

/* ── Printable cards ────────────────────────────────────────────── */
.doc-card { transition: box-shadow .2s, transform .2s; }
.doc-card:hover { box-shadow: 0 10px 28px -14px rgba(30,26,12,0.35); transform: translateY(-2px); }
.doc-icon {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: #eeeadd;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.cat-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: #4a6b12;
  padding: 1px 9px;
  border-radius: 999px;
  margin-top: 2px;
}
.current-file-badge {
  background: #eeeadd;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Timesheet table ────────────────────────────────────────────── */
.ts-table thead th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  background: #efece2;
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.ts-table tbody td {
  padding: 4px 5px;
  vertical-align: middle;
  border-bottom: 1px solid #efece4;
}
.ts-table tbody td input,
.ts-table tbody td select {
  font-size: 0.82rem;
  padding: 3px 6px;
  height: auto;
  border-radius: 8px;
}
.ts-table tbody tr:hover { background: #faf8f1; }

/* ── Period info bar ────────────────────────────────────────────── */
.period-info {
  background: var(--accent-soft);
  color: #3c520e;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 0.85rem;
  border: 1px solid #dcebb2;
}

/* ── Claude Copilot drawer ──────────────────────────────────────── */
.copilot-fab {
  position: fixed;
  right: 26px; bottom: 26px;
  z-index: 1050;
  width: 56px; height: 56px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--accent);
  border: none;
  font-size: 1.3rem;
  box-shadow: 0 12px 30px -10px rgba(20,18,8,.55);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform .15s ease;
}
.copilot-fab:hover { transform: scale(1.06); }

.copilot-panel {
  position: fixed;
  right: 26px; bottom: 94px;
  z-index: 1050;
  width: 400px;
  max-width: calc(100vw - 52px);
  height: 540px;
  max-height: calc(100vh - 130px);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 30px 70px -25px rgba(20,18,8,.5);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.copilot-panel.open { display: flex; }
.copilot-head {
  background: var(--ink);
  color: #fff;
  padding: 14px 18px;
  display: flex; align-items: center; gap: 10px;
  font-weight: 600;
}
.copilot-head .spark { color: var(--accent); }
.copilot-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #faf8f1;
}
.copilot-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.copilot-msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.copilot-msg.assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}
.copilot-msg.thinking { color: var(--muted); font-style: italic; }
.copilot-foot {
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex;
  gap: 8px;
  background: var(--card-bg);
}
.copilot-foot textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  height: 42px;
}
.copilot-foot textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(205,239,74,.45); }
.copilot-send {
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  width: 44px;
  font-size: 1rem;
  cursor: pointer;
}
.copilot-send:disabled { opacity: .5; cursor: default; }

/* ── Scrollbars ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d6d0bf; border-radius: 999px; border: 2px solid var(--canvas); }
::-webkit-scrollbar-track { background: transparent; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .main-wrap { margin-left: 200px; }
  .content-area { padding: 16px; }
  .copilot-panel { right: 12px; }
}

/* ── Page transition ────────────────────────────────────────────── */
/* NOTE: keep transforms and filling (fill-mode) animations away from
   <body> and .main-wrap. A transform — or an animation that stays
   "applied" via fill-mode — turns the element into a stacking context
   AND the containing block for position:fixed children. Bootstrap
   modals live inside .main-wrap, so that breaks them two ways: they
   center against the page instead of the viewport, and they paint
   UNDER the .modal-backdrop (dark screen, nothing clickable).
   Therefore: opacity-only fade, no fill-mode, and the page-enter class
   is removed by JS as soon as the animation ends. */
body.page-enter { animation: pageFadeIn 0.18s ease; }
@keyframes pageFadeIn { from { opacity: 0; } to { opacity: 1; } }
body.page-leaving {
  opacity: 0;
  transition: opacity 0.12s ease;
  pointer-events: none;
}

/* ── Copy-pasteable date field with a native calendar picker ───────────
   .date-text is the visible, tab/copy-paste-reachable text field. A real
   <input type="date"> sits invisibly on top of its right edge (over the
   spot where a native date input draws its own calendar icon) so a click
   there opens the browser's actual picker without making the whole field
   a non-copy-pasteable type="date" widget. */
.date-cell-wrap { position: relative; display: flex; }
.date-cell-wrap .date-text { padding-right: 24px; width: 100%; }
.date-cell-wrap .date-pick-native {
  position: absolute;
  right: 0;
  top: 0;
  width: 22px;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
}
.date-cell-wrap::after {
  content: '\f073';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #9a9284;
  pointer-events: none;
}
