:root {
  --bg: #0d0f13;
  --panel: #171a20;
  --panel-2: #20242c;
  --text: #f5f7fa;
  --muted: #aeb5c0;
  --key: #2a2f39;
  --key-fn: #aeb4bc;
  --key-fn-text: #111318;
  --accent: #ff9f0a;
  --danger: #b42318;
  --danger-2: #7a1b14;
  --border: rgba(255,255,255,.10);
  --radius: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

body { min-height: 100vh; min-height: 100dvh; }
.app-shell { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom)); }
.calculator-card { width: min(100%, 430px); }
.calc-header { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 16px; min-height: 32px; }
.calc-title { font-size: 15px; color: #8f96a3; letter-spacing: .02em; }
.install-chip, .ghost-button { border: 0; background: #20242b; color: #d8dde6; border-radius: 999px; padding: 8px 12px; cursor: pointer; }

.display-wrap { min-height: 150px; display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; padding: 10px 8px 18px; overflow: hidden; }
.history-display { min-height: 24px; max-width: 100%; font-size: 18px; color: #7f8794; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.display { width: 100%; border: 0; outline: 0; background: transparent; color: #fff; text-align: right; font-size: clamp(52px, 15vw, 74px); font-weight: 300; letter-spacing: -.03em; padding: 0; }

.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.key { aspect-ratio: 1; border: 0; border-radius: 50%; background: var(--key); color: #fff; font-size: clamp(27px, 8vw, 34px); font-weight: 400; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
.key:active { transform: scale(.97); filter: brightness(1.18); }
.key-fn { background: var(--key-fn); color: var(--key-fn-text); }
.key-op, .key-equals { background: var(--accent); color: #fff; font-size: 36px; }
.key-zero { grid-column: span 2; aspect-ratio: auto; border-radius: 999px; text-align: left; padding-left: 31px; }

.secure-view { min-height: 100vh; min-height: 100dvh; background: #101216; }
.secure-header { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; padding: max(14px, env(safe-area-inset-top)) 16px 12px; background: rgba(16,18,22,.95); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.secure-header h1 { margin: 0; font-size: 20px; }
.secure-header p { margin: 2px 0 0; }
.ghost-button { width: 42px; height: 42px; padding: 0; font-size: 20px; }
.secure-content { width: min(100%, 720px); margin: 0 auto; padding: 18px 16px max(36px, env(safe-area-inset-bottom)); display: grid; gap: 16px; }
.alert-card { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.16); }
.alert-card h2 { margin: 0 0 8px; font-size: 19px; }
.alert-card p { margin: 0 0 14px; color: var(--muted); line-height: 1.45; }
.urgent-card { border-color: rgba(180,35,24,.42); }
.primary, .secondary { width: 100%; border: 0; border-radius: 14px; padding: 14px 16px; font-weight: 700; cursor: pointer; }
.primary { background: #f4f5f7; color: #111318; }
.primary.danger { background: var(--danger); color: #fff; }
.secondary { background: var(--panel-2); color: #fff; border: 1px solid var(--border); }
.primary:disabled, .secondary:disabled { opacity: .45; cursor: not-allowed; }
.status-line { margin-top: 12px; color: #c6ccd6; font-size: 14px; line-height: 1.4; }
.contact-list { display: grid; gap: 10px; margin-bottom: 12px; }
.contact-item { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; background: var(--panel-2); border-radius: 14px; padding: 10px 10px 10px 13px; }
.contact-meta strong { display: block; }
.contact-meta span { color: var(--muted); font-size: 13px; }
.small-action { border: 0; border-radius: 10px; padding: 10px; background: #333844; color: #fff; cursor: pointer; text-decoration: none; }
.emergency-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.emergency-button { min-height: 94px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; border: 0; border-radius: 16px; padding: 14px; background: #242933; color: #fff; text-decoration: none; cursor: pointer; text-align: left; }
.emergency-button strong { font-size: 28px; }
.emergency-button span { color: #d3d8e0; font-size: 13px; line-height: 1.3; }
.support-link { display: block; margin-top: 12px; border-radius: 14px; padding: 13px 14px; background: #242933; color: #fff; text-decoration: none; line-height: 1.4; }
.emergency-button { box-shadow: 0 10px 24px rgba(0,0,0,.18); transition: transform .15s ease, filter .15s ease; }
.emergency-button:active, .support-link:active { transform: scale(.98); filter: brightness(1.06); }
.emergency-17 { background: linear-gradient(135deg, #2d6cdf, #1946a8); }
.emergency-112 { background: linear-gradient(135deg, #ef4b5a, #c2233b); }
.emergency-18 { background: linear-gradient(135deg, #ff8f32, #dd5b16); }
.emergency-114 { background: linear-gradient(135deg, #1db78a, #0f8e69); }
.emergency-3919 { background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: 0 10px 24px rgba(0,0,0,.18); }
.emergency-17 span, .emergency-112 span, .emergency-18 span, .emergency-114 span, .emergency-3919 { color: #fff; }
.emergency-3919 strong { font-size: 22px; }

.fine-print { font-size: 12px !important; color: #8f96a3 !important; }
.discreet-card { background: transparent; border: 0; padding: 0; box-shadow: none; }

.modal { border: 0; padding: 0; background: transparent; color: var(--text); width: min(calc(100% - 24px), 620px); max-height: calc(100dvh - 24px); }
.modal::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.modal-card { background: #181b21; border: 1px solid var(--border); border-radius: 22px; padding: 22px; max-height: calc(100dvh - 24px); overflow: auto; }
.modal-card.compact { width: min(100%, 440px); margin: auto; }
.modal-card h2 { margin-top: 0; }
.modal-card label { display: grid; gap: 7px; margin: 14px 0; color: #e5e8ee; font-size: 14px; }
.modal-card input, .modal-card textarea { width: 100%; border: 1px solid #363c47; background: #101217; color: #fff; border-radius: 12px; padding: 12px 13px; outline: none; }
.modal-card input:focus, .modal-card textarea:focus { border-color: #8791a1; }
.modal-card fieldset { border: 1px solid #333944; border-radius: 14px; margin: 16px 0; padding: 8px 14px 2px; }
.modal-card legend { padding: 0 7px; color: #cfd4dc; }
.muted { color: var(--muted); }
.permission-box { margin: 16px 0; padding: 14px; background: #111419; border-radius: 14px; }
.permission-box p { margin: 0 0 8px; }
.consent-row { grid-template-columns: 22px 1fr !important; align-items: start; }
.consent-row input { width: 18px; height: 18px; margin: 1px 0 0; }
.error { min-height: 20px; color: #ff8e86; margin: 8px 0; font-size: 13px; }
.button-row { display: grid; gap: 10px; }
.settings-contact { border: 1px solid #333944; padding: 12px; border-radius: 14px; margin: 12px 0; }

@media (min-width: 680px) {
  .app-shell { padding-top: 32px; padding-bottom: 32px; }
  .calculator-card { width: 390px; }
}

@media (max-width: 390px) {
  .keypad { gap: 9px; }
  .emergency-grid { grid-template-columns: 1fr; }
  .contact-item { grid-template-columns: 1fr auto; }
  .contact-item .call-action { display: none; }
}


/* Activation de licence */
.activation-shell { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom)); background: radial-gradient(circle at 50% 12%, #19202b 0, #0d0f13 42%, #090b0f 100%); }
.activation-card { width: min(100%, 430px); background: rgba(23,26,32,.96); border: 1px solid rgba(255,255,255,.10); border-radius: 26px; padding: 30px 24px; box-shadow: 0 24px 70px rgba(0,0,0,.42); }
.activation-icon { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 16px; background: linear-gradient(135deg, #2d6cdf, #7c4dff); color: #fff; font-size: 27px; font-weight: 700; box-shadow: 0 12px 30px rgba(69,89,255,.24); }
.activation-card h1 { margin: 0; text-align: center; font-size: 28px; }
.activation-subtitle { margin: 6px 0 24px; text-align: center; color: var(--muted); }
.activation-form { display: grid; gap: 12px; }
.activation-form label { font-size: 14px; color: #e6e9ef; }
.activation-form input { width: 100%; border: 1px solid #3b424e; background: #101217; color: #fff; border-radius: 14px; padding: 15px 14px; outline: none; text-transform: uppercase; letter-spacing: .035em; }
.activation-form input:focus { border-color: #7185ff; box-shadow: 0 0 0 3px rgba(113,133,255,.12); }
.activation-note { margin: 18px 0 0 !important; line-height: 1.5 !important; text-align: center; }
