:root {
  --ov-bg-0: #060b18;
  --ov-bg-1: #0d1326;
  --ov-surface: rgba(15, 23, 42, 0.74);
  --ov-surface-strong: rgba(15, 23, 42, 0.9);
  --ov-border: rgba(148, 163, 184, 0.2);
  --ov-text: #e6edf8;
  --ov-text-muted: #94a3b8;
  --ov-primary: #4f7cff;
  --ov-primary-2: #7c3aed;
  --ov-success: #22c55e;
  --ov-warning: #f59e0b;
  --ov-danger: #ef4444;
  --ov-shadow: 0 20px 45px rgba(2, 6, 23, 0.38);
  --ov-radius-xl: 22px;
  --ov-radius-lg: 16px;
  --ov-radius-md: 12px;
  --ov-gap-sm: 8px;
  --ov-ease: 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

html,
body {
  background:
    radial-gradient(circle at 8% -10%, rgba(79, 124, 255, 0.28), transparent 42%),
    radial-gradient(circle at 92% 5%, rgba(124, 58, 237, 0.24), transparent 38%),
    linear-gradient(160deg, var(--ov-bg-0), var(--ov-bg-1)) !important;
  color: var(--ov-text) !important;
}

body {
  font-family: "Poppins", sans-serif !important;
}

.sidebar {
  position: sticky !important;
  top: 14px;
  height: calc(100vh - 28px) !important;
  margin: 14px 0 14px 14px;
  border-radius: var(--ov-radius-xl) !important;
  overflow: hidden;
  background: linear-gradient(175deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.84)) !important;
  border-right: 1px solid var(--ov-border) !important;
  box-shadow: var(--ov-shadow) !important;
}

.logo-img {
  border-radius: 16px !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.5) !important;
}

.sidebar ul li a,
.sidebar a {
  color: var(--ov-text-muted) !important;
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  transition: all var(--ov-ease) !important;
}

.sidebar ul li a:hover,
.sidebar ul li a.active,
.sidebar a:hover,
.sidebar a.active {
  color: #f8fbff !important;
  background: rgba(79, 124, 255, 0.2) !important;
  border-color: rgba(79, 124, 255, 0.38) !important;
  transform: translateX(2px);
}

.main-content {
  max-width: 1680px;
  width: calc(100% - 28px);
  margin: 14px 14px 14px auto !important;
  min-height: calc(100vh - 28px);
  border-radius: var(--ov-radius-xl);
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(2, 6, 23, 0.12) !important;
  backdrop-filter: blur(2px);
  padding: 24px !important;
}

.page-title,
h1,
h2,
h3 {
  color: #f8fbff !important;
  letter-spacing: 0.2px;
}

.page-title-underline {
  background: linear-gradient(90deg, var(--ov-primary), var(--ov-primary-2)) !important;
  height: 4px !important;
  border-radius: 999px !important;
}

.card,
.stats-table-card,
.table-card,
.action-card,
.stat-card,
.stat-mini,
.help-box,
.login-box,
.modal-box {
  background: var(--ov-surface) !important;
  border: 1px solid var(--ov-border) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  box-shadow: var(--ov-shadow) !important;
  border-radius: var(--ov-radius-lg) !important;
  padding: 16px !important;
  transition: transform var(--ov-ease), box-shadow var(--ov-ease), border-color var(--ov-ease) !important;
}

.card:hover,
.stats-table-card:hover,
.table-card:hover,
.action-card:hover,
.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.38) !important;
  box-shadow: 0 24px 44px rgba(2, 6, 23, 0.44) !important;
}

.card-title,
.action-card-title,
.stat-label,
.subtitle,
.page-subtitle {
  color: #cfe0ff !important;
}

.stat-value,
.value,
.num {
  color: #ffffff !important;
}

.task-item,
.project-card,
.calendar-day,
.repartition-row,
.reason-copy,
.staff-codes-table tr,
.data-table tr,
.stats-table tr,
.comptabilite-table tr {
  background: rgba(15, 23, 42, 0.42) !important;
  border-color: rgba(148, 163, 184, 0.16) !important;
  border-radius: var(--ov-radius-md) !important;
  transition: all var(--ov-ease);
}

.task-item:hover,
.project-card:hover,
.repartition-row:hover,
.reason-copy:hover {
  background: rgba(30, 41, 59, 0.6) !important;
}

input,
select,
textarea {
  background: rgba(15, 23, 42, 0.65) !important;
  color: #f8fbff !important;
  border: 1px solid rgba(148, 163, 184, 0.34) !important;
  border-radius: 12px !important;
}

input::placeholder,
textarea::placeholder {
  color: #91a2bc !important;
}

input:focus,
select:focus,
textarea:focus {
  outline: none !important;
  border-color: rgba(79, 124, 255, 0.7) !important;
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.18) !important;
}

button,
.button-primary,
.btn-action,
.btn-ticket,
.filter-pill,
.status-toggle,
.modal-close {
  border-radius: var(--ov-radius-md) !important;
  border: 1px solid rgba(79, 124, 255, 0.42) !important;
  background: linear-gradient(135deg, var(--ov-primary), var(--ov-primary-2)) !important;
  color: #fff !important;
  box-shadow: 0 10px 18px rgba(79, 124, 255, 0.22) !important;
  transition: transform var(--ov-ease), filter var(--ov-ease), box-shadow var(--ov-ease) !important;
}

button:hover,
.button-primary:hover,
.btn-action:hover,
.btn-ticket:hover,
.filter-pill:hover,
.status-toggle:hover,
.modal-close:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.filter-pill:not(.active) {
  background: rgba(15, 23, 42, 0.72) !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
  box-shadow: none !important;
}

.filter-pill.active {
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.34) !important;
}

.badge,
.tag,
.stat-chip {
  border-radius: 999px !important;
  border: 1px solid rgba(148, 163, 184, 0.34) !important;
  background: rgba(15, 23, 42, 0.7) !important;
  color: #dbeafe !important;
}

a {
  color: #93c5fd;
}

a:hover {
  color: #bfdbfe;
}

.flash-message,
.flash-success,
.error {
  border-radius: 12px !important;
  border: 1px solid rgba(148, 163, 184, 0.24) !important;
}

.flash-success {
  background: rgba(34, 197, 94, 0.2) !important;
  color: #dcfce7 !important;
}

.error {
  background: rgba(239, 68, 68, 0.26) !important;
  color: #fee2e2 !important;
}

.progress,
.progress-bar {
  background: rgba(15, 23, 42, 0.65) !important;
  border: 1px solid rgba(148, 163, 184, 0.2) !important;
}

.progress-fill {
  background: linear-gradient(90deg, #22c55e, #86efac) !important;
}

table {
  color: #e2e8f0 !important;
}

thead th {
  color: #dbeafe !important;
  background: rgba(15, 23, 42, 0.8) !important;
}

tbody tr:nth-child(2n) {
  background: rgba(15, 23, 42, 0.54) !important;
}

th,
td {
  padding: 11px 10px !important;
}

form {
  display: grid;
  gap: var(--ov-gap-sm);
}

label {
  font-size: 0.85rem;
  color: #b8c8e5 !important;
  margin-top: 2px;
}

/* Login */
body:has(.login-box) {
  min-height: 100vh;
}

.login-box h2 {
  color: #fff !important;
}

/* Mobile polish */
@media (max-width: 900px) {
  .sidebar {
    position: static !important;
    top: auto;
    height: auto !important;
    margin: 0;
    border-radius: 0 0 18px 18px !important;
    border-right: none !important;
    border-bottom: 1px solid var(--ov-border) !important;
  }

  .main-content {
    width: 100%;
    margin: 0 !important;
    min-height: auto;
    border-radius: 0;
    border: none;
    padding-top: 18px !important;
  }
}

/* Dashboard hero redesign */
.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(240px, 1fr);
  gap: 16px;
  margin-bottom: 18px;
  padding: 22px;
  border-radius: var(--ov-radius-xl);
  border: 1px solid rgba(148, 163, 184, 0.24);
  background:
    linear-gradient(145deg, rgba(79, 124, 255, 0.18), rgba(124, 58, 237, 0.12)),
    rgba(15, 23, 42, 0.68);
  box-shadow: var(--ov-shadow);
}

.hero-eyebrow {
  margin: 0 0 8px;
  color: #9fb8ff;
  font-size: 0.72rem;
  letter-spacing: 1.4px;
  font-weight: 600;
}

.hero-description {
  max-width: 780px;
  color: #c7d8f4;
  margin: 8px 0 14px;
}

.hero-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  text-decoration: none;
  border-radius: var(--ov-radius-md);
  border: 1px solid rgba(79, 124, 255, 0.45);
  background: linear-gradient(135deg, var(--ov-primary), var(--ov-primary-2));
  color: #fff;
}

.hero-action-btn.ghost {
  background: rgba(15, 23, 42, 0.65);
  border-color: rgba(148, 163, 184, 0.34);
}

.hero-right {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.hero-mini-card {
  border-radius: var(--ov-radius-md);
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.55);
  padding: 14px;
}

.hero-mini-label {
  display: block;
  color: #a7bfec;
  font-size: 0.82rem;
  margin-bottom: 4px;
}

.hero-mini-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: #f8fbff;
}

/* Shared modern page hero */
.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(250px, 1fr);
  gap: 14px;
  margin: 0 0 18px;
  padding: 18px;
  border-radius: var(--ov-radius-xl);
  border: 1px solid rgba(148, 163, 184, 0.24);
  background:
    radial-gradient(circle at 8% 12%, rgba(79, 124, 255, 0.2), transparent 35%),
    rgba(15, 23, 42, 0.66);
  box-shadow: var(--ov-shadow);
}

.page-hero-eyebrow {
  margin: 0 0 8px;
  color: #9fb8ff;
  font-size: 0.72rem;
  letter-spacing: 1.2px;
  font-weight: 600;
}

.page-hero-main h1,
.page-hero-main .page-title {
  margin-top: 0;
}

.page-hero-metrics {
  display: grid;
  gap: 10px;
}

.page-hero-metric {
  padding: 12px;
  border-radius: var(--ov-radius-md);
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.52);
}

.page-hero-metric span {
  display: block;
  font-size: 0.8rem;
  color: #a7bfec;
  margin-bottom: 4px;
}

.page-hero-metric strong {
  color: #f8fbff;
  font-size: 1rem;
}

.modern-kpi-grid .stat-card {
  position: relative;
  overflow: hidden;
}

.modern-kpi-grid .stat-card::before {
  content: "";
  position: absolute;
  inset: -40% auto auto -35%;
  width: 140px;
  height: 140px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(79, 124, 255, 0.24), transparent 68%);
  pointer-events: none;
}

/* Login redesign */
.login-modern-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-modern-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1fr);
  gap: 18px;
}

.login-modern-aside {
  border-radius: var(--ov-radius-xl);
  border: 1px solid var(--ov-border);
  background:
    radial-gradient(circle at 10% 15%, rgba(79, 124, 255, 0.28), transparent 36%),
    rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  padding: 22px;
}

.login-modern-aside h1 {
  margin: 8px 0 10px;
}

.login-kicker {
  margin: 8px 0 0;
  color: #a5b4fc;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.login-aside-text {
  color: #c7d2fe;
  line-height: 1.55;
}

@media (max-width: 920px) {
  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .page-hero {
    grid-template-columns: 1fr;
  }

  .login-modern-shell {
    grid-template-columns: 1fr;
  }
}
