/* Be Secretary — interface de l'appli (mobile d'abord) */
:root {
  --navy: #0f1b3d; --navy-2: #1b2a55; --orange: #ff6a2b; --orange-2: #ff8a55; --orange-soft: #fff1ea;
  --bg: #f5f6fa; --card: #ffffff; --text: #141a2e; --muted: #5d6680; --faint: #8a90a3; --line: #e6e8ef; --line-2: #f0f1f5;
  --green: #12a150; --green-soft: #e6f6ed; --red: #e5484d; --red-soft: #fdecec; --amber: #c27c0e; --amber-soft: #fdf3e1; --blue: #2f6fed; --blue-soft: #eaf1fe;
  --radius: 14px; --shadow: 0 1px 2px rgba(15, 27, 61, .06), 0 4px 16px rgba(15, 27, 61, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --card: #141a2e; --text: #eef0f6; --muted: #a3aac0; --faint: #7a819a; --line: #262e48; --line-2: #1c2338;
    --orange-soft: #3a2014; --green-soft: #0f2e1d; --red-soft: #3a1416; --amber-soft: #352610; --blue-soft: #14244a; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--orange); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; letter-spacing: -.02em; }
h2 { font-size: 18px; letter-spacing: -.01em; }
h3 { font-size: 15px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- Coque ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 240px; flex: none; background: var(--navy); color: #fff; padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.02em; padding: 4px 10px 16px; display: flex; align-items: center; gap: 8px; color: #fff; }
.brand .dot { color: var(--orange); }
.brand-logo { width: 28px; height: 28px; border-radius: 8px; background: var(--orange); display: grid; place-items: center; }
.brand-logo svg { width: 17px; height: 17px; color: #fff; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: #c9cfe3; font-weight: 500; position: relative; }
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(255,106,43,.16); color: #fff; }
.nav-item.active svg { color: var(--orange); }
.nav-sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px 6px; }
.nav-badge { margin-left: auto; background: var(--orange); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.side-foot { margin-top: auto; padding: 10px; font-size: 12px; color: #8f97b3; }
.main { flex: 1; min-width: 0; }
.topbar { display: none; }
.content { max-width: 1080px; margin: 0 auto; padding: 28px 28px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .side { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; height: calc(54px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; align-items: center; gap: 10px; }
  .topbar .brand { padding: 0; font-size: 18px; }
  .topbar .spacer { flex: 1; }
  .icon-btn.light { color: #fff; }
  .content { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  h1 { font-size: 21px; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: 11px; color: var(--muted); font-weight: 600; position: relative; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--orange); }
  .tabbar .nav-badge { position: absolute; top: 3px; left: 54%; margin: 0; font-size: 10px; padding: 0 5px; }
}

/* ---------- Éléments ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 9px 15px; border-radius: 10px; font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 40px; }
.btn svg { width: 17px; height: 17px; }
.btn:hover { border-color: #cfd3df; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: #f25d1d; }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { border: 0; background: transparent; width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); position: relative; }
.icon-btn:hover { background: var(--line-2); }
.icon-btn svg { width: 20px; height: 20px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.badge.orange { background: var(--orange-soft); color: #d2531c; } .badge.green { background: var(--green-soft); color: var(--green); } .badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); } .badge.blue { background: var(--blue-soft); color: var(--blue); } .badge.navy { background: var(--navy); color: #fff; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(229,72,77,.6); animation: pulse 1.4s infinite; display: inline-block; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(229,72,77,0); } 100% { box-shadow: 0 0 0 0 rgba(229,72,77,0); } }

label.field { display: block; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--faint); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=datetime-local], input[type=url], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 12px; min-height: 42px; outline: none; }
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,106,43,.15); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 6px 0; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--orange); flex: none; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #cfd3df; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--orange); }
.switch input:checked + i::after { transform: translateX(18px); }
.toggle-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.toggle-row:last-child { border-bottom: 0; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip .n { opacity: .7; margin-left: 4px; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.kpi .l { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi .s { color: var(--faint); font-size: 12px; margin-top: 2px; }

.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.item:last-child { border-bottom: 0; }
.item .t { font-weight: 600; }
.item .d { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
a.item { color: inherit; }
a.item:hover .t { color: var(--orange); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--orange-soft); color: #d2531c; font-weight: 700; display: grid; place-items: center; flex: none; font-size: 14px; }
.avatar.urgent { background: var(--red-soft); color: var(--red); }
.avatar svg { width: 19px; height: 19px; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: var(--faint); margin-bottom: 8px; }

.banner { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 12px; background: var(--orange-soft); border: 1px solid #ffd9c7; margin-bottom: 16px; }
.banner.green { background: var(--green-soft); border-color: #bfe7cf; } .banner.red { background: var(--red-soft); border-color: #f6c6c7; } .banner.blue { background: var(--blue-soft); border-color: #c9dafc; }
.banner svg { width: 20px; height: 20px; flex: none; }
.banner .grow b { display: block; }
@media (prefers-color-scheme: dark) { .banner { border-color: transparent !important; } }

.progress { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--orange); border-radius: 99px; }
.progress.over > i { background: var(--red); }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.bars i { flex: 1; background: var(--orange); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }

/* Conversation (transcription, SMS, simulateur) */
.chat { display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 82%; padding: 9px 13px; border-radius: 16px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; }
.bubble.them { background: var(--line-2); align-self: flex-start; border-bottom-left-radius: 5px; }
.bubble.me { background: var(--navy); color: #fff; align-self: flex-end; border-bottom-right-radius: 5px; }
.bubble.ai { background: var(--orange-soft); align-self: flex-start; border-bottom-left-radius: 5px; }
.bubble .meta { display: block; font-size: 11px; opacity: .65; margin-top: 3px; }
.composer { display: flex; gap: 8px; margin-top: 12px; }
.composer input { flex: 1; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; }
.kv dt { color: var(--muted); font-size: 13px; font-weight: 600; } .kv dd { margin: 0; }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }

.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps i { flex: 1; height: 5px; border-radius: 99px; background: var(--line); }
.steps i.on { background: var(--orange); }

.code { font: 600 17px/1 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--line-2); padding: 9px 12px; border-radius: 9px; letter-spacing: .03em; user-select: all; }

.day-col { border-top: 1px solid var(--line-2); padding: 12px 0; display: grid; grid-template-columns: 92px 1fr; gap: 12px; }
.day-col:first-child { border-top: 0; }
.day-col .dl { font-weight: 700; font-size: 13px; } .day-col .dl span { display: block; color: var(--muted); font-weight: 500; }
.day-col.today .dl { color: var(--orange); }
.appt { border-left: 3px solid var(--orange); background: var(--orange-soft); padding: 8px 11px; border-radius: 8px; cursor: pointer; }
.appt + .appt { margin-top: 6px; }
.appt.pending { border-left-color: var(--amber); background: var(--amber-soft); }
.appt.done { border-left-color: var(--green); background: var(--green-soft); opacity: .8; }
.appt.cancelled { border-left-color: var(--faint); background: var(--line-2); text-decoration: line-through; opacity: .6; }
.appt .h { font-weight: 700; font-size: 13px; }
.hours-row { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.hours-row .ranges { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hours-row input[type=time] { width: 110px; min-height: 36px; padding: 6px 8px; }

.plan { border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--card); display: flex; flex-direction: column; gap: 8px; }
.plan.current { border-color: var(--orange); }
.plan .price { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.plan .price small { font-size: 14px; color: var(--muted); font-weight: 600; }
.plan ul { margin: 4px 0 8px; padding-left: 18px; color: var(--muted); font-size: 14px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 700; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 9px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.scroll-x { overflow-x: auto; }

/* Fenêtres, notifications */
.modal-bg { position: fixed; inset: 0; background: rgba(9, 14, 30, .5); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--card); border-radius: 18px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h2 { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
@media (max-width: 640px) { .modal-bg { align-items: flex-end; padding: 0; } .modal { border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: calc(22px + env(safe-area-inset-bottom)); } }
@keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: fade .2s; max-width: 92vw; }
.toast.err { background: var(--red); }
@media (min-width: 861px) { .toasts { bottom: 24px; } }
.drop { position: absolute; right: 0; top: 44px; width: 340px; max-width: 92vw; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.18); z-index: 50; max-height: 70vh; overflow-y: auto; padding: 6px 14px; }
.notif-dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; background: var(--orange); border-radius: 50%; border: 2px solid var(--navy); }

/* Écrans de connexion */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(circle at 20% 0%, #24376e 0, var(--navy) 55%); }
.auth-card { width: 100%; max-width: 440px; background: var(--card); border-radius: 20px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.auth-card .brand { color: var(--text); padding: 0 0 18px; }
.auth-card h1 { margin-bottom: 6px; }

/* Simulateur */
.sim { display: flex; flex-direction: column; height: min(560px, 70vh); }
.sim .chat { flex: 1; overflow-y: auto; padding: 4px 2px 10px; }
.sim-call { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--navy); color: #fff; border-radius: 12px; margin-bottom: 12px; }
.sim-call .avatar { background: var(--orange); color: #fff; }
.mic { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--orange); color: #fff; display: grid; place-items: center; cursor: pointer; margin: 0 auto; }
.mic svg { width: 28px; height: 28px; }
.mic.on { background: var(--red); animation: pulse 1.4s infinite; }
.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.ic-inline { width: 14px; height: 14px; vertical-align: -2px; }
details summary { color: var(--orange); }
.btn-paypal { background: #ffc439; border-color: #ffc439; color: #111; }
.btn-paypal:hover { background: #f2ba36; border-color: #f2ba36; }
