/* ═══════════════════════════════════════════════════════════════
   HRPulse — Main Stylesheet
   Eventus / PlayPulse Framework  |  v1.0
   ═══════════════════════════════════════════════════════════════ */

/* ── Imports ──────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Variables ────────────────────────────────────────────── */
:root {
  /* Brand */
  --hr-primary:     #2563eb;
  --hr-primary-dk:  #1d4ed8;
  --hr-primary-lt:  #eff6ff;
  --hr-accent:      #0ea5e9;

  /* Sidebar */
  --sidebar-bg:     #0f172a;
  --sidebar-hover:  #1e293b;
  --sidebar-active: #1e3a8a;
  --sidebar-text:   #94a3b8;
  --sidebar-active-text: #ffffff;
  --sidebar-width:  250px;
  --sidebar-collapsed: 64px;

  /* Surface */
  --bg-body:        #f1f5f9;
  --bg-card:        #ffffff;
  --bg-input:       #f8fafc;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;

  /* Borders */
  --border:         #e2e8f0;
  --border-focus:   #2563eb;

  /* Status */
  --success:        #16a34a;
  --success-bg:     #dcfce7;
  --warning:        #d97706;
  --warning-bg:     #fef3c7;
  --danger:         #dc2626;
  --danger-bg:      #fee2e2;
  --info:           #0284c7;
  --info-bg:        #e0f2fe;

  /* Topbar */
  --topbar-h:       60px;

  /* Radius / Shadow */
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
  --shadow-md:      0 4px 16px rgba(0,0,0,.10);

  /* Font */
  --font:           'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:      'Courier New', monospace;
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  height: 100%;
  display: flex;
  /* overflow-x must NOT be hidden here — it prevents all child horizontal scroll */
  overflow-x: clip; /* clip (not hidden) keeps layout stable without blocking scroll contexts */
}
a { color: var(--hr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
ul, ol { list-style: none; }

/* ══════════════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════════════ */

/* ── Sidebar ──────────────────────────────────────────────────── */
.hr-sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: width .25s ease;
  overflow: hidden;
}

/* Brand / Logo area */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  height: var(--topbar-h);
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  text-decoration: none;
}
.sidebar-brand-icon {
  width: 34px; height: 34px;
  background: var(--hr-primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-brand-text { color: #fff; font-size: 16px; font-weight: 600; white-space: nowrap; }
.sidebar-brand-text span { color: var(--hr-accent); }

/* Navigation */
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }

.nav-section-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 16px 18px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
  font-weight: 500;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--hr-accent);
  border-radius: 0 3px 3px 0;
}
.nav-item i { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item .nav-label { flex: 1; }
.nav-badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px; font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px; text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--hr-primary);
  color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-name  { color: #fff; font-size: 13px; font-weight: 500; }
.sidebar-user-role  { color: var(--sidebar-text); font-size: 11px; }

/* ── Main content area ────────────────────────────────────────── */
.hr-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;          /* critical: flex child must not overflow its parent */
  overflow-x: hidden;    /* clip at main wrapper level, not body */
  transition: margin-left .25s ease;
}

/* ── Topbar ───────────────────────────────────────────────────── */
.hr-topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-toggle {
  width: 36px; height: 36px;
  border: none; background: none; cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.topbar-toggle:hover { background: var(--bg-body); color: var(--text-primary); }

.topbar-title { font-size: 15px; font-weight: 600; color: var(--text-primary); flex: 1; }
.topbar-right  { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: none; cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 16px;
  transition: background .15s, border-color .15s;
  position: relative;
}
.topbar-btn:hover { background: var(--bg-body); border-color: var(--text-muted); color: var(--text-primary); }
.topbar-btn .notif-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger);
  position: absolute; top: 6px; right: 6px;
  border: 1.5px solid var(--bg-card);
}

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  background: none;
  transition: background .15s;
  position: relative;
}
.topbar-user:hover { background: var(--bg-body); }
.topbar-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--hr-primary);
  color: #fff; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

/* User dropdown */
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 190px;
  display: none; z-index: 300;
}
.user-dropdown.open { display: block; }
.user-dropdown-header { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.user-dropdown-header .name { font-weight: 600; font-size: 13px; }
.user-dropdown-header .email { font-size: 11px; color: var(--text-muted); }
.user-dropdown a {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; font-size: 13px; color: var(--text-primary);
  text-decoration: none; transition: background .1s;
}
.user-dropdown a:hover { background: var(--bg-body); }
.user-dropdown a i { width: 16px; color: var(--text-secondary); }
.user-dropdown .sep { height: 1px; background: var(--border); margin: 4px 0; }
.user-dropdown .logout-link { color: var(--danger); }
.user-dropdown .logout-link i { color: var(--danger); }

/* ── Page content ─────────────────────────────────────────────── */
.hr-content { flex: 1; padding: 24px; min-width: 0; overflow-x: visible; }
.page-header { margin-bottom: 20px; }
.page-title  { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.breadcrumb a { color: var(--hr-primary); }
.breadcrumb .sep { color: var(--border); }

/* ══════════════════════════════════════════════════════════════
   COMPONENTS
   ══════════════════════════════════════════════════════════════ */

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.card-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Stat cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex; align-items: flex-start; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.blue   { background: #eff6ff; color: var(--hr-primary); }
.stat-icon.green  { background: #dcfce7; color: var(--success); }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.red    { background: #fee2e2; color: var(--danger); }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon.teal   { background: #f0fdfa; color: #0d9488; }
.stat-num   { font-size: 24px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.stat-delta { font-size: 11px; margin-top: 6px; }
.stat-delta.up   { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ── Grid helpers ─────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* ── Auto-injected table search bar ─────────────────────────────────────── */
.hr-table-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.hr-table-search-bar input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
  font-family: var(--font);
  padding: 0;
  min-width: 0;
}
.hr-table-search-bar input::placeholder { color: var(--text-muted); }

/* When search bar is present, table-wrap loses its top radius (JS sets this inline too) */
.hr-table-search-bar + .table-wrap,
.hr-table-search-bar + [style*="overflow-x:auto"] {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}


/*
  Root cause of overflow: CSS grid/flex cells have min-width:auto by default.
  This lets table content push cells wider than their track, defeating overflow-x:auto.
  Fix: force min-width:0 on ALL direct children of grid/flex containers.
*/

/* Grid/flex children: prevent content from pushing cell wider than its track */
/* This is the CSS Grid min-width:auto problem — children must be min-width:0 */
[style*="display:grid"] > *   { min-width: 0; overflow: hidden; }
[style*="display: grid"] > *  { min-width: 0; overflow: hidden; }

/* Step 3: Proper scroll container */
.table-wrap {
  display: block;
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  scrollbar-width: auto;
  scrollbar-color: #94a3b8 #f1f5f9;
}
.table-wrap::-webkit-scrollbar        { height: 7px; display: block; }
.table-wrap::-webkit-scrollbar-track  { background: #f1f5f9; }
.table-wrap::-webkit-scrollbar-thumb  { background: #94a3b8; border-radius: 4px; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: #475569; }

/* When table-wrap is a direct child of .card with padding:0, clean up borders */
.card > .table-wrap {
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.hr-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--bg-card);
}
.hr-table thead th {
  background: #f8fafc; padding: 10px 14px;
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: .04em; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.hr-table tbody td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.hr-table tbody tr:last-child td { border-bottom: none; }
.hr-table tbody tr:hover td { background: #fafbff; }

/* ── Badges / Pills ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: #166534; }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-danger  { background: var(--danger-bg);  color: #991b1b; }
.badge-info    { background: var(--info-bg);    color: #075985; }
.badge-blue    { background: #eff6ff; color: #1d4ed8; }
.badge-purple  { background: #f5f3ff; color: #5b21b6; }
.badge-gray    { background: #f1f5f9; color: #475569; }
.badge-orange  { background: #fff7ed; color: #c2410c; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--hr-primary); color: #fff; border-color: var(--hr-primary); }
.btn-primary:hover { background: var(--hr-primary-dk); border-color: var(--hr-primary-dk); color: #fff; }
.btn-outline { background: none; color: var(--text-primary); border-color: var(--border); }
.btn-outline:hover { background: var(--bg-body); }
.btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 5px;
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: #fff;
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Alerts ───────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-md);
  font-size: 13px; line-height: 1.5; margin-bottom: 16px;
}
.alert i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-bg); color: #166534; border: 1px solid #86efac; }
.alert-warning { background: var(--warning-bg); color: #92400e; border: 1px solid #fcd34d; }
.alert-danger  { background: var(--danger-bg);  color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: var(--info-bg);    color: #075985; border: 1px solid #7dd3fc; }

/* ── Avatar ───────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--hr-primary); color: #fff;
  font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
  padding: 48px 24px; text-align: center; color: var(--text-muted);
}
.empty-state i   { font-size: 40px; opacity: .35; margin-bottom: 12px; display: block; }
.empty-state p   { font-size: 13px; }

/* ── Loading spinner ──────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--hr-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh; width: 100%;
  display: flex; align-items: center; justify-content: center;
  background: #0f172a;
  position: relative; overflow: hidden;
}
.login-bg-glow {
  position: absolute;
  width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.18) 0%, transparent 70%);
  top: -150px; left: -100px; pointer-events: none;
}
.login-bg-glow-2 {
  position: absolute;
  width: 400px; height: 400px; border-radius: 50%;
  background: radial-gradient(circle, rgba(14,165,233,.12) 0%, transparent 70%);
  bottom: -100px; right: -100px; pointer-events: none;
}
.login-box {
  background: #1e293b;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%; max-width: 420px;
  position: relative; z-index: 1;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 30px;
}
.login-logo-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--hr-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff;
}
.login-logo-text { color: #fff; font-size: 20px; font-weight: 700; }
.login-logo-text span { color: var(--hr-accent); }
.login-tagline { font-size: 11px; color: rgba(255,255,255,.35); margin-top: 2px; }
.login-title  { color: #fff; font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.login-sub    { color: rgba(255,255,255,.45); font-size: 13px; margin-bottom: 28px; }

.login-box .form-label  { color: rgba(255,255,255,.55); }
.login-box .form-control {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.1);
  color: #fff;
}
.login-box .form-control:focus {
  border-color: var(--hr-primary);
  background: rgba(255,255,255,.08);
  box-shadow: 0 0 0 3px rgba(37,99,235,.2);
}
.login-box .form-control::placeholder { color: rgba(255,255,255,.25); }
.login-box .btn-primary { width: 100%; justify-content: center; padding: 10px; font-size: 14px; }

.login-footer {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: rgba(255,255,255,.25);
}

/* ══════════════════════════════════════════════════════════════
   LICENSE POPUP / RENEWAL MODAL
   ══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 30px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
  width: 100%; max-width: 480px;
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(.95) translateY(10px);
  transition: transform .2s;
  margin: auto 0;
  position: relative;
}
.modal-overlay.open .modal-box { transform: scale(1) translateY(0); }

/* ── KEY FIX: form inside modal-box must be a flex child too ── */
/* When <form> wraps modal-body + modal-footer it must inherit flex layout */
.modal-box > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;           /* critical: allows flex child to shrink below content size */
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 14px;
  flex-shrink: 0;
}
.modal-header-icon {
  width: 46px; height: 46px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.modal-header-icon.warn   { background: #fef3c7; color: #d97706; }
.modal-header-icon.danger { background: #fee2e2; color: var(--danger); }
.modal-title    { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.modal-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }

.modal-body {
  padding: 20px 24px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;           /* critical: allows this flex child to shrink and scroll */
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.modal-body::-webkit-scrollbar        { width: 6px; }
.modal-body::-webkit-scrollbar-track  { background: #f1f5f9; border-radius: 3px; }
.modal-body::-webkit-scrollbar-thumb  { background: #94a3b8; border-radius: 3px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: #64748b; }

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  flex-shrink: 0;
  background: var(--bg-card);
}

/* License info grid inside modal */
.lic-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.lic-info-item { background: var(--bg-body); border-radius: var(--radius-sm); padding: 10px 12px; }
.lic-info-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.lic-info-value { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-top: 2px; }
.lic-info-value.danger { color: var(--danger); }
.lic-info-value.warning { color: var(--warning); }

/* License warning bar (persistent, inside topbar area) */
.license-warn-bar {
  background: var(--warning-bg);
  border-bottom: 1px solid #fcd34d;
  padding: 7px 24px;
  font-size: 12px; color: #92400e;
  display: flex; align-items: center; gap: 8px;
}
.license-warn-bar i { color: #d97706; }
.license-warn-bar a { color: #92400e; font-weight: 600; text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════════════════ */
.flex           { display: flex; }
.flex-center    { display: flex; align-items: center; justify-content: center; }
.flex-between   { display: flex; align-items: center; justify-content: space-between; }
.flex-col       { display: flex; flex-direction: column; }
.gap-4          { gap: 4px; }
.gap-8          { gap: 8px; }
.gap-12         { gap: 12px; }
.gap-16         { gap: 16px; }
.gap-24         { gap: 24px; }
.items-center   { align-items: center; }
.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted   { color: var(--text-secondary); }
.text-sm      { font-size: 12px; }
.text-xs      { font-size: 11px; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.font-600     { font-weight: 600; }
.font-700     { font-weight: 700; }
.w-full       { width: 100%; }
.d-none       { display: none; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Pagination */
.pagination { display: flex; gap: 4px; align-items: center; }
.page-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card);
  font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all .15s;
}
.page-btn:hover   { border-color: var(--hr-primary); color: var(--hr-primary); }
.page-btn.active  { background: var(--hr-primary); border-color: var(--hr-primary); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .hr-sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .hr-sidebar.open { transform: translateX(0); }
  .hr-main { margin-left: 0; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .hr-content { padding: 14px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .login-box { padding: 28px 20px; }
}

/* Sidebar overlay on mobile */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 199;
}
@media (max-width: 900px) {
  .sidebar-backdrop.open { display: block; }
}
