/* Modern, clean UI for web_wechat */

:root {
  --color-primary: #07c160;
  --color-primary-dark: #06ad56;
  --color-primary-light: #e8f8ef;
  --color-bg: #f5f6f7;
  --color-surface: #ffffff;
  --color-text: #191919;
  --color-text-secondary: #888888;
  --color-text-muted: #b2b2b2;
  --color-border: #ededed;
  --color-border-light: #f5f5f5;
  --color-success: #07c160;
  --color-success-bg: #e8f8ef;
  --color-warning: #fa9d3b;
  --color-warning-bg: #fff8f0;
  --color-error: #fa5151;
  --color-error-bg: #fef0f0;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
  --transition: 0.2s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--color-primary-dark);
}

h1, h2, h3 {
  margin: 0 0 8px 0;
  font-weight: 600;
  line-height: 1.3;
}
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

p { margin: 0 0 12px 0; }
code {
  font-family: "SF Mono", Monaco, Consolas, monospace;
  font-size: 12px;
  background: var(--color-border-light);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
}

/* ===== TOPBAR ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand:hover {
  color: var(--color-primary-dark);
}
.brand::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8.5 14.5L3 12l9-9 9 9-5.5 2.5L12 18l-3.5-3.5z'/%3E%3C/svg%3E");
  background-size: 16px;
  background-repeat: no-repeat;
  background-position: center;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav a {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}
.nav a:hover {
  color: var(--color-text);
  background: var(--color-border-light);
}
.nav a.active {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--color-text-secondary);
}
.pill strong {
  color: var(--color-text);
  font-weight: 500;
}

/* ===== CONTAINER ===== */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 20px;
}

.container--narrow {
  max-width: 420px;
}

.container--center {
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ===== GRID ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.grid--equal {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 720px) {
  .grid, .grid--equal {
    grid-template-columns: 1fr;
  }
}

/* ===== CARD ===== */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.card--highlight {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.card h2 {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border-light);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border-light);
}

.card__header h2 {
  margin: 0;
  padding: 0;
  border: 0;
}

/* ===== FORMS ===== */
label {
  display: block;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

label .muted {
  font-weight: 400;
}

input, select, textarea {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  transition: all var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

input::placeholder {
  color: var(--color-text-muted);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--color-primary);
  color: white;
  text-decoration: none;
}

.btn:hover {
  background: var(--color-primary-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.btn--ghost:hover {
  background: var(--color-border-light);
  color: var(--color-text);
  box-shadow: none;
}

.btn--outline {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}
.btn--outline:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  box-shadow: none;
}

.btn--danger {
  background: var(--color-error);
}
.btn--danger:hover {
  background: #e04545;
}

.btn--small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn--block {
  width: 100%;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ===== ALERTS ===== */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert--ok {
  background: var(--color-success-bg);
  color: #059048;
  border: 1px solid #b8e6ce;
}

.alert--error {
  background: var(--color-error-bg);
  color: #c23c3c;
  border: 1px solid #fcd0d0;
}

.alert--warning {
  background: var(--color-warning-bg);
  color: #b06d1a;
  border: 1px solid #fde3c8;
}

.alert--muted {
  background: var(--color-border-light);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: var(--color-border-light);
  color: var(--color-text-secondary);
}

.badge--ok {
  background: var(--color-success-bg);
  color: #059048;
}

.badge--star {
  background: #fff6d6;
  color: #a15c00;
  border: 1px solid #ffe7a3;
}

.badge--label {
  background: #eef2ff;
  color: #4f46e5;
  border: 1px solid #e0e7ff;
}

.badge--warn {
  background: var(--color-warning-bg);
  color: #b06d1a;
}

.badge--error {
  background: var(--color-error-bg);
  color: #c23c3c;
}

.badge--muted {
  background: var(--color-border-light);
  color: var(--color-text-muted);
}

/* ===== TABLES ===== */
.table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
}

.table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: var(--color-border-light);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.right { text-align: right; }
.center { text-align: center; }

/* ===== AVATAR ===== */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--color-border-light);
}

.avatar--placeholder {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-border) 0%, var(--color-border-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar--placeholder::after {
  content: "";
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b2b2b2'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
  background-size: contain;
}

.avatar--sm {
  width: 32px;
  height: 32px;
}

.avatar--lg {
  width: 56px;
  height: 56px;
}

/* ===== QR CODE ===== */
.qr {
  width: 200px;
  height: 200px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: 8px;
}

.qr-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--color-border-light);
  border-radius: var(--radius-md);
}

/* ===== MUTED TEXT ===== */
.muted {
  color: var(--color-text-secondary);
  font-size: 13px;
}

.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }

/* ===== LIST ===== */
.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.list li:last-child {
  border-bottom: none;
}

/* ===== AUTH PAGES ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(180deg, var(--color-bg) 0%, #e8e8e8 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-card__logo {
  width: 64px;
  height: 64px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card__logo::after {
  content: "";
  width: 32px;
  height: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z'/%3E%3C/svg%3E");
  background-size: contain;
}

.auth-card h1 {
  font-size: 22px;
  margin-bottom: 8px;
}

.auth-card .muted {
  margin-bottom: 24px;
}

.auth-card form {
  text-align: left;
}

.auth-card .btn {
  width: 100%;
  margin-top: 8px;
  padding: 12px 20px;
}

.auth-card__footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border-light);
  font-size: 14px;
  color: var(--color-text-secondary);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-secondary);
}

.empty-state__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== ACCOUNT ROW ===== */
.account-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}

.account-row:hover {
  background: var(--color-border-light);
}

.account-row__info {
  flex: 1;
  min-width: 0;
}

.account-row__name {
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-row__id {
  font-size: 12px;
  color: var(--color-text-muted);
  font-family: "SF Mono", Monaco, Consolas, monospace;
}

/* ===== CONTACTS ===== */
.contact-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.contact-search {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  max-width: 420px;
}

.contact-search input {
  flex: 1;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition), box-shadow var(--transition);
}

.contact-item:hover {
  background: var(--color-border-light);
  box-shadow: var(--shadow-sm);
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  font-family: "SF Mono", Monaco, Consolas, monospace;
}

.contact-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.contact-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contact-detail {
  display: flex;
  align-items: center;
  gap: 16px;
}

.contact-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-light);
}

.action-row:last-child {
  border-bottom: none;
}

.contact-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.label-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.label-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-border-light);
  font-size: 13px;
  cursor: pointer;
}

.label-pill input {
  width: auto;
  margin: 0;
}

.label-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.label-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-border-light);
}

/* ===== GROUPS ===== */
.member-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.member-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  font-family: "SF Mono", Monaco, Consolas, monospace;
}

/* ===== CHAT LAYOUT ===== */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
}

.chat-sidebar {
  background: #f7f7f7;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  min-height: 560px;
}

.chat-sidebar__header {
  padding: 16px;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-list {
  display: flex;
  flex-direction: column;
}

.chat-list__item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-light);
  color: inherit;
  text-decoration: none;
  transition: background var(--transition);
}

.chat-list__item:hover {
  background: var(--color-border-light);
}

.chat-list__item.active {
  background: #e7f6e3;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.chat-list__content {
  flex: 1;
  min-width: 0;
}

.chat-list__title {
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list__preview {
  font-size: 12px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list__meta {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.chat-main {
  background: #ededed;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  min-height: 560px;
  box-shadow: var(--shadow-sm);
}

.chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 520px;
  background: #f5f5f5;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  overflow: hidden;
}

.chat-title {
  padding: 10px 14px;
  background: #f7f7f7;
  border-bottom: 1px solid #e1e1e1;
  font-size: 14px;
}

.chat-title .red {
  color: #e74c3c;
  margin-right: 6px;
  font-weight: 600;
}

.chat-content {
  flex: 1;
  overflow: auto;
  padding: 16px 16px 8px;
}

.chat-content-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-send {
  border-top: 1px solid #e1e1e1;
  background: #ffffff;
  padding: 6px 10px 10px;
}

.tools ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  margin: 0;
}

.tools {
  position: relative;
}

.tool-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  color: #666666;
  padding: 4px;
  border-radius: 6px;
}

.tool-btn:hover {
  background: #f0f0f0;
}

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

.emoji-panel,
.media-panel {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 8px;
  background: #fafafa;
  margin: 6px 0;
}

.emoji-popover {
  position: fixed;
  width: 300px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  padding: 6px;
  z-index: 50;
}

.emoji-popover__inner {
  max-height: 220px;
  overflow: auto;
}

.emoji-popover__arrow {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ffffff;
  transform: rotate(45deg);
  left: var(--emoji-arrow-left, 16px);
}

.emoji-popover--above .emoji-popover__arrow {
  bottom: -5px;
  border-right: 1px solid #e5e5e5;
  border-bottom: 1px solid #e5e5e5;
}

.emoji-popover--below .emoji-popover__arrow {
  top: -5px;
  border-left: 1px solid #e5e5e5;
  border-top: 1px solid #e5e5e5;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: 12px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 70%;
  list-style: none;
}

.chat-message--out {
  align-self: flex-end;
}

.chat-message--in {
  align-self: flex-start;
}

.chat-message__bubble {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid #e6e6e6;
  word-break: break-word;
}

.chat-message--out .chat-message__bubble {
  background: #95ec69;
  color: #1f2a1f;
  border-color: #87da60;
}

.chat-message__meta {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.chat-message--in .chat-message__meta {
  justify-content: flex-start;
}

.media-img {
  max-width: 260px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.media-emoji {
  width: 90px;
  height: 90px;
}

.media-video {
  max-width: 320px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.media-placeholder {
  padding: 10px 12px;
  background: var(--color-border-light);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--color-text-secondary);
}

.media-actions {
  margin-top: 8px;
}

.media-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.media-file__name {
  font-weight: 500;
  word-break: break-all;
}

.inline-emoji {
  width: 20px;
  height: 20px;
  vertical-align: text-bottom;
}

.media-link {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.media-link__content {
  flex: 1;
  min-width: 0;
}

.media-link__title {
  font-weight: 600;
  margin-bottom: 4px;
}

.media-link__thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 8px;
  max-height: 200px;
  overflow: auto;
  padding: 8px;
  background: var(--color-border-light);
  border-radius: var(--radius-md);
}

.emoji-btn {
  border: none;
  background: transparent;
  padding: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.emoji-btn:hover {
  background: var(--color-primary-light);
}

.emoji-btn img {
  width: 24px;
  height: 24px;
}

.chat-emoji h3 {
  margin: 0 0 8px 0;
}

.image-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.image-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.image-modal__content {
  position: relative;
  z-index: 1;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.image-modal__content img {
  max-width: 80vw;
  max-height: 70vh;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.image-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.chat-composer {
  margin-top: 12px;
  border-top: 1px solid var(--color-border-light);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-composer textarea {
  resize: vertical;
  min-height: 70px;
}

.chat-composer__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.send textarea {
  border: none;
  background: transparent;
  padding: 8px 10px;
  min-height: 70px;
}

.send textarea:focus {
  border: none;
  box-shadow: none;
}

.chat-media {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-media h3 {
  margin: 0;
}

.chat-media__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ===== STEPS ===== */
.steps {
  margin: 8px 0 0 18px;
  padding: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.steps li {
  margin-bottom: 6px;
}

/* ===== LOADING SPINNER ===== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== UTILITY ===== */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ===== MOBILE ADJUSTMENTS ===== */
@media (max-width: 600px) {
  .topbar {
    padding: 0 12px;
    height: 52px;
  }
  
  .topbar__left {
    gap: 12px;
  }
  
  .brand::before {
    display: none;
  }
  
  .nav {
    gap: 0;
  }
  
  .nav a {
    padding: 8px 10px;
    font-size: 13px;
  }
  
  .pill {
    display: none;
  }
  
  .container {
    padding: 16px 12px;
  }
  
  .card {
    padding: 20px 16px;
  }
  
  .auth-card {
    padding: 32px 24px;
  }
  
  h1 { font-size: 20px; }
  h2 { font-size: 16px; }

  .chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    min-height: auto;
  }

  .chat-main {
    min-height: auto;
  }

  .contact-info-grid {
    grid-template-columns: 1fr;
  }
}
