/* ========== HeartBeat 首页 v1.0 · 极简风格 ========== */
:root {
  --bg: #f6f7f8;
  --card: #ffffff;
  --border: #e6e8eb;
  --text: #17181a;
  --muted: #8a8f98;
  --faint: #b6bac0;
  --accent: #d84c7e;
  --accent-soft: #fbeef4;
  --hover: #f2f3f4;
  --active: #ececec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 500px at 80% -10%, #ffffff 0%, transparent 60%),
    var(--bg);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 36px 32px 28px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}

.login-logo .logo-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, #d84c7e, #7b61ff, #35a3f5, #d84c7e);
}

.login-logo span {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 28px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  outline: none;
  background: #fbfbfc;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  border-color: #17181a;
  box-shadow: 0 0 0 3px rgba(23, 24, 26, 0.06);
  background: #fff;
}

.login-btn {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  background: #17181a;
  color: #fff;
  font-weight: 600;
  margin-top: 6px;
  transition: opacity 0.15s;
}

.login-btn:hover { opacity: 0.86; }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.login-error {
  min-height: 20px;
  color: #d4384f;
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
}

.login-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

/* ---------- 主框架 ---------- */
.shell { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left { display: flex; align-items: center; gap: 10px; }

.topbar-left .logo-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, #d84c7e, #7b61ff, #35a3f5, #d84c7e);
}

.topbar-left .brand { font-weight: 700; font-size: 15px; }

/* v1.1：品牌 logo 图（透明底） */
.topbar-left .brand-logo { height: 26px; display: block; }

.login-logo-img { height: 46px; display: block; }

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

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fbfbfc;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.user-chip .name { font-size: 13px; font-weight: 500; }

.logout-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  transition: all 0.15s;
}

.logout-btn:hover { color: var(--text); border-color: #c9ccd1; }

.shell-body { display: flex; flex: 1; min-height: 0; }

/* ---------- 侧边栏（永久定格） ---------- */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: #fafafa;
  border-right: 1px solid var(--border);
  padding: 16px 12px 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
}

.nav-group { margin-bottom: 20px; }

.nav-group-title {
  font-size: 12px;
  color: var(--faint);
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  color: #3c3f44;
  text-align: left;
  transition: background 0.12s;
  margin-bottom: 2px;
}

.nav-item:hover { background: var(--hover); }

.nav-item.active {
  background: var(--active);
  color: var(--text);
  font-weight: 600;
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.nav-item.active .icon { color: var(--text); }

.nav-item .badge-dev {
  margin-left: auto;
  font-size: 11px;
  color: var(--faint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  background: #fff;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
}

/* ---------- 内容区 ---------- */
.content {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 40px;
}

.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 20px; font-weight: 700; }
.page-head p { color: var(--muted); margin-top: 4px; font-size: 13px; }

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

/* 首页：用户卡片 */
.profile-card { overflow: hidden; margin-bottom: 20px; }

.profile-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
}

.profile-top .avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
}

.profile-top .who h2 { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }

.tag {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  background: var(--hover);
  padding: 2px 8px;
  border-radius: 6px;
}

.tag.link { color: #2278d8; background: transparent; padding: 0; }

.profile-top .who p { color: var(--muted); font-size: 13px; margin-top: 6px; }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
}

.profile-stats > div {
  padding: 18px 24px;
}

.profile-stats > div + div { border-left: 1px solid var(--border); }

.stat-label {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-value { font-size: 24px; font-weight: 700; margin-top: 8px; letter-spacing: 0.3px; }
.stat-sub { color: var(--faint); font-size: 12px; margin-top: 6px; }

/* 首页：模块卡片 */
.section-title { font-size: 15px; font-weight: 600; margin: 24px 0 12px; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.module-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.module-card:hover { border-color: #c9ccd1; transform: translateY(-1px); }

.module-card .m-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3c3f44;
}

.module-card h3 { font-size: 15px; font-weight: 600; }
.module-card p { color: var(--muted); font-size: 13px; line-height: 1.6; }

.module-card .m-foot {
  margin-top: auto;
  padding-top: 10px;
  color: var(--faint);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.module-card .m-foot .go { color: var(--text); }

/* 内嵌子应用（iframe） */
.frame-wrap {
  height: calc(100vh - 56px - 48px);
  min-height: 480px;
}

.app-frame {
  width: 100%;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  display: block;
}

/* 占位页 */
.placeholder {
  border: 1px dashed #d4d7db;
  border-radius: var(--radius);
  background: #fbfbfc;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
}

.placeholder .p-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
}

.placeholder h3 { color: var(--text); font-size: 16px; font-weight: 600; }
.placeholder p { font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translate(-50%, -8px);
  background: #17181a;
  color: #fff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 99;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 响应式兜底 */
@media (max-width: 860px) {
  .profile-stats { grid-template-columns: 1fr; }
  .profile-stats > div + div { border-left: none; border-top: 1px solid var(--border); }
  .sidebar { width: 200px; }
}
