:root {
  --bg: #08080b;
  --panel: #0e0e13;
  --panel-2: #121218;
  --line: #23232d;
  --line-soft: #1a1a22;
  --text: #f5f5f7;
  --muted: #92929e;
  --muted-2: #656570;
  --accent: #7c5cff;
  --accent-2: #9c86ff;
  --danger: #ff667a;
  --success: #5ed6a3;
  --shadow: 0 24px 80px rgba(0,0,0,.42);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.auth-page {
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(100px);
  opacity: .13;
  pointer-events: none;
}
.ambient-one { width: 430px; height: 430px; background: var(--accent); left: -150px; top: -100px; }
.ambient-two { width: 380px; height: 380px; background: #4361ee; right: -120px; bottom: -130px; opacity: .09; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1.02fr) minmax(520px, .98fr);
  position: relative;
  z-index: 1;
}

.brand-panel {
  position: relative;
  padding: 52px clamp(42px, 6vw, 100px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line-soft);
  background: radial-gradient(circle at 30% 20%, rgba(124,92,255,.09), transparent 36%), #09090d;
}

.brand-lockup { display: flex; align-items: center; gap: 15px; }
.brand-logo { width: 62px; height: 62px; object-fit: contain; filter: drop-shadow(0 8px 28px rgba(255,255,255,.05)); }
.brand-lockup > div { display: flex; flex-direction: column; gap: 2px; }
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand-by { font-size: 12px; color: var(--muted-2); }

.brand-copy { max-width: 680px; margin: 80px 0; }
.eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  color: var(--accent-2);
  margin-bottom: 20px;
}
.brand-copy h1 {
  margin: 0;
  max-width: 620px;
  font-size: clamp(42px, 5.1vw, 76px);
  line-height: .98;
  letter-spacing: -.055em;
}
.brand-copy p {
  max-width: 520px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}
.brand-footer { color: var(--muted-2); font-size: 12px; }

.auth-panel {
  display: grid;
  place-items: center;
  padding: 48px clamp(28px, 5vw, 80px);
}

.auth-card { width: min(100%, 620px); }
.mobile-brand { display: none; }
.auth-tabs {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: #101016;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 34px;
}
.tab-btn {
  border: 0;
  border-radius: 9px;
  padding: 10px 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.tab-btn.active { background: #1a1a23; color: var(--text); box-shadow: inset 0 0 0 1px rgba(255,255,255,.03); }

.form-heading { margin-bottom: 28px; }
.form-heading h2 { margin: 0; font-size: 34px; letter-spacing: -.035em; }
.form-heading p { margin: 9px 0 0; color: var(--muted); }
.auth-view { display: none; }
.auth-view.active { display: block; animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.alert {
  padding: 13px 15px;
  border-radius: 11px;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.4;
}
.alert.error { border-color: rgba(255,102,122,.28); background: rgba(255,102,122,.07); color: #ff9baa; }
.alert.success { border-color: rgba(94,214,163,.28); background: rgba(94,214,163,.07); color: #8be8bd; }

form { display: grid; gap: 18px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 8px; }
.field > span { font-size: 12px; color: #b6b6c0; font-weight: 700; }
.field input {
  width: 100%;
  height: 50px;
  color: var(--text);
  background: #0d0d12;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  padding: 0 14px;
  transition: .16s ease;
}
.field input::placeholder { color: #555560; }
.field input:focus { border-color: rgba(124,92,255,.72); box-shadow: 0 0 0 4px rgba(124,92,255,.09); background: #101016; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 78px; }
.show-password {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #8e8e99;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  padding: 8px;
}
.show-password:hover { color: var(--text); }

.primary-btn {
  margin-top: 5px;
  height: 52px;
  border: 0;
  border-radius: 11px;
  color: white;
  background: linear-gradient(135deg, var(--accent), #6748f5);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(124,92,255,.18);
  transition: transform .15s ease, filter .15s ease;
}
.primary-btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.primary-btn:active { transform: translateY(0); }
.fine-print { color: var(--muted-2); font-size: 11px; line-height: 1.5; margin: -4px 0 0; text-align: center; }

/* MT CONNECT / CHAT */
.connect-page { overflow: hidden; }
.app-shell { min-height: 100vh; height: 100vh; display: grid; grid-template-columns: 74px 260px minmax(0, 1fr); background: #09090c; }
.rail {
  border-right: 1px solid var(--line-soft);
  background: #08080b;
  padding: 14px 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.rail-logo { width: 50px; height: 50px; border: 1px solid var(--line); border-radius: 15px; display: grid; place-items: center; background: #111116; }
.rail-logo img { width: 40px; height: 40px; object-fit: contain; }
.rail-item {
  width: 46px; height: 46px; border: 1px solid transparent; border-radius: 13px;
  display: grid; place-items: center; text-decoration: none; color: #757581; background: transparent; font-weight: 800; cursor: pointer;
}
.rail-item:hover, .rail-item.active { color: white; background: #15151c; border-color: var(--line); }
.rail-spacer { flex: 1; }
.sidebar { background: #0c0c10; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; min-width: 0; }
.sidebar-head { height: 74px; padding: 0 18px; display: flex; align-items: center; border-bottom: 1px solid var(--line-soft); }
.sidebar-head > div { display: grid; gap: 3px; }
.sidebar-head strong { font-size: 15px; }
.sidebar-head span { color: var(--muted-2); font-size: 11px; }
.section-label { padding: 22px 18px 8px; color: #5f5f6a; font-size: 10px; font-weight: 900; letter-spacing: .13em; }
.channel { margin: 2px 10px; height: 40px; border: 0; border-radius: 9px; color: #92929d; background: transparent; text-align: left; padding: 0 12px; cursor: pointer; font-weight: 650; }
.channel span { color: #5f5f6b; margin-right: 8px; }
.channel:hover, .channel.active { background: #15151b; color: #f1f1f3; }
.user-card { margin-top: auto; border-top: 1px solid var(--line-soft); padding: 12px; display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 11px; background: #1a1a23; border: 1px solid #2c2c37; display: grid; place-items: center; font-weight: 900; }
.user-meta { min-width: 0; display: grid; gap: 2px; }
.user-meta strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.user-meta span { color: var(--success); font-size: 10px; }
.logout-mini { color: #6f6f7a; text-decoration: none; font-size: 10px; font-weight: 800; }
.logout-mini:hover { color: white; }
.chat-main { min-width: 0; display: grid; grid-template-rows: 74px minmax(0,1fr) auto; background: #0a0a0e; }
.chat-head { border-bottom: 1px solid var(--line-soft); padding: 0 22px; display: flex; align-items: center; justify-content: space-between; }
.chat-head > div { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.chat-head strong { font-size: 15px; }
.chat-head span { color: var(--muted-2); font-size: 11px; }
.ghost-btn { height: 36px; padding: 0 13px; border-radius: 9px; color: #777783; border: 1px solid var(--line); background: #111116; }
.messages { overflow: auto; }
.empty-state { display: grid; place-content: center; text-align: center; padding: 30px; }
.empty-mark { width: 86px; height: 86px; margin: 0 auto 20px; border-radius: 24px; display: grid; place-items: center; background: #111116; border: 1px solid #262630; box-shadow: var(--shadow); }
.empty-mark img { width: 72px; height: 72px; object-fit: contain; }
.empty-state h1 { margin: 0; font-size: 29px; letter-spacing: -.035em; }
.empty-state p { margin: 10px auto 0; max-width: 460px; color: var(--muted); line-height: 1.6; font-size: 13px; }
.composer-wrap { padding: 0 22px 20px; }
.composer { height: 52px; border-radius: 12px; border: 1px solid var(--line); background: #111116; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; padding: 0 12px; }
.composer button { border: 0; background: transparent; color: #72727d; font-size: 18px; }
.composer input { border: 0; outline: 0; background: transparent; color: white; min-width: 0; }
.composer input::placeholder { color: #5b5b66; }
.composer span { color: #555560; font-size: 10px; font-weight: 800; }

@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .brand-panel { display: none; }
  .auth-panel { min-height: 100vh; padding: 28px 20px; }
  .mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; font-weight: 800; }
  .mobile-brand img { width: 46px; height: 46px; object-fit: contain; }
  .auth-tabs { width: 100%; }
  .tab-btn { flex: 1; }
  .app-shell { grid-template-columns: 68px 230px minmax(0,1fr); }
}

@media (max-width: 720px) {
  .field-grid { grid-template-columns: 1fr; }
  .form-heading h2 { font-size: 29px; }
  .app-shell { grid-template-columns: 62px minmax(0,1fr); }
  .sidebar { display: none; }
  .chat-head span { display: none; }
  .composer-wrap { padding: 0 12px 12px; }
}
