body { background: var(--bg); }
.shell { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.side { background: var(--side, var(--ink)); color: var(--side-ink, #dfe6ea); padding: 22px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 22px; color: var(--side-ink, #fff); font-size: 17px; font-weight: 500; letter-spacing: -.01em; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; }
.brand small { display: block; font-size: 11px; color: #8b97a1; font-weight: 400; }
.nav-i { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; border: 0; background: none; color: inherit; font-size: 14px; cursor: pointer; text-align: left; width: 100%; }
.nav-i:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.nav-i.on { background: color-mix(in srgb, currentColor 18%, transparent); font-weight: 500; }
.nav-i svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.badge { margin-left: auto; background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 8px; font-weight: 600; }
.spacer { flex: 1; }
.me { padding: 12px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; color: #9aa6af; }
.me b { display: block; color: #fff; font-weight: 500; font-size: 13px; }

.main { min-width: 0; }
.page { padding: 34px 44px 60px; max-width: 1180px; margin: 0 auto; }
.page-h { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-h h1 { font-size: 30px; font-weight: 300; flex: 1; }
.sec { font-size: 15px; margin: 30px 0 12px; font-weight: 500; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; background: var(--bg); }
.stat .v { font-size: 34px; font-weight: 300; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; }

.list { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 500; }
.item .s { color: var(--muted); font-size: 13px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; }
.empty { padding: 30px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* calendrier */
.cal { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cal-h { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--bg-soft); }
.cal-h div { padding: 9px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; }
.cal-g { display: grid; grid-template-columns: repeat(7, 1fr); }
.cell { min-height: 112px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; background: var(--bg); }
.cell:nth-child(7n) { border-right: 0; }
.cell:hover { background: var(--bg-soft); }
.cell.out { background: var(--bg-soft); }
.cell.out .n { color: var(--muted); }
.cell .n { font-size: 12px; font-weight: 600; width: 22px; height: 22px; display: grid; place-items: center; }
.cell.today .n { background: var(--accent); color: #fff; border-radius: 50%; }
.ev { font-size: 11.5px; border-radius: 5px; padding: 2px 6px; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 14%, white); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ev.blocked { border-left-color: #5b6770; color: #3d4850; background: repeating-linear-gradient(135deg, #dfe3e6, #dfe3e6 6px, #f1f3f4 6px, #f1f3f4 12px); }
.ev.pending { background: repeating-linear-gradient(135deg, var(--amber-soft), var(--amber-soft) 6px, #fff 6px, #fff 12px); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar h2 { font-size: 20px; text-transform: capitalize; min-width: 170px; }
.toolbar select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg); }
.iconbtn { width: 34px; height: 34px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; cursor: pointer; font-size: 16px; }

/* cartes salles */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.rcard { border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--c); }
.rcard h3 { font-size: 19px; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font-size: 13px; letter-spacing: .04em; }
pre.snip { background: var(--ink); color: #d8e3e8; border-radius: 10px; padding: 14px 16px; font-size: 12.5px; overflow: auto; margin: 0 0 8px; white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.snip-h { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 6px; font-weight: 500; }

/* modales */
.overlay { position: fixed; inset: 0; background: rgba(18,24,27,.45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: var(--bg); border-radius: 16px; width: min(560px, 100%); max-height: 92vh; overflow: auto; padding: 26px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h2 { font-size: 22px; margin-bottom: 18px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 99; font-size: 13px; }

/* connexion */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login .art { background: var(--side, var(--ink)); color: var(--side-ink, #fff); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
/* quadrillage discret dans le panneau de connexion, plus visible vers le bas et s'estompant vers le haut */
.login .art { position: relative; overflow: hidden; }
.login .art::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(to right, rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(to bottom, rgba(255,255,255,.07) 1px, transparent 1px); background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 15% 95%, #000 0%, transparent 100%); mask-image: radial-gradient(ellipse 90% 70% at 15% 95%, #000 0%, transparent 100%); }
.login .art > * { position: relative; }
.login .art h2 { font-size: 40px; font-weight: 300; line-height: 1.15; max-width: 440px; }
.login .art p { color: #9aa6af; max-width: 400px; }
.login .box { display: grid; place-items: center; padding: 30px; }
.login form { width: min(380px, 100%); }
.login h1 { font-size: 28px; margin-bottom: 6px; }
.login .sub { color: var(--muted); margin-bottom: 26px; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; } .brand { padding: 4px 8px; } .spacer, .me { display: none; }
  .page { padding: 22px 16px 50px; } .login { grid-template-columns: 1fr; } .login .art { display: none; } .cell { min-height: 70px; }
}

/* photos de salles */
.rphoto { display: block; width: calc(100% + 40px); height: 160px; object-fit: cover; margin: -20px -20px 6px; max-width: none; border-radius: 10px 10px 0 0; background: var(--bg-soft); }
.photo-prev { display: flex; flex-direction: column; gap: 10px; }
.photo-prev img, .photo-prev .ph { width: 100%; height: 170px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-soft); }
.photo-prev .ph { display: grid; place-items: center; color: var(--muted); border-style: dashed; }
.photo-act { display: flex; gap: 8px; }

/* pastilles de statut (sélecteur) */
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { border: 1px solid var(--line); background: var(--bg); color: var(--muted); border-radius: 99px; padding: 6px 14px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.pill:hover:not([disabled]) { border-color: currentColor; }
.pill[disabled] { cursor: default; }
.pill.on { border-color: transparent; font-weight: 600; }
.pill.on.amber { background: var(--amber-soft); color: var(--amber); }
.pill.on.green { background: var(--green-soft); color: var(--green); }
.pill.on.red { background: var(--red-soft); color: var(--red); }
.pill.on.grey { background: var(--grey-soft); color: var(--ink-2); }
.modal .actions .btn.danger.sm { margin-right: auto; }

/* logo + paramètres */
.brand .logo-img { background: #fff; width: auto; min-width: 34px; height: 38px; padding: 4px 6px; border-radius: 9px; }
.brand .logo-img img { max-height: 30px; max-width: 70px; display: block; }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px 40px; margin-bottom: 20px; max-width: 1000px; }
.settings .sec { margin-top: 0; }
.logo-box { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.logo-box img, .logo-box .ph { height: 90px; max-width: 100%; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--bg-soft); }
.logo-box .ph { display: grid; place-items: center; color: var(--muted); border-style: dashed; width: 180px; }
.color-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.color-row input[type=color], .field input[type=color] { width: 56px; height: 38px; padding: 3px; cursor: pointer; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch:hover { transform: scale(1.12); }
.dossier { margin-bottom: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 10px; font-size: 13px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.modal h3.sec { margin: 22px 0 10px; font-size: 15px; font-weight: 500; }

/* avec un logo : logo en haut sur toute la largeur, titre plus petit dessous */
.brand.stacked { flex-direction: column; align-items: stretch; gap: 10px; padding: 4px 8px 20px; }
.brand.stacked .logo-img { width: 100%; height: auto; min-height: 72px; padding: 10px 12px; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.brand.stacked .logo-img img { max-height: 84px; max-width: 100%; width: auto; height: auto; }
.brand.stacked .brand-t { font-size: 14px; font-weight: 500; line-height: 1.25; padding: 0 4px; }
.brand.stacked .brand-t small { margin-top: 2px; }
.login .art .brand.stacked { max-width: 260px; }
.login .art .brand.stacked .brand-t { font-size: 16px; }
.ev-t { overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.ev-c { overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; color: var(--ink-2); opacity: .85; }
.cell { min-height: 124px; }
.ev-t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ev-c { white-space: nowrap; }
.ev-cat { font-style: italic; }

/* finances */
.stat.ok .v { color: var(--green); } .stat.warn .v { color: var(--amber); }
table.fin { width: 100%; border-collapse: collapse; font-size: 14px; }
table.fin th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.fin td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.fin .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.fin tr.tot td { font-weight: 600; border-bottom: 0; background: var(--bg-soft); }
table.fin .barcell { width: 32%; }
.bar { position: relative; height: 10px; background: var(--grey-soft); border-radius: 99px; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; }
.bar i.exp { background: color-mix(in srgb, var(--accent) 35%, white); } .bar i.rec { background: var(--accent); }
@media (max-width: 860px) { table.fin .barcell { display: none; } }

/* cautions + convention */
.dep-row { align-items: flex-start; }
.dep-box { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.dep { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 210px; display: flex; flex-direction: column; gap: 8px; }
.dep-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.dep-a { display: flex; gap: 6px; flex-wrap: wrap; }
.pill.on.accent { background: var(--accent-soft); color: var(--accent); }
textarea.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; line-height: 1.5; width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--bg); }

/* histogramme des encaissements */
.chart-card { border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px 14px; margin-top: 22px; }
.chart-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .val { fill: var(--ink); font-size: 11px; font-weight: 600; font-family: var(--font); }
.chart .bar-exp { fill: var(--grey-soft); stroke: var(--line); }
.chart .bar-rec:hover { filter: brightness(1.1); }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.chart-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-legend i.exp { background: var(--grey-soft); border: 1px solid var(--line); }

/* clients */
input.search { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-width: 260px; background: var(--bg); }
input.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.toolbar .pill { flex: none; }

/* sélecteur de client dans la réservation */
.client-results { margin-top: 8px; max-height: 188px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.client-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 8px 12px; cursor: pointer; font-size: 13.5px; }
.client-opt:last-child { border-bottom: 0; }
.client-opt:hover, .client-opt:focus-visible { background: var(--accent-soft); }
.client-opt span { font-size: 12px; color: var(--muted); }
.client-chip { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--bg-soft); }
.client-chip .s { font-size: 12px; color: var(--muted); }

/* navigation d'année (Finances) */
.year-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.iconbtn[disabled] { opacity: .35; cursor: default; }
.iconbtn:not([disabled]):hover { background: var(--bg-soft); }

/* Téléphone : le menu devient une barre compacte en haut (logo + onglets qui défilent), le contenu passe en premier */
@media (max-width: 860px) {
  .side { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; flex-wrap: nowrap; overflow-x: auto; gap: 2px; padding: 6px 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .brand, .brand.stacked { flex: none; flex-direction: row; align-items: center; width: auto; padding: 0 8px 0 4px; gap: 8px; }
  .brand .brand-t, .brand.stacked .brand-t { display: none; }
  .brand.stacked .logo-img, .brand .logo-img { width: auto; min-height: 0; height: 38px; padding: 3px 6px; }
  .brand.stacked .logo-img img, .brand .logo-img img { max-height: 30px; max-width: 64px; }
  .nav-i { width: auto; flex: none; white-space: nowrap; padding: 9px 12px; gap: 8px; }
  .nav-i svg { width: 17px; height: 17px; }
  .spacer, .me { display: none; }
  .modal { padding: 20px 16px; border-radius: 14px; max-height: 94vh; }
  .overlay { padding: 10px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .page-h h1 { font-size: 24px; }
  .toolbar h2 { min-width: 0; }
  table.fin { font-size: 12.5px; } table.fin th, table.fin td { padding: 7px 5px; }
  .dep-box, .dep { min-width: 0; width: 100%; }
}

/* Colonnes du calendrier de largeur égale, quel que soit le texte des réservations */
.cal-h, .cal-g { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cell { min-width: 0; overflow: hidden; }
@media (max-width: 860px) {
  .cell { padding: 3px; min-height: 84px; }
  .ev { font-size: 10px; padding: 1px 3px; }
  .ev-c { display: none; }
  .ev-t { -webkit-line-clamp: 2; }
}

/* Boutons de la fenêtre toujours visibles, même sur une longue fiche */
.modal .actions { position: sticky; bottom: -26px; background: var(--bg); padding: 12px 0 26px; margin: 8px 0 -26px; border-top: 1px solid var(--line); z-index: 2; }
@media (max-width: 860px) { .modal .actions { bottom: -20px; padding-bottom: 20px; margin-bottom: -20px; } }

/* état de la messagerie (Paramètres) */
.mailstate { border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.mailstate.ok { background: var(--green-soft); color: var(--green); }
.mailstate.warn { background: var(--amber-soft); color: var(--amber); }

/* liens et messages de la page de connexion */
a.link { color: var(--accent); text-decoration: none; font-size: 13px; }
a.link:hover { text-decoration: underline; }
.okmsg { color: var(--green); background: var(--green-soft); border-radius: 8px; padding: 0; font-size: 13px; margin-bottom: 12px; }
.okmsg:not(:empty) { padding: 10px 12px; }
