.auth-shell {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow: hidden;
  background: radial-gradient(ellipse at 30% 20%, #C8E8EF 0%, #EEF3F7 60%, #DDEAF2 100%);
}
.auth-shell::before,
.auth-shell::after {
  content: "";
  position: fixed;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,.75);
  filter: blur(60px);
  opacity: .5;
  pointer-events: none;
}
.auth-shell::before { left: -48px; top: -42px; }
.auth-shell::after { right: -58px; bottom: -52px; }
.auth-card {
  position: relative;
  z-index: 1;
  width: min(380px, calc(100vw - 32px));
  padding: 36px 32px;
  border: 1px solid rgba(255,255,255,.6);
  border-radius: var(--tw-r-xl);
  background: var(--tw-bg-glass);
  box-shadow: var(--tw-shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.auth-card .eyebrow,
.tw-logo {
  display: block;
  color: var(--tw-accent-dark);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.5px;
  line-height: 1;
  text-align: center;
}
.auth-card h1 {
  margin: 0 0 4px;
  color: var(--tw-accent-dark);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.5px;
  text-align: center;
}
.auth-card > p {
  margin: 4px 0 24px;
  color: var(--tw-text-secondary);
  font-size: 13px;
  text-align: center;
}
.auth-panel-title {
  margin: 0 0 16px;
  padding: 20px;
  border: 1px solid var(--tw-border);
  border-radius: var(--tw-r-lg);
  background: rgba(255,255,255,.55);
}
.auth-panel-title strong { display: block; font-size: 16px; font-weight: 600; color: var(--tw-text-primary); }
.auth-panel-title small { display: block; margin-top: 2px; font-size: 13px; color: var(--tw-text-secondary); }
.auth-card label {
  position: relative;
  color: var(--tw-text-secondary);
  font-size: 0;
}
.auth-card label::before {
  content: "◦";
  position: absolute;
  left: 14px;
  bottom: 13px;
  z-index: 1;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  color: var(--tw-text-tertiary);
  font-size: 16px;
}
.auth-card input {
  height: 44px;
  min-height: 44px;
  padding: 0 12px 0 40px;
  border: 1px solid var(--tw-border-strong);
  border-radius: var(--tw-r-md);
  background: rgba(255,255,255,.7);
  box-shadow: none;
}
.auth-card input:focus {
  border-color: var(--tw-accent);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(26,122,138,.15);
}
.auth-card .button.primary,
.auth-card button.primary {
  width: 100%;
  height: 44px;
  min-height: 44px;
  border: 0;
  border-radius: var(--tw-r-md);
  color: #fff;
  background: var(--tw-accent);
  font-weight: 600;
}
.auth-card .button.primary:hover,
.auth-card button.primary:hover { background: var(--tw-accent-dark); }
.auth-card .button.primary:active,
.auth-card button.primary:active { transform: scale(.98); }
.auth-link { margin: 16px 0 0; color: var(--tw-text-secondary); font-size: 13px; text-align: center; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
  color: var(--tw-text-secondary);
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--tw-border); }
.social-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.social-row .button {
  height: 40px;
  min-height: 40px;
  border: 1px solid var(--tw-border-strong);
  border-radius: var(--tw-r-md);
  background: rgba(255,255,255,.8);
  color: var(--tw-text-primary);
  font-weight: 600;
}
.auth-note {
  margin: 12px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--tw-accent);
  border-radius: var(--tw-r-md);
  background: var(--tw-accent-light);
  color: var(--tw-text-secondary);
  font-size: 12px;
}
.auth-back {
  position: absolute;
  left: 18px;
  top: 18px;
  color: var(--tw-text-secondary);
  font-size: 20px;
}
.pending-hero { text-align: center; }
.pending-icon {
  width: 108px;
  height: 108px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(230,244,246,.85);
  color: var(--tw-accent-dark);
  animation: pulse 2s infinite;
}
.notify-outline {
  width: 100%;
  height: 44px;
  border: 1.5px solid var(--tw-accent);
  border-radius: var(--tw-r-pill);
  color: var(--tw-accent);
  background: transparent;
}
.panel, .glass-panel, .glass-card, .admin-card, .update-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.screen > .panel:first-child {
  padding: 16px;
  background: var(--tw-bg-surface);
}
.screen > .panel:first-child .eyebrow { display: none; }
.screen > .panel:first-child h1 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
}
.search-input { margin: 12px 0 0; }
.search-input input {
  height: 36px;
  min-height: 36px;
  padding: 0 14px 0 36px;
  border: 0;
  border-radius: var(--tw-r-pill);
  background: var(--tw-bg-page);
  box-shadow: none;
}
.tabs {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--tw-border);
  border-radius: 0;
  background: var(--tw-bg-surface);
}
.tabs a {
  flex: 1;
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--tw-r-pill);
  color: var(--tw-text-secondary);
  font-size: 13px;
  font-weight: 600;
}
.tabs a.active {
  color: #fff;
  background: var(--tw-accent);
  box-shadow: none;
}
.list, .chat-list {
  display: block;
  overflow: auto;
  border-radius: 0;
  background: var(--tw-bg-surface);
}
.list-row, .chat-item {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid var(--tw-border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: background 100ms var(--tw-ease);
}
.list-row:hover, .chat-item:hover,
.list-row:active, .chat-item:active { background: var(--tw-accent-light); transform: none; box-shadow: none; }
.avatar {
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--tw-accent), #63B8C5);
  box-shadow: none;
  font-size: 16px;
  font-weight: 700;
}
.avatar.big { width: 80px; height: 80px; border-radius: 50%; border: 3px solid var(--tw-accent); font-size: 32px; }
.presence-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--tw-green);
}
.grow { min-width: 0; flex: 1; }
.grow strong { display: block; color: var(--tw-text-primary); font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow small { display: block; margin-top: 2px; color: var(--tw-text-secondary); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { display: grid; justify-items: end; gap: 5px; color: var(--tw-text-tertiary); font-size: 12px; }
.unread, .badge {
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0 7px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--tw-r-pill);
  color: #fff;
  background: var(--tw-accent);
  font-size: 10px;
  font-weight: 700;
}
.chat-head {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  color: var(--tw-text-primary);
  background: rgba(255,255,255,.85);
  border-bottom: 1px solid var(--tw-border);
  box-shadow: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.chat-head > a:first-child {
  width: 28px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--tw-text-secondary);
  background: transparent;
  border-radius: 0;
  font-size: 20px;
  font-weight: 700;
}
.chat-head .avatar { width: 38px; height: 38px; flex-basis: 38px; }
.chat-head strong { display: block; color: var(--tw-text-primary); font-size: 15px; font-weight: 600; }
.chat-head small { display: block; color: var(--tw-text-secondary); font-size: 12px; }
.chat-head .info-link { margin-left: auto; color: var(--tw-text-secondary); font-size: 13px; font-weight: 600; }
.messages {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  padding: 16px;
  background: var(--tw-bg-surface);
}
.bubble, .message-bubble, .tw-bubble {
  max-width: 65%;
  padding: 8px 12px;
  border: 0;
  box-shadow: none;
  overflow-wrap: anywhere;
  animation: tw-bubble-in 180ms var(--tw-ease) both;
}
.bubble.mine, .message-bubble.mine, .message-bubble.sent {
  align-self: flex-end;
  color: var(--tw-bubble-sent-text);
  background: var(--tw-bubble-sent-bg);
  border-radius: 16px 4px 16px 16px;
}
.bubble.theirs, .message-bubble.theirs, .message-bubble.received {
  align-self: flex-start;
  color: var(--tw-bubble-recv-text);
  background: var(--tw-bubble-recv-bg);
  border-radius: 4px 16px 16px 16px;
}
.bubble p, .message-bubble p { margin: 0 0 4px; color: inherit; font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.message-meta, .bubble small {
  display: block;
  color: rgba(255,255,255,.72);
  font-size: 11px;
  text-align: right;
}
.theirs .message-meta, .received .message-meta, .bubble.theirs small { color: var(--tw-text-tertiary); }
.read { color: #65D7FF; }
.sender-name { display: block; margin-bottom: 4px; color: var(--tw-accent-dark); font-size: 12px; font-weight: 600; }
.composer {
  position: static;
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 16px;
  border: 0;
  border-top: 1px solid var(--tw-border);
  border-radius: 0;
  background: var(--tw-bg-surface);
  box-shadow: none;
  transform: none;
}
.composer textarea {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 14px;
  resize: none;
  border: 1px solid var(--tw-border-strong);
  border-radius: var(--tw-r-xl);
  background: var(--tw-bg-page);
  box-shadow: none;
}
.composer button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--tw-accent);
  font-size: 0;
  transition: background 150ms, opacity 150ms, transform 80ms;
}
.composer button::before { content: "➤"; font-size: 16px; }
.composer button.is-empty { background: var(--tw-border-strong); }
.composer button.is-empty::before { content: "🎙"; font-size: 14px; }
.composer-tools { display: flex; gap: 4px; }
.attach, .icon-button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--tw-text-tertiary);
  background: transparent;
  font-size: 18px;
}
.camera-button { font-size: 11px; }
.attach input { display: none; }
.media-thumb { border-radius: var(--tw-r-md); background: var(--tw-bg-page); }
.media-card, .doc-card {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--tw-border-strong);
  border-radius: var(--tw-r-md);
  color: var(--tw-text-primary);
  background: var(--tw-bg-surface);
}
.alert, .toast {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--tw-border);
  border-radius: var(--tw-r-md);
  background: var(--tw-accent-light);
  color: var(--tw-text-primary);
}
.alert.danger, .toast.danger { color: var(--tw-red); background: rgba(239,68,68,.10); }
.alert.success, .toast.success { color: #166534; background: #DCFCE7; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 90;
  width: min(420px, calc(100% - 28px));
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
  box-shadow: var(--tw-shadow-md);
  transition: opacity 160ms var(--tw-ease), transform 160ms var(--tw-ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.status-pill {
  display: inline-grid;
  place-items: center;
  min-height: 22px;
  padding: 3px 10px;
  border-radius: var(--tw-r-pill);
  color: var(--tw-accent);
  background: var(--tw-accent-light);
  font-size: 12px;
  font-weight: 600;
}
.status-pill.approved { background: #DCFCE7; color: #166534; }
.status-pill.pending { background: #FEF9C3; color: #854D0E; }
.status-pill.blocked { background: #FEE2E2; color: #991B1B; }
.profile-shell, .settings-shell { display: grid; gap: 16px; }
.settings-menu {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-right: 1px solid var(--tw-border);
  background: var(--tw-bg-surface);
}
.settings-menu a {
  padding: 10px 14px;
  border-radius: var(--tw-r-md);
  color: var(--tw-text-secondary);
  font-size: 14px;
}
.settings-menu a.active { color: var(--tw-accent); background: var(--tw-accent-light); }
.settings-menu .logout-link { margin-top: auto; color: var(--tw-red); }
.profile-card {
  padding: 20px;
  background: var(--tw-bg-surface);
}
.profile-fields label {
  display: grid;
  gap: 4px;
  color: var(--tw-text-tertiary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.profile-fields input, .profile-fields textarea {
  min-height: 40px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--tw-border-strong);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.settings-toggle {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-toggle input[type="checkbox"] {
  appearance: none;
  width: 44px;
  height: 26px;
  min-height: 26px;
  padding: 3px;
  border: 0;
  border-radius: 13px;
  background: var(--tw-border-strong);
  transition: background 200ms var(--tw-ease);
}
.settings-toggle input[type="checkbox"]::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 200ms var(--tw-ease);
}
.settings-toggle input[type="checkbox"]:checked { background: var(--tw-accent); }
.settings-toggle input[type="checkbox"]:checked::before { transform: translateX(18px); }
.group-avatar, .chat-item[href*="group-chat"] .avatar {
  background: linear-gradient(135deg, #6A9BA6, var(--tw-accent));
}
.read-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--tw-text-secondary);
  font-size: 11px;
}
.read-strip .mini-avatar {
  width: 18px;
  height: 18px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: var(--tw-accent-light);
}
.quote-card {
  width: 100%;
  min-height: 0;
  display: grid;
  gap: 2px;
  margin-bottom: 6px;
  padding: 7px 9px;
  border: 0;
  border-left: 3px solid var(--tw-accent);
  border-radius: var(--tw-r-sm);
  color: inherit;
  background: rgba(255,255,255,.28);
  text-align: left;
  box-shadow: none;
}
.quote-card strong { font-size: 12px; }
.quote-card span { overflow: hidden; color: inherit; opacity: .72; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.forwarded-label {
  display: block;
  margin-bottom: 3px;
  color: inherit;
  opacity: .72;
  font-size: 11px;
  font-style: italic;
}
.reaction-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.reaction-pill {
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--tw-border);
  border-radius: var(--tw-r-pill);
  color: var(--tw-text-primary);
  background: rgba(255,255,255,.72);
  font-size: 12px;
}
.reply-preview {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 6px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 9px 12px;
  border-left: 3px solid var(--tw-accent);
  border-radius: var(--tw-r-md);
  background: var(--tw-bg-surface);
  box-shadow: var(--tw-shadow-md);
}
.reply-preview strong { font-size: 12px; }
.reply-preview span { overflow: hidden; color: var(--tw-text-secondary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.reply-preview button { grid-row: 1 / span 2; grid-column: 2; min-height: 28px; padding: 0 8px; border-radius: var(--tw-r-pill); }
.emoji-trigger {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--tw-text-tertiary);
  background: transparent;
  font-size: 18px;
}
.emoji-picker {
  position: absolute;
  right: 58px;
  bottom: calc(100% + 8px);
  z-index: 40;
  width: 248px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--tw-border);
  border-radius: var(--tw-r-lg);
  background: var(--tw-bg-surface);
  box-shadow: var(--tw-shadow-lg);
}
.emoji-picker button {
  min-height: 28px;
  padding: 0;
  border-radius: var(--tw-r-sm);
  background: transparent;
  font-size: 18px;
}
.twalk-lightbox,
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15,25,35,.78);
}
.twalk-lightbox img {
  max-width: min(980px, 96vw);
  max-height: 88vh;
  border-radius: var(--tw-r-lg);
  box-shadow: var(--tw-shadow-lg);
}
.twalk-lightbox button {
  position: fixed;
  right: 18px;
  top: 18px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(0,0,0,.4);
  font-size: 26px;
}
.search-box {
  width: min(620px, 100%);
  max-height: 82vh;
  overflow: auto;
  padding: 18px;
  border-radius: var(--tw-r-xl);
  background: var(--tw-bg-surface);
  box-shadow: var(--tw-shadow-lg);
}
.search-box > button { float: right; min-height: 32px; padding: 0 10px; border-radius: var(--tw-r-pill); }
.search-result {
  padding: 12px 0;
  border-bottom: 1px solid var(--tw-border);
}
.search-result p { margin-top: 4px; color: var(--tw-text-primary); }
.file-icon {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 4px;
  border-radius: var(--tw-r-sm);
  color: #fff;
  background: var(--tw-accent);
  font-size: 11px;
  font-weight: 800;
}
@media (min-width: 768px) {
  .settings-shell { grid-template-columns: 200px 1fr; background: var(--tw-bg-surface); }
}
@keyframes tw-bubble-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes tw-dot-bounce { 0%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-4px); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
.tw-btn:active { transform: scale(.97); transition: transform 80ms; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
