* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Montserrat', Arial, sans-serif;
  background: var(--page-background) no-repeat center center fixed;
  background-size: cover;
  color: var(--text);
}

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

img {
  max-width: 100%;
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  background: var(--topbar-surface);
  border: 1px solid var(--topbar-border);
  border-radius: 28px;
  padding: 22px 24px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.brand-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
  display: block;
}

.title-block {
  min-width: 0;
  flex: 1 1 320px;
}

.title-block h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.title-block p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 600;
}

.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(var(--surface-rgb), 0.82);
  border: 1px solid var(--language-switch-border);
  box-shadow: var(--language-switch-shadow);
  backdrop-filter: blur(12px);
}

.lang-pill {
  min-width: 52px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  transition:
    background 0.22s ease,
    color 0.22s ease,
    transform 0.18s ease,
    box-shadow 0.22s ease,
    opacity 0.22s ease;
}

.lang-pill:hover {
  background: var(--lang-pill-hover-bg);
  color: var(--primary);
  transform: translateY(-1px);
}

.lang-pill:focus-visible,
.btn:focus-visible,
.header-detail-btn:focus-visible,
.detail-inline-btn:focus-visible,
.modal-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.lang-pill.active {
  background: var(--action-color);
  color: var(--action-contrast);
  box-shadow: var(--lang-pill-active-shadow);
}

.nav-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

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

.btn {
  border: 1px solid transparent;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
  box-shadow: var(--shadow-soft);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--button-hover-shadow);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: var(--action-color);
  color: var(--action-contrast);
  box-shadow: var(--action-shadow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--action-color-hover);
}

.btn-outline {
  background: rgba(var(--surface-rgb), 0.84);
  color: var(--primary);
  border-color: var(--button-outline-border);
}

.summary {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
}

.summary-card,
.section,
.panel,
.meta-item,
.day-card {
  background: rgba(var(--surface-rgb), 0.94);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.summary-card {
  border-radius: 22px;
  padding: 18px;
}

.summary-card .label {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.summary-card .value {
  font-size: 1.55rem;
  font-weight: 800;
}

.summary-card .sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.section {
  margin-top: 24px;
  border-radius: 28px;
  overflow: hidden;
}

.section-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, var(--section-header-start), var(--section-header-end));
}

.section-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.week-chip {
  background: var(--info);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.92rem;
}

.week-table-wrapper {
  padding: 20px;
  overflow-x: auto;
}

.week-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1100px;
  background: rgba(var(--surface-rgb), 1);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
}

.week-table th,
.week-table td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  vertical-align: top;
}

.week-table th:last-child,
.week-table td:last-child {
  border-right: none;
}

.week-table tr:last-child td,
.week-table tr:last-child th {
  border-bottom: none;
}

.week-table thead th {
  background: var(--table-head-bg-solid);
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 800;
  text-align: left;
  min-width: 145px;
}

.week-table thead th:first-child {
  width: 220px;
  min-width: 220px;
  background: var(--table-head-first-bg-solid);
}

.row-label {
  background: var(--row-label-bg-solid);
  font-weight: 700;
  color: var(--text);
  width: 220px;
  min-width: 220px;
}

.cell-title {
  font-weight: 800;
  font-size: 1rem;
}

.cell-subtitle {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.cell-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
}

.badge-calm { background: #4ca52f; }
.badge-normal { background: #5f95d0; }
.badge-charged { background: #f18700; }
.badge-critical { background: #d83d31; }

.variation-value {
  display: inline-block;
  margin-top: 8px;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  line-height: 1.2;
}

.variation-very-negative { background: #d83d31; color: #ffffff; }
.variation-negative { background: #f18700; color: #ffffff; }
.variation-neutral { background: #f2c94c; color: #000000; }
.variation-positive { background: #6cc04a; color: #ffffff; }
.variation-very-positive { background: #2f7a16; color: #ffffff; }

.weather-cell {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reco-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
}

.header-day {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.header-day .cell-title {
  margin: 0;
}

.header-detail-btn,
.detail-inline-btn {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--primary);
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}

.mobile-days {
  display: none;
  padding: 16px;
  gap: 14px;
}

.day-card {
  border-radius: 22px;
  padding: 16px;
}

.day-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.day-card-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.day-card-title .cell-title {
  font-size: 1.04rem;
}

.day-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--primary-dark);
  white-space: nowrap;
}

.day-status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #5f95d0;
  box-shadow: 0 0 0 4px rgba(95, 149, 208, 0.14);
}

.day-status.calm::before {
  background: #4ca52f;
  box-shadow: 0 0 0 4px rgba(76, 165, 47, 0.14);
}

.day-status.normal::before {
  background: #5f95d0;
  box-shadow: 0 0 0 4px rgba(95, 149, 208, 0.14);
}

.day-status.charged::before {
  background: #f18700;
  box-shadow: 0 0 0 4px rgba(241, 135, 0, 0.14);
}

.day-status.critical::before {
  background: #d83d31;
  box-shadow: 0 0 0 4px rgba(216, 61, 49, 0.14);
}

.day-status.closed {
  color: #666;
}

.day-status.closed::before {
  background: #b8b8b8;
  box-shadow: 0 0 0 4px rgba(184, 184, 184, 0.14);
}

.day-card-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.day-card-kpi {
  border: 1px solid var(--border);
  background: rgba(var(--surface-rgb), 0.9);
  border-radius: 16px;
  padding: 12px 10px;
  min-width: 0;
  text-align: center;
}

.day-card-kpi .day-card-item-label {
  margin-bottom: 8px;
  font-size: 0.74rem;
}

.day-card-kpi .cell-title {
  font-size: 0.98rem;
}

.day-card-kpi .cell-subtitle {
  margin-top: 6px;
  font-size: 0.8rem;
}

.day-card-kpi .variation-value {
  margin-top: 8px;
}

.day-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.day-card-item {
  border: 1px solid var(--border);
  background: rgba(var(--surface-rgb), 0.86);
  border-radius: 16px;
  padding: 12px;
  min-width: 0;
}

.day-card-item.full {
  grid-column: 1 / -1;
}

.day-card-item-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.day-card-item .reco-list {
  gap: 4px;
  font-size: 0.88rem;
}

.day-card-actions {
  margin-top: 14px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 50, 77, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2000;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  width: min(1200px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 28px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(23, 50, 77, 0.24);
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  background: rgba(var(--surface-rgb), 0.98);
  z-index: 2;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  font-weight: 700;
  flex: 0 0 auto;
}

.modal-body {
  padding: 20px;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr;
  gap: 20px;
  padding: 0;
}

.panel {
  border-radius: 22px;
  padding: 18px;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 1.08rem;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.meta-item {
  border-radius: 18px;
  padding: 12px;
}

.meta-item .k {
  color: var(--muted);
  font-size: 0.85rem;
}

.meta-item .v {
  margin-top: 5px;
  font-weight: 800;
  font-size: 1.12rem;
}


.detail-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-title-status {
  font-size: 0.95rem;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.detail-status-value {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.detail-status-value::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #5f95d0;
  box-shadow: 0 0 0 4px rgba(95, 149, 208, 0.14);
}

.detail-status-value.calm::before {
  background: #4ca52f;
  box-shadow: 0 0 0 4px rgba(76, 165, 47, 0.14);
}

.detail-status-value.normal::before {
  background: #5f95d0;
  box-shadow: 0 0 0 4px rgba(95, 149, 208, 0.14);
}

.detail-status-value.charged::before {
  background: #f18700;
  box-shadow: 0 0 0 4px rgba(241, 135, 0, 0.14);
}

.detail-status-value.critical::before {
  background: #d83d31;
  box-shadow: 0 0 0 4px rgba(216, 61, 49, 0.14);
}

.detail-weather-meta .detail-weather-icons {
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 5px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-color);
  font-size: 1.35rem;
  line-height: 1;
  letter-spacing: 1px;
}

.chart-box {
  background: linear-gradient(180deg, #fbfdff, #f6fbff);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  height: 360px;
  position: relative;
  overflow: hidden;
}

.grid-line {
  position: absolute;
  left: 16px;
  right: 16px;
  height: 1px;
  background: #e8eef5;
}

.grid-line:nth-child(1) { top: 60px; }
.grid-line:nth-child(2) { top: 110px; }
.grid-line:nth-child(3) { top: 160px; }
.grid-line:nth-child(4) { top: 210px; }
.grid-line:nth-child(5) { top: 260px; }
.grid-line:nth-child(6) { top: 310px; }

.chart-box > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.legend {
  position: absolute;
  left: 18px;
  bottom: 12px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--muted);
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border-radius: 4px;
  vertical-align: -2px;
}

.lg-pred::before { background: rgba(31,111,190,0.9); }
.lg-ci::before { background: rgba(108,192,74,0.35); }
.lg-n1::before { background: rgba(108,192,74,0.9); }

.hour-labels {
  position: absolute;
  left: 26px;
  right: 20px;
  bottom: 42px;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.text-block {
  color: var(--text);
  line-height: 1.55;
  font-size: 0.97rem;
}

.tag-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tag {
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: var(--normal);
  color: var(--primary-dark);
}

.tag.warning { background: var(--warning); color: #8d6200; }
.tag.success { background: var(--success); color: #2f7a16; }
.tag.danger { background: var(--danger); color: #a33a31; }

.closed-cell {
  background: #f5f5f5;
  color: #7a7a7a;
  text-align: center;
}

.closed-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  background: #ececec;
  color: #666;
}

.center-cell {
  text-align: center;
  vertical-align: middle;
}

.center-cell .cell-title,
.center-cell .cell-subtitle,
.center-cell .cell-badge,
.center-cell .weather-cell {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

#weekNote {
  padding: 0 20px 20px;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 1080px) {
  .summary { grid-template-columns: repeat(2, minmax(200px, 1fr)); }
  .detail-layout { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
}

@media (max-width: 860px) {
  .topbar-main {
    align-items: flex-start;
  }

  .title-block {
    flex-basis: 100%;
    order: 2;
  }

  .lang-switcher {
    order: 3;
  }

  .brand {
    order: 1;
  }

  .nav-actions-spread {
    gap: 10px;
  }

  .nav-actions-spread .btn {
    flex: 1 1 240px;
  }
}

@media (max-width: 700px) {
  body {
    background-attachment: scroll;
  }

  .container {
    padding: 14px;
  }

  .summary,
  .meta-grid,
  .day-card-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 16px;
    border-radius: 22px;
  }

  .topbar-main {
    gap: 14px;
  }

  .brand-logo {
    height: 28px;
  }

  .title-block h1 {
    font-size: 1.45rem;
  }

  .title-block p {
    font-size: 0.92rem;
  }

  .lang-switcher {
    align-self: flex-start;
  }

  .lang-pill {
    min-width: 46px;
    height: 36px;
    padding: 0 14px;
    font-size: 11px;
  }

  .section {
    border-radius: 22px;
  }

  .section-header {
    padding: 14px;
  }

  .nav-actions-spread {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .nav-actions-spread .btn {
    width: 100%;
    min-width: 0;
    padding: 0 10px;
    font-size: 0.92rem;
  }

  .week-table-wrapper {
    display: none;
  }

  .mobile-days {
    display: grid;
  }

  #weekNote {
    padding: 0 16px 16px;
  }

  .day-card {
    padding: 14px;
    border-radius: 18px;
  }

  .day-card-kpis {
    gap: 8px;
  }

  .day-card-kpi {
    padding: 10px 8px;
    border-radius: 14px;
  }

  .day-card-kpi .cell-title {
    font-size: 0.9rem;
  }

  .day-card-kpi .day-card-item-label {
    font-size: 0.68rem;
  }

  .day-card-header {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 12px;
  }

  .day-status {
    align-self: flex-start;
  }

  .header-detail-btn,
  .detail-inline-btn {
    min-height: 42px;
  }

  .modal-overlay {
    padding: 10px;
    align-items: flex-end;
  }

  .modal {
    width: 100%;
    max-height: min(92vh, 820px);
    border-radius: 24px 24px 0 0;
  }

  .modal-header {
    padding: 14px 16px;
    align-items: flex-start;
  }

  .modal-header h2 {
    font-size: 1.05rem;
    line-height: 1.3;
    padding-right: 8px;
  }

  .modal-body {
    padding: 14px;
  }

  .panel {
    padding: 14px;
    border-radius: 18px;
  }

  .chart-box {
    height: 280px;
    padding: 12px;
  }

  .hour-labels {
    left: 18px;
    right: 16px;
    bottom: 38px;
    font-size: 0.72rem;
  }

  .legend {
    left: 14px;
    right: 14px;
    bottom: 10px;
    gap: 10px;
    font-size: 0.78rem;
  }
}

@media (max-width: 420px) {
  .container {
    padding: 10px;
  }

  .topbar,
  .section {
    border-radius: 18px;
  }

  .topbar {
    padding: 14px;
  }

  .title-block h1 {
    font-size: 1.28rem;
  }

  .nav-actions-spread {
    grid-template-columns: 1fr;
  }

  .nav-actions-spread .btn {
    min-height: 42px;
  }

  .mobile-days {
    padding: 12px;
  }

  .day-card-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .day-card-kpi {
    padding: 10px 6px;
  }

  .day-card-kpi .cell-title {
    font-size: 0.84rem;
  }

  .day-card-kpi .day-card-item-label {
    font-size: 0.64rem;
    letter-spacing: 0.02em;
  }

  .modal {
    border-radius: 20px 20px 0 0;
  }

  .meta-item .v,
  .cell-title {
    word-break: break-word;
  }
}


.event-cell {
  position: relative;
}

.event-cell-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding-right: 0; /* ✅ on enlève le décalage */
}

.week-table .event-add-btn {
  position: absolute;
  right: 8px;   /* ajuste si besoin */
  top: 50%;
  transform: translateY(-50%);
}

.event-list {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.event-add-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--button-outline-border);
  background: rgba(var(--surface-rgb), 0.96);
  color: var(--primary);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.event-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--button-hover-shadow);
}

.week-table .event-add-btn {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
}

.week-table td.event-cell:hover .event-add-btn,
.week-table td.event-cell:focus-within .event-add-btn {
  opacity: 1;
  pointer-events: auto;
}

.day-card-context-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.35fr);
  gap: 10px;
}

.day-card-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.day-card-item-weather {
  align-items: center;
  text-align: center;
}

.day-card-item-weather .cell-title {
  font-size: 1.1rem;
  text-align: center;
  width: 100%;
}

.day-card-item-weather .weather-icons-only {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 28px;
}

.day-card-item-event .cell-title {
  font-size: 0.98rem;
}

.mobile-visible {
  flex: 0 0 auto;
}

.modal-compact {
  width: min(520px, 100%);
}

.event-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.event-form-row {
  display: grid;
}

.event-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.event-field-label {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
}

.event-input {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(var(--surface-rgb), 0.96);
  padding: 12px 14px;
  color: var(--text);
}

.event-input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.event-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 700px) {
  .day-card-context-row {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr);
  }

  .day-card-item-event .cell-title {
    font-size: 0.86rem;
  }

  .event-form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .event-form-actions .btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .day-card-context-row {
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    gap: 8px;
  }

  .day-card-item {
    padding: 10px;
  }

  .event-add-btn {
    width: 26px;
    height: 26px;
  }
}


.modal-header-rich,
.modal-footer-rich {
  padding: 22px 24px;
}

.modal-body-rich {
  padding: 22px 24px;
}

.modal-event {
  width: min(860px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modal-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.modal-body-rich {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-footer-rich {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  background: rgba(var(--surface-rgb), 0.98);
  position: sticky;
  bottom: 0;
  z-index: 3;
}

.event-modal-date-chip-wrap {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.event-date-chip-label,
.event-field-label {
  font-size: 11px;
  color: var(--primary);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.event-date-chip {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(var(--surface-rgb), 0.96), var(--surface-soft));
  font-weight: 700;
  color: var(--text);
}

.event-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.event-field {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.event-field-full {
  grid-column: 1 / -1;
}

.event-input,
.event-textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  background: rgba(var(--surface-rgb), 0.92);
  border-radius: 16px;
  padding: 0 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.event-input:focus,
.event-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.event-textarea {
  min-height: 120px;
  padding: 14px;
  resize: vertical;
}

.event-site-stack {
  display: grid;
  gap: 10px;
}

.event-multi-sites {
  display: none;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 12px 14px;
  max-height: 180px;
  overflow: auto;
}

.event-multi-site-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
}

.event-multi-site-option + .event-multi-site-option {
  border-top: 1px solid var(--border);
}

.event-multi-site-option.selected {
  color: var(--primary);
  font-weight: 600;
}

@media (max-width: 700px) {
  .modal-header-rich,
  .modal-body-rich,
  .modal-footer-rich {
    padding: 16px;
  }

  .modal-event {
    width: 100%;
    max-height: calc(100vh - 24px);
    border-radius: 22px;
  }

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

  .modal-footer-rich {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  background: rgba(var(--surface-rgb), 0.98);
  position: sticky;
  bottom: 0;
  z-index: 3;
}

.event-modal-date-chip-wrap {
    margin-bottom: 14px;
  }

  .event-date-chip {
    min-height: 44px;
    padding: 12px 14px;
  }

  .modal-footer-rich {
    flex-direction: column;
    align-items: stretch;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .modal-footer-rich .footer-actions {
    width: 100%;
    margin-left: 0;
  }

  .modal-footer-rich .footer-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}


/* Fix event modal layout */
.modal-event .footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.modal-event .footer-actions .btn {
  min-width: 132px;
  justify-content: center;
}

@media (max-width: 700px) {
  .modal-event {
    max-height: calc(100vh - 20px);
  }

  .modal-body-rich {
    padding-bottom: 12px;
  }

  .modal-event .footer-actions {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .modal-event .footer-actions .btn {
    width: 100%;
    min-width: 0;
  }
}

.event-edit-btn {
  font-size: 0.95rem;
}

.day-card-item-head .event-add-btn {
  flex: 0 0 auto;
}



.page {
  max-width: 1440px;
  margin: 0 auto;
}

body {
  padding: 32px;
  min-height: 100vh;
}

.container {
  padding: 0;
  max-width: 100%;
  margin: 96px auto 0;
}

.language-switch {
  position: fixed;
  top: 20px;
  right: 32px;
  z-index: 220;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(var(--surface-rgb), 0.78);
  border: 1px solid var(--language-switch-border);
  box-shadow: var(--language-switch-shadow);
  backdrop-filter: blur(12px);
}

.app-shell {
  display: flex;
  gap: 24px;
  align-items: stretch;
}

.sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: rgba(var(--surface-rgb), 0.72);
  border: 1px solid rgba(var(--surface-rgb), 0.78);
  border-radius: 28px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 64px);
  position: sticky;
  top: 24px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
  max-width: 150px;
  height: 34px;
  width: auto;
  object-fit: contain;
  display: block;
}

.sidebar-section-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.8;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  font-weight: 700;
  transition: 0.2s ease;
  position: relative;
}

.nav-item:hover {
  background: rgba(var(--surface-rgb), 0.55);
  border-color: var(--button-outline-border);
}

.nav-item.active {
  background: rgba(9, 31, 91, 0.05);
  border-color: var(--button-outline-border);
  color: var(--primary);
}

.nav-item-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex: 0 0 auto;
  border-radius: 10px;
  background: rgba(var(--surface-rgb), 0.55);
  border: 1px solid var(--button-outline-border);
  box-shadow: inset 0 1px 0 rgba(var(--surface-rgb), 0.45);
}

.nav-item.active .nav-item-icon {
  color: var(--primary);
  background: rgba(var(--surface-rgb), 0.78);
}

.nav-item-label {
  flex: 1 1 auto;
  min-width: 0;
}

.nav-item-chevron {
  color: var(--muted);
  font-size: 16px;
  flex: 0 0 auto;
  opacity: 0.8;
}

.sidebar-subnav {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  margin-left: 12px;
  padding-left: 14px;
  border-left: 1px solid var(--button-outline-border);
}

.subnav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  transition: 0.2s ease;
}

.subnav-item:hover {
  background: rgba(var(--surface-rgb), 0.5);
  color: var(--text);
}

.subnav-item.active {
  background: rgba(9, 31, 91, 0.08);
  color: var(--primary);
}

.subnav-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.46);
  border: 1px solid var(--button-outline-border);
  flex: 0 0 auto;
}

.content-area {
  flex: 1 1 auto;
  min-width: 0;
}

.mobile-nav-trigger,
.mobile-sidebar-backdrop,
.mobile-sidebar-close {
  display: none;
}

@media (max-width: 1100px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
    position: static;
  }

  body {
    padding: 20px;
  }
}

@media (max-width: 860px) {
  body {
    padding: 16px;
  }

  .language-switch {
    top: 12px;
    right: 16px;
    padding: 5px;
    gap: 4px;
  }

  .lang-pill {
    min-width: 46px;
    height: 36px;
    padding: 0 14px;
    font-size: 11px;
  }

  .app-shell {
    display: block;
  }

  .container {
    margin-top: 72px;
  }

  .mobile-nav-trigger {
    position: fixed;
    top: 12px;
    left: 16px;
    z-index: 225;
    width: 42px;
    height: 42px;
    border: 1px solid var(--button-outline-border);
    background: rgba(var(--surface-rgb), 0.92);
    color: var(--primary);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    padding: 0;
  }

  .mobile-nav-trigger svg {
    width: 20px;
    height: 20px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(310px, calc(100vw - 34px));
    max-width: 310px;
    min-height: 100vh;
    border-radius: 0 28px 28px 0;
    z-index: 240;
    transform: translateX(-106%);
    transition: transform 0.24s ease;
    overflow-y: auto;
  }

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

  .mobile-sidebar-close {
    display: inline-flex;
    align-self: flex-end;
    width: 40px;
    height: 40px;
    border: 1px solid var(--button-outline-border);
    background: rgba(var(--surface-rgb), 0.92);
    color: var(--primary);
    border-radius: 14px;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    margin-bottom: 12px;
  }

  .mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(3px);
    z-index: 230;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    display: block;
  }

  .mobile-sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }
}



/* =========================================================
   FINAL PRED HEADER + WEEK NAV LAYOUT
   ========================================================= */

.page {
  max-width: 1440px;
  margin: 96px auto 0;
}

/* Header card like Events */
.hero {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px 28px;
  border-radius: 28px;
  background:
    linear-gradient(
      135deg,
      var(--hero-gradient-start, rgba(37, 0, 191, 0.06)),
      var(--hero-gradient-end, rgba(131, 102, 255, 0.03))
    ),
    rgba(var(--surface-rgb, 255, 255, 255), 0.85);
  border: 1px solid var(--hero-border, rgba(221, 214, 255, 0.95));
  box-shadow:
    0 12px 28px rgba(37, 0, 191, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
}

.hero-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
}

.hero-copy {
  max-width: 640px;
  min-width: 0;
}

.hero h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.hero-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 600;
}

/* Week navigation above table like Horaires */
.pred-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  padding: 22px 22px 0;
}

.pred-week-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.pred-week-nav-row .btn {
  min-width: 220px;
}

.pred-week-nav-row #prevWeekBtn {
  margin-right: auto;
  justify-content: flex-start;
}

.pred-week-nav-row #nextWeekBtn {
  margin-left: auto;
  justify-content: flex-end;
}

/* Neutralize old header action styles if present */
.hero-actions-row {
  display: none !important;
}

@media (max-width: 900px) {
  .page {
    margin-top: 72px;
  }

  .hero {
    padding: 16px;
    gap: 12px;
    border-radius: 22px;
  }

  .hero-main {
    display: block;
  }

  .hero h1 {
    font-size: 28px;
    line-height: 1.1;
  }

  .hero-copy {
    max-width: 100%;
    min-width: 0;
  }

  .pred-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px 16px 0;
  }

  .pred-week-nav-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .pred-week-nav-row .btn {
    width: 100%;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
    justify-content: center !important;
  }
}

@media (max-width: 640px) {
  .hero h1 {
    font-size: 26px;
  }
}



/* Persistent page header */
.page-top-header {
  position: sticky;
  top: 16px;
  z-index: 220;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  justify-content: space-between;
  margin: 16px auto 18px;
  padding: 14px 18px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, var(--hero-gradient-start, rgba(37, 0, 191, 0.06)), var(--hero-gradient-end, rgba(131, 102, 255, 0.03))),
    rgba(var(--surface-rgb, 255, 255, 255), 0.88);
  border: 1px solid var(--hero-border, rgba(221, 214, 255, 0.95));
  box-shadow: var(--shadow-soft, 0 18px 44px rgba(37, 0, 191, 0.12));
  backdrop-filter: blur(14px);
}

.page-top-header-title {
  flex: 1 1 auto;
  min-width: 0;
}

.page-top-header-title .hero-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}


.page-top-header-title-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.page-top-header-client-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 44px;
  display: block;
}

.page-top-header-title {
  min-width: 0;
}

.page-top-header-title h1,
.page-top-header-title .page-top-header-title-text {
  margin: 0;
  font-size: clamp(28px, 2.5vw, 38px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: var(--text, #040019);
}

.page-top-header-title p,
.page-top-header-title .subtle,
.page-top-header-title .hero-subtitle,
.page-top-header-title .page-top-header-subtitle {
  margin: 0 !important;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-muted, rgba(4, 0, 25, 0.68));
}

.page-top-header-right {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  min-width: fit-content;
}

body.with-fixed-top-header .language-switch {
  position: static !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  bottom: auto !important;
  margin: 0;
  z-index: auto;
}

body.with-fixed-top-header .page {
  margin-top: 24px !important;
}

body.with-fixed-top-header .hero {
  margin-top: 0;
}

body.with-fixed-top-header .hero-main {
  min-height: 0;
}

body.with-fixed-top-header .hero h1.page-title-relocated,
body.with-fixed-top-header .hero .page-subtitle-relocated {
  display: none !important;
}

@media (max-width: 980px) {

  .page-top-header-title-wrapper {
    gap: 10px;
    align-items: center;
  }

  .page-top-header-client-logo {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .page-top-header {
    top: 12px;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 20px;
  }

  .page-top-header-title h1,
  .page-top-header-title .page-top-header-title-text {
    font-size: 22px;
    line-height: 1.1;
  }

  .page-top-header-title p,
  .page-top-header-title .subtle,
  .page-top-header-title .hero-subtitle,
  .page-top-header-title .page-top-header-subtitle {
    font-size: 14px;
  }
}

@media (max-width: 720px) {
  .page-top-header {
    top: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }

  .page-top-header-title {
    order: 2;
    width: 100%;
  }

  .page-top-header-title h1,
  .page-top-header-title .page-top-header-title-text {
    font-size: 24px;
  }

  .page-top-header-right {
    order: 1;
    margin-left: auto;
  }

  body.with-fixed-top-header .page {
    margin-top: 12px !important;
  }
}

body:has(.modal-overlay.open) .page-top-header,
body:has(.modal-overlay.open) .language-switch {
  display: none !important;
}


/* Desktop week view: center content in each day column */
@media (min-width: 861px) {
  .week-table thead th:not(:first-child) {
    text-align: center;
  }

  .week-table thead th:not(:first-child) .header-day {
    align-items: center;
  }

  .week-table tbody td.center-cell {
    text-align: center;
    vertical-align: middle;
  }

  .week-table tbody td.center-cell .cell-title,
  .week-table tbody td.center-cell .cell-subtitle,
  .week-table tbody td.center-cell .cell-badge,
  .week-table tbody td.center-cell .weather-cell,
  .week-table tbody td.center-cell .variation-value {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }

  .week-table tbody td.center-cell .reco-list {
    display: inline-flex;
    align-items: center;
    text-align: center;
    padding-left: 0;
    list-style-position: inside;
  }

  .week-table tbody td.center-cell .event-cell-content {
    justify-content: center;
  }
}


/* Desktop week view: center weather icons correctly */
@media (min-width: 861px) {
  .week-table tbody td.center-cell .weather-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
  }
}


/* Mobile: center weather icons inside card */
@media (max-width: 860px) {
  .day-card-item .weather-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
  }

  .day-card-item .weather-cell img,
  .day-card-item .weather-cell svg {
    margin: 0 auto;
    display: block;
  }
}


/* Mobile week view: Prévision and N-1 side by side using full width */
@media (max-width: 860px) {
  .day-card-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 12px;
    align-items: stretch;
  }

  .day-card-kpi {
    width: 100%;
    min-width: 0;
  }
}


/* Mobile week view: Prévision and N-1 side by side on full width */
@media (max-width: 860px) {
  .day-card-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 12px;
    align-items: stretch;
  }

  .day-card-kpi {
    width: 100%;
    min-width: 0;
  }
}
