/* Cockpit : une bande bleu-gris en haut, avec les lignes à décider. Dessous, la feuille du journal. */

:root {
  --panel: #4a5e70;       /* bleu-gris de tableau de bord */
  --panel-deep: #3a4b5a;  /* le casier qui tient les lignes à décider */
  --sheet: #f2f4f3;       /* la feuille du journal */
  --paper: #fcfcfa;       /* une ligne à décider */
  --ink: #16232c;
  --ink-soft: #4c5b66;
  --rule: #cdd5d8;
  --amber: #f2a900;       /* attend une action */
  --green: #1f7a4a;       /* fait */
  --red: #b3261e;         /* panne */
  --on-panel: #ffffff;
  --on-panel-soft: #e3eaee;

  --display: Bahnschrift, "DIN Alternate", "Roboto Condensed", "Arial Narrow", sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(1rem, 4vw, 3rem);
  --wide: 76rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.5;
}

[hidden] {
  display: none !important;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h2 {
  font-family: var(--display);
  font-stretch: 87.5%;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

/* --- Boutons --- */

.btn {
  min-height: 2.75rem;
  padding: 0.5rem 1.125rem;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}

.btn:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
}

.btn-go {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.btn-go:hover:not(:disabled) {
  border-color: var(--ink);
}

/* Bouton armé : un second clic déclenche l'action. */
.btn-go.is-armed,
.btn-go.is-armed:hover:not(:disabled) {
  border-color: var(--amber);
  background: var(--amber);
  color: var(--ink);
}

.btn-quiet {
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.link {
  padding: 0.25rem 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.link-on-panel {
  color: var(--on-panel-soft);
}

.link-on-panel:focus-visible {
  outline-color: var(--on-panel);
}

/* --- Bande du haut --- */

.band {
  background: var(--panel);
  color: var(--on-panel);
}

.band-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.25rem var(--gutter) 2.25rem;
}

.topline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.5rem;
}

.brand {
  font-family: var(--display);
  font-size: 1.3125rem;
  font-weight: 600;
}

.today {
  margin-right: auto;
  color: var(--on-panel-soft);
}

.headline {
  margin-top: 2.25rem;
  font-family: var(--display);
  font-stretch: 87.5%;
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 600;
  line-height: 1.05;
}

.subline {
  margin-top: 0.5rem;
  color: var(--on-panel-soft);
  font-size: 1.125rem;
}

/* --- Casier des lignes à décider --- */

.rack {
  display: grid;
  gap: 0.375rem;
  margin: 1.75rem 0 0;
  padding: 0.375rem;
  border-radius: 3px;
  background: var(--panel-deep);
  list-style: none;
}

.strip {
  padding: 0.875rem 1.125rem 1rem;
  border-left: 0.5rem solid var(--amber);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
}

.strip.is-error {
  border-left-color: var(--red);
}

.strip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.strip-agent {
  font-family: var(--display);
  font-weight: 600;
}

.strip-time {
  color: var(--ink-soft);
  font-size: 0.875rem;
  white-space: nowrap;
}

.strip-text {
  max-width: 70ch;
  margin-top: 0.125rem;
  font-size: 1.3125rem;
  line-height: 1.35;
}

.strip-error {
  max-width: 70ch;
  margin-top: 0.5rem;
  color: var(--red);
  font-weight: 600;
}

.detail {
  margin-top: 0.5rem;
}

.longtext {
  max-width: 70ch;
  margin: 0.375rem 0 0;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.draft {
  margin-top: 0.875rem;
  padding-left: 0.875rem;
  border-left: 2px solid var(--rule);
}

.draft-label {
  display: block;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.draft-editor {
  display: block;
  width: 100%;
  max-width: 70ch;
  min-height: 12rem;
  margin-top: 0.375rem;
  padding: 0.75rem;
  border: 1.5px solid var(--ink-soft);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.strip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* --- Feuille : journal à gauche, objectif et agents à droite --- */

.sheet {
  display: grid;
  gap: 3rem;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 2rem;
}

.side {
  display: grid;
  gap: 3rem;
  align-content: start;
}

@media (min-width: 62rem) {
  .sheet {
    grid-template-columns: minmax(0, 1fr) 21rem;
    gap: 4.5rem;
  }
}

/* Sur petit écran, l'objectif et les agents passent avant le journal. */
@media (max-width: 61.99rem) {
  .side {
    order: -1;
  }
}

.day {
  margin-top: 1.75rem;
  padding-bottom: 0.375rem;
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: 1.125rem;
  font-weight: 600;
}

.day:first-child {
  margin-top: 0;
}

.rows,
.counters,
.agents {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
  list-style: none;
}

.row {
  display: grid;
  grid-template-columns: 3.25rem 9.5rem minmax(0, 1fr);
  gap: 0 1rem;
  align-items: baseline;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--rule);
}

.row-time {
  color: var(--ink-soft);
  font-family: var(--display);
  font-variant-numeric: tabular-nums;
}

.row-agent {
  font-family: var(--display);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.row-text {
  max-width: 70ch;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.row.is-ignored .row-text {
  color: var(--ink-soft);
}

.tag {
  font-family: var(--display);
  font-size: 0.875rem;
  font-weight: 600;
}

.tag-confirmed {
  color: var(--green);
}

.tag-ignored {
  color: var(--ink-soft);
}

@media (max-width: 40rem) {
  .row {
    grid-template-columns: 3.25rem minmax(0, 1fr);
  }

  .row-body {
    grid-column: 1 / -1;
    margin-top: 0.125rem;
  }
}

.empty {
  max-width: 60ch;
  color: var(--ink-soft);
}

.more {
  margin-top: 1.5rem;
}

/* --- Compteur de l'objectif --- */

.counter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 1rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.counter-controls {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.counter-value {
  min-width: 2.5ch;
  font-family: var(--display);
  font-size: 2.25rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1;
  text-align: center;
}

.counter.is-reached .counter-value,
.counter-note {
  color: var(--green);
}

.counter-note {
  grid-column: 1 / -1;
  font-size: 0.875rem;
  font-weight: 600;
}

.step {
  width: 2.75rem;
  height: 2.75rem;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.step:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
}

.step:disabled {
  opacity: 0.35;
  cursor: default;
}

/* --- Agents --- */

.agent {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 1rem;
  align-items: baseline;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--rule);
}

.agent-name {
  font-family: var(--display);
  font-weight: 600;
}

.agent-last,
.agent-kind,
.agent-note {
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.agent-last {
  text-align: right;
}

.agent-kind,
.agent-note,
.agent .link,
.task-form {
  grid-column: 1 / -1;
}

.agent .link {
  justify-self: start;
  font-size: 0.875rem;
}

.task-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.task-input {
  flex: 1 1 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--ink-soft);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

/* --- Pied de page --- */

.foot {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 var(--gutter) 2.5rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.foot .is-error {
  color: var(--red);
  font-weight: 600;
}

/* --- Connexion --- */

.login {
  min-height: 100vh;
  background: var(--panel);
  color: var(--on-panel);
}

.login-panel {
  max-width: 24rem;
  padding: clamp(3rem, 16vh, 9rem) var(--gutter) 3rem;
}

.login-title {
  font-family: var(--display);
  font-stretch: 87.5%;
  font-size: 3.5rem;
  font-weight: 600;
  line-height: 1;
}

.login-form {
  display: grid;
  gap: 0.5rem;
  margin-top: 2.5rem;
}

.login-form input[type="password"] {
  min-height: 3rem;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1.125rem;
}

.login-form .btn {
  justify-self: start;
  margin-top: 1rem;
}

.login :focus-visible {
  outline-color: var(--on-panel);
}

.login-error {
  padding: 0.5rem 0.75rem;
  border-left: 0.5rem solid var(--amber);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
