/* BILI IMMOBILIÈRE — espace administrateur */
.admin { background: var(--sand-50); min-height: 100vh; }
.small { font-size: .84rem; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login__box { width: 100%; max-width: 400px; display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--line); padding: 40px; border-radius: var(--radius); }
.login__box h1 { font-size: 1.9rem; }
.login__box p { margin: -8px 0 8px; }

.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #d4cdc0; padding: 24px 16px; display: flex; flex-direction: column; gap: 32px; position: sticky; top: 0; height: 100vh; }
.side .logo { color: #fff; padding: 0 8px; }
.side .logo__mark { color: #fff; width: 32px; height: 32px; }
.side .logo__name { font-size: 1.2rem; }
.side .logo__sub { color: var(--sand-200); font-size: .55rem; }
.side__nav, .side__foot { display: grid; gap: 2px; }
.side__foot { margin-top: auto; }
.side a, .side button { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius); color: #d4cdc0; background: none; border: 0; font-size: .93rem; text-align: left; width: 100%; }
.side a:hover, .side button:hover { background: #2c2a26; color: #fff; }
.side a[aria-current="page"] { background: #34312c; color: #fff; }
.side svg { width: 18px; height: 18px; flex: none; }
.count { margin-left: auto; background: var(--accent); color: #fff; font-size: .72rem; min-width: 22px; height: 20px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }

.main { padding: 32px clamp(16px, 3vw, 48px) 64px; min-width: 0; }
.main__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.main__head h1 { font-size: 2.1rem; }
.main__head p { margin: 6px 0 0; }
.back { font-size: .86rem; color: var(--muted); display: inline-block; margin-bottom: 8px; }
.back:hover { color: var(--ink); }
.head-actions { display: flex; gap: 10px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .input { flex: 1; min-width: 220px; }
.toolbar .select { width: auto; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 820px; }
.table th { text-align: left; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fcfaf5; }
.right { text-align: right !important; }
.row-bien { display: flex; gap: 14px; align-items: center; }
.row-bien img { width: 72px; height: 54px; object-fit: cover; border-radius: var(--radius); background: var(--sand-100); flex: none; }
.row-bien strong { display: block; font-weight: 500; }
.row-bien span { font-size: .8rem; color: var(--muted); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; font-size: .72rem; border-radius: var(--radius); background: var(--sand-100); color: var(--ink-2); white-space: nowrap; }
.tag--ok { background: #e3ede4; color: var(--ok); }
.tag--warn { background: #f4ead8; color: #8a5a12; }
.tag--off { background: #efe8e6; color: var(--danger); }
.tag--demo { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); }
.actions { display: inline-flex; gap: 6px; }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.btn.danger { color: var(--danger); border-color: #e2c5bf; }
.btn.danger:hover { background: #f8ecea; border-color: var(--danger); }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 11px; cursor: pointer; transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.demo-tools { margin-top: 20px; padding: 16px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; background: var(--surface); }
.demo-tools p { margin: 0; font-size: .9rem; color: var(--ink-2); }

.editor { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.editor__main, .editor__side { display: grid; gap: 20px; }
.editor__side { position: sticky; top: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px 24px; margin: 0; display: grid; gap: 16px; min-width: 0; }
.panel legend { float: left; width: 100%; font-family: var(--font-serif); font-size: 1.25rem; padding: 0; margin-bottom: 4px; }
.panel legend + * { clear: both; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 14px; align-items: end; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.toggle { display: flex; align-items: center; gap: 12px; font-size: .93rem; cursor: pointer; min-height: 46px; }
.toggle input { position: absolute; opacity: 0; }
.toggle span { position: relative; width: 40px; height: 22px; background: var(--line-strong); border-radius: 11px; flex: none; transition: background .2s; }
.toggle span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; }
.toggle input:checked + span { background: var(--ink); }
.toggle input:checked + span::after { transform: translateX(18px); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photos:empty { display: none; }
.photo { position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--sand-100); }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo__bar { display: flex; justify-content: space-between; padding: 6px; gap: 4px; background: var(--surface); }
.photo__bar button { width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.photo__bar button:hover:not(:disabled) { border-color: var(--ink); }
.photo__bar button:disabled { opacity: .35; cursor: default; }
.photo__bar svg { width: 15px; height: 15px; }
.photo__cover { position: absolute; top: 6px; left: 6px; }
.dropzone { display: flex; align-items: center; gap: 14px; padding: 22px; border: 1px dashed var(--line-strong); border-radius: var(--radius); cursor: pointer; color: var(--ink-2); transition: border-color .2s, background .2s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--ink); background: var(--bg); }
.dropzone input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dropzone svg { width: 24px; height: 24px; color: var(--accent); flex: none; }

.msg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 12px; display: grid; gap: 10px; }
.msg--unread { border-left: 3px solid var(--accent); }
.msg__head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.msg__head strong { font-size: 1.05rem; font-weight: 600; }
.msg__meta { font-size: .82rem; color: var(--muted); }
.msg__body { white-space: pre-line; color: var(--ink-2); margin: 0; }
.msg__details { display: flex; flex-wrap: wrap; gap: 6px; }
.msg__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--radius); font-size: .92rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-err { background: var(--danger); }

.empty-row td { text-align: center; padding: 48px 16px !important; color: var(--muted); }

@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } .editor__side { position: static; } .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; gap: 8px; overflow-x: auto; }
  .side .logo__text { display: none; }
  .side__nav, .side__foot { display: flex; margin: 0; }
  .side__foot { margin-left: auto; }
  .side a, .side button { padding: 9px 10px; white-space: nowrap; font-size: .85rem; }
  .side__foot a { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .main { padding-top: 20px; }
}

/* Le logo n'hérite pas du style des liens de navigation */
.side > .logo { width: auto; flex: none; padding: 0 8px; background: none !important; }
.table td:first-child { min-width: 320px; }

/* =========================================================
   Backstage — style blanc / noir / rouge + demandes
   ========================================================= */
.admin { --radius: 12px; background: #f4f4f6; }
.side { background: var(--olive); color: rgba(255, 255, 255, .7); }
.side a, .side button { color: rgba(255, 255, 255, .7); border-radius: 8px; }
.side a:hover, .side button:hover { background: rgba(255, 255, 255, .06); }
.side a[aria-current="page"] { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.side .logo__sub { color: var(--accent); letter-spacing: .3em; }
.side .side__cta { color: var(--ink); justify-content: center; margin-top: -12px; }
.side .side__cta:hover { color: #fff; background: var(--accent); }
.main__head h1 { font-size: 2.2rem; }
.panel legend { text-transform: uppercase; font-weight: 500; letter-spacing: .02em; }
.tag { border-radius: 999px; padding: 0 10px; }
.tag--new { background: var(--accent); color: #fff; }
.tag--ok { background: #e2efe6; }
.tag--warn { background: #fdf1d8; }
.tag--off { background: #ececef; color: var(--muted); }
.login { background: var(--olive); }
.login__box { border: 0; border-radius: 16px; }
.login__box h1 { font-size: 2.4rem; }
.toggle input:checked + span { background: var(--accent); }
.switch input:checked + span { background: var(--accent); }
.table tr:hover td { background: #fafafb; }
.icon-btn { border-radius: 8px; }

/* Indicateurs */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; transition: border-color .2s, transform .2s; }
.kpi:hover { border-color: var(--ink); transform: translateY(-2px); }
.kpi strong { font-family: var(--font-serif); font-size: 2.6rem; font-weight: 500; line-height: 1; }
.kpi span { font-size: .82rem; color: var(--muted); }
.kpi--accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.kpi--accent span { color: rgba(255, 255, 255, .85); }
.dash { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.panel__head h2 { font-size: 1.25rem; }
.dash-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.dash-row:first-child { border-top: 0; }
.dash-row > span:first-of-type { flex: 1; min-width: 0; }
.dash-row strong { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-row small { color: var(--muted); font-size: .8rem; }
.dash-row img { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; flex: none; }
.dash-row:hover strong { color: var(--accent); }

/* Boîte de réception */
.inbox-tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.inbox-tabs button { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: .85rem; white-space: nowrap; }
.inbox-tabs button span { font-size: .72rem; color: var(--muted); }
.inbox-tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.inbox-tabs button[aria-selected="true"] span { color: rgba(255, 255, 255, .7); }
.inbox { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 16px; align-items: start; }
.inbox__list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; max-height: calc(100vh - 240px); overflow-y: auto; }
.inbox__empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: .9rem; }
.mrow { display: grid; gap: 4px; width: 100%; text-align: left; padding: 14px 18px 14px 22px; border: 0; border-bottom: 1px solid var(--line); background: none; position: relative; }
.mrow:last-child { border-bottom: 0; }
.mrow:hover { background: #fafafb; }
.mrow.is-active { background: #f2f2f5; box-shadow: inset 3px 0 0 var(--ink); }
.mrow.is-new::before { content: ""; position: absolute; left: 9px; top: 21px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.mrow__top { display: flex; justify-content: space-between; gap: 10px; }
.mrow__top strong { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow.is-new .mrow__top strong { font-weight: 700; }
.mrow__top time { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.mrow__kind { font-size: .75rem; color: var(--accent); }
.mrow__text { font-size: .84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow__tags { display: flex; gap: 6px; margin-top: 4px; }
.inbox__detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 30px; display: grid; gap: 20px; position: sticky; top: 20px; }
.inbox__placeholder { display: grid; place-items: center; gap: 10px; padding: 60px 0; color: var(--muted); text-align: center; }
.inbox__placeholder svg { width: 36px; height: 36px; }
.inbox__back { display: none; border: 0; background: none; padding: 0; text-align: left; }
.detail__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.detail__head h2 { font-size: 2rem; margin: 4px 0 6px; }
.detail__head p { margin: 0; }
.detail__kind { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.detail__contact { display: flex; flex-wrap: wrap; gap: 8px; }
.detail__contact .btn svg { width: 16px; height: 16px; }
.detail__listing { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.detail__listing:hover { border-color: var(--ink); }
.detail__listing img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; }
.detail__listing span { flex: 1; min-width: 0; }
.detail__listing strong { display: block; font-weight: 500; }
.detail__listing small { color: var(--muted); }
.detail__listing svg { width: 18px; height: 18px; color: var(--muted); }
.detail__subject { margin: 0; font-weight: 500; }
.detail__specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.detail__specs div { padding: 12px 14px; box-shadow: 0 0 0 .5px var(--line); }
.detail__specs dt { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.detail__specs dd { margin: 4px 0 0; font-weight: 500; }
.detail__msg { white-space: pre-line; background: #f6f6f8; border-radius: 10px; padding: 16px 18px; color: var(--ink-2); line-height: 1.7; }
.detail__convert { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-radius: 10px; background: var(--accent-soft); flex-wrap: wrap; }
.detail__convert p { margin: 0; font-size: .9rem; flex: 1; min-width: 220px; }
.detail__block { display: grid; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.seg-status { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-status button { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: none; font-size: .84rem; }
.seg-status button:hover { border-color: var(--ink); }
.seg-status button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.detail__foot { display: flex; justify-content: space-between; gap: 8px; }

@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(3, 1fr); } .dash { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox__list { max-height: none; }
  .inbox__detail { display: none; position: static; padding: 22px 20px; }
  .inbox.has-detail .inbox__list { display: none; }
  .inbox.has-detail .inbox__detail { display: grid; }
  .inbox__back { display: inline-block; }
}
@media (max-width: 820px) {
  .side .side__cta { display: none; }
  .side a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
}
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr 1fr; } .detail__head { flex-direction: column; } }
