:root {
  --bg: #070910;
  --panel: #0c1019;
  --panel-2: #111622;
  --panel-3: #171d2b;
  --border: rgba(255,255,255,.07);
  --border-strong: rgba(255,255,255,.12);
  --text: #f5f7fb;
  --muted: #808a9d;
  --muted-2: #596274;
  --accent: #6678ff;
  --accent-2: #8d55ff;
  --green: #43dd9b;
  --yellow: #f5bd4f;
  --red: #ff6678;
  --rail: #05070d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.mobile-only {
  display: none;
}

/* AUTH */

.auth-screen {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  background:
    radial-gradient(
      circle at 18% 16%,
      rgba(87,100,255,.19),
      transparent 32%
    ),
    radial-gradient(
      circle at 76% 80%,
      rgba(139,72,255,.16),
      transparent 31%
    ),
    #070910;
  overflow: hidden;
}

.auth-glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(70px);
  pointer-events: none;
}

.glow-one {
  width: 380px;
  height: 380px;
  left: -100px;
  top: -120px;
  background: rgba(79,99,255,.25);
}

.glow-two {
  width: 420px;
  height: 420px;
  right: -160px;
  bottom: -160px;
  background: rgba(136,67,255,.22);
}

.auth-panel {
  position: relative;
  z-index: 1;
  padding: 60px 70px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
  background:
    linear-gradient(
      135deg,
      var(--accent),
      var(--accent-2)
    );
  box-shadow:
    0 12px 36px rgba(100,91,255,.34);
}

.brand-name {
  font-weight: 900;
  letter-spacing: .12em;
  font-size: 14px;
}

.brand-sub {
  color: var(--muted);
  letter-spacing: .18em;
  font-size: 9px;
  margin-top: 4px;
}

.auth-copy {
  max-width: 650px;
  margin-bottom: 8vh;
}

.auth-copy h1 {
  font-size: clamp(50px,7vw,96px);
  letter-spacing: -.06em;
  line-height: .91;
  margin: 0 0 28px;
}

.auth-copy p {
  max-width: 520px;
  color: #a5adbd;
  line-height: 1.7;
  font-size: 18px;
}

.auth-card {
  align-self: center;
  justify-self: center;
  position: relative;
  z-index: 2;
  width: min(430px, calc(100% - 40px));
  padding: 34px;
  border-radius: 25px;
  background: rgba(15,19,30,.88);
  border: 1px solid var(--border-strong);
  box-shadow:
    0 40px 100px rgba(0,0,0,.48);
  backdrop-filter: blur(22px);
}

.auth-tabs {
  display: flex;
  padding: 4px;
  background: rgba(255,255,255,.035);
  border-radius: 13px;
  margin-bottom: 30px;
}

.auth-tab {
  flex: 1;
  border: 0;
  color: var(--muted);
  background: transparent;
  padding: 11px;
  border-radius: 10px;
}

.auth-tab.active {
  color: #fff;
  background: rgba(255,255,255,.07);
}

.auth-card h2 {
  margin: 0 0 7px;
  font-size: 26px;
}

.auth-card p {
  margin: 0 0 26px;
}

.auth-card label {
  display: block;
  color: #aeb6c6;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .03em;
  margin: 18px 0;
}

.auth-card input {
  width: 100%;
  margin-top: 8px;
  padding: 14px 15px;
  color: #fff;
  outline: 0;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: #090c13;
}

.auth-card input:focus {
  border-color: rgba(102,120,255,.65);
  box-shadow:
    0 0 0 3px rgba(102,120,255,.08);
}

.primary {
  width: 100%;
  border: 0;
  border-radius: 12px;
  color: white;
  padding: 14px;
  font-weight: 800;
  margin-top: 8px;
  background:
    linear-gradient(
      135deg,
      var(--accent),
      var(--accent-2)
    );
}

.error-box {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  color: #ffb0ba;
  background: rgba(255,76,98,.1);
  border: 1px solid rgba(255,76,98,.2);
  font-size: 13px;
}

/* APP */

.app {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns:
    72px
    265px
    minmax(0,1fr)
    245px;
}

.server-rail {
  background: var(--rail);
  border-right: 1px solid var(--border);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.server-logo,
.rail-server {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: 0;
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.server-logo {
  background:
    linear-gradient(
      135deg,
      var(--accent),
      var(--accent-2)
    );
}

.rail-divider {
  width: 30px;
  height: 1px;
  background: var(--border-strong);
  margin: 11px 0;
}

.rail-server {
  margin: 4px 0;
  background: #131824;
}

.rail-server.active {
  background: #192034;
  border: 1px solid rgba(112,128,255,.25);
}

.rail-server.disabled {
  color: var(--muted-2);
}

.sidebar {
  position: relative;
  background: #0b0e16;
  border-right: 1px solid var(--border);
  min-width: 0;
}

.workspace-header {
  height: 72px;
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workspace-name {
  font-weight: 900;
  font-size: 13px;
  letter-spacing: .08em;
}

.workspace-sub {
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: .12em;
  margin-top: 4px;
}

.channel-list {
  height: calc(100% - 138px);
  overflow-y: auto;
  padding: 17px 10px;
}

.channel-category {
  color: #697286;
  font-size: 10px;
  letter-spacing: .14em;
  font-weight: 850;
  padding: 15px 9px 8px;
}

.channel-button {
  width: 100%;
  border: 0;
  padding: 9px 10px;
  margin: 1px 0;
  border-radius: 8px;
  color: #8e98aa;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
}

.channel-button:hover {
  color: #d9deea;
  background: rgba(255,255,255,.035);
}

.channel-button.active {
  color: #fff;
  background: rgba(103,119,255,.11);
}

.channel-prefix {
  color: #626c81;
  font-size: 17px;
}

.user-panel {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 66px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  background: #090c13;
}

.avatar {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  background:
    linear-gradient(
      135deg,
      #3b465d,
      #232b3d
    );
}

.user-panel-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#presenceSelect {
  margin-top: 2px;
  width: 100%;
  color: #778196;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 10px;
}

.icon-button {
  border: 0;
  color: #8993a7;
  background: transparent;
  font-size: 18px;
}

.chat {
  min-width: 0;
  display: grid;
  grid-template-rows:
    72px
    minmax(0,1fr)
    auto
    auto;
  background:
    radial-gradient(
      circle at 70% -20%,
      rgba(76,90,185,.08),
      transparent 35%
    ),
    #0d111a;
}

.chat-header {
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 11px;
}

.channel-symbol {
  color: #69758b;
  font-size: 22px;
}

.channel-title {
  font-size: 15px;
  font-weight: 850;
}

.channel-description {
  color: var(--muted-2);
  font-size: 10px;
  margin-top: 3px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.online-counter {
  color: #788295;
  font-size: 11px;
}

.owner-button {
  border: 1px solid rgba(122,103,255,.26);
  color: #c8c1ff;
  background: rgba(111,91,255,.09);
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .06em;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 22px 26px;
}

.message {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 8px 10px;
  margin: 2px -10px;
  border-radius: 10px;
}

.message:hover {
  background: rgba(255,255,255,.018);
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: #1a2232;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
}

.message-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.message-author {
  font-size: 13px;
  font-weight: 850;
}

.message-role {
  color: #8c96aa;
  font-size: 9px;
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
}

.message-time {
  color: #555f71;
  font-size: 9px;
}

.message-body {
  color: #ced4df;
  font-size: 14px;
  line-height: 1.52;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-top: 3px;
}

.message-delete {
  position: absolute;
  right: 8px;
  top: 8px;
  opacity: 0;
  border: 1px solid var(--border);
  color: #9e7180;
  background: #111620;
  border-radius: 7px;
  padding: 4px 7px;
  font-size: 10px;
}

.message:hover .message-delete {
  opacity: 1;
}

.empty-channel {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: end;
  padding-bottom: 30px;
}

.empty-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 28px;
  background: #171d29;
  margin-bottom: 15px;
}

.empty-channel h2 {
  margin: 0 0 7px;
}

.empty-channel p {
  color: var(--muted);
  margin: 0;
}

.typing {
  min-height: 22px;
  padding: 2px 28px;
  color: #757f92;
  font-size: 10px;
}

.composer-wrap {
  padding: 0 22px 22px;
}

.composer {
  min-height: 50px;
  display: flex;
  align-items: end;
  gap: 8px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #151a25;
}

.composer textarea {
  flex: 1;
  min-height: 32px;
  max-height: 160px;
  resize: none;
  outline: 0;
  border: 0;
  color: #e6e9f0;
  background: transparent;
  padding: 7px 4px;
  line-height: 1.4;
}

.attach-button,
.send-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
}

.attach-button {
  color: #7d8799;
  background: #1c2230;
  font-size: 20px;
}

.send-button {
  color: white;
  background:
    linear-gradient(
      135deg,
      var(--accent),
      var(--accent-2)
    );
}

.members {
  background: #0a0d14;
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

.members-header {
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 17px;
  color: #727c90;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .13em;
  border-bottom: 1px solid var(--border);
}

.member-role {
  padding: 18px 14px 8px;
  color: #626d81;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .1em;
}

.member {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 13px;
}

.member-avatar-wrap {
  position: relative;
}

.member-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 10px;
  font-weight: 850;
  background: #18202e;
}

.presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border: 2px solid #0a0d14;
  border-radius: 999px;
  background: #50596a;
}

.presence-dot.online {
  background: var(--green);
}

.presence-dot.idle {
  background: var(--yellow);
}

.presence-dot.dnd {
  background: var(--red);
}

.member-name {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-status {
  color: #586276;
  font-size: 9px;
  margin-top: 2px;
}

.voice-placeholder {
  grid-row: 2 / 5;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 30px;
}

.voice-orb {
  width: 88px;
  height: 88px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  font-size: 37px;
  background:
    linear-gradient(
      135deg,
      rgba(97,116,255,.2),
      rgba(147,77,255,.18)
    );
  border: 1px solid rgba(118,105,255,.2);
}

.voice-placeholder h2 {
  margin: 22px 0 8px;
}

.voice-placeholder p {
  max-width: 440px;
  color: var(--muted);
  line-height: 1.6;
}

/* OWNER */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(8px);
}

.owner-console {
  position: relative;
  z-index: 2;
  width: min(1000px, calc(100% - 36px));
  height: min(760px, calc(100% - 36px));
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--border-strong);
  background: #0d111a;
  box-shadow:
    0 50px 120px rgba(0,0,0,.58);
}

.owner-console-header {
  height: 82px;
  padding: 0 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.owner-eyebrow {
  color: #756ff0;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .17em;
}

.owner-console h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.owner-tabs {
  display: flex;
  gap: 5px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.owner-tab {
  border: 0;
  color: var(--muted);
  background: transparent;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 11px;
}

.owner-tab.active {
  color: #fff;
  background: rgba(110,103,255,.12);
}

#ownerContent {
  height: calc(100% - 135px);
  overflow-y: auto;
  padding: 22px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 12px;
}

.stat-card {
  padding: 20px;
  border-radius: 15px;
  background: #121824;
  border: 1px solid var(--border);
}

.stat-value {
  font-size: 30px;
  font-weight: 900;
}

.stat-label {
  color: var(--muted);
  margin-top: 5px;
  font-size: 11px;
}

.owner-section {
  margin-top: 18px;
  padding: 18px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: #10151f;
}

.owner-section h3 {
  margin: 0 0 15px;
  font-size: 14px;
}

.owner-form {
  display: grid;
  grid-template-columns: 1fr 150px auto;
  gap: 9px;
}

.owner-form input,
.owner-form select,
.user-row select {
  color: #e8ebf2;
  background: #090c13;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px;
  outline: 0;
}

.owner-form button,
.small-button {
  border: 0;
  border-radius: 9px;
  padding: 10px 13px;
  color: white;
  background: #5d6cf0;
}

.invite-row,
.user-row,
.audit-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}

.invite-row {
  grid-template-columns:
    1fr
    160px
    120px;
}

.invite-code {
  font-family: ui-monospace, monospace;
  color: #b9c1ff;
}

.user-row {
  grid-template-columns:
    1fr
    220px
    90px;
}

.audit-row {
  grid-template-columns:
    150px
    150px
    1fr;
  color: #929bad;
}

.audit-action {
  color: #d6dbea;
  font-weight: 750;
}

.danger-button {
  border: 1px solid rgba(255,82,107,.25);
  color: #ff8d9c;
  background: rgba(255,82,107,.08);
  border-radius: 8px;
  padding: 8px 9px;
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns:
      64px
      240px
      minmax(0,1fr);
  }

  .members {
    display: none;
  }
}

@media (max-width: 760px) {
  .mobile-only {
    display: inline-flex;
  }

  .auth-screen {
    display: block;
    overflow-y: auto;
    padding: 20px 0 40px;
  }

  .auth-panel {
    padding: 28px 24px;
  }

  .auth-copy {
    display: none;
  }

  .auth-card {
    margin: 25px auto;
  }

  .app {
    display: grid;
    grid-template-columns: 1fr;
  }

  .server-rail {
    display: none;
  }

  .sidebar {
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(290px, 88vw);
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow:
      20px 0 70px rgba(0,0,0,.45);
  }

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

  .chat-header {
    padding: 0 12px;
  }

  .online-counter {
    display: none;
  }

  .owner-button {
    font-size: 8px;
  }

  .messages {
    padding: 18px 15px;
  }

  .composer-wrap {
    padding: 0 11px 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .owner-form {
    grid-template-columns: 1fr;
  }

  .invite-row,
  .user-row,
  .audit-row {
    grid-template-columns: 1fr;
  }
}

/* ==================================================
   BRILL CONNECT v0.3
   ================================================== */

.unread-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #697aff;
  color: white;
  font-size: 9px;
  font-weight: 900;
}

.reply-preview {
  margin: 1px 0 6px;
  padding-left: 9px;
  border-left:
    2px solid
    rgba(115,130,255,.45);
  color: #77839a;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.message-attachments img {
  display: block;
  max-width: min(
    420px,
    100%
  );
  max-height: 330px;
  border-radius: 12px;
  object-fit: contain;
  background: #080b11;
  border:
    1px solid
    rgba(255,255,255,.06);
}

.file-card {
  display: inline-flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  color: #bec7ff;
  text-decoration: none;
  background: #121a29;
  border:
    1px solid
    rgba(255,255,255,.07);
  font-size: 11px;
}

.reaction-row {
  min-height: 24px;
  margin-top: 7px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.reaction-chip,
.reaction-add {
  border-radius: 7px;
  border:
    1px solid
    rgba(255,255,255,.07);
  color: #9ba6ba;
  background: #111722;
  padding: 3px 7px;
  font-size: 10px;
}

.reaction-chip.mine {
  border-color:
    rgba(101,119,255,.45);
  color: #c7ceff;
  background:
    rgba(101,119,255,.12);
}

.message-v03-actions {
  display: none;
  gap: 5px;
  margin-top: 6px;
}

.message:hover
.message-v03-actions {
  display: flex;
}

.message-v03-actions button {
  border: 0;
  padding: 3px 6px;
  border-radius: 6px;
  color: #717d91;
  background: transparent;
  font-size: 9px;
}

.message-v03-actions button:hover {
  color: #cdd3df;
  background:
    rgba(255,255,255,.04);
}

.composer-extras {
  margin-bottom: 7px;
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-radius: 11px;
  background: #101620;
  border:
    1px solid
    rgba(255,255,255,.05);
}

.composer-reply,
.pending-file {
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 8px;
  color: #9ea8bb;
  background: #171e2b;
  font-size: 10px;
}

.composer-reply span,
.pending-file span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.composer-reply button,
.pending-file button {
  border: 0;
  background: transparent;
  color: #697589;
}

.notification-button {
  border:
    1px solid
    rgba(255,255,255,.07);
  border-radius: 8px;
  padding: 7px 9px;
  color: #8c96a9;
  background:
    rgba(255,255,255,.025);
  font-size: 10px;
}

.notification-enabled {
  color: #75e2ad;
  border-color:
    rgba(67,220,155,.2);
  background:
    rgba(67,220,155,.07);
}

@media (max-width: 760px) {
  .message-attachments img {
    max-width: 100%;
  }

  .message-v03-actions {
    display: flex;
  }
}
