/* =====================================================================
   Conciergerie — back-office
   ===================================================================== */
:root {
  --brand: #1a1a1a; --accent: #8c7a64;
  --bg: #f5f4f1; --surface: #fff; --ink: #1a1a1a; --muted: #6f6a63; --line: #e3e0da; --line-2: #d3cfc7;
  --ok: #2f6b43; --ok-bg: #e2efe5; --warn: #7a5b12; --warn-bg: #f5ecd3; --bad: #93392a; --bad-bg: #f6e0db; --info: #3a4f7d; --info-bg: #e4e9f4;
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Helvetica Neue", Helvetica, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --r: 3px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14.5px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.2rem; }
p { margin: 0 0 .8em; }
.ico { flex: none; vertical-align: -0.18em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------- structure */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: #1a1a1a; color: rgba(255,255,255,.78); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sb-brand { display: flex; gap: 12px; align-items: center; padding: 22px 20px; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
.sb-brand img { width: 40px; height: 40px; object-fit: contain; background: #fff; padding: 3px; }
.sb-brand strong { display: block; color: #fff; font-family: var(--serif); font-weight: 400; font-size: 1.12rem; line-height: 1.2; }
.sb-brand small { color: rgba(255,255,255,.5); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.sb-nav { padding: 14px 10px; display: grid; gap: 2px; }
.sb-nav a, .sb-foot a, .sb-foot button {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r); text-decoration: none; color: inherit;
  font: inherit; background: none; border: 0; width: 100%; cursor: pointer; text-align: left;
}
.sb-nav a:hover, .sb-foot a:hover, .sb-foot button:hover { background: rgba(255,255,255,.07); color: #fff; }
.sb-nav a.on { background: rgba(255,255,255,.12); color: #fff; }
.sb-label { margin: 16px 12px 6px; font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.4); }
.sb-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 10px; }
.sb-foot { margin-top: auto; padding: 12px 10px 18px; border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 2px; font-size: .9rem; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 18px 32px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; min-height: 72px; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { margin: 0; font-size: 1.65rem; }
.topbar-title .crumb { font-size: .78rem; color: var(--muted); text-decoration: none; display: inline-flex; gap: 5px; align-items: center; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.content { padding: 28px 32px 60px; }
.scrim { display: none; }
.flashes { padding: 16px 32px 0; display: grid; gap: 8px; }
.flash { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-radius: var(--r); background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--bad-bg); color: var(--bad); }

/* ------------------------------------------------------------- composants */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: 500 .85rem/1.2 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-danger { color: var(--bad); border-color: #e6c3bb; }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn-sm { padding: 6px 10px; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 7px; }
.inline { display: inline; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1.25rem; }
.panel-body { padding: 18px; }
.panel + .panel { margin-top: 18px; }
.stack > * + * { margin-top: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; text-decoration: none; display: block; }
.kpi:hover { border-color: var(--line-2); }
.kpi small { color: var(--muted); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; display: block; }
.kpi strong { font-family: var(--serif); font-size: 2.2rem; font-weight: 400; line-height: 1.2; }
.kpi.accent { background: var(--brand); color: #fff; border-color: var(--brand); }
.kpi.accent small { color: rgba(255,255,255,.6); }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 500; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #faf9f7; }
.tbl .thumb { width: 54px; height: 40px; object-fit: cover; border-radius: 2px; background: var(--bg); display: block; }
.tbl .thumb.ph { display: grid; place-items: center; color: var(--muted); }
.tbl a.row-link { text-decoration: none; font-weight: 500; }
.tbl a.row-link:hover { text-decoration: underline; }
.tbl .sub { color: var(--muted); font-size: .8rem; display: block; }
.tbl .actions { display: flex; gap: 4px; justify-content: flex-end; }
.tbl.inactive-dim tr.off td { opacity: .5; }
.table-wrap { overflow-x: auto; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600; letter-spacing: .04em; padding: 3px 9px; border-radius: 10px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.pill.ete { background: #efe9d8; color: #6d6548; } .pill.hiver { background: #e6e9ee; color: #4c5562; } .pill.both { background: #eee9e2; color: #5d564c; }
.st { display: inline-block; font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: 10px; white-space: nowrap; }
.st-nouvelle { background: var(--warn-bg); color: var(--warn); }
.st-en_cours, .st-a_traiter { background: var(--info-bg); color: var(--info); }
.st-confirmee, .st-confirme, .st-terminee { background: var(--ok-bg); color: var(--ok); }
.st-partielle { background: #ebe4f3; color: #5b3f7a; }
.st-refusee, .st-annulee, .st-indisponible { background: var(--bad-bg); color: var(--bad); }
.toggle { background: none; border: 0; padding: 0; cursor: pointer; }
.switch { width: 34px; height: 20px; border-radius: 10px; background: #cfcac2; position: relative; display: inline-block; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch.on { background: var(--ok); } .switch.on::after { transform: translateX(14px); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filters input, .filters select { width: auto; min-width: 160px; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: .9rem; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs a small { background: var(--bg); padding: 1px 7px; border-radius: 9px; margin-left: 4px; }

/* ------------------------------------------------------------- formulaires */
label { display: grid; gap: 5px; font-size: .82rem; font-weight: 500; color: #3d3a36; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], input[type=url], input[type=tel], textarea, select {
  width: 100%; font: 400 .92rem/1.4 var(--sans); color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: var(--r); padding: 9px 11px;
}
input[type=color] { width: 48px; height: 38px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r); background: #fff; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(140,122,100,.2); }
.help { font-weight: 400; color: var(--muted); font-size: .78rem; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; font-size: .9rem; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.check .help { display: block; }
.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.internal { background: #fbf8f1; border: 1px dashed #d8c9a8; padding: 12px; border-radius: var(--r); }
.internal label { color: var(--warn); }
.img-field { display: grid; gap: 10px; }
.img-preview { aspect-ratio: 4 / 3; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-preview.logo img { object-fit: contain; padding: 10px; }
.sticky-bar { position: sticky; bottom: 0; background: rgba(245,244,241,.95); backdrop-filter: blur(6px); padding: 14px 0; margin-top: 20px; display: flex; gap: 8px; border-top: 1px solid var(--line); z-index: 5; }
.chips-help { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.chips-help button { font-size: .72rem; border: 1px solid var(--line-2); background: #fff; border-radius: 10px; padding: 2px 8px; cursor: pointer; }
.chips-help button:hover { border-color: var(--ink); }

/* ------------------------------------------------------------- demandes */
.order-item { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; background: #fff; }
.order-item + .order-item { margin-top: 10px; }
.order-item-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.order-item h4 { margin: 0; font-size: 1rem; font-weight: 600; }
.order-item .meta { color: var(--muted); font-size: .84rem; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0; }
.order-item .meta span { display: inline-flex; align-items: center; gap: 4px; }
.answers { margin: 8px 0 0; padding: 8px 10px; background: var(--bg); border-radius: var(--r); font-size: .86rem; }
.answers div + div { margin-top: 3px; }
.answers small { color: var(--muted); }
.staff-hint { margin-top: 8px; font-size: .82rem; background: #fbf8f1; border-left: 3px solid #d8c9a8; padding: 6px 10px; color: #5d4c2a; }
.item-edit { display: grid; grid-template-columns: 150px 120px 90px 110px 1fr; gap: 8px; margin-top: 10px; align-items: end; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; font-size: .86rem; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline small { color: var(--muted); display: block; }
.dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: .9rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }
.total-line strong { font-family: var(--serif); font-size: 1.6rem; font-weight: 400; }
.new-row { display: grid; grid-template-columns: minmax(200px, 2fr) minmax(140px, 1.2fr) 130px 100px 80px minmax(120px, 1fr) 36px; gap: 8px; align-items: end; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.new-row .rest { grid-column: 1 / 3; }
.empty { padding: 36px; text-align: center; color: var(--muted); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.list-plain li:last-child { border-bottom: 0; }
.list-plain a { text-decoration: none; }
.list-plain a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- connexion */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #1a1a1a; }
.login-card { width: 100%; max-width: 380px; background: #fff; padding: 36px 32px; display: grid; gap: 14px; text-align: center; }
.login-card label { text-align: left; }
.login-logo { width: 110px; margin: 0 auto 6px; }
.login-card h1 { margin: 0; font-size: 1.7rem; }
.login-card .muted { margin: 0 0 6px; }
.back-link { font-size: .82rem; color: var(--muted); text-decoration: none; display: inline-flex; gap: 5px; align-items: center; justify-content: center; margin-top: 4px; }

/* ------------------------------------------------------------- impression */
@media print {
  .sidebar, .topbar-actions, .menu-btn, .no-print, .sticky-bar, .flashes { display: none !important; }
  .layout { display: block; } .content { padding: 0; } .topbar { position: static; border: 0; padding: 0 0 12px; }
  .grid-main { grid-template-columns: 1fr; } body { background: #fff; } .panel { border-color: #ccc; break-inside: avoid; }
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .item-edit { grid-template-columns: 1fr 1fr; }
  .new-row { grid-template-columns: 1fr 1fr; }
  .new-row .rest { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
  .menu-btn { display: block; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .topbar-title h1 { font-size: 1.35rem; }
  .content { padding: 18px 16px 48px; }
  .flashes { padding: 12px 16px 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .filters input, .filters select { flex: 1; min-width: 130px; }
}

/* catégories */
.cat-rows { padding: 6px 12px; }
.cat-row { display: grid; grid-template-columns: 70px 150px minmax(160px, 1fr) 140px 60px 70px 90px; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: 0; }
.cat-head { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.icon-pick { display: flex; gap: 6px; align-items: center; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.contents { display: contents; }
.panel + .panel, section.panel + section.panel { margin-top: 18px; }
@media (max-width: 860px) { .cat-row { grid-template-columns: 60px 1fr 1fr; } .cat-head { display: none; } }
