:root{
  --bg: #f3f4f6;       /* gris clair */
  --card: #ffffff;
  --text: #111827;     /* écriture très lisible */
  --muted: #4b5563;
  --border: #d1d5db;
  --focus: #2563eb;
  --primary: #111827;
  --danger: #b91c1c;
  --chip: #e5e7eb;
  --chipHover: #d1d5db;
  --shadow: 0 8px 24px rgba(0,0,0,.06);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

.container{
  width: min(980px, 92vw);
  margin: 28px auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.header{
  background: transparent;
  padding: 6px 2px;
}
.logo{
  width: 70px;
  height: auto;
  border-radius: 90px;
  display: grid;
  place-items: center;
  display: block;
}
h1{
  margin: 0 0 6px;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: .2px;
}
.subtitle{
  margin: 0;
  color: var(--muted);
}

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

.card-title{
  margin: 0 0 12px;
  font-size: 18px;
}

.form{ display: flex; flex-direction: column; gap: 14px; }

.grid{
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 720px){
  .grid{ grid-template-columns: 1fr; }
}

.field{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  min-width: 0;
}

.label{
  display: block;
  font-weight: 650;
  margin-bottom: 6px;
}

.help{
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
  line-height: 1.3;
}

input[type="text"], select, input[type="number"]{
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 16px;
  outline: none;
}

input[type="text"]:focus, select:focus, input[type="number"]:focus{
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(37,99,235,.18);
}

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

.sectionTitle{
  margin: 2px 0 -2px;
  font-size: 16px;
  color: var(--text);
}

.row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
@media (max-width: 720px){
  .row{ grid-template-columns: 1fr; }
}

.miniField .label{ margin-bottom: 6px; }

.chipRow{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip{
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 650;
  cursor: pointer;
}
.chip:hover{ background: var(--chipHover); }
.chip:focus{
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,.18);
  border-color: var(--focus);
}

.toggle{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--text);
  font-size: 14px;
}
.toggle input{ width: 18px; height: 18px; }

.radio{
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-size: 14px;
  color: var(--text);
}
.radio input{ width: 18px; height: 18px; }

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

.btnPrimary, .btnGhost{
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 750;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}
.btnPrimary{
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btnPrimary:hover{ filter: brightness(1.05); }
.btnGhost:hover{ background: #f9fafb; }
.btnGhost:focus, .btnPrimary:focus{
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,.18);
  border-color: var(--focus);
}

.btnGhost.danger{
  border-color: rgba(185,28,28,.35);
  color: var(--danger);
}

.error{
  min-height: 1.2em;
  margin: 0;
  color: var(--danger);
  font-weight: 650;
}

.results{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.resultRow{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.key{
  color: var(--muted);
  font-weight: 650;
}
.value{
  font-weight: 900;
  letter-spacing: .2px;
}

.note{
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #fafafa;
}
.noteTitle{
  font-weight: 900;
  margin-bottom: 6px;
}
.noteText{
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.historyControls{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.historyList{
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 10px;
}

.historyItem{
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.historyTop{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}
.historyMeta{
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}
.historyBtns{
  display: flex;
  gap: 8px;
}
.iconBtn{
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 800;
}
.iconBtn:hover{ background: #f9fafb; }
.iconBtn:focus{
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,.18);
  border-color: var(--focus);
}

.footer{
  padding: 0 2px 10px;
}
.footerText{
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
}
