:root {
  --bg: #07050d;
  --panel: rgba(29, 24, 42, .7);
  --line: rgba(255, 255, 255, .11);
  --line-strong: rgba(255, 255, 255, .2);
  --text: #fff;
  --muted: #bdb3cc;
  --soft: #eee7ff;
  --purple: #c7a1ff;
  --purple-2: #8e58e8;
  --danger: #ff91ab;
  --shadow: 0 22px 65px rgba(0, 0, 0, .42);
  --radius: 24px;
  --sidebar: 236px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: radial-gradient(circle at 70% 8%, rgba(122, 70, 215, .36), transparent 36%), linear-gradient(125deg, #05030a, #100b18 48%, #08050f);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}
button, input, textarea { font: inherit; }
button { border: 0; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
label { display: block; color: var(--muted); font-size: 13px; font-weight: 800; }
label input, label textarea, label button { margin-top: 7px; }

.bg-orb {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(70px);
  opacity: .45;
}
.orb-one { top: -180px; right: 8%; width: 520px; height: 520px; background: #6b32c9; }
.orb-two { bottom: -130px; left: 15%; width: 380px; height: 380px; background: #2e214c; }
.glass {
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .035));
  box-shadow: var(--shadow);
  backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
}
#app { height: 100%; }

.logo-mark {
  display: grid;
  overflow: hidden;
  width: 54px;
  height: 54px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 18px;
  color: #150e20;
  background: var(--soft);
  font-weight: 950;
}
.logo-mark img { width: 100%; height: 100%; object-fit: cover; }
.auth-shell {
  display: flex;
  max-width: 540px;
  height: 100%;
  margin: auto;
  padding: 28px;
  align-items: center;
  justify-content: center;
}
.auth-brand {
  display: flex;
  padding: 4px 0 24px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.auth-brand .logo-mark {
  width: 184px;
  height: 184px;
  margin-bottom: 20px;
  border-radius: 42px;
}
.auth-brand h1 { margin: 0 0 6px; font-size: 44px; letter-spacing: -.05em; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 16px; }
.auth-card { width: 100%; padding: 26px; border-radius: 32px; }
.auth-tabs {
  display: grid;
  margin-bottom: 18px;
  padding: 5px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .055);
  grid-template-columns: 1fr 1fr;
}
.auth-tab {
  padding: 10px;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
}
.auth-tab.active { color: #130d1b; background: var(--soft); }
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-form h2 { margin: 4px 0 16px; font-size: 28px; }
.auth-form label { margin: 12px 0 7px; }
.auth-form input, .field {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  color: var(--text);
  background: rgba(255, 255, 255, .065);
}
.auth-form input:focus, .field:focus, .textarea:focus { border-color: rgba(199, 161, 255, .7); }
.error-text { min-height: 18px; color: var(--danger); font-size: 13px; font-weight: 750; }
.auth-help { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.primary-btn, .ghost-btn, .icon-btn {
  border-radius: 16px;
  font-weight: 900;
}
.primary-btn { padding: 13px 18px; color: #130d1b; background: var(--soft); }
.primary-btn:hover { filter: brightness(.97); }
.ghost-btn {
  padding: 11px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .07);
}
.ghost-btn:hover, .icon-btn:hover, .pill:hover { background: rgba(255, 255, 255, .13); }
.icon-btn {
  display: grid;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  place-items: center;
  background: rgba(255, 255, 255, .08);
  font-size: 20px;
}
.text-btn { padding: 0; color: var(--purple); background: transparent; font-size: 13px; font-weight: 900; }
.danger { color: var(--danger); }
.muted { color: var(--muted); }
.helper { font-size: 12px; line-height: 1.5; }
.top-gap { margin-top: 14px; }

.shell {
  display: grid;
  max-width: 1420px;
  height: 100%;
  margin: auto;
  padding: 22px;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 16px;
}
.sidebar {
  display: flex;
  min-height: 0;
  padding: 16px;
  border-radius: 26px;
  flex-direction: column;
}
.brand { display: flex; margin-bottom: 22px; gap: 12px; align-items: center; }
.brand .logo-mark { width: 38px; height: 38px; margin: 0; border-radius: 14px; }
.brand h2 { margin: 0; font-size: 17px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.nav { display: grid; gap: 6px; }
.nav button {
  display: flex;
  padding: 12px;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-weight: 850;
}
.nav button.active, .nav button:hover { color: #fff; background: rgba(199, 161, 255, .17); }
.nav b, .chat-item b {
  display: grid;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  place-items: center;
  border-radius: 99px;
  color: #150d1f;
  background: var(--purple);
  font-size: 11px;
}
.side-user {
  display: flex;
  min-width: 0;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: inherit;
  background: rgba(255, 255, 255, .06);
  gap: 10px;
  align-items: center;
  text-align: left;
}
.logout { width: 100%; margin-top: 10px; }

.avatar {
  display: grid;
  overflow: hidden;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #150d1f;
  background: var(--avatar, var(--purple));
  font-size: 13px;
  font-weight: 950;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xl { width: 90px; height: 90px; font-size: 24px; }
.user-meta { display: block; min-width: 0; flex: 1; }
.user-meta strong, .user-meta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--muted); font-size: 12px; }

.content {
  display: grid;
  min-width: 0;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}
.topbar {
  display: flex;
  min-height: 92px;
  padding: 18px 22px;
  border-radius: 28px;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.eyebrow {
  margin-bottom: 3px;
  color: var(--purple);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.topbar h1 { margin: 0; font-size: 32px; letter-spacing: -.04em; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.search-box {
  display: none;
  width: 260px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  color: #fff;
  background: rgba(255, 255, 255, .08);
}
.search-box.show { display: block; }
.view { min-height: 0; overflow: auto; padding: 0 2px 8px; }
.view::-webkit-scrollbar, .chat-body::-webkit-scrollbar { width: 10px; }
.view::-webkit-scrollbar-thumb, .chat-body::-webkit-scrollbar-thumb { border-radius: 99px; background: rgba(255, 255, 255, .12); }

.grid-stats {
  display: grid;
  margin-bottom: 14px;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.stat { padding: 18px; border-radius: 24px; }
.stat strong { display: block; font-size: 34px; }
.stat span { color: var(--muted); font-weight: 800; }
.card { margin-bottom: 14px; padding: 16px; border-radius: 24px; }
.section-title { margin: 0 0 12px; font-size: 19px; }
.section-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.section-head .section-title { margin-bottom: 0; }
.two-column, .admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.admin-grid section:last-child:nth-child(odd) { grid-column: 1 / -1; }

.story-card { padding-bottom: 12px; }
.story-row { display: flex; overflow-x: auto; padding: 14px 1px 2px; gap: 14px; }
.story {
  display: grid;
  min-width: 64px;
  padding: 0;
  justify-items: center;
  color: var(--muted);
  background: transparent;
  gap: 6px;
}
.story small { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.story-ring {
  padding: 3px;
  border: 2px solid rgba(255, 255, 255, .15);
  border-radius: 50%;
}
.story.unread .story-ring { border-color: var(--purple); }
.story .avatar { width: 52px; height: 52px; }
.story-plus {
  display: grid;
  width: 60px;
  height: 60px;
  border: 1px dashed var(--line-strong);
  place-items: center;
  border-radius: 50%;
  color: var(--purple);
  background: rgba(255, 255, 255, .055);
  font-size: 28px;
}
.feed-tools { display: flex; max-width: 760px; margin: 0 auto 14px; gap: 10px; justify-content: space-between; }
.segmented {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .05);
}
.segmented button {
  padding: 8px 11px;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 850;
}
.segmented button.active { color: #160f20; background: var(--soft); }

.post { max-width: 760px; margin: 0 auto 14px; }
.post-head { display: flex; margin-bottom: 12px; gap: 12px; align-items: center; justify-content: space-between; }
.post-user, .person-main {
  display: flex;
  min-width: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  gap: 10px;
  align-items: center;
  text-align: left;
}
.post-user strong, .post-user small, .person-main strong, .person-main small { display: block; }
.post-user small, .person-main small { color: var(--muted); }
.post-text { margin: 8px 0 12px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; }
.post-img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 560px;
  margin: 10px auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  object-fit: contain;
  background: rgba(255, 255, 255, .04);
}
.post-actions, .form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #fff;
  background: rgba(255, 255, 255, .065);
  font-weight: 850;
}
.comments { display: grid; margin-top: 12px; gap: 8px; }
.comment { padding: 10px 12px; border-radius: 14px; color: #ede8f8; background: rgba(255, 255, 255, .055); }
.comment-form { display: flex; margin-top: 10px; gap: 8px; }
.comment-form input { flex: 1; }

.composer { max-width: 760px; margin: 0 auto; }
.textarea {
  width: 100%;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: none;
  resize: vertical;
  color: #fff;
  background: rgba(255, 255, 255, .065);
}
.upload-zone {
  margin-top: 12px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 22px;
  text-align: center;
  background: rgba(255, 255, 255, .045);
}
.upload-zone p { margin: 0 0 9px; }
.file-input { display: none; }
.preview { display: none; max-width: 100%; max-height: 420px; margin: 12px auto 0; border-radius: 18px; }
.preview.show { display: block; }

.mini-list { display: grid; gap: 10px; }
.person-row {
  display: flex;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .045);
}
.badge {
  padding: 5px 8px;
  border-radius: 99px;
  color: #140d1c;
  background: var(--purple);
  font-size: 12px;
  font-weight: 950;
}

.messages-layout {
  display: grid;
  height: 100%;
  min-height: 0;
  grid-template-columns: minmax(230px, 310px) minmax(0, 1fr);
  gap: 12px;
}
.chat-list, .chat-panel { min-height: 0; overflow: hidden; border-radius: 24px; }
.chat-list { padding: 14px; }
.chat-items { display: grid; max-height: calc(100vh - 230px); overflow: auto; padding-right: 2px; gap: 8px; }
.chat-item {
  display: flex;
  width: 100%;
  padding: 10px;
  border-radius: 16px;
  gap: 10px;
  align-items: center;
  text-align: left;
  background: rgba(255, 255, 255, .055);
}
.chat-item.active { background: rgba(199, 161, 255, .18); }
.chat-panel { display: grid; padding: 14px; grid-template-rows: auto minmax(0, 1fr) auto; }
.chat-head { padding: 0 4px 12px; border-bottom: 1px solid var(--line); }
.chat-body { display: flex; overflow: auto; padding: 14px 4px; flex-direction: column; gap: 10px; }
.bubble {
  display: grid;
  max-width: 68%;
  padding: 10px 12px 7px;
  align-self: flex-start;
  border-radius: 17px;
  background: rgba(255, 255, 255, .09);
  line-height: 1.35;
  gap: 4px;
}
.bubble.me { align-self: flex-end; color: #130d1b; background: var(--purple); font-weight: 750; }
.bubble small { justify-self: end; opacity: .65; font-size: 10px; }
.chat-empty { margin: auto; }
.chat-form { display: flex; padding-top: 10px; gap: 8px; }
.chat-form input { flex: 1; }

.notification-head { margin-bottom: 12px; }
.notification { display: flex; margin-bottom: 0; gap: 12px; align-items: flex-start; }
.notification p { margin: 0 0 6px; }
.notification-dot { width: 10px; height: 10px; margin-top: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--purple); }

.profile-wrap { max-width: 840px; margin: auto; }
.profile-hero { padding: 20px; }
.profile-main { display: flex; gap: 16px; align-items: center; }
.profile-main h2 { margin: 0 0 4px; }
.profile-main p { margin: 6px 0; }
.profile-stats { display: flex; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); gap: 20px; font-size: 13px; }
.profile-stats strong { color: #fff; font-size: 18px; }
.profile-editor { display: grid; gap: 12px; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.color-input { display: block; width: 54px; height: 42px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .07); }

.code-list { margin-top: 14px; }
.code-box {
  display: flex;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .055);
}
.code { font-size: 20px; font-weight: 950; letter-spacing: .12em; }

.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(3, 2, 7, .82);
  backdrop-filter: blur(16px);
}
.story-viewer {
  display: grid;
  width: min(440px, 100%);
  min-height: 570px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background: radial-gradient(circle at top, rgba(255, 255, 255, .16), transparent 45%), var(--story-color, #452875);
  box-shadow: var(--shadow);
  grid-template-rows: auto 1fr auto;
}
.story-header, .story-footer { display: flex; padding: 14px; gap: 10px; align-items: center; justify-content: space-between; }
.story-content { display: grid; padding: 14px; place-items: center; align-content: center; gap: 14px; }
.story-content img { max-width: 100%; max-height: 410px; border-radius: 18px; object-fit: contain; }
.story-content p { margin: 0; text-align: center; font-size: 26px; font-weight: 900; line-height: 1.2; }

@media (max-width: 900px) {
  body { overflow: auto; }
  .shell { height: auto; min-height: 100%; padding: 12px; grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 20;
    right: 10px;
    bottom: 10px;
    left: 10px;
    min-height: auto;
    padding: 8px;
    border-radius: 22px;
  }
  .brand, .side-user, .logout { display: none; }
  .nav { grid-template-columns: repeat(7, 1fr); gap: 2px; }
  .nav button { display: grid; padding: 10px 3px; place-items: center; text-align: center; font-size: 11px; }
  .nav b { display: none; }
  .content { padding-bottom: 72px; }
  .topbar { min-height: 78px; padding: 15px; }
  .topbar h1 { font-size: 24px; }
  .search-box { width: 150px; }
  .grid-stats { grid-template-columns: 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .messages-layout { height: auto; grid-template-columns: 1fr; }
  .chat-items { max-height: none; }
  .chat-panel { min-height: 460px; }
  .auth-shell { min-height: 100%; padding: 14px; }
  .two-column, .admin-grid, .editor-grid { grid-template-columns: 1fr; }
  .admin-grid section:last-child:nth-child(odd) { grid-column: auto; }
}

@media (max-width: 560px) {
  .top-actions .primary-btn { display: none; }
  .search-box { width: 130px; }
  .comment-form { display: grid; }
  .person-row { align-items: flex-start; flex-direction: column; }
  .profile-main { align-items: flex-start; flex-direction: column; }
  .story-viewer { min-height: 520px; }
}
