@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Color Palette */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;

  --success: #10b981;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;

  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;

  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;

  --info: #0ea5e9;
  --info-light: #f0f9ff;
  --info-border: #bae6fd;
  --info-text: #0369a1;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Top Bar */
.app-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.logo-badge {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.logo-text h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.2;
}

.logo-text span {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #2563eb;
  letter-spacing: 0.05em;
}

/* Nav Links */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  transition: all 0.15s ease-in-out;
}

.nav-link-btn:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

.nav-link-btn.active {
  color: var(--primary);
  background-color: var(--primary-light);
  font-weight: 700;
}

/* Header Utilities */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tenant-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: #334155;
}

.role-switcher-form {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.role-select {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1.5px solid var(--primary-border);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--primary);
  cursor: pointer;
  outline: none;
}

.mobile-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-main);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}

/* Alerts */
.alert-box {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  animation: fadeIn 0.25s ease-out;
}

.alert-success { background: var(--success-light); border: 1px solid var(--success-border); color: var(--success-text); }
.alert-error { background: var(--danger-light); border: 1px solid var(--danger-border); color: var(--danger-text); }
.alert-warning { background: var(--warning-light); border: 1px solid var(--warning-border); color: var(--warning-text); }

/* Common Card Styles */
.card-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.card-header-bar {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: #ffffff;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.card-body-content {
  padding: 1.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }

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

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

.btn-secondary { background: #f1f5f9; border-color: var(--border-color); color: var(--text-main); }
.btn-secondary:hover { background: #e2e8f0; }

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

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.775rem; }
.btn-lg { padding: 0.75rem 1.4rem; font-size: 0.95rem; border-radius: var(--radius-md); }
.btn-block { width: 100%; display: flex; }

/* Form Controls & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.15rem;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 700;
  color: #334155;
  display: block;
}

.form-control,
.form-select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: #0f172a;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.15s ease-in-out;
  line-height: 1.5;
  box-sizing: border-box;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background-color: #ffffff;
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-control:read-only,
.form-control:disabled {
  background-color: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
  border-color: #e2e8f0;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-draft { background: #f1f5f9; color: #475569; }
.badge-calculated { background: #fef3c7; color: #b45309; }
.badge-submitted { background: #e0e7ff; color: #4338ca; }
.badge-approved { background: #dbeafe; color: #1e40af; }
.badge-finalized { background: #d1fae5; color: #065f46; }
.badge-paid { background: #ccfbf1; color: #0f766e; }
.badge-reversed { background: #fee2e2; color: #b91c1c; }
.badge-active { background: #dcfce7; color: #15803d; }

/* Responsive Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.custom-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.custom-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: #1e293b;
  vertical-align: middle;
}

.custom-table tr:hover td {
  background: #f8fafc;
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 0.775rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: #0f172a;
  margin-top: 0.35rem;
  letter-spacing: -0.02em;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Form Controls */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.form-control, .form-select {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ========================================================================= */
/* REQUIREMENTS PAGE DEDICATED RESPONSIVE ARCHITECTURE (TABS & MOBILE)       */
/* ========================================================================= */

.req-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.req-header-banner {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  padding: 2rem 2.25rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.req-header-banner::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.3) 0%, rgba(37, 99, 235, 0) 70%);
  pointer-events: none;
}

.req-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.req-badge {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.req-badge-green { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.4); }
.req-badge-blue { background: rgba(59, 130, 246, 0.25); color: #93c5fd; border-color: rgba(59, 130, 246, 0.4); }

.req-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.req-subtitle {
  font-size: 0.95rem;
  color: #94a3b8;
  max-width: 850px;
  line-height: 1.6;
}

/* Device View Switcher Toolbar (Testing Responsive Adjustments) */
.device-tester-bar {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.device-tester-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.device-buttons {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #f1f5f9;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}

.device-btn {
  background: transparent;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.device-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Responsive Requirements Layout */
.req-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Sidebar Navigation Tabs */
.req-sidebar-tabs {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

.req-tab-heading {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  padding: 0.5rem 0.75rem 0.35rem;
}

.req-tab-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #475569;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.3;
}

.req-tab-link:hover {
  background: #f8fafc;
  color: var(--primary);
}

.req-tab-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.req-tab-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Requirements Content Sections */
.req-content-pane {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.req-section-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: none; /* Controlled by tab activation */
  animation: fadeIn 0.2s ease-in-out;
}

.req-section-card.active {
  display: block;
}

.req-section-header {
  padding: 1.25rem 1.75rem;
  background: #fafafa;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.req-section-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}

.req-section-body {
  padding: 1.75rem;
  font-size: 0.925rem;
  color: #334155;
  line-height: 1.65;
}

.req-section-body h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin: 1.25rem 0 0.5rem;
}

.req-section-body p {
  margin-bottom: 0.85rem;
}

.req-section-body ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.req-section-body li {
  margin-bottom: 0.4rem;
}

/* Architecture Topology Diagram Widget */
.topology-box {
  background: #0f172a;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  overflow-x: auto;
  border: 1px solid #334155;
  margin: 1rem 0;
}

.topology-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.topology-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

.topology-card h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
}

.topology-card p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Responsive Table Wrapper with Sticky Column */
.table-stat-clean {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 1rem 0;
}

.table-stat-clean th {
  background: #f1f5f9;
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: #1e293b;
  border: 1px solid var(--border-color);
}

.table-stat-clean td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  vertical-align: top;
}

/* Payslip styling */
.payslip-paper {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  border: 2px solid #0f172a;
  border-radius: var(--radius-sm);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  font-family: var(--font-sans);
}

.payslip-header {
  text-align: center;
  border-bottom: 2px dashed #0f172a;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
}

.payslip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.payslip-column {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.payslip-col-header {
  background: #0f172a;
  color: white;
  padding: 0.5rem 0.85rem;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.payslip-line {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0.85rem;
  font-size: 0.825rem;
  border-bottom: 1px solid #f1f5f9;
}

.payslip-total {
  font-weight: 700;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
}

.payslip-net-box {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid #2563eb;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
}

/* ========================================================================= */
/* RESPONSIVENESS: TABLET / TABS (768px - 1024px)                            */
/* ========================================================================= */

@media (max-width: 1024px) {
  .req-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .req-sidebar-tabs {
    position: static;
    max-height: none;
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    padding: 0.5rem;
    gap: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }

  .req-tab-heading {
    display: none;
  }

  .req-tab-link {
    width: auto;
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: white;
  }

  .req-tab-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
  }

  .req-tab-link:hover {
    background: var(--primary-light);
  }

  .req-tab-link.active:hover {
    background: var(--primary);
    color: white;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .header-container {
    padding: 0.65rem 1rem;
  }
}

/* ========================================================================= */
/* RESPONSIVENESS: MOBILE DEVICES (< 768px)                                  */
/* ========================================================================= */

@media (max-width: 768px) {
  .header-nav {
    display: none; /* Shown via mobile drawer */
  }

  .header-nav.mobile-active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    border-bottom: 2px solid var(--primary);
    box-shadow: var(--shadow-lg);
    gap: 0.5rem;
  }

  .mobile-toggle {
    display: block;
  }

  .header-actions {
    gap: 0.4rem;
  }

  .role-select {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    max-width: 125px;
  }

  .tenant-pill {
    display: none;
  }

  .main-wrapper {
    padding: 1rem 0.75rem;
  }

  .req-header-banner {
    padding: 1.5rem 1.25rem;
  }

  .req-title {
    font-size: 1.4rem;
  }

  .req-subtitle {
    font-size: 0.85rem;
  }

  .req-section-header {
    padding: 1rem 1.25rem;
  }

  .req-section-body {
    padding: 1.25rem;
    font-size: 0.875rem;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .payslip-paper {
    padding: 1.25rem;
  }

  .payslip-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .payslip-net-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* Table cards transformation on mobile */
  .custom-table th {
    padding: 0.65rem 0.75rem;
    font-size: 0.775rem;
  }

  .custom-table td {
    padding: 0.65rem 0.75rem;
    font-size: 0.8rem;
  }
}

/* Device View Modes Simulated Container */
.viewport-mode-tablet {
  max-width: 820px !important;
  margin: 0 auto;
  border-left: 2px dashed #94a3b8;
  border-right: 2px dashed #94a3b8;
  padding: 0 1rem;
}

.viewport-mode-mobile {
  max-width: 430px !important;
  margin: 0 auto;
  border-left: 2px dashed #ef4444;
  border-right: 2px dashed #ef4444;
  padding: 0 0.5rem;
}

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

/* ==========================================================================
   Header SuperAdmin & Logout Button
   ========================================================================== */
.header-superadmin {
  background: #ffffff !important;
  border-bottom: 2px solid #4f46e5 !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08) !important;
}

.header-superadmin .logo-text h1 {
  color: #0f172a !important;
}

.header-superadmin .logo-text span {
  color: #4f46e5 !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em !important;
}

.header-superadmin .nav-link-btn {
  color: #475569 !important;
}

.header-superadmin .nav-link-btn:hover {
  color: #4f46e5 !important;
  background-color: #eef2ff !important;
}

.header-superadmin .nav-link-btn.active {
  color: #4f46e5 !important;
  background-color: #e0e7ff !important;
  font-weight: 700 !important;
}

.badge-superadmin {
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35) !important;
}

.pill-superadmin {
  background: #eef2ff !important;
  border: 1px solid #c7d2fe !important;
  color: #4338ca !important;
  font-weight: 700 !important;
}

.user-identity-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.65rem 0.25rem 0.35rem;
  border-radius: 20px;
}

.user-avatar-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #0369a1 100%);
  color: white;
  font-size: 0.725rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-meta-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.user-name-label {
  font-size: 0.775rem;
  font-weight: 700;
  color: #0f172a;
}

.user-role-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.775rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-logout:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

/* ==========================================================================
   Login Page & Dual Portal Switcher
   ========================================================================== */
.login-page-container {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card-wrapper {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
  max-width: 580px;
  width: 100%;
  overflow: hidden;
  padding: 2rem;
}

.login-brand-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.brand-badge-icon {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: white;
  border-radius: var(--radius-md);
  font-size: 1.5rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-md);
}

.brand-title {
  font-size: 1.75rem;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

.brand-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.portal-tabs-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  background: #f1f5f9;
  padding: 0.4rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.portal-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.portal-tab-btn.active {
  background: white;
  box-shadow: var(--shadow-sm);
}

.portal-tab-btn .portal-icon {
  font-size: 1.35rem;
}

.portal-tab-btn .portal-meta strong {
  display: block;
  font-size: 0.9rem;
  color: #0f172a;
}

.portal-tab-btn .portal-meta small {
  display: block;
  font-size: 0.725rem;
  color: var(--text-muted);
}

.portal-scope-banner {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  line-height: 1.45;
  margin-bottom: 1.25rem;
}

.superadmin-banner {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
}

.superadmin-banner .banner-badge {
  display: inline-block;
  background: #4f46e5;
  color: #ffffff;
  font-size: 0.675rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-bottom: 0.4rem;
}

.tenant-banner {
  background: #eff6ff;
  border: 1px solid var(--primary-border);
  color: #1e40af;
}

.tenant-banner .banner-badge {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 0.675rem;
  font-weight: 800;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  margin-bottom: 0.4rem;
}

.quick-credentials-box {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.quick-title {
  display: block;
  font-size: 0.775rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
  letter-spacing: 0.05em;
}

.quick-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.quick-role-chip {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.65rem;
  border-radius: 20px;
  font-size: 0.775rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-role-chip:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.quick-role-chip.superadmin-chip {
  background: #0f172a;
  color: #38bdf8;
  border-color: #334155;
}

.kiosk-shortcut-card {
  margin-top: 1.75rem;
  background: #0f172a;
  color: white;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.kiosk-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.kiosk-icon-box {
  font-size: 1.75rem;
}

.kiosk-meta h4 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.15rem;
}

.kiosk-meta p {
  font-size: 0.775rem;
  color: #94a3b8;
  margin: 0;
}

/* ==========================================================================
   Camera Biometrics Time-In Kiosk
   ========================================================================== */
.kiosk-viewport-container {
  max-width: 1300px;
  margin: 0 auto;
}

.kiosk-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
  color: white;
  padding: 1.25rem 1.75rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}

.kiosk-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.kiosk-pulse-dot {
  width: 14px;
  height: 14px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 12px #22c55e;
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.kiosk-title {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 0.15rem;
}

.kiosk-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  margin: 0;
}

.kiosk-clock-card {
  text-align: right;
}

.kiosk-clock-digits {
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 900;
  color: #38bdf8;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.kiosk-clock-date {
  font-size: 0.8rem;
  color: #cbd5e1;
}

.kiosk-main-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
}

.kiosk-camera-card {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.camera-stage-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#webcamVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror view for natural interaction */
}

#hudCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: scaleX(-1); /* Match mirrored video */
  z-index: 10;
}

.camera-hud-overlay {
  position: absolute;
  inset: 1.5rem;
  pointer-events: none;
}

/* Corner Reticles */
.hud-corner {
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: #38bdf8;
  border-style: solid;
}

.hud-corner.top-left { top: 0; left: 0; border-width: 4px 0 0 4px; }
.hud-corner.top-right { top: 0; right: 0; border-width: 4px 4px 0 0; }
.hud-corner.bottom-left { bottom: 0; left: 0; border-width: 0 0 4px 4px; }
.hud-corner.bottom-right { bottom: 0; right: 0; border-width: 0 4px 4px 0; }

/* Laser Scanner Bar */
.scan-laser-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #38bdf8, #22c55e, transparent);
  box-shadow: 0 0 15px #38bdf8;
  animation: laserSweep 3s ease-in-out infinite alternate;
}

@keyframes laserSweep {
  0% { top: 5%; opacity: 0.3; }
  50% { opacity: 1; }
  100% { top: 95%; opacity: 0.3; }
}

/* Reticle Center */
.face-target-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 180px;
  height: 220px;
  border: 2px dashed rgba(56, 189, 248, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.face-target-reticle.active {
  border: 3px solid #10b981 !important;
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.5) !important;
}

.face-target-reticle.active .reticle-dots .dot {
  background: #10b981 !important;
  box-shadow: 0 0 10px #10b981 !important;
}

.face-target-reticle.scanning {
  border: 2px solid #38bdf8 !important;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.3) !important;
}

.face-target-reticle.noface {
  border: 2px dashed rgba(148, 163, 184, 0.35) !important;
  box-shadow: none !important;
}

.face-target-reticle.noface .reticle-dots .dot {
  background: #64748b !important;
  box-shadow: none !important;
}

.reticle-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.reticle-dots .dot {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 6px #38bdf8;
}

.dot.eye-left { top: 38%; left: 32%; }
.dot.eye-right { top: 38%; right: 32%; }
.dot.nose { top: 52%; left: 48%; }
.dot.mouth { bottom: 30%; left: 44%; width: 22px; height: 3px; border-radius: 2px; }

.hud-status-bar {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  justify-content: space-between;
}

.hud-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
}

.hud-badge.live {
  background: rgba(15, 23, 42, 0.85);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.hud-badge.confidence {
  background: rgba(15, 23, 42, 0.85);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.camera-permission-fallback {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  z-index: 20;
}

.viewfinder-toolbar {
  padding: 1rem 1.25rem;
  background: #0f172a;
  border-top: 1px solid #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toolbar-mode-toggle {
  display: flex;
  background: #020617;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid #334155;
}

.mode-pill {
  padding: 0.45rem 1rem;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-pill.active {
  background: #1e293b;
  color: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.kiosk-control-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.control-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

.control-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.employee-preview-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.emp-avatar-box {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #0284c7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.emp-initials {
  color: white;
  font-weight: 900;
  font-size: 1.35rem;
}

.emp-info-meta {
  flex: 1;
}

.emp-card-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.15rem;
}

.emp-card-sub {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.emp-punches-today {
  display: flex;
  gap: 0.5rem;
}

.today-punch-pill {
  font-family: var(--font-mono);
  font-size: 0.725rem;
  font-weight: 700;
  background: white;
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  color: #475569;
}

.btn-punch-action {
  width: 100%;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: white;
  border: none;
  padding: 1.15rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  box-shadow: 0 10px 15px -3px rgba(2, 132, 199, 0.4);
  transition: all 0.2s ease;
  margin-bottom: 1.5rem;
}

.btn-punch-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 20px -3px rgba(2, 132, 199, 0.5);
}

.btn-punch-action .punch-icon {
  font-size: 2rem;
}

.btn-punch-action .punch-text-group {
  text-align: left;
}

.punch-main-title {
  display: block;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.punch-sub-title {
  display: block;
  font-size: 0.775rem;
  opacity: 0.85;
}

.quick-employee-chips {
  margin-bottom: 1.5rem;
}

.chips-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.emp-chip-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 0.35rem 0.65rem;
  border-radius: 20px;
  font-size: 0.775rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

.emp-chip-btn:hover {
  background: #e0f2fe;
  color: var(--primary);
  border-color: #bae6fd;
}

.kiosk-security-footer {
  margin-top: auto;
  background: #f8fafc;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.775rem;
  color: #475569;
}

.kiosk-security-footer p {
  margin: 0;
  font-size: 0.725rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Success Modal Overlay
   ========================================================================== */
.kiosk-success-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.success-card-content {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 2.25rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.success-chime-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #dcfce7;
  color: #166534;
  font-size: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.modal-emp-highlight {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.modal-face-snapshot {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 2px solid var(--primary);
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .kiosk-main-grid {
    grid-template-columns: 1fr;
  }
}