:root {
  color-scheme: dark;
  --color-bg: #030712;
  --color-bg-elevated: rgba(15, 23, 42, 0.5);
  --color-bg-card: rgba(15, 23, 42, 0.4);
  --color-border: rgba(255, 255, 255, 0.08);
  --color-primary: #38bdf8;
  --color-primary-soft: rgba(56, 189, 248, 0.15);
  --color-primary-glow: rgba(56, 189, 248, 0.4);
  --color-text: #f8fafc;
  --color-text-muted: #94a3b8;
  --shadow-soft: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-glow: 0 0 20px var(--color-primary-glow);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-full: 9999px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Animated Background Orbs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  animation: float 15s ease-in-out infinite alternate;
  opacity: 0.35;
  pointer-events: none;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.5), transparent 70%);
  top: -100px;
  left: -100px;
}

.orb-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.4), transparent 70%);
  bottom: -200px;
  right: -100px;
  animation-delay: -5s;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.4), transparent 70%);
  top: 40%;
  left: 30%;
  animation-delay: -10s;
}

@keyframes float {
  0% {
    transform: translateY(0) scale(1);
  }

  100% {
    transform: translateY(-40px) scale(1.1);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  background: rgba(3, 7, 18, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  animation: slideUp 0.6s ease-out;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* NextLevel Logo Link */
.nl-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  font-size: 0.85rem;
  transition: all var(--transition-smooth);
  backdrop-filter: blur(8px);
}

.nl-logo-link svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--color-primary);
  transition: transform var(--transition-smooth);
}

.nl-logo-link .nl-text {
  opacity: 0.85;
}

.nl-logo-link .nl-text strong {
  font-weight: 700;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nl-logo-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.2);
}

.nl-logo-link:hover svg {
  transform: translateY(-1px) scale(1.1);
}

.top-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: rgba(15, 23, 42, 0.4);
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-smooth);
}

.nav-link:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: #030712;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  box-shadow: var(--shadow-glow);
  font-weight: 600;
}

.nav-badge {
  display: inline-flex;
  min-width: 1.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #fca5a5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #f97316, #ec4899, #8b5cf6);
  box-shadow: 0 10px 25px rgba(236, 72, 153, 0.4);
  font-size: 1.25rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(to right, #f8fafc, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

/* Main */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 2rem auto 3rem;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.view {
  animation: slideUp 0.5s ease-out backwards;
}

/* Cards */
.card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card h1,
.card h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.card p {
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  background: linear-gradient(to right, #ffffff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subheading {
  font-size: 1.1rem;
  font-weight: 400;
  color: #cbd5e1;
  margin-bottom: 1.5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Chips & Badges */
.quick-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--color-text);
  font-size: 0.85rem;
  text-decoration: none;
  transition: all var(--transition-smooth);
  backdrop-filter: blur(8px);
}

.chip:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.2);
}

.chip strong {
  font-weight: 700;
}

.status-badge {
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
  color: var(--color-text-muted);
}

.status-saving {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.1);
  color: #bae6fd;
  animation: pulse-glow 2s infinite;
}

.status-success {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.1);
  color: #bbf7d0;
}

@keyframes pulse-glow {

  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }
}

/* Buttons */
.btn {
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  padding: 0.6rem 1.5rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--transition-smooth);
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  color: #030712;
  box-shadow: 0 10px 25px rgba(56, 189, 248, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 15px 35px rgba(56, 189, 248, 0.5);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  backdrop-filter: blur(8px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* View / Tab Header Options */
.due-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  width: 100%;
}

.due-summary {
  margin-top: 0.25rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.range-switch {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.3rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: rgba(15, 23, 42, 0.5);
}

.range-btn {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-smooth);
}

.range-btn:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.05);
}

.range-btn.active {
  color: #030712;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  box-shadow: var(--shadow-glow);
  font-weight: 600;
}

/* Forms & Inputs */
.employee-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  flex: 1 1 200px;
  gap: 0.4rem;
}

.field-wide {
  flex-basis: 100%;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-left: 0.2rem;
}

input[type='text'],
.date-input,
.note-input {
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

input[type='text']:focus,
.date-input:focus,
.note-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px var(--color-primary-soft), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

input[type='text']::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

/* Certs Block */
.certs-group {
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  transition: all var(--transition-smooth);
}

.certs-group:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.03);
}

.certs-group legend {
  padding: 0 0.75rem;
  font-weight: 600;
  color: #cbd5e1;
}

.cert-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 0.5rem;
}

.cert-row {
  display: grid;
  grid-template-columns: 1fr 180px auto;
  gap: 1rem;
  align-items: center;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.cert-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.cert-check {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

input[type="checkbox"] {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

input[type="checkbox"]:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 6px;
  width: 5px;
  height: 10px;
  border: solid #030712;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.cert-hint {
  min-width: 2.5rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  padding: 0.25rem 0.75rem;
  border: 1px solid transparent;
}

.cert-hint--ok {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.1);
  color: #bbf7d0;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

.cert-hint--warn90 {
  border-color: rgba(234, 179, 8, 0.4);
  background: rgba(234, 179, 8, 0.1);
  color: #fef08a;
}

.cert-hint--warn60 {
  border-color: rgba(249, 115, 22, 0.4);
  background: rgba(249, 115, 22, 0.1);
  color: #fed7aa;
}

.cert-hint--warn30,
.cert-hint--overdue {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
  animation: pulse-glow 2s infinite;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* Tables */
.table-wrapper {
  margin-top: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.employees-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.employees-table thead {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
}

.employees-table th,
.employees-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.employees-table th {
  font-weight: 600;
  color: #e2e8f0;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.employees-table tbody tr {
  transition: background var(--transition-fast);
}

.employees-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Table Pills */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text-muted);
}

.pill.ok {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #bbf7d0;
}

.pill.warn90 {
  background: rgba(234, 179, 8, 0.1);
  border-color: rgba(234, 179, 8, 0.4);
  color: #fef08a;
}

.pill.warn60 {
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.4);
  color: #fed7aa;
}

.pill.warn30 {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.pill.overdue {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fca5a5;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
  animation: pulse-glow 2s infinite;
}

.pill.empty {
  opacity: 0.4;
  border-style: dashed;
  background: transparent;
}

.employees-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.employees-count {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
}

/* Hints & Tooltips */
.hint {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.5rem;
  display: block;
}

/* Icon Buttons */
.btn-icon {
  padding: 0.4rem;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
}

.btn-icon-danger {
  color: #fca5a5;
}

.btn-icon-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fecaca;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

@media (min-width: 768px) {
  .app-main {
    gap: 2.5rem;
  }

  .card {
    padding: 2.5rem;
  }

  .cert-grid {
    grid-template-columns: 1fr 1fr;
  }

  .cert-row {
    grid-template-columns: 1fr 200px;
  }
}