@import url("https://fonts.googleapis.com/css2?family=Shippori+Mincho:wght@500;600;700&family=Zen+Kaku+Gothic+New:wght@400;500;700&display=swap");

:root {
  --paper: #f4efe4;
  --panel: #fffdf8;
  --panel-raised: #ede6d6;
  --border: #ddd2ba;
  --ink: #241f18;
  --muted: #8a7e68;

  --torii: #a8452f;
  --torii-soft: #f2e0da;
  --torii-dark: #8a3623;

  --matcha: #4f7259;
  --matcha-soft: #e2ebe1;

  --gold: #9c7c42;
  --gold-soft: #f4ecd8;

  --shadow-sm: 0 1px 2px rgba(36, 31, 24, 0.06), 0 1px 1px rgba(36, 31, 24, 0.04);
  --shadow-md: 0 4px 14px rgba(36, 31, 24, 0.08), 0 1px 3px rgba(36, 31, 24, 0.06);

  /* alias historiques (composants existants) */
  --bg: var(--paper);
  --text: var(--ink);
  --accent: var(--torii);
  --accent-soft: var(--torii-soft);
  --new-badge: var(--matcha);
  --new-badge-soft: var(--matcha-soft);
  --excluded: var(--torii-dark);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(168, 69, 47, 0.05), transparent 45%),
    radial-gradient(circle at 100% 30%, rgba(156, 124, 66, 0.06), transparent 40%);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: "Shippori Mincho", "Iowan Old Style", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}

a { color: var(--torii); transition: color 0.15s ease; }
a:hover { color: var(--torii-dark); }

.topbar {
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.brand {
  font-family: "Shippori Mincho", Georgia, serif;
  font-weight: 700;
  font-size: 19px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.brand:hover { color: var(--torii); }

.topbar nav { display: flex; flex-wrap: wrap; gap: 4px; }
.topbar nav a {
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.topbar nav a:hover { background: var(--panel-raised); color: var(--ink); }
.topbar nav a.active {
  font-weight: 700;
  color: var(--torii);
  background: var(--torii-soft);
}

main {
  max-width: 1220px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

h1 { font-size: 30px; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 30px 0 10px; letter-spacing: 0.005em; }

.itinerary-header h1 { margin-bottom: 4px; }
.subtitle { color: var(--muted); max-width: 720px; font-size: 14.5px; }

.stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0 22px;
  font-size: 14px;
  color: var(--muted);
}
#stat-total-days { font-weight: 700; color: var(--ink); }

.btn-primary {
  background: var(--torii);
  color: #fffaf3;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-primary:hover { background: var(--torii-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.5; cursor: default; transform: none; }

#save-status { color: var(--muted); font-size: 13px; }
#save-status.ok { color: var(--matcha); font-weight: 600; }
#save-status.err { color: var(--torii-dark); font-weight: 600; }

.itinerary-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 22px;
}

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.column h2 {
  font-size: 15px;
  margin: 0 0 10px;
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.hint { color: var(--muted); font-weight: 400; font-size: 13px; }

.stage-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  min-height: 200px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.stage-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 7px;
  cursor: grab;
  font-size: 14px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.stage-item:hover { border-color: var(--gold); box-shadow: var(--shadow-sm); }
.stage-item.sortable-ghost { opacity: 0.4; }

.stage-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stage-name { font-weight: 700; }

.badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.01em;
}
.badge-region { background: var(--torii-soft); color: var(--torii); }
.badge-new { background: var(--matcha-soft); color: var(--matcha); }
.badge-excluded { background: #f3e0dd; color: var(--excluded); }

.stage-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.days-input {
  width: 48px;
  padding: 3px 4px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  text-align: center;
  font-family: inherit;
  background: var(--panel);
  color: var(--ink);
}

.order-num {
  display: inline-block;
  min-width: 20px;
  color: var(--gold);
  font-weight: 700;
  font-size: 12px;
}

.map-column {
  position: sticky;
  top: 84px;
  align-self: start;
}
#map {
  height: 480px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
#map-note { margin-top: 8px; }

@media (max-width: 900px) {
  .itinerary-body { grid-template-columns: 1fr; }
  .columns { grid-template-columns: 1fr; }
}

/* --- Page Activités (Phase 4) --- */

.activities-header h1 { margin-bottom: 4px; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
  margin: 18px 0 22px;
}
.control {
  display: flex;
  flex-direction: column;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  gap: 5px;
}
.control input, .control select {
  font-size: 14px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  min-width: 200px;
  font-family: inherit;
}
.control input:focus, .control select:focus {
  outline: none;
  border-color: var(--torii);
  box-shadow: 0 0 0 3px var(--torii-soft);
}

.macro-summary {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.zone-block { margin-bottom: 26px; }
.zone-block h2 {
  font-size: 16px;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.zone-no-coords {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  font-family: "Zen Kaku Gothic New", sans-serif;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 11px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease;
}
.activity-item:hover { box-shadow: var(--shadow-md); }

.activity-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.activity-name { font-weight: 700; font-size: 15.5px; font-family: "Shippori Mincho", serif; }

.badge-category { background: var(--gold-soft); color: var(--gold); }
.badge-status-prevue { background: var(--matcha-soft); color: var(--matcha); }
.badge-status-retiree { background: #f3e0dd; color: var(--excluded); }
.badge-status-other { background: #ece6d8; color: var(--muted); }

.activity-desc {
  font-size: 13.5px;
  color: var(--ink);
  margin: 5px 0;
  opacity: 0.85;
}
.activity-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 9px;
}

.vote-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.vote-btn {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.vote-btn:hover { border-color: var(--gold); background: var(--gold-soft); }
.vote-btn .count {
  color: var(--muted);
  margin-left: 4px;
  font-weight: 400;
}
.vote-btn.active[data-value="Oui"] { background: var(--matcha-soft); border-color: var(--matcha); color: var(--matcha); }
.vote-btn.active[data-value="Peut-être"] { background: var(--gold-soft); border-color: var(--gold); color: #7a611f; }
.vote-btn.active[data-value="Non"] { background: #f3e0dd; border-color: var(--excluded); color: var(--excluded); }
.vote-btn.active[data-rating] { background: var(--torii-soft); border-color: var(--torii); color: var(--torii); }

.comment-input {
  flex: 1;
  min-width: 160px;
  font-size: 12.5px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: inherit;
  background: var(--panel);
  color: var(--ink);
}
.comment-input:focus { outline: none; border-color: var(--gold); }

.votes-detail {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.vote-save-note {
  font-size: 11px;
  margin-left: 4px;
  font-weight: 600;
}
.vote-save-note.ok { color: var(--matcha); }
.vote-save-note.err { color: var(--excluded); }

/* --- Tables génériques (pages read-only : restauration, réservations, logistique, jours) --- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 26px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  background: var(--panel-raised);
  color: var(--torii-dark);
  padding: 10px 12px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
}
.data-table td {
  padding: 9px 12px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}
.data-table tr:hover td { background: rgba(168, 69, 47, 0.035); }
.data-table .nowrap { white-space: nowrap; }
.data-table .details-cell { max-width: 420px; color: var(--muted); }
.data-table .total-row { font-weight: 700; background: var(--gold-soft); }

/* --- Landing page --- */

.landing h1 {
  margin-bottom: 10px;
  font-size: 34px;
}

.flow-list {
  list-style: none;
  counter-reset: flow;
  margin: 0 0 28px;
  padding: 0;
  max-width: 680px;
}
.flow-list li {
  counter-increment: flow;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 11px;
  position: relative;
  padding-left: 54px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.flow-list li:has(a:hover) { box-shadow: var(--shadow-md); transform: translateX(2px); }
.flow-list li::before {
  content: counter(flow);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--torii);
  color: #fffaf3;
  font-size: 13px;
  font-weight: 700;
  font-family: "Shippori Mincho", serif;
  display: flex;
  align-items: center;
  justify-content: center;
}
.flow-list li a {
  text-decoration: none;
  font-size: 15.5px;
  color: var(--ink);
}
.flow-list li a strong { color: var(--torii); font-family: "Shippori Mincho", serif; }
.flow-list li .hint { display: block; margin-top: 4px; }

.flow-list-secondary { counter-reset: none; }
.flow-list-secondary li { padding-left: 18px; }
.flow-list-secondary li::before { content: none; }

/* --- Commentaire général par section (page Thématiques) --- */

.section-comment {
  background: var(--panel-raised);
  border: 1px dashed var(--gold);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 4px 0 28px;
}
.section-comment h3 {
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold);
  margin: 0 0 10px;
}
.section-comment-existing { margin-bottom: 10px; }
.section-comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13.5px;
}
.section-comment-list li {
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.section-comment-list li:last-child { border-bottom: none; }

.btn-small { padding: 6px 14px; font-size: 13px; }

/* --- Dashboard --- */

.chart-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
  position: relative;
  height: 260px;
}
.chart-wrap-tall { height: 420px; }
