/* Carnet : écran de service. Papier chaud, encre, un seul accent vermillon pour « nouveau ». */

:root {
  --paper: #f4f1e9;
  --surface: #fffdf7;
  --surface-sunk: #ece7db;
  --ink: #1f1c17;
  --ink-soft: #575146;
  --ink-faint: #6b6455;
  --line: #dcd5c6;
  --line-strong: #c3baa7;
  --accent: #c4421a;
  --accent-wash: #fbe6dc;
  --accent-ink: #a3360f;
  --alfred: #2d4a78;
  --alfred-wash: #e3e9f4;
  --guest-ok: #2d6a3e;
  --guest-ok-wash: #e1efe3;
  --seated: #3a352d;
  --radius: 6px;
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Iowan Old Style', 'Charter', 'Palatino Linotype', Palatino, Georgia, serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-wash);
  color: var(--ink);
}

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

[hidden] {
  display: none !important;
}

/* ---------- Marque ---------- */

.wordmark {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}

.demo-mention {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8125rem;
}

/* ---------- Boutons et champs ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 2.5rem;
  padding: 0 0.875rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: background-color 150ms var(--ease-out), border-color 150ms var(--ease-out);
}

.button:hover {
  background: var(--surface-sunk);
}

.button-primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
  font-weight: 600;
}

.button-primary:hover {
  background: #3a352d;
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
}

.button-quiet:hover {
  background: var(--surface-sunk);
  color: var(--ink);
}

.button-icon {
  width: 2.5rem;
  padding: 0;
}

.button-icon svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

select,
input[type='date'],
input[type='password'] {
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
}

select {
  min-width: 14rem;
}

/* ---------- Connexion ---------- */

.login-page {
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  width: min(100%, 24rem);
  padding: 2.25rem 2rem 2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(31 28 23 / 0.04), 0 12px 32px -12px rgb(31 28 23 / 0.12);
}

.login-card .demo-mention {
  margin-top: 0.375rem;
}

.login-title {
  margin: 2rem 0 1.25rem;
  font-size: 1.125rem;
  font-weight: 600;
}

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

.login-form label {
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.login-form .button {
  margin-top: 0.75rem;
}

.login-error {
  margin: 0 0 1rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius);
  background: var(--accent-wash);
  color: #8f2e10;
  font-size: 0.875rem;
}

/* ---------- Barre du haut ---------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.25rem 2rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: grid;
  gap: 0.25rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.25rem;
  margin: 0;
}

.field-label {
  color: var(--ink-soft);
  font-size: 0.8125rem;
}

.date-stepper {
  display: flex;
  gap: 0.375rem;
}

/* ---------- Service ---------- */

.service {
  display: grid;
  gap: 1.25rem;
  padding: 1.5rem 2rem 3rem;
}

.service-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.service-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 8px;
  background: var(--surface-sunk);
}

.service-tab {
  display: grid;
  gap: 0.125rem;
  min-width: 9rem;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}

.service-tab:hover {
  color: var(--ink);
}

.service-tab[aria-selected='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(31 28 23 / 0.08);
}

.service-tab-name {
  font-size: 1.125rem;
  font-weight: 600;
}

.service-tab-hours {
  font-size: 0.8125rem;
}

.service-tab-name-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-new-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 0.375rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
}

.service-summary {
  text-align: right;
}

.covers {
  margin: 0;
  line-height: 1;
}

.covers-value {
  font-family: var(--font-serif);
  font-size: 2.75rem;
  font-weight: 600;
}

.covers-total {
  color: var(--ink-soft);
  font-size: 1.125rem;
}

.summary-detail {
  margin: 0.375rem 0 0;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.connection-warning {
  margin: 0;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  background: var(--accent-wash);
  color: #8f2e10;
  font-size: 0.9375rem;
}

/* ---------- Grille ---------- */

.board-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.board-scroll {
  overflow-x: auto;
}

.board {
  --label-width: 7.5rem;
  --head-height: 2.25rem;
  --area-height: 2.5rem;
  --row-height: 3.75rem;
  display: grid;
  grid-template-columns: var(--label-width) repeat(var(--slot-count, 8), minmax(4.75rem, 1fr));
  position: relative;
  min-width: max-content;
}

.board-corner,
.slot-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  height: var(--head-height);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-faint);
  font-size: 0.8125rem;
}

.board-corner {
  left: 0;
  z-index: 5;
  grid-row: 1;
  grid-column: 1;
  padding-left: 1rem;
}

.slot-head {
  padding-left: 0.375rem;
  border-left: 1px solid var(--line);
}

.slot-head-hour {
  color: var(--ink);
  font-weight: 600;
}

.board > .board-corner,
.board > .slot-head {
  align-self: start;
}

.area-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  padding: 0 1rem 0.375rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.table-label {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--surface);
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.75rem 0 1rem;
  border-bottom: 1px solid var(--line);
}

.table-number {
  font-weight: 600;
}

.table-seats {
  color: var(--ink-faint);
  font-size: 0.8125rem;
}

.table-lane {
  grid-column: 2 / -1;
  border-bottom: 1px solid var(--line);
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: calc(100% / var(--slot-count, 8)) 100%;
}

.block {
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 0.125rem;
  min-width: 0;
  margin: 0.3125rem 0.1875rem;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
  box-shadow: 0 1px 1px rgb(31 28 23 / 0.06);
}

.block-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
  white-space: nowrap;
}

.block-time {
  color: var(--ink-soft);
  font-size: 0.8125rem;
}

.block-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
}

.block-covers {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 0.8125rem;
}

.block-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
  white-space: nowrap;
}

.block-note {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
}

.block.status-CONFIRMED_BY_GUEST {
  border-color: #9cc3a5;
  background: var(--guest-ok-wash);
}

.block.status-SEATED {
  border-color: var(--seated);
  background: var(--seated);
  color: var(--surface);
}

.block.status-SEATED .block-time,
.block.status-SEATED .block-covers,
.block.status-SEATED .block-note {
  color: #d9d3c6;
}

.block.status-NO_SHOW {
  border-style: dashed;
  background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 6px, var(--surface-sunk) 6px, var(--surface-sunk) 12px);
  color: var(--ink-soft);
}

.block.is-new {
  z-index: 2;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), 0 6px 18px -6px rgb(196 66 26 / 0.45);
}

.block.has-new-note .block-note {
  color: var(--accent-ink);
  font-weight: 600;
}

.now-line {
  z-index: 0;
  position: relative;
  pointer-events: none;
}

.now-line::before {
  content: '';
  position: absolute;
  top: var(--head-height);
  bottom: 0;
  left: var(--now-offset, 0%);
  width: 2px;
  margin-left: -1px;
  background: var(--accent);
  opacity: 0.7;
}

/* ---------- Étiquettes ---------- */

.source-tag,
.status-chip,
.new-chip,
.note-chip {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-height: 1.375rem;
  padding: 0 0.5rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.source-tag {
  background: var(--alfred-wash);
  color: var(--alfred);
}

.block.status-SEATED .source-tag {
  background: rgb(255 253 247 / 0.16);
  color: var(--surface);
}

.status-chip {
  background: var(--surface-sunk);
  color: var(--ink-soft);
}

.status-chip-guest,
.status-chip-CONFIRMED_BY_GUEST {
  background: var(--guest-ok-wash);
  color: var(--guest-ok);
}

.status-chip-SEATED {
  background: var(--seated);
  color: var(--surface);
}

.status-chip-CANCELLED,
.status-chip-NO_SHOW {
  background: transparent;
  color: var(--ink-faint);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.new-chip,
.note-chip {
  background: var(--accent);
  color: #fff;
}

/* ---------- Liste ---------- */

.section-title {
  margin: 0.75rem 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.reservation-list {
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  list-style: none;
  overflow: hidden;
}

.reservation-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(12rem, 1.3fr) 5.5rem minmax(12rem, 2fr) minmax(12rem, auto);
  align-items: center;
  gap: 1.25rem;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--line);
  transition: background-color 600ms var(--ease-out);
}

.reservation-row:first-child {
  border-top: 0;
}

.reservation-row.is-new {
  background: var(--accent-wash);
}

.row-time {
  font-size: 1.125rem;
  font-weight: 600;
}

.row-who {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
}

.row-name-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.row-name {
  min-width: 0;
  overflow: hidden;
  font-size: 1.0625rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-contact {
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.row-covers {
  font-weight: 600;
}

.row-notes {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.row-notes.has-new-note .row-note-text {
  color: var(--ink);
  font-weight: 600;
}

.row-note-empty {
  color: var(--ink-faint);
}

.row-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.375rem;
}

.reservation-row.status-CANCELLED .row-time,
.reservation-row.status-CANCELLED .row-name,
.reservation-row.status-CANCELLED .row-covers,
.reservation-row.status-CANCELLED .row-note-text {
  color: var(--ink-faint);
  text-decoration: line-through;
  text-decoration-color: var(--line-strong);
}

.empty-state {
  margin: 0;
  padding: 2rem 1.25rem;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------- Mouvement : une seule entrée, à l'arrivée d'une réservation ---------- */

@keyframes arrive {
  from {
    opacity: 0.35;
    transform: translateY(-4px) scale(0.98);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

.is-arriving {
  animation: arrive 700ms var(--ease-out) both;
}

@media (prefers-reduced-motion: reduce) {
  .is-arriving {
    animation: none;
  }
  .button,
  .service-tab,
  .reservation-row {
    transition: none;
  }
}

/* ---------- Petits écrans ---------- */

@media (max-width: 900px) {
  .topbar,
  .service {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .service-summary {
    text-align: left;
  }
  .reservation-row {
    grid-template-columns: 4rem 1fr auto;
    gap: 0.5rem 1rem;
  }
  .row-notes,
  .row-status {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }
  .row-notes:has(.row-note-empty) {
    display: none;
  }
}

.reservation-list:empty {
  display: none;
}

/* ---------- Bascule de vue ---------- */

.view-toggle {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 8px;
  background: var(--surface-sunk);
}

.view-option {
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}

.view-option:hover {
  color: var(--ink);
}

.view-option[aria-pressed='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(31 28 23 / 0.08);
}

/* ---------- Plan de salle ---------- */

.plan-section {
  --occupied: #3a352d;
  --soon: #f4e4b4;
  --soon-line: #a97a12;
  --soon-ink: #5c4208;
  --terrace: #e9eedf;
  --terrace-line: #6f8a63;
  --terrace-ink: #3f5a35;
  display: grid;
  gap: 1rem;
  padding: 1rem 1.25rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.plan-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
}

.plan-times {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 8px;
  background: var(--surface-sunk);
}

.plan-time {
  min-width: 3.75rem;
  min-height: 2.5rem;
  padding: 0 0.625rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}

.plan-time:hover {
  color: var(--ink);
}

.plan-time[aria-pressed='true'] {
  background: var(--ink);
  color: var(--surface);
  font-weight: 600;
}

.plan-status {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.0625rem;
}

.plan-status-time {
  color: var(--ink);
  font-size: 1.25rem;
}

.plan-legend {
  display: flex;
  gap: 1rem;
  margin: 0 0 0 auto;
  padding: 0;
  color: var(--ink-soft);
  font-size: 0.875rem;
  list-style: none;
}

.plan-legend li {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.legend-swatch {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
}

.legend-soon {
  border-color: var(--soon-line);
  background: var(--soon);
}

.legend-occupied {
  border-color: var(--occupied);
  background: var(--occupied);
}

.plan-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.plan-layout.has-detail {
  grid-template-columns: minmax(0, 1fr) 19rem;
}

.plan-scroll {
  overflow-x: auto;
}

.plan-floor {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  min-width: 60rem;
  padding: 0.5rem 0.25rem 1rem;
}

.plan-area {
  flex-basis: 0;
  min-width: 0;
}

.plan-area-name {
  margin: 0 0 0.5rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plan-zone {
  position: relative;
  width: 100%;
  border-radius: 12px;
}

/* Salle : murs pleins, sol discret en lames. */
.plan-zone-indoor {
  border: 4px solid var(--ink-soft);
  background: repeating-linear-gradient(90deg, #faf6ec 0, #faf6ec 3.5rem, #f3eee1 3.5rem, #f3eee1 3.5625rem);
}

/* Terrasse : bord pointillé, sol clair, jardinières en bordure. */
.plan-zone-outdoor {
  border: 3px dashed var(--terrace-line);
  background: var(--terrace);
}

.plan-zone-outdoor::before,
.plan-zone-outdoor::after {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  height: 1.125rem;
  background-image: radial-gradient(circle at 50% 55%, var(--terrace-line) 0 38%, transparent 40%);
  background-size: 1.75rem 1.125rem;
  content: '';
  opacity: 0.55;
  pointer-events: none;
}

.plan-zone-outdoor::before {
  top: -0.8125rem;
}

.plan-zone-outdoor::after {
  bottom: -0.8125rem;
}

.plan-table {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0.125rem;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: background-color 150ms var(--ease-out), border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}

.plan-table-round {
  border-radius: 50%;
}

.plan-table-square,
.plan-table-rect {
  border-radius: 10px;
}

.plan-table:hover {
  border-color: var(--ink-soft);
}

.plan-table-face {
  display: grid;
  gap: 0.0625rem;
  max-width: 100%;
  min-width: 0;
  line-height: 1.2;
}

.plan-table-number {
  font-size: 1.125rem;
  font-weight: 700;
}

.plan-table-guest {
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-table-detail {
  overflow: hidden;
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-table.is-free {
  color: var(--ink-soft);
}

.plan-table.is-soon {
  border-color: var(--soon-line);
  background: var(--soon);
  color: var(--soon-ink);
}

.plan-table.is-occupied {
  border-color: var(--occupied);
  background: var(--occupied);
  color: var(--surface);
}

.plan-table.is-occupied .plan-table-detail {
  color: #e4dece;
}

.plan-table.is-new {
  z-index: 2;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent), 0 8px 20px -6px rgb(196 66 26 / 0.5);
}

.plan-table.is-selected {
  z-index: 3;
  outline: 3px solid var(--alfred);
  outline-offset: 3px;
}

.plan-table-note-flag {
  justify-self: center;
  padding: 0 0.375rem;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.plan-table-alfred {
  position: absolute;
  top: -0.875rem;
  right: -0.25rem;
  z-index: 1;
  padding: 0 0.4375rem;
  border-radius: 4px;
  background: var(--alfred);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.375rem;
  white-space: nowrap;
}

.plan-chair {
  position: absolute;
  width: 1.125rem;
  height: 0.625rem;
  border: 2px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  pointer-events: none;
}

.plan-chair-round {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.plan-chair-top {
  transform: translate(-50%, -125%);
}

.plan-chair-bottom {
  transform: translate(-50%, 25%);
}

.plan-chair.is-taken {
  border-color: var(--occupied);
  background: var(--occupied);
}

.plan-table.is-soon .plan-chair.is-taken {
  border-color: var(--soon-line);
  background: var(--soon-line);
}

.plan-detail {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
}

.plan-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.plan-detail-number {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
}

.plan-detail-meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.plan-detail-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-detail-item {
  display: grid;
  gap: 0.375rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.plan-detail-item.is-new {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.plan-detail-line {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  min-width: 0;
}

.plan-detail-time {
  font-size: 1.125rem;
  font-weight: 600;
}

.plan-detail-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-detail-covers {
  margin-left: auto;
  color: var(--ink-soft);
  white-space: nowrap;
}

.plan-detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.plan-detail-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.plan-detail-note.has-new-note {
  color: var(--accent-ink);
  font-weight: 600;
}

.plan-detail-item.status-CANCELLED .plan-detail-time,
.plan-detail-item.status-CANCELLED .plan-detail-name,
.plan-detail-item.status-CANCELLED .plan-detail-covers {
  color: var(--ink-faint);
  text-decoration: line-through;
  text-decoration-color: var(--line-strong);
}

.plan-detail-empty {
  margin: 0;
  color: var(--ink-soft);
}

@media (max-width: 1100px) {
  .plan-layout.has-detail {
    grid-template-columns: minmax(0, 1fr);
  }
  .plan-detail {
    position: static;
  }
  .plan-legend {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .view-option,
  .plan-time,
  .plan-table {
    transition: none;
  }
}
