/* OpenAds — thème aligné sur OpenSEO (openseo-dark) */
:root {
  color-scheme: dark;
  --background: oklch(18% 0 0);
  --foreground: oklch(92% 0 0);
  --muted: oklch(92% 0 0 / .6);
  --card: oklch(23% 0 0);
  --sidebar: oklch(24% 0 0);
  --hover: oklch(100% 0 0 / .08);
  --secondary: oklch(40% 0 0 / .3);
  --border: oklch(30% 0 0);
  --input: oklch(40% 0 0);
  --primary: oklch(66% .12 262);
  --success: oklch(65% .18 145);
  --warning: oklch(80% .15 80);
  --destructive: oklch(74% .16 25);
  --radius: .5rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--sidebar); color: var(--foreground); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Coquille : barre latérale + panneau principal en retrait */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex: none; display: flex; flex-direction: column; padding: 14px 10px; gap: 4px; }
.brand { font-weight: 700; font-size: 15px; padding: 2px 8px 10px; color: var(--foreground); }
.workspace { border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 10px; margin-bottom: 10px; }
.workspace strong { display: block; font-weight: 500; }
.workspace span { color: var(--muted); font-size: 12px; }
.nav-label { color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; padding: 10px 8px 4px; }
.nav a, .nav button { display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 8px; border-radius: 6px; color: var(--foreground);
  font: inherit; width: 100%; background: none; border: 0; cursor: pointer; position: relative; text-align: left; }
.nav a:hover, .nav button:hover { background: var(--hover); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--hover); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--primary); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 8px; }
.sidebar-foot .who { color: var(--muted); font-size: 12px; padding: 4px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel { flex: 1; min-width: 0; background: var(--background); border: 1px solid var(--border); border-right: 0; border-bottom: 0;
  border-top-left-radius: 12px; margin-top: 6px; padding: 32px 56px 64px; }
.content { max-width: 980px; }

/* En-tête de page */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
h1 { font-size: 24px; font-weight: 600; margin: 0; line-height: 1.3; }
.sub { color: var(--muted); margin: 2px 0 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Cartes */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; }
.card-head p { margin: 2px 0 0; }
.card-body { padding: 0 18px 18px; }
.rows > * { border-top: 1px solid var(--border); }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 500; }
.row .desc { color: var(--muted); font-size: 12px; }
.tile-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--hover); display: grid; place-items: center; flex: none; }
.foot { padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); display: flex; align-items: center; gap: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat { padding: 16px 18px; }
.stat .value { font-size: 26px; font-weight: 600; line-height: 1.2; margin-top: 6px; }

/* Messages et pastilles */
.notice { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--radius); padding: 11px 14px; margin-bottom: 14px; border: 1px solid; }
.notice.ok { color: var(--success); border-color: oklch(65% .18 145 / .4); background: oklch(65% .18 145 / .1); }
.notice.warn { color: var(--warning); border-color: oklch(80% .15 80 / .4); background: oklch(80% .15 80 / .1); }
.notice.error { color: var(--destructive); border-color: oklch(74% .16 25 / .4); background: oklch(74% .16 25 / .1); }
.notice svg.i { margin-top: 2px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 1px 7px; border-radius: 6px; border: 1px solid; white-space: nowrap; }
.badge.ok { color: var(--success); border-color: oklch(65% .18 145 / .45); background: oklch(65% .18 145 / .12); }
.badge.warn { color: var(--warning); border-color: oklch(80% .15 80 / .45); background: oklch(80% .15 80 / .12); }
.badge.error { color: var(--destructive); border-color: oklch(74% .16 25 / .45); background: oklch(74% .16 25 / .12); }
.badge.neutral { color: var(--muted); border-color: var(--border); }
.ok { color: var(--success); } .warn { color: var(--warning); } .error { color: var(--destructive); }

/* Formulaires */
label { display: block; margin: 0 0 14px; font-weight: 500; }
input, select { display: block; width: 100%; margin-top: 6px; height: 38px; padding: 0 11px; border: 1px solid var(--input); border-radius: var(--radius);
  font: inherit; color: var(--foreground); background: oklch(18% 0 0); }
input[type=file] { padding: 7px 10px; height: auto; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
input::placeholder { color: oklch(92% 0 0 / .35); }
.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--radius);
  font: inherit; font-weight: 500; cursor: pointer; border: 1px solid transparent; background: var(--primary); color: #fff;
  white-space: nowrap; flex: none; }
.btn:hover, button:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary, button.secondary { background: var(--secondary); border-color: var(--input); color: var(--foreground); }
button.danger { background: transparent; border-color: oklch(74% .16 25 / .5); color: var(--destructive); }
button.small { height: 30px; padding: 0 10px; font-size: 13px; }
form.inline { display: inline; margin: 0; }
.actions { display: flex; gap: 10px; align-items: center; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 18px; border-bottom: 1px solid var(--border); }
td { padding: 10px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td input { margin-top: 0; height: 32px; max-width: 140px; }
.num { font-variant-numeric: tabular-nums; }

/* Code et secrets */
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: oklch(100% 0 0 / .06); padding: 1px 6px; border-radius: 5px; word-break: break-all; }
pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: oklch(14% 0 0); border: 1px solid var(--border);
  padding: 12px 14px; border-radius: var(--radius); overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 8px 0 14px; }
ol.steps { margin: 0; padding-left: 20px; } ol.steps li { margin-bottom: 10px; } ol.steps li::marker { color: var(--muted); }

/* Pages de connexion */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--background); }
.auth-box { width: 100%; max-width: 400px; }
.auth-box .brand { padding: 0 0 14px; font-size: 16px; }
.auth-box .card { padding: 24px; }
.auth-box h1 { font-size: 20px; }
.auth-box .sub { margin-bottom: 18px; }
.auth-box button { width: 100%; margin-top: 4px; }
.qr { width: 200px; margin: 4px auto 14px; background: #fff; padding: 10px; border-radius: var(--radius); }
.qr svg { width: 100%; height: auto; display: block; }

@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; }
  .workspace, .nav-label, .sidebar-foot .who { display: none; }
  .nav { display: contents; } .nav a, .nav button { width: auto; }
  .sidebar-foot { margin: 0; border: 0; padding: 0; }
  .panel { border-radius: 0; border-left: 0; margin: 0; padding: 24px 18px 48px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
