:root {
  --bg: #f4f5fb;
  --bg-soft: #eef0f8;
  --card: #ffffff;
  --primary: #6c5ce7;
  --primary-2: #5646d6;
  --primary-soft: #ece8ff;
  --teal: #2fa58f;
  --accent: #ff8a65;
  --text: #1e2537;
  --muted: #8b92a9;
  --line: #edf0f7;
  --line-strong: #e2e6f1;
  --success: #2e9e6b;
  --danger: #e05555;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 12px 34px rgba(40, 48, 84, 0.09);
  --shadow-sm: 0 2px 12px rgba(40, 48, 84, 0.06);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
img { display: block; }
.hidden { display: none !important; }

.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; width: 100%; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d4d9e8; border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: #b9c0d8; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 18px; font-size: 14px; font-weight: 600;
  transition: all .15s ease; white-space: nowrap; user-select: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .fa-spinner { animation: btnspin .7s linear infinite; }
@keyframes btnspin { to { transform: rotate(360deg); } }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; box-shadow: 0 4px 14px rgba(108, 92, 231, 0.30);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(108, 92, 231, 0.36); }
.btn-outline { background: #fff; color: var(--primary); border-color: #cfc8f5; }
.btn-outline:hover { background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line-strong); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-danger { background: #fff; color: var(--danger); border-color: #f3c4c4; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #278a5c; }
.mobile-nav { display: none; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: 9px; line-height: 1; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm); background: #fff; color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.14); }
.textarea { resize: vertical; min-height: 90px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-error { display: none; background: #fdecec; color: var(--danger); border: 1px solid #f6caca; padding: 9px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 12px; }
.form-error.show { display: block; }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 42px; }
.pass-wrap .pass-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  border-radius: 8px; font-size: 15px; transition: color .15s, background .15s;
}
.pass-wrap .pass-toggle:hover { color: var(--text); background: var(--bg-soft); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(40, 48, 84, 0.02);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--text); letter-spacing: -.2px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  display: flex; align-items: center; justify-content: center; color: #fff;
  font-size: 16px; font-weight: 800;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.35);
}
.brand span em { font-style: normal; color: var(--primary); }

.nav-links { display: flex; align-items: center; gap: 6px; background: var(--bg-soft); padding: 4px; border-radius: 12px; }
.nav-links a {
  color: var(--muted); font-weight: 600; font-size: 13.5px;
  padding: 8px 16px; border-radius: 9px; display: inline-flex; align-items: center; gap: 7px;
  transition: all .15s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }
.nav-links .side-badge { margin-left: 2px; }

.nav-cta { display: flex; gap: 10px; align-items: center; }
.avatar-btn { position: relative; }
.avatar-btn .avatar { width: 36px; height: 36px; border: 2px solid #fff; box-shadow: var(--shadow-sm); }

/* ---------- Home ---------- */
.hero {
  padding: 76px 0 60px; text-align: center; color: #fff;
  background:
    linear-gradient(rgba(22, 24, 46, 0.62), rgba(22, 24, 46, 0.55)),
    url("https://images.unsplash.com/photo-1470252649378-9c29740c9fa8?auto=format&fit=crop&w=1600&q=80") center / cover no-repeat;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.16); color: #fff;
  font-size: 13px; font-weight: 700; padding: 7px 14px; border-radius: 999px; margin-bottom: 18px;
  backdrop-filter: blur(6px);
}
.hero h1 { font-size: clamp(34px, 5vw, 54px); line-height: 1.12; font-weight: 800; letter-spacing: -1px; max-width: 760px; margin: 0 auto 18px; color: #fff; }
.hero h1 .grad { background: linear-gradient(90deg, #b3a8f5, #5ed4b5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: rgba(255, 255, 255, 0.85); font-size: 18px; max-width: 620px; margin: 0 auto 30px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.section { padding: 64px 0; }
.section-head { text-align: center; margin-bottom: 38px; }
.section-head h2 { font-size: 30px; letter-spacing: -.5px; }
.section-head p { color: var(--muted); margin-top: 8px; }

.articles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 22px; }
.article-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s;
}
.article-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.article-card img { width: 100%; height: 175px; object-fit: cover; }
.article-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.article-meta { display: flex; gap: 10px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.article-meta .cat { color: var(--primary); background: var(--primary-soft); padding: 2px 9px; border-radius: 999px; }
.article-card h3 { font-size: 17px; margin-bottom: 8px; }
.article-card p { font-size: 14px; color: var(--muted); flex: 1; }
.article-card .read-more { margin-top: 14px; font-weight: 700; font-size: 14px; color: var(--primary); background: none; border: none; padding: 0; text-align: left; }
.article-card .read-more:hover { color: var(--primary-2); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 24, 40, 0.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: 18px; max-width: 640px; width: 100%;
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow);
  transform: translateY(10px); transition: transform .18s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal img.modal-cover { width: 100%; height: 200px; object-fit: cover; }
.modal-content { padding: 24px 26px; }
.modal-content h2 { margin-bottom: 6px; font-size: 24px; }
.modal-content .m-meta { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.modal-content p { margin-bottom: 14px; color: #3a4159; }
.modal-close { position: absolute; top: 14px; right: 14px; background: rgba(255, 255, 255, 0.9); border: none; border-radius: 999px; width: 34px; height: 34px; font-size: 18px; cursor: pointer; }
.modal-close:hover { background: #fff; }

.modal-overlay.fullscreen { padding: 0; align-items: stretch; }
.modal-overlay.fullscreen .modal {
  max-width: none; width: 100%; height: 100%; max-height: none; border-radius: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-overlay.fullscreen .modal-content {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  padding: 26px 24px 18px;
}
.modal-overlay.fullscreen .task-chat-msgs { flex: 1; max-height: none; min-height: 0; }

.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pay-method { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line-strong); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; transition: border-color .12s, box-shadow .12s; }
.pay-method:hover { border-color: #cfc8f5; }
.pay-method.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12); }
.pay-method .pm-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 16px; flex: none; }
.pay-method b { display: block; font-size: 14px; }
.pay-method small { font-size: 11.5px; color: var(--muted); }
.pm-status { margin-left: auto; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); white-space: nowrap; }
.pm-status.ok { color: var(--success); }
.pay-soon { text-align: center; padding: 18px 10px; color: var(--muted); }
.pay-soon .big { margin-bottom: 6px; }
.pay-soon b { color: var(--text); font-size: 14px; }
.pay-soon p { font-size: 13px; margin-top: 6px; }
.pay-addr { text-align: center; }
.addr-box { background: var(--bg-soft); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 12px; font-size: 13px; word-break: break-all; margin: 10px 0; font-family: Consolas, monospace; }
.pm-admin-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.pm-admin-row .pm-name { flex: 1 1 140px; }
.pm-admin-row .pm-desc { flex: 1 1 160px; }
.pm-admin-row .pm-icon { flex: 1 1 160px; }
.pm-admin-row .pm-conn { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pm-admin-row .pm-conn input { width: 16px; height: 16px; accent-color: var(--primary); }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 22px; box-shadow: var(--shadow-sm); }
.feature .ico { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: var(--primary-soft); margin-bottom: 14px; }
.feature h4 { margin-bottom: 6px; }
.feature p { font-size: 14px; color: var(--muted); }

.footer { border-top: 1px solid var(--line); padding: 30px 0; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 30px 16px;
  background: radial-gradient(700px 400px at 20% 10%, rgba(108, 92, 231, 0.12), transparent 60%),
              radial-gradient(600px 360px at 85% 90%, rgba(47, 165, 143, 0.12), transparent 60%); }
.auth-card { background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 36px 36px 30px; width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; margin-bottom: 6px; font-size: 19px; }
.auth-card h1 { text-align: center; font-size: 23px; margin: 14px 0 4px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.auth-alt { text-align: center; font-size: 14px; color: var(--muted); margin-top: 18px; }
.demo-hint { margin-top: 18px; background: var(--bg-soft); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------- App layout ---------- */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.app-body { flex: 1; display: flex; padding: 22px 0 44px; }

/* Side badge (used in nav links & mobile tabs) */
.side-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; min-width: 20px; text-align: center; }

/* Content panels */
.content { flex: 1; min-width: 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h3 { font-size: 16px; letter-spacing: -.2px; }
.panel-body { padding: 22px; }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 44px; margin-bottom: 12px; opacity: .8; }

/* Profile feed */
.feed-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.profile-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 18px 18px; display: flex; flex-direction: column; align-items: center;
  text-align: center; transition: transform .15s, box-shadow .15s; position: relative;
  animation: fadeUp .25s ease backwards;
}
.profile-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #d9d4f7; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--primary-soft); flex: none; }
.avatar-wrap { position: relative; margin-bottom: 12px; }
.avatar-wrap .avatar { width: 88px; height: 88px; border: 3px solid #fff; box-shadow: 0 6px 18px rgba(40, 48, 84, 0.18); }
.online-dot { width: 15px; height: 15px; border-radius: 50%; background: var(--success); border: 3px solid #fff; position: absolute; bottom: 4px; right: 2px; }
.pc-name { font-weight: 700; font-size: 15.5px; letter-spacing: -.2px; }
.pc-sub { font-size: 13px; color: var(--muted); margin: 2px 0 8px; }
.pc-chips { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; justify-content: center; }
.pc-chip { font-size: 11.5px; font-weight: 600; background: var(--bg-soft); color: var(--text); padding: 3px 10px; border-radius: 999px; }
.pc-about { font-size: 13px; color: #5a6277; margin-bottom: 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pc-actions { display: flex; gap: 8px; width: 100%; }
.pc-actions .btn { flex: 1; }
.follows-you { position: absolute; top: 14px; left: 14px; font-size: 10.5px; font-weight: 700; color: var(--teal); background: #e3f5ef; padding: 3px 9px; border-radius: 999px; }

.searchbar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.searchbar .search-input-wrap { position: relative; flex: 1; max-width: 380px; }
.searchbar .search-input-wrap .search-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; }
.searchbar .search-input-wrap .input { padding-left: 38px; }

/* ---------- Chat ---------- */
.chat-wrap { display: flex; height: calc(100vh - 140px); min-height: 520px; }
.conv-list { width: 330px; flex: none; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; background: #fcfcff; }
.conv-list .list-head { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.conv-list .list-head h3 { font-size: 15px; }
.conv-scroll { flex: 1; overflow-y: auto; }
.conv-item { display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; align-items: center; position: relative; }
.conv-item:hover { background: var(--bg-soft); }
.conv-item.active { background: var(--primary-soft); }
.conv-item.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--primary); }
.conv-item .avatar { width: 48px; height: 48px; }
.conv-meta { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 11px; color: var(--muted); flex: none; }
.conv-preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item.active .conv-preview { color: #6b639b; }
.unread-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 3px 8px rgba(108, 92, 231, 0.4); }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; background: #fff; }
.chat-head .avatar { width: 44px; height: 44px; }
.chat-head .ch-name { font-weight: 700; font-size: 15px; }
.chat-head .ch-status { font-size: 12px; color: var(--muted); }
.chat-head .ch-status b { color: var(--primary); }
.chat-head .online-now { color: var(--success); font-weight: 600; }

.messages {
  flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 4px;
  background:
    radial-gradient(600px 300px at 0% 0%, rgba(108, 92, 231, 0.03), transparent 60%),
    #f7f8fd;
}
.day-divider { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); margin: 12px 0 10px; background: var(--bg-soft); align-self: center; padding: 4px 14px; border-radius: 999px; }
.msg-row { display: flex; gap: 8px; margin-top: 6px; align-items: flex-end; }
.msg-row .m-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; background: var(--primary-soft); }
.msg-row.me { justify-content: flex-end; }
.msg-row.me .m-avatar { display: none; }
.msg { max-width: 68%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45; position: relative; overflow-wrap: anywhere; word-break: break-word; }
.msg-row.me .msg { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-bottom-right-radius: 5px; box-shadow: 0 4px 12px rgba(108, 92, 231, 0.28); }
.msg-row.other .msg { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 5px; box-shadow: var(--shadow-sm); }
.msg .m-tail { display: block; font-size: 10.5px; color: var(--muted); margin-top: 4px; opacity: .9; }
.msg-row.me .msg .m-tail { color: rgba(255, 255, 255, 0.78); }
.msg .m-img { max-width: 240px; border-radius: 10px; margin-bottom: 4px; }
.msg-input { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); background: #fff; align-items: center; }
.msg-input .input { flex: 1; border-radius: 24px; padding: 12px 18px; }
.msg-input .btn { border-radius: 24px; }

/* ---------- Notifications ---------- */
.notif-item { display: flex; gap: 13px; padding: 16px 20px; border-bottom: 1px solid var(--line); align-items: center; transition: background .12s; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-soft); }
.notif-item.unread { background: var(--primary-soft); }
.notif-item .avatar { width: 46px; height: 46px; border: 2px solid #fff; box-shadow: var(--shadow-sm); }
.notif-item .notif-ann-av { display: flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2, var(--primary))); }
.notif-tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--primary); background: var(--primary-soft); padding: 2px 7px; border-radius: 6px; margin-right: 7px; }
.notif-body { flex: 1; min-width: 0; }
.notif-body .ntext { font-size: 14px; }
.notif-body .ntime { font-size: 12px; color: var(--muted); }
.notif-item .btn { flex: none; }

/* ---------- Profile page ---------- */
.profile-page { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
.profile-cover { height: 130px; border-radius: var(--radius) var(--radius) 0 0; background: linear-gradient(120deg, #6c5ce7, #9b6bd8 55%, #2fa58f); }
.profile-banner { display: flex; gap: 22px; align-items: flex-end; padding: 0 26px 24px; flex-wrap: wrap; margin-top: -52px; }
.profile-banner > div:last-child { margin-top: 52px; }
.profile-banner .avatar { width: 108px; height: 108px; border: 4px solid #fff; box-shadow: var(--shadow); }
.profile-banner h2 { font-size: 23px; letter-spacing: -.4px; }
.pb-stats { display: flex; gap: 26px; margin-top: 8px; }
.pb-stat { text-align: center; }
.pb-stat b { display: block; font-size: 18px; }
.pb-stat span { font-size: 12px; color: var(--muted); }
.avatar-upload { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.avatar-upload .preview { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--bg-soft); border: 1px solid var(--line-strong); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #232a3f; color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); animation: slideUp .2s ease; max-width: 90vw; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--success); }
.toast.warn { background: #b8860b; }
.toast.banner {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  background: #1f2745; padding: 12px 18px; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  min-width: 280px; max-width: 90vw;
}
.toast.banner:hover { background: #2a3350; }
.toast.banner .banner-ico {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--teal)); color: #fff; font-size: 16px;
}
.toast.banner .banner-body { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.toast.banner .banner-body b { font-size: 13.5px; }
.toast.banner .banner-body small { color: rgba(255, 255, 255, 0.72); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msg-banner { display: flex; align-items: center; gap: 12px; background: #1f2745; border: 1px solid rgba(255, 255, 255, 0.10); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 600; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.msg-banner.hidden { display: none; }
.msg-banner .banner-ico {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--teal)); color: #fff; font-size: 16px;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Plans & membership ---------- */
.plan-badge {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  padding: 2px 9px; border-radius: 999px; background: var(--bg-soft); color: var(--muted); border: 1px solid var(--line-strong);
  vertical-align: middle; margin-left: 6px; white-space: nowrap;
}
.plan-badge.pro { background: linear-gradient(135deg, #ffd54d, #ffb300); color: #4a3200; border-color: transparent; }
.plan-badge.proplus { background: linear-gradient(135deg, #7c6cf0, #b06bf0); color: #fff; border-color: transparent; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 18px; }
.panel-plans { grid-column: 1 / -1; }
.plan-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 18px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow-sm);
}
.plan-card.featured { border-color: var(--primary); box-shadow: 0 8px 22px rgba(108, 92, 231, 0.18); }
.plan-card.current { background: var(--primary-soft); }
.plan-card .plan-name { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-pop { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--primary); background: #fff; border: 1px solid #cfc8f5; padding: 1px 7px; border-radius: 999px; }
.plan-card .plan-price { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.plan-card .plan-feat { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.plan-card .plan-feats { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.plan-card .plan-feats div { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.plan-card .plan-feats i { color: var(--success); font-size: 11px; flex: none; }
.plan-card .btn, .plan-card .plan-cur { margin-top: auto; }
.plan-card .plan-cur { font-size: 12px; font-weight: 700; color: var(--primary); text-align: center; }

/* ---------- Tasks & earnings ---------- */
.task-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.task-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm);
}
.task-card .task-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.task-reward { font-weight: 800; font-size: 15px; color: var(--primary); white-space: nowrap; }
.task-card .task-title { font-weight: 700; font-size: 14px; line-height: 1.35; }
.task-card .task-desc { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0; }
.task-card .task-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 4px; flex-wrap: wrap; }
.blurred { filter: blur(6px); user-select: none; pointer-events: none; }
.chip { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-strong); }
.chip-open { color: var(--primary); background: var(--primary-soft); border-color: transparent; }
.chip-go { color: #b45309; background: #fef3c7; border-color: transparent; }
.chip-done { color: #047857; background: #d1fae5; border-color: transparent; }
.earn-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.earn-bal b { font-size: 26px; letter-spacing: -.5px; display: block; }
.earn-bal span { font-size: 12px; color: var(--muted); }
.earn-note { flex: 1; min-width: 220px; font-size: 13px; color: var(--muted); }
.task-chat-msgs { max-height: 300px; overflow-y: auto; }
.hint { font-size: 12px; color: var(--muted); }

/* ---------- Admin ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-topbar {
  display: none; position: sticky; top: 0; z-index: 70; align-items: center; gap: 12px;
  background: #1a2040; color: #fff; padding: 12px 16px;
}
.admin-topbar .hamburger {
  width: 38px; height: 38px; border-radius: 10px; border: none; cursor: pointer;
  background: rgba(255, 255, 255, 0.10); color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center; transition: background .12s;
}
.admin-topbar .hamburger:active { background: rgba(255, 255, 255, 0.22); }
.admin-topbar .admin-topbar-title { font-weight: 700; font-size: 15px; }
.admin-topbar .admin-topbar-title em { color: var(--accent); font-style: normal; }
.admin-backdrop {
  position: fixed; inset: 0; z-index: 74; background: rgba(10, 14, 30, 0.55);
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.admin-backdrop.show { opacity: 1; pointer-events: auto; }
.admin-side {
  width: 238px; flex: none; background: #1a2040; color: #c9cfe4;
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.admin-side .brand { color: #fff; margin-bottom: 26px; padding: 0 6px; }
.admin-side .brand .logo { background: linear-gradient(135deg, var(--primary), var(--accent)); }
.admin-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 12px 14px; border-radius: 11px; border: none; background: none;
  color: #b9c0d8; font-size: 14px; font-weight: 600; text-align: left; margin-bottom: 5px; transition: all .12s;
}
.admin-item .ico { font-size: 17px; width: 20px; text-align: center; }
.admin-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.admin-item.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 4px 14px rgba(108, 92, 231, 0.35); }
.admin-side .side-foot { margin-top: auto; padding: 12px 6px; font-size: 12px; color: #7e86a5; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.admin-side .side-foot .btn { width: 100%; margin-top: 10px; }

.admin-main { flex: 1; min-width: 0; padding: 28px 30px; }
.admin-main h1 { font-size: 24px; letter-spacing: -.4px; margin-bottom: 4px; }
.admin-main .page-sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); transition: transform .15s; }
.stat-card:hover { transform: translateY(-2px); }
.stat-card b { font-size: 28px; display: block; letter-spacing: -.5px; }
.stat-card span { font-size: 13px; color: var(--muted); font-weight: 600; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 12px 16px; border-bottom: 1.5px solid var(--line); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafaff; }
.table .avatar { width: 40px; height: 40px; border: 2px solid #fff; box-shadow: var(--shadow-sm); }
.tbl-user { display: flex; align-items: center; gap: 11px; }
.tbl-user .name { font-weight: 600; font-size: 13.5px; }
.tbl-user .sub { font-size: 12px; color: var(--muted); }

.admin-chat-layout { display: flex; height: calc(100vh - 150px); min-height: 520px; gap: 18px; }
.admin-conv-list { width: 370px; flex: none; display: flex; flex-direction: column; overflow: hidden; background: #fcfcff; }
.admin-conv-list .list-head { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.admin-conv-scroll { flex: 1; overflow-y: auto; }
.admin-chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.hidden-badge { display: inline-block; font-size: 10px; font-weight: 700; color: var(--muted); background: var(--bg-soft); border: 1px solid var(--border); padding: 1px 7px; border-radius: 999px; vertical-align: middle; margin-left: 4px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text); margin-top: 12px; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

.notif-pick-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px 12px; background: var(--bg-soft); }
.notif-pick { margin: 8px 0; }
.notif-pick .avatar { width: 30px; height: 30px; flex: none; }
.notif-pick span { font-weight: 600; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--bg-soft); border: 1px solid var(--line); padding: 4px; border-radius: 10px; }
.seg button { border: none; background: none; padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.seg-count { opacity: .75; font-size: 11px; margin-left: 2px; }
.dir-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; line-height: 1.4; }
.dir-badge.in { background: #e3f5ef; color: var(--teal); }
.dir-badge.out { background: var(--primary-soft); color: var(--primary); }
.seg button.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }

#view-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 18px;
  align-items: start;
}
.settings-block { max-width: none; margin-top: 0 !important; }
.settings-block .field { margin-bottom: 16px; }
.settings-block.settings-wide { grid-column: 1 / -1; }

/* ---------- AI assistant ---------- */
#view-ai {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 18px;
  align-items: start;
}
.ai-master input { width: 20px; height: 20px; }
.ai-status {
  display: flex; align-items: center; gap: 12px; margin-top: 16px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.ai-status .ai-status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.ai-status .ai-status-dot.on { background: var(--success); box-shadow: 0 0 0 4px rgba(46, 158, 107, 0.18); }
.ai-status .ai-status-dot.off { background: var(--muted); box-shadow: 0 0 0 4px rgba(139, 146, 169, 0.15); }
.ai-status b { font-size: 14px; display: block; }
.ai-status small { font-size: 12.5px; color: var(--muted); }
.kb-card {
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 12px; background: #fcfcff;
}
.kb-card-head { display: flex; align-items: center; gap: 10px; }
.kb-card-head .kb-intent { font-weight: 700; }
.kb-new {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 16px; background: #fcfcff;
}
.kb-new-head { font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.kb-reply-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.kb-reply-row .input { flex: 1; }
.kb-reply-row .kb-reply-del { flex: none; }
.dir-badge.ai { background: #ece8ff; color: var(--primary); }


/* ---------- Mobile tab bar ---------- */
.mobile-tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(40, 48, 84, 0.08);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px 12px; background: none; border: none; cursor: pointer;
  font-size: 11px; font-weight: 600; color: var(--muted); position: relative; transition: color .12s;
}
.tab-item .t-ico { font-size: 21px; line-height: 1; }
.tab-item.active { color: var(--primary); }
.tab-item .side-badge { margin: 0; position: absolute; top: 7px; right: 50%; transform: translateX(14px); font-size: 10px; padding: 1px 5px; min-width: 17px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  #view-messages { margin: 0 -12px; }
  #view-messages .panel { background: transparent; border: none; box-shadow: none; }
  .messages { padding: 14px 10px; }
  .msg-row .m-avatar { display: none; }
}
@media (max-width: 960px) {
  .chat-wrap { height: calc(100vh - 160px); overflow: hidden; }
  .conv-list { width: 100%; }
  .chat-wrap.mobile-chat-open .conv-list { display: none; }
  .feed-grid { grid-template-columns: repeat(3, 1fr); }
  .profile-page { grid-template-columns: 1fr; }
  .admin-shell { flex-direction: column; }
  .admin-topbar { display: flex; }
  .admin-side {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; width: 250px;
    transform: translateX(-105%); transition: transform .22s ease; z-index: 80;
    box-shadow: 0 0 44px rgba(0, 0, 0, 0.35); padding-top: 26px;
  }
  .admin-side.open { transform: translateX(0); }
  .admin-main { padding: 16px; }
  #view-settings { grid-template-columns: 1fr; }
  .admin-chat-layout { flex-direction: column; height: auto; }
  .admin-conv-list { width: 100%; max-height: 300px; }
  .admin-chat-main { height: 480px; }
}
@media (min-width: 1201px) {
  #view-messages {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 0 20px;
  }
}
@media (max-width: 720px) {
  .nav-links { display: none; }
  .mobile-nav { display: flex; align-items: center; gap: 8px; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .hero { padding: 50px 0 40px; }
  .feed-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-card { padding: 18px 12px 14px; }
  .pc-actions { flex-direction: column; }
  .mobile-tabbar { display: flex; }
  .app-shell { padding-bottom: 66px; }
  .app-body { padding: 10px 20px 12px; }
  .toast-wrap { bottom: 78px; }
  .chat-wrap { height: calc(100vh - 190px); }
}
