*, *::before, *::after { box-sizing: border-box; }
:root { --ink: #1c2330; --muted: #5d6676; --bg: #f4f6fa; --card: #fff; --brand: #1d5fd1; --brand-d: #1749a3; --line: #dde2ec; --ok: #166534; --err: #b42318; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
a { color: var(--brand); }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding-top: 20px; padding-bottom: 32px; }
main.narrow { max-width: 640px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 18px 0 6px; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: .93rem; }

.top { background: #fff; border-bottom: 1px solid var(--line); }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding-top: 8px; padding-bottom: 8px; }
.brand { font-weight: 800; font-size: 1.4rem; color: var(--ink); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.brand span { color: var(--brand); }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.who { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; color: var(--muted); }
.inline { display: inline; margin: 0; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; background: #e8ecf3; color: var(--muted); font-size: .85rem; font-weight: 600; }
.badge-pro { background: #dcfce7; color: var(--ok); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--brand); border-radius: 10px; background: var(--brand); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--brand-d); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-ghost { background: transparent; color: var(--brand); border-color: transparent; }
.btn-ghost:hover { background: #e9effb; }
.card .btn-ghost { border-color: var(--line); }
.btn-small { padding: 0 14px; }
.btn-block { display: flex; width: 100%; }
.btn-danger { background: var(--err); border-color: var(--err); }
.btn-danger:hover { background: #8f1c12; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 0 0 16px; }
.card h1 { margin-top: 0; }
.form label { display: block; font-weight: 600; margin: 12px 0 4px; }
.form input[type=email], .form input[type=password], .form input[type=text] { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid #b8c0cf; border-radius: 10px; font: inherit; }
.form .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 16px 0; }
.form .check input { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.form .btn { margin-top: 8px; }
.alert { padding: 10px 14px; border-radius: 10px; margin: 0 0 12px; }
.alert-err { background: #fef0ee; color: var(--err); border: 1px solid #f6c8c2; }
.alert-ok { background: #ecfdf3; color: var(--ok); border: 1px solid #b7ebcb; }
.alert p { margin: 4px 0 8px; }
[hidden] { display: none !important; }

.plans { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 16px 0; }
@media (min-width: 700px) { .plans { grid-template-columns: 1fr 1fr; } }
.plan h2 { margin-top: 0; }
.plan-pro { border: 2px solid var(--brand); }
.price { font-size: 2rem; font-weight: 800; margin: 4px 0 12px; }
.price small { font-size: .95rem; font-weight: 400; color: var(--muted); }
.ticks { padding-left: 20px; margin: 0 0 16px; }
.ticks li { margin-bottom: 6px; }

/* Calculatrice */
.calc-layout { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 800px) { .calc-layout { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 24px; } }
.calc { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; width: 100%; max-width: 420px; margin: 0 auto; min-width: 0; }
.screen { background: #101828; color: #fff; border-radius: 12px; padding: 8px 14px; height: 108px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; text-align: right; }
.screen .line { color: #9aa6bd; font-size: .95rem; height: 1.4em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen .value { font-size: 48px; font-weight: 600; line-height: 1.15; white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums; }
.screen .value.err { color: #ffb4a8; }
.pro-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.rate-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0; font-size: .95rem; color: var(--muted); }
.rate-row select { min-height: 44px; padding: 0 10px; border: 1px solid #b8c0cf; border-radius: 10px; font: inherit; background: #fff; color: var(--ink); }
.pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.key { min-height: 56px; min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: #f1f4f9; color: var(--ink); font: inherit; font-size: 1.35rem; font-weight: 600; cursor: pointer; touch-action: manipulation; position: relative; padding: 0 2px; }
.key:hover { background: #e5eaf3; }
.key:active { background: #d7deec; }
.key.op { background: #e6eefc; color: var(--brand-d); }
.key.eq { background: var(--brand); color: #fff; border-color: var(--brand); grid-row: span 2; }
.key.zero { grid-column: span 2; }
.key.fn { color: var(--err); }
.key.pro { font-size: 1.05rem; background: #fff7e0; border-color: #f0dca0; min-height: 48px; }
.key.pro.locked { background: #eef0f4; color: #8b94a5; border-color: var(--line); }
.key.pro .lock { pointer-events: none; position: absolute; top: 3px; right: 4px; width: 11px; height: 13px; }
.lock-msg { background: #fff7e0; border: 1px solid #f0dca0; border-radius: 10px; padding: 8px 12px; margin: 0 0 10px; font-weight: 600; font-size: .95rem; }
.history { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; min-width: 0; }
.history h2 { margin-top: 0; }
.hlist { list-style: none; margin: 0 0 12px; padding: 0; max-height: 480px; overflow-y: auto; }
.hlist li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.hlist time { display: block; font-size: .8rem; color: var(--muted); }
.hexpr { overflow-wrap: anywhere; }
.hres { border: 0; background: none; color: var(--brand); font: inherit; font-weight: 700; padding: 6px 4px; min-height: 36px; cursor: pointer; text-decoration: underline; }
.upsell { background: #f1f6ff; border-radius: 12px; padding: 14px; }
.upsell p { margin: 0 0 8px; }

.foot { border-top: 1px solid var(--line); background: #fff; padding: 16px 0; text-align: center; font-size: .92rem; }
.foot p { margin: 4px 0; }
.foot a { display: inline-block; padding: 8px 4px; }

@media (max-width: 380px) {
  .wrap { padding: 0 10px; }
  .key { min-height: 52px; font-size: 1.2rem; }
  .who { max-width: 130px; }
  .btn { padding: 0 12px; }
  .screen .value { font-size: 40px; }
}
