/* Version web: l'interface est celle de Windows; ce fichier ajoute le mobile/tablette et les ecrans propres au web. */
html, body { overflow: hidden; }
.app { height: 100vh; height: 100dvh; width: 100%; }
.login-overlay { overflow-y: auto; padding: 16px; align-content: center; }
.login-card { width: min(600px, 100%); }
.login-card .login-brand img { width: 44px; height: 44px; object-fit: contain; }
#auth .login-card { width: min(440px, 100%); }
#auth .form-grid { grid-template-columns: 1fr; }
#auth .form-grid .wide { grid-column: 1; }
.terms-row span { display: flex; gap: 8px; align-items: flex-start; font-size: 11px; line-height: 1.5; color: var(--text-dim); }
.terms-row input { width: auto !important; margin: 3px 0 0 !important; }
.terms-row a, .auth-switch a { color: var(--accent); }
.auth-switch { text-align: center; margin: 14px 0 0; font-size: 12px; }
#auth-message, #login-message { min-height: 18px; margin: 12px 0 0; font-size: 12px; color: var(--sell); text-align: center; }
#login-message { color: var(--accent); }
.login-actions { display: flex; gap: 10px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.login-card .hint { margin: 14px 0 0; font-size: 10.5px; line-height: 1.5; color: var(--text-mute); text-align: center; }
.form-grid label.wide span { display: flex; gap: 8px; align-items: center; }
.form-grid label.wide span input[type=checkbox] { width: auto; margin: 0; }
button.secondary { background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text); border-radius: 8px; padding: 9px 14px; font-size: 11px; letter-spacing: .03em; }
button.secondary:hover { border-color: var(--accent-line); }
button.secondary.danger { color: var(--sell); }
.err { color: var(--sell); font-size: 12px; }
.mut { color: var(--text-dim); }

/* Mon compte */
.account-card { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.acc-block { border-top: 1px solid var(--border); padding: 14px 0; display: grid; gap: 10px; }
.acc-block:first-child { border-top: 0; }
.acc-block h3 { margin: 0; font-size: 11px; letter-spacing: .08em; color: var(--text-dim); }
.acc-block input, .acc-block select { width: 100%; padding: 10px; background: var(--void); border: 1px solid var(--border-strong); color: var(--text); border-radius: 8px; }
.acc-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.acc-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.acc-row small { display: block; }
.acc-row > span:last-child { display: flex; gap: 6px; }
.acc-plan { color: var(--accent); font-size: 12px; }
.acc-msg { min-height: 16px; margin: 0; font-size: 12px; color: var(--accent); }
.acc-out { margin: 0; padding: 10px; background: var(--void); border: 1px dashed var(--border-strong); border-radius: 8px; color: var(--accent); font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; user-select: all; min-height: 0; }
.acc-out:empty { display: none; }

/* ---------------------------------------------------------------- tablette */
@media (max-width: 1100px) {
  .app { grid-template: auto 1fr auto / 76px 1fr; }
  .sidebar { padding: 10px 6px; }
  .sidebar .assistant { display: none; }
  .rail-item { flex-direction: column; height: 56px; gap: 4px; padding: 6px 2px; justify-content: center; }
  .rail-item span { flex: 0; font-size: 8.5px; text-align: center; }
  .rail-item mark { position: absolute; top: 2px; right: 2px; }
  .topbar { height: auto; min-height: 64px; flex-wrap: wrap; padding: 8px 14px; gap: 10px; }
  .brand { min-width: 0 !important; }
  .brand p, .ai-live, .profile { display: none; }
  .account-head { flex: 1 1 260px; }
  .workspace, .simple .workspace { grid-template-columns: minmax(220px, 270px) minmax(0, 1fr); }
  .right-column, .simple .right-column { grid-column: 1 / 3; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .center-column, .simple .center-column { min-width: 0; }
  .simple .brand { min-width: 0; }
  .auto-status-card { grid-template-columns: 10px minmax(0, 1fr) auto auto; }
  .kpis, .simple .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bottom-grid { grid-template-columns: 1fr 1fr; }
  footer { gap: 16px; overflow: hidden; }
}

/* ---------------------------------------------------------------- telephone */
@media (max-width: 760px) {
  html, body { overflow: hidden; }
  .app { display: flex; flex-direction: column; }
  .topbar { flex-wrap: nowrap; gap: 8px; padding: calc(env(safe-area-inset-top) + 6px) 10px 6px; min-height: 0; }
  .brand img { width: 30px; height: 30px; }
  .brand h1 { font-size: 12px; white-space: nowrap; }
  .brand h1 small, .brand h1 em, .update-badge { display: none; }
  .account-head { height: auto; min-height: 42px; flex: 1; min-width: 0; }
  .account-head > div { min-width: 0 !important; padding: 5px 10px; }
  .account-head b { white-space: nowrap; margin-top: 1px; }
  .account-head strong { font-size: 14px; }
  .account-head > div:nth-child(1), .account-head > div:nth-child(2) { display: none; }
  .mode-toggle { display: none; }
  .license-pill { font-size: 9px; padding: 7px 8px; }
  main { flex: 1; min-height: 0; padding: 10px 10px calc(76px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(60px + env(safe-area-inset-bottom)); padding: 4px 8px env(safe-area-inset-bottom);
    border-right: 0; border-top: 1px solid var(--border); flex-direction: row; gap: 0; }
  .sidebar nav { flex-direction: row; width: 100%; justify-content: space-around; gap: 2px; }
  .rail-item { width: auto; flex: 1; height: 52px; }
  .rail-item span { font-size: 8px; }
  footer { display: none; }
  .kpis, .simple .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis b { font-size: 16px; }
  .kpis svg { display: none; }
  .auto-status-card { display: grid !important; grid-template-columns: 10px 1fr !important; gap: 8px 10px; }
  .auto-status-card .auto-status-meta { grid-column: 1 / 3; display: flex; flex-wrap: wrap; gap: 6px 12px; }
  .auto-status-card .auto-status-meta small { display: block !important; white-space: normal; }
  #auto-risk-open { max-width: 100%; }
  .auto-status-card .primary { grid-column: 1 / 3; width: 100%; }
  .workspace, .simple .workspace { display: flex; flex-direction: column; gap: 12px; }
  .center-column { order: 1; }
  .left-column { order: 2; }
  .right-column { order: 3; display: flex; }
  .chart-panel { height: 340px; }
  .bottom-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  #toast { right: 10px; left: 10px; bottom: calc(72px + env(safe-area-inset-bottom)); text-align: center; }
  .form-grid, .risk-fields { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: 1; }
  .acc-grid { grid-template-columns: 1fr; }
  .modal > div { width: min(420px, calc(100vw - 24px)); }
  .license-card { width: min(520px, calc(100vw - 20px)); }
  table, .table-head { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Boite de confirmation (remplace confirm() du navigateur) */
.dialog-overlay { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 16px; background: rgba(2, 3, 7, .72); backdrop-filter: blur(6px); animation: dlg-fade .15s ease-out; }
.dialog-card { width: min(420px, 100%); padding: 26px 24px 20px; text-align: center; background: linear-gradient(160deg, var(--surface-2), var(--surface)); border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, .65), 0 0 0 1px rgba(23, 227, 214, .06); animation: dlg-pop .18s cubic-bezier(.2, .9, .3, 1.2); }
.dialog-card.danger { border-color: rgba(255, 93, 120, .35); box-shadow: 0 30px 100px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 93, 120, .12); }
.dialog-icon { width: 52px; height: 52px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; font-size: 24px; color: var(--accent); background: var(--accent-dim); border: 1px solid var(--accent-line); }
.dialog-card.danger .dialog-icon { color: var(--sell); background: var(--sell-dim); border-color: rgba(255, 93, 120, .35); }
.dialog-card h3 { margin: 0 0 8px; font-family: var(--font-ui); font-size: 16px; color: var(--text); }
.dialog-card p { margin: 0 0 4px; font-size: 12.5px; line-height: 1.65; color: var(--text-dim); white-space: pre-line; }
.dialog-actions { display: flex; gap: 10px; margin-top: 20px; }
.dialog-actions button { flex: 1; padding: 12px 10px; border-radius: 10px; border: 1px solid var(--border-strong); font-family: var(--font-ui); font-size: 11.5px; font-weight: 700; letter-spacing: .03em; cursor: pointer; transition: transform .1s, filter .15s; }
.dialog-actions button:active { transform: scale(.98); }
.dialog-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dialog-no { background: var(--surface-2); color: var(--text-dim); }
.dialog-no:hover { color: var(--text); border-color: var(--text-mute); }
.dialog-yes { background: linear-gradient(135deg, #17e3d6, #0fb8ad); color: #04121a; border-color: transparent; }
.dialog-yes:hover { filter: brightness(1.1); }
.dialog-card.danger .dialog-yes { background: linear-gradient(135deg, #ff5d78, #d63d5b); color: #fff; }
@keyframes dlg-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dlg-pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@media (max-width: 420px) { .dialog-actions { flex-direction: column-reverse; } }

/* Fenetre de licence: zone de saisie aux couleurs de l'application (comme la version Windows) */
#license-key { width: 100%; min-height: 96px; margin-top: 8px; padding: 12px; resize: vertical; background: var(--void); border: 1px solid var(--border-strong); border-radius: 10px;
  color: var(--accent); font-family: var(--font-mono); font-size: 12px; line-height: 1.5; word-break: break-all; }
#license-key::placeholder { color: var(--text-mute); }
#license-key:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-dim); }



/* Bouton afficher / masquer le mot de passe */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap > input { width: 100%; padding-right: 44px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center; padding: 0; margin: 0;
  background: transparent; border: 0; border-radius: 8px; color: #8b96a8; cursor: pointer; min-height: 0; box-shadow: none; }
.pw-eye:hover { color: #19e3d0; background: rgba(25, 227, 208, .1); }
