:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --text-primary: #0f172a;
  --text-muted: #64748b;
  --line-color: #e2e8f0;
  
  --accent-color: #0f172a;
  --accent-hover: #334155;
  --accent-light: #f1f5f9;
  
  --gold-primary: #c29d53;
  --gold-dark: #a37f37;
  --gold-glow: rgba(194, 157, 83, 0.15);
  
  --success: #10b981;
  --danger: #ef4444;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
  --shadow-premium: 0 30px 60px -15px rgba(0, 0, 0, 0.25);
  
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', sans-serif;
}

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

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

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  place-items: center;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  color: #ffffff;
  transition: opacity 0.3s ease;
}

.loader.is-active {
  display: grid;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--gold-primary);
  border-radius: 50%;
  animation: spin 1s cubic-bezier(0.55, 0.055, 0.675, 0.19) infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-content p {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
}

.not-found {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background: 
    radial-gradient(circle at 10% 20%, rgba(15, 23, 42, 1) 0%, rgba(9, 12, 22, 1) 90%),
    radial-gradient(circle at top right, var(--gold-glow), transparent 40%);
  color: #ffffff;
}

.not-found-panel {
  max-width: 580px;
  width: 100%;
  border: 1px solid rgba(194, 157, 83, 0.25);
  padding: 48px 40px;
  border-radius: var(--radius-lg);
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-premium), 0 0 40px rgba(194, 157, 83, 0.05);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.not-found-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
}

.not-found-panel h1 {
  font-family: var(--font-display);
  font-size: 96px;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, #ffffff 0%, var(--gold-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
  letter-spacing: -0.03em;
}

.not-found-panel p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 24px;
}

.not-found-panel p.error-message {
  font-size: 18px;
  font-weight: 500;
  color: #ffffff;
  margin-bottom: 8px;
}

.gold-divider {
  height: 1px;
  width: 80px;
  background: var(--gold-primary);
  margin: 20px auto;
  opacity: 0.5;
}

.employee-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--theme-bg, var(--bg-primary));
  color: var(--theme-ink, var(--text-primary));
  transition: all 0.3s ease;
}

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(20px, 6vw, 80px);
  border-bottom: 1px solid var(--theme-line, var(--line-color));
  background: var(--theme-nav, var(--bg-secondary));
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-lockup-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.brand-lockup-link:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.logo-mark-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 2px solid var(--theme-accent, var(--accent-color));
  color: var(--theme-accent, var(--accent-color));
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.03);
}

.brand-lockup h1 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-lockup small {
  display: block;
  font-size: 12px;
  color: var(--theme-muted, var(--text-muted));
  font-weight: 500;
  margin-top: 1px;
}

.status-pill {
  border: 1.5px solid var(--theme-accent, var(--accent-color));
  color: var(--theme-accent, var(--accent-color));
  padding: 6px 14px;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 50px;
  background: transparent;
  white-space: nowrap;
}

.status-pill.status-pill-inactive {
  border-color: var(--danger) !important;
  color: var(--danger) !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

.profile-hero {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(320px, 600px);
  align-content: center;
  justify-content: center;
  align-items: center;
  gap: clamp(30px, 6vw, 80px);
  padding: clamp(30px, 6vw, 90px) 24px;
}

.employee-photo {
  width: 100%;
  aspect-ratio: 3.8 / 5;
  object-fit: cover;
  border: 8px solid var(--theme-photo-border, var(--bg-secondary));
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.employee-photo.has-ended {
  filter: grayscale(100%);
  opacity: 0.7;
}

.profile-hero img.has-ended:hover {
  filter: grayscale(85%) !important;
  opacity: 0.8 !important;
}

.profile-data {
  display: flex;
  flex-direction: column;
}

.profile-data .eyebrow {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--theme-accent, var(--accent-color));
  margin-bottom: 8px;
}

.profile-data h2 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.profile-data .role {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  color: var(--theme-accent, var(--accent-color));
  margin-bottom: 28px;
}

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

.data-item {
  border-left: 3px solid var(--theme-accent, var(--accent-color));
  padding: 12px 18px;
  background: var(--theme-card, rgba(255, 255, 255, 0.7));
  backdrop-filter: blur(5px);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

.data-item span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--theme-muted, var(--text-muted));
  margin-bottom: 4px;
}

.data-item strong {
  font-size: 14px;
  font-weight: 600;
  word-break: break-word;
}

.data-item a {
  text-decoration: underline;
  transition: opacity 0.2s;
}

.data-item a:hover {
  opacity: 0.7;
}

.admin {
  min-height: 100vh;
  background: #f1f5f9;
}

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(20px, 4vw, 60px);
  background: #0f172a;
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

.admin-top-title h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.admin-top-title p {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.admin-body {
  padding: 24px clamp(20px, 4vw, 60px) 60px;
}

.tabs-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 24px;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 12px 18px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.is-active {
  color: #0f172a;
}

.tab.is-active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: #0f172a;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.toolbar h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.filters-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary { background: #0f172a; color: #ffffff; }
.btn-primary:hover { background: #334155; }
.btn-dark { background: #1e293b; color: #ffffff; }
.btn-dark:hover { background: #0f172a; }
.btn-ghost { background: #e2e8f0; color: #334155; }
.btn-ghost:hover { background: #cbd5e1; }
.btn-danger { background: #ef4444; color: #ffffff; }
.btn-danger:hover { background: #dc2626; }

.btn-sm {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #94a3b8;
}

.icon-btn.btn-danger-icon:hover {
  background: #fef2f2;
  color: #ef4444;
  border-color: #fca5a5;
}

.table-wrap {
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

th, td {
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  font-size: 14px;
}

th {
  background: #f8fafc;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #e2e8f0;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: #f8fafc;
}

.row-actions {
  display: flex;
  gap: 6px;
}

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

.field span {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.field span.required::after {
  content: ' *';
  color: var(--danger);
}

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-size: 14px;
  background: #ffffff;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: #64748b;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.1);
}

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

.field.full {
  grid-column: 1 / -1;
}

.modal {
  border: none;
  border-radius: var(--radius-lg);
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  box-shadow: var(--shadow-premium);
  outline: none;
  overflow: hidden;
}

#qrModal {
  width: min(520px, calc(100vw - 32px));
}

dialog.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

.modal-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  width: 100%;
  max-height: inherit;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-head h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.close-button {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
}

.close-button:hover {
  color: var(--text-primary);
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.qr-card {
  width: 100%;
  max-width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.qr-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #cbd5e1;
}

.qr-image canvas, .qr-image img {
  display: block;
  margin: 0 auto;
  border: 16px solid #ffffff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
  border-radius: var(--radius-lg);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.qr-image:hover canvas, .qr-image:hover img {
  transform: scale(1.025);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.12);
}

.qr-details {
  padding: 24px;
  background: #ffffff;
}

.copy-input-group {
  display: flex;
  gap: 8px;
}

.copy-input-group input {
  font-family: monospace;
  font-size: 12px;
  background: #f1f5f9;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  font-size: 14px;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  gap: 8px;
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state p {
  margin-bottom: 12px;
  font-size: 15px;
}

.status-pill-mobile {
  display: none;
}

@media (max-width: 820px) {
  .status-pill-desktop {
    display: none;
  }
  
  .status-pill-mobile {
    display: inline-block;
    align-self: center;
    margin-bottom: 8px;
  }

  .profile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 32px 20px;
  }
  
  .employee-photo {
    width: min(100%, 280px);
    justify-self: center;
  }
  
  .profile-data {
    align-items: center;
    text-align: center;
    width: 100%;
  }

  .profile-data h2,
  .profile-data .role,
  .profile-data .eyebrow {
    text-align: center;
  }
  
  .brand-bar {
    padding: 14px 20px;
    justify-content: center;
  }
  
  .data-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .admin-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .tabs-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  
  .toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .filters-wrapper {
    width: 100%;
    flex-direction: column;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-actions {
    flex-direction: column-reverse;
  }
  
  .modal-actions .btn {
    width: 100%;
  }
}
