/* ========== Get Chat - Telegram Style ========== */
:root {
  --tg-blue: #2AABEE;
  --tg-blue-hover: #2098dd;
  --tg-blue-light: #ebf6fd;
  --tg-bg: #ffffff;
  --tg-sidebar: #f7f7f8;
  --tg-sidebar-hover: #e8e8ea;
  --tg-chat-bg: #e6ebee;
  --tg-msg-other: #ffffff;
  --tg-msg-me: #eeffde;
  --tg-text: #000000;
  --tg-text-secondary: #707579;
  --tg-text-light: #a0a4a8;
  --tg-border: #e0e0e0;
  --tg-danger: #e53935;
  --tg-success: #4caf50;
  --tg-warning: #ff9800;
  --tg-admin: #8e24aa;
  --tg-radius: 12px;
  --tg-radius-sm: 8px;
  --tg-shadow: 0 1px 2px rgba(0,0,0,0.06);
  --tg-shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
  --tg-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans CJK SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--tg-font);
  background: var(--tg-bg);
  color: var(--tg-text);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* ========== Ban Page ========== */
.ban-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  background: var(--tg-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
}

.ban-container {
  text-align: center;
  padding: 40px;
  max-width: 360px;
}

.ban-icon {
  font-size: 72px;
  margin-bottom: 24px;
}

.ban-container h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--tg-danger);
  margin-bottom: 12px;
}

.ban-container p {
  font-size: 15px;
  color: var(--tg-text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}

.ban-container .ban-sub {
  font-size: 13px;
  color: var(--tg-text-light);
  margin-top: 16px;
}

/* ========== Auth Pages (Telegram Style) ========== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  background: var(--tg-bg);
}

.auth-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

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

.auth-logo {
  margin-bottom: 40px;
}

.auth-logo .logo-icon {
  width: 100px;
  height: 100px;
  background: var(--tg-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 4px 20px rgba(42,171,238,0.3);
}

.auth-logo .logo-icon svg {
  width: 50px;
  height: 50px;
}

.auth-logo h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--tg-text);
  margin-bottom: 5px;
}

.auth-logo p {
  font-size: 14px;
  color: var(--tg-text-secondary);
  font-weight: 400;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--tg-border);
}

.auth-tab {
  flex: 1;
  padding: 12px 10px;
  text-align: center;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--tg-text-secondary);
  transition: all 0.2s;
  position: relative;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.auth-tab:hover { color: var(--tg-blue); }

.auth-tab.active {
  color: var(--tg-blue);
  border-bottom-color: var(--tg-blue);
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-form .input-group {
  margin-bottom: 16px;
  text-align: left;
}

.auth-form label {
  display: block;
  font-size: 13px;
  color: var(--tg-text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.auth-form .input-field {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--tg-border);
  border-radius: var(--tg-radius-sm);
  font-size: 15px;
  font-family: var(--tg-font);
  transition: all 0.2s;
  background: var(--tg-bg);
  outline: none;
}

.auth-form .input-field:focus {
  border-color: var(--tg-blue);
  box-shadow: 0 0 0 3px rgba(42,171,238,0.1);
}

.captcha-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.captcha-group .input-field { flex: 1; }

.captcha-img {
  height: 48px;
  min-width: 120px;
  border: 1.5px solid var(--tg-border);
  border-radius: var(--tg-radius-sm);
  cursor: pointer;
  background: var(--tg-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.2s;
}

.captcha-img:hover { border-color: var(--tg-blue); }
.captcha-img svg { display: block; }

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--tg-blue);
  color: white;
  border: none;
  border-radius: var(--tg-radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--tg-font);
}

.btn-primary:hover { background: var(--tg-blue-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.auth-error {
  color: var(--tg-danger);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  min-height: 18px;
}

.auth-info {
  background: var(--tg-blue-light);
  color: var(--tg-blue);
  padding: 12px 16px;
  border-radius: var(--tg-radius-sm);
  font-size: 13px;
  margin-top: 16px;
  text-align: center;
  font-weight: 500;
}

/* ========== Main App Layout ========== */
.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

/* Sidebar */
.sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--tg-bg);
  border-right: 1px solid var(--tg-border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 16px 20px;
  background: var(--tg-bg);
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--tg-border);
}

.sidebar-header .menu-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--tg-text-secondary);
  transition: background 0.15s;
}

.sidebar-header .menu-btn:hover { background: var(--tg-sidebar); }

.sidebar-header h2 {
  font-size: 20px;
  font-weight: 700;
  flex: 1;
  color: var(--tg-text);
}

.sidebar-nav {
  display: flex;
  padding: 8px 12px;
  gap: 4px;
  background: var(--tg-bg);
  border-bottom: 1px solid var(--tg-border);
}

.nav-item {
  flex: 1;
  padding: 8px 6px;
  text-align: center;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tg-text-secondary);
  transition: all 0.2s;
  font-family: var(--tg-font);
}

.nav-item:hover { background: var(--tg-sidebar); color: var(--tg-text); }
.nav-item.active { background: var(--tg-blue); color: white; }

.search-bar {
  padding: 10px 16px;
  background: var(--tg-bg);
}

.search-bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 22px;
  background: var(--tg-sidebar);
  cursor: pointer;
  transition: background 0.2s;
}

.search-bar-inner:hover { background: var(--tg-sidebar-hover); }

.search-bar-inner .search-icon {
  font-size: 16px;
  opacity: 0.5;
}

.search-bar-inner .search-placeholder {
  font-size: 14px;
  color: var(--tg-text-light);
}

.search-bar input {
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: 22px;
  background: var(--tg-sidebar);
  font-size: 14px;
  font-family: var(--tg-font);
  outline: none;
  transition: background 0.2s;
}

.search-bar input:focus { background: var(--tg-sidebar-hover); }

.search-page-bar {
  padding: 12px 0;
}

.search-page-bar input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--tg-border);
  border-radius: 22px;
  background: var(--tg-sidebar);
  font-size: 15px;
  font-family: var(--tg-font);
  outline: none;
  transition: border-color 0.2s;
}

.search-page-bar input:focus { border-color: var(--tg-blue); background: var(--tg-bg); }

.chat-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.chat-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  gap: 12px;
  transition: background 0.1s;
  position: relative;
}

.chat-item:hover { background: var(--tg-sidebar); }
.chat-item.active { background: var(--tg-blue-light); }

.chat-item-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--tg-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

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

.chat-item-avatar .online-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: var(--tg-success);
  border: 2px solid var(--tg-bg);
  border-radius: 50%;
}

.chat-item-info {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--tg-border);
}

.chat-item:last-child .chat-item-info { border-bottom: none; }

.chat-item-name {
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--tg-text);
}

.chat-item-name .lock-icon { color: var(--tg-success); font-size: 12px; }

.chat-item-name .admin-badge {
  background: var(--tg-admin);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.chat-item-preview {
  font-size: 14px;
  color: var(--tg-text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.chat-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.chat-item-time {
  font-size: 12px;
  color: var(--tg-text-light);
}

.badge-unread {
  background: var(--tg-blue);
  color: white;
  font-size: 12px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Chat Area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--tg-chat-bg);
  position: relative;
}

#chatContent {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Chat background pattern */
.chat-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c8d6e0' fill-opacity='0.5'%3E%3Ccircle cx='10' cy='10' r='2.5'/%3E%3Ccircle cx='40' cy='25' r='2.5'/%3E%3Ccircle cx='25' cy='45' r='2.5'/%3E%3Ccircle cx='55' cy='55' r='2.5'/%3E%3Ccircle cx='55' cy='10' r='2.5'/%3E%3Ccircle cx='10' cy='55' r='2.5'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.chat-header {
  padding: 8px 16px;
  background: var(--tg-bg);
  border-bottom: 1px solid var(--tg-border);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
  position: relative;
  min-height: 56px;
}

.chat-header .back-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--tg-blue);
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--tg-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
}

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

.chat-header-info { flex: 1; cursor: pointer; }

.chat-header-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--tg-text);
}

.chat-header-status {
  font-size: 13px;
  color: var(--tg-text-secondary);
}

.chat-header-actions { display: flex; gap: 4px; }

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--tg-text-secondary);
  transition: all 0.15s;
}

.icon-btn:hover { background: var(--tg-sidebar); color: var(--tg-blue); }

/* Messages */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  z-index: 1;
}

.message {
  max-width: 70%;
  padding: 8px 12px 6px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.45;
  word-wrap: break-word;
  position: relative;
  animation: msgIn 0.2s ease;
}

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

.message.me {
  align-self: flex-end;
  background: var(--tg-msg-me);
  border-bottom-right-radius: 2px;
}

.message.other {
  align-self: flex-start;
  background: var(--tg-msg-other);
  border-bottom-left-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.message-sender {
  font-size: 12px;
  color: var(--tg-blue);
  font-weight: 600;
  margin-bottom: 2px;
}

.message-time {
  float: right;
  font-size: 11px;
  color: var(--tg-text-light);
  margin-left: 8px;
  margin-top: 4px;
  line-height: 1;
  white-space: nowrap;
}

.message-content {
  display: inline;
}

.message .lock-badge {
  font-size: 10px;
  color: var(--tg-success);
  margin-right: 4px;
}

.message img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  margin-top: 4px;
  display: block;
}

.message video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  margin-top: 4px;
}

.message .file-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(42,171,238,0.08);
  border-radius: 8px;
  text-decoration: none;
  color: var(--tg-blue);
  font-size: 14px;
  margin-top: 4px;
  font-weight: 500;
}

.message-date-divider {
  text-align: center;
  margin: 12px 0 4px;
  font-size: 13px;
  color: var(--tg-text-light);
  font-weight: 500;
}

.message-cleared-notice {
  text-align: center;
  color: var(--tg-text-light);
  font-size: 13px;
  padding: 12px;
  margin: 8px 0;
  background: rgba(0,0,0,0.03);
  border-radius: 8px;
}

.typing-indicator {
  align-self: flex-start;
  padding: 8px 14px;
  background: var(--tg-msg-other);
  border-radius: 12px;
  font-size: 13px;
  color: var(--tg-text-secondary);
  display: none;
  box-shadow: 0 1px 1px rgba(0,0,0,0.06);
}

.typing-indicator.show { display: block; }

/* Input Area */
.chat-input-area {
  padding: 8px 16px 12px;
  background: var(--tg-bg);
  border-top: 1px solid var(--tg-border);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  z-index: 10;
  position: relative;
}

.chat-input-area .input-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: var(--tg-sidebar);
  border-radius: 22px;
  padding: 2px 4px 2px 16px;
  transition: background 0.2s;
}

.chat-input-area .input-wrapper:focus-within { background: var(--tg-sidebar-hover); }

.chat-input-area textarea {
  flex: 1;
  border: none;
  background: none;
  font-size: 15px;
  font-family: var(--tg-font);
  padding: 9px 0;
  outline: none;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  color: var(--tg-text);
}

.chat-input-area textarea::placeholder { color: var(--tg-text-light); }

.chat-input-area .file-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--tg-text-secondary);
  transition: all 0.15s;
  flex-shrink: 0;
}

.chat-input-area .file-btn:hover { color: var(--tg-blue); background: var(--tg-sidebar); }

.chat-input-area .send-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--tg-blue);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-input-area .send-btn:hover { background: var(--tg-blue-hover); transform: scale(1.05); }
.chat-input-area .send-btn:active { transform: scale(0.95); }
.chat-input-area .send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Empty State */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--tg-text-light);
  gap: 12px;
  position: relative;
  z-index: 1;
}

.empty-state .empty-logo {
  width: 100px;
  height: 100px;
  background: var(--tg-sidebar);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}

.empty-state .empty-logo svg { width: 50px; height: 50px; }

.empty-state p { font-size: 16px; font-weight: 500; color: var(--tg-text-secondary); }

/* ========== Full Page Panels ========== */
.full-page {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--tg-bg);
  z-index: 500;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  animation: slideIn 0.25s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.full-page.show { display: flex; }

.full-page-header {
  padding: 12px 16px;
  background: var(--tg-bg);
  border-bottom: 1px solid var(--tg-border);
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 56px;
}

.full-page-header .back-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--tg-blue);
  transition: background 0.15s;
}

.full-page-header .back-btn:hover { background: var(--tg-sidebar); }

.full-page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--tg-text);
}

.full-page-content {
  padding: 16px;
  flex: 1;
}

/* Settings Page */
.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 13px;
  color: var(--tg-text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 4px 8px;
}

.settings-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--tg-bg);
  cursor: pointer;
  transition: background 0.15s;
  gap: 16px;
  border-bottom: 1px solid var(--tg-border);
}

.settings-item:first-child { border-radius: var(--tg-radius-sm) var(--tg-radius-sm) 0 0; }
.settings-item:last-child { border-radius: 0 0 var(--tg-radius-sm) var(--tg-radius-sm); border-bottom: none; }
.settings-item:only-child { border-radius: var(--tg-radius-sm); }

.settings-item:hover { background: var(--tg-sidebar); }

.settings-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.settings-item-icon.blue { background: #e3f2fd; color: var(--tg-blue); }
.settings-item-icon.red { background: #ffebee; color: var(--tg-danger); }
.settings-item-icon.purple { background: #f3e5f5; color: var(--tg-admin); }
.settings-item-icon.green { background: #e8f5e9; color: var(--tg-success); }
.settings-item-icon.orange { background: #fff3e0; color: var(--tg-warning); }

.settings-item-info { flex: 1; }

.settings-item-label {
  font-size: 16px;
  font-weight: 500;
  color: var(--tg-text);
}

.settings-item-desc {
  font-size: 13px;
  color: var(--tg-text-light);
  margin-top: 2px;
}

.settings-item-arrow {
  color: var(--tg-text-light);
  font-size: 18px;
}

/* Profile Page */
.profile-header {
  text-align: center;
  padding: 30px 20px;
  background: linear-gradient(180deg, var(--tg-blue-light) 0%, var(--tg-bg) 100%);
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--tg-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 48px;
  font-weight: 600;
  margin: 0 auto 16px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 20px rgba(42,171,238,0.2);
  transition: all 0.2s;
}

.profile-avatar:hover { transform: scale(1.02); }

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

.profile-avatar .edit-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.4);
  color: white;
  text-align: center;
  font-size: 12px;
  padding: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.profile-avatar:hover .edit-hint { opacity: 1; }

.profile-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--tg-text);
}

.profile-phone {
  font-size: 14px;
  color: var(--tg-text-secondary);
  margin-top: 4px;
}

.profile-role-tag {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.profile-form {
  padding: 16px;
}

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

.profile-form label {
  display: block;
  font-size: 13px;
  color: var(--tg-text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.profile-form .input-field {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--tg-border);
  border-radius: var(--tg-radius-sm);
  font-size: 15px;
  font-family: var(--tg-font);
  outline: none;
  transition: all 0.2s;
  background: var(--tg-bg);
}

.profile-form .input-field:focus {
  border-color: var(--tg-blue);
  box-shadow: 0 0 0 3px rgba(42,171,238,0.1);
}

.profile-form textarea.input-field {
  min-height: 80px;
  resize: vertical;
}

.profile-form .input-field:disabled {
  background: var(--tg-sidebar);
  color: var(--tg-text-light);
}

/* Group Info Page */
.group-info-header {
  text-align: center;
  padding: 24px 20px;
  background: linear-gradient(180deg, var(--tg-blue-light) 0%, var(--tg-bg) 100%);
}

.group-info-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--tg-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 40px;
  font-weight: 600;
  margin: 0 auto 12px;
  cursor: pointer;
}

.group-info-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--tg-text);
}

.group-info-meta {
  font-size: 13px;
  color: var(--tg-text-secondary);
  margin-top: 4px;
}

/* Admin Panel Page */
.admin-nav {
  display: flex;
  padding: 8px 12px;
  gap: 4px;
  background: var(--tg-sidebar);
  border-radius: 12px;
  margin-bottom: 16px;
}

.admin-nav-item {
  flex: 1;
  padding: 10px 8px;
  text-align: center;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tg-text-secondary);
  transition: all 0.2s;
  font-family: var(--tg-font);
}

.admin-nav-item:hover { color: var(--tg-text); }
.admin-nav-item.active { background: var(--tg-bg); color: var(--tg-blue); font-weight: 600; box-shadow: var(--tg-shadow); }

/* User List */
.admin-quick-ban {
  padding: 12px 16px;
  background: rgba(229,57,53,0.04);
  border: 1px dashed rgba(229,57,53,0.3);
  border-radius: var(--tg-radius-sm);
  margin-bottom: 12px;
}

.user-list-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  transition: background 0.15s;
  border-bottom: 1px solid var(--tg-border);
}

.user-list-item:hover { background: var(--tg-sidebar); }
.user-list-item:last-child { border-bottom: none; }

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--tg-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}

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

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

.user-list-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--tg-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-list-phone {
  font-size: 13px;
  color: var(--tg-text-light);
  margin-top: 2px;
}

/* Role Badges */
.role-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 600;
  display: inline-block;
  line-height: 1;
}

.role-badge.super_admin { background: #fce4ec; color: #c62828; }
.role-badge.admin { background: #f3e5f5; color: var(--tg-admin); }
.role-badge.owner { background: #e3f2fd; color: #1565c0; }
.role-badge.user { background: var(--tg-sidebar); color: var(--tg-text-secondary); }

/* Group Permissions */
.permission-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--tg-border);
  border-radius: var(--tg-radius-sm);
  overflow: hidden;
}

.permission-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--tg-bg);
  gap: 12px;
}

.permission-item-info { flex: 1; }

.permission-item-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--tg-text);
}

.permission-item-desc {
  font-size: 13px;
  color: var(--tg-text-light);
  margin-top: 2px;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--tg-border);
  border-radius: 14px;
  transition: all 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider { background: var(--tg-blue); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Small Buttons */
.btn-sm {
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--tg-font);
  white-space: nowrap;
}

.btn-sm-primary { background: var(--tg-blue); color: white; }
.btn-sm-primary:hover { background: var(--tg-blue-hover); }

.btn-sm-danger { background: var(--tg-danger); color: white; }
.btn-sm-danger:hover { background: #c62828; }

.btn-sm-outline { background: none; border: 1.5px solid var(--tg-border); color: var(--tg-text-secondary); }
.btn-sm-outline:hover { background: var(--tg-sidebar); border-color: var(--tg-text-secondary); }

.btn-full {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--tg-radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--tg-font);
  margin-top: 8px;
}

.btn-full.primary { background: var(--tg-blue); color: white; }
.btn-full.primary:hover { background: var(--tg-blue-hover); }

.btn-full.danger { background: var(--tg-danger); color: white; }
.btn-full.danger:hover { background: #c62828; }

.btn-full.outline { background: none; border: 1.5px solid var(--tg-danger); color: var(--tg-danger); }
.btn-full.outline:hover { background: #ffebee; }

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 12px;
}

.section-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--tg-text);
}

.section-header .add-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--tg-blue);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.section-header .add-btn:hover { background: var(--tg-blue-hover); transform: scale(1.05); }

/* Modal (for dialogs) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s;
}

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

.modal-overlay.show { display: flex; }

.modal {
  background: var(--tg-bg);
  border-radius: 16px;
  padding: 24px;
  width: 400px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--tg-shadow-lg);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--tg-text);
}

.modal .close-btn {
  cursor: pointer;
  font-size: 24px;
  color: var(--tg-text-light);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
}

.modal .close-btn:hover { background: var(--tg-sidebar); }

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

.modal label {
  display: block;
  font-size: 13px;
  color: var(--tg-text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.modal .input-field {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--tg-border);
  border-radius: var(--tg-radius-sm);
  font-size: 15px;
  font-family: var(--tg-font);
  outline: none;
  transition: all 0.2s;
}

.modal .input-field:focus {
  border-color: var(--tg-blue);
  box-shadow: 0 0 0 3px rgba(42,171,238,0.1);
}

.modal textarea.input-field {
  min-height: 80px;
  resize: vertical;
}

.modal select.input-field {
  background: var(--tg-bg);
  cursor: pointer;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-row .btn-primary { flex: 1; }

.btn-secondary {
  flex: 1;
  padding: 14px;
  border: 1.5px solid var(--tg-border);
  background: var(--tg-bg);
  border-radius: var(--tg-radius-sm);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--tg-text-secondary);
  transition: all 0.2s;
  font-family: var(--tg-font);
}

.btn-secondary:hover { background: var(--tg-sidebar); }

/* Image Preview */
.image-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  cursor: pointer;
}

.image-preview-overlay.show { display: flex; }

.image-preview-overlay img {
  max-width: 95vw;
  max-height: 95vh;
  border-radius: 4px;
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 3000;
  animation: toastIn 0.3s;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

@keyframes toastIn {
  from { transform: translate(-50%, -100px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ========== Mobile - Full Screen Telegram Style ========== */
@media (max-width: 768px) {
  html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
  }

  body {
    background: var(--tg-bg);
    overflow: hidden;
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .app {
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh;
    width: 100%;
    max-width: 100%;
    position: relative;
    overflow: hidden;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    flex-shrink: 0;
    border-right: none;
  }

  .chat-area {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    z-index: 200;
    background: var(--tg-chat-bg);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    overflow: hidden;
  }

  .app.mobile-chat .sidebar {
    display: none;
  }

  .app.mobile-chat .chat-area {
    transform: translateX(0);
  }

  .chat-area::before {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }

  .chat-header .back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    color: var(--tg-text-secondary);
    flex-shrink: 0;
    margin-right: 4px;
  }

  .chat-header .back-btn:hover { background: var(--tg-sidebar); }

  .message { max-width: 85%; }

  /* Full page panels */
  .full-page {
    width: 100%;
    left: 0;
    height: 100%;
    height: 100dvh;
    top: 0;
    bottom: 0;
    position: fixed;
  }

  .full-page-header {
    padding-top: max(16px, env(safe-area-inset-top));
  }

  .full-page-content {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  /* Auth pages */
  .auth-page {
    padding: 0;
    align-items: flex-start;
    width: 100%;
    height: 100%;
    height: 100dvh;
    position: fixed;
    top: 0;
    left: 0;
  }

  .auth-container {
    padding: 40px 20px;
    max-width: 100%;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .auth-logo {
    margin-bottom: 30px;
  }

  .auth-logo .logo-icon {
    width: 80px;
    height: 80px;
  }

  .auth-logo h1 {
    font-size: 24px;
  }

  /* Chat input */
  .chat-input-area {
    padding: 8px 10px;
    gap: 6px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .chat-input-area textarea {
    font-size: 16px;
  }

  .chat-input-area .send-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .chat-input-area .file-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  /* Sidebar header */
  .sidebar-header {
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .sidebar-header h2 {
    font-size: 18px;
  }

  /* Search bar */
  .search-bar {
    padding: 8px 12px;
  }

  .search-bar-inner {
    padding: 10px 14px;
  }

  /* Chat items */
  .chat-item-avatar {
    width: 48px;
    height: 48px;
  }

  /* Settings */
  .profile-header {
    padding: 20px;
  }

  .profile-avatar {
    width: 80px;
    height: 80px;
  }

  .profile-avatar img {
    width: 80px;
    height: 80px;
  }

  .profile-form {
    padding: 16px;
  }

  .profile-form .input-field {
    font-size: 16px;
  }

  .profile-form .btn-full {
    padding: 14px;
    font-size: 16px;
  }

  /* Modal */
  .modal {
    width: 90%;
    max-width: 90vw;
  }

  /* Toast */
  .toast {
    top: auto;
    bottom: 20px;
    bottom: max(20px, env(safe-area-inset-bottom));
    font-size: 14px;
    padding: 10px 20px;
    transform: translateX(-50%);
  }
}