:root {
  --kw-red: #b40101;
  --kw-red-dark: #8d0101;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --bg: #f4f4f6;
  --card: #ffffff;
  --line: #e3e3e8;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.hidden { display: none !important; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--ink);
  color: #fff;
  padding: 0.7rem 1.2rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
}
/* Hauteur imposée, largeur libre : les proportions d'origine (1,17) sont
   conservées exactement, quelle que soit la taille d'affichage. */
.brand .logo {
  height: 34px;
  width: auto;
  display: block;
}
.agent-box { display: flex; align-items: center; gap: 0.8rem; font-size: 0.9rem; }
.link-btn {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.85rem;
}

.login-screen { display: flex; justify-content: center; padding: 12vh 1rem; }
.login-card { max-width: 420px; text-align: center; }
.login-card h1 { margin-top: 0; }
/* Version couleur sur fond clair, hauteur imposée et largeur libre pour
   conserver les proportions d'origine (1,17). */
.logo-login {
  height: 74px;
  width: auto;
  display: block;
  margin: 0 auto 1.1rem;
}
#google-signin { display: flex; justify-content: center; margin-top: 0.6rem; }
#login-form { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1.2rem; }
#login-form input { text-align: center; }
.separator {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 1.1rem 0 0;
  position: relative;
}
.separator::before, .separator::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: var(--line);
}
.separator::before { left: 0; }
.separator::after { right: 0; }

.app { max-width: 1000px; margin: 0 auto; padding: 1.2rem; }

.tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.tab {
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.55rem 1.1rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--muted);
}
.tab.active {
  background: var(--kw-red);
  border-color: var(--kw-red);
  color: #fff;
  font-weight: 600;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.4rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.card h2 { margin-top: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.8rem 1rem;
}
label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
input, select, textarea {
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--kw-red);
  outline-offset: 0;
  border-color: var(--kw-red);
}
label.full { margin-top: 0.8rem; }
.checks { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: 0.9rem; }
.checks label, .check-inline { flex-direction: row; align-items: center; gap: 0.4rem; }

.actions { margin-top: 1.1rem; display: flex; gap: 0.8rem; }
.btn-primary {
  background: var(--kw-red);
  color: #fff;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--kw-red-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.65rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
}

.msg { padding: 0.6rem 0.9rem; border-radius: 8px; font-size: 0.92rem; }
.msg.ok { background: #e6f6e6; color: #1a6b1a; }
.msg.err, .error { background: #fdecec; color: var(--kw-red-dark); }
.error { padding: 0.6rem 0.9rem; border-radius: 8px; }

.table-wrap { overflow-x: auto; margin-top: 0.6rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
tr:hover td { background: #fafafa; }
.row-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--kw-red);
  text-decoration: underline;
  padding: 0 0.3rem;
}

.list-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.list-head input { min-width: 220px; }
.count { color: var(--muted); font-size: 0.85rem; font-weight: 400; }

.mapping { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.6rem; margin-bottom: 1rem; }
.mapping .map-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.mapping .map-row .col-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}
progress { width: 100%; height: 14px; accent-color: var(--kw-red); }

.dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.4rem;
  max-width: 560px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.dialog textarea { width: 100%; font-family: monospace; font-size: 0.8rem; word-break: break-all; }
.snippet {
  background: #1d1d1f;
  color: #d8f0d8;
  padding: 0.8rem;
  border-radius: 8px;
  font-size: 0.75rem;
  overflow-x: auto;
}
.muted { color: var(--muted); font-size: 0.82rem; }
.sep { border: none; border-top: 1px solid var(--line); margin: 1.2rem 0 0.9rem; }
.btn-danger {
  background: #fff;
  color: var(--kw-red-dark);
  border: 1px solid var(--kw-red);
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn-danger:hover { background: #fdecec; }
.section {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--kw-red);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.35rem;
  margin: 1.6rem 0 0.9rem;
}
.section:first-of-type { margin-top: 0.4rem; }
.hint { font-size: 0.78rem; color: var(--muted); font-weight: 400; }
.tag-picker { display: flex; gap: 0.5rem; align-items: center; }
.tag-picker input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.chip {
  background: #f2e5e5;
  color: var(--kw-red-dark);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.chip button {
  border: none;
  background: none;
  color: var(--kw-red-dark);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.dup-hint { font-size: 0.8rem; margin-top: 0.2rem; }
.dup-hint.own { color: #a06000; }
.dup-hint.other { color: var(--kw-red-dark); }
#import-report { margin-top: 0.8rem; font-size: 0.9rem; }
#import-report ul { margin: 0.3rem 0; padding-left: 1.2rem; }

.fiche-acq {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.7rem;
}
.fiche-acq .btn-secondary { margin-top: 0.5rem; font-size: 0.82rem; padding: 0.35rem 0.8rem; }

.carte-suivante { margin-top: 1.2rem; }

.acq-nom { font-weight: 600; color: var(--kw-red); margin-bottom: 0.15rem; }
