/* Ampère : design clair, sobre */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5f6b7a;
  --line: #e3e8ef;
  --primary: #1a73e8;
  --primary-d: #1559b8;
  --primary-l: #e8f0fe;
  --green: #188038;
  --green-l: #e6f4ea;
  --red: #d93025;
  --red-l: #fce8e6;
  --amber: #b06000;
  --amber-l: #fef7e0;
  --blue-l: #e8f0fe;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: 13px; }
code { background: #f1f3f6; padding: 1px 6px; border-radius: 6px; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 6px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0; font-weight: 600; }
h3 { font-size: 15px; margin: 22px 0 10px; font-weight: 600; }
.ico { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.center { text-align: center; justify-content: center; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.txt-red { color: var(--red); }

/* Barre du haut */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.brand-mark .ico { width: 18px; height: 18px; }
.brand-tag { font-size: 12px; font-weight: 500; color: var(--muted); background: #f1f3f6; padding: 2px 8px; border-radius: 99px; }
.nav { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.nav a { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 99px; color: var(--muted); font-weight: 500; font-size: 14px; }
.nav a:hover { background: #f1f3f6; color: var(--text); text-decoration: none; }
.nav a.on { background: var(--primary-l); color: var(--primary); }
.nav a .ico { width: 16px; height: 16px; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 6px 11px; font-size: 18px; cursor: pointer; }
.envbar { text-align: center; font-size: 13px; padding: 7px 16px; }
.env-demo { background: var(--amber-l); color: var(--amber); }
.env-sandbox { background: var(--blue-l); color: var(--primary-d); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 20px 40px; }
.area-public .wrap, .area-install .wrap { max-width: 900px; }

/* Hero */
.hero { text-align: center; padding: 34px 10px 30px; }
.hero h1 { font-size: 38px; }
.hero-sm { padding: 8px 0 22px; text-align: left; }
.hero-sm h1 { font-size: 28px; }
.hero .lead { font-size: 18px; color: var(--muted); margin: 6px 0 24px; }
.hero-ico { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--primary-l); color: var(--primary); margin-bottom: 14px; }
.hero-ico .ico { width: 28px; height: 28px; }
.hero-sm .hero-ico { width: 44px; height: 44px; }
.page-h { margin-bottom: 20px; }
.page-h h1 { margin-bottom: 4px; }

/* Cartes repliables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.card-h { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: none; border: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.card-h:hover { background: #fafbfc; }
.card-h:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.card-t { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.card-t .ico { color: var(--primary); }
.card-chev { color: var(--muted); display: grid; transition: transform .25s ease; }
.card.is-closed .card-chev { transform: rotate(-90deg); }
.card-b { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .28s ease; }
.card.is-closed .card-b { grid-template-rows: 0fr; }
.card-in { overflow: hidden; padding: 0 20px 20px; }
.card.is-closed .card-in { padding-bottom: 0; }
.card-in > :first-child { margin-top: 0; }
.card-danger .card-t .ico { color: var(--red); }
.card-success { border-color: #b7dfc2; }
.card-flat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 500 14px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: #f6f8fa; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
.btn-danger { color: var(--red); border-color: #f3c2bd; }
.btn-danger:hover { background: var(--red-l); }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-block { width: 100%; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.row-actions form { margin: 0; }

/* Formulaires */
.form { display: block; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 500; color: #3c4652; }
.field.full { grid-column: 1 / -1; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], input[type=date], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d0d7e2; border-radius: 10px; background: #fff; font: 14px var(--font); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
textarea { font-family: var(--mono); font-size: 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26, 115, 232, .15); }
input:disabled { background: #f6f8fa; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.check.small { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 16px; margin: 6px 0 16px; }
.seg { display: inline-flex; background: #f1f3f6; border-radius: 99px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg label { cursor: pointer; }
.seg input { display: none; }
.seg span { display: block; padding: 7px 16px; border-radius: 99px; font-size: 14px; color: var(--muted); font-weight: 500; }
.seg input:checked + span { background: #fff; color: var(--primary); box-shadow: var(--shadow); }
details.adv { margin: 6px 0 14px; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; }
details.adv summary { cursor: pointer; color: var(--primary); font-weight: 500; font-size: 14px; }
details.adv[open] summary { margin-bottom: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 180px; flex: 0 1 auto; }
.inline-edit { display: flex; gap: 6px; align-items: center; }
.inline-edit input { padding: 6px 9px; font-size: 13px; }
.inline-edit input[name=daily_quota] { width: 80px; }

/* Grilles */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }
.grid2.tight { gap: 0 10px; }
.grid2 > .card { margin-bottom: 16px; }
.area-admin .grid2 { gap: 0 16px; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; padding: 10px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 10px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.dim td { opacity: .55; }
.table td input { padding: 6px 9px; font-size: 13px; }

/* Éléments */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: var(--green-l); color: #0d652d; border-color: #c4e6cf; }
.alert-error { background: var(--red-l); color: #a50e0e; border-color: #f6c8c3; }
.alert-info { background: var(--blue-l); color: var(--primary-d); border-color: #c9dbfb; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; }
.b-green { background: var(--green-l); color: var(--green); }
.b-red { background: var(--red-l); color: var(--red); }
.b-amber { background: var(--amber-l); color: var(--amber); }
.b-blue { background: var(--blue-l); color: var(--primary); }
.b-grey { background: #f1f3f6; color: var(--muted); }
.pill { display: inline-block; font-family: var(--mono); font-size: 12px; background: #f1f3f6; border-radius: 6px; padding: 2px 7px; margin: 1px 0; }
.list { margin: 0; padding-left: 20px; }
.list li { margin: 6px 0; }
.steps { margin: 0 0 12px; padding-left: 22px; }
.steps li { margin: 8px 0; }
.checks { list-style: none; padding: 0; margin: 0 0 6px; }
.checks li { padding: 6px 0; }
.checks li.ok { color: var(--green); }
.checks li.ko { color: var(--red); }
.checks li a { color: inherit; }
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.code { background: #0f1720; color: #e6edf3; padding: 14px 16px; border-radius: 12px; overflow-x: auto; margin: 0 0 12px; line-height: 1.5; white-space: pre; }
.token-box { display: flex; gap: 10px; align-items: center; background: var(--primary-l); border: 1px solid #c9dbfb; border-radius: 12px; padding: 12px 14px; flex-wrap: wrap; }
.token-box code { background: none; font-size: 15px; word-break: break-all; flex: 1; color: var(--primary-d); }
.copyline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.copyline > span { font-size: 13px; color: var(--muted); min-width: 210px; }
.copyline code { word-break: break-all; }
.infobox { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; }
.infobox p { margin: 6px 0; }
.subnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.subnav a { padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.subnav a:hover { color: var(--primary); text-decoration: none; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; font-size: 14px; }

.feat { padding: 4px 4px 0; }
.feat .num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 99px; background: var(--primary-l); color: var(--primary); font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.feat strong { display: block; margin-bottom: 4px; }
.feat p { margin: 0; color: var(--muted); font-size: 14px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); margin-bottom: 10px; }
.tile:hover { border-color: var(--primary); text-decoration: none; background: #fafcff; }
.tile .ico { color: var(--primary); }
.tile span { color: var(--muted); font-size: 14px; }

/* KPIs et graphiques */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi span { display: block; font-size: 13px; color: var(--muted); }
.kpi strong { display: block; font-size: 28px; font-weight: 650; margin-top: 4px; }
.kpi em { font-style: normal; font-size: 12px; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 6px; }
.bar-stack { width: 100%; max-width: 34px; display: flex; flex-direction: column; border-radius: 6px 6px 2px 2px; overflow: hidden; min-height: 2px; background: #eef1f5; }
.bar-stack i, .legend i { display: block; }
.bar-stack .live, .legend .live { background: var(--primary); }
.bar-stack .hit, .legend .hit { background: #9fc3f7; }
.bar span { font-size: 11px; color: var(--muted); }
.legend { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin: 12px 0 0; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-left: 10px; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.timeline li { padding: 7px 0; border-bottom: 1px solid #eef1f5; }
.timeline li:last-child { border: 0; }
.chart { min-height: 120px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .ax { fill: var(--muted); font-size: 11px; }

/* Menus et connexion */
details.menu { position: relative; display: inline-block; }
details.menu summary { list-style: none; }
details.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(16, 24, 40, .12); padding: 14px; width: 260px; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.menu-pop form { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.login { max-width: 400px; margin: 30px auto 0; }
.login .hero-sm { text-align: center; }
.sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.foot { border-top: 1px solid var(--line); background: var(--surface); }
.foot-in { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 18px; color: var(--muted); font-size: 13px; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 10px; flex-direction: column; }
  .nav.open { display: flex; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 30px; }
  .dl { grid-template-columns: 1fr; }
  .copyline > span { min-width: 0; width: 100%; }
}

/* Administration : barre plus large, menu compact, repli en dessous de 1360 px */
.area-admin .topbar-in, .area-admin .wrap { max-width: 1400px; }
.area-admin .nav { flex-wrap: nowrap; }
.area-admin .nav a { padding: 7px 10px; font-size: 13.5px; white-space: nowrap; }
@media (max-width: 1360px) {
  .area-admin .nav-toggle { display: block; }
  .area-admin .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 10px; flex-direction: column; }
  .area-admin .nav.open { display: flex; }
}

.area-admin .nav .sm-only { display: none; }
@media (max-width: 1360px) { .area-admin .nav .sm-only { display: inline; } }
.devhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.devhead .badge { margin-right: 6px; }
.devpower { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; }
.devpower small { font-size: 14px; color: var(--muted); font-weight: 500; }
.price-set[hidden] { display: none; }
.kpi span.badge { display: inline-block; font-size: 13px; color: inherit; }
