/* Public page — contenu centré, lignes pleine largeur */
.public-page {
  --page-max-width: 1320px;
  --page-padding-x: 1.5rem;
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 769px) {
  .public-page {
    --page-padding-x: clamp(2rem, 5vw, 4rem);
  }
}

@media (min-width: 1200px) {
  .public-page {
    --page-padding-x: clamp(3rem, 6vw, 5rem);
  }
}

.page-inset {
  width: 100%;
  max-width: var(--page-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--page-padding-x);
  padding-right: var(--page-padding-x);
}

/* Barre haute — logo + métadonnées */
.top-bar {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.top-bar__inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding-top: 1rem;
  padding-bottom: 1.35rem;
}

.top-bar__left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  min-width: 0;
  flex: 1;
  align-self: stretch;
  padding-top: 0.15rem;
}

.top-bar__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.top-bar__title {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 200;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  margin-top: auto;
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

.site-logo {
  opacity: 0.35;
  transition: opacity 0.15s;
  line-height: 0;
}

.top-bar__brand:hover .site-logo {
  opacity: 0.6;
}

.site-logo img {
  display: block;
  height: 11px;
  width: auto;
}

.top-bar__label {
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  opacity: 0.45;
}

.top-bar__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: right;
}

.top-bar__meta-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.top-bar__meta dt {
  font-weight: 400;
}

.top-bar__meta dt::after {
  content: ' :';
}

.top-bar__meta dd {
  margin: 0;
  color: var(--color-text);
  font-weight: 500;
}

.top-bar__meta .badge {
  font-weight: 500;
}

/* Rounds — bas de page, à droite de la timeline */
.rounds-panel {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex-shrink: 0;
}

.rounds-panel--footer {
  align-items: flex-end;
  text-align: right;
  padding-bottom: 0.15rem;
}

.rounds-panel__title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
}

.rounds-panel__counts {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
}

.rounds-panel__realized {
  color: var(--color-accent);
}

.rounds-panel--over .rounds-panel__realized {
  color: var(--color-danger);
}

.rounds-panel__sep,
.rounds-panel__estimated {
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Brief */
.brief-section {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.brief-section__summary {
  padding: 1rem 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.brief-section__summary::-webkit-details-marker {
  display: none;
}

.brief-section__summary-inner {
  display: block;
}

.brief-section__summary-inner::before {
  content: '+ ';
  font-weight: 400;
}

.brief-section[open] .brief-section__summary-inner::before {
  content: '− ';
}

.brief-section[open] .brief-section__summary {
  border-bottom: 1px solid var(--color-border);
}

.brief-section__body {
  padding-top: 1.25rem;
  padding-bottom: 1.5rem;
  display: grid;
  grid-template-columns: 4fr 1fr 1fr;
  align-items: stretch;
}

.brief-section__col {
  min-width: 0;
  padding: 0 1.25rem;
  border-right: 1px solid var(--color-border);
}

.brief-section__col:first-child {
  padding-left: 0;
}

.brief-section__col:last-child {
  padding-right: 0;
  border-right: none;
}

.brief-section__text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--color-text);
}

.brief-section__empty {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.brief-section__col-label {
  margin: 0 0 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.brief-section__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.brief-section__list li {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--color-text);
}

.brief-section__list a {
  color: var(--color-accent);
  text-decoration: none;
}

.brief-section__list a:hover {
  text-decoration: underline;
}

.brief-section__list .file-unavailable {
  color: var(--color-text-muted);
  font-style: italic;
}

/* Kanban — une colonne par version */
.kanban {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 1.5rem;
  background: var(--color-surface-muted);
}

.kanban__inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 0;
}

.kanban__scroll {
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.kanban__board {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  width: 100%;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.kanban__board::after {
  content: '';
  flex-shrink: 0;
  width: 1.25rem;
}

.kanban__board-empty {
  width: 100%;
  text-align: center;
  padding: 3rem 1rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.kanban__column {
  flex: 1;
  min-width: 400px;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.kanban__column--feedback-pending {
  border-color: #e8a838;
  box-shadow: 0 0 0 1px #e8a838;
}

.kanban__column--unused {
  opacity: 0.38;
  background: #f0f0ee;
  border: 1px dashed #e8e8e4;
  box-shadow: none;
}

.kanban__column--unused .kanban__column-header {
  background: transparent;
  border-bottom-color: #ececea;
}

.kanban__column--unused .badge {
  background: #efefec;
  color: #a8a8a2;
}

.kanban__column--unused .kanban__column-title,
.kanban__column--unused .kanban__column-etat,
.kanban__column--unused .kanban__empty--unused {
  color: #a8a8a2;
}

.kanban__column--done {
  opacity: 0.72;
}

.kanban__column--done .kanban__feedback summary,
.kanban__column--done .kanban__feedback-text,
.kanban__column--done .kanban__feedback-author,
.kanban__column--done .kanban__feedback-date {
  color: var(--color-text-muted);
}

.kanban__column--done .kanban__feedback--pending .kanban__feedback-text {
  color: var(--color-text-muted);
  font-style: italic;
}

.kanban__column--done .kanban__feedback-bubble {
  background: #efefec;
  border-color: #e0e0dc;
}

.kanban__column-header {
  padding: 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.kanban__column--feedback-pending .kanban__column-header {
  background: #fef9e7;
}

.kanban__column-header-left {
  min-width: 0;
}

.kanban__column-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
}

.kanban__column-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

.kanban__column-date {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.kanban__column-etat {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--color-text);
}

.kanban__column-badge {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.kanban__column-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.kanban__files-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: 0.2rem;
}

.kanban__column .file-list {
  gap: 0.1rem;
}

.kanban__column .file-list a,
.kanban__column .file-list .file-unavailable {
  padding: 0.1rem 0;
  line-height: 1.35;
}

.kanban__empty {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Feedback déroulant */
.kanban__feedback {
  margin-top: auto;
  border-top: 1px solid var(--color-border);
  padding-top: 0.65rem;
}

.kanban__feedback summary {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.kanban__feedback summary::-webkit-details-marker {
  display: none;
}

.kanban__feedback summary::before {
  content: '+ ';
  font-weight: 400;
}

.kanban__feedback[open] summary::before {
  content: '− ';
}

.kanban__feedback--pending summary {
  color: #b45309;
}

.kanban__feedback-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

.kanban__feedback-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
}

.kanban__feedback-item:has(.kanban__feedback-author) {
  gap: 0.4rem;
}

.kanban__feedback-author {
  margin: 0 0 0 0.15rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-text-muted);
  line-height: 1.2;
}

.kanban__feedback-bubble {
  position: relative;
  max-width: 100%;
  padding: 0.5rem 0.7rem;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: 0.65rem;
  box-shadow: 0 1px 2px rgba(26, 26, 24, 0.04);
}

.kanban__feedback-date {
  margin: 0.3rem 0 0 0.15rem;
  font-size: 0.62rem;
  color: var(--color-text-muted);
}

.kanban__feedback-text {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--color-text);
  white-space: pre-wrap;
}

.kanban__feedback--pending .kanban__feedback-text {
  margin-top: 0.35rem;
  color: #b45309;
  font-style: italic;
}

.kanban__feedback-text--empty {
  color: var(--color-text-muted);
  font-style: italic;
}

/* Livraison finale */
.delivery-section {
  padding: 2rem 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.delivery-section__inner {
  text-align: center;
}

.delivery-section__label {
  margin: 0 0 1rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
}

.delivery-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}

.delivery-btn:hover {
  background: #1e3329;
  text-decoration: none;
}

/* Timeline — bas de page */
.timeline {
  padding: 2rem 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.timeline__inner {
  width: 100%;
}

.timeline__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
}

.timeline__track {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 0.25rem;
}

.timeline__track::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.timeline__progress {
  position: absolute;
  top: 14px;
  left: 14px;
  height: 2px;
  background: var(--color-accent);
  z-index: 1;
  transition: width 0.4s ease;
  max-width: calc(100% - 28px);
}

.timeline__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  position: relative;
  z-index: 2;
  min-width: 0;
}

.date-mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
}

.timeline__dot {
  width: 28px;
  height: 28px;
  border-radius: 0;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: border-color 0.3s, background 0.3s, color 0.3s;
  flex-shrink: 0;
}

.timeline__step--done .timeline__dot {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.timeline__step--current .timeline__dot {
  border-color: var(--color-accent);
  color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

.timeline__step--unused .timeline__dot {
  background: #f4f4f2;
  border-color: #e0e0dc;
  color: #c8c8c2;
}

.timeline__step--unused .timeline__label {
  color: #c8c8c2;
}

.timeline__label {
  font-size: 0.7rem;
  text-align: center;
  color: var(--color-text-muted);
  max-width: 80px;
  line-height: 1.3;
  word-break: break-word;
}

.timeline__step--done .timeline__label {
  color: var(--color-accent);
  font-weight: 500;
}

/* Error page */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 2rem;
}

.error-page h1 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.error-page p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .kanban__board {
    flex-wrap: nowrap;
    width: max-content;
    min-width: 100%;
  }

  .kanban__column {
    flex: 0 0 400px;
    max-width: 400px;
  }

  /* Brief — 3 sections empilées */
  .brief-section__body {
    padding-top: 1rem;
    padding-bottom: 1.25rem;
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .brief-section__col {
    padding: 1rem;
    border-right: none;
    border-bottom: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
  }

  .brief-section__col:first-child {
    padding: 1rem;
  }

  .brief-section__col:last-child {
    padding: 1rem;
  }

  .brief-section__col-label {
    font-size: 0.7rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
  }

  .brief-section__text {
    font-size: 0.9rem;
    line-height: 1.65;
  }

  .brief-section__list li {
    font-size: 0.85rem;
    padding: 0.2rem 0;
  }

  .timeline__footer {
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
  }

  .rounds-panel--footer {
    align-self: flex-end;
  }
}

@media (max-width: 640px) {
  .top-bar__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .top-bar__meta {
    align-items: flex-start;
    text-align: left;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .timeline__label {
    font-size: 0.6rem;
    max-width: 56px;
  }

  .timeline__dot {
    width: 22px;
    height: 22px;
    font-size: 0.6rem;
  }

  .timeline__track::before,
  .timeline__progress {
    top: 11px;
  }

  .public-page {
    --page-padding-x: 1rem;
  }

  .brief-section__body {
    gap: 0.6rem;
  }

  .brief-section__col {
    padding: 0.85rem;
  }

  .rounds-panel__counts {
    font-size: 1.25rem;
  }
}

/* Accès protégé par mot de passe */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: var(--color-bg);
}

.auth-page__inner {
  width: 100%;
  max-width: 380px;
}

.auth-page__logo {
  display: inline-block;
  opacity: 0.35;
  margin-bottom: 2rem;
  line-height: 0;
}

.auth-page__logo img {
  height: 11px;
  width: auto;
}

.auth-page__title {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  font-weight: 200;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.auth-page__intro {
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.auth-form__label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.auth-form__input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font: inherit;
  font-size: 0.95rem;
  color: var(--color-text);
}

.auth-form__input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.auth-form__submit {
  margin-top: 0.35rem;
  padding: 0.8rem 1rem;
  border: none;
  background: var(--color-accent);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.auth-form__submit:hover:not(:disabled) {
  background: #1e3329;
}

.auth-form__submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-form__error {
  margin: 0.85rem 0 0;
  font-size: 0.8rem;
  color: var(--color-danger);
}
