:root {
  --bg: #080c18;
  --panel: rgba(16, 22, 40, .88);
  --panel-strong: #11182c;
  --panel-soft: #161f37;
  --line: rgba(188, 201, 255, .12);
  --text: #f6f7ff;
  --muted: #8c97b7;
  --accent: #8b7bff;
  --accent-2: #42d9c3;
  --danger: #ff779e;
  --shadow: 0 24px 80px rgba(0, 0, 0, .36);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: 'Segoe UI', Arial, sans-serif; }
body { min-height: 100vh; overflow-x: hidden; }
button, input, textarea { font: inherit; }
button { cursor: pointer; border: 0; }

body::before, body::after { content: ''; position: fixed; z-index: -1; border-radius: 999px; filter: blur(1px); pointer-events: none; }
body::before { width: 42vw; height: 42vw; top: -18vw; right: -8vw; background: radial-gradient(circle, rgba(122, 104, 255, .17), transparent 68%); }
body::after { width: 35vw; height: 35vw; bottom: -15vw; left: -10vw; background: radial-gradient(circle, rgba(35, 210, 190, .09), transparent 70%); }

.shell { display: grid; grid-template-columns: 296px 1fr; height: 100vh; min-height: 620px; max-width: 1500px; margin: auto; }
.sidebar { padding: 30px 18px 22px; border-right: 1px solid var(--line); background: rgba(9, 13, 27, .7); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 12px 28px; }
.logo { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #927bff, #5d55e8); box-shadow: 0 8px 24px rgba(117, 100, 255, .3); }
.logo svg { width: 20px; }
.brand-name { font: 700 20px 'Trebuchet MS', sans-serif; letter-spacing: -.04em; }
.brand-pill { margin-left: auto; width: 7px; height: 7px; background: var(--accent-2); border-radius: 50%; box-shadow: 0 0 12px var(--accent-2); }
.side-label { padding: 0 12px 10px; font-size: 11px; font-weight: 700; color: #64708f; letter-spacing: .12em; text-transform: uppercase; }
.chat-list { flex: 1; overflow-y: auto; }
.chat-row { width: 100%; text-align: left; display: flex; gap: 11px; align-items: center; color: var(--text); background: transparent; padding: 11px 12px; border-radius: 14px; margin-bottom: 4px; transition: .2s ease; }
.chat-row:hover, .chat-row.active { background: var(--panel-soft); }
.chat-avatar { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; color: #dcd9ff; background: linear-gradient(135deg, rgba(139,123,255,.28), rgba(66,217,195,.16)); border: 1px solid rgba(139,123,255,.25); border-radius: 12px; font-weight: 700; }
.chat-row-copy { min-width: 0; }
.chat-row-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row-sub { margin-top: 2px; color: var(--muted); font-size: 11px; }
.empty-side { padding: 25px 12px; color: #687492; font-size: 13px; line-height: 1.5; }
.new-chat { width: 100%; margin-top: 16px; padding: 13px 15px; color: #fff; border: 1px solid rgba(139,123,255,.5); border-radius: 13px; background: linear-gradient(135deg, rgba(139,123,255,.22), rgba(139,123,255,.09)); font-weight: 600; transition: .2s ease; }
.new-chat:hover { background: rgba(139,123,255,.3); transform: translateY(-1px); }
.side-foot { display: flex; align-items: center; gap: 8px; padding: 18px 12px 0; color: var(--muted); font-size: 12px; }
.lock-dot { width: 8px; height: 8px; background: var(--accent-2); border-radius: 50%; }

.main { min-width: 0; display: flex; flex-direction: column; background: radial-gradient(circle at 50% 0%, rgba(139,123,255,.055), transparent 40%); }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 0 38px; border-bottom: 1px solid var(--line); }
.current-chat { min-width: 0; }
.current-chat h1 { margin: 0; font: 600 20px 'Trebuchet MS', sans-serif; letter-spacing: -.035em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.current-chat p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; gap: 9px; }
.button { display: inline-flex; gap: 8px; align-items: center; justify-content: center; min-height: 39px; padding: 0 14px; border-radius: 11px; color: var(--text); background: var(--panel-soft); border: 1px solid var(--line); font-size: 13px; font-weight: 600; transition: .2s ease; }
.button:hover { border-color: rgba(139,123,255,.5); background: #202945; }
.button.primary { color: white; border-color: transparent; background: var(--accent); box-shadow: 0 8px 20px rgba(139,123,255,.2); }
.button.primary:hover { background: #9b8dff; }
.button svg { width: 16px; height: 16px; }
.messages { flex: 1; overflow-y: auto; padding: 34px 6%; }
.welcome { max-width: 600px; margin: 11vh auto 0; text-align: center; }
.welcome-mark { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 20px; border-radius: 22px; color: #dcd9ff; background: linear-gradient(135deg, rgba(139,123,255,.23), rgba(66,217,195,.13)); border: 1px solid rgba(139,123,255,.22); }
.welcome-mark svg { width: 29px; }
.welcome h2 { margin: 0 0 12px; font: 600 28px 'Trebuchet MS', sans-serif; letter-spacing: -.05em; }
.welcome p { margin: 0 auto 28px; max-width: 470px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.features { display: flex; justify-content: center; gap: 9px; flex-wrap: wrap; }
.feature { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; color: #b9c2dd; background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.feature svg { width: 14px; color: var(--accent-2); }
.date-divider { display: flex; align-items: center; gap: 13px; margin: 10px 0 20px; color: #687492; font-size: 11px; }
.date-divider::before, .date-divider::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.message { display: flex; gap: 10px; margin: 14px 0; max-width: 760px; }
.message.mine { margin-left: auto; flex-direction: row-reverse; }
.message-avatar { width: 31px; height: 31px; flex: 0 0 31px; display: grid; place-items: center; border-radius: 10px; color: #c9c3ff; background: #1a2340; font-size: 11px; font-weight: 700; }
.message-body { min-width: 0; }
.message-head { display: flex; align-items: baseline; gap: 8px; margin: 0 4px 5px; }
.mine .message-head { flex-direction: row-reverse; }
.message-name { color: #b6bfdb; font-size: 11px; font-weight: 600; }
.message-time { color: #687492; font-size: 10px; }
.bubble { padding: 11px 14px; border: 1px solid var(--line); border-radius: 5px 15px 15px 15px; color: #e9ebf7; background: rgba(21,29,51,.9); font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.mine .bubble { border-radius: 15px 5px 15px 15px; border-color: rgba(139,123,255,.25); background: rgba(85,72,184,.28); }
.file-card { display: flex; align-items: center; gap: 11px; min-width: 230px; padding: 12px 14px; border: 1px solid rgba(66,217,195,.22); border-radius: 15px; background: rgba(26,56,63,.34); }
.file-icon { width: 35px; height: 35px; display: grid; place-items: center; flex: 0 0 35px; border-radius: 10px; color: var(--accent-2); background: rgba(66,217,195,.12); }
.file-icon svg { width: 18px; }
.file-info { min-width: 0; flex: 1; }
.file-name { color: #e7fffb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.file-size { margin-top: 4px; color: #82bdb7; font-size: 11px; }
.file-download { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid rgba(66,217,195,.24); border-radius: 9px; color: var(--accent-2); background: transparent; }
.file-download:hover { background: rgba(66,217,195,.12); }
.file-download svg { width: 15px; }
.composer-wrap { padding: 18px 6% 25px; }
.composer { display: flex; align-items: flex-end; gap: 9px; max-width: 900px; margin: 0 auto; padding: 9px; border: 1px solid var(--line); border-radius: 17px; background: rgba(18,25,45,.9); box-shadow: var(--shadow); }
.attach { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; color: var(--muted); background: transparent; border-radius: 11px; }
.attach:hover { color: var(--accent-2); background: rgba(66,217,195,.08); }
.attach svg { width: 19px; }
#message-input { width: 100%; min-height: 40px; max-height: 140px; padding: 10px 4px; resize: none; color: var(--text); border: 0; outline: 0; background: transparent; line-height: 1.4; }
#message-input::placeholder { color: #66718e; }
.send { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 40px; border-radius: 11px; color: white; background: var(--accent); }
.send:hover { background: #9b8dff; }
.send svg { width: 17px; }
.composer-note { max-width: 900px; margin: 10px auto 0; text-align: center; color: #606b88; font-size: 11px; }
.hidden { display: none !important; }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(4,6,13,.72); backdrop-filter: blur(10px); }
.modal { width: min(100%, 470px); padding: 27px; border: 1px solid var(--line); border-radius: 22px; background: #121a30; box-shadow: var(--shadow); }
.modal h3 { margin: 0; font: 600 22px 'Trebuchet MS', sans-serif; letter-spacing: -.04em; }
.modal p { margin: 9px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.field-label { display: block; margin: 17px 0 8px; color: #aeb8d5; font-size: 12px; font-weight: 600; }
.input { width: 100%; padding: 13px 14px; color: var(--text); border: 1px solid var(--line); outline: 0; border-radius: 11px; background: #0d1427; }
.input:focus { border-color: rgba(139,123,255,.65); box-shadow: 0 0 0 3px rgba(139,123,255,.1); }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.invite-link { display: flex; align-items: center; gap: 8px; margin-top: 15px; padding: 10px; border-radius: 11px; background: #0c1325; }
.invite-link input { min-width: 0; flex: 1; color: #9ca9cc; border: 0; outline: 0; background: transparent; font-size: 11px; }
.copy-status { min-height: 17px; margin-top: 10px; color: var(--accent-2); font-size: 12px; }
.error { color: var(--danger) !important; }
.drop-overlay { position: fixed; z-index: 10; inset: 20px; display: grid; place-items: center; border: 2px dashed var(--accent-2); border-radius: 24px; color: #d9fffa; background: rgba(21,72,76,.72); backdrop-filter: blur(4px); font: 600 20px 'Trebuchet MS', sans-serif; }
.progress { width: 100%; height: 4px; margin-top: 8px; overflow: hidden; border-radius: 9px; background: rgba(255,255,255,.08); }
.progress::before { content: ''; display: block; width: 45%; height: 100%; border-radius: inherit; background: var(--accent-2); animation: progress 1.1s infinite ease-in-out; }
@keyframes progress { 0% { transform: translateX(-110%); } 100% { transform: translateX(230%); } }

@media (max-width: 760px) {
  .shell { display: block; min-height: 100vh; height: auto; }
  .sidebar { min-height: auto; padding: 15px 12px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 5px 15px; }
  .chat-list { display: flex; gap: 4px; overflow-x: auto; }
  .chat-row { width: 180px; flex: 0 0 180px; margin: 0; }
  .empty-side { display: none; }
  .new-chat { margin-top: 10px; }
  .side-foot { display: none; }
  .topbar { height: 72px; padding: 0 17px; }
  .top-actions .button span { display: none; }
  .top-actions .button { width: 40px; padding: 0; }
  .messages { padding: 25px 17px; min-height: 480px; }
  .composer-wrap { padding: 15px 17px 20px; }
  .welcome { margin-top: 8vh; }
}
