:root{
  --bg: #f3f4f6;          /* gris très clair */
  --surface: #ffffff;
  --text: #111827;        /* noir cassé */
  --muted: #6b7280;
  --border: rgba(17,24,39,.12);
  --shadow: 0 10px 30px rgba(0,0,0,.06);
  --accent: #374151;     /* gris moyen */
  --accent2: #111827;
  --danger: #b91c1c;

  --radius: 16px;
  --radius-sm: 12px;

  --focus: 0 0 0 4px rgba(55,65,81,.18);

  color-scheme: light;
}

:root[data-theme="dark"]{
  --bg: #0b1220;
  --surface: #0f1a30;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: rgba(229,231,235,.14);
  --shadow: 0 18px 50px rgba(0,0,0,.35);
  --accent: #cbd5e1;
  --accent2: #f3f4f6;
  --danger: #ef4444;

  color-scheme: dark;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: radial-gradient(900px 400px at 10% -10%, rgba(55,65,81,.16), transparent 60%),
              radial-gradient(700px 300px at 90% 0%, rgba(17,24,39,.10), transparent 60%),
              var(--bg);
  color: var(--text);
}

.container{
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 16px 40px;
}

.topbar{
  display: flex;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.logo{
  width: 70px;
  height: auto;
  border-radius: 90px;
  display: grid;
  place-items: center;
  display: block;
}

.theme{
  display: flex;
  gap: 10px;
  align-items: center;
}
.theme__label{
  color: var(--muted);
  font-size: .95rem;
}
.theme__select{
  appearance: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
  font-weight: 600;
  outline: none;
}
.theme__select:focus-visible{
  box-shadow: var(--focus);
}

.grid{
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 14px;
}

@media (max-width: 820px){
  .grid{ grid-template-columns: 1fr; }
  .topbar{ align-items: flex-start; flex-direction: column; }
}

.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card__title{
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 800;
}

.form .field{
  margin-bottom: 14px;
}
label{
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.hint{
  margin-top: 6px;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.3;
}

.inputWrap{
  display: flex;
  align-items: center;
  gap: 10px;
}

input[type="number"], input[type="text"], .select{
  width: 100%;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 11px 12px;
  border-radius: 12px;
  outline: none;
  font-weight: 700;
}
.select{
  padding: 11px 12px;
}

input[type="number"]:focus-visible,
.select:focus-visible{
  box-shadow: var(--focus);
  border-color: rgba(55,65,81,.35);
}

.unit{
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.actions{
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
}

.btn{
  border: 1px solid transparent;
  background: var(--accent2);
  color: var(--surface);
  font-weight: 800;
  padding: 11px 14px;
  border-radius: 12px;
  cursor: pointer;
  outline: none;
}
.btn:hover{ filter: brightness(1.03); }
.btn:focus-visible{ box-shadow: var(--focus); }
.btn--ghost{
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--small{
  padding: 9px 12px;
  border-radius: 10px;
  font-weight: 800;
}

.error{
  margin-top: 10px;
  color: var(--danger);
  font-weight: 800;
  background: rgba(185,28,28,.08);
  border: 1px solid rgba(185,28,28,.22);
  padding: 10px 12px;
  border-radius: 12px;
}

.card--result .result__row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: baseline;
  margin: 14px 0;
}
.card--result .result__row--muted{
  margin-top: 6px;
}

.result__label{
  color: var(--muted);
  font-weight: 800;
}
.result__value{
  font-weight: 900;
  font-size: 1.25rem;
  text-align: right;
  word-break: break-word;
}
.result__formula{
  font-size: .98rem;
  font-weight: 800;
  color: var(--text);
}

.divider{
  height: 1px;
  background: var(--border);
  margin: 14px 0 8px;
}

.switch{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  font-weight: 800;
}
.switch input{
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch__ui{
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: rgba(107,114,128,.35);
  border: 1px solid var(--border);
  position: relative;
  transition: background .2s ease;
}
.switch__ui::after{
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform .2s ease, background .2s ease;
}
.switch input:checked + .switch__ui{
  background: rgba(55,65,81,.45);
}
.switch input:checked + .switch__ui::after{
  transform: translateX(18px);
}

.switch__text{
  color: var(--muted);
  font-size: .95rem;
}

.miniCalc{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}
.miniCalc input{
  width: 120px;
  text-align: right;
  padding: 10px 12px;
}
.miniCalc__out{
  margin-top: 6px;
  color: var(--muted);
  font-weight: 900;
  font-size: .98rem;
  text-align: right;
}

.note{
  margin-top: 10px;
  color: var(--muted);
  font-weight: 700;
  font-size: .93rem;
  line-height: 1.4;
}

.footer{
  margin-top: 16px;
  color: var(--muted);
  font-weight: 700;
  font-size: .95rem;
  text-align: center;
}
