/* Shell — tokens + layout fixe. Pas de composants métier. */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b16;
  --card-bg: #10182a;
  --surface: #0c1322;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --danger: #f87171;
  --success: #34d399;
  --border: rgba(148, 163, 184, 0.14);
  --shadow-soft: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 18px 40px rgba(0, 0, 0, 0.32);
  --radius-xl: 18px;
  --nav-h: 3.5rem;
  --sidebar-w: 256px;
  --sidebar-rail-w: 76px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f7;
  --card-bg: #ffffff;
  --surface: #f8fafc;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --text: #0f172a;
  --muted: #64748b;
  --danger: #dc2626;
  --success: #16a34a;
  --border: #e2e8f0;
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px rgba(15, 23, 42, 0.06);
  --sidebar-w: 256px;
}

* {
  box-sizing: border-box;
}

body.mk5-app,
body.mk5-login {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background:
    radial-gradient(1100px 520px at 10% -16%, rgba(59, 130, 246, 0.2), transparent 52%),
    radial-gradient(820px 420px at 100% 0%, rgba(14, 165, 233, 0.08), transparent 46%),
    linear-gradient(180deg, #0a1222 0%, #050816 100%);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

[data-theme="light"] body.mk5-app,
[data-theme="light"] body.mk5-login {
  background:
    radial-gradient(1100px 480px at 8% -12%, rgba(59, 130, 246, 0.12), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(14, 165, 233, 0.08), transparent 48%),
    linear-gradient(180deg, #f5f8fc 0%, #e8eef6 100%);
  color: var(--text);
}

.mk5-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
}

.mk5-sidebar {
  width: var(--sidebar-w);
  border-right: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(8, 12, 24, 0.92);
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 60;
  transition: width 0.2s ease;
}

[data-theme="light"] .mk5-sidebar {
  background: rgba(255, 255, 255, 0.92);
  border-right: 1px solid #e8eef5;
  box-shadow: 6px 0 24px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(16px);
}

body.mk5-sidebar-rail {
  --sidebar-w: var(--sidebar-rail-w);
}

.mk5-shell-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
  transition: margin-left 0.2s ease;
}

.mk5-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 10px;
  flex-shrink: 0;
  gap: 8px;
}

.mk5-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.mk5-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.mk5-brand-logo {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

.mk5-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.mk5-brand-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.mk5-brand-sub {
  font-size: 11px;
  color: var(--muted);
}

.mk5-sidebar-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 16px;
}

.mk5-sidebar-collapse:hover {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text);
}

.mk5-side-nav {
  padding: 6px 10px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mk5-side-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mk5-side-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #64748b;
  padding: 10px 12px 6px;
}

.mk5-side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  position: relative;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  text-decoration: none;
}

.mk5-side-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.mk5-side-link:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
}

.mk5-side-link.is-active {
  background: rgba(59, 130, 246, 0.18);
  color: #dbeafe;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.22);
}

.mk5-side-link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

[data-theme="light"] .mk5-side-title {
  color: #94a3b8;
}

[data-theme="light"] .mk5-side-link {
  color: #64748b;
}

[data-theme="light"] .mk5-side-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .mk5-side-link.is-active {
  background: #eff6ff;
  color: #1d4ed8;
}

body.mk5-sidebar-rail .mk5-brand-text,
body.mk5-sidebar-rail .mk5-side-title,
body.mk5-sidebar-rail .mk5-side-label {
  display: none;
}

body.mk5-sidebar-rail .mk5-sidebar-head {
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  padding: 14px 8px 8px;
}

body.mk5-sidebar-rail .mk5-side-nav {
  padding: 8px 8px 20px;
}

body.mk5-sidebar-rail .mk5-side-link {
  justify-content: center;
  padding: 10px 8px;
}

body.mk5-sidebar-rail .mk5-side-link.is-active::before {
  top: 6px;
  bottom: 6px;
}

.mk5-menu-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  min-height: var(--nav-h);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(8, 13, 28, 0.78);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .mk5-menu-bar {
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.mk5-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(71, 85, 105, 0.55);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  flex-shrink: 0;
}

.mk5-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 16px;
  height: 16px;
}

.mk5-burger span {
  display: block;
  height: 1.5px;
  width: 100%;
  background: currentColor;
  border-radius: 1px;
}

.mk5-topbar-divider {
  display: none;
}

.mk5-topbar-title {
  font-size: 16px;
  font-weight: 650;
  flex: 1;
  min-width: 0;
}

.mk5-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.mk5-top-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px !important;
  border-radius: 10px !important;
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}

.mk5-top-cta .mk5-side-ico {
  width: 15px;
  height: 15px;
}

.mk5-usage-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.mk5-usage-chip .mk5-side-ico {
  width: 15px;
  height: 15px;
}

.mk5-icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  cursor: pointer;
}

.mk5-icon-btn:hover {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text);
}

.mk5-icon-btn .mk5-side-ico {
  width: 18px;
  height: 18px;
}

.mk5-lang {
  display: inline-flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(71, 85, 105, 0.55);
  flex-shrink: 0;
}

.mk5-lang-btn {
  min-width: 38px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 0;
  background: #0b1220;
  color: #94a3b8;
  cursor: pointer;
  font-family: inherit;
}

[data-theme="light"] .mk5-lang {
  border-color: #dbe3ee;
  background: #f8fafc;
}

[data-theme="light"] .mk5-lang-btn {
  background: transparent;
  color: #64748b;
}

[data-theme="light"] .mk5-usage-chip {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

[data-theme="light"] .mk5-icon-btn:hover {
  background: #f1f5f9;
}

[data-theme="light"] .mk5-user-btn:hover,
[data-theme="light"] .mk5-user.is-open .mk5-user-btn {
  background: #f8fafc;
  border-color: #bfdbfe;
}

.mk5-lang-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.mk5-user {
  position: relative;
}

.mk5-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
}

.mk5-user-btn:hover,
.mk5-user.is-open .mk5-user-btn {
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(15, 23, 42, 0.55);
}

.mk5-user-chev {
  display: flex;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.mk5-user-chev .mk5-side-ico {
  width: 14px;
  height: 14px;
}

.mk5-user.is-open .mk5-user-chev {
  transform: rotate(180deg);
}

.mk5-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  text-transform: lowercase;
  flex-shrink: 0;
}

.mk5-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
  text-align: left;
}

.mk5-user-name {
  font-size: 13px;
  font-weight: 600;
}

.mk5-user-role {
  font-size: 11px;
  color: var(--muted);
  text-transform: lowercase;
}

.mk5-user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 188px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(51, 65, 85, 0.9);
  background: #0b1220;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  z-index: 80;
}

[data-theme="light"] .mk5-user-menu {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .mk5-user-item {
  color: #0f172a;
}

[data-theme="light"] .mk5-user-item:hover {
  background: #f1f5f9;
}

[data-theme="light"] .mk5-user-item.is-danger {
  color: #dc2626;
}

.mk5-user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e2e8f0;
  text-decoration: none;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.mk5-user-item .mk5-side-ico {
  width: 16px;
  height: 16px;
}

.mk5-user-item:hover {
  background: rgba(148, 163, 184, 0.1);
}

.mk5-user-item.is-danger {
  color: #f87171;
}

.mk5-user-item.is-danger:hover {
  background: rgba(248, 113, 113, 0.1);
}

.mk5-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 20px 40px;
  width: 100%;
}

.mk5-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.mk5-title-block h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.03em;
}

.mk5-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 40rem;
  line-height: 1.45;
}

.mk5-header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.mk5-action-bar {
  position: sticky;
  bottom: 0;
  z-index: 25;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0 8px;
  background: linear-gradient(180deg, transparent, #020617 28%);
}

[data-theme="light"] .mk5-action-bar {
  background: linear-gradient(180deg, transparent, #eef2f7 32%);
}

body.mk5-nav-open {
  overflow: hidden;
}

@media (min-width: 960px) {
  .mk5-menu-toggle,
  .mk5-topbar-divider {
    display: none !important;
  }
}

@media (max-width: 959px) {
  .mk5-shell-main {
    margin-left: 0;
  }

  .mk5-menu-toggle {
    display: inline-flex;
  }

  .mk5-sidebar-collapse {
    display: none;
  }

  .mk5-sidebar {
    width: min(272px, 86vw) !important;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  body.mk5-sidebar-open .mk5-sidebar {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.35);
  }

  body.mk5-sidebar-closed .mk5-sidebar,
  body.mk5-sidebar-rail .mk5-sidebar {
    transform: translateX(-100%);
    pointer-events: none;
  }

  body.mk5-sidebar-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    z-index: 55;
  }

  [data-theme="light"] body.mk5-sidebar-open::before {
    background: rgba(15, 23, 42, 0.28);
  }

  .mk5-page {
    padding: 16px 14px 28px;
  }

  .mk5-title-block h1 {
    font-size: 21px;
  }

  .mk5-user-meta,
  .mk5-user-chev {
    display: none;
  }

  .mk5-top-cta span {
    display: none;
  }
}

@media (max-width: 640px) {
  .mk5-usage-chip span:not(.mk5-side-ico) {
    font-size: 12px;
  }

  .mk5-topbar-title {
    font-size: 14px;
  }
}
