/* ========== The adventure's Vue d'ensemble tab (8A): band, table, chronicle ==========
   Mockup AdvOverview (1440 GM, 1180 landscape, 820 portrait). One DOM, three geometries:
   >= 1280 px  "band band" / "table chron", columns 440 px | 1fr
   1024-1279   "band chron" / "table chron", columns 380 px | 1fr (the invite card stacks)
   <= 1023.98  "band" / "table" / "chron", one column (the band is a row, the table 2 columns) */

/* The Places recipe (places.css): the band scrolls away, then the table and the chronicle
   stick under the app bar and the sub-tab bar and each scrolls inside itself. */
.anima-main-content:has(.overview-page) {
  padding-bottom: 12px;
}
.overview-page {
  display: grid;
  grid-template-columns: 440px minmax(0, 1fr);
  grid-template-areas:
    "band band"
    "table chron";
  gap: 16px;
  align-items: start;
}
.overview-band {
  grid-area: band;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}
.overview-table,
.overview-chron {
  position: sticky;
  top: calc(var(--chrome-h) + var(--subtab-bar-h) + 1px + 12px);
  max-height: calc(100dvh - var(--chrome-h) - var(--subtab-bar-h) - 1px - 24px);
  min-width: 0;
  box-sizing: border-box;
  overflow-y: auto;
}
.overview-table {
  grid-area: table;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* The chronicle is adventure/notes' own section (`.note-chron`, below): its side panel renders
   beside it, not inside, so the sticky box's stacking context does not trap the panel under the
   app bar, the sub-tab bar and the ambient button. */
.overview-chron {
  grid-area: chron;
  overflow: hidden;
}

/* ── The title ── */
.overview-title {
  flex: 1;
  min-width: 0;
}
.overview-role {
  margin-bottom: 8px;
}
.overview-name,
.overview-description {
  overflow-wrap: anywhere;
}
.overview-description {
  margin-bottom: 0;
}

/* ── The invite card ── */
.invite-card {
  flex-shrink: 0;
  box-sizing: border-box;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.invite-card-label {
  font-family: var(--font-title);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.invite-card-hint {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.invite-card-code {
  font-family: var(--font-num);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.invite-card-btn {
  min-height: var(--touch-min);
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
}
.invite-card-btn--primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}
.invite-card-error {
  flex-basis: 100%;
}

/* ── A section of the table ── */
.overview-section {
  box-sizing: border-box;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.overview-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch-min);
}
.overview-section-title {
  flex: 1;
  margin: 0;
  font-family: var(--font-title);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.overview-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}
.overview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.overview-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-2);
  font-family: var(--font-num);
  font-size: 0.8rem;
  color: var(--muted);
}
.overview-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.overview-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--ink);
}
.overview-row-meta {
  font-size: 0.8rem;
  color: var(--muted);
}
.overview-btn {
  flex-shrink: 0;
  min-height: var(--touch-min);
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
}
.overview-btn--primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}
.overview-btn--danger {
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Landscape iPad: the band sits in the left column, the chronicle takes the right ── */
@media (max-width: 1279.98px) {
  .overview-page {
    grid-template-columns: 380px minmax(0, 1fr);
    grid-template-areas:
      "band chron"
      "table chron";
  }
  .overview-band {
    flex-direction: column;
  }
  .invite-card {
    align-self: stretch;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ── Portrait iPad: one column, the table above the chronicle ── */
@media (max-width: 1023.98px) {
  .overview-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "band"
      "table"
      "chron";
  }
  .overview-band {
    flex-direction: row;
  }
  .invite-card {
    align-self: auto;
    width: 320px;
  }
  .overview-table {
    position: static;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 12px;
  }
  .overview-table--gm .overview-participants,
  .overview-linked {
    grid-column: 1 / -1;
  }
}

/* ── The linked characters: one card each, stacked (the table column scrolls) ── */
.linked-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.linked-empty {
  margin: 0;
  padding: 12px 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.linked-card {
  box-sizing: border-box;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.linked-card--dying {
  border: 2px solid var(--danger);
  padding: 9px 11px;
}
.linked-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.linked-card-head .anima-character-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}
.linked-card-id {
  flex: 1;
  min-width: 0;
}
.linked-card-namerow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.linked-card-name {
  min-height: var(--touch-min);
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  color: var(--ink);
}
.linked-card-phr {
  min-height: var(--touch-min);
  padding: 0 12px;
}
.linked-card-namerow .gm-artifact-manager {
  margin-top: 0;
  margin-left: auto;
}
.linked-card-owner {
  font-size: 0.8rem;
  color: var(--muted);
}
.linked-card-dying {
  color: var(--danger);
  font-weight: 700;
}
.linked-card-gauges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.linked-card-gauge {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch-min);
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
}
.linked-card-gauge--hp {
  flex: 1;
  min-width: 180px;
}
.linked-card-gauge--hp .anima-hp-bar {
  flex: 1;
  min-width: 0;
}
.linked-card-gauge--hp .anima-hp-bar-label {
  font-family: var(--font-num);
}
.linked-card-gauge--fatigue {
  font-family: var(--font-num);
}
.linked-card-gauge-tag {
  font-weight: 700;
  color: var(--muted);
}
.linked-card-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 180px;
}
.linked-card-form input {
  min-height: var(--touch-min);
  width: 5.5rem;
}
.linked-card-confirm {
  min-width: var(--touch-min);
  min-height: var(--touch-min);
}
.linked-card-penalty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 0.8rem;
  color: var(--warning);
}
.linked-card-penalty-btn {
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  padding: 0 8px;
  border: 1px solid var(--warning);
  border-radius: 8px;
  background: transparent;
  color: var(--warning);
  font-family: var(--font-body);
  font-size: 0.8rem;
}
@media (max-width: 1023.98px) {
  .linked-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }
}

/* ── The chronicle column (adventure/notes): the header stays, the list scrolls ── */
.note-chron {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.note-chron-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.note-chron-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--font-title);
  font-size: 1rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.note-chron-hint {
  font-size: 0.8rem;
  color: var(--muted);
}
.note-chron-new {
  height: var(--touch-min);
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.note-chron-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px;
}
.note-card {
  flex: none;
  display: flex;
  gap: 10px;
  padding: 12px 14px 12px 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.note-card.is-private {
  border-color: var(--border-strong);
  background: var(--selected);
}
.note-handle {
  flex: none;
  width: var(--touch-min);
  height: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: grab;
}
.note-handle:active {
  cursor: grabbing;
}
.note-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.note-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 0.8rem;
  color: var(--muted);
}
.note-when {
  font-weight: 700;
  color: var(--accent);
}
.note-private-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--chrome);
  color: var(--chrome-ink);
  font-weight: 700;
}
.note-card-title {
  margin: 0;
  font-family: var(--font-title);
  font-size: 1.05rem;
}
.note-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.note-card-spacer {
  flex: 1;
}
.note-link-pill {
  padding: 3px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.8rem;
}
.note-action {
  min-height: var(--touch-min);
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.note-action--danger {
  color: var(--danger);
}

/* ── The « Nouvelle note » side panel (adventure/note-panel) ── */
.note-panel .anima-side-panel-body {
  display: flex;
  flex-direction: column;
}
.note-panel-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.note-panel-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
}
.note-panel-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.note-panel-label {
  padding: 0;
  margin: 0;
  float: none;
  font-size: 0.8rem;
  color: var(--muted);
}
.note-panel-input,
.note-panel-textarea {
  box-sizing: border-box;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9rem;
}
.note-panel-input {
  height: var(--touch-min);
  padding: 0 10px;
}
.note-panel-textarea {
  flex: 1 1 160px;
  min-height: 160px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: none;
}
.note-panel-content-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.note-panel-content-header .note-panel-label {
  flex: 1;
}
.note-panel-status {
  font-size: 0.8rem;
  color: var(--accent);
}
.note-panel-btn {
  min-height: var(--touch-min);
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}
.note-panel-hint {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
}
.note-panel-linked {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}
.note-panel-linked legend {
  margin-bottom: 8px;
}
.note-panel-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.note-panel-pill {
  min-height: var(--touch-min);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
}
.note-panel-pill.is-selected {
  border: 2px solid var(--accent);
  padding: 0 13px;
}
.note-panel-pill input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}
.note-panel-private {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.note-panel-private-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.9rem;
}
.note-panel-private-hint {
  font-size: 0.8rem;
  color: var(--muted);
}
/* The switch: a 56 × 32 track inside a 44 px hit area, the knob right when on. */
.note-panel-switch {
  flex: none;
  position: relative;
  width: 56px;
  height: var(--touch-min);
  padding: 0;
  border: none;
  background: transparent;
}
.note-panel-switch::before {
  content: '';
  position: absolute;
  inset: 50% 0 auto;
  height: 32px;
  margin-top: -16px;
  box-sizing: border-box;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface-2);
}
.note-panel-switch[aria-checked='true']::before {
  border-color: var(--accent);
  background: var(--accent);
}
.note-panel-switch-knob {
  position: absolute;
  top: 50%;
  left: 4px;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  box-sizing: border-box;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
}
.note-panel-switch[aria-checked='true'] .note-panel-switch-knob {
  left: 28px;
}
.note-panel-cancel,
.note-panel-submit {
  height: 52px;
  padding: 0 20px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
}
.note-panel-cancel {
  margin-right: auto;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--ink);
  font-weight: 500;
}
.note-panel-submit {
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}
.note-panel-cancel:disabled,
.note-panel-submit:disabled {
  opacity: 0.6;
}
