/* Missive : interface claire, sobre */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --line: #e3e7ee;
  --line-2: #d0d6e0;
  --text: #1f2328;
  --muted: #5f6b7a;
  --primary: #1a73e8;
  --primary-2: #1557b0;
  --primary-soft: #e8f0fe;
  --danger: #d93025;
  --ok: #188038;
  --warn: #b06000;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
h3 { font-size: 15px; font-weight: 600; margin: 2px 0; }
code { font: 12.5px ui-monospace, "Cascadia Code", Consolas, monospace; background: #f1f3f6; padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.ok { color: var(--ok); font-weight: 500; }
.ko { color: var(--danger); font-weight: 500; }
.ic { width: 18px; height: 18px; flex: none; }

/* Barre du haut */
.topbar { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 24px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; }
.mainnav a:hover { background: #f1f3f6; text-decoration: none; color: var(--text); }
.mainnav a.on { background: var(--primary-soft); color: var(--primary); }
.userbox { display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 600; }
.iconbtn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); background: none; border: 0; cursor: pointer; list-style: none; font-size: 18px; }
.iconbtn:hover { background: #f1f3f6; color: var(--text); text-decoration: none; }
.iconbtn::-webkit-details-marker { display: none; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .muted { margin: 0; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 500 14px var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: #f5f7fa; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); box-shadow: var(--shadow); }
.btn.danger { color: var(--danger); }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.ms-btn { height: 44px; border-radius: 8px; }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; color: #3c4450; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.span2 { grid-column: 1 / -1; }
.form.inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.form.inline input, .form.inline select { width: auto; flex: 1 1 160px; }
input, select, textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 8px; font: 14px var(--font); color: var(--text); background: #fff; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26, 115, 232, .15); }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { resize: vertical; }
.actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.switch { flex-direction: row !important; align-items: center; gap: 10px !important; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { width: 36px; height: 20px; border-radius: 999px; background: #c4cbd6; position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }
details.sub { border: 1px dashed var(--line-2); border-radius: 10px; padding: 10px 14px; }
details.sub summary { cursor: pointer; color: var(--muted); font-weight: 500; }
details.sub[open] summary { margin-bottom: 12px; }
fieldset.seg { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
fieldset.seg legend { font-weight: 500; font-size: 13px; color: #3c4450; margin-bottom: 6px; }
fieldset.seg label { cursor: pointer; }
fieldset.seg input { position: absolute; opacity: 0; }
fieldset.seg span { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border: 1px solid var(--line-2); border-radius: 10px; font-weight: 500; transition: all .15s; }
fieldset.seg input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

/* Cartes pliables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.card-toggle { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; flex: 1; text-align: left; }
.card-toggle .ic { color: var(--muted); transition: transform .25s ease; }
.card.closed .card-toggle .ic { transform: rotate(-90deg); }
.card-body { padding: 4px 18px 18px; overflow: hidden; }
.card.closed .card-body { display: none; }
.card-body.anim { transition: height .25s ease, opacity .25s ease; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; }
.flash-ok { background: #e6f4ea; border-color: #b7dfc3; color: #0d652d; }
.flash-err { background: #fce8e6; border-color: #f4c7c3; color: #a50e0e; }
.flash code.copy { display: inline-block; margin-top: 6px; background: #fff; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; color: var(--text); font-weight: 500; }
.chip b { color: var(--muted); font-weight: 500; margin-left: 4px; }
.chip.on { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.chip:hover { text-decoration: none; border-color: var(--primary); }
.search input { width: 260px; border-radius: 999px; padding-left: 16px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #eef1f5; color: #46505d; }
.b-newsletter { background: #e8f0fe; color: #1a5fc6; }
.b-transactional { background: #fef3e0; color: #a05a00; }
.b-signature { background: #e6f4ea; color: #137333; }
.b-sent { background: #e6f4ea; color: #137333; }
.b-sending { background: #fef3e0; color: #a05a00; }
.b-draft { background: #eef1f5; color: #46505d; }
.b-paused { background: #fce8e6; color: #a50e0e; }

/* Grille de modèles */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.tpl-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s; }
.tpl-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.tpl-thumb { display: block; height: 220px; overflow: hidden; border-bottom: 1px solid var(--line); background: #f1f3f6; position: relative; border-radius: var(--radius) var(--radius) 0 0; }
.tpl-thumb iframe { width: 640px; height: 900px; border: 0; transform: scale(.42); transform-origin: 0 0; pointer-events: none; position: absolute; left: 50%; margin-left: -134px; }
.tpl-meta { display: flex; justify-content: space-between; gap: 8px; padding: 12px 14px; }
.tpl-meta h3 a { color: var(--text); }

details.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: 38px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 170px; padding: 6px; z-index: 30; }
.menu-pop a, .menu-pop button { display: block; width: 100%; padding: 8px 12px; text-align: left; border: 0; background: none; font: 14px var(--font); color: var(--text); border-radius: 6px; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: #f1f3f6; text-decoration: none; }
.menu-pop .danger { color: var(--danger); }

.empty { text-align: center; padding: 60px 20px; background: #fff; border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty img { width: 120px; margin-bottom: 8px; }

/* Tableaux */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table input, .table select { padding: 6px 10px; }
.table-wrap { overflow-x: auto; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 12px; }
.info-grid > div { display: flex; flex-direction: column; gap: 4px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
code.copy { cursor: copy; }
code.copied { background: #e6f4ea; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 24px; font-weight: 600; }
.progress { height: 8px; background: #e8ecf2; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); width: 0; transition: width .4s; }

/* Dialogues */
.dialog { border: 0; border-radius: 16px; padding: 24px; width: min(520px, 94vw); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(15, 23, 42, .35); }
.dialog h2 { font-size: 20px; margin-bottom: 4px; }

/* Pages d'authentification */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, #eef3fb 0%, var(--bg) 60%); }
.auth-card { width: min(400px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow-lg); }
.auth-card.wide { width: min(640px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; margin-bottom: 20px; }
.auth-brand img { width: 32px; height: 32px; }
.sep { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 18px 0; font-size: 13px; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.steps { list-style: none; padding: 0; margin: 16px 0 22px; display: flex; gap: 8px; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; font-size: 13px; }
.steps li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #eef1f5; font-size: 12px; }
.steps li.on { color: var(--primary); }
.steps li.on span { background: var(--primary); color: #fff; }
.steps li.done span { background: #e6f4ea; color: var(--ok); }
.steps li + li::before { content: ""; width: 18px; height: 1px; background: var(--line-2); }
.checklist { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 6px; }
.checklist li { padding: 8px 12px; border-radius: 8px; background: #f8fafc; }
.checklist .ok { color: var(--ok); }
.checklist .ko { color: var(--danger); background: #fce8e6; }

.unsub { text-align: center; }

@media (max-width: 760px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .mainnav a span, .brand span { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .wrap { padding: 18px 12px 40px; }
  .search input { width: 100%; }
}
