/* Conexteo × Pipedrive — styles du panneau, des réglages et des pages publiques.
   Thèmes clair et sombre (exigés par la validation Marketplace) : le thème
   vient du SDK Pipedrive et est posé sur <html data-theme="…">. */

:root {
  --bg: #ffffff;
  --surface: #f5f6f7;
  --text: #21232c;
  --muted: #656e7a;
  --border: #d5d8de;
  --accent: #0d7a6f;
  --accent-text: #ffffff;
  --accent-soft: #e3f6f3;
  --danger: #c5221f;
  --danger-soft: #fdecea;
  --ok: #18794e;
  --ok-soft: #e6f4ec;
  --radius: 6px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

:root[data-theme="dark"] {
  --bg: #1f2127;
  --surface: #2a2d35;
  --text: #eceef1;
  --muted: #a3abb6;
  --border: #454a55;
  --accent: #2dd4bf;
  --accent-text: #0b1f3a;
  --accent-soft: #17403c;
  --danger: #ff8a80;
  --danger-soft: #4a2523;
  --ok: #6fd6a0;
  --ok-soft: #1d3a2b;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body.embed { padding: 12px; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 12px; }
.title { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }

label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input[type="text"], input[type="url"], input[type="password"], select, textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
textarea { resize: vertical; min-height: 84px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--border); }
.btn.small { padding: 4px 9px; font-size: 12px; font-weight: 500; }
.btn.block { width: 100%; }

.tabs { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tabs button {
  flex: 1; padding: 6px 8px; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 12px; cursor: pointer;
}

.box { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: var(--surface); }
.notice { border-radius: var(--radius); padding: 8px 10px; font-size: 13px; overflow-wrap: anywhere; }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.info { background: var(--surface); color: var(--text); }

.counter { text-align: right; }
.choice { display: grid; grid-template-columns: 96px 1fr auto; gap: 6px; align-items: center; }
.choice .full { grid-column: 1 / -1; }
.preview-img { max-width: 100%; max-height: 120px; border-radius: var(--radius); border: 1px solid var(--border); }
code.copy { display: block; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow-wrap: anywhere; font-size: 12px; }

/* Réglages */
.settings { max-width: 640px; }
.settings h2 { font-size: 15px; margin-bottom: 2px; }
.settings section { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.off { background: var(--surface); color: var(--muted); }
.badge.error { background: var(--danger-soft); color: var(--danger); }

.rule-text { overflow-wrap: anywhere; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
optgroup { font-style: normal; }

/* Pages publiques (accueil, erreurs OAuth) */
body.page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--surface); }
.card { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 36px 32px; max-width: 460px; width: 100%; display: flex; flex-direction: column; gap: 14px; }
.card h1 { font-size: 22px; line-height: 1.25; }
.brand { font-weight: 800; font-size: 16px; }
.brand span { color: var(--accent); }
