:root {
  color-scheme: dark;
  --ink: #07100d;
  --ink-2: #0b1612;
  --panel: #101d18;
  --panel-2: #14231d;
  --paper: #f3f1e9;
  --paper-2: #e9e7df;
  --white: #fffef8;
  --green: #7df3ac;
  --green-2: #31d978;
  --gold: #d8c69d;
  --text: #e9efe9;
  --muted: #8b9b93;
  --dark-text: #17201c;
  --line: rgba(255, 255, 255, .085);
  --dark-line: rgba(12, 28, 21, .12);
  --danger: #ff7e78;
  --shadow: 0 38px 120px rgba(0, 0, 0, .42);
  --radius: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  background: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
.hidden { display: none !important; }
.ambient { position: fixed; border-radius: 50%; filter: blur(120px); pointer-events: none; opacity: .22; }
.ambient-one { width: 500px; height: 500px; left: -160px; top: -170px; background: #2ee780; }
.ambient-two { width: 440px; height: 440px; right: -160px; bottom: -180px; background: #a4813c; opacity: .16; }

.app-shell { min-height: 100vh; display: grid; place-items: center; padding: 26px; position: relative; z-index: 1; }
.login-view { width: min(1180px, 100%); min-height: 700px; display: grid; grid-template-columns: 1.2fr .8fr; gap: 90px; align-items: center; }
.brand-story { align-self: stretch; display: flex; flex-direction: column; justify-content: space-between; padding: 26px 0; }
.wordmark, .brand-mini { display: flex; align-items: center; gap: 13px; letter-spacing: .18em; font-size: 13px; font-weight: 760; }
.brand-orbit, .brand-mini > span { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid rgba(125, 243, 172, .6); border-radius: 50%; color: var(--green); font-family: Georgia, serif; font-size: 22px; letter-spacing: 0; box-shadow: inset 0 0 0 6px rgba(125,243,172,.04); }
.eyebrow { color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .22em; }
.story-copy h1 { margin: 20px 0 25px; font-size: clamp(48px, 5vw, 76px); line-height: 1.06; letter-spacing: -.055em; font-weight: 590; }
.story-copy h1 em { color: var(--gold); font-family: Georgia, "Songti SC", serif; font-weight: 400; }
.story-lead { max-width: 620px; margin: 0; color: #9caaa3; font-size: 18px; line-height: 1.8; }
.trust-row { display: flex; flex-wrap: wrap; gap: 25px; color: #819087; font-size: 12px; }
.trust-row span { display: flex; align-items: center; gap: 8px; }
.trust-row i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }

.login-card { width: min(430px, 100%); justify-self: end; padding: 26px; border: 1px solid var(--line); border-radius: 28px; background: rgba(16, 29, 24, .84); box-shadow: var(--shadow); backdrop-filter: blur(28px); }
.login-card-head { display: flex; justify-content: space-between; align-items: center; color: #a5b0aa; font-size: 12px; }
.status-light { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 13px rgba(125,243,172,.9); }
.quiet-button { border: 0; background: transparent; color: inherit; padding: 6px; }
.login-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 22px 0 24px; padding: 4px; border-radius: 13px; background: rgba(255,255,255,.045); }
.tab-button { border: 0; border-radius: 10px; padding: 11px; color: #718078; background: transparent; font-size: 13px; font-weight: 650; }
.tab-button.active { color: var(--text); background: rgba(255,255,255,.085); box-shadow: 0 5px 18px rgba(0,0,0,.16); }
.qr-card { position: relative; width: 228px; height: 228px; margin: 0 auto; padding: 15px; border-radius: 22px; background: var(--white); box-shadow: 0 18px 50px rgba(0,0,0,.26); }
.qr-code, .qr-code > img, .qr-code > canvas { width: 198px !important; height: 198px !important; border-radius: 8px; }
.qr-cover { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center; color: var(--dark-text); background: rgba(255,254,248,.92); border-radius: 22px; backdrop-filter: blur(4px); }
.mini-button { border: 0; border-radius: 999px; padding: 8px 14px; color: #07100d; background: var(--green-2); font-size: 12px; font-weight: 750; }
.qr-state { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 22px 0; }
.qr-state strong, .qr-state small { display: block; }
.qr-state strong { font-size: 13px; }
.qr-state small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 6px rgba(125,243,172,.08); animation: breathe 1.8s infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 11px rgba(125,243,172,0); } }
.login-steps { display: grid; gap: 10px; margin: 0; padding: 16px 0 0; border-top: 1px solid var(--line); list-style: none; color: #8b9891; font-size: 12px; }
.login-steps li { display: flex; align-items: center; gap: 10px; }
.login-steps span { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--green); font-size: 10px; }
.security-note { margin: 18px 0 0; color: #66736c; text-align: center; font-size: 10px; }
.field { display: block; margin: 0 0 15px; }
.field > span { display: block; margin: 0 0 7px; color: #9ba79f; font-size: 11px; font-weight: 680; }
.field input { width: 100%; height: 48px; border: 1px solid var(--line); border-radius: 12px; outline: none; padding: 0 14px; color: var(--text); background: rgba(255,255,255,.045); transition: border-color .2s, box-shadow .2s; }
.field input:focus { border-color: rgba(125,243,172,.55); box-shadow: 0 0 0 4px rgba(125,243,172,.06); }
.primary-button { width: 100%; height: 50px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 13px; padding: 0 18px; color: #07100d; background: var(--green); font-weight: 780; }
.primary-button:disabled { opacity: .55; cursor: wait; }
.form-error { min-height: 20px; margin: 12px 0 0; color: var(--danger); text-align: center; font-size: 12px; }
.api-settings { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.api-settings p { margin: 0; color: var(--muted); font-size: 10px; }

.chat-view { width: min(1580px, 100%); height: min(940px, calc(100vh - 34px)); display: grid; grid-template-columns: 320px minmax(0, 1fr) 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink-2); box-shadow: var(--shadow); transition: grid-template-columns .25s ease; }
.chat-view.show-details { grid-template-columns: 320px minmax(0, 1fr) 310px; }
.sidebar { min-width: 0; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); background: #0b1712; }
.sidebar-head { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); }
.brand-mini > span { width: 32px; height: 32px; font-size: 16px; }
.round-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; color: #bdc7c1; background: rgba(255,255,255,.04); }
.round-button:hover { color: var(--green); border-color: rgba(125,243,172,.35); background: rgba(125,243,172,.07); }
.profile-row { display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center; padding: 18px 20px 12px; }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; flex: none; overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; color: #08110d; background: var(--gold); font-weight: 800; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-me { background: var(--green); }
.profile-copy { min-width: 0; }
.profile-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.profile-copy span { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--muted); font-size: 10px; }
.profile-copy i { width: 5px; height: 5px; border-radius: 50%; background: #637069; }
.profile-copy i.online { background: var(--green); box-shadow: 0 0 8px rgba(125,243,172,.8); }
.profile-copy b { font-weight: 500; }
.search-box { display: flex; align-items: center; gap: 8px; margin: 5px 15px 16px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; color: #6f7c75; background: rgba(255,255,255,.035); }
.search-box input { width: 100%; height: 40px; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 12px; }
.section-title { display: flex; justify-content: space-between; padding: 0 20px 9px; color: #647169; font-size: 10px; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
.section-title button { border: 0; color: #718078; background: transparent; font-size: 10px; letter-spacing: 0; }
.chat-list { flex: 1; overflow: auto; padding: 0 9px; }
.chat-item { width: 100%; display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 11px; align-items: center; border: 0; border-radius: 15px; padding: 11px; color: inherit; text-align: left; background: transparent; }
.chat-item:hover { background: rgba(255,255,255,.035); }
.chat-item.active { background: rgba(125,243,172,.085); }
.chat-item.active .avatar { box-shadow: 0 0 0 2px rgba(125,243,172,.28); }
.chat-copy, .chat-tail { min-width: 0; }
.chat-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.chat-preview { display: block; margin-top: 5px; overflow: hidden; color: #69766f; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chat-tail { align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.chat-time { color: #59665f; font-size: 9px; }
.unread { min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 5px; border-radius: 99px; color: #07100d; background: var(--green); font-size: 9px; font-weight: 800; }
.sidebar-foot { min-height: 52px; display: flex; align-items: center; justify-content: center; padding: 0 18px; border-top: 1px solid var(--line); color: #56635c; font-size: 9px; letter-spacing: .08em; }
.sidebar-foot button { display: none; }

.conversation { min-width: 0; position: relative; display: grid; grid-template-rows: 76px 1fr auto auto; background: var(--paper); color: var(--dark-text); }
.conversation-head { display: grid; grid-template-columns: auto auto 1fr auto; gap: 12px; align-items: center; padding: 0 22px; border-bottom: 1px solid var(--dark-line); background: rgba(243,241,233,.94); backdrop-filter: blur(18px); }
.conversation-title { min-width: 0; }
.conversation-title h2 { margin: 0; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-title p { margin: 4px 0 0; color: #79827d; font-size: 10px; }
.head-actions { display: flex; gap: 7px; }
.conversation .round-button { color: #66716b; border-color: var(--dark-line); background: rgba(8,20,14,.025); }
.empty-state { display: grid; place-content: center; justify-items: center; padding: 30px; text-align: center; }
.empty-mark { width: 82px; height: 82px; display: grid; place-items: center; margin-bottom: 26px; border: 1px solid rgba(15,38,27,.16); border-radius: 50%; box-shadow: inset 0 0 0 10px rgba(14,36,25,.035); font: 34px Georgia, serif; }
.empty-state .eyebrow { color: #4f7861; }
.empty-state h3 { max-width: 520px; margin: 10px 0; font: 400 34px/1.2 Georgia, "Songti SC", serif; letter-spacing: -.025em; }
.empty-state > p:last-child { color: #7d8781; font-size: 13px; }
.messages { overflow: auto; padding: 28px clamp(22px, 5vw, 78px); scroll-behavior: smooth; }
.day-divider { display: flex; align-items: center; gap: 12px; margin: 14px 0 26px; color: #8b918d; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.day-divider::before, .day-divider::after { content: ""; height: 1px; flex: 1; background: var(--dark-line); }
.message-row { display: flex; align-items: flex-end; gap: 10px; margin: 0 0 16px; }
.message-row.mine { flex-direction: row-reverse; }
.message-row .avatar { width: 30px; height: 30px; border-radius: 10px; font-size: 11px; }
.message-block { max-width: min(66%, 640px); }
.message-author { display: block; margin: 0 0 5px 3px; color: #818984; font-size: 9px; }
.mine .message-author { text-align: right; margin-right: 3px; }
.message-bubble { padding: 11px 14px; border: 1px solid rgba(14,30,22,.08); border-radius: 5px 17px 17px 17px; background: var(--white); box-shadow: 0 7px 20px rgba(17,30,24,.055); font-size: 13px; line-height: 1.55; word-break: break-word; }
.mine .message-bubble { border-radius: 17px 5px 17px 17px; color: #08110d; background: #b9f6cc; }
.message-time { display: block; margin-top: 5px; color: #919893; font-size: 8px; text-align: right; }
.message-bubble img, .message-bubble video { display: block; max-width: min(380px, 100%); max-height: 420px; border-radius: 11px; object-fit: cover; }
.message-bubble audio { max-width: 280px; }
.file-card { min-width: 250px; display: grid; grid-template-columns: 42px 1fr auto; gap: 11px; align-items: center; color: inherit; text-decoration: none; }
.file-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--green-2); background: rgba(15,90,50,.08); font-size: 11px; font-weight: 850; }
.file-card strong, .file-card small { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card small { margin-top: 4px; color: #79827d; font-size: 9px; }
.file-download { color: #557060; font-size: 17px; }
.upload-bar { padding: 8px 22px; border-top: 1px solid var(--dark-line); background: #eceae2; }
.upload-bar > div { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 9px; }
.upload-bar > i { height: 3px; display: block; overflow: hidden; border-radius: 99px; background: rgba(15,40,27,.1); }
.upload-bar b { height: 100%; display: block; width: 0; border-radius: inherit; background: #2c9e5e; transition: width .15s; }
.composer { margin: 0 clamp(18px, 4vw, 52px) 22px; padding: 11px 12px 10px; border: 1px solid rgba(13,34,23,.13); border-radius: 19px; background: var(--white); box-shadow: 0 14px 42px rgba(23,38,29,.09); }
.composer { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 8px; }
.composer-tool { width: 34px; height: 34px; border: 0; border-radius: 50%; color: #53615a; background: #eff0ea; font-size: 20px; }
.composer textarea { width: 100%; max-height: 140px; resize: none; border: 0; outline: 0; padding: 8px 5px 5px; color: var(--dark-text); background: transparent; font-size: 13px; line-height: 1.5; }
.composer-meta { grid-column: 2; display: flex; align-items: center; justify-content: space-between; color: #9a9f9c; font-size: 8px; }
.send-button { width: 32px; height: 32px; border: 0; border-radius: 50%; color: #fff; background: #0e2017; font-size: 17px; }
.send-button:disabled { opacity: .35; }
.drop-zone { position: absolute; inset: 76px 0 0; z-index: 5; display: grid; place-items: center; background: rgba(243,241,233,.92); backdrop-filter: blur(12px); }
.drop-zone > div { min-width: 300px; padding: 45px; border: 1px dashed #3a7f59; border-radius: 24px; text-align: center; }
.drop-zone strong, .drop-zone span { display: block; }
.drop-zone strong { font: 28px Georgia, serif; }
.drop-zone span { margin-top: 9px; color: #7c8780; font-size: 11px; }

.details-panel { min-width: 0; overflow: hidden; border-left: 1px solid var(--line); background: var(--panel); }
.details-panel > header { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; }
.details-content { padding: 24px 20px; color: #8f9d95; font-size: 11px; line-height: 1.7; }
.details-hero { text-align: center; padding: 12px 0 25px; border-bottom: 1px solid var(--line); }
.details-hero .avatar { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px; font-size: 20px; }
.details-hero strong, .details-hero span { display: block; }
.details-hero strong { color: var(--text); font-size: 14px; }
.details-hero span { margin-top: 5px; color: var(--muted); font-size: 9px; }
.member-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px 6px; margin-top: 18px; text-align: center; }
.member-grid .avatar { width: 38px; height: 38px; margin: 0 auto 5px; border-radius: 12px; font-size: 10px; }
.member-grid span { display: block; overflow: hidden; color: #89978f; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 30px; transform: translateX(-50%); padding: 11px 17px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); background: rgba(10,23,17,.92); box-shadow: 0 12px 40px rgba(0,0,0,.35); backdrop-filter: blur(16px); font-size: 11px; }
.mobile-only { display: none; }

@media (max-width: 980px) {
  .login-view { min-height: auto; grid-template-columns: 1fr; gap: 40px; }
  .brand-story { gap: 34px; padding: 0; }
  .story-copy h1 { font-size: 50px; }
  .login-card { justify-self: start; }
  .trust-row { display: none; }
  .chat-view, .chat-view.show-details { grid-template-columns: 290px minmax(0,1fr); }
  .details-panel { position: absolute; z-index: 8; top: 0; right: 0; bottom: 0; width: min(310px, 90vw); transform: translateX(100%); transition: transform .25s; }
  .chat-view.show-details .details-panel { transform: translateX(0); }
}

@media (max-width: 680px) {
  body.login-active { overflow-y: auto; }
  .app-shell { padding: 0; }
  .login-view { min-height: 100vh; padding: 28px 20px 35px; align-content: start; }
  .wordmark { margin-bottom: 20px; }
  .story-copy h1 { margin: 12px 0 15px; font-size: 39px; }
  .story-lead { font-size: 14px; }
  .login-card { width: 100%; padding: 21px; border-radius: 24px; }
  .chat-view, .chat-view.show-details { width: 100%; height: 100vh; border: 0; border-radius: 0; grid-template-columns: 1fr; }
  .sidebar { position: absolute; z-index: 12; inset: 0 18% 0 0; transform: translateX(-105%); box-shadow: 30px 0 80px rgba(0,0,0,.45); transition: transform .25s ease; }
  .chat-view.show-sidebar .sidebar { transform: translateX(0); }
  .sidebar-foot { justify-content: space-between; }
  .sidebar-foot button { display: block; border: 0; color: var(--green); background: transparent; font-size: 10px; }
  .mobile-only { display: block; }
  .conversation-head { padding: 0 13px; grid-template-columns: auto auto 1fr auto; }
  .conversation-title p { display: none; }
  .messages { padding: 20px 13px; }
  .message-block { max-width: 78%; }
  .message-bubble img, .message-bubble video { max-width: 100%; }
  .composer { margin: 0 9px calc(9px + env(safe-area-inset-bottom)); }
  .composer-meta > span { display: none; }
  .empty-state h3 { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; } }
