/* CRM du propriétaire : rail émail, table des dossiers, tiroir de dossier, catalogue, mise en production. */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - 38px); }
.rail { background: var(--enamel); color: var(--on-enamel); padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: calc(100vh - 40px); }
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 800; font-size: 1.0625rem; line-height: 1.3; }
.rail-brand small { display: block; font-weight: 500; font-size: var(--t-1); color: var(--on-enamel-2); }
.disc { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 2.5px solid #fff; font-weight: 800; flex: none; }
.rail-nav { display: grid; gap: 2px; }
.rail-nav a { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 10px; border-radius: var(--r-s); color: #fff; text-decoration: none; font-weight: 700; transition: background-color 160ms ease; }
.rail-nav a em { margin-left: auto; font-style: normal; font-size: 0.75rem; font-weight: 800; background: var(--buoy); color: var(--ink); border-radius: 999px; padding: 1px 8px 0; }
.rail-nav a em:empty { display: none; }
.rail-nav a[aria-current="page"] { background: rgba(255, 255, 255, .15); }
@media (hover: hover) and (pointer: fine) { .rail-nav a:hover { background: rgba(255, 255, 255, .09); } }
.rail-foot { margin-top: auto; font-size: var(--t-1); color: var(--on-enamel-2); padding: 10px; border-top: 1px solid rgba(255, 255, 255, .16); display: grid; gap: 4px; }
.rail-foot b { color: #fff; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #5fd08e; margin-right: 6px; }
.dot.is-down { background: var(--buoy); }

.work { min-width: 0; outline: none; }
.cview { padding: 26px 28px 8px; max-width: 1240px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head h1 { font-size: var(--t-4); font-weight: 800; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; background: #fff; border: 1px solid var(--rule); border-radius: var(--r-l); margin-bottom: 16px; }
.kpi { padding: 14px 16px; border-left: 1px solid var(--rule); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi span { display: block; font-size: var(--t-1); color: var(--muted); font-weight: 600; }
.kpi b { font-size: 1.5rem; font-weight: 800; }
.kpi small { display: block; font-size: var(--t-1); color: var(--ink-2); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.searchbox { position: relative; flex: 1 1 220px; max-width: 320px; }
.searchbox .i { position: absolute; left: 11px; top: 13px; color: var(--muted); }
.searchbox .input { padding-left: 36px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--rule-strong); background: #fff; font-weight: 700; font-size: var(--t-1); cursor: pointer; transition: background-color 160ms ease, transform 140ms var(--ease-out); }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] { background: var(--enamel); border-color: var(--enamel); color: #fff; }
.chip b { font-weight: 800; opacity: .75; margin-left: 4px; }

.tablebox { background: #fff; border: 1px solid var(--rule); border-radius: var(--r-l); overflow: hidden; }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--t-2); }
.tbl th { text-align: left; font-size: 0.75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--rule); background: #f7f9fa; white-space: nowrap; }
.tbl th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.tbl th button .i { width: 14px; height: 14px; }
.tbl th[aria-sort="ascending"], .tbl th[aria-sort="descending"] { color: var(--ink); }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; transition: background-color 120ms ease; }
.tbl tbody tr.is-active { background: #eef4fb; }
@media (hover: hover) and (pointer: fine) { .tbl tbody tr:hover { background: #f4f7f9; } }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl .ref { font-weight: 800; white-space: nowrap; }
.who b { display: block; }
.who span, .sub { font-size: var(--t-1); color: var(--muted); }
.flag { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-1); font-weight: 700; color: #6d4b00; }
.flag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--buoy-deep); box-shadow: 0 0 0 3px rgba(245, 196, 0, .25); }
.flag.is-seen { color: var(--muted); font-weight: 500; }
.flag.is-seen::before { background: transparent; border: 1.5px solid var(--rule-strong); box-shadow: none; width: 6px; height: 6px; }
.cards { display: none; }
.empty { padding: 36px; text-align: center; color: var(--muted); }

/* Tiroir de dossier */
.scrim { position: fixed; inset: 0; background: rgba(12, 28, 43, .36); z-index: 40; opacity: 0; transition: opacity 240ms var(--ease-out); }
.scrim.is-on { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 50;
  background: var(--ground); box-shadow: var(--shadow-2); overflow-y: auto; overscroll-behavior: contain; outline: none;
  transform: translateX(104%); visibility: hidden;
  transition: transform 380ms var(--ease-drawer), visibility 0s linear 380ms;
}
.drawer.is-open { transform: translateX(0); visibility: visible; transition: transform 440ms var(--ease-drawer), visibility 0s; }
.d-head { position: sticky; top: 0; z-index: 2; background: var(--enamel); color: #fff; padding: 16px 18px; display: flex; align-items: center; gap: 12px; }
.d-head h2 { font-size: var(--t-3); font-weight: 800; }
.d-head .sub { color: var(--on-enamel-2); }
.d-head .tag { margin-left: auto; }
.d-close { color: #fff; border: 1px solid rgba(255, 255, 255, .3); background: transparent; width: 40px; height: 40px; border-radius: var(--r-s); display: grid; place-items: center; cursor: pointer; flex: none; transition: transform 140ms var(--ease-out); }
.d-close:active { transform: scale(0.95); }
.d-body { padding: 16px 18px 28px; display: grid; gap: 14px; }
.box { background: #fff; border: 1px solid var(--rule); border-radius: var(--r-l); padding: 16px; min-width: 0; }
.box h3 { font-size: 0.75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 12px; font-size: var(--t-2); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.quote-msg { margin-top: 10px; padding: 10px 12px; background: #f4f7f9; border-radius: var(--r-s); font-size: var(--t-2); }
.avail { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.avail-live { font-size: var(--t-1); font-weight: 700; color: var(--ink-2); margin-top: 10px; display: flex; gap: 6px; align-items: center; }
.actions { display: grid; gap: 10px; }
.actions .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.actions .field { flex: 1 1 160px; }
.prop { display: grid; gap: 8px; }
.prop .pl { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 10px; align-items: center; font-size: var(--t-2); }
.prop .pl .input { text-align: right; min-height: 38px; padding: 6px 10px; }
.prop .pt { display: flex; justify-content: space-between; font-weight: 800; font-size: 1.125rem; padding-top: 8px; border-top: 1px solid var(--rule); }
.mailbox { border: 1px dashed var(--rule-strong); border-radius: var(--r-m); padding: 12px; background: #f7f9fa; font-size: var(--t-1); display: grid; gap: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: var(--t-1); }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--muted); font-weight: 600; }
.timeline li.is-new { animation: rise 320ms var(--ease-out); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.plate.is-flip { animation: flip 560ms var(--ease-out); }
@keyframes flip { 0% { transform: rotateX(90deg); opacity: .4; } 100% { transform: rotateX(0); opacity: 1; } }

/* Relances */
.rules { display: grid; gap: 0; background: #fff; border: 1px solid var(--rule); border-radius: var(--r-l); }
.rule { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 16px; border-top: 1px solid var(--rule); align-items: center; }
.rule:first-child { border-top: 0; }
.rule b { display: block; font-size: 1.0625rem; }
.rule .sub { margin-top: 2px; }
.rule details { grid-column: 1 / -1; font-size: var(--t-1); }
.rule summary { cursor: pointer; color: var(--enamel-2); font-weight: 700; }
.rule .mailbox { margin-top: 8px; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: var(--t-1); cursor: pointer; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--rule-strong); position: relative; cursor: pointer; transition: background-color 180ms ease; margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform 200ms var(--ease-out); }
.switch input:checked { background: var(--free); }
.switch input:checked::after { transform: translateX(18px); }
.upcoming { margin-top: 16px; }

/* Catalogue et mise en production */
.grid2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.syncbig { display: grid; gap: 4px; }
.syncbig b { font-size: 1.5rem; font-weight: 800; }
.statrow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.statrow div { background: #f4f7f9; border-radius: var(--r-s); padding: 10px 12px; }
.statrow span { display: block; font-size: var(--t-1); color: var(--muted); }
.statrow b { font-size: 1.25rem; font-weight: 800; }
.progress { height: 8px; border-radius: 4px; background: #e1e7eb; overflow: hidden; margin: 12px 0 6px; }
.progress i { display: block; height: 100%; width: 100%; background: var(--enamel); transform-origin: left; transform: scaleX(0); transition: transform 600ms var(--ease-out); }
.steps-run { list-style: none; margin: 8px 0 0; padding: 0; font-size: var(--t-1); display: grid; gap: 4px; }
.steps-run li { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.steps-run li.done { color: var(--ink); }
.steps-run li.done .i { color: var(--free); }
.steps-run .i { width: 15px; height: 15px; }
.nights td.ok { color: var(--free); font-weight: 700; }
.nights td.warn { color: #8a4a00; font-weight: 700; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.checks li:last-child { border-bottom: 0; }
.checks .i { width: 20px; height: 20px; margin-top: 1px; }
.checks .ok .i { color: var(--free); }
.checks .todo .i { color: var(--hold); }
.checks b { display: block; }
.badge { font-size: 0.75rem; font-weight: 800; padding: 2px 8px 1px; border-radius: 4px; background: var(--free-soft); color: var(--free); white-space: nowrap; }
.badge.todo { background: var(--hold-soft); color: var(--hold); }
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 6px; }
.flow div { padding: 12px; border: 1px solid var(--rule); margin-left: -1px; background: #fff; font-size: var(--t-1); }
.flow div:first-child { border-radius: var(--r-m) 0 0 var(--r-m); margin-left: 0; }
.flow div:last-child { border-radius: 0 var(--r-m) var(--r-m) 0; }
.flow b { display: block; font-size: var(--t-2); }
.flow .is-secret { background: var(--enamel); color: #fff; border-color: var(--enamel); }
.flow .is-secret span { color: var(--on-enamel-2); }

@media (max-width: 1080px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .tbl .col-next { display: none; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; padding: 6px 8px; gap: 6px; }
  .rail-brand small, .rail-brand > span:last-child, .rail-foot { display: none; }
  .rail-brand { padding: 0 2px; }
  .rail-brand .disc { width: 32px; height: 32px; font-size: 0.875rem; }
  .rail-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; flex: 1; min-width: 0; }
  .rail-nav a { flex-direction: column; justify-content: center; gap: 2px; min-height: 48px; padding: 4px 2px; font-size: 0.6875rem; text-align: center; position: relative; }
  .rail-nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .rail-nav a em { position: absolute; top: 3px; right: 6px; margin: 0; padding: 0 6px; font-size: 0.6875rem; }
  .cview { padding: 18px 14px 6px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .tablebox { display: none; }
  .cards { display: grid; gap: 10px; }
  .card { background: #fff; border: 1px solid var(--rule); border-radius: var(--r-l); padding: 14px; display: grid; gap: 6px; cursor: pointer; transition: transform 140ms var(--ease-out); }
  .card:active { transform: scale(0.98); }
  .card .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
  .card .bottom { display: flex; justify-content: space-between; gap: 8px; font-size: var(--t-1); color: var(--ink-2); }
  .drawer { width: 100vw; }
  .statrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .flow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .flow div, .flow div:first-child, .flow div:last-child { border-radius: 0; margin: 0; }
  .searchbox { max-width: none; }
}
@media (max-width: 620px) {
  .nights th:nth-child(2), .nights td:nth-child(2), .nights th:nth-child(3), .nights td:nth-child(3) { display: none; }
  .nights th, .nights td { padding: 9px 8px; white-space: normal; }
}
@media (max-width: 520px) {
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 6px; }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .head h1 { font-size: 1.5rem; }
  .flow { grid-template-columns: minmax(0, 1fr); }
  .chip { min-height: 32px; padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer.is-open { transition: visibility 0s; }
  .plate.is-flip, .timeline li.is-new { animation: none; }
  .progress i { transition: none; }
}
.nights tbody tr { cursor: default; }
