:root {
  --accent: #6d28ff;
  --accent-dark: #4c16d7;
  --accent-soft: rgba(109, 40, 255, 0.1);
  --ink: #070817;
  --muted: #666d82;
  --line: #e8e9f2;
  --panel: #ffffff;
  --soft: #f7f8fc;
  --green: #0f9f6e;
  --blue: #1887e8;
  --orange: #f48118;
  --red: #ef4444;
  --shadow: 0 24px 70px rgba(25, 23, 49, 0.1);
  --sidebar-bg: rgba(255, 255, 255, 0.82);
  --sidebar-backdrop: blur(22px);
  --sidebar-border: 1px solid rgba(109, 40, 255, 0.12);
  --sidebar-color: #24283d;
  --sidebar-shadow: 16px 0 40px rgba(25, 23, 49, 0.05);
  --sidebar-panel-bg: var(--panel);
  --sidebar-panel-border: 1px solid var(--line);
  --sidebar-panel-shadow: var(--shadow);
  --sidebar-muted-color: var(--muted);
  --sidebar-kicker-color: var(--accent);
  --nav-item-color: #24283d;
  --nav-item-icon-bg: rgba(109, 40, 255, 0.1);
  --nav-item-icon-color: var(--accent);
  --nav-item-active-shadow: 0 14px 28px rgba(109, 40, 255, 0.24);
  --brand-mark-size: 36px;
  --topbar-title-min: 260px;
  --topbar-h1-margin: 0;
  --search-bg: rgba(255, 255, 255, 0.94);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(109, 40, 255, 0.08), rgba(255, 255, 255, 0) 360px),
    var(--soft);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

body.drawer-open {
  overflow: hidden;
}

a,
button,
input {
  font: inherit;
}

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

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  min-height: 100vh;
  max-height: 100vh;
  flex-direction: column;
  border-inline-end: var(--sidebar-border);
  padding: 22px 18px;
  color: var(--sidebar-color);
  background: var(--sidebar-bg);
  backdrop-filter: var(--sidebar-backdrop);
  box-shadow: var(--sidebar-shadow);
}

.sidebar-header,
.brand,
.topbar,
.topbar-title,
.topbar-actions,
.user-menu,
.bottom-nav {
  display: flex;
  align-items: center;
}

.sidebar-header {
  justify-content: space-between;
  gap: 12px;
}

.brand {
  min-width: 0;
  gap: 10px;
  font-weight: 780;
}

.brand-mark,
.avatar,
.nav-item-icon,
.bottom-nav-icon {
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, #0a0b18, var(--accent));
  font-weight: 820;
}

.brand-mark {
  width: var(--brand-mark-size);
  height: var(--brand-mark-size);
  border-radius: 8px;
  font-size: 12px;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.nav-item {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--nav-item-color);
  font-size: 14px;
  font-weight: 720;
}

.nav-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--nav-item-icon-color);
  background: var(--nav-item-icon-bg);
  font-size: 10px;
}

.nav-item.active,
.nav-item:hover {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: var(--nav-item-active-shadow);
}

.nav-item.active span,
.nav-item:hover span {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-panel,
.sidebar-user {
  border: var(--sidebar-panel-border);
  border-radius: 8px;
  background: var(--sidebar-panel-bg);
  box-shadow: var(--sidebar-panel-shadow);
}

.sidebar-panel {
  margin-top: auto;
  padding: 18px;
}

.sidebar-kicker {
  margin: 0;
  color: var(--sidebar-kicker-color);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-panel strong,
.sidebar-panel span,
.sidebar-user strong,
.sidebar-user span {
  display: block;
}

.sidebar-panel strong {
  margin-top: 8px;
}

.sidebar-panel span,
.sidebar-user span {
  color: var(--sidebar-muted-color);
  font-size: 12px;
}

.sidebar-user {
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
}

.avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 999px;
  font-size: 12px;
}

.avatar-small {
  width: 38px;
  height: 38px;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns:
    minmax(220px, 0.8fr)
    minmax(260px, 560px)
    minmax(132px, 180px)
    max-content;
  min-height: 86px;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid rgba(232, 233, 242, 0.78);
  padding: 18px 30px;
  background: rgba(247, 248, 252, 0.86);
  backdrop-filter: blur(20px);
}

.topbar-title {
  min-width: 0;
  gap: 12px;
}

.topbar h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: var(--topbar-h1-margin);
  font-size: 28px;
  line-height: 1.1;
}

.title-badge {
  display: inline-grid;
  min-width: 52px;
  height: 26px;
  place-items: center;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(109, 40, 255, 0.11);
  font-size: 13px;
  font-weight: 820;
}

.topbar-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(24, 29, 54, 0.07);
}

.drawer-open,
.sidebar-close {
  display: none;
}

.drawer-open-glyph {
  font-size: 20px;
  line-height: 1;
}

.search {
  position: relative;
  width: 100%;
  max-width: 560px;
}

.search span {
  position: absolute;
  top: 50%;
  inset-inline-start: 16px;
  color: var(--muted);
  transform: translateY(-50%);
}

.search input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding-block: 0;
  padding-inline: 42px 18px;
  color: var(--ink);
  background: var(--search-bg);
  box-shadow: 0 14px 34px rgba(24, 29, 54, 0.06);
}

.search input:focus {
  border-color: rgba(109, 40, 255, 0.45);
  outline: 3px solid rgba(109, 40, 255, 0.1);
}

.topbar-actions {
  gap: 12px;
}

.topbar-language {
  width: 100%;
  min-width: 132px;
  max-width: 180px;
}

.notification-button {
  position: relative;
}

.notification-dot {
  position: absolute;
  top: -6px;
  inset-inline-end: -6px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 11px;
  font-weight: 760;
}

.user-menu {
  min-height: 46px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px 6px 6px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(24, 29, 54, 0.07);
}

.user-meta {
  display: grid;
  text-align: start;
}

.user-meta small {
  color: var(--muted);
}

.drawer-backdrop,
.bottom-nav,
.mobile-more-backdrop,
.mobile-more-menu {
  display: none;
}

@media (max-width: 1350px) {
  .user-meta {
    display: none;
  }

  .user-menu {
    padding: 3px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    width: min(84vw, 340px);
    transform: translateX(-110%);
    transition: transform 180ms ease;
  }

  body.drawer-open .sidebar {
    transform: translateX(0);
  }

  [dir="rtl"] .sidebar {
    transform: translateX(110%);
  }

  [dir="rtl"] body.drawer-open .sidebar {
    transform: translateX(0);
  }

  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: block;
    background: rgba(7, 8, 23, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.drawer-open .drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .drawer-open,
  .sidebar-close {
    display: inline-grid;
  }

  .topbar {
    grid-template-areas:
      "title actions"
      "search language";
    grid-template-columns: minmax(0, 1fr) minmax(132px, auto);
    align-items: center;
    gap: 10px 12px;
    padding: 14px 18px;
  }

  .topbar-title {
    grid-area: title;
    min-width: 0;
  }

  .topbar-title > div {
    min-width: 0;
  }

  .topbar-title h1,
  .topbar-title p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    grid-area: actions;
    justify-self: end;
  }

  .topbar-language {
    grid-area: language;
    width: 100%;
    min-width: 132px;
    max-width: 180px;
    justify-self: end;
  }

  .search {
    grid-area: search;
    min-width: 0;
    max-width: none;
  }

  .user-meta {
    display: none;
  }

  .bottom-nav {
    position: fixed;
    inset-inline: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border: 1px solid rgba(109, 40, 255, 0.14);
    border-radius: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 22px 60px rgba(25, 23, 49, 0.16);
    backdrop-filter: blur(18px);
  }

  .bottom-nav a,
  .bottom-nav button {
    display: grid;
    justify-items: center;
    gap: 4px;
    min-width: 0;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    padding: 6px 4px;
    color: var(--muted);
    background: transparent;
    font-size: 11px;
    font-weight: 760;
    cursor: pointer;
  }

  .bottom-nav a.active,
  .bottom-nav button.active {
    color: var(--accent);
    background: var(--accent-soft);
  }

  .bottom-nav-icon {
    font-size: 10px;
  }

  body.mobile-more-open {
    overflow: hidden;
  }

  .mobile-more-backdrop {
    position: fixed;
    inset: 0;
    z-index: 42;
    display: block;
    background: rgba(7, 8, 23, 0.42);
    backdrop-filter: blur(4px);
  }

  .mobile-more-menu {
    position: fixed;
    inset-inline: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 43;
    display: grid;
    max-height: min(72vh, 620px);
    overflow: hidden;
    border: 1px solid rgba(109, 40, 255, 0.16);
    border-radius: 8px;
    color: var(--ink);
    background: #ffffff;
    box-shadow: 0 28px 80px rgba(7, 8, 23, 0.24);
  }

  .mobile-more-menu[hidden],
  .mobile-more-backdrop[hidden] {
    display: none;
  }

  .mobile-more-menu header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    padding: 18px;
  }

  .mobile-more-menu header p,
  .mobile-more-menu header h2 {
    margin: 0;
  }

  .mobile-more-menu header p {
    color: var(--muted);
    font-size: 11px;
    font-weight: 780;
    text-transform: uppercase;
  }

  .mobile-more-menu header h2 {
    margin-top: 4px;
    font-size: 22px;
  }

  .mobile-more-close {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: #ffffff;
    font-size: 24px;
  }

  .mobile-more-menu nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow-y: auto;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  }

  .mobile-more-item {
    display: flex;
    min-width: 0;
    min-height: 52px;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    padding: 10px;
    color: var(--ink);
    background: var(--soft);
    font-size: 13px;
    font-weight: 760;
  }

  .mobile-more-item .bottom-nav-icon {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    border-radius: 8px;
    color: #ffffff;
    background: linear-gradient(135deg, #0a0b18, var(--accent));
    font-size: 9px;
  }

  .mobile-more-item.active {
    color: var(--accent);
    background: var(--accent-soft);
  }
}

@media (max-width: 560px) {
  .topbar-title h1 {
    font-size: 20px;
    line-height: 1;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .title-badge {
    min-width: 46px;
    height: 24px;
    font-size: 12px;
  }

  .topbar-title p {
    display: none;
  }

  .topbar-actions {
    gap: 8px;
  }

  .topbar .icon-button,
  .topbar .user-menu {
    min-width: 44px;
    min-height: 44px;
  }

  .topbar .user-menu {
    padding: 3px;
  }

  .topbar .avatar-small {
    width: 36px;
    height: 36px;
  }
}
