:root {
  --bg: #F4F4F2;
  --card: #ffffff;
  --border: rgba(140,115,89,0.18);
  --border-strong: rgba(140,115,89,0.35);
  --text: #1a1410;
  --muted: #6F5A45;
  --accent: #111111;
  --accent-dark: #000000;
  --accent-light: rgba(0,0,0,0.06);
  --brand: #8C7359;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-size: 15px;
  min-height: 100vh;
}

/* Navbar */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand {
  color: var(--text) !important;
  font-family: Georgia,"Times New Roman",serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -.01em;
}
.navbar-brand i { color: var(--brand); }

/* Buttons */
.btn-primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  border-radius: 6px;
  font-weight: 500;
  transition: background .15s, border-color .15s;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}
.btn-outline-accent {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--accent);
  border-radius: 6px;
  font-weight: 500;
  transition: background .15s, border-color .15s;
}
.btn-outline-accent:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
}
.btn-outline-light {
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 6px;
  background: transparent;
}
.btn-outline-light:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--text);
}
.btn-outline-danger {
  border-radius: 6px;
  font-size: .85rem;
}
.btn-outline-warning {
  border-radius: 6px;
  font-size: .85rem;
}
.btn-danger { border-radius: 6px; }
.btn-success { border-radius: 6px; background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #15803d; border-color: #15803d; }
.btn-outline-success {
  border-radius: 6px;
  border-color: var(--success);
  color: var(--success);
}
.btn-outline-success:hover {
  background: var(--success);
  color: #fff;
}
.btn-outline-secondary {
  border-radius: 6px;
  border-color: var(--border-strong);
  color: var(--muted);
}
.btn-outline-secondary:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--text);
}

/* Hero */
.hero { padding: 80px 0 64px; }

.badge-pill {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent-dark);
  border: 1px solid var(--border-strong);
  border-radius: 50px;
  padding: 5px 16px;
  font-size: .8rem;
  font-weight: 500;
}

.hero h1 {
  font-family: Georgia,"Times New Roman",serif;
  color: var(--text);
}

.accent-text { color: var(--accent); }

/* Stock cards */
.stock-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 36px;
  text-align: center;
  min-width: 180px;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.stock-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(140,115,89,0.12);
}
.stock-icon { font-size: 1.8rem; color: var(--brand); margin-bottom: 8px; }
.stock-count {
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1;
  font-family: Georgia,"Times New Roman",serif;
  color: var(--text);
}
.stock-label { color: var(--muted); font-size: .83rem; margin-top: 4px; }

/* Feature cards */
.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  height: 100%;
  transition: border-color .18s;
}
.feature-card:hover { border-color: var(--accent); }

/* Auth */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 60px);
  padding: 24px;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 2px 12px rgba(140,115,89,0.07);
}

/* Dashboard cards */
.dash-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}

/* Balance */
.balance-display {
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  font-family: Georgia,"Times New Roman",serif;
}

/* Prix / stat en marron brand */
.brand-color { color: var(--brand); }

/* Account result */
.account-result {
  background: rgba(22,163,74,0.06);
  border: 1px solid rgba(22,163,74,0.25);
  border-radius: 8px;
  padding: 16px;
}
.result-label {
  font-size: .72rem;
  color: var(--success);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.result-email { font-size: .95rem; font-weight: 600; font-family: monospace; margin-bottom: 4px; }
.result-password { font-size: .88rem; color: var(--muted); font-family: monospace; }

/* Stat cards */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  transition: border-color .18s;
}
.stat-card-green {
  border-color: rgba(22,163,74,0.35);
  background: rgba(22,163,74,0.04);
}
.stat-card-red {
  border-color: rgba(220,38,38,0.35);
  background: rgba(220,38,38,0.04);
}
.stat-icon { font-size: 1.2rem; margin-bottom: 6px; color: var(--brand); }
.stat-val {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  font-family: Georgia,"Times New Roman",serif;
}
.stat-label {
  font-size: .68rem;
  color: var(--muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* Tables */
.table { color: var(--text); }
.table th { color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; border-color: var(--border); }
.table td { border-color: var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--accent-light); }
.font-mono { font-family: monospace; }

/* Badges */
.badge.bg-primary { background: var(--accent) !important; }
.badge.bg-secondary { background: #c4b8ac !important; color: #3A2F25 !important; }
.badge.bg-success { background: var(--success) !important; }
.badge.bg-danger { background: var(--danger) !important; }
.badge.bg-warning { background: var(--warning) !important; color: #fff !important; }
.badge.bg-info { background: #0891b2 !important; }

/* Forms */
.form-control, .form-select {
  background: #fff;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 6px;
  font-size: .9rem;
}
.form-control:focus, .form-select:focus {
  background: #fff;
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(140,115,89,0.12);
}
.form-control::placeholder { color: #bba899; }
.form-label { color: var(--muted); font-size: .82rem; font-weight: 500; }

/* Alerts */
.alert-danger {
  background: rgba(220,38,38,0.07);
  border-color: rgba(220,38,38,0.25);
  color: #b91c1c;
  border-radius: 7px;
}
.alert-warning {
  background: rgba(217,119,6,0.08);
  border-color: rgba(217,119,6,0.25);
  color: #b45309;
  border-radius: 7px;
}

/* Misc */
.text-primary { color: var(--accent) !important; }
.text-muted { color: var(--muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: #0891b2 !important; }
.text-secondary { color: var(--muted) !important; }

/* Section headings */
.section-title {
  font-family: Georgia,"Times New Roman",serif;
  font-weight: 700;
  color: var(--text);
}

hr { border-color: var(--border); }

.doc-block { display:none }

/* API doc */
.api-endpoint { border-left: 2px solid var(--border); padding-left: 12px; }
.api-badge { font-size: .62rem; font-weight: 700; border-radius: 4px; padding: 2px 7px; letter-spacing: .03em; flex-shrink: 0; }
.api-get  { background: rgba(140,115,89,.12); color: #6F5A45; }
.api-post { background: rgba(22,163,74,.1);  color: #15803d; }
.api-path { font-size: .8rem; color: var(--text); background: var(--accent-light); border: 1px solid var(--border); border-radius: 5px; padding: 1px 7px; }
.api-desc { font-size: .75rem; color: var(--muted); }
.api-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 13px;
  font-size: .72rem;
  font-family: monospace;
  color: var(--text);
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}
.api-comment { color: var(--muted); }
.api-key-inline { color: var(--brand); font-weight: 500; }

/* Accordéon doc */
.acc-list {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.acc-item { border-bottom: 1px solid var(--border); }
.acc-item:last-child { border-bottom: none; }
.acc-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: none;
  padding: 13px 16px;
  font-size: .83rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}
.acc-btn:hover { background: var(--accent-light); }
.acc-btn[aria-expanded="true"] { background: var(--accent-light); }
.acc-btn[aria-expanded="true"] .acc-icon { transform: rotate(180deg); }
.acc-icon { font-size: .65rem; color: var(--muted); transition: transform .2s; flex-shrink: 0; }
.acc-body { padding: 4px 16px 18px; background: var(--bg); }
.acc-label {
  font-size: .64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin: 14px 0 7px;
}
.acc-url-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.acc-url-wrap code {
  flex: 1;
  padding: 9px 12px;
  font-size: .71rem;
  font-family: monospace;
  color: var(--text);
  word-break: break-all;
  line-height: 1.5;
  background: transparent;
}
.acc-url-wrap code .api-key-inline { color: var(--brand); }
.acc-copy-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 13px;
  background: var(--accent-light);
  border: none;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: .8rem;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.acc-copy-btn:hover { background: rgba(140,115,89,.18); color: var(--accent-dark); }
.acc-resp {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .71rem;
  font-family: monospace;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
  margin: 0;
}
.acc-params { display: flex; flex-direction: column; gap: 6px; }
.acc-param-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: .78rem;
}
.acc-param-row code {
  background: var(--accent-light);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: .72rem;
  color: var(--text);
  white-space: nowrap;
}
.acc-param-val { color: var(--accent-dark); font-size: .75rem; white-space: nowrap; }
.acc-param-desc { color: var(--muted); font-size: .73rem; }
.api-url-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: .72rem;
  font-family: monospace;
  word-break: break-all;
  line-height: 1.6;
}
.api-base { color: var(--text); }
.api-param { color: var(--muted); }
.api-resp {
  background: transparent;
  border: none;
  border-left: 2px solid var(--border);
  border-radius: 0;
  padding: 4px 0 0 10px;
  font-size: .68rem;
  font-family: monospace;
  color: var(--muted);
  margin: 4px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Auth shadowproxy style ───────────────────────── */
@keyframes fade-up {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}
.sp-container {
  animation: fade-up .35s ease forwards;
  width: 100%;
  max-width: 380px;
}
.sp-brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  margin-bottom: 1.5rem;
}
.sp-brand i { font-size: 1.3rem; color: #000; }
.sp-brand span { font-family: Georgia,"Times New Roman",serif; font-size: 1.15rem; color: #3A2F25; letter-spacing: -.01em; }
.sp-title { font-family: Georgia,"Times New Roman",serif; font-size: 1.45rem; font-weight: 700; color: #3A2F25; margin: 0 0 .25rem; }
.sp-subtitle { font-size: .72rem; color: #8C7359; margin: 0; }
.sp-card {
  background: #fff;
  border: 1px solid rgba(140,115,89,0.15);
  border-radius: 1rem;
  box-shadow: 0 12px 30px -18px rgba(58,47,37,.2);
  padding: 1.5rem;
  margin-top: 1.5rem;
}
.sp-card > * + * { margin-top: 1rem; }
.sp-label { display: block; font-size: .688rem; color: #8C7359; margin-bottom: .375rem; }
.sp-field {
  width: 100%;
  background: #fff;
  border: 1px solid rgba(140,115,89,0.2);
  border-radius: .5rem;
  padding: .625rem .875rem;
  font-size: .75rem;
  color: #3A2F25;
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}
.sp-field:focus { border-color: #8C7359; box-shadow: none; }
.sp-field::placeholder { color: rgba(140,115,89,.45); }
.sp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #000;
  color: #fff;
  border: none;
  border-radius: .5rem;
  padding: .55rem 1rem;
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s;
  font-family: inherit;
}
.sp-btn:hover { opacity: .78; color: #fff; }
.sp-remember {
  display: flex;
  align-items: center;
  gap: .625rem;
  cursor: pointer;
  user-select: none;
}
.sp-checkbox {
  width: 1rem;
  height: 1rem;
  border-radius: .25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .12s, border .12s;
}
.sp-alert {
  background: rgba(220,38,38,.07);
  border: 1px solid rgba(220,38,38,.25);
  border-radius: .5rem;
  color: #b91c1c;
  font-size: .75rem;
  padding: .5rem .75rem;
}
.sp-foot { font-size: .688rem; color: #8C7359; text-align: center; margin: 0; }
.sp-foot a { color: #3A2F25; font-weight: 500; text-decoration: none; }
.sp-foot a:hover { text-decoration: underline; }

/* ── Admin sidebar ───────────────────────────────── */
.admin-sidebar {
  width: 210px;
  min-width: 210px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  transition: width .18s ease, min-width .18s ease;
  overflow: hidden;
}
.admin-sidebar.collapsed { width: 52px; min-width: 52px; }
.admin-sidebar.collapsed .sb-label { display: none; }
.admin-sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
}
.admin-sidebar.collapsed .sidebar-item i { font-size: 1.05rem; }
.sb-toggle {
  align-self: flex-end;
  margin: 0 10px 14px auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .72rem;
  flex-shrink: 0;
  transition: color .13s, border-color .13s;
}
.sb-toggle:hover { color: var(--text); border-color: var(--brand); }
.admin-sidebar.collapsed .sb-toggle { align-self: center; margin: 0 0 14px; }
.sidebar-section {
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  padding: 0 18px 6px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  font-size: .83rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background .13s, border-color .13s, color .13s;
  white-space: nowrap;
}
.sidebar-item i { font-size: .95rem; color: var(--muted); flex-shrink: 0; transition: color .13s; }
.sidebar-item:hover {
  background: var(--accent-light);
  color: var(--accent-dark);
}
.sidebar-item:hover i { color: var(--accent); }
.sidebar-item.active {
  background: var(--accent-light);
  border-left-color: var(--brand);
  color: var(--accent-dark);
  font-weight: 600;
}
.sidebar-item.active i { color: var(--brand); }
.sidebar-badge {
  margin-left: auto;
  background: var(--accent-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .62rem;
  padding: 1px 7px;
  color: var(--muted);
}

/* ── mailgen01 status ────────────────────────────── */
.mg-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mg-dot-online  { background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.mg-dot-offline { background: var(--danger);  box-shadow: 0 0 0 3px rgba(220,38,38,.18); }
.mg-dot-loading { background: #c4b8ac; animation: mg-pulse .9s ease-in-out infinite alternate; }
@keyframes mg-pulse { from { opacity:.4 } to { opacity:1 } }

.mg-metric {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
}
.mg-metric-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  width: 44px;
  white-space: nowrap;
}
.mg-bar-wrap {
  width: 90px;
  height: 6px;
  background: var(--accent-light);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.mg-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--brand);
  transition: width .4s ease, background .3s;
  width: 0%;
}
.mg-metric-val {
  font-size: .73rem;
  color: var(--text);
  min-width: 80px;
  font-family: monospace;
}

.worker-step {
  font-size: .72rem;
  background: rgba(140,115,89,.1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--brand);
  white-space: nowrap;
}
