/* HowGo — LaswI Studio (c) 2026 */
:root {
  --green: #07c160;
  --green-dark: #06ad56;
  --bg: #ededed;
  --side: #f7f7f7;
  --line: #e3e3e3;
  --text: #191919;
  --sub: #8a8a8a;
  --bubble-me: #95ec69;
  --bubble-other: #ffffff;
  --danger: #fa5151;
  --admin: #1f2937;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

.hidden { display: none !important; }

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---------------- 登录 ---------------- */
.auth-view {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #0fbf66 0%, #07c160 40%, #ededed 40.1%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 26px 24px 20px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.14);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--green); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; letter-spacing: 1px;
}
.brand h1 { margin: 0; font-size: 22px; letter-spacing: 0.5px; }
.brand-sub { margin: 2px 0 0; font-size: 12px; color: var(--sub); }

.tabs-line { display: flex; gap: 18px; margin: 22px 0 14px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 8px 2px 10px; color: var(--sub); font-size: 15px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--green); }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: var(--sub); margin-bottom: 5px; }
.field input {
  width: 100%; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 9px;
  font-size: 16px; /* iOS 上小于 16px 会触发自动放大 */
  background: #fafafa; outline: none;
}
.field input:focus { border-color: var(--green); background: #fff; }

.switch-line {
  display: flex; align-items: center; gap: 8px;
  margin: 4px 0 12px; font-size: 13px; color: #444;
}
.switch-line input { width: 17px; height: 17px; accent-color: var(--green); }
.switch-line em { font-style: normal; color: var(--sub); font-size: 12px; }

.primary {
  width: 100%; padding: 12px; border-radius: 9px;
  background: var(--green); color: #fff; font-weight: 600; font-size: 15px;
}
.primary:hover { background: var(--green-dark); }
.primary:disabled { opacity: 0.6; cursor: default; }
.primary.small { width: auto; padding: 9px 18px; font-size: 14px; }

.form-error { min-height: 18px; margin: 0 0 8px; font-size: 13px; color: var(--danger); }

.panel-hint { margin: 0 0 14px; font-size: 12.5px; line-height: 1.7; color: var(--sub); }

.switch-link { margin: 12px 0 0; text-align: center; font-size: 12.5px; }
.switch-link a { color: var(--green-dark); text-decoration: none; }
.switch-link a:hover { text-decoration: underline; }

.divider {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0 10px; color: var(--sub); font-size: 12px;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.ghost {
  width: 100%; padding: 11px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff;
  font-size: 14px; color: #333;
}
.ghost:hover { border-color: var(--green); color: var(--green-dark); }
.auth-foot { margin: 16px 0 0; font-size: 11.5px; color: var(--sub); line-height: 1.6; }

/* ---------------- 主界面 ---------------- */
.main-view { display: flex; height: 100%; overflow: hidden; }

.sidebar {
  width: 320px; min-width: 320px;
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}

.sidebar-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 14px 10px;
}
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 38px; height: 38px; border-radius: 8px;
  background: var(--green); color: #fff;
  display: grid; place-items: center; font-weight: 600;
  flex: 0 0 auto;
}
.me-info { display: flex; flex-direction: column; min-width: 0; }
.me-info strong { font-size: 14px; }
.me-info span { font-size: 11.5px; color: var(--sub); }
.icon-btn { color: var(--sub); font-size: 16px; padding: 6px; }

.side-tabs { display: flex; padding: 0 10px 8px; gap: 6px; }
.side-tab {
  flex: 1; padding: 7px 0; border-radius: 8px;
  font-size: 13px; color: var(--sub);
}
.side-tab.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.side-tab.admin-only.active { background: var(--admin); color: #fff; }

.side-body { flex: 1; overflow-y: auto; padding: 0 8px 14px; }

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

.item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 9px; cursor: pointer;
}
.item:hover { background: #ececec; }
.item.active { background: #dedede; }
.item-main { flex: 1; min-width: 0; }
.item-title { display: flex; justify-content: space-between; gap: 8px; }
.item-title strong { font-size: 14px; font-weight: 500; }
.item-title time { font-size: 11px; color: var(--sub); flex: 0 0 auto; }
.item-sub {
  font-size: 12.5px; color: var(--sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge-dot {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff;
  font-size: 11px; display: grid; place-items: center; flex: 0 0 auto;
}

.empty-small { padding: 20px 10px; color: var(--sub); font-size: 13px; text-align: center; }

/* 好友 / 搜索 / 申请 */
.friend-tools { display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 8px; }
#friend-search {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; background: #fff; color: var(--text); outline: none;
}
#friend-search:focus { border-color: var(--green); }
.req-toggle {
  align-self: flex-start; padding: 5px 10px; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; color: var(--text); font-size: 12.5px; cursor: pointer;
}
.req-toggle b {
  display: inline-block; min-width: 16px; margin-left: 2px; padding: 0 4px;
  border-radius: 8px; background: var(--danger); color: #fff; font-size: 11px;
}
.req-panel, .search-results {
  padding: 4px 0 8px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
}
.group-title {
  padding: 8px 10px 4px; font-size: 11.5px; color: var(--sub); letter-spacing: 0.3px;
}
.friend-row { align-items: center; }
.friend-row .btn-mini { flex: 0 0 auto; margin-left: 4px; }
.row-actions { display: flex; gap: 4px; flex: 0 0 auto; }


/* 管理台左侧导航 */
.admin-nav { display: flex; flex-direction: column; gap: 4px; padding: 4px; }
.admin-tab {
  text-align: left; padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; color: #4b5563;
}
.admin-tab.active { background: var(--admin); color: #fff; font-weight: 600; }

/* ---------------- 聊天 ---------------- */
.content { flex: 1; min-width: 0; display: flex; }
.chat-pane { flex: 1; display: flex; min-width: 0; }

.empty-hint {
  margin: auto; color: var(--sub); font-size: 14px;
}

.chat-box { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.chat-head {
  height: 54px; padding: 0 18px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); background: var(--side);
}
.chat-head strong { font-size: 15px; }
.chat-peer-id { margin-left: 8px; font-size: 11.5px; color: var(--sub); }

.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: #ffe9e9; color: var(--danger);
}

.messages {
  flex: 1; overflow-y: auto; padding: 16px 18px 8px;
  display: flex; flex-direction: column; gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.sys-line {
  align-self: center; max-width: 80%;
  background: #dadada; color: #555;
  font-size: 12px; padding: 4px 10px; border-radius: 6px; text-align: center;
}

.msg { display: flex; gap: 8px; max-width: 78%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg .avatar { width: 32px; height: 32px; border-radius: 6px; font-size: 13px; }
.msg-body { min-width: 0; }

.bubble {
  padding: 9px 12px; border-radius: 8px;
  background: var(--bubble-other); font-size: 14.5px;
  white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,0.04);
  position: relative;
}
.msg.me .bubble { background: var(--bubble-me); }
.bubble.removed {
  background: #f2f2f2; color: var(--sub); font-style: italic; font-size: 13px;
}
.bubble.blocked {
  background: #ffecec; border: 1px dashed #f5b5b5; color: #96302f;
}
.bubble .mask-flag {
  display: block; margin-top: 5px; font-size: 11px; color: #b26a00;
}

.msg-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 3px; font-size: 11px; color: var(--sub);
}
.msg.me .msg-meta { justify-content: flex-end; }
.report-btn { color: var(--sub); font-size: 11px; text-decoration: underline; }
.report-btn:hover { color: var(--danger); }

.composer {
  border-top: 1px solid var(--line); background: var(--side);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
#msg-input {
  flex: 1; resize: none; max-height: 120px;
  padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--line); font-size: 16px;
  font-family: inherit; line-height: 1.4; outline: none;
  background: #fff;
}
#msg-input:focus { border-color: var(--green); }
.composer-tip { margin: 6px 2px 0; font-size: 11px; color: var(--sub); }
.ban-banner {
  margin-bottom: 8px; padding: 8px 10px; border-radius: 8px;
  background: #ffe9e9; color: var(--danger); font-size: 12.5px;
}

/* ---------------- 管理台 ---------------- */
.admin-pane { flex: 1; display: flex; flex-direction: column; background: #f3f4f6; min-width: 0; }
.admin-head {
  height: 54px; padding: 0 20px; display: flex; align-items: center; gap: 12px;
  background: var(--admin); color: #fff;
}
.admin-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(255,255,255,0.16); }

.admin-body { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat-card {
  background: #fff; border-radius: 10px; padding: 14px;
  border: 1px solid #e5e7eb;
}
.stat-card span { display: block; font-size: 12px; color: #6b7280; }
.stat-card b { font-size: 24px; }
.stat-card.warn b { color: var(--danger); }

.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 14px; margin-bottom: 12px;
}
.card h3 { margin: 0 0 10px; font-size: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }

.pill {
  display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 9px;
  background: #eef2f7; color: #4b5563;
}
.pill.blocked { background: #fee2e2; color: #b91c1c; }
.pill.masked { background: #fef3c7; color: #92400e; }
.pill.deleted { background: #e5e7eb; color: #4b5563; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.open { background: #fee2e2; color: #b91c1c; }
.pill.resolved { background: #dcfce7; color: #166534; }
.pill.ban { background: #fee2e2; color: #b91c1c; }

.row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid #f1f2f4;
}
.row:last-child { border-bottom: none; }
.row-main { flex: 1; min-width: 0; }
.row-text { font-size: 13.5px; word-break: break-word; }
.row-sub { font-size: 11.5px; color: #6b7280; margin-top: 3px; }
.row-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.btn-mini {
  font-size: 12px; padding: 5px 10px; border-radius: 7px;
  background: #f3f4f6; border: 1px solid #e5e7eb; color: #374151;
}
.btn-mini:hover { background: #e5e7eb; }
.btn-mini.danger { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.btn-mini.primary { background: var(--green); border-color: var(--green); color: #fff; }

.inline-form { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.inline-form input, .inline-form select {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 13px; font-family: inherit;
}
.inline-form input.grow { flex: 1; min-width: 160px; }

.word-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; margin: 0 6px 6px 0;
  background: #f3f4f6; border-radius: 8px; font-size: 12.5px;
}
.word-chip button { color: #9ca3af; font-size: 12px; }
.word-chip button:hover { color: var(--danger); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%);
  background: rgba(0,0,0,0.82); color: #fff;
  padding: 9px 16px; border-radius: 8px; font-size: 13px;
  max-width: 76vw; z-index: 99;
}
.toast.error { background: rgba(214, 48, 48, 0.94); }

/* ---------------- 移动端 ---------------- */
@media (max-width: 760px) {
  .main-view { position: relative; }
  .sidebar { width: 100%; min-width: 0; border-right: none; }
  .content {
    position: absolute; inset: 0; background: var(--bg);
    transform: translateX(100%); transition: transform .22s ease;
    z-index: 10;
  }
  .main-view.chat-open .content { transform: translateX(0); }
  .main-view.chat-open .sidebar { display: none; }
  .chat-head { position: relative; padding-left: 46px; }
  .chat-head::before {
    content: "‹"; position: absolute; left: 16px; top: 50%;
    transform: translateY(-52%); font-size: 30px; line-height: 1;
    color: #333; cursor: pointer;
  }
  .msg { max-width: 86%; }
  .admin-body { padding: 14px 12px 40px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
