/* knowlyr-id 专属样式
   官网 knowlyr.css 已通过 <link> 引入，提供 :root 变量和基础组件
   本文件只写 knowlyr-id 特有的样式 */

/* ── 页面布局 — body flex 撑满视口 ── */
html {
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-soft, #f8f8f6);
}

/* 认证页面（登录/注册）垂直居中 */
.auth-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

/* ── 卡片容器 ── */
.id-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: var(--bg, #fff);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

/* 品牌标识 — 卡片顶部 */
.id-card-brand {
  text-align: center;
  margin-bottom: 32px;
}

.id-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 12px;
  margin-bottom: 24px;
}

.id-card-title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.01em;
  color: var(--text, #1a1a1a);
}

.id-card-subtitle {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-tertiary, #999);
  text-align: center;
  margin-top: 8px;
  letter-spacing: 0.04em;
}

/* 分割线 */
.id-card-divider {
  width: 40px;
  height: 2px;
  background: var(--border);
  margin: 24px auto;
}

/* ── 登录方式切换 ── */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 10px 0;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-tertiary, #999);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.2s;
}

.auth-tab:hover {
  color: var(--text, #1a1a1a);
}

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

/* ── 表单 ── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text, #1a1a1a);
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  line-height: 48px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  background: var(--bg, #fff);
  color: var(--text, #1a1a1a);
}

.form-input::placeholder {
  color: #bbb;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light, rgba(13,107,94,0.06));
}

.form-input--error {
  border-color: #e53e3e;
}

.form-input--error:focus {
  box-shadow: 0 0 0 3px rgba(229,62,62,0.06);
}

/* 密码输入框容器 */
.form-input-wrap {
  position: relative;
}

.form-input-wrap .form-input {
  padding-right: 48px;
}

.form-toggle-pw {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary, #999);
  font-size: 18px;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.form-toggle-pw:hover {
  color: var(--text, #1a1a1a);
}

/* 验证码输入框 + 发送按钮 */
.form-code-wrap {
  display: flex;
  gap: 8px;
}

.form-code-wrap .form-input {
  flex: 1;
}

.btn-send-code {
  flex-shrink: 0;
  padding: 0 16px;
  height: 48px;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-light, rgba(13,107,94,0.06));
  border: 1px solid var(--accent-border, rgba(13,107,94,0.18));
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-send-code:hover {
  background: rgba(13,107,94,0.12);
}

.btn-send-code:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-send-code--disabled {
  color: var(--text-tertiary, #999);
  background: var(--bg-soft, #f8f8f6);
  border-color: var(--border);
}

.form-hint {
  font-size: 12px;
  color: var(--text-tertiary, #999);
  margin-top: 6px;
}

.form-error {
  font-size: 12px;
  color: #d1242f;
  margin-top: 6px;
}

/* ── 按钮 ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius, 8px);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  height: 48px;
  padding: 0 24px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(13,107,94,0.2);
}

.btn-primary:hover {
  background: #0a5a4f;
  box-shadow: 0 4px 16px rgba(13,107,94,0.3);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: #ccc;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg, #fff);
  color: var(--text, #1a1a1a);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-hover, #ccc);
  background: var(--bg-soft, #f8f8f6);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

/* ── 消息提示 ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius, 8px);
  font-size: 14px;
  margin-bottom: 20px;
}

.alert-error {
  background: rgba(209,36,47,0.06);
  color: #d1242f;
  border: 1px solid rgba(209,36,47,0.15);
}

.alert-success {
  background: var(--accent-light, rgba(13,107,94,0.06));
  color: var(--accent);
  border: 1px solid var(--accent-border, rgba(13,107,94,0.18));
}

/* ── 链接文本 ── */
.text-center {
  text-align: center;
}

.text-link {
  color: var(--text-tertiary, #999);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.text-link:hover {
  color: var(--accent);
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

/* 登录按钮上方额外间距 */
.form-group--submit {
  margin-top: 28px;
  margin-bottom: 0;
}

/* ── 底部链接行 ── */
.id-card-footer {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light, #f0f0ed);
  text-align: center;
}

/* ── emoji 选择器 ── */
.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.emoji-option {
  cursor: pointer;
}

.emoji-option input {
  display: none;
}

.emoji-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 22px;
  border: 2px solid transparent;
  border-radius: 10px;
  transition: all 0.15s;
}

.emoji-option input:checked + .emoji-display {
  border-color: var(--accent);
  background: var(--accent-light, rgba(13,107,94,0.06));
}

.emoji-display:hover {
  background: var(--bg-soft, #f8f8f6);
}

/* ── 能力领域选择器 ── */
.domain-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.domain-option {
  cursor: pointer;
}

.domain-option input {
  display: none;
}

.domain-option .tag {
  transition: all 0.15s;
  border: 1px solid var(--border);
  cursor: pointer;
}

.domain-option input:checked + .tag {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── 身份证卡片 ── */
.profile-page {
  flex: 1;
  padding: 48px 24px;
  background: var(--bg-soft, #f8f8f6);
}

.profile-card {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg, #fff);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
}

.profile-header {
  text-align: center;
  padding: 40px 28px 24px;
  background: linear-gradient(180deg, var(--accent-light, rgba(13,107,94,0.06)) 0%, transparent 100%);
  position: relative;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  background: var(--bg, #fff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 2px solid var(--bg, #fff);
}

.profile-name {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.profile-meta {
  font-size: 14px;
  color: var(--text-secondary, #555);
}

.profile-level {
  color: var(--accent);
  font-weight: 600;
}

.profile-role-sep {
  margin: 0 6px;
  color: var(--border);
}

.profile-bio {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-tertiary, #999);
}

.profile-info {
  padding: 20px 28px;
}

.profile-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 14px;
}

.profile-info-row + .profile-info-row {
  border-top: 1px solid var(--border-light, #f0f0ed);
}

.profile-info-label {
  color: var(--text-tertiary, #999);
  flex-shrink: 0;
  margin-right: 16px;
  font-size: 13px;
}

.profile-info-value {
  text-align: right;
  font-weight: 500;
}

.profile-info-value .tag {
  font-size: 12px;
  padding: 2px 8px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  background: var(--bg-soft, #f8f8f6);
}

.profile-stat {
  text-align: center;
  padding: 20px 8px;
}

.profile-stat + .profile-stat {
  border-left: 1px solid var(--border-light, #f0f0ed);
}

.profile-stat-num {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text, #1a1a1a);
}

.profile-stat-label {
  font-size: 11px;
  color: var(--text-tertiary, #999);
  margin-top: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-activities {
  padding: 20px 28px;
  border-top: 1px solid var(--border);
}

.profile-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary, #999);
  margin-bottom: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.profile-activity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
}

.profile-activity + .profile-activity {
  border-top: 1px solid var(--border-light, #f0f0ed);
}

.activity-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.activity-badge--points {
  background: var(--accent-light, rgba(13,107,94,0.06));
  color: var(--accent);
}

.activity-badge--income {
  background: var(--indigo-light, rgba(99,102,241,0.08));
  color: var(--indigo, #6366f1);
}

/* ── 员工认证徽章 ── */

.badge-staff {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(130, 80, 223, 0.08);
  color: #8250df;
  letter-spacing: 0.02em;
}

.activity-text {
  flex: 1;
  color: var(--text-secondary, #555);
}

.activity-time {
  flex-shrink: 0;
  color: var(--text-tertiary, #999);
  font-size: 12px;
  font-family: var(--font-mono);
}

.profile-actions {
  display: flex;
  gap: 8px;
  padding: 20px 28px;
  border-top: 1px solid var(--border);
}

.profile-actions .btn {
  flex: 1;
}

/* ── 邀请页 ── */
.invite-code-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: var(--bg-soft, #f8f8f6);
  border-radius: var(--radius, 8px);
  margin-bottom: 8px;
}

.invite-code-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 4px;
  color: var(--accent);
}

.invite-stat {
  text-align: center;
  margin: 20px 0;
  font-size: 14px;
  color: var(--text-secondary, #555);
}

.invite-list {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 12px;
}

.invite-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  font-size: 14px;
}

.invite-item + .invite-item {
  border-top: 1px solid var(--border-light, #f0f0ed);
}

.invite-item-emoji {
  font-size: 20px;
}

.invite-item-name {
  flex: 1;
  font-weight: 500;
}

.invite-item-time {
  color: var(--text-tertiary, #999);
  font-size: 12px;
  font-family: var(--font-mono);
}

/* ── 管理后台 ── */
.admin-page {
  flex: 1;
  padding: 48px 24px;
  background: var(--bg-soft, #f8f8f6);
}

.admin-container {
  max-width: 900px;
  margin: 0 auto;
}

.admin-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.admin-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.admin-nav-item {
  padding: 8px 16px;
  font-size: 14px;
  text-decoration: none;
  color: var(--text-tertiary, #999);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s;
  font-weight: 500;
}

.admin-nav-item:hover {
  color: var(--text, #1a1a1a);
}

.admin-nav-item--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.admin-stat-card {
  text-align: center;
  padding: 20px 16px;
  background: var(--bg, #fff);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.admin-stat-num {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.admin-stat-label {
  font-size: 12px;
  color: var(--text-tertiary, #999);
  margin-top: 4px;
  letter-spacing: 0.04em;
}

.admin-quick {
  display: flex;
  gap: 8px;
}

.admin-search {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-search .form-input {
  flex: 1;
  max-width: 300px;
}
.admin-search .btn {
  width: auto;
  flex-shrink: 0;
}

.admin-info {
  font-size: 13px;
  color: var(--text-tertiary, #999);
  margin-bottom: 12px;
}

.admin-table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
  background: var(--bg, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-tertiary, #999);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light, #f0f0ed);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover {
  background: var(--bg-soft, #f8f8f6);
}

.admin-pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.admin-back {
  margin-bottom: 16px;
}

.admin-user-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding: 24px;
  background: var(--bg, #fff);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.admin-user-avatar {
  font-size: 48px;
  line-height: 1;
}

.admin-user-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.admin-user-id {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-tertiary, #999);
  font-family: var(--font-mono);
  margin-left: 8px;
}

.admin-user-meta {
  font-size: 13px;
  color: var(--text-secondary, #555);
  margin-bottom: 8px;
}

.admin-user-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.admin-user-tags .tag {
  font-size: 12px;
  padding: 2px 8px;
}

.admin-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.admin-action-card {
  padding: 20px;
  background: var(--bg, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.admin-action-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.admin-log-section {
  margin-bottom: 24px;
}

.admin-log-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* ── 响应式 ── */
@media (max-width: 640px) {
  .id-card {
    max-width: calc(100% - 32px);
    padding: 32px 24px;
  }

  .auth-page {
    padding: 24px 16px;
    align-items: flex-start;
    padding-top: 10vh;
  }

  .profile-card {
    margin: 0 16px;
    border-radius: 12px;
  }

  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .profile-stat:nth-child(3) {
    border-left: none;
  }

  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-actions-grid {
    grid-template-columns: 1fr;
  }
}
