:root {
  --ink: #0a2f63;
  --muted: #58708f;
  --line: #d7e8f5;
  --paper: #ffffff;
  --bg: #f6fbff;
  --brand: #0b63ce;
  --accent: #19b7b0;
  --warn: #d98b20;
  --danger: #b63b3b;
  --shadow: 0 18px 42px rgba(7, 52, 111, 0.1);
}

:root[data-theme="dark"] {
  --ink: #e6f2ff;
  --muted: #9fb7d3;
  --line: #244766;
  --paper: #102033;
  --bg: #071522;
  --brand: #39a6ff;
  --accent: #27d3bd;
  --warn: #f3b04f;
  --danger: #ef6b6b;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

button, input, select, textarea { font: inherit; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  background: var(--accent);
  color: #042033;
  font-weight: 900;
  left: 1rem;
  padding: 0.7rem 1rem;
  position: fixed;
  top: 1rem;
  transform: translateY(-140%);
  z-index: 10;
}

.skip-link:focus {
  transform: translateY(0);
}

button {
  background: var(--brand);
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  min-height: 42px;
  padding: 0.65rem 0.9rem;
}

button.ghost {
  background: #e7eef5;
  color: var(--ink);
}

:root[data-theme="dark"] button.ghost {
  background: #1b3650;
}

button.danger {
  background: var(--danger);
  color: #fff;
}

.compact-button {
  font-size: 0.82rem;
  min-height: 32px;
  padding: 0.35rem 0.55rem;
}

.icon-button {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 1.05rem;
  height: 40px;
  justify-content: center;
  min-height: 40px;
  padding: 0;
  width: 40px;
}

.theme-icon {
  line-height: 1;
}

.topbar {
  align-items: center;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 72px;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  position: sticky;
  top: 0;
  z-index: 2;
}

.brand {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  text-decoration: none;
}

.brand > span {
  display: grid;
  gap: 0.1rem;
}

.brand-logo {
  background: #fff;
  border: 1px solid #dbeaf5;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(7, 52, 111, 0.08);
  height: 52px;
  object-fit: contain;
  padding: 0.25rem;
  width: 52px;
}

.brand strong { font-size: 1.15rem; }
.brand span, .muted, small { color: var(--muted); }
.top-actions { align-items: center; display: flex; gap: 0.75rem; }

.header-link {
  align-items: center;
  border-radius: 6px;
  display: inline-flex;
  font-weight: 800;
  min-height: 40px;
  padding: 0 0.85rem;
  text-decoration: none;
}

.language-picker select,
.top-actions select {
  min-height: 36px;
  min-width: 70px;
}

.visually-hidden {
  height: 1px;
  margin: -1px;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

main {
  margin: 0 auto;
  max-width: 1440px;
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 3rem;
}

.app-menu {
  background: #e7eef5;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
}

.app-menu button {
  background: transparent;
  color: var(--ink);
}

.app-menu button.active {
  background: var(--paper);
  box-shadow: 0 4px 12px rgba(22, 32, 51, 0.12);
}

.login-card, .panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.site-footer {
  align-items: center;
  background: var(--paper);
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.site-footer a {
  color: var(--brand);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a,
a:visited {
  color: var(--brand);
}

.login-card {
  margin: 3rem auto;
  max-width: 440px;
}

.landing {
  align-items: center;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.05fr) minmax(280px, 440px);
  min-height: calc(100vh - 170px);
}

.landing-copy {
  display: grid;
  gap: 1rem;
}

.landing-copy h1 {
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1.02;
  margin: 0;
}

.landing-copy p:not(.eyebrow) {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 620px;
}

.google-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(7, 52, 111, 0.08);
  color: var(--ink);
  display: inline-flex;
  font-weight: 900;
  justify-content: center;
  min-height: 46px;
  padding: 0.7rem 1rem;
  text-decoration: none;
  width: fit-content;
}

.google-button::before {
  background: conic-gradient(from -40deg, #4285f4 0 25%, #34a853 0 50%, #fbbc05 0 75%, #ea4335 0);
  border-radius: 50%;
  content: "";
  height: 18px;
  margin-right: 0.6rem;
  width: 18px;
}

.app-link {
  color: var(--brand);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 4px;
  width: fit-content;
}

.landing .login-card {
  margin: 0;
}

.landing-seo {
  display: grid;
  gap: 1rem;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 1rem;
}

.landing-seo article {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}

.landing-seo h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.landing-seo p {
  color: var(--muted);
  margin: 0;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 220px);
  place-items: center;
}

.planning-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.preview-head {
  align-items: center;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  color: #fff;
  display: flex;
  justify-content: space-between;
  padding: 1rem;
}

.preview-head span { font-weight: 800; }

.preview-grid {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  padding: 1rem;
}

.preview-grid span {
  aspect-ratio: 1;
  background: #edf5fb;
  border: 1px solid #d7e8f5;
  border-radius: 6px;
  color: var(--muted);
  display: grid;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.15;
  place-items: center;
  text-align: center;
}

.preview-grid .leave {
  background: #dff8f7;
  border-color: #9ce4df;
  color: #05605c;
}

.preview-grid .leave.alt {
  background: #e7f0ff;
  border-color: #b6d1ff;
  color: #0a4ca0;
}

.preview-grid .leave.soft {
  background: #fff2da;
  border-color: #ffd28a;
  color: #775016;
}

.simulation-panel {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.65rem;
  padding: 1rem;
}

.simulation-panel p {
  color: var(--muted);
  margin: 0;
}

.simulation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.simulation-actions button {
  min-height: 34px;
  padding: 0.4rem 0.6rem;
}

.simulation-actions button.active {
  background: var(--brand);
  color: #fff;
}

.gate {
  background: linear-gradient(0deg, rgba(10, 47, 99, 0.16), rgba(10, 47, 99, 0));
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  padding: 1rem;
  pointer-events: none;
  position: fixed;
  right: 0;
  z-index: 2000;
}

.gate-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 760px;
  padding: 1.25rem;
  pointer-events: auto;
  width: min(760px, calc(100vw - 2rem));
}

.gate-card ol {
  color: var(--muted);
  font-weight: 700;
  padding-left: 1.25rem;
}

h1, h2, h3, p { margin-top: 0; }
.eyebrow {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.page-heading, .section-title {
  align-items: end;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.page-heading h1 { margin-bottom: 0; }
.form-grid, form { display: grid; gap: 0.75rem; }
label { color: var(--muted); display: grid; font-weight: 800; gap: 0.35rem; }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  width: 100%;
}

.inline-check {
  align-content: end;
  align-items: center;
  display: flex;
  gap: 0.5rem;
  min-height: 66px;
}

.inline-check input {
  width: auto;
}

.year-picker { min-width: 150px; }

.planning-controls {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: end;
}

.inline-planning-controls {
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  justify-content: start;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
}

.agent-filter {
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
}

.filter-heading {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.filter-heading > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.agent-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.agent-check {
  align-items: center;
  background: #eef4fa;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-size: 0.86rem;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0.25rem 0.6rem;
}

.agent-check input {
  margin: 0;
  width: auto;
}

.planning-controls label {
  min-width: 140px;
}

.segmented {
  background: #e7eef5;
  border-radius: 8px;
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
}

.segmented button {
  background: transparent;
  color: var(--ink);
  min-height: 38px;
  padding: 0.45rem 0.75rem;
}

.segmented button.active {
  background: var(--paper);
  box-shadow: 0 4px 12px rgba(22, 32, 51, 0.12);
}

.type-picker {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  padding: 0.7rem;
}

.planning-toolbar {
  align-items: end;
  display: grid;
  gap: 0.9rem;
  grid-template-columns: minmax(280px, 1.2fr) minmax(320px, 1fr) minmax(220px, 0.8fr) auto;
  margin-bottom: 1rem;
}

.leave-type-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.type-button {
  align-items: center;
  border: 2px solid transparent;
  display: grid;
  gap: 0.05rem;
  min-height: 50px;
  min-width: 96px;
  padding: 0.42rem 0.65rem;
}

.type-button span {
  font-weight: 900;
}

.type-button small {
  color: inherit;
  opacity: 0.86;
}

.type-button.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(22, 32, 51, 0.12);
}

.toolbar-fields {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rules-panel {
  margin-bottom: 1rem;
}

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

.type-picker legend {
  color: var(--muted);
  font-weight: 900;
  padding: 0 0.25rem;
}

.type-picker label {
  align-items: center;
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: center;
  min-height: 40px;
}

.type-picker input {
  margin: 0 0.35rem 0 0;
  width: auto;
}

.selected-box {
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
}

.selected-days {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.selected-days span {
  color: var(--muted);
}

.selected-chip {
  background: #dff1f4;
  color: #13586a;
  font-size: 0.82rem;
  min-height: 32px;
  padding: 0.3rem 0.55rem;
}

.submit-actions {
  display: grid;
  gap: 0.45rem;
}

.balances {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  margin-bottom: 1rem;
}

.balances article {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.2rem;
  padding: 1rem;
}

.balances span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.balances strong {
  color: var(--brand);
  font-size: 2.2rem;
  line-height: 1;
}

.work-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(280px, 410px) minmax(0, 1fr);
  margin-bottom: 1rem;
}

.rules {
  display: grid;
  gap: 0.6rem;
}

.rules p {
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0;
  padding: 0.75rem;
}

.help-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.help-grid article {
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0.4rem;
  padding: 0.9rem;
}

.help-grid h3,
.help-grid p {
  margin: 0;
}

.shift-alerts,
.shift-ok {
  border-radius: 8px;
  margin-bottom: 0.75rem;
  padding: 0.8rem;
}

.shift-alerts {
  background: #fff4e5;
  border: 1px solid #f1c27a;
  color: #7a4300;
}

.shift-alerts p {
  margin: 0.35rem 0 0;
}

.shift-ok {
  background: #e8f7ef;
  border: 1px solid #a8ddbd;
  color: #17613c;
  font-weight: 800;
}

.shift-grid {
  display: grid;
  gap: 0.65rem;
}

.shift-day {
  align-items: start;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(120px, 0.55fr) repeat(3, minmax(0, 1fr));
  padding: 0.75rem;
}

.shift-day-conflict {
  border-color: #f1c27a;
  box-shadow: inset 4px 0 0 var(--warn);
}

.shift-date,
.shift-column {
  display: grid;
  gap: 0.2rem;
}

.shift-column span {
  color: var(--muted);
}

.shift-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  grid-column: 1 / -1;
}

.shift-editor button {
  font-size: 0.78rem;
  min-height: 30px;
  padding: 0.28rem 0.45rem;
}

.shift-editor button.service {
  background: #0b63ce;
  color: #fff;
}

.shift-editor button.rest {
  background: #e9eef5;
  color: #40546f;
}

.shift-editor button.blocked {
  background: #f9dfdf;
  color: var(--danger);
  cursor: not-allowed;
}

.list {
  display: grid;
  gap: 0.65rem;
}

.row {
  align-items: center;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding: 0.75rem;
}

.row-main { display: grid; gap: 0.15rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.row-provisoire {
  opacity: 0.78;
}

.validation-actions {
  display: grid;
  gap: 0.45rem;
  min-width: 260px;
}

.validation-actions textarea {
  min-height: 64px;
}

.decision-choice {
  color: var(--muted);
  display: grid;
  font-size: 0.85rem;
  font-weight: 800;
  gap: 0.25rem;
}

.validation-footer {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.validation-footer p {
  margin: 0;
}

.status {
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 0.32rem 0.55rem;
}

.previsionnel { background: #e7eef5; color: #46566b; }
.provisoire { background: #fff1cc; color: #805600; }
.valide { background: #dff4ea; color: #23664e; }
.refuse { background: #f9dfdf; color: var(--danger); }

.type-ca {
  background: #c93939;
  color: #fff;
}

.type-ca_n1 {
  background: #8f2f45;
  color: #fff;
}

.type-rtt {
  background: #1f6fd1;
  color: #fff;
}

.type-caf {
  background: #7b4ec4;
  color: #fff;
}

.type-hp {
  background: #de8b28;
  color: #fff;
}

.type-formation {
  background: #2f8f6b;
  color: #fff;
}

.type-autre {
  background: #6f7785;
  color: #fff;
}

.type-astreinte {
  background: #3d4f67;
  color: #fff;
}

.calendar {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.calendar.single-month {
  grid-template-columns: minmax(0, 860px);
}

.calendar.year-view {
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
}

.month {
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.month h3 {
  background: #eaf1f7;
  margin: 0;
  padding: 0.65rem 0.8rem;
}

.weekdays, .days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekdays {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  padding: 0.35rem 0.45rem 0;
  text-align: center;
}

.days { gap: 0.25rem; padding: 0.45rem; }

.day {
  aspect-ratio: 1;
  background: #fff;
  border: 1px solid #e8eef5;
  border-radius: 6px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  padding: 0.25rem;
  text-align: left;
}

.calendar.single-month .day {
  aspect-ratio: auto;
  min-height: 112px;
}

.day.has-leave {
  border-color: #9fb3c7;
  box-shadow: inset 0 0 0 1px #c1d0df;
}

.day.has-shift {
  border-color: #a9d8d5;
}

.day.target-occupied {
  background-image: linear-gradient(135deg, rgba(22, 32, 51, 0.06) 25%, transparent 25%, transparent 50%, rgba(22, 32, 51, 0.06) 50%, rgba(22, 32, 51, 0.06) 75%, transparent 75%, transparent);
  background-size: 10px 10px;
}

.calendar.year-view .day {
  aspect-ratio: auto;
  min-height: 58px;
}

.day:first-child { grid-column-start: calc(var(--offset) + 1); }
.day > span { color: #46566b; font-size: 0.78rem; font-weight: 800; }
.holiday { background: #eef8f2; border-color: #bae1cd; }
.pentecost { outline: 2px solid var(--warn); outline-offset: -2px; }
.has-astreinte {
  border-color: #3d4f67;
  box-shadow: inset 0 0 0 2px rgba(61, 79, 103, 0.28);
}

.holiday-tag {
  background: #d8efe2;
  border: 1px solid #acd9bf;
  border-radius: 4px;
  color: #23664e;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.05;
  overflow: hidden;
  padding: 0.1rem 0.18rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.non-working {
  background: #f1f4f7;
  border-color: #d6e0ea;
  color: #8b99a8;
}

.non-working > span {
  color: #8b99a8;
}

.non-working:not(.has-leave) {
  opacity: 0.72;
}

.day.selected {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 2px var(--brand);
}

.pill {
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.67rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.1;
  overflow: hidden;
  padding: 0.12rem 0.2rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill.previsionnel,
.pill.provisoire {
  opacity: 0.58;
}

.shift-pill {
  cursor: default;
}

.shift-service {
  background: color-mix(in srgb, var(--agent-color, #19b7b0) 20%, #ffffff);
  border-left: 4px solid var(--agent-color, #19b7b0);
  color: #123a4a;
}

.shift-repos {
  background: #e9eef5;
  color: #40546f;
}

.shift-more {
  background: #e8f7ef;
  color: #17613c;
}

.color-swatch {
  border: 1px solid rgba(10, 47, 99, 0.24);
  border-radius: 999px;
  display: inline-block;
  height: 0.75rem;
  margin-right: 0.4rem;
  vertical-align: -0.08rem;
  width: 0.75rem;
}

.shift-save-actions {
  align-items: center;
  margin-bottom: 0.75rem;
}

.calendar.year-view .pill {
  font-size: 0.72rem;
  padding: 0.16rem 0.24rem;
}

.leave-tooltip {
  background: rgba(22, 32, 51, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  box-shadow: 0 14px 34px rgba(22, 32, 51, 0.24);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  left: 0;
  line-height: 1.35;
  max-width: min(320px, calc(100vw - 28px));
  padding: 0.65rem 0.75rem;
  pointer-events: none;
  position: fixed;
  top: 0;
  white-space: pre-line;
  z-index: 1000;
}

.leave-tooltip[hidden] {
  display: none;
}

.history-year {
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
}

.history-agent {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(7, 52, 111, 0.06);
  padding: 0.8rem;
}

.history-agent + .history-agent {
  margin-top: 0.75rem;
}

.history-agent > summary {
  color: var(--ink);
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 900;
}

.history-agent .history-year {
  margin-top: 0.75rem;
}

.history-year summary {
  cursor: pointer;
  font-weight: 900;
}

.history-year summary span {
  color: var(--muted);
  font-size: 0.82rem;
  margin-left: 0.45rem;
}

.history-year .list {
  margin-top: 0.75rem;
}

.pill.provisoire,
.pill.valide,
.pill.refuse {
  color: #fff;
}

.holiday-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.holiday-legend span {
  background: #eef8f2;
  border: 1px solid #bae1cd;
  border-radius: 999px;
  color: #23664e;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.28rem 0.55rem;
}

.astreinte-panel textarea {
  min-height: 220px;
  resize: vertical;
  white-space: pre-wrap;
}

.user-form,
.service-form,
.account-form,
.leave-type-form {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin: 1rem 0;
}

.leave-type-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.service-form {
  grid-template-columns: minmax(220px, 1fr) auto;
}

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

.account-form button,
.account-form p {
  align-self: end;
}

.privacy-box {
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
  padding: 1rem;
}

.privacy-box h3,
.privacy-box p {
  margin: 0;
}

:root[data-theme="dark"] .google-button,
:root[data-theme="dark"] .planning-preview,
:root[data-theme="dark"] .simulation-panel,
:root[data-theme="dark"] .login-card,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .admin-card,
:root[data-theme="dark"] .row,
:root[data-theme="dark"] .privacy-box,
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: var(--paper);
  border-color: var(--line);
  color: var(--ink);
}

:root[data-theme="dark"] .app-menu,
:root[data-theme="dark"] .compact-button,
:root[data-theme="dark"] .type-button,
:root[data-theme="dark"] .calendar-day,
:root[data-theme="dark"] .selected-days span,
:root[data-theme="dark"] .agent-filter-list label {
  background: #0d2236;
  border-color: var(--line);
  color: var(--ink);
}

:root[data-theme="dark"] a,
:root[data-theme="dark"] a:visited,
:root[data-theme="dark"] .app-link,
:root[data-theme="dark"] .site-footer a {
  color: #7dccff;
}

:root[data-theme="dark"] .brand-logo,
:root[data-theme="dark"] .landing-seo article,
:root[data-theme="dark"] .gate-card,
:root[data-theme="dark"] .inline-planning-controls,
:root[data-theme="dark"] .agent-filter,
:root[data-theme="dark"] .type-picker label,
:root[data-theme="dark"] .selected-box,
:root[data-theme="dark"] .rules p,
:root[data-theme="dark"] .help-grid article,
:root[data-theme="dark"] .shift-day,
:root[data-theme="dark"] .month,
:root[data-theme="dark"] .day,
:root[data-theme="dark"] .history-agent,
:root[data-theme="dark"] .history-year,
:root[data-theme="dark"] .privacy-box {
  background: #0d2236;
  border-color: var(--line);
  color: var(--ink);
}

:root[data-theme="dark"] .planning-preview,
:root[data-theme="dark"] .preview-grid span,
:root[data-theme="dark"] .month h3,
:root[data-theme="dark"] .segmented,
:root[data-theme="dark"] .app-menu,
:root[data-theme="dark"] .selected-chip,
:root[data-theme="dark"] .shift-editor button.rest {
  background: #142b42;
  border-color: var(--line);
  color: var(--ink);
}

:root[data-theme="dark"] .preview-grid .leave {
  background: #123f45;
  border-color: #237b78;
  color: #bdf8f4;
}

:root[data-theme="dark"] .preview-grid .leave.alt {
  background: #12335f;
  border-color: #2f72bd;
  color: #d3e9ff;
}

:root[data-theme="dark"] .preview-grid .leave.soft,
:root[data-theme="dark"] .shift-alerts {
  background: #3a2b13;
  border-color: #7a5a23;
  color: #ffd995;
}

:root[data-theme="dark"] .shift-ok,
:root[data-theme="dark"] .holiday {
  background: #123522;
  border-color: #2c7247;
  color: #aee8c4;
}

:root[data-theme="dark"] .day.has-leave {
  border-color: #5f7c98;
  box-shadow: inset 0 0 0 1px #355674;
}

:root[data-theme="dark"] .non-working {
  background-color: #14263a;
}

:root[data-theme="dark"] .previsionnel {
  background: #26384e;
  color: #d4e4f4;
}

:root[data-theme="dark"] .provisoire {
  background: #4a3712;
  color: #ffd88a;
}

:root[data-theme="dark"] .valide {
  background: #163d2a;
  color: #b8eccd;
}

:root[data-theme="dark"] .refuse,
:root[data-theme="dark"] .shift-editor button.blocked {
  background: #4a1e27;
  color: #ffb5c1;
}

.compact .row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.error { color: var(--danger); font-weight: 800; }

@media (max-width: 980px) {
  .landing {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .page-heading, .section-title, .row, .topbar, .planning-controls, .filter-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .balances, .work-grid, .user-form, .service-form, .account-form, .leave-type-form, .type-picker, .planning-toolbar, .toolbar-fields, .inline-rules, .help-grid, .shift-day, .landing-seo {
    grid-template-columns: 1fr;
  }
}
