/* =====================================================================
   Identik — Design System
   Dark navy premium · accent bleu électrique · DX-first
   ===================================================================== */

:root {
  /* Fonds bleu nuit très profond */
  --bg-0: #020408;   /* fond le plus profond */
  --bg-1: #050914;   /* panneaux / surfaces */
  --bg-2: #091024;   /* surfaces élevées / hover */
  --bg-3: #0d1734;

  /* Accent bleu marine */
  --accent:        #1e3a8a;
  --accent-hover:  #1e40af;
  --accent-soft:   rgba(30, 58, 138, 0.14);
  --accent-ring:   rgba(30, 58, 138, 0.35);

  /* Texte */
  --text:        #eaf0ff;
  --text-muted:  #8b97b8;
  --text-faint:  #59648a;

  /* Bordures & traits */
  --border:        rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);

  /* États */
  --success: #2fd17a;
  --warning: #f5b54a;
  --danger:  #ff5d6c;

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 20px;

  --shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.8);
  --shadow-soft: 0 8px 28px -18px rgba(0, 0, 0, 0.7);

  --sidebar-w: 264px;
  --topbar-h: 64px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* ------------------------------------------------------------------ Reset */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1100px 600px at 80% -10%, rgba(30, 58, 138, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(30, 58, 138, 0.08), transparent 55%),
    var(--bg-0);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }

::selection { background: var(--accent-soft); }

/* --------------------------------------------------------------- Branding */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand img { width: 30px; height: 30px; display: block; }
.brand span { color: var(--text); }

/* ------------------------------------------------------------- Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 550;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px -12px var(--accent-ring);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg-2); }

.btn-block { width: 100%; }

/* --------------------------------------------------------------- Forms */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 7px;
  font-weight: 500;
}
.input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: var(--text-faint); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* --------------------------------------------------------------- Alerts */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-error {
  background: rgba(255, 93, 108, 0.10);
  border-color: rgba(255, 93, 108, 0.30);
  color: #ffb3bb;
}
.alert-success {
  background: rgba(47, 209, 122, 0.10);
  border-color: rgba(47, 209, 122, 0.30);
  color: #97e8bd;
}

/* ===================================================================
   Layout d'authentification (login / register)
   =================================================================== */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 32px;
  box-shadow: var(--shadow);
}
.auth-card .brand { margin-bottom: 26px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-muted); font-size: 14px; margin-bottom: 26px; }
.auth-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
}
.auth-foot a { color: var(--accent-hover); font-weight: 500; }

/* ===================================================================
   Layout applicatif (sidebar + topbar + contenu)
   =================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* --------- Sidebar épurée --------- */
.sidebar {
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(5,9,20,0.7), rgba(2,4,8,0.7));
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand { padding: 4px 8px; }

.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-group .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 6px 10px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; opacity: .5;
}
.nav-item.active .dot { background: var(--accent); opacity: 1; }

/* --------- Sidebar Accordion --------- */
.nav-details summary { list-style: none; cursor: pointer; user-select: none; }
.nav-details summary::-webkit-details-marker { display: none; }
.nav-details summary .chevron { opacity: 0.5; transition: transform .2s ease; }
.nav-details[open] summary .chevron { transform: rotate(90deg); }
.nav-subgroup { display: flex; flex-direction: column; padding-left: 36px; gap: 4px; margin-top: 4px; margin-bottom: 8px; }
.nav-subitem { font-size: 13.5px; color: var(--text-muted); padding: 6px 10px; border-radius: var(--radius-sm); transition: all .15s ease; text-decoration: none; }
.nav-subitem:hover { background: var(--bg-2); color: var(--text); }
.nav-subitem.active { background: var(--accent-soft); color: var(--text); font-weight: 500; }

.sidebar-foot { margin-top: auto; }

/* --------- Topbar --------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  background: rgba(2, 4, 8, 0.75);
  backdrop-filter: blur(12px);
  z-index: 5;
}
.topbar .page-title { font-size: 15px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; color: var(--text);
}

/* --------- Contenu --------- */
.content { padding: 32px 30px 56px; max-width: 1180px; width: 100%; margin: 0 auto; }
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 26px; }
.page-head p { color: var(--text-muted); margin: 6px 0 0; font-size: 14.5px; }

/* --------- Cartes & stats --------- */
.card {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat .k { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat .v { font-size: 30px; font-weight: 650; letter-spacing: -0.03em; margin-top: 8px; }
.stat .v small { font-size: 14px; color: var(--text-faint); font-weight: 500; }

/* --------- Liste de volumes --------- */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-title h2 { font-size: 17px; }

.volume-list { display: flex; flex-direction: column; gap: 10px; }
.volume {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  transition: border-color .15s ease, background .15s ease;
}
.volume:hover { border-color: var(--border-strong); background: var(--bg-2); }
.volume .glyph {
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--accent-soft);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.volume .glyph i {
  display: block; width: 16px; height: 2.5px; border-radius: 2px;
  background: var(--accent); position: relative;
}
.volume .glyph i::before, .volume .glyph i::after {
  content: ""; position: absolute; left: 0; height: 2.5px; border-radius: 2px;
  background: var(--accent);
}
.volume .glyph i::before { top: -5px; width: 11px; }
.volume .glyph i::after  { top: 5px; width: 13px; }
.volume .meta { flex: 1; min-width: 0; }
.volume .meta .name { font-weight: 550; font-size: 14.5px; }
.volume .meta .uuid {
  font-family: var(--mono); font-size: 12px; color: var(--text-faint);
  margin-top: 3px;
}
.volume .count { font-size: 13px; color: var(--text-muted); }

.badge {
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; letter-spacing: 0.02em;
}
.badge-users { background: var(--accent-soft); color: var(--accent-hover); }
.badge-orgs  { background: rgba(245,181,74,0.14); color: var(--warning); }

/* --------- État vide --------- */
.empty {
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
}
.empty .glyph {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 16px;
  background: var(--accent-soft); display: grid; place-items: center;
}
.empty h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 14px; margin: 0 0 18px; }

/* --------- Bloc code (clé API / snippet) --------- */
.code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: #c7d2fe;
  overflow-x: auto;
}

/* --------- Context Switcher --------- */
.context-switcher {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  cursor: pointer;
  transition: background .2s;
}
.context-switcher:hover { background: rgba(255,255,255,0.06); }
.context-switcher .info { display: flex; flex-direction: column; }
.context-switcher .info small { font-size: 11px; color: var(--text-faint); margin-bottom: 2px; }
.context-switcher .info strong { font-size: 13px; font-weight: 600; }

/* --------- Sidebar Icons --------- */
.nav-item svg {
  width: 16px; height: 16px; opacity: 0.6; transition: opacity .15s ease;
}
.nav-item:hover svg, .nav-item.active svg { opacity: 1; }
.nav-item.active svg { color: var(--accent); }

/* --------- Topbar --------- */
.search-input {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 36px;
  color: var(--text);
  font-size: 13px;
  width: 300px;
  transition: all .2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b97b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
  outline: none;
}
.breadcrumb { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.breadcrumb .separator { margin: 0 8px; color: var(--text-faint); }
.breadcrumb .current { color: var(--text); font-weight: 600; }

.topbar-icons { display: flex; gap: 16px; align-items: center; margin-right: 16px; }
.topbar-icons svg { width: 18px; height: 18px; color: var(--text-muted); cursor: pointer; transition: color .2s; }
.topbar-icons svg:hover { color: var(--text); }

/* --------- Tabs --------- */
.page-header-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.page-header-top h1 { font-size: 24px; display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.page-header-top .sub { font-size: 13px; color: var(--text-muted); }

.tabs {
  display: flex; gap: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.tab-item {
  padding: 0 4px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .2s;
}
.tab-item:hover { color: var(--text); }
.tab-item.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* --------- Onboarding Widget --------- */
.onboarding-widget {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 32px;
}
.onboarding-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.onboarding-header h2 { font-size: 18px; }
.onboarding-header .progress-text { font-size: 13px; color: var(--text-muted); }

.onboarding-body {
  display: grid;
  grid-template-columns: 280px 1fr;
}
.onboarding-steps {
  border-right: 1px solid var(--border);
  padding: 16px 0;
}
.step-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: all .2s;
}
.step-item:hover { background: var(--bg-2); }
.step-item.active {
  background: rgba(255,255,255,0.02);
  color: var(--text);
  border-left-color: var(--accent);
}
.step-item.completed .circle {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.step-item .circle {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid; place-items: center; font-size: 11px;
}
.onboarding-content {
  padding: 32px;
}
.onboarding-content h3 { font-size: 18px; margin-bottom: 12px; }
.onboarding-content p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; line-height: 1.6; }
.onboarding-actions { display: flex; gap: 16px; align-items: center; }

/* --------- Layout 2 colonnes --------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
.dashboard-col .section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.dashboard-col .section-header h3 { font-size: 16px; font-weight: 600; }
.dashboard-col .section-header a { font-size: 13px; color: var(--accent); font-weight: 500; }

.status-card {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.status-item {
  display: flex; gap: 12px; margin-bottom: 16px;
}
.status-item:last-child { margin-bottom: 0; }
.status-item .icon { color: var(--success); font-size: 18px; margin-top: 2px; }
.status-item .details h4 { font-size: 14px; margin-bottom: 4px; }
.status-item .details p { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.5; }
.status-item .details .date { font-size: 12px; color: var(--text-faint); margin-top: 4px; display: block; }

/* --------- Responsive --------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 24px 18px 40px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .onboarding-body { grid-template-columns: 1fr; }
  .onboarding-steps { border-right: none; border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 16px; }
}

/* --------- Dropdown Menu --------- */
.dropdown-menu { display: none; position: absolute; top: 100%; left: 0; margin-top: 8px; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5); min-width: 200px; z-index: 100; padding: 8px 0; }
.dropdown-menu.show { display: block; }
.dropdown-header { padding: 4px 12px; font-size: 11px; text-transform: uppercase; color: var(--text-faint); font-weight: 600; letter-spacing: 0.05em; }
.dropdown-item { display: flex; align-items: center; padding: 8px 12px; color: var(--text); font-size: 13.5px; text-decoration: none; transition: background 0.1s; cursor: pointer; }
.dropdown-item:hover { background: var(--bg-2); }
.dropdown-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 0; }
.text-accent { color: var(--accent) !important; }

/* --------- Modal --------- */
.modal-backdrop { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center; }
.modal-backdrop.show { display: flex; }
.modal-box { background: var(--bg-1); width: 100%; max-width: 480px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: 0 20px 40px rgba(0,0,0,0.4); overflow: hidden; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--bg-2); }
.modal-body { padding: 24px 20px; }
