/* ============================================================
   账户中心 - 全局样式
   设计语言：克制、专业、留白充足。无渐变光晕、无 emoji 装饰。
   主色：深海军蓝 #1f3a5f
   ============================================================ */

:root {
  --c-primary: #1f3a5f;
  --c-primary-hover: #16304d;
  --c-primary-light: #eaf0f7;
  --c-accent: #b8762a;
  --c-success: #2d6a4f;
  --c-success-light: #e6f4ee;
  --c-danger: #a32d2d;
  --c-danger-light: #fbe9e9;
  --c-warning: #b58605;
  --c-warning-light: #fdf6e3;

  --c-text: #1a202c;
  --c-text-secondary: #4a5568;
  --c-text-muted: #718096;
  --c-text-faint: #a0aec0;

  --c-border: #e2e8f0;
  --c-border-strong: #cbd5e0;
  --c-bg: #f7f8fa;
  --c-surface: #ffffff;
  --c-surface-alt: #fbfcfd;

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Monaco", "Consolas", "Courier New", monospace;
}

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

html, body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--c-primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--c-primary-hover); }

/* ============================================================
   顶部导航
   ============================================================ */
.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--c-text);
  font-weight: 600;
  font-size: 16px;
}
.brand-mark {
  width: 28px;
  height: 28px;
  background: var(--c-primary);
  border-radius: var(--radius-sm);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px solid #fff;
  border-radius: 2px;
  border-top-color: transparent;
  border-right-color: transparent;
}
.brand-text { letter-spacing: 0.3px; }

.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-item {
  color: var(--c-text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.nav-item:hover { color: var(--c-text); background: var(--c-bg); }
.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--c-border);
}
.nav-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--c-primary-light);
}
.nav-nickname {
  font-size: 14px;
  color: var(--c-text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   布局
   ============================================================ */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  min-height: calc(100vh - 60px - 60px);
}

.page-head {
  margin-bottom: 24px;
}
.page-head h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 4px;
}
.page-head p {
  color: var(--c-text-muted);
  font-size: 13px;
}

/* ============================================================
   卡片
   ============================================================ */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
}
.card-header .sub {
  font-size: 12px;
  color: var(--c-text-muted);
}
.card-body { padding: 24px; }
.card-body-tight { padding: 16px 24px; }

/* ============================================================
   表单
   ============================================================ */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-secondary);
  margin-bottom: 6px;
}
.form-label .req { color: var(--c-danger); margin-left: 2px; }
.form-hint {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-top: 4px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.1);
}
.form-control::placeholder { color: var(--c-text-faint); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.input-group {
  display: flex;
  gap: 8px;
}
.input-group .form-control { flex: 1; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--c-primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--c-primary-hover);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--c-text-secondary);
  border-color: var(--c-border-strong);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--c-bg);
  color: var(--c-text);
  border-color: var(--c-text-muted);
}
.btn-danger {
  background: var(--c-danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #8a2424; color: #fff; }
.btn-success {
  background: var(--c-success);
  color: #fff;
}
.btn-success:hover:not(:disabled) { background: #245540; color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-lg { padding: 11px 20px; font-size: 15px; }
.btn-block { width: 100%; }

/* ============================================================
   提示
   ============================================================ */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid transparent;
}
.alert-success { background: var(--c-success-light); color: var(--c-success); border-color: #c3e6d3; }
.alert-danger  { background: var(--c-danger-light); color: var(--c-danger); border-color: #f1c2c2; }
.alert-warning { background: var(--c-warning-light); color: var(--c-warning); border-color: #f0dca8; }
.alert-info    { background: var(--c-primary-light); color: var(--c-primary); border-color: #cfdcea; }
.alert-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ============================================================
   标签 / 徽章
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 10px;
  line-height: 1.5;
}
.badge-success { background: var(--c-success-light); color: var(--c-success); }
.badge-warning { background: var(--c-warning-light); color: var(--c-warning); }
.badge-danger  { background: var(--c-danger-light); color: var(--c-danger); }
.badge-info    { background: var(--c-primary-light); color: var(--c-primary); }
.badge-muted   { background: #edf2f7; color: var(--c-text-muted); }

/* ============================================================
   认证页面（登录/注册）
   ============================================================ */
.auth-wrap {
  min-height: calc(100vh - 60px - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
}
.auth-card .auth-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 4px;
}
.auth-card .auth-subtitle {
  font-size: 13px;
  color: var(--c-text-muted);
  margin-bottom: 24px;
}
.auth-card .auth-foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--c-border);
  font-size: 13px;
  color: var(--c-text-muted);
  text-align: center;
}
.auth-card .auth-foot a { font-weight: 500; }

/* ============================================================
   资料页布局
   ============================================================ */
.profile-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .profile-layout { grid-template-columns: 1fr; }
}

.profile-side .avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: block;
}
.profile-side .side-name {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--c-text);
}
.profile-side .side-email {
  text-align: center;
  font-size: 13px;
  color: var(--c-text-muted);
  margin-bottom: 16px;
  word-break: break-all;
}
.profile-side .side-stats {
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 16px;
}
.profile-side .stat-item { text-align: center; }
.profile-side .stat-num { font-size: 16px; font-weight: 600; color: var(--c-text); }
.profile-side .stat-label { font-size: 11px; color: var(--c-text-muted); }

.side-menu { list-style: none; }
.side-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--c-text-secondary);
  font-size: 14px;
}
.side-menu li a:hover { background: var(--c-bg); color: var(--c-text); }
.side-menu li a.active { background: var(--c-primary-light); color: var(--c-primary); font-weight: 500; }

/* ============================================================
   表格
   ============================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
}
.table th {
  font-weight: 500;
  color: var(--c-text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--c-surface-alt);
}
.table tbody tr:hover { background: var(--c-surface-alt); }
.table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   设备列表
   ============================================================ */
.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--c-border);
}
.device-item:last-child { border-bottom: none; }
.device-info { display: flex; align-items: center; gap: 14px; }
.device-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: var(--c-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-primary);
  font-weight: 600;
  font-size: 16px;
}
.device-name { font-size: 14px; color: var(--c-text); font-weight: 500; }
.device-meta { font-size: 12px; color: var(--c-text-muted); margin-top: 2px; }
.device-actions { display: flex; align-items: center; gap: 8px; }

/* ============================================================
   首页 Hero
   ============================================================ */
.hero {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 240px; height: 240px;
  background: var(--c-primary-light);
  border-radius: 50%;
  transform: translate(80px, -80px);
  opacity: 0.6;
}
.hero-content { position: relative; z-index: 1; max-width: 560px; }
.hero h1 {
  font-size: 28px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 12px;
  line-height: 1.3;
}
.hero p {
  font-size: 15px;
  color: var(--c-text-secondary);
  margin-bottom: 24px;
  line-height: 1.7;
}
.hero-actions { display: flex; gap: 12px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 768px) {
  .feature-grid { grid-template-columns: 1fr; }
}
.feature-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.feature-card .feature-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--c-text-faint);
  margin-bottom: 12px;
}
.feature-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 8px;
}
.feature-card p {
  font-size: 13px;
  color: var(--c-text-muted);
  line-height: 1.6;
}

/* ============================================================
   分页
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text-secondary);
}
.pagination a:hover { background: var(--c-bg); color: var(--c-text); }
.pagination .current {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}
.pagination .disabled { color: var(--c-text-faint); cursor: not-allowed; }

/* ============================================================
   页脚
   ============================================================ */
.footer {
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  height: 60px;
  display: flex;
  align-items: center;
}
.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  font-size: 12px;
  color: var(--c-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.footer-divider { color: var(--c-text-faint); }
.footer a { color: var(--c-text-muted); }
.footer a:hover { color: var(--c-text); }

/* ============================================================
   工具类
   ============================================================ */
.text-muted { color: var(--c-text-muted); }
.text-danger { color: var(--c-danger); }
.text-success { color: var(--c-success); }
.text-center { text-align: center; }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: 12px; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-4 { gap: 16px; }
.hidden { display: none; }

/* ============================================================
   管理员后台
   ============================================================ */
.admin-body { background: var(--c-bg); }

.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { display: none; }
}

.admin-side {
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
  border-bottom: 1px solid var(--c-border);
}
.admin-nav {
  flex: 1;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
}
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--c-text-secondary);
  font-size: 14px;
  border-left: 2px solid transparent;
}
.admin-nav a:hover { background: var(--c-bg); color: var(--c-text); }
.admin-nav a.active {
  background: var(--c-primary-light);
  color: var(--c-primary);
  border-left-color: var(--c-primary);
  font-weight: 500;
}
.admin-side-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-side-foot a {
  font-size: 13px;
  color: var(--c-text-muted);
  padding: 6px 0;
}
.admin-side-foot a:hover { color: var(--c-text); }

.admin-main-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.admin-topbar {
  height: 56px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.admin-topbar h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--c-text);
}
.admin-main { padding: 24px 32px; flex: 1; }
.admin-main .page-head { margin-bottom: 24px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 960px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-bottom: 8px;
}
.stat-card .stat-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--c-text);
  font-family: var(--font-mono);
}
.stat-card .stat-trend {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-top: 4px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.search-box {
  display: flex;
  gap: 8px;
  flex: 1;
  max-width: 480px;
}
.search-box .form-control { flex: 1; }

.table-actions { display: flex; gap: 6px; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 640px) {
  .topbar-inner { padding: 0 16px; }
  .container { padding: 20px 16px 48px; }
  .nav-nickname { display: none; }
  .hero { padding: 32px 24px; }
  .hero h1 { font-size: 22px; }
  .auth-card { padding: 24px; }
  .admin-main { padding: 16px; }
}
