/* HoomanChat v3.0 - National Internet Edition */
:root {
  /* Dark Theme (Default) */
  --bg: #0e1621;
  --panel: #17212b;
  --panel2: #1f2c3a;
  --panel3: #2a3a4d;
  --text: #e6eef6;
  --text-secondary: #9fb0c0;
  --text-muted: #6d7f91;
  --primary: #2ea6ff;
  --primary-dark: #1a8cd8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --bubble: #223040;
  --bubble-me: #2b5278;
  --bubble-system: #374151;
  --border: rgba(255, 255, 255, 0.07);
  --border-light: rgba(255, 255, 255, 0.04);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Vazirmatn", "Segoe UI", Tahoma, system-ui, -apple-system, sans-serif;
  --font-mono: "Consolas", "Monaco", "Courier New", monospace;
}

[data-theme="light"] {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel2: #f8fafc;
  --panel3: #f1f5f9;
  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --bubble: #ffffff;
  --bubble-me: #dbeafe;
  --bubble-system: #f1f5f9;
  --border: rgba(0, 0, 0, 0.07);
  --border-light: rgba(0, 0, 0, 0.04);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary);
}

.mono {
  font-family: var(--font-mono);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* Buttons & Forms */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  outline: none;
  position: relative;
  overflow: hidden;
}

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

.btn:not(:disabled):active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #071019;
  border: 1px solid var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--panel3);
  border-color: var(--border-light);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: 1px solid var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-light);
}

.btn-success {
  background: var(--success);
  color: white;
  border: 1px solid var(--success);
}

.btn-success:hover:not(:disabled) {
  background: #059669;
  border-color: #059669;
}

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

.btn-lg {
  padding: 14px 24px;
  font-size: 16px;
}

.btn-full {
  width: 100%;
}

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.pill:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-light);
  text-decoration: none;
}

.pill.active {
  background: rgba(46, 166, 255, 0.12);
  border-color: rgba(46, 166, 255, 0.35);
  color: var(--primary);
}

.pill.small {
  padding: 5px 10px;
  font-size: 12px;
}

/* Alerts & Notifications */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  border: 1px solid;
  font-size: 14px;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--warning);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--info);
}

/* Forms */
label {
  display: block;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  outline: none;
  font-family: var(--font);
  font-size: 15px;
  transition: all 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(46, 166, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(46, 166, 255, 0.1);
}

input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.form-row > * {
  flex: 1;
}

.checkbox,
.radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox input,
.radio input {
  width: auto;
  margin: 0;
}

/* Hints & Help Text */
.hint {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 6px;
  line-height: 1.4;
}

/* Links */
.link {
  color: var(--primary);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

/* Login Page */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: linear-gradient(135deg, var(--bg) 0%, var(--panel) 100%);
  min-height: 100vh;
}

.login-card {
  width: min(420px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brand {
  font-weight: 900;
  font-size: 24px;
  text-align: center;
  margin-bottom: 8px;
  color: var(--primary);
}

.subtitle {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
  font-size: 14px;
}

/* App Layout */
.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 360px 1fr;
  overflow: hidden;
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 300px 1fr;
  }
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    display: none;
  }
  
  .sidebar.active {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
  }
}

.sidebar {
  border-left: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel) 0%, rgba(23, 33, 43, 0.98) 100%);
  display: flex;
  flex-direction: column;
  min-width: 260px;
  position: relative;
  z-index: 10;
}

.sidebar-top {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.me {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(46, 166, 255, 0.9), rgba(110, 231, 183, 0.7));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #071019;
  overflow: hidden;
  flex: 0 0 44px;
  border: 2px solid var(--border);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar.small {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

.avatar.medium {
  width: 56px;
  height: 56px;
  font-size: 20px;
}

.avatar.big {
  width: 84px;
  height: 84px;
  font-size: 28px;
  border-radius: 20px;
}

.me-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.me-name {
  font-weight: 800;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.me-sub {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Sidebar Tabs */
.sidebar-tabs {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  transition: all 0.2s;
}

.tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--text);
  border-color: rgba(46, 166, 255, 0.55);
  background: rgba(46, 166, 255, 0.12);
}

.tab-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.tab-panel.active {
  display: flex;
}

.sidebar-title {
  padding: 12px 16px 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* Room Lists */
.room-list {
  overflow: auto;
  flex: 1;
  padding: 4px 0;
}

.room-list.compact {
  max-height: 200px;
}

.room-item {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.room-item:first-child {
  border-top: none;
}

.room-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.room-item.active {
  background: rgba(46, 166, 255, 0.12);
  border-left: 3px solid var(--primary);
}

.room-item .meta {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.room-item .title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-item .subtitle {
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.room-item.muted {
  color: var(--text-muted);
  cursor: default;
}

.room-item.muted:hover {
  background: transparent;
}

.room-item.unread::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

/* User Rows */
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.user-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.user-row .uavatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex: 0 0 40px;
}

.user-row .uavatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-row .uname {
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 2px;
}

.user-row .ubio {
  color: var(--text-muted);
  font-size: 12px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-row .ustatus {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-left: auto;
}

.user-row .ustatus.online {
  background: var(--success);
}

.user-row .ustatus.away {
  background: var(--warning);
}

.user-row .ustatus.busy {
  background: var(--danger);
}

/* Chat Area */
.chat {
  display: flex;
  flex-direction: column;
  background: radial-gradient(1200px 700px at 50% 20%, rgba(46, 166, 255, 0.08), transparent 55%),
              radial-gradient(1200px 700px at 30% 80%, rgba(110, 231, 183, 0.05), transparent 55%);
  position: relative;
}

.chat-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(23, 33, 43, 0.8);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
  z-index: 5;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.chat-header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: var(--text-muted);
  overflow: hidden;
  flex: 0 0 44px;
}

.chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-title {
  font-weight: 800;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.offline {
  background: rgba(239, 68, 68, 0.7);
}

.dot.online {
  background: rgba(16, 185, 129, 0.85);
}

.dot.connecting {
  background: rgba(245, 158, 11, 0.85);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Messages */
.messages {
  flex: 1;
  overflow: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.msg-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: messageAppear 0.3s ease;
}

@keyframes messageAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-row.me {
  flex-direction: row-reverse;
}

.msg-row.system {
  justify-content: center;
}

.msg-row.system .msg {
  background: var(--bubble-system);
  border-color: var(--border);
  max-width: 80%;
  text-align: center;
  font-size: 13px;
  padding: 8px 16px;
}

.msg-row .mavatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: var(--text-muted);
  flex: 0 0 36px;
  margin-top: 4px;
}

.msg-row .mavatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg-row.me .mavatar {
  display: none;
}

.msg {
  max-width: min(680px, 75%);
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--bubble);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.msg.me {
  background: var(--bubble-me);
  border-color: rgba(46, 166, 255, 0.2);
}

.msg .top {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.msg .user {
  font-weight: 800;
  font-size: 14px;
  color: var(--primary);
}

.msg.me .user {
  color: inherit;
}

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

.msg .body {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 14.5px;
}

.msg .body a {
  color: var(--primary);
  text-decoration: underline;
}

.msg .body a:hover {
  text-decoration: none;
}

.msg .edited {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 4px;
  font-style: italic;
}

.msg .reply {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  font-size: 13px;
}

.msg .reply .reply-user {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 2px;
}

.msg .reply .reply-body {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg .file {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.msg .file .name {
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.msg .file .meta {
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg .file img {
  max-width: 240px;
  max-height: 240px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.msg .file .actions {
  display: flex;
  gap: 8px;
}

/* Composer */
.composer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: flex-end;
  background: rgba(23, 33, 43, 0.7);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.composer textarea {
  min-height: 46px;
  max-height: 200px;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  padding: 12px;
  resize: none;
}

.file-input {
  display: none;
}

.upload-preview {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.upload-preview .preview-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.upload-preview .preview-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-preview .preview-size {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal.active {
  display: flex;
}

.modal-card {
  width: min(540px, 95vw);
  max-height: 90vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-weight: 800;
  font-size: 18px;
  flex: 1;
}

.modal-body {
  padding: 20px;
  overflow: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

/* Admin Pages */
.admin-body {
  padding: 20px;
  min-height: 100vh;
  background: var(--bg);
}

.admin-shell {
  max-width: 1200px;
  margin: 0 auto;
}

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.admin-top .brand {
  font-size: 24px;
  font-weight: 900;
  color: var(--primary);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

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

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  color: var(--text);
}

.row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.row > * {
  flex: 1;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* Tables */
.table {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 16px 0;
}

.thead,
.trow {
  display: grid;
  padding: 0;
}

.thead {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.thead > div,
.trow > div {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  min-height: 44px;
}

.trow:last-child > div {
  border-bottom: none;
}

/* Specific table layouts */
.thead.users,
.trow.users {
  grid-template-columns: 1.2fr 0.7fr 0.5fr 1fr;
}

.thead.rooms,
.trow.rooms {
  grid-template-columns: 1.5fr 0.7fr 0.6fr 0.9fr 0.5fr;
}

.thead.uploads,
.trow.uploads {
  grid-template-columns: 1.6fr 0.7fr 0.7fr 0.5fr 0.9fr 0.5fr;
}

/* Checkboxes */
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.check input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* Loading States */
.loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
}

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

.skeleton {
  background: linear-gradient(90deg, var(--panel2) 25%, var(--panel3) 50%, var(--panel2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Selection */
::selection {
  background: rgba(46, 166, 255, 0.3);
  color: inherit;
}

/* Focus outlines */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .sidebar,
  .composer,
  .chat-header-right,
  button {
    display: none !important;
  }
  
  .chat {
    background: white !important;
    color: black !important;
  }
  
  .messages {
    overflow: visible !important;
    height: auto !important;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

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

.text-left {
  text-align: left;
}

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }

.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }

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

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius); }
.rounded-full { border-radius: 9999px; }

.border { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-l { border-left: 1px solid var(--border); }
.border-r { border-right: 1px solid var(--border); }

.bg-panel { background: var(--panel); }
.bg-panel2 { background: var(--panel2); }
.bg-panel3 { background: var(--panel3); }

.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }

.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 24px; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }

.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

.select-none { user-select: none; }

.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-100 { opacity: 1; }

.shadow { box-shadow: var(--shadow-sm); }
.shadow-lg { box-shadow: var(--shadow); }
.shadow-none { box-shadow: none; }

.transition { transition: all 0.2s ease; }
.transition-colors { transition: color 0.2s, background-color 0.2s, border-color 0.2s; }
.transition-transform { transition: transform 0.2s; }
.transition-opacity { transition: opacity 0.2s; }

/* National Internet Specific */
.national-watermark {
  position: fixed;
  bottom: 10px;
  right: 10px;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.5;
  z-index: 1;
  pointer-events: none;
}

.connection-status {
  position: fixed;
  top: 10px;
  right: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  z-index: 1000;
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
}

.connection-status.connected {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
}

.connection-status.disconnected {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.connection-status.reconnecting {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Security Indicators */
.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.security-badge.secure {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.security-badge.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.security-badge.danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Time Display */
.time-display {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  border: 1px solid var(--border);
}