:root {
  color-scheme: light;
  --ink: #1d2032;
  --muted: #8b8da0;
  --muted-dark: #66697c;
  --line: #ececf2;
  --purple: #6b5ce7;
  --purple-dark: #5748d0;
  --lavender: #f0efff;
  --sidebar: #fbfbfd;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #fff;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app-shell { display: flex; min-height: 100vh; height: 100vh; overflow: hidden; }
.sidebar { width: 286px; flex: 0 0 286px; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--line); padding: 27px 17px 15px; }
.sidebar-top, .topbar, .sidebar-bottom, .section-heading, .chat-header, .composer-row { display: flex; align-items: center; }
.sidebar-top { justify-content: space-between; padding: 0 6px 36px; }
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font-family: 'Segoe UI', Arial, sans-serif; font-size: 19px; font-weight: 800; letter-spacing: -.8px; }
.brand-light { font-weight: 500; color: #77798d; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: #fff; background: linear-gradient(145deg, #8274fa, #6152db); font-family: 'Segoe UI', Arial, sans-serif; font-size: 17px; font-weight: 800; box-shadow: 0 5px 12px #6b5ce733; }
.workspace-label, .section-heading, .eyebrow { color: #a2a3b2; font-size: 10px; letter-spacing: 1.35px; font-weight: 700; }
.workspace-label { display: flex; align-items: center; gap: 8px; padding: 0 9px 31px; }
.online-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #5bc69b; box-shadow: 0 0 0 3px #5bc69b1c; }
.section-heading { justify-content: space-between; padding: 0 9px 12px; }
.icon-button, .text-icon-button, .dialog-close { border: 0; background: transparent; color: #85879a; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-size: 22px; }
.icon-button:hover, .text-icon-button:hover { background: #efeff5; color: var(--purple); }
.text-icon-button { font-size: 19px; border-radius: 6px; width: 25px; height: 25px; }
.conversation-list { flex: 1; overflow: auto; }
.conversation-item { position: relative; width: 100%; display: flex; align-items: center; gap: 11px; text-align: left; padding: 9px 8px; margin: 2px 0; border: 0; border-radius: 11px; color: var(--ink); background: transparent; }
.conversation-item:hover { background: #f1f0fa; }
.conversation-item.active { background: var(--lavender); }
.conversation-item.unread .conversation-copy strong { color: var(--ink); font-weight: 700; }
.unread-badge { min-width: 20px; height: 20px; display: grid; place-items: center; margin-left: auto; padding: 0 6px; border-radius: 10px; color: #fff; background: var(--purple); font-size: 10px; font-weight: 700; }
.conversation-avatar, .chat-avatar, .message-avatar, .avatar { flex: 0 0 auto; display: grid; place-items: center; color: #6458ca; background: #e9e6ff; font-size: 11px; font-weight: 700; }
.conversation-avatar { width: 36px; height: 36px; border-radius: 12px; }
.group-avatar { color: #cf785c; background: #fff0e8; font-size: 20px; font-weight: 500; }
.conversation-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.conversation-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.conversation-copy > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
.sidebar-empty { padding: 2px 9px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.sidebar-bottom { gap: 10px; border-top: 1px solid var(--line); padding: 15px 3px 0; }
.avatar-small { width: 34px; height: 34px; border-radius: 50%; color: #fff; background: #8e7ae9; }
.profile-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.profile-copy strong { font-size: 12px; }
.profile-copy span { color: var(--muted); font-size: 10px; }
.logout-button { font-size: 18px; }

.main-panel { min-width: 0; flex: 1; display: flex; flex-direction: column; position: relative; }
.topbar { height: 76px; flex: 0 0 76px; justify-content: flex-end; gap: 16px; padding: 0 42px; border-bottom: 1px solid #f1f1f5; }
.topbar-caption { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.mobile-brand { display: none; }
.button { border: 0; border-radius: 9px; padding: 11px 16px; font-size: 12px; font-weight: 600; transition: background .15s, transform .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--purple); box-shadow: 0 5px 12px #6b5ce729; }
.button-primary:hover { background: var(--purple-dark); }
.button-subtle { color: #57516d; background: #f3f1ff; }
.button-subtle:hover { background: #eae7ff; }
.welcome-panel { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 36px 20px 70px; }
.welcome-illustration { width: 200px; height: 145px; position: relative; margin-bottom: 17px; }
.illustration-card { position: absolute; width: 150px; height: 105px; border: 1px solid #eeeefa; border-radius: 16px; background: #fff; box-shadow: 0 12px 35px #39307813; }
.card-back { top: 8px; left: 31px; transform: rotate(8deg); background: #f5f3ff; }
.card-front { top: 25px; left: 20px; display: grid; grid-template-columns: 25px 1fr; align-content: center; gap: 11px 10px; padding: 15px; transform: rotate(-5deg); }
.illustration-avatar { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; font-size: 9px; font-weight: 700; }
.avatar-purple { color: #685cda; background: #ebe8ff; }
.avatar-coral { color: #d98668; background: #fff0e8; }
.avatar-blue { color: #5791c5; background: #eaf5ff; }
.illustration-line { height: 7px; align-self: center; border-radius: 8px; background: #eeedf5; }
.illustration-line.short { width: 65%; }
.sparkle { position: absolute; color: #f4b65e; font-size: 21px; }
.sparkle-one { top: 2px; right: 12px; }
.sparkle-two { left: 1px; bottom: 17px; color: #8a7bea; font-size: 15px; }
.eyebrow { margin: 0 0 13px; color: var(--purple); }
.welcome-panel h1 { margin: 0; font-family: 'Segoe UI', Arial, sans-serif; font-size: clamp(29px, 3.2vw, 42px); line-height: 1.2; letter-spacing: -1.7px; }
.welcome-panel h1 span { color: #84839a; font-weight: 500; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.6; }
.welcome-copy { max-width: 390px; margin: 14px auto 23px; }
.welcome-panel .button { padding: 13px 18px; }
.welcome-panel .button span { padding-left: 14px; font-size: 16px; }

.chat-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; max-width: 1100px; width: 100%; margin: 0 auto; }
.chat-header { height: 78px; flex: 0 0 78px; gap: 12px; padding: 0 36px; border-bottom: 1px solid #f1f1f5; }
.chat-avatar { width: 39px; height: 39px; border-radius: 13px; font-size: 16px; }
.chat-heading { min-width: 0; flex: 1; }
.chat-heading h1 { margin: 0 0 3px; font-family: 'Segoe UI', Arial, sans-serif; font-size: 15px; letter-spacing: -.2px; }
.chat-heading p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; color: var(--muted); font-size: 11px; }
.chat-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.chat-header #add-member-button { flex: 0 0 auto; padding: 9px 11px; }
.chat-status i { width: 6px; height: 6px; border-radius: 50%; background: #5bc69b; }
.chat-actions { display: flex; align-items: center; gap: 7px; padding: 8px 36px; border-bottom: 1px solid #f1f1f5; overflow-x: auto; }
.tool-button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 0; border-radius: 8px; color: #77798b; background: transparent; font-size: 11px; }
.tool-button:hover { color: var(--purple); background: #f3f1ff; }
.messages { flex: 1; overflow-y: auto; padding: 23px 42px; }
.message { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 22px; }
.unread-divider { display: flex; align-items: center; gap: 12px; margin: 8px 0 20px; color: var(--purple); font-size: 10px; font-weight: 700; }
.unread-divider::before, .unread-divider::after { height: 1px; flex: 1; background: #e6e2ff; content: ""; }
.message-avatar { width: 31px; height: 31px; border-radius: 11px; font-size: 10px; }
.message-content { min-width: 0; max-width: min(660px, 85%); }
.message-meta { display: flex; align-items: center; gap: 9px; margin: 1px 0 5px; }
.message-meta strong { font-size: 11px; font-weight: 700; }
.message-meta time { color: #a4a5b3; font-size: 10px; }
.message-bubble { display: table; max-width: 100%; padding: 9px 12px; border-radius: 4px 14px 14px 14px; background: #f1f1f6; }
.message-body { margin: 0; color: #505165; font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.own-message .message-avatar { order: 2; color: #fff; background: #8071e6; }
.own-message { flex-direction: row-reverse; }
.own-message .message-content { text-align: right; }
.own-message .message-meta { justify-content: flex-end; }
.own-message .message-meta strong { color: #6252d6; }
.own-message .message-bubble { margin-left: auto; border-radius: 14px 4px 14px 14px; background: #e4dfff; }
.own-message .message-body { color: #342b69; text-align: left; }
.own-message .message-attachment { align-items: flex-end; }
.message-edited { color: var(--muted); font-size: 9px; }
.message-reply { display: block; max-width: 100%; margin: 0 0 6px auto; padding: 0; overflow: hidden; border: 0; color: var(--muted); background: transparent; font-size: 10px; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.message-reply:hover { color: var(--purple); }
.message-mention { color: var(--purple-dark); font-weight: 700; }
.own-message .message-mention { color: #4c3fb1; }
.message-actions { display: flex; align-items: center; gap: 5px; margin-top: 5px; opacity: .7; }
.message-actions > button, .reaction-control > button { padding: 4px 6px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 10px; }
.message-actions button:hover { color: var(--purple); background: #f3f1ff; }
.own-message .message-actions { justify-content: flex-end; }
.reaction-control { position: relative; }
.reaction-picker { position: absolute; z-index: 3; bottom: 100%; left: 0; display: flex; gap: 3px; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 5px 18px #2820471c; }
.own-message .reaction-picker { left: auto; right: 0; }
.reaction-picker button { padding: 4px; border: 0; border-radius: 6px; background: transparent; font-size: 16px; }
.reaction-picker button:hover { background: #f3f1ff; }
.message-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.reaction-chip { padding: 3px 7px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted-dark); background: #fff; font-size: 10px; cursor: pointer; }
.reaction-chip.selected { border-color: #b7adff; color: #5345c8; background: #f0efff; }
.deleted-message { color: var(--muted); font-style: italic; }
.message-attachment { display: flex; align-items: flex-start; flex-direction: column; gap: 7px; margin-top: 8px; }
.message-attachment img { max-width: min(330px, 100%); max-height: 250px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); }
.message-attachment audio { width: min(330px, 100%); height: 38px; }
.message-attachment a { color: var(--purple-dark); font-size: 11px; text-decoration: none; }
.message-attachment a:hover { text-decoration: underline; }
.composer { position: relative; margin: 0 34px 22px; border: 1px solid #e8e7ef; border-radius: 13px; box-shadow: 0 5px 18px #3e347408; }
.composer-row { gap: 8px; padding: 9px 10px 4px; }
.attach-button { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; color: #77798b; cursor: pointer; }
.attach-button:hover { color: var(--purple); background: #f5f3ff; }
.attach-button span { font-size: 23px; font-weight: 300; }
.attach-button input { display: none; }
.composer textarea { min-width: 0; flex: 1; resize: none; max-height: 120px; border: 0; outline: 0; padding: 9px 4px; color: var(--ink); font-size: 13px; }
.composer textarea::placeholder { color: #a2a3b2; }
.send-button { display: grid; place-items: center; flex: 0 0 auto; width: 33px; height: 33px; border: 0; border-radius: 9px; color: white; background: var(--purple); font-size: 20px; }
.send-button:hover { background: var(--purple-dark); }
.send-button:disabled { opacity: .6; cursor: wait; }
.record-button { font-size: 16px; }
.record-button.recording { color: #d44c55; background: #fff0f1; animation: pulse 1.2s infinite; }
.composer-footer { display: flex; justify-content: space-between; min-height: 25px; padding: 0 15px 8px; color: #a5a6b4; font-size: 10px; }
.composer-footer #record-status { color: #ce6b54; }
.attachment-preview { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 12px 0; padding: 8px 10px; border-radius: 8px; color: #6b687e; background: #f7f6fc; font-size: 11px; overflow-wrap: anywhere; }
.reply-preview { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 12px 0; padding: 8px 10px; border-left: 3px solid var(--purple); border-radius: 5px; color: var(--muted-dark); background: #f7f6fc; font-size: 11px; }
.reply-preview button { border: 0; color: var(--muted); background: transparent; font-size: 18px; }
.mention-suggestions { position: absolute; z-index: 5; bottom: calc(100% - 8px); left: 52px; display: flex; flex-direction: column; width: min(320px, calc(100% - 64px)); max-height: 220px; overflow: auto; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 8px 25px #2820471c; }
.mention-suggestions button { padding: 8px; border: 0; border-radius: 6px; color: var(--ink); background: transparent; text-align: left; font-size: 11px; }
.mention-suggestions button:hover { background: #f3f1ff; }
.remove-attachment { border: 0; color: #85879a; background: transparent; font-size: 18px; }
.message-fetch-error { margin: 0 0 14px; }

.auth-screen { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: radial-gradient(ellipse at 75% 15%, #f0eeff, transparent 38%), #f9f9fc; }
.auth-card { width: min(100%, 410px); padding: 39px; border: 1px solid #eeedf4; border-radius: 18px; background: #fff; box-shadow: 0 20px 60px #34305d0c; }
.brand-auth { margin-bottom: 40px; }
.auth-card h1 { margin: 0; font-family: 'Segoe UI', Arial, sans-serif; font-size: 27px; letter-spacing: -1px; }
.auth-card > .muted { margin: 8px 0 25px; }
.stack-form, .dialog-form { display: flex; flex-direction: column; gap: 15px; }
.stack-form label, .dialog-form > label { display: flex; flex-direction: column; gap: 7px; color: #55576b; font-size: 11px; font-weight: 600; }
.stack-form input, .dialog-form input, .dialog-form select { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #e7e6ed; border-radius: 8px; outline: 0; color: var(--ink); background: #fff; font-size: 13px; }
.stack-form input:focus, .dialog-form input:focus, .dialog-form select:focus { border-color: #9c91ef; box-shadow: 0 0 0 3px #7564e719; }
.stack-form .button { margin-top: 4px; height: 43px; }
.auth-hint { margin: 18px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.error-message { padding: 10px 12px; border-radius: 8px; color: #aa3843; background: #fff0f0; font-size: 12px; line-height: 1.5; }

.app-dialog { width: min(100% - 32px, 480px); max-height: min(85vh, 700px); overflow: auto; padding: 0; border: 1px solid #eeedf4; border-radius: 16px; box-shadow: 0 24px 80px #29264430; }
.app-dialog::backdrop { background: #25243b55; backdrop-filter: blur(2px); }
.dialog-form { padding: 25px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 5px; }
.dialog-heading .eyebrow { margin-bottom: 7px; font-size: 9px; }
.dialog-heading h2 { margin: 0; font-family: 'Segoe UI', Arial, sans-serif; font-size: 20px; letter-spacing: -.7px; }
.dialog-close { width: 30px; height: 30px; border-radius: 8px; font-size: 23px; line-height: 1; }
.dialog-close:hover { background: #f2f1f7; }
.dialog-form > .muted { margin: 0 0 3px; font-size: 12px; }
.dialog-form fieldset { min-width: 0; margin: 0; padding: 10px; border: 1px solid #e9e8ef; border-radius: 9px; }
.dialog-form legend { padding: 0 5px; color: #55576b; font-size: 11px; font-weight: 600; }
.user-picker { display: flex; flex-direction: column; gap: 3px; max-height: 190px; overflow-y: auto; }
.user-option { display: flex; align-items: center; gap: 9px; padding: 7px; border-radius: 8px; cursor: pointer; }
.user-option:hover { background: #f8f7fc; }
.user-option input { width: 15px; height: 15px; accent-color: var(--purple); }
.user-option .conversation-avatar { width: 31px; height: 31px; border-radius: 10px; }
.user-option-copy { display: flex; flex-direction: column; gap: 2px; }
.user-option-copy strong { color: var(--ink); font-size: 11px; }
.user-option-copy small { color: var(--muted); font-size: 10px; }
.dialog-form > .button { margin-top: 3px; }
.install-dialog .dialog-form { gap: 12px; }
.install-dialog .dialog-form > .muted { margin: 0; }
.install-dialog .dialog-form > .button { width: 100%; margin-top: 0; }
.search-results, .files-list, .tasks-list { display: flex; flex-direction: column; gap: 7px; max-height: 300px; overflow: auto; }
.search-result { display: flex; flex-direction: column; gap: 5px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; text-align: left; }
.search-result:hover { border-color: #c8c0ff; background: #faf9ff; }
.search-result strong { color: var(--muted-dark); font-size: 10px; }
.search-result span { font-size: 12px; line-height: 1.5; }
.shared-file, .task-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.task-item { display: grid; grid-template-columns: minmax(0, 1fr) 118px; align-items: center; gap: 12px; }
.shared-file-details, .task-details { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.task-details { flex: 1; }
.shared-file-details strong, .task-details strong { overflow-wrap: anywhere; font-size: 12px; }
.shared-file-details small, .task-details small { color: var(--muted); font-size: 10px; }
.shared-file a { flex: 0 0 auto; color: var(--purple-dark); font-size: 10px; text-decoration: none; }
.task-create-form { display: flex; flex-direction: column; gap: 10px; padding: 12px 0 15px; border-bottom: 1px solid var(--line); }
.task-create-form label { display: flex; flex-direction: column; gap: 6px; color: var(--muted-dark); font-size: 10px; font-weight: 600; }
.task-create-form input, .task-create-form textarea, .task-create-form select { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; font-size: 12px; }
.task-create-form textarea { resize: vertical; }
.task-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.task-details p { margin: 0; color: var(--muted-dark); font-size: 11px; white-space: pre-wrap; }
.task-status { width: 100%; min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; font-size: 10px; }
.task-status:disabled { opacity: .7; }
.button-danger { color: white; background: #cf4c59; }
.button-danger:hover { background: #b93e4b; }
.call-dialog { width: min(100% - 32px, 620px); }
.call-videos { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.call-videos video { width: 100%; min-height: 150px; max-height: 360px; border-radius: 10px; background: #181820; object-fit: cover; }
#remote-audio { display: none; }
.call-controls { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.call-controls button { min-width: 100px; }
.call-dialog .muted { margin: 0; text-align: center; }
.app-toast { position: fixed; z-index: 10; right: 24px; bottom: 24px; max-width: calc(100vw - 32px); padding: 13px 17px; border: 1px solid #d9eee2; border-radius: 10px; color: #27754d; background: #f0fbf4; box-shadow: 0 8px 26px #2820471c; font-size: 13px; }

@keyframes pulse { 50% { box-shadow: 0 0 0 5px #d44c5524; } }
@media (max-width: 760px) {
  .app-shell { height: 100dvh; }
  .sidebar { width: 70px; flex-basis: 70px; padding: 18px 8px 11px; }
  .sidebar-top { justify-content: center; padding: 0 0 27px; }
  .sidebar-top .brand > span:not(.brand-mark), .workspace-label, .section-heading span, .conversation-copy, .sidebar-bottom .profile-copy, .logout-button { display: none; }
  .sidebar-top .icon-button { position: absolute; top: 67px; left: 18px; }
  .section-heading { justify-content: center; padding: 0 0 12px; }
  .text-icon-button { display: none; }
  .conversation-item { justify-content: center; padding: 7px 0; }
  .conversation-avatar { width: 38px; height: 38px; }
  .conversation-item .unread-badge { position: absolute; top: 0; right: 0; min-width: 17px; height: 17px; margin: 0; padding: 0 4px; font-size: 9px; }
  .sidebar-bottom { justify-content: center; padding-top: 12px; }
  .topbar { height: 59px; flex-basis: 59px; justify-content: space-between; padding: 0 15px; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; font-size: 12px; }
  .mobile-brand .brand-mark { width: 27px; height: 27px; border-radius: 9px; font-size: 14px; }
  .topbar-caption { display: none; }
  #manage-users-button { padding: 9px 10px; font-size: 10px; }
  .welcome-panel { padding-bottom: 50px; }
  .chat-header { height: 66px; flex-basis: 66px; padding: 0 15px; }
  .chat-header #add-member-button { padding: 8px; font-size: 10px; white-space: nowrap; }
  .chat-status { font-size: 0; }
  .messages { padding: 20px 14px; }
  .composer { margin: 0 10px 10px; }
  .composer-footer { font-size: 9px; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ececf4;
  --muted: #a0a1b3;
  --muted-dark: #c1c1d0;
  --line: #353541;
  --purple: #9286ff;
  --purple-dark: #b0a7ff;
  --lavender: #302d49;
  --sidebar: #1b1b25;
  background: #15151d;
  color: var(--ink);
}
html[data-theme="dark"] body,
html[data-theme="dark"] .main-panel { background: #15151d; }
html[data-theme="dark"] .sidebar { border-color: var(--line); }
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .chat-header,
html[data-theme="dark"] .chat-actions { border-color: var(--line); }
html[data-theme="dark"] .brand-light,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .text-icon-button,
html[data-theme="dark"] .dialog-close { color: #b8b8c8; }
html[data-theme="dark"] .icon-button:hover,
html[data-theme="dark"] .text-icon-button:hover,
html[data-theme="dark"] .dialog-close:hover { background: #2b2a38; color: var(--purple); }
html[data-theme="dark"] .conversation-item:hover,
html[data-theme="dark"] .tool-button:hover { background: #29273b; }
html[data-theme="dark"] .chat-status i { background: #5bc69b; }
html[data-theme="dark"] .message-bubble { background: #292933; }
html[data-theme="dark"] .message-body { color: #e0e0ea; }
html[data-theme="dark"] .own-message .message-bubble { background: #302d49; }
html[data-theme="dark"] .own-message .message-body,
html[data-theme="dark"] .own-message .message-mention { color: #e2ddff; }
html[data-theme="dark"] .own-message .message-meta strong,
html[data-theme="dark"] .message-mention { color: #c0b9ff; }
html[data-theme="dark"] .unread-divider::before,
html[data-theme="dark"] .unread-divider::after { background: #403b62; }
html[data-theme="dark"] .composer,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .app-dialog { border-color: var(--line); background: #20202b; }
html[data-theme="dark"] .composer textarea,
html[data-theme="dark"] .stack-form input,
html[data-theme="dark"] .dialog-form input,
html[data-theme="dark"] .dialog-form select,
html[data-theme="dark"] .task-create-form input,
html[data-theme="dark"] .task-create-form textarea,
html[data-theme="dark"] .task-create-form select,
html[data-theme="dark"] .task-status { border-color: var(--line); color: var(--ink); background: #191922; }
html[data-theme="dark"] .composer textarea::placeholder { color: #858598; }
html[data-theme="dark"] .button-subtle { color: #d3d0f0; background: #302d49; }
html[data-theme="dark"] .button-subtle:hover { background: #3a3658; }
html[data-theme="dark"] .message-actions > button,
html[data-theme="dark"] .reaction-control > button { color: #b8b8c8; }
html[data-theme="dark"] .message-actions button:hover,
html[data-theme="dark"] .reaction-picker button:hover,
html[data-theme="dark"] .mention-suggestions button:hover { background: #302d49; }
html[data-theme="dark"] .reaction-picker,
html[data-theme="dark"] .mention-suggestions,
html[data-theme="dark"] .search-result,
html[data-theme="dark"] .shared-file,
html[data-theme="dark"] .task-item { border-color: var(--line); color: var(--ink); background: #24242f; }
html[data-theme="dark"] .search-result:hover { border-color: #5b538c; background: #29273b; }
html[data-theme="dark"] .reaction-chip { border-color: var(--line); color: var(--muted-dark); background: #24242f; }
html[data-theme="dark"] .reaction-chip.selected { border-color: #675e9f; color: #e0dcff; background: #302d49; }
html[data-theme="dark"] .reply-preview,
html[data-theme="dark"] .attachment-preview { color: var(--muted-dark); background: #292933; }
html[data-theme="dark"] .mention-suggestions button { color: var(--ink); }
html[data-theme="dark"] .auth-screen { background: radial-gradient(ellipse at 75% 15%, #302d49, transparent 38%), #15151d; }
html[data-theme="dark"] .illustration-card { border-color: #353541; background: #24242f; }
html[data-theme="dark"] .card-back { background: #302d49; }
html[data-theme="dark"] .illustration-line { background: #454552; }
html[data-theme="dark"] .stack-form label,
html[data-theme="dark"] .dialog-form > label,
html[data-theme="dark"] .task-create-form label,
html[data-theme="dark"] .dialog-form legend { color: var(--muted-dark); }
html[data-theme="dark"] .dialog-form fieldset,
html[data-theme="dark"] .task-create-form { border-color: var(--line); }
html[data-theme="dark"] .user-option:hover { background: #29273b; }
html[data-theme="dark"] .user-option-copy strong { color: var(--ink); }
html[data-theme="dark"] .call-videos video { background: #101015; }
html[data-theme="dark"] .app-toast { border-color: #315a43; color: #a9e3bd; background: #1d3025; }

@media (max-width: 760px) {
  .topbar { gap: 6px; padding: 0 9px; }
  #notifications-button,
  #install-app-button,
  #theme-toggle { width: 34px; height: 34px; padding: 0; overflow: hidden; white-space: nowrap; }
  #notifications-button > span:last-child,
  #install-app-button > span:last-child,
  #theme-toggle > span:last-child { display: none; }
  #manage-users-button { padding: 8px 7px; font-size: 9px; white-space: nowrap; }
  .chat-actions { gap: 3px; padding: 7px 10px; }
  .tool-button { padding: 7px; }
  .tool-button span { display: none; }
  .chat-header #add-member-button { font-size: 16px; }
  .chat-header #add-member-button span { display: none; }
  .call-videos { grid-template-columns: 1fr; }
  .call-videos video { min-height: 120px; max-height: 250px; }
}

@media (max-width: 480px) {
  .mobile-brand strong { display: none; }
  #manage-users-button { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; overflow: hidden; font-size: 0; }
  #manage-users-button::before { content: "＋"; font-size: 18px; }
  .task-item { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .task-status { width: 100%; }
  .task-form-row { grid-template-columns: minmax(0, 1fr); }
}
