/* ==========================================================================
   RydNxt Enterprise HRMS - Core Design System & Styling
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.1);
  --accent: #06b6d4;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #6366f1;

  /* Theme: Dark (Default Modern Enterprise) */
  --bg-main: #0b0f19;
  --bg-surface: #111827;
  --bg-card: #1f2937;
  --bg-card-hover: #263345;
  --border-color: #374151;
  --border-light: #2d3748;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.25);

  --sidebar-width: 260px;
  --header-height: 70px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-main: #f3f4f6;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f9fafb;
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;
  --text-main: #111827;
  --text-muted: #4b5563;
  --text-dim: #9ca3af;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 15px rgba(37, 99, 235, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==========================================================================
   Layout Architecture
   ========================================================================== */

.hrms-app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.hrms-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: #fff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-info span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 10px 14px 4px 14px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-light);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  border-color: rgba(37, 99, 235, 0.3);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
}

.user-snippet {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 0.95rem;
}

.user-meta {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Main Content Area */
.hrms-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Header */
.hrms-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-title-box h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-title-box p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.punch-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

/* Page Containers */
.hrms-content {
  padding: 28px;
  flex: 1;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ==========================================================================
   Components: Stats Cards & Widgets
   ========================================================================== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.metric-card.success::before { background: var(--success); }
.metric-card.warning::before { background: var(--warning); }
.metric-card.info::before { background: var(--accent); }
.metric-card.purple::before { background: #8b5cf6; }

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-light);
}

.metric-info h3 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -1px;
}

.metric-sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.metric-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-card.success .metric-icon-wrap { background: var(--success-bg); color: var(--success); }
.metric-card.warning .metric-icon-wrap { background: var(--warning-bg); color: var(--warning); }
.metric-card.info .metric-icon-wrap { background: rgba(6, 182, 212, 0.12); color: var(--accent); }
.metric-card.purple .metric-icon-wrap { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }

/* Quick Action / Punch Banner */
.punch-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(6, 182, 212, 0.1));
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.punch-text h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.punch-text p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.punch-timer {
  font-size: 1.35rem;
  font-weight: 700;
  font-family: monospace;
  color: var(--accent);
}

.punch-cta-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #059669; }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

/* ==========================================================================
   Data Tables & Filter Bars
   ========================================================================== */

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 28px;
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  min-width: 240px;
}

.search-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-dim);
}

.search-input-wrap input {
  padding-left: 36px;
}

.form-control, select.form-control {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: rgba(0, 0, 0, 0.15);
  padding: 12px 18px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--bg-card-hover);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: rgba(6, 182, 212, 0.12); color: var(--accent); }
.badge-secondary { background: rgba(156, 163, 175, 0.15); color: var(--text-muted); }

/* ==========================================================================
   Modals & Drawers
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.25s ease;
  overflow: hidden;
}

.modal-backdrop.show .modal-box {
  transform: translateY(0);
}

.modal-box.modal-lg {
  max-width: 900px;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.25rem;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.1);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid.full {
  grid-template-columns: 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.col-span-2 {
  grid-column: span 2;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==========================================================================
   OFFER LETTER & FNF DOCUMENT GENERATOR (A4 PRINT & PREVIEW)
   ========================================================================== */

.letter-generator-wrap {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 28px;
}

.letter-controls-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  height: fit-content;
}

.letter-preview-card {
  background: #334155;
  padding: 30px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: auto;
}

.preview-toolbar {
  width: 100%;
  max-width: 800px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* A4 Sheet Simulator */
.a4-sheet {
  width: 794px; /* Standard A4 at 96 DPI */
  min-height: 1123px;
  background: #ffffff;
  color: #1e293b;
  padding: 55px 60px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-family: 'Times New Roman', Times, serif, 'Inter';
  line-height: 1.6;
  position: relative;
  box-sizing: border-box;
}

/* Corporate Letterhead */
.letterhead-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 18px;
  margin-bottom: 24px;
}

.letterhead-brand h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.letterhead-brand p {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 500;
}

.letterhead-contact {
  text-align: right;
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.4;
}

.letterhead-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 22px;
  font-weight: 600;
  color: #334155;
}

.letter-title {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
  text-decoration: underline;
  margin-bottom: 24px;
  color: #0f172a;
  letter-spacing: 0.5px;
}

.letter-salutation {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.letter-body {
  font-size: 0.95rem;
  color: #1e293b;
  margin-bottom: 20px;
  text-align: justify;
}

.letter-salary-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 0.88rem;
}

.letter-salary-table th {
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
  text-align: left;
}

.letter-salary-table td {
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
  color: #334155;
}

.letter-salary-table .total-row td {
  font-weight: 700;
  background: #f8fafc;
  color: #0f172a;
}

.clearance-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.85rem;
}

.clearance-table th, .clearance-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
}

.letter-sign-block {
  display: flex;
  justify-content: space-between;
  margin-top: 45px;
  page-break-inside: avoid;
}

.signature-box {
  width: 220px;
}

.signature-line {
  border-top: 1px solid #334155;
  margin-top: 40px;
  padding-top: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
}

.signature-sub {
  font-size: 0.78rem;
  color: #64748b;
}

/* ==========================================================================
   Print Rules
   ========================================================================== */

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
  }

  .hrms-sidebar,
  .hrms-header,
  .letter-controls-card,
  .preview-toolbar,
  .btn,
  .modal-backdrop,
  .toast-container {
    display: none !important;
  }

  .hrms-main {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .hrms-content {
    padding: 0 !important;
  }

  .letter-generator-wrap {
    display: block !important;
  }

  .letter-preview-card {
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  .a4-sheet {
    box-shadow: none !important;
    width: 100% !important;
    min-height: auto !important;
    padding: 20mm !important;
    margin: 0 !important;
  }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .hrms-sidebar {
    transform: translateX(-100%);
  }
  .hrms-sidebar.open {
    transform: translateX(0);
  }
  .hrms-main {
    margin-left: 0;
  }
  .letter-generator-wrap {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================================
   HRMS DEDICATED LOGIN SCREEN STYLING
   ========================================================================== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 20%, rgba(37, 99, 235, 0.15) 0%, rgba(11, 15, 25, 1) 70%);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-header .brand-logo-icon {
  margin: 0 auto 14px auto;
  width: 52px;
  height: 52px;
  font-size: 1.6rem;
}

.login-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.login-error-alert {
  display: none;
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 18px;
}

.password-input-wrap {
  position: relative;
}

.password-toggle-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px;
}

.password-toggle-btn:hover {
  color: var(--text-main);
}

/* ==========================================================================
   ROLE BASED PORTAL & MOBILE NAVIGATION STYLES
   ========================================================================== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 998;
}

.sidebar-backdrop.show {
  display: block;
}

.mobile-menu-btn {
  display: none;
}

@media (max-width: 1024px) {
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex-shrink: 0;
  }
  .mobile-menu-btn:hover {
    background: var(--bg-surface);
  }
}

/* Role-based UI visibility */
.hrms-app.role-employee .nav-admin-only,
.hrms-app.role-employee .admin-only {
  display: none !important;
}

.hrms-app.role-admin .employee-only {
  display: none !important;
}

.user-role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 2px;
}

.user-role-badge.badge-role-admin { background: rgba(37, 99, 235, 0.2); color: #60a5fa; }
.user-role-badge.badge-role-manager { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.user-role-badge.badge-role-employee { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.user-role-badge.badge-role-fleet { background: rgba(168, 85, 247, 0.2); color: #c084fc; }

/* Employee Self-Service Dashboard Banner */
.ess-welcome-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(13, 148, 136, 0.15) 100%);
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.ess-welcome-title h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.ess-welcome-title p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.ess-quick-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ess-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 30px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   PAYSLIP MODAL & PRINT STYLING
   ========================================================================== */
.payslip-sheet {
  background: #ffffff;
  color: #0f172a;
  border-radius: var(--radius-md);
  padding: 28px 32px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 'Inter', sans-serif;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  max-width: 780px;
  margin: 0 auto;
}

.payslip-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #0284c7;
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.payslip-logo-title h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0369a1;
  margin: 0 0 2px 0;
  letter-spacing: -0.5px;
}

.payslip-logo-title p {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
}

.payslip-badge-month {
  text-align: right;
}

.payslip-badge-month .month-tag {
  background: #e0f2fe;
  color: #0284c7;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 4px;
}

.payslip-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 22px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.84rem;
}

.payslip-info-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed #e2e8f0;
  padding-bottom: 4px;
}

.payslip-info-row span.label {
  color: #64748b;
  font-weight: 500;
}

.payslip-info-row span.val {
  color: #0f172a;
  font-weight: 600;
}

.payslip-breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.breakdown-box {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}

.breakdown-box-header {
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.breakdown-box.earnings .breakdown-box-header {
  background: #f0fdf4;
  color: #166534;
  border-bottom: 1px solid #bbf7d0;
}

.breakdown-box.deductions .breakdown-box-header {
  background: #fef2f2;
  color: #991b1b;
  border-bottom: 1px solid #fecaca;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.breakdown-table td {
  padding: 7px 12px;
  border-bottom: 1px solid #f1f5f9;
}

.breakdown-table tr.total-row td {
  font-weight: 700;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.payslip-net-box {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-radius: 6px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.payslip-net-box .net-label {
  font-size: 0.92rem;
  font-weight: 600;
}

.payslip-net-box .net-amount {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.payslip-net-words {
  font-size: 0.82rem;
  color: #64748b;
  font-style: italic;
  margin-top: -10px;
  margin-bottom: 18px;
  padding-left: 4px;
}

.payslip-footer-notes {
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 0.75rem;
  color: #64748b;
}

/* Printing rules for payslip */
@media print {
  body.printing-payslip {
    background: #ffffff !important;
  }
  body.printing-payslip .hrms-app,
  body.printing-payslip .modal-header,
  body.printing-payslip .modal-footer,
  body.printing-payslip .modal-backdrop {
    display: none !important;
  }
  body.printing-payslip #payslipModal {
    display: block !important;
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
  }
  body.printing-payslip #payslipModal .modal-box {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    padding: 0 !important;
    background: transparent !important;
  }
  body.printing-payslip .payslip-sheet {
    box-shadow: none !important;
    padding: 8mm 12mm !important;
    max-width: 100% !important;
  }
}

