.chat-app {
  display: flex;
  height: 100vh;
  background: #0a0a1a;
  color: #e0e0e0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-sidebar {
  width: 260px;
  background: #0d0d2b;
  border-right: 1px solid #1a1a3e;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-sidebar-title {
  padding: 16px 20px;
  margin: 0;
  font-size: 16px;
  color: #a8d8ea;
  border-bottom: 1px solid #1a1a3e;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.room-list {
  list-style: none;
  padding: 8px 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}

.room-list li {
  padding: 12px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  font-size: 14px;
}

.room-list li:hover {
  background: #1a1a3e;
}

.room-list li.active {
  background: #16213e;
  border-left-color: #d4a843;
  color: #fff;
}

.room-list .room-realm {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.chat-user-info {
  padding: 12px 20px;
  border-top: 1px solid #1a1a3e;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-username {
  font-size: 13px;
  color: #888;
}

.chat-logout-btn {
  background: none;
  border: 1px solid #333;
  color: #888;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.chat-logout-btn:hover {
  border-color: #e94560;
  color: #e94560;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.jump-to-latest {
  position: absolute;
  right: 24px;
  bottom: 72px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #16213e;
  border: 1px solid #1a1a3e;
  color: #a8d8ea;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

.jump-to-latest.show {
  display: flex;
}

.jump-to-latest:hover {
  border-color: #d4a843;
  color: #d4a843;
}

.chat-header {
  padding: 12px 20px;
  border-bottom: 1px solid #1a1a3e;
  background: #0d0d2b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #16213e;
  color: #a8d8ea;
  border: 1px solid #1a1a3e;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.chat-header-btn:hover {
  border-color: #d4a843;
  color: #d4a843;
}

.chat-room-name {
  margin: 0;
  font-size: 15px;
  color: #d4a843;
}

.pinned-view-btn {
  background: #16213e;
  color: #a8d8ea;
  border: 1px solid #1a1a3e;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.pinned-view-btn:hover {
  border-color: #d4a843;
  color: #d4a843;
}

.pinned-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 26, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.pinned-modal-box {
  width: 560px;
  max-width: 92vw;
  max-height: 75vh;
  background: #12122c;
  border: 1px solid #1a1a3e;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pinned-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #1a1a3e;
  background: #0d0d2b;
}

.pinned-modal-title {
  margin: 0;
  font-size: 15px;
  color: #d4a843;
}

.pin-close-btn {
  background: transparent;
  border: none;
  color: #a8d8ea;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.pin-close-btn:hover {
  color: #e94560;
}

.pinned-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pinned-empty {
  color: #666;
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

.pinned-item {
  background: #1a1a2e;
  border: 1px solid #222244;
  border-left: 3px solid #d4a843;
  border-radius: 6px;
  padding: 8px 12px;
}

.pinned-item-head {
  font-size: 11px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pinned-item-author {
  color: #a8d8ea;
  font-weight: 600;
}

.pinned-item-by {
  color: #d4a843;
}

.pinned-item-body {
  margin-top: 4px;
  font-size: 13px;
  color: #e0e0e0;
  cursor: pointer;
}

.pinned-item-body:hover {
  color: #a8d8ea;
}

.pinned-item-actions {
  margin-top: 6px;
  text-align: right;
}

.pinned-unpin-btn {
  background: transparent;
  border: 1px solid #1a1a3e;
  color: #a8d8ea;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
}

.pinned-unpin-btn:hover {
  border-color: #e94560;
  color: #e94560;
}

.message-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-item {
  max-width: 75%;
  padding: 8px 14px;
  border-radius: 8px;
  line-height: 1.4;
  font-size: 14px;
}

.message-item.own {
  align-self: flex-end;
  background: #16213e;
  border: 1px solid #1a1a3e;
}

.message-item.other {
  align-self: flex-start;
  background: #1a1a2e;
  border: 1px solid #222244;
}

.message-item.pinned {
  border-color: #d4a843;
  box-shadow: 0 0 0 1px rgba(212, 168, 67, 0.45);
}

.message-item.flash {
  animation: pinned-flash 2.5s ease;
}

@keyframes pinned-flash {
  0% { background: #2a2438; box-shadow: 0 0 0 2px rgba(212, 168, 67, 0.9); }
  100% { background: inherit; box-shadow: 0 0 0 1px rgba(212, 168, 67, 0.45); }
}

.message-meta {
  font-size: 11px;
  color: #666;
  margin-bottom: 3px;
}

.message-meta .message-author {
  color: #a8d8ea;
  font-weight: 600;
}

.message-meta .message-time {
  margin-left: 8px;
}

.message-pin-badge {
  margin-left: 8px;
  color: #d4a843;
  font-size: 10px;
}

.message-text {
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.pin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #a8d8ea;
  padding: 3px 5px;
  border-radius: 4px;
  opacity: 0.35;
  line-height: 1;
}

.pin-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.pin-btn.pinned {
  opacity: 1;
  color: #d4a843;
}

.del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #a8d8ea;
  padding: 3px 5px;
  border-radius: 4px;
  opacity: 0.35;
  line-height: 1;
}

.del-btn:hover {
  opacity: 1;
  color: #e94560;
  background: rgba(255, 255, 255, 0.08);
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #a8d8ea;
  padding: 3px 5px;
  border-radius: 4px;
  opacity: 0.35;
  line-height: 1;
}

.reaction-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #16213e;
  border: 1px solid #1a1a3e;
  border-radius: 12px;
  color: #e0e0e0;
  font-size: 12px;
  padding: 2px 8px;
  cursor: pointer;
}

.reaction-pill:hover {
  border-color: #d4a843;
}

.reaction-pill.mine {
  border-color: #d4a843;
  background: rgba(212, 168, 67, 0.15);
}

.reaction-emoji {
  font-size: 13px;
  line-height: 1.2;
}

.reaction-count {
  font-size: 11px;
  color: #a8d8ea;
}

.reaction-picker {
  position: fixed;
  z-index: 50;
  width: 240px;
  max-height: 200px;
  overflow-y: auto;
  background: #12122c;
  border: 1px solid #1a1a3e;
  border-radius: 8px;
  padding: 8px;
  display: none;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.reaction-picker-option {
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1.4;
  cursor: pointer;
  border-radius: 4px;
  padding: 2px;
}

.reaction-picker-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.chat-input-area {
  padding: 12px 20px;
  border-top: 1px solid #1a1a3e;
  background: #0d0d2b;
  display: flex;
  gap: 10px;
}

.emoji-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.emoji-btn {
  background: #16213e;
  border: 1px solid #1a1a3e;
  border-radius: 6px;
  color: #a8d8ea;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}

.emoji-btn:hover:not(:disabled) {
  border-color: #d4a843;
  color: #d4a843;
}

.emoji-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.emoji-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 250px;
  max-height: 190px;
  overflow-y: auto;
  background: #12122c;
  border: 1px solid #1a1a3e;
  border-radius: 8px;
  padding: 8px;
  display: none;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.emoji-option {
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1.4;
  cursor: pointer;
  border-radius: 4px;
  padding: 2px;
}

.emoji-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.message-input {
  flex: 1;
  background: #16213e;
  border: 1px solid #1a1a3e;
  border-radius: 6px;
  padding: 10px 14px;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
}

.message-input:focus {
  border-color: #d4a843;
}

.message-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.send-btn {
  background: #d4a843;
  color: #0a0a1a;
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.send-btn:hover:not(:disabled) {
  background: #e94560;
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.auth-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: #0a0a1a;
}

.auth-card {
  background: #0d0d2b;
  border: 1px solid #1a1a3e;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  color: #e0e0e0;
}

.auth-card h2 {
  color: #d4a843;
  margin-bottom: 10px;
}

.auth-card p {
  color: #888;
  margin-bottom: 24px;
}

.auth-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}

.auth-btn-employee {
  background: #d4a843;
  color: #0a0a1a;
}

.auth-btn-employee:hover {
  background: #e94560;
}

.auth-btn-customer {
  background: #16213e;
  color: #a8d8ea;
  border: 1px solid #a8d8ea;
}

.auth-btn-customer:hover {
  background: #1a1a3e;
}

.chat-notice {
  text-align: center;
  color: #666;
  font-size: 13px;
  padding: 8px;
  background: #0d0d2b;
  border-radius: 4px;
  margin: 4px 0;
}

@media (max-width: 768px) {
  .chat-sidebar {
    width: 200px;
  }
  .message-item {
    max-width: 90%;
  }
}