:root {
    --bg: #0a0c10;
    --surface: #111318;
    --surface2: #181c24;
    --border: #1f2530;
    --accent: #4fffb0;
    --accent2: #ff6b6b;
    --accent3: #ffd166;
    --accent4: #74b9ff;
    --text: #e8eaf0;
    --text-muted: #6b7280;
    --text-dim: #3d4555;
    --radius: 14px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
  }

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

  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* GRID NOISE TEXTURE */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
      repeating-linear-gradient(0deg, transparent, transparent 39px, var(--border) 39px, var(--border) 40px),
      repeating-linear-gradient(90deg, transparent, transparent 39px, var(--border) 39px, var(--border) 40px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
  }

  .app {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 8, 12, 0.72);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    border: none;
    z-index: 25;
  }

  /* ─── SIDEBAR ─── */
  .sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 28px 0;
    position: relative;
    overflow: hidden;
  }

  .sidebar::after {
    content: '';
    position: absolute;
    bottom: -60px; left: -60px;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(79,255,176,0.08) 0%, transparent 70%);
    pointer-events: none;
  }

  .logo {
    padding: 0 24px 28px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
  }

  .sidebar-close,
  .menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
  }

  .sidebar-close:hover,
  .menu-toggle:hover {
    border-color: var(--text-muted);
    color: var(--accent);
  }

  .sidebar-close {
    margin-left: auto;
    width: 34px;
    height: 34px;
    font-size: 15px;
    flex-shrink: 0;
  }

  .logo-icon {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
  }

  .logo-text {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 18px;
    color: var(--text);
    letter-spacing: -0.5px;
  }

  .logo-text span { color: var(--accent); }

  .nav { padding: 20px 14px; flex: 1; }

  .nav-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    text-transform: uppercase;
    padding: 0 10px;
    margin-bottom: 8px;
    margin-top: 16px;
  }

  .nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
    transition: all 0.15s;
    position: relative;
  }

  .nav-item:hover { background: var(--surface2); color: var(--text); }

  .nav-item.active {
    background: rgba(79,255,176,0.1);
    color: var(--accent);
    font-weight: 500;
  }

  .nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
  }

  .nav-icon { font-size: 16px; width: 20px; text-align: center; }

  .badge {
    margin-left: auto;
    background: var(--accent2);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
  }

  .sidebar-user {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
  }

  .avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent4) 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #0a0c10;
    flex-shrink: 0;
  }

  .user-info .name { font-size: 13px; font-weight: 500; }
  .user-info .role { font-size: 11px; color: var(--text-muted); }

  /* ─── MAIN ─── */
  .main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .topbar {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(10,12,16,0.8);
    backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 10;
  }

  .topbar-start {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
  }

  .page-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: var(--text);
  }

  .page-title span { color: var(--text-muted); font-weight: 400; font-size: 15px; margin-left: 8px; }

  .topbar-actions { display: flex; align-items: center; gap: 10px; }

  .menu-toggle {
    width: 42px;
    height: 42px;
    font-size: 18px;
    flex-shrink: 0;
  }

  .btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
  }

  .btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
  }
  .btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

  .btn-primary {
    background: var(--accent);
    color: #0a0c10;
    font-weight: 600;
  }
  .btn-primary:hover { background: #3de89d; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(79,255,176,0.3); }

  /* ─── CONTENT ─── */
  .content { padding: 28px 32px; flex: 1; }

  /* ─── STATS GRID ─── */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
  }

  .stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
    cursor: default;
  }

  .stat-card:hover { transform: translateY(-2px); border-color: var(--text-dim); }

  .stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
  }

  .stat-card.green::before { background: var(--accent); }
  .stat-card.red::before { background: var(--accent2); }
  .stat-card.yellow::before { background: var(--accent3); }
  .stat-card.blue::before { background: var(--accent4); }

  .stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 500;
  }

  .stat-value {
    font-family: 'Syne', sans-serif;
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
  }

  .stat-card.green .stat-value { color: var(--accent); }
  .stat-card.red .stat-value { color: var(--accent2); }
  .stat-card.yellow .stat-value { color: var(--accent3); }
  .stat-card.blue .stat-value { color: var(--accent4); }

  .stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 4px;
  }

  .stat-icon {
    position: absolute;
    right: 18px; top: 18px;
    font-size: 28px;
    opacity: 0.12;
  }

  /* ─── 2-COL LAYOUT ─── */
  .two-col { display: grid; grid-template-columns: 1fr 340px; gap: 20px; margin-bottom: 24px; }

  /* ─── CALENDAR ─── */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
  }

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

  .card-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 15px;
  }

  .card-body { padding: 20px 22px; }

  .cal-nav {
    display: flex; align-items: center; gap: 10px;
  }

  .cal-nav button {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 30px; height: 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
  }

  .cal-nav button:hover { background: var(--border); }

  .cal-month {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 15px;
    min-width: 140px;
    text-align: center;
  }

  .cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 16px;
  }

  .cal-day-name {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 6px 0;
  }

  .cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.1s;
    position: relative;
    gap: 2px;
  }

  .cal-day:hover:not(.empty) { background: var(--surface2); }
  .cal-day.empty { cursor: default; }

  .cal-day.today {
    background: rgba(79,255,176,0.1);
    color: var(--accent);
    font-weight: 600;
  }

  .cal-day.today::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--accent);
  }

  .cal-day.conge { background: rgba(79,255,176,0.08); }
  .cal-day.absence { background: rgba(255,107,107,0.08); }
  .cal-day.teletravail { background: rgba(116,185,255,0.08); }
  .cal-day.weekend { opacity: 0.3; }

  .dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  /* ─── LEGEND ─── */
  .legend {
    display: flex; gap: 16px;
    margin-top: 14px;
    flex-wrap: wrap;
  }

  .legend-item {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
  }

  .legend-dot {
    width: 8px; height: 8px;
    border-radius: 2px;
  }

  /* ─── REQUESTS LIST ─── */
  .requests { display: flex; flex-direction: column; gap: 10px; }

  .request-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex; align-items: center; gap: 12px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
  }

  .request-item:hover { border-color: var(--text-dim); transform: translateX(2px); }

  .request-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
  }

  .request-item.pending::before { background: var(--accent3); }
  .request-item.approved::before { background: var(--accent); }
  .request-item.rejected::before { background: var(--accent2); }

  .req-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
    color: #0a0c10;
  }

  .req-info { flex: 1; min-width: 0; }
  .req-name { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
  .req-details { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .req-status {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .status-pending { background: rgba(255,209,102,0.12); color: var(--accent3); }
  .status-approved { background: rgba(79,255,176,0.12); color: var(--accent); }
  .status-rejected { background: rgba(255,107,107,0.12); color: var(--accent2); }

  /* ─── TEAM TABLE ─── */
  .table-wrap { overflow-x: auto; }
  .table-wrap { -webkit-overflow-scrolling: touch; }

  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }

  thead th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
  }

  tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
    cursor: pointer;
  }

  tbody tr:hover { background: var(--surface2); }
  tbody tr:last-child { border-bottom: none; }

  tbody td {
    padding: 13px 16px;
    color: var(--text);
    vertical-align: middle;
  }

  .td-name { display: flex; align-items: center; gap: 10px; }

  .progress-bar {
    background: var(--surface2);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    width: 80px;
  }

  .progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
  }

  /* ─── MODAL ─── */
  .modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
  }

  .modal-overlay.open { opacity: 1; pointer-events: all; }

  .modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    width: 480px;
    max-width: 95vw;
    transform: translateY(20px);
    transition: transform 0.2s;
    overflow: hidden;
  }

  .modal-overlay.open .modal { transform: translateY(0); }

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

  .modal-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 17px;
  }

  .modal-close {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 30px; height: 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
  }

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

  .modal-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }

  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

  .form-group { display: flex; flex-direction: column; gap: 6px; }
  .form-group.full { grid-column: 1/-1; }

  label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  input, select, textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 10px 14px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.15s;
    outline: none;
  }

  input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,255,176,0.08);
  }

  select option { background: var(--surface2); }
  textarea { resize: vertical; min-height: 80px; }

  .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 10px;
  }

  /* ─── NOTIFICATION TOAST ─── */
  .toast {
    position: fixed;
    bottom: 28px; right: 28px;
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 14px 20px;
    display: flex; align-items: center; gap: 12px;
    font-size: 13px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(79,255,176,0.1);
    z-index: 200;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
  }

  .toast.show { transform: translateY(0); opacity: 1; }
  .toast-icon { font-size: 18px; }
  .toast-text { color: var(--text); }

  /* ─── SCROLLBAR ─── */
  ::-webkit-scrollbar { width: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

  /* ─── ANIMATIONS ─── */
  @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

  .stats-grid > * { animation: fadeIn 0.4s ease both; }
  .stats-grid > *:nth-child(1) { animation-delay: 0.05s; }
  .stats-grid > *:nth-child(2) { animation-delay: 0.1s; }
  .stats-grid > *:nth-child(3) { animation-delay: 0.15s; }
  .stats-grid > *:nth-child(4) { animation-delay: 0.2s; }

  .view { display: none; }
  .view.active { display: block; animation: fadeIn 0.3s ease both; }

  /* ─── TABS ─── */
  .tabs {
    display: flex; gap: 4px;
    background: var(--surface2);
    border-radius: 10px;
    padding: 4px;
  }

  .tab {
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
    border: none;
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    white-space: nowrap;
  }

  .tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
  }

  /* ─── SOLDE CARD ─── */
  .solde-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 24px;
  }

  .solde-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
  }

  .section-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
  }

  .search-input {
    width: 200px;
    padding: 7px 12px;
    font-size: 13px;
  }

  .solde-type { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
  .solde-number { font-family: 'Syne', sans-serif; font-size: 36px; font-weight: 800; line-height: 1; }
  .solde-unit { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

  .ring {
    width: 64px; height: 64px;
    border-radius: 50%;
    margin: 0 auto 12px;
    position: relative;
    display: flex; align-items: center; justify-content: center;
  }

  .ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
  .ring-bg { fill: none; stroke: var(--surface2); stroke-width: 5; }
  .ring-fill { fill: none; stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 1s ease; }

  @media (max-width: 1180px) {
    .stats-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .two-col {
      grid-template-columns: 1fr;
    }

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

  @media (max-width: 960px) {
    body.menu-open {
      overflow: hidden;
    }

    body.menu-open .sidebar-overlay {
      opacity: 1;
      pointer-events: auto;
    }

    body.menu-open .sidebar {
      transform: translateX(0);
    }

    .sidebar {
      position: fixed;
      top: 0;
      left: 0;
      bottom: 0;
      width: min(84vw, 320px);
      max-width: 320px;
      transform: translateX(-100%);
      transition: transform 0.24s ease;
      z-index: 30;
      overflow-y: auto;
      box-shadow: 0 24px 64px rgba(0,0,0,0.45);
    }

    .sidebar-close,
    .menu-toggle {
      display: inline-flex;
    }

    .topbar {
      padding: 16px 18px;
      flex-wrap: wrap;
      gap: 14px;
      align-items: flex-start;
    }

    .topbar-actions {
      width: 100%;
      flex-wrap: wrap;
    }

    .topbar-actions .btn {
      flex: 1 1 180px;
      justify-content: center;
    }

    .page-title {
      font-size: 20px;
      line-height: 1.1;
    }

    .page-title span {
      display: block;
      margin-left: 0;
      margin-top: 5px;
      font-size: 13px;
    }

    .content {
      padding: 20px 18px 28px;
    }

    .card-header,
    .modal-header,
    .modal-footer {
      gap: 12px;
      flex-wrap: wrap;
    }

    .card-header > *,
    .modal-header > *,
    .modal-footer > * {
      max-width: 100%;
    }

    .section-toolbar {
      flex-wrap: wrap;
      align-items: stretch;
    }

    .section-toolbar .tabs {
      width: 100%;
      overflow-x: auto;
    }

    .section-toolbar .btn {
      width: 100%;
      margin-left: 0 !important;
      justify-content: center;
    }

    .search-input {
      width: 100%;
    }

    .cal-month {
      min-width: 0;
      font-size: 14px;
    }

    .table-wrap table {
      min-width: 680px;
    }

    .modal {
      width: min(100vw - 24px, 480px);
      max-height: calc(100dvh - 24px);
      display: flex;
      flex-direction: column;
    }

    .modal-body {
      overflow-y: auto;
    }

    .toast {
      left: 16px;
      right: 16px;
      bottom: 16px;
    }
  }

  @media (max-width: 640px) {
    .stats-grid,
    .solde-grid {
      grid-template-columns: 1fr;
    }

    .content {
      padding: 18px 14px 24px;
    }

    .btn {
      padding: 10px 14px;
    }

    .card-header,
    .card-body,
    .modal-header,
    .modal-body,
    .modal-footer {
      padding-left: 16px;
      padding-right: 16px;
    }

    .cal-nav {
      width: 100%;
      justify-content: space-between;
    }

    .cal-grid {
      gap: 2px;
    }

    .cal-day-name {
      font-size: 10px;
      padding: 4px 0;
    }

    .cal-day {
      aspect-ratio: auto;
      min-height: 40px;
      font-size: 12px;
      padding: 4px 0;
    }

    .request-item {
      align-items: flex-start;
      flex-wrap: wrap;
    }

    .req-status {
      width: 100%;
      text-align: left;
    }

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

    .modal-footer .btn {
      width: 100%;
      justify-content: center;
    }

    .toast {
      padding: 12px 14px;
      font-size: 12px;
    }
  }
