/* Unit4Bridge Dashboard — Style centralisé */

:root {
  --color-bg: #f5f6fa;
  --color-surface: #ffffff;
  --color-border: #e1e4e8;
  --color-text: #24292f;
  --color-text-secondary: #656d76;
  --color-primary: #0969da;
  --color-primary-hover: #0550ae;
  --color-success: #1a7f37;
  --color-success-bg: #dafbe1;
  --color-warning: #9a6700;
  --color-warning-bg: #fff8c5;
  --color-error: #cf222e;
  --color-error-bg: #ffebe9;
  --color-idle: #6e7781;
  --color-idle-bg: #eaeef2;
  --color-busy: #0969da;
  --color-busy-bg: #ddf4ff;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* --- Layout --- */

.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}

.header__nav {
  display: flex;
  gap: 4px;
}

.header__nav a {
  padding: 6px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.header__nav a:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.header__nav a.active {
  background: var(--color-primary);
  color: #fff;
}

.header__client {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.header__client select {
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--color-surface);
  color: var(--color-text);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 20px;
}

/* --- Cards --- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card__title {
  font-size: 16px;
  font-weight: 600;
}

.card__body {
  padding: 20px;
}

.card + .card { margin-top: 16px; }

/* --- Grid --- */

.grid {
  display: grid;
  gap: 16px;
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* --- Stat boxes --- */

.stat-box {
  text-align: center;
  padding: 20px;
}

.stat-box__value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
}

.stat-box__label {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* --- Badge / Status --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge--ok    { background: var(--color-success-bg); color: var(--color-success); }
.badge--warn  { background: var(--color-warning-bg); color: var(--color-warning); }
.badge--error { background: var(--color-error-bg);   color: var(--color-error); }
.badge--idle  { background: var(--color-idle-bg);    color: var(--color-idle); }
.badge--busy  { background: var(--color-busy-bg);    color: var(--color-busy); }

.badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* --- Tables --- */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  background: var(--color-bg);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  letter-spacing: 0.03em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:hover td { background: #f8f9fb; }

td.number { text-align: right; font-variant-numeric: tabular-nums; }
td.center { text-align: center; }

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
  font-family: var(--font);
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
}
.btn--primary:hover { background: var(--color-primary-hover); }

.btn--outline {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn--outline:hover { background: var(--color-bg); }

.btn--danger {
  background: var(--color-error);
  color: #fff;
}
.btn--danger:hover { background: #a40e26; }

.btn--sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Forms --- */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--color-text-secondary);
}

.form-group select,
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="month"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  background: var(--color-surface);
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.15);
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-row .form-group { margin-bottom: 0; }

/* --- Drop zone --- */

.dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--color-primary);
  background: rgba(9, 105, 218, 0.04);
}

.dropzone__icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.dropzone__text {
  font-size: 15px;
  color: var(--color-text-secondary);
}

.dropzone__text strong {
  color: var(--color-primary);
}

/* --- Pivot table --- */

.pivot-table {
  font-size: 12px;
}

.pivot-table th,
.pivot-table td {
  padding: 6px 8px;
  text-align: center;
  min-width: 36px;
}

.pivot-table th.collab-header {
  text-align: left;
  min-width: 150px;
  position: sticky;
  left: 0;
  background: var(--color-bg);
  z-index: 2;
}

.pivot-table td.collab-cell {
  text-align: left;
  font-weight: 500;
  position: sticky;
  left: 0;
  background: var(--color-surface);
  z-index: 1;
  min-width: 150px;
}

.pivot-table td.weekend {
  background: #f0f0f0;
  color: var(--color-text-secondary);
}

.pivot-table td.has-value {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-primary);
}

.pivot-table td.has-value:hover {
  background: var(--color-busy-bg);
}

.pivot-table td.total-cell {
  font-weight: 700;
  background: var(--color-bg);
}

.pivot-table tr.total-row td {
  font-weight: 700;
  background: var(--color-bg);
  border-top: 2px solid var(--color-border);
}

/* Week group headers */
.pivot-table th.week-header {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.pivot-table th.week-even { background: #f0f4f8; }
.pivot-table th.week-odd  { background: var(--color-bg); }

/* --- Side panel --- */

.side-panel {
  position: fixed;
  top: 56px;
  right: -400px;
  width: 400px;
  height: calc(100vh - 56px);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  transition: right 0.25s ease;
  overflow-y: auto;
}

.side-panel.open { right: 0; }

.side-panel__header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
}

.side-panel__close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--color-text-secondary);
}

.side-panel__body {
  padding: 20px;
}

/* --- Alerts / Messages --- */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert--success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid #aceebb; }
.alert--error   { background: var(--color-error-bg);   color: var(--color-error);   border: 1px solid #ffcecb; }
.alert--warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid #ecd570; }
.alert--info    { background: var(--color-busy-bg);    color: var(--color-busy);    border: 1px solid #a8d7ff; }

/* --- Checkbox list (collaborators) --- */

.checkbox-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px;
}

.checkbox-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.checkbox-list li:hover { background: var(--color-bg); }

/* --- Loading spinner --- */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px;
  color: var(--color-text-secondary);
  font-size: 14px;
}

/* --- Empty state --- */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-secondary);
}

.empty-state__icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* --- Utilities --- */

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-secondary); }
.text-mono { font-family: var(--font-mono); font-size: 13px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
.gap-4 { gap: 4px; }

/* --- Badge variants --- */
.badge--info    { background: var(--color-busy-bg);    color: var(--color-busy); }
.badge--success { background: var(--color-success-bg); color: var(--color-success); }

/* --- Button extras --- */
.btn--xs {
  padding: 2px 8px;
  font-size: 11px;
}

.btn--outline.btn--danger {
  background: transparent;
  border-color: var(--color-error);
  color: var(--color-error);
}
.btn--outline.btn--danger:hover {
  background: var(--color-error-bg);
}

.btn-link {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 14px;
  line-height: 1;
}
.btn-link:hover { opacity: 0.7; }

/* --- Form elements (standalone) --- */
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.form-input {
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  background: var(--color-surface);
}
.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.15);
}

/* --- Table compact --- */
.table--compact th,
.table--compact td {
  padding: 6px 10px;
  font-size: 13px;
}

/* --- Modal --- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.modal__content {
  position: relative;
  z-index: 1;
  width: 90%;
  animation: modalIn 0.15s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* --- Agenda --- */

.container--wide { max-width: 1600px; }

.agenda-filters {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.agenda-filters__nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agenda-filters__month {
  font-size: 16px;
  font-weight: 600;
  min-width: 140px;
  text-align: center;
}

.agenda-filters__mode {
  display: flex;
  gap: 4px;
}

.agenda-filters__options {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-left: auto;
}

.agenda-filters__label {
  font-size: 13px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.agenda-filters__label select {
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--color-surface);
}

/* Agenda table */
.agenda-table {
  font-size: 11px;
}

.agenda-table th,
.agenda-table td {
  padding: 4px 2px;
  text-align: center;
  min-width: 32px;
  max-width: 60px;
}

.agenda-day-name {
  font-size: 10px;
  font-weight: 400;
  color: var(--color-text-secondary);
}

/* Cells */
.agenda-cell {
  font-size: 11px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: transform 0.1s;
}

.agenda-cell:not(.weekend):hover {
  transform: scale(1.1);
  z-index: 5;
  position: relative;
}

.agenda-cell.weekend {
  background: #f0f0f0;
}

.agenda-cell--transferred { background: var(--color-success-bg); color: var(--color-success); }
.agenda-cell--ready       { background: var(--color-busy-bg);    color: var(--color-busy); }
.agenda-cell--draft       { background: var(--color-warning-bg); color: var(--color-warning); }
.agenda-cell--unknown     { background: var(--color-idle-bg);    color: var(--color-idle); }

.agenda-cell--full {
  font-weight: 700;
}

.agenda-cell--partial {
  font-style: italic;
  opacity: 0.85;
}

.agenda-cell--missing {
  color: var(--color-error);
  opacity: 0.4;
  font-size: 10px;
}

.agenda-cell--internal {
  color: var(--color-text-secondary);
  opacity: 0.4;
}

.agenda-cell--client {
  color: #333;
  font-size: 10px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Legend */
.agenda-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.agenda-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.agenda-legend__swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.1);
}

/* Tooltip */
.agenda-tooltip {
  position: absolute;
  z-index: 300;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.5;
  max-width: 350px;
  pointer-events: none;
}

.agenda-tooltip hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 6px 0;
}
