:root {
  --sidebar-w: 268px;
  --bg-app: #f1f5f9;
  --bg-sidebar: #0b1220;
  --bg-sidebar-hover: #172033;
  --accent: #5b21b6;
  --accent-2: #db2777;
  --accent-soft: #ede9fe;
  --text-sidebar: #e2e8f0;
  --text-muted-sidebar: #94a3b8;
  --border: #e2e8f0;
  --card-bg: #ffffff;
  --navy: #0f172a;
  --green-shift: #dcfce7;
  --green-shift-text: #166534;
  --green-border: #86efac;
  --morning-bg: #fef3c7;
  --morning-text: #92400e;
  --morning-border: #fcd34d;
  --off-bg: #ffe4e6;
  --off-text: #9f1239;
  --off-border: #fda4af;
  --conge-bg: #dbeafe;
  --conge-text: #1d4ed8;
  --conge-border: #93c5fd;
}
body.dark-mode {
  --bg-app: #070b12;
  --bg-sidebar: #05080f;
  --bg-sidebar-hover: #121826;
  --accent-soft: #2e1065;
  --border: #1f2937;
  --card-bg: #0f1623;
  --navy: #e2e8f0;
  color: #e2e8f0;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg-app);
  min-height: 100vh;
  color: var(--navy);
}
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background:
    radial-gradient(800px 280px at 0% 0%, rgba(219,39,119,.18), transparent 55%),
    radial-gradient(600px 240px at 100% 20%, rgba(91,33,182,.22), transparent 50%),
    var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1040;
}
.sidebar-brand {
  padding: 1.15rem 1.1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255,255,255,.96);
  padding: 4px;
}
.sidebar-brand a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1.3;
  letter-spacing: 0.02em;
  display: block;
}
.sidebar-brand small {
  display: block;
  color: var(--text-muted-sidebar);
  font-weight: 400;
  font-size: .72rem;
  margin-top: .2rem;
}
.sidebar-nav { flex: 1; padding: .75rem .65rem; overflow-y: auto; }
.nav-section {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted-sidebar);
  padding: .75rem .75rem .35rem;
  font-weight: 600;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .85rem;
  border-radius: 10px;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: .9rem;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: var(--bg-sidebar-hover); color: #fff; }
.sidebar-nav a.active {
  background: linear-gradient(120deg, #7c3aed, #db2777);
  color: #fff;
  font-weight: 600;
}
.sidebar-nav a i { font-size: 1.1rem; opacity: .95; }
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .8rem;
  color: var(--text-muted-sidebar);
}
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.main-content { padding: 1.5rem; flex: 1; }
.page-heading-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  background: linear-gradient(125deg, #5b21b6 0%, #db2777 55%, #f59e0b 140%);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: 0 5px 18px rgba(91, 33, 182, 0.28);
}
.page-banner {
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(120deg, #5b21b6 0%, #7c3aed 40%, #db2777 100%);
  color: #fff;
  border: 1px solid rgba(255,255,255,.15);
}
.page-banner p { margin: 0; opacity: .95; font-size: .92rem; }
.card-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
  padding: 1.25rem;
}
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(219,39,119,.18), transparent 55%),
    radial-gradient(800px 380px at 100% 0%, rgba(91,33,182,.2), transparent 50%),
    radial-gradient(700px 300px at 50% 110%, rgba(245,158,11,.12), transparent 45%),
    #f8fafc;
}
.login-card {
  width: 100%;
  max-width: 430px;
  border-radius: 18px;
  border: 1px solid rgba(226,232,240,.95);
  background: rgba(255,255,255,.96);
  box-shadow: 0 24px 60px rgba(15, 23, 42, .12);
  overflow: hidden;
}
.login-card .login-hero {
  padding: 1.35rem 1.5rem 1rem;
  text-align: center;
  background: linear-gradient(135deg, rgba(91,33,182,.08), rgba(219,39,119,.08));
  border-bottom: 1px solid #eef2f7;
}
.login-card .login-hero img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: .65rem;
}
.login-card .brand {
  font-weight: 800;
  letter-spacing: .02em;
  color: #0f172a;
  font-size: 1.05rem;
}

/* ---- Aqua / water panels (Planning + Congé) ---- */
.aqua-banner {
  background:
    linear-gradient(115deg, rgba(8, 145, 178, .92) 0%, rgba(14, 116, 144, .9) 42%, rgba(6, 182, 212, .88) 100%) !important;
  border: 1px solid rgba(165, 243, 252, .35) !important;
  box-shadow: 0 12px 28px rgba(8, 145, 178, .22);
  position: relative;
  overflow: hidden;
}
.aqua-banner::after {
  content: "";
  position: absolute;
  inset: auto -10% -60% -10%;
  height: 140%;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(255,255,255,.28), transparent 55%),
    radial-gradient(ellipse at 80% 0%, rgba(165, 243, 252, .35), transparent 50%);
  pointer-events: none;
}
.aqua-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 18px !important;
  border: 1px solid rgba(103, 232, 249, .45) !important;
  background:
    linear-gradient(165deg, rgba(255,255,255,.82), rgba(224, 242, 254, .72) 45%, rgba(207, 250, 254, .65)),
    #ecfeff !important;
  box-shadow:
    0 18px 40px rgba(8, 145, 178, .14),
    inset 0 1px 0 rgba(255,255,255,.75) !important;
  backdrop-filter: blur(10px);
}
.aqua-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .55;
  background:
    radial-gradient(900px 220px at 8% -20%, rgba(34, 211, 238, .28), transparent 60%),
    radial-gradient(700px 260px at 100% 0%, rgba(14, 165, 233, .2), transparent 55%),
    radial-gradient(500px 180px at 50% 120%, rgba(6, 182, 212, .18), transparent 50%);
}
.aqua-panel > * { position: relative; z-index: 1; }

/* ---- Congé water sheet ---- */
.conge-sheet-wrap { overflow: hidden; }
.conge-sheet {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
}
.conge-sheet th,
.conge-sheet td {
  border: 1px solid rgba(14, 116, 144, .22);
  text-align: center;
  vertical-align: middle;
  padding: 0.78rem 0.7rem;
  font-weight: 700;
}
.conge-sheet thead th {
  background: linear-gradient(180deg, #fff7cc 0%, #fde68a 100%);
  color: #0f172a;
  white-space: nowrap;
  font-size: 0.86rem;
  border-bottom: 2px solid rgba(14, 116, 144, .28);
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
}
.conge-sheet thead th.conge-head-name {
  background: linear-gradient(180deg, #a5f3fc 0%, #67e8f9 55%, #22d3ee 100%);
  color: #0c4a6e;
  text-align: center;
}
.conge-sheet .conge-name {
  background: linear-gradient(90deg, rgba(186, 230, 253, .95), rgba(165, 243, 252, .88));
  color: #0c4a6e;
  text-align: center;
  white-space: nowrap;
  min-width: 168px;
  border-bottom: 1px solid rgba(14, 116, 144, .28);
  box-shadow: inset 4px 0 0 #06b6d4;
}
.conge-sheet tbody tr + tr .conge-name {
  border-top: 1px solid rgba(14, 116, 144, .18);
}
.conge-sheet tbody tr:hover .conge-name {
  background: linear-gradient(90deg, #bae6fd, #99f6e4);
}
.conge-sheet .conge-date,
.conge-sheet .conge-months {
  color: #1e3a8a;
  background: rgba(255,255,255,.72);
}
.conge-sheet .conge-earned,
.conge-sheet .conge-balance {
  color: #0284c7;
  background: rgba(255,255,255,.78);
  font-size: 1.02rem;
}
.conge-sheet .conge-taken {
  color: #dc2626;
  background: rgba(255, 241, 242, .85);
  font-size: 1.02rem;
}
.conge-sheet .conge-actions {
  background: rgba(240, 249, 255, .9);
  font-weight: 600;
}
.conge-sheet .conge-input {
  font-weight: 700;
  text-align: center;
  border-radius: 8px;
  border-color: rgba(14, 116, 144, .28);
}

/* ---- Planning water grid ---- */
.name-col { min-width: 190px; white-space: nowrap; }
.date-col { min-width: 110px; font-size: 0.85rem; }
.planning-table-wrap { overflow-x: auto; }
.planning-table {
  margin: 0;
  background: transparent;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}
.planning-table thead th {
  background: linear-gradient(180deg, #fff7cc 0%, #fde68a 100%) !important;
  font-weight: 700;
  vertical-align: middle;
  color: #0f172a;
  border-color: rgba(14, 116, 144, .22) !important;
  text-align: center;
}
.planning-table thead th .date-sub {
  color: #64748b !important;
  font-weight: 500;
}
.planning-table thead th.name-col-head {
  background: linear-gradient(180deg, #a5f3fc 0%, #67e8f9 50%, #22d3ee 100%) !important;
  color: #0c4a6e !important;
  text-align: center !important;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: .82rem;
  border-bottom: 2px solid rgba(14, 116, 144, .35) !important;
}
.planning-table th.plan-name {
  background: linear-gradient(90deg, rgba(186, 230, 253, .98), rgba(165, 243, 252, .9)) !important;
  color: #0c4a6e;
  font-weight: 800;
  text-align: center !important;
  letter-spacing: 0.01em;
  border-color: rgba(14, 116, 144, .22) !important;
  box-shadow: inset 4px 0 0 #06b6d4;
  padding: .85rem .75rem !important;
}
.planning-table tbody tr:hover th.plan-name {
  background: linear-gradient(90deg, #bae6fd, #99f6e4) !important;
  color: #083344;
}
.planning-table td {
  border-color: rgba(14, 116, 144, .22) !important;
  vertical-align: middle;
  background-clip: padding-box;
}
.planning-table tbody th.plan-name,
.planning-table tbody td {
  border-top: 1px solid rgba(14, 116, 144, .22) !important;
  border-bottom: 1px solid rgba(14, 116, 144, .22) !important;
  border-left: 1px solid rgba(14, 116, 144, .22) !important;
  border-right: 1px solid rgba(14, 116, 144, .22) !important;
}
.planning-table tbody tr + tr th.plan-name,
.planning-table tbody tr + tr td {
  /* same light aqua line between each mailer row */
  border-top-color: rgba(14, 116, 144, .22) !important;
}
.plan-select {
  min-width: 118px;
  max-width: 140px;
  margin: 0 auto;
  font-size: 0.82rem;
  border: 1px solid transparent;
  background: transparent;
  text-align: center;
  font-weight: 700;
  color: inherit;
}
.plan-select:focus {
  box-shadow: none;
  background: #fff;
  border-color: var(--accent);
  color: #0f172a;
}
.cell-label { font-size: 0.9rem; font-weight: 700; }
.cell-evening {
  background: var(--green-shift) !important;
  color: var(--green-shift-text);
}
.cell-morning {
  background: var(--morning-bg) !important;
  color: var(--morning-text);
}
.cell-off {
  background: var(--off-bg) !important;
  color: var(--off-text);
}
.cell-conge {
  background: var(--conge-bg) !important;
  color: var(--conge-text);
}
.cell-shift {
  background: #f1f5f9 !important;
  color: #334155;
}
.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,.08);
}
.legend-dot.evening { background: var(--green-shift); border-color: var(--green-border); }
.legend-dot.morning { background: var(--morning-bg); border-color: var(--morning-border); }
.legend-dot.off { background: var(--off-bg); border-color: var(--off-border); }
.legend-dot.conge { background: var(--conge-bg); border-color: var(--conge-border); }
body.dark-mode .topbar,
body.dark-mode .card-panel,
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .planning-table,
body.dark-mode .table {
  background: var(--card-bg);
  color: #e2e8f0;
  border-color: var(--border);
}
body.dark-mode .planning-table thead th {
  background: linear-gradient(180deg, #3f3a22, #2a2618) !important;
  color: #fef9c3;
}
body.dark-mode .planning-table thead th.name-col-head {
  background: linear-gradient(180deg, #164e63, #0e7490) !important;
  color: #ecfeff !important;
}
body.dark-mode .planning-table th.plan-name {
  background: linear-gradient(90deg, #0c4a6e, #155e75) !important;
  color: #e0f2fe;
  box-shadow: inset 4px 0 0 #22d3ee;
  border-bottom-color: rgba(34, 211, 238, .28) !important;
}
body.dark-mode .aqua-panel {
  background: linear-gradient(165deg, rgba(15,22,35,.92), rgba(8,47,73,.88)) !important;
  border-color: rgba(34, 211, 238, .28) !important;
  box-shadow: 0 18px 40px rgba(0,0,0,.35) !important;
}
body.dark-mode .conge-sheet-wrap { border-color: rgba(34, 211, 238, .28); }
body.dark-mode .conge-sheet th,
body.dark-mode .conge-sheet td { border-color: rgba(34, 211, 238, .2); }
body.dark-mode .conge-sheet thead th {
  background: linear-gradient(180deg, #3f3a22, #2a2618);
  color: #fef9c3;
}
body.dark-mode .conge-sheet thead th.conge-head-name {
  background: linear-gradient(180deg, #164e63, #0e7490);
  color: #ecfeff;
}
body.dark-mode .conge-sheet .conge-name {
  background: linear-gradient(90deg, #0c4a6e, #155e75);
  color: #e0f2fe;
  box-shadow: inset 4px 0 0 #22d3ee;
}
body.dark-mode .conge-sheet .conge-date,
body.dark-mode .conge-sheet .conge-months,
body.dark-mode .conge-sheet .conge-earned,
body.dark-mode .conge-sheet .conge-balance,
body.dark-mode .conge-sheet .conge-taken,
body.dark-mode .conge-sheet .conge-actions {
  background: rgba(15, 22, 35, .75);
}
body.dark-mode .text-muted { color: #94a3b8 !important; }
body.dark-mode .plan-select:focus { background: #0b0f14; }
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1035;
  }
  .sidebar-backdrop.show { display: block; }
}
