/* Ridearound — back office (charte : bleu nuit #0B1326, orange #FF5500, vert départ #10B981) */
:root {
  --navy: #0B1326; --navy-2: #131B2E; --navy-3: #1C2640;
  --orange: #FF5500; --orange-2: #FF9500; --green: #10B981;
  --bg: #F8FAFC; --card: #FFFFFF; --ink: #0F172A; --muted: #5B6779; --line: #E2E8F0; --soft: #F1F5F9;
  --good: #047857; --bad: #B91C1C;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 14px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.link { text-decoration: underline; color: #9AA6BC; font-size: 13px; }
.wordmark { font-weight: 800; letter-spacing: -.03em; }
.wordmark b { font-weight: 800; }
.wordmark i { font-style: normal; color: var(--orange); }

/* Accès */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(120% 70% at 50% 0%, #16213B 0%, var(--navy) 60%, #070C17 100%); }
.gate-card { width: 100%; max-width: 380px; background: var(--navy-2); color: #fff; border: 1px solid #26314D; border-radius: 20px; padding: 32px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.gate-card h1 { font-size: 32px; color: #fff; }
.gate-sub { margin: -6px 0 4px; color: #9AA6BC; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; font-size: 12px; }
.gate-card p { margin: 0; color: #CBD5E1; }
#g-btn { min-height: 44px; }
.gate-form { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.gate-form input { height: 44px; border-radius: 10px; border: 1px solid #2A3654; background: var(--navy); color: #fff; padding: 0 12px; }
.gate-form input:focus { outline: 2px solid var(--orange); border-color: transparent; }

/* En-tête */
.top { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; }
.top-in { max-width: 1320px; margin: 0 auto; padding: 12px 24px 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { width: 26px; height: auto; }
.brand .wordmark { font-size: 21px; color: #fff; }
.brand span { color: #9AA6BC; font-size: 13px; white-space: nowrap; padding-left: 10px; border-left: 1px solid #2A3654; }
.top-side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.top-side .muted { color: #9AA6BC; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .btn { background: rgba(255, 255, 255, .1); color: #fff; }
.top .btn:hover { background: rgba(255, 255, 255, .18); }
.btn { flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 8px; background: var(--soft); border: 1px solid transparent; font-weight: 600; font-size: 13px; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--line); }
.btn.primary { background: var(--orange); color: #fff; }
.btn.primary:hover { background: #E64C00; }
.btn.danger { background: #FEE2E2; color: var(--bad); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.tabs { max-width: 1320px; margin: 0 auto; padding: 0 24px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; padding: 10px 12px; color: #9AA6BC; border-bottom: 3px solid transparent; font-weight: 600; }
.tabs button:hover { color: #fff; }
.tabs button.on { color: #fff; border-color: var(--orange); }
.tab-count { margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--orange); color: #fff; font-size: 12px; }

/* Page */
.page { max-width: 1320px; margin: 0 auto; padding: 20px 24px 64px; display: flex; flex-direction: column; gap: 16px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bar .grow { flex: 1 1 auto; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { padding: 6px 12px; border-radius: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; font-weight: 600; }
.seg button.on { background: var(--navy); color: #fff; }
.field { min-height: 36px; padding: 0 10px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
input.field { flex: 1 1 220px; max-width: 380px; }
.field:focus { outline: 2px solid var(--orange); border-color: transparent; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; }
.card > h2 { font-size: 16px; }
.card > .sub { margin: 2px 0 12px; color: var(--muted); font-size: 13px; }
.card > .sub:empty { margin: 0 0 8px; }
.kpi { display: flex; flex-direction: column; gap: 2px; border-top: 3px solid var(--orange); }
.kpi small { color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi b { font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi span { color: var(--muted); font-size: 12px; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.note { padding: 10px 12px; background: #FFF4ED; border: 1px solid #FFD8BF; border-radius: 10px; color: #7C2D12; font-size: 13px; }
.drawer .kpi b { font-size: 22px; }
.empty { padding: 24px 8px; text-align: center; color: var(--muted); }
.wrap { white-space: normal; display: block; min-width: 220px; color: var(--muted); font-size: 13px; }

/* Graphiques */
.vbars { display: flex; align-items: flex-end; gap: 3px; height: 160px; }
.vbar { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.vbar i { display: block; background: linear-gradient(to top, var(--orange), var(--orange-2)); border-radius: 5px 5px 0 0; }
.vbar i.zero { background: var(--line); height: 2px; border-radius: 1px; }
.vbar:hover i:not(.zero) { background: var(--navy); }
.vaxis { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); font-size: 12px; }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hrow { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.hrow .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track { height: 10px; background: var(--soft); border-radius: 5px; overflow: hidden; }
.track i { display: block; height: 100%; background: linear-gradient(to right, var(--orange), var(--orange-2)); border-radius: 0 5px 5px 0; }
.hrow .v { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; font-weight: 600; }
.hrow .v small { color: var(--muted); margin-left: 6px; font-weight: 400; }
.smap { height: 380px; border-radius: 10px; overflow: hidden; background: var(--soft); }

/* Listes et tableaux */
.table-wrap { overflow-x: auto; margin: 0 -16px -16px; padding: 0 16px 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 600; position: sticky; top: 0; background: var(--card); }
th button { color: inherit; font-weight: 600; font-size: 12px; }
th .arrow { margin-left: 3px; color: var(--orange); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .cell-sub { display: block; color: var(--muted); font-size: 12px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #FFF7F2; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--soft); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.good { background: #D1FAE5; color: var(--good); }
.pill.warn { background: #FFEDD5; color: #C2410C; }
.pill.bad { background: #FEE2E2; color: #991B1B; }
.watch { display: flex; flex-direction: column; }
.watch button { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); text-align: left; width: 100%; }
.watch button:last-child { border-bottom: 0; }
.watch button:hover b { color: var(--orange); }
.watch b { font-size: 18px; font-weight: 800; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed span:last-child { color: var(--muted); font-size: 12px; white-space: nowrap; }
.feed span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer .feed span:first-child { white-space: normal; }
.sim { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.sim label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.sim .field { max-width: none; }

/* Fiche utilisateur */
.drawer { position: fixed; inset: 0; z-index: 1000; }
.drawer-back { position: absolute; inset: 0; background: rgba(11, 19, 38, .55); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--bg); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.d-head { display: flex; align-items: center; gap: 12px; }
.d-head h2 { font-size: 20px; overflow-wrap: anywhere; }
.d-head > div { min-width: 0; flex: 1; }
.avatar { flex: none; width: 56px; height: 56px; border-radius: 50%; background: var(--navy); color: #fff; box-shadow: inset 0 0 0 3px var(--orange); display: grid; place-items: center; font-weight: 800; font-size: 22px; }
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; margin: 0; }
.dl div { min-width: 0; }
.dl dt { color: var(--muted); font-size: 12px; }
.dl dd { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.form { display: flex; flex-direction: column; gap: 8px; }
.form textarea { min-height: 72px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; background: #fff; }
.form select { width: 100%; }
.rlist { display: flex; flex-direction: column; gap: 8px; }
.ritem { display: flex; gap: 12px; align-items: center; padding: 6px; border-radius: 10px; background: var(--soft); }
.ritem .thumb { flex: none; background: #fff; border-radius: 8px; }
.ritem b { display: block; }
.ritem .muted { font-size: 12px; }

/* Feedback */
.fb-list { display: flex; flex-direction: column; gap: 12px; }
.fb-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; }
.fb-who { font-weight: 700; text-decoration: underline; cursor: pointer; overflow-wrap: anywhere; }
.fb-msg { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-shot { display: block; max-width: 100%; max-height: 70vh; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; }
.fb-ua { margin: 8px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.tip { position: fixed; z-index: 2000; pointer-events: none; max-width: 260px; padding: 6px 10px; border-radius: 8px; background: var(--navy); color: #fff; font-size: 12px; }
.toast { position: fixed; z-index: 2000; left: 50%; bottom: 80px; transform: translateX(-50%); padding: 10px 14px; background: var(--navy); color: #fff; border-radius: 10px; max-width: calc(100% - 32px); }

@media (max-width: 900px) {
  .c3, .c4, .c5, .c6, .c7, .c8 { grid-column: span 12; }
}
@media (max-width: 600px) {
  .top-in, .tabs { padding-left: 16px; padding-right: 16px; }
  .page { padding: 16px 16px 72px; }
  .brand span, #me { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  input.field { max-width: none; }
}
