:root{
  --bg: #f3f4f6;          /* gris claire */
  --surface: #ffffff;
  --text: #111827;
  --muted: #4b5563;
  --border: rgba(17, 24, 39, 0.12);
  --shadow: rgba(17, 24, 39, 0.08);

  --primary: #374151;
  --primaryText: #f9fafb;

  --focus: #2563eb;

  --monoBg: rgba(17, 24, 39, 0.06);
  --danger: #b91c1c;

  --radius: 16px;
  --container: 1020px;
}

html[data-theme="dark"]{
  --bg: #0b1220;
  --surface: #0f1b2d;
  --text: #e5e7eb;
  --muted: #a3a9b7;
  --border: rgba(229, 231, 235, 0.14);
  --shadow: rgba(0, 0, 0, 0.35);

  --primary: #e5e7eb;
  --primaryText: #0b1220;

  --focus: #60a5fa;

  --monoBg: rgba(229, 231, 235, 0.08);
  --danger: #ff6b6b;
}

@media (prefers-color-scheme: dark){
  html[data-theme="system"]{
    /* fallback si système et rien n'est forcé */
  }
}

*{ box-sizing: border-box; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  transition: background-color .2s ease, color .2s ease;
}

h1{
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.2px;
}
h2{
  margin: 0 0 10px 0;
  font-size: 16px;
}

.subtitle{
  margin: 4px 0 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar{
  max-width: var(--container);
  margin: 20px auto 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

.container{
  max-width: var(--container);
  margin: 18px auto 40px auto;
  padding: 0 16px;
  display: grid;
  gap: 14px;
}

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

.grid{
  display: grid;
  gap: 12px;
}

.field{
  display: grid;
  gap: 6px;
}
.field label{
  font-size: 13px;
  color: var(--muted);
}
input, select{
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  outline: none;
}
input::placeholder{
  color: rgba(107, 114, 128, 0.9);
}
input:focus, select:focus{
  border-color: rgba(37, 99, 235, 0.7);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.20);
}

.microhelp{
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.full{ grid-column: 1 / -1; }

.actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.btn{
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .05s ease, background-color .15s ease;
}
.btn:active{ transform: translateY(1px); }

.btn.primary{
  background: var(--primary);
  color: var(--primaryText);
  border-color: transparent;
}

.theme-block{
  display: grid;
  gap: 6px;
  justify-items: end;
}
.theme-label{
  font-size: 13px;
  color: var(--muted);
}
.theme-select{
  width: 180px;
}

.hint{
  margin: 0 0 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.resultRow{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.resultRow:last-child{
  border-bottom: none;
}

.resultLabel{
  color: var(--muted);
  font-size: 13px;
}
.resultValue{
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.subtle .resultValue{
  font-size: 13px;
  font-weight: 600;
}

.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: var(--monoBg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

.callout{
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(37,99,235,0.08), rgba(37,99,235,0.02));
}
.calloutTitle{
  margin: 0 0 6px 0;
  font-weight: 800;
  font-size: 13px;
}
.calloutText{
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.tableWrap{
  overflow: auto;
}
.table{
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th, .table td{
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th{
  color: var(--muted);
  font-weight: 700;
}
.table td{
  font-weight: 700;
}

.list{
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}
.list li{
  margin: 6px 0;
}

@media (max-width: 720px){
  .topbar{
    flex-direction: column;
    align-items: stretch;
  }
  .theme-block{
    justify-items: start;
  }
  .resultValue{ font-size: 22px; }
}
