:root {
  --primary: #01849A;
  --primary-dark: #016879;
  --primary-soft: #e3f7fb;
  --green: #22c55e;
  --bg: #f4fbfc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(1,132,154,0.12);
  --shadow: 0 12px 30px rgba(1, 132, 154, 0.10);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Inter, Arial, sans-serif; color: var(--text); background: radial-gradient(circle at top, #eefcff 0%, var(--bg) 45%, #edf6f7 100%); }
a { color: inherit; text-decoration: none; }
body { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px; backdrop-filter: blur(14px);
  background: rgba(255,255,255,.84); border-bottom: 1px solid var(--border);
}
.brand-wrap { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #12b981); color: #fff; font-weight: 800;
  box-shadow: var(--shadow);
}
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar-user { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--primary-soft); border-radius: 999px; }
.nav-link { color: var(--muted); font-weight: 600; }
.nav-link:hover { color: var(--primary-dark); }
.page-shell { padding: 24px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); }
.glass { background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.76)); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  border-radius: 14px; padding: 12px 18px; font-weight: 700; transition: .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), #0ea5a8); color: #fff; }
.btn-ghost { background: var(--primary-soft); color: var(--primary-dark); }
.btn-small { padding: 9px 14px; font-size: 14px; }
label { display: block; margin: 0 0 8px; font-size: 14px; font-weight: 700; }
input, textarea {
  width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid rgba(100,116,139,.18);
  background: #fff; outline: none; font-size: 15px; color: var(--text);
}
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(1,132,154,0.10); }
textarea { resize: vertical; min-height: 78px; }
.muted { color: var(--muted); font-size: 14px; }
.alert { padding: 12px 14px; border-radius: 14px; margin: 12px 0; }
.error { background: #fee2e2; color: #991b1b; }
.success { background: #dcfce7; color: #166534; }
.pill { display: inline-flex; padding: 8px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.avatar { border-radius: 50%; object-fit: cover; background: #dbeafe; flex-shrink: 0; }
.avatar-xxs { width: 18px; height: 18px; }
.avatar-sm { width: 34px; height: 34px; }
.avatar-md { width: 46px; height: 46px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 96px; height: 96px; }
.auth-wrap {
  max-width: 1100px; margin: 0 auto; min-height: calc(100vh - 80px);
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 28px; align-items: center; padding: 28px 24px 48px;
}
.auth-side h1 { font-size: 52px; line-height: 1.05; margin: 18px 0 14px; }
.auth-side p { max-width: 540px; color: var(--muted); font-size: 18px; line-height: 1.6; }
.auth-card { padding: 28px; max-width: 440px; width: 100%; justify-self: end; }
.auth-card h2 { margin-top: 0; font-size: 30px; }
.auth-card input, .auth-card button { margin-bottom: 12px; }
.dashboard-grid, .profile-grid { display: grid; gap: 22px; max-width: 1250px; margin: 0 auto; }
.hero-card { padding: 28px; display: grid; grid-template-columns: 1.3fr .7fr; gap: 20px; }
.hero-copy h1 { margin: 12px 0; font-size: 38px; }
.hero-copy p { color: var(--muted); max-width: 670px; line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.hero-stats { display: grid; gap: 14px; }
.stat-card { padding: 20px; border-radius: 20px; background: linear-gradient(135deg, #f8feff, #ecfeff); border: 1px solid var(--border); }
.stat-card span { display: block; color: var(--muted); margin-bottom: 6px; }
.stat-card strong { font-size: 34px; }
.section-head { padding: 24px 24px 0; }
.section-head h2, .section-head h1 { margin: 0 0 8px; }
.section-head p { margin: 0; color: var(--muted); }
.team-card, .convo-card, .profile-card, .password-card { padding-bottom: 24px; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; padding: 24px; }
.team-member { padding: 18px; border: 1px solid var(--border); border-radius: 20px; background: linear-gradient(180deg, #fff, #f8feff); display: grid; gap: 8px; justify-items: start; }
.status-online { color: #15803d; }
.status-away { color: #b45309; }
.conversation-list-simple { padding: 10px 18px 0; display: grid; gap: 10px; }
.conversation-item-simple { display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: center; padding: 12px; border-radius: 18px; border: 1px solid var(--border); }
.conversation-simple-top { display: flex; justify-content: space-between; gap: 10px; }
.messenger-page { display: grid; grid-template-columns: 360px 1fr; gap: 22px; min-height: calc(100vh - 104px); max-width: 1400px; margin: 0 auto; }
.sidebar, .chat-panel { overflow: hidden; }
.sidebar-title { padding: 22px 20px; border-bottom: 1px solid var(--border); font-weight: 800; font-size: 18px; }
.conversation-item {
  display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid rgba(1,132,154,0.08); transition: .2s ease;
}
.conversation-item:hover, .conversation-item.active { background: linear-gradient(90deg, rgba(1,132,154,.08), rgba(34,197,94,.05)); }
.conversation-content { min-width: 0; }
.conversation-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.conversation-preview { color: var(--muted); font-size: 13px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { min-width: 22px; height: 22px; line-height: 22px; border-radius: 999px; text-align: center; background: linear-gradient(135deg, var(--primary), #10b981); color: #fff; font-size: 12px; padding: 0 6px; }
.chat-panel { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; }
.chat-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.chat-user { display: flex; gap: 14px; align-items: center; }
.chat-header h2 { margin: 0 0 6px; font-size: 24px; }
.member-avatars { display: flex; gap: 8px; }
.messages {
  padding: 22px; overflow-y: auto; background:
    radial-gradient(circle at top left, rgba(1,132,154,.08), transparent 26%),
    radial-gradient(circle at bottom right, rgba(34,197,94,.08), transparent 24%),
    #f7fcfd;
}
.message-wrap { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 14px; }
.message-wrap.mine { justify-content: flex-end; }
.message-avatar { margin-bottom: 6px; }
.message {
  max-width: 75%; background: #fff; border-radius: 18px 18px 18px 6px; padding: 12px 14px 8px;
  box-shadow: 0 10px 24px rgba(2,132,199,.08); border: 1px solid rgba(1,132,154,.10); position: relative;
}
.message.mine {
  margin-left: auto; background: linear-gradient(135deg, rgba(1,132,154,.95), rgba(10,173,181,.95));
  color: #fff; border-radius: 18px 18px 6px 18px;
}
.message.mine .message-meta, .message.mine .message-link a { color: rgba(255,255,255,.84); }
.message-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.message-body { white-space: normal; line-height: 1.58; word-wrap: break-word; }
.message-link { margin-top: 8px; font-size: 14px; }
.message-link a { color: var(--primary-dark); font-weight: 700; }
.read-indicators { display: flex; justify-content: flex-end; gap: 4px; margin-top: 8px; }
.read-avatar { border: 2px solid rgba(255,255,255,.88); box-shadow: 0 2px 10px rgba(0,0,0,.14); }
.send-form { padding: 16px 18px 18px; border-top: 1px solid var(--border); display: grid; gap: 10px; background: rgba(255,255,255,.92); }
.send-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.empty-state { display: grid; place-items: center; padding: 40px; color: var(--muted); }
.profile-grid { grid-template-columns: 1.15fr .85fr; }
.profile-card, .password-card { padding: 0 24px 24px; }
.profile-form { display: grid; gap: 14px; }
.profile-photo-wrap { display: flex; gap: 18px; align-items: center; padding: 18px 0 6px; }
.grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.toggle-wrap { display: grid; gap: 10px; align-content: end; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check-row input { width: auto; }
@media (max-width: 980px) {
  .auth-wrap, .hero-card, .profile-grid, .messenger-page { grid-template-columns: 1fr; }
  .auth-card { justify-self: stretch; max-width: none; }
}
@media (max-width: 640px) {
  .page-shell { padding: 14px; }
  .topbar { padding: 12px 14px; }
  .topbar-right { gap: 8px; }
  .auth-side h1 { font-size: 36px; }
  .grid-two, .send-row { grid-template-columns: 1fr; }
  .message { max-width: 88%; }
}
