/* ═══ Styles repris de la V1 : notes, gestion, GPS, garages, plans ═══ */
/* Notes épinglées */
.note-banner { margin: 0 16px 10px; border-radius: 12px; overflow: hidden; border: 1.5px solid rgba(245,166,35,0.35); }
.note-banner-body { background: rgba(245,166,35,0.08); padding: 11px 14px; }
.note-banner-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.note-banner-pin { font-size: 15px; }
.note-banner-author { font-size: 11px; color: var(--text2); flex: 1; }
.note-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 8px; }
.note-badge.temp { background: rgba(52,152,219,0.2); color: #3498db; }
.note-badge.perm { background: rgba(39,174,96,0.2); color: #27ae60; }
.note-banner-text { font-size: 13px; color: var(--text); line-height: 1.45; white-space: pre-wrap; }
.note-banner-actions { display: flex; border-top: 1px solid rgba(245,166,35,0.2); }
.note-action-btn { flex: 1; padding: 7px; background: none; border: none; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text2); display: flex; align-items: center; justify-content: center; gap: 5px; }
.note-action-btn:first-child { border-right: 1px solid rgba(245,166,35,0.2); }
.note-action-btn:hover { background: rgba(245,166,35,0.08); }
.note-form-card { margin: 0 16px 10px; background: var(--bg2); border: 1.5px solid var(--accent); border-radius: 12px; padding: 14px; }
.note-form-card textarea { width: 100%; background: var(--bg3); border: 1.5px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; padding: 10px 12px; outline: none; resize: vertical; min-height: 80px; box-sizing: border-box; font-family: inherit; }
.note-form-card textarea:focus { border-color: var(--accent); }
.note-type-row { display: flex; gap: 8px; margin: 10px 0; }
.note-type-btn { flex: 1; padding: 8px; border: 2px solid var(--border); border-radius: 8px; background: var(--bg3); color: var(--text2); font-size: 12px; font-weight: 700; cursor: pointer; text-align: center; transition: all .15s; }
.note-type-btn.sel { border-color: var(--accent); color: var(--accent); background: rgba(245,166,35,0.1); }
.note-form-btns { display: flex; gap: 8px; }
.note-save-btn { flex: 1; padding: 10px; background: var(--accent); color: #000; border: none; border-radius: 8px; font-size: 13px; font-weight: 800; cursor: pointer; }
.note-cancel-btn { padding: 10px 16px; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; color: var(--text2); cursor: pointer; }
.btn-pin-note { background: rgba(245,166,35,0.1); color: var(--accent); border: 1.5px solid rgba(245,166,35,0.3); border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 5px; }

.btn-parking { background: #2e3350; color: var(--text2); border: 1.5px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn-parking:active { background: #3e4565; }

.header-user { margin-left: auto; display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.user-chip { background: var(--bg3); border: 1px solid var(--border); color: var(--text2); font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 10px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-icon { background: var(--bg3); border: 1.5px solid var(--border); color: var(--text2); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-icon:active { background: var(--border); }

/* Page admin */
#admin-page { display:none; min-height:100vh; background:var(--bg); padding-bottom:80px; }
.ap-header { background:var(--bg2); border-bottom:2px solid var(--accent); padding:11px 16px; position:sticky; top:0; z-index:100; display:flex; align-items:center; gap:10px; }
.ap-back { background:none; border:none; color:var(--text2); font-size:13px; font-weight:700; cursor:pointer; display:flex; align-items:center; gap:7px; padding:6px 10px; border-radius:8px; }
.ap-back:active { background:var(--bg3); }
.ap-back img { width:22px; height:22px; border-radius:6px; object-fit:cover; }
.ap-title { font-size:15px; font-weight:800; color:var(--accent); margin-left:auto; }
.ap-layout { display:flex; min-height:calc(100vh - 50px); }
.ap-sidebar { width:190px; flex-shrink:0; position:sticky; top:50px; height:calc(100vh - 50px); overflow-y:auto; background:var(--bg2); border-right:1px solid var(--border); padding:10px 0; scrollbar-width:none; }
.ap-sidebar::-webkit-scrollbar { display:none; }
.ap-sidebar-item { display:flex; align-items:center; gap:10px; padding:11px 16px; font-size:13px; font-weight:600; color:var(--text2); cursor:pointer; border-left:3px solid transparent; transition:all .15s; user-select:none; }
.ap-sidebar-item:hover { background:var(--bg3); color:var(--text); }
.ap-sidebar-item.active { color:var(--accent); border-left-color:var(--accent); background:rgba(245,166,35,0.08); }
.ap-sidebar-icon { font-size:17px; flex-shrink:0; width:22px; text-align:center; }
.ap-sidebar-group-label { font-size:10px; font-weight:800; color:var(--text2); opacity:.6; text-transform:uppercase; letter-spacing:1.2px; padding:14px 16px 6px; }
.ap-sidebar-group-label:first-child { padding-top:4px; }
.ap-content { flex:1; min-width:0; }
.ap-body { padding:16px; max-width:760px; display:flex; flex-direction:column; gap:20px; }
.ap-section { display:flex; flex-direction:column; gap:12px; scroll-margin-top:70px; }
.ap-section-hdr { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; margin-bottom:2px; }
.ap-section-icon { font-size:15px; }
.ap-section-title { font-size:15px; font-weight:800; color:var(--text); }
.ap-section-desc { font-size:12px; color:var(--text2); margin-top:-6px; }
@media (max-width:699px) {
  .ap-layout { flex-direction:column; }
  .ap-sidebar { width:100%; height:auto; position:sticky; top:50px; border-right:none; border-bottom:1px solid var(--border); display:flex; flex-direction:row; overflow-x:auto; padding:6px 8px; gap:4px; z-index:50; }
  .ap-sidebar-item { flex-shrink:0; padding:7px 12px; border-left:none; border-radius:20px; border:1.5px solid var(--border); background:var(--bg3); white-space:nowrap; font-size:12px; }
  .ap-sidebar-item.active { border-color:var(--accent); }
  .ap-sidebar-icon { display:none; }
  .ap-sidebar-group-label { display:none; }
}
.ap-section-label { font-size:10px; font-weight:800; color:var(--text2); text-transform:uppercase; letter-spacing:1px; margin-bottom:8px; }
.ap-user-card { background:var(--bg2); border:1px solid var(--border); border-radius:14px; overflow:hidden; }
.ap-user-hdr { display:flex; align-items:center; padding:13px 16px; gap:12px; cursor:pointer; user-select:none; }
.ap-user-hdr:active { background:var(--bg3); }
.ap-avatar { width:38px; height:38px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:17px; flex-shrink:0; }
.ap-avatar.driver { background:rgba(245,166,35,0.15); }
.ap-avatar.coordinator { background:rgba(52,152,219,0.15); }
.ap-user-meta { flex:1; min-width:0; }
.ap-user-name { font-size:14px; font-weight:700; color:var(--text); }
.ap-user-role { font-size:11px; color:var(--text2); margin-top:1px; }
.ap-chevron { color:var(--text2); font-size:12px; transition:transform .2s; flex-shrink:0; }
.ap-chevron.open { transform:rotate(180deg); }
.ap-del { background:rgba(231,76,60,0.12); border:1px solid rgba(231,76,60,0.25); color:var(--red); padding:6px 12px; border-radius:8px; cursor:pointer; font-size:12px; font-weight:600; flex-shrink:0; }
.ap-user-body { border-top:1px solid var(--border); padding:14px 16px; display:none; }
.ap-user-body.open { display:block; }
.ap-pass-row { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--text2); margin-bottom:12px; }
.ap-pass-btn { background:none; border:none; color:var(--text2); cursor:pointer; font-size:14px; padding:2px 4px; }
.ap-circuits-label { font-size:10px; font-weight:700; color:var(--text2); text-transform:uppercase; letter-spacing:.5px; margin-bottom:8px; }
.ap-circuits-grid { display:flex; flex-wrap:wrap; gap:7px; }
.ap-circuit-btn { padding:7px 14px; border-radius:20px; border:2px solid var(--border); background:var(--bg3); color:var(--text2); font-size:12px; font-weight:700; cursor:pointer; transition:all .15s; -webkit-tap-highlight-color:transparent; }
.ap-circuit-btn.on { border-color:var(--accent); color:var(--accent); background:rgba(245,166,35,0.12); }
.ap-changelog { font-size:11px; color:var(--text2); margin-top:10px; font-style:italic; }
.ap-add-form { background:var(--bg2); border:1px solid var(--border); border-radius:14px; padding:16px; }
.ap-add-title { font-size:13px; font-weight:700; color:var(--text); margin-bottom:12px; }
.ap-input { width:100%; padding:11px 14px; background:var(--bg3); border:1.5px solid var(--border); border-radius:10px; color:var(--text); font-size:14px; outline:none; margin-bottom:10px; box-sizing:border-box; }
.ap-input:focus { border-color:var(--accent); }
.ap-submit { width:100%; padding:12px; background:var(--accent); color:#000; border:none; border-radius:10px; font-size:14px; font-weight:800; cursor:pointer; }
.ap-err { color:var(--red); font-size:12px; margin-top:6px; display:none; }
.ap-sep { height:1px; background:var(--border); }
/* Notes admin */
.ap-note-row { background:var(--bg2); border:1px solid var(--border); border-radius:12px; overflow:hidden; }
.ap-note-row-top { display:flex; align-items:center; padding:12px 14px; gap:10px; }
.ap-note-circuit { font-size:13px; font-weight:800; color:var(--accent); min-width:70px; }
.ap-note-preview { flex:1; font-size:12px; color:var(--text2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ap-note-btns { display:flex; gap:6px; flex-shrink:0; }
.ap-note-edit-btn { padding:5px 10px; border:1.5px solid var(--border); border-radius:7px; background:none; color:var(--text2); font-size:11px; font-weight:700; cursor:pointer; }
.ap-note-del-btn  { padding:5px 10px; border:1.5px solid rgba(231,76,60,.3); border-radius:7px; background:none; color:var(--red); font-size:11px; font-weight:700; cursor:pointer; }
.ap-note-form { border-top:1px solid var(--border); padding:12px 14px; background:var(--bg3); }
/* Plans admin */
.ap-plan-row { background:var(--bg2); border:1px solid var(--border); border-radius:12px; padding:12px 14px; display:flex; align-items:center; gap:12px; }
.ap-plan-thumb { width:56px; height:40px; border-radius:6px; object-fit:cover; border:1px solid var(--border); background:var(--bg3); flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:18px; }
.ap-plan-thumb img { width:56px; height:40px; border-radius:6px; object-fit:cover; }
.ap-plan-meta { flex:1; min-width:0; }
.ap-plan-key { font-size:12px; font-weight:700; color:var(--text); }
.ap-plan-by { font-size:11px; color:var(--text2); }
.ap-plan-upload-label { padding:6px 12px; border:1.5px solid var(--accent); color:var(--accent); border-radius:8px; font-size:11px; font-weight:700; cursor:pointer; white-space:nowrap; flex-shrink:0; }
.ap-plan-del { padding:6px 10px; border:1.5px solid rgba(231,76,60,.3); color:var(--red); border-radius:8px; font-size:11px; font-weight:700; cursor:pointer; background:none; flex-shrink:0; }
/* Archives */
.ap-archive-row { background:var(--bg2); border:1px solid var(--border); border-radius:12px; padding:12px 14px; display:flex; align-items:center; gap:12px; }
.ap-archive-badge { background:var(--bg3); color:var(--text2); font-size:12px; font-weight:800; padding:4px 10px; border-radius:8px; letter-spacing:.5px; flex-shrink:0; min-width:58px; text-align:center; }
.ap-archive-meta { flex:1; min-width:0; }
.ap-archive-name { font-size:13px; font-weight:600; color:var(--text); }
.ap-archive-date { font-size:11px; color:var(--text2); margin-top:2px; }
.ap-archive-btn { padding:7px 14px; border-radius:8px; border:1.5px solid; font-size:12px; font-weight:700; cursor:pointer; white-space:nowrap; flex-shrink:0; }
.ap-archive-btn.archive { border-color:rgba(231,76,60,.35); color:var(--red); background:rgba(231,76,60,.08); }
.ap-archive-btn.restore { border-color:rgba(39,174,96,.4); color:#27ae60; background:rgba(39,174,96,.1); }

#last-update { text-align:center; font-size:11px; color:var(--text2); opacity:.6; padding:14px 16px 24px; }

.offline-banner { display:none; position:sticky; top:0; z-index:200; background:#c0392b; color:#fff; text-align:center; font-size:12px; font-weight:700; padding:8px 12px; }

#gps-toggle-btn { padding:8px 14px; border-radius:20px; border:1.5px solid var(--border); background:var(--bg3); color:var(--text2); font-size:12px; font-weight:700; cursor:pointer; white-space:nowrap; }
#gps-toggle-btn.active { border-color:#27ae60; color:#27ae60; background:rgba(39,174,96,.1); }

#gps-page { display:none; position:fixed; inset:0; background:var(--bg); z-index:500; flex-direction:column; }
#gps-page-header { display:flex; align-items:center; justify-content:space-between; padding:14px 16px; border-bottom:1px solid var(--border); background:var(--bg2); }
#gps-page-header h2 { font-size:15px; font-weight:800; color:var(--text); }
#gps-map { flex:1; min-height:260px; }
#gps-driver-list { max-height:38vh; overflow-y:auto; padding:10px 14px; }
.gps-driver-row { display:flex; align-items:center; gap:10px; padding:10px 12px; background:var(--bg2); border:1px solid var(--border); border-radius:10px; margin-bottom:8px; }
.gps-driver-dot { width:10px; height:10px; border-radius:50%; background:#27ae60; flex-shrink:0; }
.gps-driver-meta { flex:1; min-width:0; }
.gps-driver-name { font-size:13px; font-weight:700; color:var(--text); }
.gps-driver-sub { font-size:11px; color:var(--text2); }
.gps-empty { text-align:center; color:var(--text2); font-size:13px; padding:24px; }


#garage-page { display:none; position:fixed; inset:0; background:var(--bg); z-index:500; flex-direction:column; }
#garage-page-header { display:flex; align-items:center; justify-content:flex-end; padding:14px 16px; }
#garage-page-body { flex:1; overflow-y:auto; padding:16px; }
.garage-card { display:flex; align-items:center; gap:14px; padding:16px; border-radius:14px; border:2px solid var(--border); background:var(--bg2); cursor:pointer; width:100%; text-align:left; margin-bottom:12px; text-decoration:none; color:inherit; }
.garage-card:hover, .garage-card:active { border-color:#3498db; }
.garage-meta { flex:1; min-width:0; }
.garage-name { font-size:19px; font-weight:800; color:var(--text); }
.garage-addr { font-size:12px; color:var(--text2); margin-top:2px; }
.garage-svc-row { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.garage-svc-chip { font-size:10.5px; font-weight:700; padding:3px 8px; border-radius:8px; background:var(--bg3); color:var(--text2); border:1px solid var(--border); }
.garage-empty { text-align:center; color:var(--text2); font-size:13px; padding:40px 20px; }

.history-row { background:var(--bg2); border:1px solid var(--border); border-radius:10px; padding:10px 14px; margin-bottom:6px; font-size:12.5px; }
.history-row .h-action { font-weight:700; color:var(--accent); }
.history-row .h-meta { color:var(--text2); font-size:11px; margin-top:2px; }

/* Vue attribution par circuit */
.ap-circ-row { background:var(--bg2); border:1px solid var(--border); border-radius:12px; padding:12px 14px; display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.ap-circ-badge { background:var(--accent); color:#000; font-size:12px; font-weight:800; padding:4px 10px; border-radius:8px; letter-spacing:.5px; flex-shrink:0; min-width:58px; text-align:center; }
.ap-circ-drivers { display:flex; flex-wrap:wrap; gap:6px; flex:1; }
.ap-driver-chip { display:flex; align-items:center; gap:5px; padding:5px 10px; border-radius:20px; background:rgba(245,166,35,0.1); border:1.5px solid rgba(245,166,35,0.3); font-size:12px; font-weight:600; color:var(--accent); }
.ap-driver-chip-del { background:none; border:none; cursor:pointer; color:var(--text2); font-size:13px; line-height:1; padding:0; margin-left:2px; }
.ap-driver-chip-del:hover { color:var(--red); }
.ap-circ-none { font-size:12px; color:var(--text2); font-style:italic; }
@media (min-width:700px) {
  .ap-users-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
}

#plan-modal { display: none; position: fixed; inset: 0; background: #000; z-index: 9999; flex-direction: column; }
.plan-modal-topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: rgba(20,20,20,.85); backdrop-filter: blur(6px); position: relative; z-index: 2; }
.plan-modal-topbar h3 { font-size: 13px; font-weight: 800; color: var(--accent); }
.plan-modal-topbar p { font-size: 11px; color: #aaa; margin-top: 2px; }
.plan-modal-close { background: rgba(255,255,255,.12); border: none; color: #fff; font-size: 20px; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.plan-modal-content { flex: 1; overflow: hidden; touch-action: none; display: flex; align-items: center; justify-content: center; }
.plan-modal-content img { display: block; width: 100%; height: auto; margin: auto; transform-origin: 0 0; will-change: transform; }


/* ═══ BusPilot V2 — écran de conduite ═══ */
:root {
  --bg: #0c0e14; --bg2: #161a24; --bg3: #1f2433; --bg4: #2a3045;
  --accent: #f5a623; --accent-ink: #1a1204; --green: #2ecc71; --green-d: #1f9d55; --red: #e74c3c; --blue: #4a9eff;
  --nav: #1a73e8;
  --text: #f1f3f8; --text2: #a3a9bf; --text3: #6f7690; --border: #2a3046; --radius: 16px;
}
:root[data-theme="black"] {
  --bg: #000; --bg2: #0b0b0d; --bg3: #151518; --bg4: #202025; --border: #222228;
  --text: #f5f5f5; --text2: #9a9aa2; --text3: #66666e;
}
:root[data-theme="light"] {
  --bg: #f3f4f8; --bg2: #ffffff; --bg3: #eceef4; --bg4: #e0e3ec; --border: #d9dce6;
  --accent: #d9820a; --accent-ink: #fff; --green: #1e8449; --green-d: #1e8449; --red: #c0392b; --blue: #1f6fd1; --nav: #1a73e8;
  --text: #15171f; --text2: #5c6275; --text3: #8a90a3;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 16px; min-height: 100vh; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }
.muted { color: var(--text2); }
.small { font-size: 12px; }
.accent { color: var(--accent); }
.good { color: var(--green); }
.link { color: var(--blue); text-decoration: none; font-weight: 700; }
.warn-txt { color: #e67e22; }
.empty { padding: 36px 16px; text-align: center; color: var(--text2); font-size: 15px; line-height: 1.5; }

/* ── Connexion ── */
#login-screen { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 9999; gap: 18px; padding: 32px; }
#login-screen .login-logo { width: min(260px, 70vw); height: auto; aspect-ratio: 1; border-radius: 28px; object-fit: cover; }
#login-screen .login-version { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text2); margin-top: -6px; }
#login-screen h2 { font-size: 24px; font-weight: 900; color: var(--accent); }
#login-screen p { font-size: 14px; color: var(--text2); margin-top: -10px; }
#login-screen input { width: 100%; max-width: 320px; height: 56px; padding: 0 16px; background: var(--bg2); border: 2px solid var(--border); border-radius: 14px; color: var(--text); font-size: 18px; text-align: center; outline: none; }
#login-screen input:focus { border-color: var(--accent); }
#login-screen button { width: 100%; max-width: 320px; height: 56px; background: var(--accent); color: var(--accent-ink); border: none; border-radius: 14px; font-size: 18px; font-weight: 900; }
#login-screen .error { color: var(--red); font-size: 14px; display: none; text-align: center; }
.beta-pill { font-size: 12px; font-weight: 800; color: var(--accent-ink); background: var(--accent); padding: 2px 8px; border-radius: 20px; vertical-align: middle; }
.tb-wake { flex-shrink: 0; font-size: 15px; line-height: 1; opacity: .85; }
.tb-wake[hidden] { display: none; }

/* ── En-tête ── */
#main-app { display: none; }
.topbar { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-top: calc(env(safe-area-inset-top) + 18px); background: var(--bg2); border-bottom: 1px solid var(--border); }
.tb-circuit { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; background: none; border: none; color: inherit; text-align: left; padding: 4px; border-radius: 12px; }
.tb-circuit:active { background: var(--bg3); }
.tb-badge { background: var(--accent); color: var(--accent-ink); font-weight: 900; font-size: 22px; padding: 6px 12px; border-radius: 11px; white-space: nowrap; }
.tb-meta { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.tb-meta b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-meta span { font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-caret { color: var(--text2); font-size: 13px; flex-shrink: 0; }
.tb-clock { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.tb-icon { width: 48px; height: 48px; flex-shrink: 0; border-radius: 14px; background: var(--bg3); border: 1px solid var(--border); color: var(--text); font-size: 22px; display: flex; align-items: center; justify-content: center; }

/* ── Contenu ── */
.wrap { max-width: 680px; margin: 0 auto; padding: 12px 12px calc(40px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.wrap .note-banner, .wrap .note-form-card { margin: 0; }
.note-banner-text { font-size: 15px; }

.seg { display: flex; background: var(--bg3); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; height: 50px; border: none; border-radius: 11px; font-size: 16px; font-weight: 800; background: none; color: var(--text2); }
.seg button.on.am { background: var(--green-d); color: #fff; }
.seg button.on.pm { background: #c0392b; color: #fff; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; min-height: 56px; padding: 8px 14px; border-radius: 14px; border: 2px solid var(--border); background: var(--bg2); color: var(--text); display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; text-align: left; }
.chip .c1 { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.chip .c2 { font-size: 13px; color: var(--text2); font-variant-numeric: tabular-nums; }
.chip.on { border-color: var(--accent); background: rgba(245,166,35,.12); }
.tag { font-size: 10.5px; font-weight: 900; padding: 2px 7px; border-radius: 20px; text-transform: uppercase; letter-spacing: .4px; }
.tag.live { background: var(--green-d); color: #fff; }
.tag.next { background: rgba(74,158,255,.18); color: var(--blue); }
.now-link { align-self: stretch; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 1.5px dashed var(--blue); background: rgba(74,158,255,.08); color: var(--blue); font-size: 14px; font-weight: 800; text-align: left; }

/* Carte « prochain arrêt » */
.hero { background: var(--bg2); border: 2px solid var(--accent); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.hero.done { border-color: var(--border); }
.hero-kicker { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.hero.done .hero-kicker { color: var(--text2); }
.hero-eta { color: var(--text); font-size: 15px; letter-spacing: 0; text-transform: none; }
.hero-stop { display: flex; gap: 14px; align-items: flex-start; }
.hero-time { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.05; }
.hero-name { font-size: 21px; font-weight: 800; line-height: 1.25; }
.hero-sub { font-size: 14px; color: var(--text2); margin-top: 4px; }
.btn-nav { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; border-radius: 16px; background: var(--nav); color: #fff; font-size: 19px; font-weight: 900; text-decoration: none; }
.btn-nav:active { filter: brightness(.9); }
.btn-sec { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 8px 12px; border-radius: 14px; background: var(--bg3); border: 1px solid var(--border); color: var(--text); font-size: 15px; font-weight: 800; text-decoration: none; text-align: center; }
.btn-sec:active { background: var(--bg4); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2.one { grid-template-columns: 1fr; }

/* Détails */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card.pad { padding: 14px; }
.card-kicker { font-size: 11px; font-weight: 900; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.kv-list { display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.details-toggle { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: none; border: none; color: var(--text); text-align: left; font-size: 15px; font-weight: 700; }
.details-sum { flex: 1; min-width: 0; line-height: 1.4; }
.details-sum .dot { color: var(--text3); margin: 0 6px; }
.caret { color: var(--text2); font-size: 12px; }
.details-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14.5px; border-top: 1px solid var(--border); padding-top: 12px; }
.kv .k { color: var(--text2); font-weight: 600; }
.kv .v { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }

/* Arrêts */
.stops-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 2px 0; }
.stops-head h3 { font-size: 14px; font-weight: 900; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }
.icon-btn { width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); font-size: 19px; }
.search-box input { width: 100%; height: 52px; padding: 0 14px; background: var(--bg2); border: 2px solid var(--accent); border-radius: 14px; color: var(--text); font-size: 16px; outline: none; }
.stops { display: flex; flex-direction: column; gap: 8px; }
.past-toggle { min-height: 48px; border: 1.5px dashed var(--border); border-radius: 14px; background: none; color: var(--text2); font-size: 14px; font-weight: 800; }
.stop { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.stop-line { display: flex; align-items: stretch; }
.stop-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 66px; background: none; border: none; color: inherit; text-align: left; }
.stop-time { font-size: 18px; font-weight: 900; min-width: 52px; font-variant-numeric: tabular-nums; color: var(--accent); }
.stop-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.stop-name { font-size: 16px; font-weight: 700; line-height: 1.25; }
.stop-sub { font-size: 12.5px; color: var(--text2); }
.stop-kids { flex-shrink: 0; font-size: 14px; font-weight: 800; padding: 5px 9px; border-radius: 10px; background: rgba(245,166,35,.14); color: var(--accent); white-space: nowrap; }
.stop-nav { width: 64px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: rgba(26,115,232,.14); color: var(--blue); font-size: 24px; text-decoration: none; border-left: 1px solid var(--border); }
.stop-nav:active { background: rgba(26,115,232,.3); }
.stop.school { border-color: rgba(46,204,113,.55); background: rgba(46,204,113,.06); }
.stop.school .stop-time { color: var(--green); }
.stop.school .stop-kids { background: rgba(46,204,113,.15); color: var(--green); }
.stop.dom .stop-time { color: var(--blue); }
.stop.past { opacity: .45; }
.stop.next { border: 2px solid var(--accent); box-shadow: 0 0 0 3px rgba(245,166,35,.16); }
.stop-extra { border-top: 1px solid var(--border); padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 10px; background: var(--bg3); }
.students { display: flex; flex-direction: column; }
.student { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 15px; border-bottom: 1px solid var(--border); }
.student:last-child { border-bottom: none; }
.extra-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-mini { flex: 1; min-width: 130px; min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); font-size: 14px; font-weight: 800; text-decoration: none; }
.stop-via { display: flex; gap: 12px; align-items: center; padding: 2px 14px; font-size: 13px; color: var(--text3); }
.stop-via .t { min-width: 52px; font-variant-numeric: tabular-nums; }
.stop-via.past { opacity: .5; }

/* ── Sélecteur de circuit ── */
.sheet { position: fixed; inset: 0; z-index: 900; background: var(--bg); display: none; flex-direction: column; }
.sheet.open { display: flex; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: calc(env(safe-area-inset-top) + 18px); border-bottom: 1px solid var(--border); background: var(--bg2); }
.sheet-head img { width: 40px; height: 40px; border-radius: 10px; }
.sheet-head h2 { flex: 1; font-size: 20px; font-weight: 900; }
.sheet-search { padding: 12px 16px 0; max-width: 760px; width: 100%; margin: 0 auto; }
.sheet-search input { width: 100%; height: 54px; padding: 0 16px; background: var(--bg2); border: 2px solid var(--border); border-radius: 14px; color: var(--text); font-size: 18px; outline: none; }
.sheet-search input:focus { border-color: var(--accent); }
.sheet-body { flex: 1; overflow-y: auto; padding: 12px 16px 24px; max-width: 760px; width: 100%; margin: 0 auto; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.ptile { position: relative; min-height: 88px; border-radius: 16px; background: var(--bg2); border: 2px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px; cursor: pointer; text-align: center; }
.ptile:active { border-color: var(--accent); }
.ptile.on { border-color: var(--accent); background: rgba(245,166,35,.1); }
.ptile.garage { border-color: rgba(74,158,255,.5); }
.ptile-num { font-size: 24px; font-weight: 900; line-height: 1.1; }
.ptile-num.long { font-size: 18px; }
.ptile { padding-top: 14px; }
.ptile-sub { font-size: 12.5px; color: var(--text2); font-variant-numeric: tabular-nums; }
.ptile-sub.live { color: var(--green); font-weight: 900; }
.ptile-pin { position: absolute; top: 2px; right: 2px; width: 36px; height: 36px; background: none; border: none; font-size: 18px; color: var(--text3); }
.ptile-pin.on { color: var(--accent); }
.psec { font-size: 12px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: var(--text2); margin: 20px 2px 10px; display: flex; align-items: center; gap: 8px; }
.psec::after { content: ""; flex: 1; height: 1px; background: var(--border); }
#last-update { text-align: center; font-size: 12px; color: var(--text2); opacity: .7; padding: 18px 16px 8px; }

/* ── Menu ── */
.menu-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 950; display: none; }
.menu-backdrop.open { display: block; }
.menu { position: fixed; left: 0; right: 0; bottom: 0; z-index: 951; background: var(--bg2); border-radius: 22px 22px 0 0; padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; transform: translateY(110%); transition: transform .2s ease; max-height: 85vh; overflow-y: auto; }
.menu.open { transform: none; }
.menu-grab { width: 44px; height: 5px; border-radius: 3px; background: var(--border); margin: 4px auto 10px; }
.menu-user { font-size: 13px; color: var(--text2); padding: 2px 12px 8px; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 0 12px; border: none; background: none; color: var(--text); font-size: 17px; font-weight: 700; border-radius: 12px; text-align: left; }
.menu-item span { width: 28px; text-align: center; font-size: 20px; }
.menu-item:active { background: var(--bg3); }
.menu-item.on { color: var(--green); }
.menu-item.danger { color: var(--red); }

/* Tablette / écran partagé à côté de Google Maps */
@media (min-width: 700px) {
  .ap-users-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}

/* ── BusPilot 2 : Gestion en lecture seule ── */
.bp2-readonly { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--accent); background: rgba(245,166,35,.08); color: var(--text); font-size: 13.5px; font-weight: 600; line-height: 1.45; }

/* ── BusPilot 2 : carte du parcours ── */
.btn-map { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 60px; margin-bottom: 10px; border-radius: 16px; border: 2px solid var(--accent); background: var(--bg2); color: var(--text); font-size: 18px; font-weight: 900; }
.btn-map:active { background: var(--bg3); }
body.map-open { overflow: hidden; }
#map-page { position: fixed; inset: 0; z-index: 600; display: flex; flex-direction: column; background: var(--bg); }
#map-page[hidden] { display: none; }
.map-top { display: flex; align-items: center; gap: 12px; padding: 10px 12px; padding-top: calc(env(safe-area-inset-top) + 18px); background: var(--bg2); border-bottom: 1px solid var(--border); z-index: 2; }
.map-head { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.map-head b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-head span { font-size: 14px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-close { flex-shrink: 0; width: 52px; height: 52px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg3); color: var(--text); font-size: 22px; font-weight: 900; }
#route-map { flex: 1; background: #1b1f2a; }
.map-status { position: absolute; left: 12px; right: 72px; bottom: calc(env(safe-area-inset-bottom) + 96px); z-index: 1000; padding: 10px 14px; border-radius: 12px; background: rgba(12,14,20,.92); color: #fff; font-size: 15px; font-weight: 700; text-align: center; }
.map-recenter { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 24px); z-index: 1000; min-height: 60px; padding: 0 26px; border-radius: 30px; border: none; background: var(--nav); color: #fff; font-size: 19px; font-weight: 900; box-shadow: 0 6px 20px rgba(0,0,0,.45); }
/* Tuiles OSM assombries (thèmes sombres) — contraste élevé la nuit. */
:root:not([data-theme="light"]) .map-tiles { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.95); }
#route-map .leaflet-control-zoom a { width: 48px; height: 48px; line-height: 48px; font-size: 24px; }
#route-map .leaflet-bottom.leaflet-right { margin-bottom: env(safe-area-inset-bottom); }
.stop-pin { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #fff; color: #111; border: 3px solid #111; font-size: 16px; font-weight: 900; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.stop-pin.approx { border-style: dashed; }
.stop-popup .sp-approx { color: #b36b00; font-weight: 700; font-size: 14px; }
.stop-pin.next { background: var(--accent); color: var(--accent-ink); border-color: #fff; transform: scale(1.18); }
.bus-pos { width: 44px; height: 44px; transition: transform .4s linear; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.bus-pos.no-heading .bus-arrow { display: none; }
.stop-popup .leaflet-popup-content { margin: 14px 16px; font-size: 16px; line-height: 1.4; }
.stop-popup .sp-name { font-size: 18px; font-weight: 900; margin-bottom: 4px; }
.stop-popup .sp-meta { font-weight: 700; margin-bottom: 4px; }
.stop-popup .sp-addr { color: #555; margin-bottom: 8px; }
.stop-popup .sp-gmaps { display: block; margin-top: 10px; padding: 12px; border-radius: 12px; background: #1a73e8; color: #fff !important; text-align: center; font-weight: 900; text-decoration: none; }

/* ── BusPilot 2 : trajets (Gestion) ── */
.rt-summary { font-size: 13.5px; font-weight: 700; color: var(--text2); }
.rt-job { font-size: 13.5px; font-weight: 700; color: var(--accent); }
.rt-job:empty { display: none; }
.rt-err { margin-top: 6px; color: var(--red); font-weight: 600; font-size: 12.5px; }
.rt-list { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; }
.rt-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 9px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--border); font-size: 13px; }
.rt-name { flex: 1 1 180px; min-width: 0; }
.rt-chip { font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 20px; }
.rt-chip.ok { background: rgba(46,204,113,.14); color: var(--green); }
.rt-chip.stale { background: rgba(245,166,35,.16); color: var(--accent); }
.rt-chip.none { background: var(--bg3); color: var(--text2); }
.rt-meta { font-size: 12px; color: var(--text2); }
.rt-btn { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg3); color: var(--text); font-size: 12px; font-weight: 700; }
.rt-btn:disabled, .ap-submit:disabled { opacity: .5; cursor: default; }
