/* ==========================================================================
   AxoBilling - Design System
   DA : noir (fond) / blanc (primaire). Aucun degrade. ASCII only.
   Typo : Inter (UI) + IBM Plex Mono (donnees, montants, codes).
   ========================================================================== */

:root{
  /* Neutres - echelle du noir pur au blanc */
  --bg:        #000000;
  --bg-1:      #0a0a0a;
  --bg-2:      #101012;
  --bg-3:      #16161a;
  --surface:   #0d0d0f;
  --line:      #232327;
  --line-2:    #34343a;
  --text:      #ffffff;
  --text-2:    #b4b4bb;
  --text-3:    #7a7a83;
  --text-4:    #4d4d55;
  /* Primaire = blanc */
  --primary:   #ffffff;
  --primary-ink:#000000;
  /* Etats (desatures, pas de couleurs criardes) */
  --ok:        #4ade80;
  --warn:      #fbbf24;
  --bad:       #f87171;
  --info:      #93c5fd;
  /* Rayons & ombres */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --shadow: 0 1px 0 rgba(255,255,255,.03), 0 8px 24px rgba(0,0,0,.5);
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--sans);
  font-size:14px;
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
a{ color:var(--text); text-decoration:none; }
a:hover{ color:var(--text-2); }
h1,h2,h3,h4{ margin:0 0 .4em; font-weight:600; letter-spacing:-.02em; line-height:1.15; }
h1{ font-size:30px; } h2{ font-size:22px; } h3{ font-size:17px; }
p{ margin:0 0 1em; color:var(--text-2); }
small{ color:var(--text-3); }
code,kbd{ font-family:var(--mono); font-size:.9em; }
hr{ border:0; border-top:1px solid var(--line); margin:24px 0; }
::selection{ background:#fff; color:#000; }

/* Scrollbar sobre */
*::-webkit-scrollbar{ width:10px; height:10px; }
*::-webkit-scrollbar-thumb{ background:var(--line-2); border-radius:8px; }
*::-webkit-scrollbar-track{ background:transparent; }

/* --- Icones Lucide --- */
[data-lucide]{ width:1em; height:1em; stroke-width:1.75; vertical-align:-.14em; }
.icon-lg[data-lucide]{ width:20px; height:20px; }

/* --- Layout applicatif : sidebar + contenu --- */
.app{ display:flex; min-height:100vh; }
.sidebar{
  width:248px; flex:0 0 248px;
  background:var(--bg-1);
  border-right:1px solid var(--line);
  padding:18px 14px;
  position:sticky; top:0; height:100vh; overflow-y:auto;
  display:flex; flex-direction:column; gap:6px;
}
.brand{ display:flex; align-items:center; gap:10px; padding:6px 8px 18px; }
.brand-mark{
  width:28px; height:28px; border-radius:7px;
  background:var(--primary); color:var(--primary-ink);
  display:grid; place-items:center; font-weight:800; font-size:15px;
  font-family:var(--mono);
}
.brand-name{ font-weight:700; letter-spacing:-.02em; font-size:16px; }
.brand-name span{ color:var(--text-3); font-weight:500; }

.shop-switch{
  border:1px solid var(--line); border-radius:var(--r);
  background:var(--bg-2); padding:8px 10px; margin-bottom:10px;
  display:flex; align-items:center; gap:9px; cursor:pointer;
}
.shop-switch .avatar{ width:26px;height:26px;border-radius:6px;background:var(--bg-3);display:grid;place-items:center;overflow:hidden; }
.shop-switch .avatar img{ width:100%;height:100%;object-fit:cover; }
.shop-switch .meta{ min-width:0; flex:1; }
.shop-switch .meta b{ display:block; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.shop-switch .meta small{ font-size:11px; color:var(--text-3); }

.nav-group{ margin-top:12px; }
.nav-label{ font-size:10.5px; text-transform:uppercase; letter-spacing:.09em; color:var(--text-4); padding:4px 10px; }
.nav-item{
  display:flex; align-items:center; gap:11px;
  padding:8px 10px; border-radius:var(--r-sm);
  color:var(--text-2); font-size:13.5px; font-weight:500;
}
.nav-item [data-lucide]{ width:17px; height:17px; color:var(--text-3); }
.nav-item:hover{ background:var(--bg-3); color:var(--text); }
.nav-item.active{ background:#fff; color:#000; }
.nav-item.active [data-lucide]{ color:#000; }
.nav-item .lock{ margin-left:auto; width:13px;height:13px;color:var(--text-4); }
.nav-spacer{ flex:1; }

.main{ flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar{
  height:60px; border-bottom:1px solid var(--line);
  display:flex; align-items:center; gap:16px; padding:0 26px;
  position:sticky; top:0; background:rgba(0,0,0,.72); backdrop-filter:blur(10px); z-index:20;
}
.topbar h1{ font-size:18px; margin:0; }
.topbar .spacer{ flex:1; }
.content{ padding:26px; width:100%; }

/* --- Boutons --- */
.btn{
  display:inline-flex; align-items:center; gap:8px; justify-content:center;
  font:inherit; font-weight:600; font-size:13.5px;
  padding:9px 15px; border-radius:var(--r-sm); border:1px solid var(--line-2);
  background:var(--bg-3); color:var(--text); cursor:pointer;
  transition:background .12s, border-color .12s, transform .06s;
  white-space:nowrap;
}
.btn:hover{ background:var(--bg-2); border-color:var(--text-4); color:var(--text); }
.btn:active{ transform:translateY(1px); }
.btn [data-lucide]{ width:16px; height:16px; }
.btn-primary{ background:var(--primary); color:var(--primary-ink); border-color:var(--primary); }
.btn-primary:hover{ background:#e9e9ee; color:#000; border-color:#e9e9ee; }
.btn-ghost{ background:transparent; border-color:transparent; color:var(--text-2); }
.btn-ghost:hover{ background:var(--bg-3); color:var(--text); }
.btn-danger{ color:var(--bad); border-color:var(--line-2); background:transparent; }
.btn-danger:hover{ background:rgba(248,113,113,.1); border-color:var(--bad); }
.btn-sm{ padding:6px 11px; font-size:12.5px; }
.btn-block{ width:100%; }
.btn[disabled]{ opacity:.45; pointer-events:none; }

/* --- Cartes & grilles --- */
.card{
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r); padding:20px;
}
.card-head{ display:flex; align-items:center; gap:12px; margin-bottom:16px; }
.card-head h3{ margin:0; }
.card-head .spacer{ flex:1; }
.grid{ display:grid; gap:16px; }
.grid-2{ grid-template-columns:repeat(2,1fr); }
.grid-3{ grid-template-columns:repeat(3,1fr); }
.grid-4{ grid-template-columns:repeat(4,1fr); }

/* --- Stat tiles --- */
.stat{
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r); padding:18px;
}
.stat .k{ display:flex; align-items:center; gap:8px; color:var(--text-3); font-size:12.5px; font-weight:500; }
.stat .k [data-lucide]{ width:15px;height:15px; }
.stat .v{ font-family:var(--mono); font-size:27px; font-weight:600; letter-spacing:-.02em; margin-top:8px; }
.stat .d{ font-size:12px; margin-top:4px; }
.up{ color:var(--ok); } .down{ color:var(--bad); }

/* --- Tableaux --- */
.table-wrap{ border:1px solid var(--line); border-radius:var(--r); overflow:hidden; background:var(--surface); }
table.tbl{ width:100%; border-collapse:collapse; font-size:13px; }
.tbl th{
  text-align:left; font-weight:600; color:var(--text-3);
  font-size:11px; text-transform:uppercase; letter-spacing:.05em;
  padding:11px 16px; border-bottom:1px solid var(--line); background:var(--bg-1);
}
.tbl td{ padding:12px 16px; border-bottom:1px solid var(--line); color:var(--text-2); }
.tbl tr:last-child td{ border-bottom:0; }
.tbl tr:hover td{ background:var(--bg-1); }
.tbl .mono{ font-family:var(--mono); color:var(--text); }
.tbl td b{ color:var(--text); font-weight:600; }

/* --- Formulaires --- */
.field{ margin-bottom:16px; }
.field label{ display:block; font-size:12.5px; font-weight:600; margin-bottom:6px; color:var(--text-2); }
.field .hint{ font-size:11.5px; color:var(--text-4); margin-top:5px; }
.input, .select, textarea.input{
  width:100%; font:inherit; font-size:13.5px;
  padding:10px 12px; border-radius:var(--r-sm);
  background:var(--bg-2); border:1px solid var(--line-2); color:var(--text);
  transition:border-color .12s;
}
.input:focus, .select:focus, textarea.input:focus{ outline:none; border-color:var(--text-3); }
.input::placeholder{ color:var(--text-4); }
textarea.input{ resize:vertical; min-height:90px; }
.input-group{ display:flex; }
.input-group .addon{
  display:flex; align-items:center; padding:0 12px; font-family:var(--mono); font-size:12.5px;
  background:var(--bg-3); border:1px solid var(--line-2); color:var(--text-3);
}
.input-group .addon:first-child{ border-radius:var(--r-sm) 0 0 var(--r-sm); border-right:0; }
.input-group .addon:last-child{ border-radius:0 var(--r-sm) var(--r-sm) 0; border-left:0; }
.input-group .input{ border-radius:0; }
.input-group .input:first-child{ border-radius:var(--r-sm) 0 0 var(--r-sm); }
.input-group .input:last-child{ border-radius:0 var(--r-sm) var(--r-sm) 0; }

/* Toggle switch */
.switch{ position:relative; display:inline-block; width:40px; height:22px; }
.switch input{ display:none; }
.switch .track{ position:absolute; inset:0; background:var(--bg-3); border:1px solid var(--line-2); border-radius:22px; transition:.15s; }
.switch .track::after{ content:""; position:absolute; width:16px; height:16px; left:2px; top:2px; background:var(--text-3); border-radius:50%; transition:.15s; }
.switch input:checked + .track{ background:#fff; border-color:#fff; }
.switch input:checked + .track::after{ background:#000; transform:translateX(18px); }

/* --- Badges & pills --- */
.badge{ display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:600; padding:3px 9px; border-radius:20px; border:1px solid var(--line-2); color:var(--text-2); }
.badge-ok{ color:var(--ok); border-color:rgba(74,222,128,.3); background:rgba(74,222,128,.08); }
.badge-warn{ color:var(--warn); border-color:rgba(251,191,36,.3); background:rgba(251,191,36,.08); }
.badge-bad{ color:var(--bad); border-color:rgba(248,113,113,.3); background:rgba(248,113,113,.08); }
.badge-muted{ color:var(--text-3); }
.pill-pro{ font-family:var(--mono); font-size:10px; font-weight:700; letter-spacing:.06em; padding:2px 7px; border-radius:5px; background:#fff; color:#000; }
.pill-basic{ font-family:var(--mono); font-size:10px; font-weight:700; letter-spacing:.06em; padding:2px 7px; border-radius:5px; background:var(--bg-3); color:var(--text-3); border:1px solid var(--line-2); }

/* --- Flash / alertes --- */
.flash{ display:flex; align-items:center; gap:10px; padding:12px 15px; border-radius:var(--r-sm); border:1px solid var(--line-2); margin-bottom:16px; font-size:13.5px; background:var(--bg-2); }
.flash [data-lucide]{ width:17px;height:17px; flex:0 0 auto; }
.flash-success{ border-color:rgba(74,222,128,.35); color:#bbf7d0; }
.flash-error{ border-color:rgba(248,113,113,.35); color:#fecaca; }
.flash-info{ border-color:var(--line-2); color:var(--text-2); }

/* --- Empty state --- */
.empty{ text-align:center; padding:56px 20px; color:var(--text-3); }
.empty [data-lucide]{ width:34px;height:34px; color:var(--text-4); margin-bottom:12px; }
.empty h3{ color:var(--text-2); }

/* --- Page header --- */
.page-head{ display:flex; align-items:flex-start; gap:16px; margin-bottom:22px; }
.page-head .spacer{ flex:1; }
.page-head p{ margin:4px 0 0; }

/* --- Locked feature overlay --- */
.locked{ position:relative; }
.locked::after{ content:""; position:absolute; inset:0; background:rgba(0,0,0,.55); border-radius:var(--r); }
.lock-note{ display:inline-flex; align-items:center; gap:7px; font-size:12px; color:var(--text-3); border:1px dashed var(--line-2); padding:6px 11px; border-radius:var(--r-sm); }

/* --- Progress (community goals) --- */
.progress{ height:8px; background:var(--bg-3); border-radius:20px; overflow:hidden; border:1px solid var(--line); }
.progress > span{ display:block; height:100%; background:#fff; }

/* --- Tabs --- */
.tabs{ display:flex; gap:2px; border-bottom:1px solid var(--line); margin-bottom:22px; }
.tabs a{ padding:10px 15px; font-size:13.5px; font-weight:500; color:var(--text-3); border-bottom:2px solid transparent; margin-bottom:-1px; }
.tabs a:hover{ color:var(--text); }
.tabs a.active{ color:var(--text); border-bottom-color:#fff; }

/* --- Utils --- */
.flex{ display:flex; align-items:center; gap:10px; }
.between{ justify-content:space-between; }
.wrap{ flex-wrap:wrap; }
.muted{ color:var(--text-3); }
.mono{ font-family:var(--mono); }
.right{ text-align:right; }
.mt0{margin-top:0;} .mt8{margin-top:8px;} .mt16{margin-top:16px;} .mt24{margin-top:24px;}
.mb0{margin-bottom:0;} .mb8{margin-bottom:8px;} .mb16{margin-bottom:16px;}
.hidden{ display:none !important; }

@media (max-width:960px){
  .grid-4{ grid-template-columns:repeat(2,1fr); }
  .grid-3{ grid-template-columns:1fr; }
  .grid-2{ grid-template-columns:1fr; }
}
@media (max-width:760px){
  .sidebar{ position:fixed; left:0; top:0; z-index:60; transform:translateX(-100%); transition:transform .2s; }
  .sidebar.open{ transform:none; }
  .content{ padding:18px; }
  .grid-4{ grid-template-columns:1fr; }
  .menu-toggle{ display:inline-flex !important; }
}
.menu-toggle{ display:none; }
