/* Démo PME — styles de base partagés (charte injectée par app.js en variables CSS).
   Les écrans ajoutent les leurs dans crm/crm.css et tech/tech.css. */

:root {
  --brand: #184909;
  --brand-dark: #0f3306;
  --brand-soft: #ccedd1;
  --accent: #61ce70;
  --font: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bg: #f5f6f4;
  --panel: #ffffff;
  --ink: #1d2420;
  --ink-2: #4b554f;
  --ink-3: #7c8580;
  --line: #e3e6e2;
  --line-2: #eef0ed;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 20, .06), 0 4px 16px rgba(16, 24, 20, .05);
  --red: #c62828; --red-soft: #fdecea;
  --amber: #b26a00; --amber-soft: #fff4e0;
  --blue: #1d5fd1; --blue-soft: #e8f0fe;
  --green: #217a3c; --green-soft: #e6f4ea;
  --violet: #6d3fc9; --violet-soft: #f1ebfd;
  --gray: #59625d; --gray-soft: #eef0ee;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.icon { flex: none; }
.boot { display: grid; place-items: center; align-content: center; gap: 12px; min-height: 100vh; padding: 16px; text-align: center; color: var(--ink-3); }

/* --- Bandeau démo --------------------------------------------------------------- */
.demo-banner { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 6px 16px; background: #1d2420; color: #e9ece9; font-size: 12px; }
.demo-banner b { color: #fff; }
.demo-banner .link { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: #c9d4cc; cursor: pointer; text-decoration: underline; font-size: 12px; padding: 0; }

/* --- Coque du CRM ------------------------------------------------------------------ */
.crm { display: flex; flex-direction: column; height: 100vh; }
.crm-body { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 232px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px; gap: 2px; overflow-y: auto; }
.sidebar .brand { display: block; padding: 4px 10px 14px; }
.sidebar .brand img { max-width: 120px; max-height: 92px; display: block; }
.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 600; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; font-size: 13.5px; }
.nav:hover { background: var(--line-2); color: var(--ink); }
.nav.active { background: var(--brand-soft); color: var(--brand-dark); }
.nav em { margin-left: auto; font-style: normal; background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.nav-spacer { flex: 1; min-height: 16px; }
.nav-tech { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.office { display: flex; gap: 10px; align-items: center; padding: 12px 10px 2px; border-top: 1px solid var(--line); margin-top: 8px; }
.office small { display: block; color: var(--ink-3); font-size: 12px; }
.main { flex: 1; overflow-y: auto; padding: 24px 28px 48px; min-width: 0; position: relative; }
.menu-btn { display: none; }

.phone-panel { width: 410px; flex: none; border-left: 1px solid var(--line); background: #e9ece8; display: flex; flex-direction: column; }
.phone-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.phone-frame { flex: 1; display: grid; place-items: center; padding: 16px; min-height: 0; }
.phone-frame iframe { width: 375px; height: min(780px, 100%); border: 10px solid #1d2420; border-radius: 34px; background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.18); }

/* --- Page ---------------------------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--ink-3); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.card-body { padding: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

/* --- Tableaux --------------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #fafbf9; }
.table .right { text-align: right; }

/* --- Boutons ----------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 13.5px; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #c9cec8; background: #fafbf9; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { border-color: transparent; background: none; }
.btn-danger { color: var(--red); }
.btn-lg { padding: 13px 18px; font-size: 15px; border-radius: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: none; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--line-2); }

/* --- Badges, avatars ------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tone-red { background: var(--red-soft); color: var(--red); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-gray { background: var(--gray-soft); color: var(--gray); }
.tone-brand { background: var(--brand-soft); color: var(--brand-dark); }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; width: 28px; height: 28px; font-size: 11px; }
.avatar-empty { background: var(--line); color: var(--ink-3); }

/* --- Formulaires --------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; outline: none; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }

/* --- Modale ------------------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(18, 24, 20, .42); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line-2); }
.qr-box { display: grid; justify-items: center; gap: 12px; text-align: center; }
.qr { width: 240px; }
.qr svg { width: 100%; height: auto; display: block; }

/* --- Divers ---------------------------------------------------------------------------- */
.empty { display: grid; justify-items: center; gap: 8px; padding: 32px 16px; color: var(--ink-3); text-align: center; }
.working { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-weight: 600; padding: 12px 0; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: dot 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: #1d2420; color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; transition: .2s; pointer-events: none; z-index: 80; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .phone-panel { position: fixed; right: 0; top: 0; bottom: 0; z-index: 40; box-shadow: -8px 0 30px rgba(0,0,0,.15); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 45; transform: translateX(-100%); transition: transform .2s; box-shadow: 8px 0 30px rgba(0,0,0,.12); }
  .sidebar.open { transform: none; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 44; background: rgba(16, 24, 20, .35); }
  .nav-qr { display: none; }
  .main { padding: 16px 16px 40px; }
  .menu-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; margin-bottom: 12px; cursor: pointer; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .demo-banner { flex-direction: column; gap: 2px; }
}
