/* ==========================================================================
   安验 开发者/代理/平台后台 — iOS 极简高级风格
   设计语言参考 iOS / macOS：大量留白、毛玻璃、克制的圆角与阴影、弹性动画。
   ========================================================================== */

:root {
  --bg: #f4f4f7;
  --bg-elevated: #ffffff;
  --bg-soft: #f2f2f7;
  --bg-sidebar: rgba(255, 255, 255, 0.72);
  --border: rgba(60, 60, 67, 0.12);
  --border-soft: rgba(60, 60, 67, 0.08);
  --text: #1c1c1e;
  --text-dim: #8a8a8e;
  --text-faint: #b5b5ba;

  --primary: #007aff;
  --primary-dim: #0064d1;
  --primary-tint: rgba(0, 122, 255, 0.1);
  --success: #34c759;
  --success-tint: rgba(52, 199, 89, 0.12);
  --warning: #ff9f0a;
  --warning-tint: rgba(255, 159, 10, 0.14);
  --danger: #ff3b30;
  --danger-tint: rgba(255, 59, 48, 0.12);
  --gray-tint: rgba(142, 142, 147, 0.14);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);

  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

* { box-sizing: border-box; }

::selection { background: var(--primary-tint); color: var(--primary-dim); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.16); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.28); background-clip: padding-box; }

html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(0, 122, 255, 0.06), transparent 60%),
    radial-gradient(1000px 500px at -10% 110%, rgba(88, 86, 214, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  letter-spacing: -0.01em;
  animation: fadeIn 0.35s var(--ease-out);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

a { color: var(--primary); text-decoration: none; transition: opacity 0.15s var(--ease-out); }
a:hover { opacity: 0.75; }

/* ---------------- Layout ---------------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 238px;
  background: var(--bg-sidebar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--border-soft);
  padding: 16px 12px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  padding: 8px 8px 16px;
}

/* ---------------- 账号信息卡（侧栏顶部） ---------------- */

.side-account {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; margin: 0 2px 16px; border-radius: 12px;
  background: var(--bg-elevated); border: 1px solid var(--border-soft);
  animation: sideAccountIn 0.5s var(--ease-spring) 0.05s backwards;
  transition: box-shadow 0.2s var(--ease-out), transform 0.2s var(--ease-spring);
}
.side-account:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
@keyframes sideAccountIn { from { opacity: 0; transform: translateY(-6px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.side-account-avatar {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #5856d6); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.side-account-info { min-width: 0; overflow: hidden; }
.side-account-name {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-account-tier {
  font-size: 11px; color: var(--text-dim); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------------- 品牌标识（图形徽标 + 中英文双语字标） ---------------- */

.brand-lockup { display: inline-flex; align-items: center; gap: 9px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #5856d6);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 122, 255, 0.28);
}
.brand-mark svg { width: 17px; height: 17px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text .en { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); font-family: -apple-system, "SF Pro Display", "Segoe UI", sans-serif; }
.brand-text .en b { color: var(--primary); font-weight: 800; }
.brand-text .cn { font-size: 10px; font-weight: 600; letter-spacing: 0.22em; color: var(--text-faint); margin-top: 2px; }

.brand-lockup.lg .brand-mark { width: 46px; height: 46px; border-radius: 13px; }
.brand-lockup.lg .brand-mark svg { width: 26px; height: 26px; }
.brand-lockup.lg .brand-text .en { font-size: 27px; }
.brand-lockup.lg .brand-text .cn { font-size: 12px; }

.sidebar nav { display: flex; flex-direction: column; flex: 1; }

.nav-group { display: flex; flex-direction: column; gap: 1px; margin-bottom: 2px; animation: navGroupIn 0.42s var(--ease-out) backwards; }
.nav-group:nth-child(1) { animation-delay: 0.03s; }
.nav-group:nth-child(2) { animation-delay: 0.09s; }
.nav-group:nth-child(3) { animation-delay: 0.15s; }
.nav-group:nth-child(n+4) { animation-delay: 0.2s; }
@keyframes navGroupIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-faint); padding: 14px 11px 6px;
}
.nav-group:first-child .nav-label { padding-top: 2px; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px 8px 9px;
  margin-left: -3px;
  color: var(--text-dim);
  border-radius: 9px;
  border-left: 3px solid transparent;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out), border-color 0.18s var(--ease-out), padding-left 0.18s var(--ease-out);
  position: relative;
}

.sidebar nav a .nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-faint);
  transition: color 0.18s var(--ease-out);
}

.sidebar nav a .nav-icon .icon-svg { display: block; }

.sidebar nav a:hover { background: var(--gray-tint); color: var(--text); padding-left: 12px; }
.sidebar nav a:hover .nav-icon { color: var(--text-dim); }
.sidebar nav a:active { background: var(--border-soft); }

.sidebar nav a.active {
  background: var(--primary-tint);
  border-left-color: var(--primary);
  color: var(--primary-dim);
  font-weight: 600;
  padding-left: 12px;
}

.sidebar nav a.active .nav-icon { color: var(--primary); }

/* ---------------- 签到卡片 ---------------- */

.checkin-box {
  margin: 14px 4px 4px;
  padding: 12px 13px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 159, 10, 0.12), rgba(255, 59, 48, 0.06));
  border: 1px solid rgba(255, 159, 10, 0.18);
  animation: riseIn 0.5s var(--ease-out) 0.25s backwards;
  transition: box-shadow 0.2s var(--ease-out);
}
.checkin-box:hover { box-shadow: 0 4px 16px rgba(255, 159, 10, 0.12); }

.checkin-row { display: flex; align-items: center; gap: 10px; }

.checkin-flame {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 159, 10, 0.16); color: var(--warning);
  animation: flamePulse 2.4s ease-in-out infinite;
}
@keyframes flamePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

.checkin-info { flex: 1; min-width: 0; }
.checkin-title { font-size: 12.5px; font-weight: 600; color: var(--text); }
.checkin-title b { color: var(--warning); font-size: 14px; }
.checkin-sub { font-size: 11px; color: var(--text-dim); margin-top: 1px; }

.checkin-box .btn.small { flex-shrink: 0; }
.checkin-box .btn.small:disabled { background: var(--gray-tint); color: var(--text-faint); opacity: 1; box-shadow: none; }

.sidebar-foot { margin-top: auto; padding: 10px; font-size: 11px; color: var(--text-faint); }

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

.topbar {
  height: 60px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: rgba(244, 244, 247, 0.75);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  position: sticky;
  top: 0;
  z-index: 40;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar > .flex > div:not(.hamburger) { animation: headingIn 0.42s var(--ease-out); }
@keyframes headingIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.content { padding: 26px 28px 60px; flex: 1; overflow-x: auto; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------------- Cards & panels ---------------- */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s var(--ease-out);
  animation: riseIn 0.4s var(--ease-out);
}
.card:hover { box-shadow: var(--shadow); }

@keyframes riseIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease-out);
  animation: statCardIn 0.45s var(--ease-out) backwards;
}
@keyframes statCardIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.stat-grid .stat-card:nth-child(1) { animation-delay: 0.02s; }
.stat-grid .stat-card:nth-child(2) { animation-delay: 0.07s; }
.stat-grid .stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-grid .stat-card:nth-child(4) { animation-delay: 0.17s; }
.stat-grid .stat-card:nth-child(n+5) { animation-delay: 0.2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .label { color: var(--text-dim); font-size: 12px; margin-bottom: 8px; font-weight: 500; }
.stat-card .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.stat-card.highlight {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.1), rgba(88, 86, 214, 0.06));
  border: 1px solid rgba(0, 122, 255, 0.18);
}
.stat-card.highlight .label { color: var(--primary-dim); }
.stat-card.highlight .value { color: var(--primary); }

/* ---------------- Table ---------------- */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); text-align: left; white-space: nowrap; }
th { color: var(--text-dim); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr { transition: background 0.15s var(--ease-out); animation: rowIn 0.4s var(--ease-out) backwards; }
tbody tr:hover td { background: rgba(0, 0, 0, 0.02); }
tbody tr:last-child td { border-bottom: none; }
@keyframes rowIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
tbody tr:nth-child(1) { animation-delay: 0.01s; }
tbody tr:nth-child(2) { animation-delay: 0.03s; }
tbody tr:nth-child(3) { animation-delay: 0.05s; }
tbody tr:nth-child(4) { animation-delay: 0.07s; }
tbody tr:nth-child(5) { animation-delay: 0.09s; }
tbody tr:nth-child(6) { animation-delay: 0.11s; }
tbody tr:nth-child(7) { animation-delay: 0.13s; }
tbody tr:nth-child(8) { animation-delay: 0.15s; }
tbody tr:nth-child(9) { animation-delay: 0.17s; }
tbody tr:nth-child(n+10) { animation-delay: 0.19s; }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); color: #fff; border: none;
  padding: 10px 18px; min-height: 40px; border-radius: 10px; cursor: pointer; font-size: 14px;
  font-weight: 600; letter-spacing: -0.01em;
  transition: transform 0.2s var(--ease-spring), background 0.15s var(--ease-out), box-shadow 0.22s var(--ease-out), opacity 0.15s;
  box-shadow: 0 1px 2px rgba(0, 122, 255, 0.15);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn.loading { pointer-events: none; opacity: 0.75; }
.btn .btn-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff;
  animation: btnSpin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }
.btn::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.55s var(--ease-out);
  z-index: -1;
}
/* 悬浮态只在真正有鼠标指针的设备上生效，避免触屏点击后「粘住」悬浮态导致按钮视觉异常 */
@media (hover: hover) and (pointer: fine) {
  .btn:hover::before { transform: translateX(120%); }
  .btn:hover { background: var(--primary-dim); transform: translateY(-1.5px); box-shadow: 0 6px 16px rgba(0, 122, 255, 0.28); }
  .btn.secondary:hover { background: rgba(0, 0, 0, 0.06); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06); }
  .btn.danger:hover { background: #e0332a; box-shadow: 0 6px 16px rgba(255, 59, 48, 0.3); }
  .btn.success:hover { background: #2aa84a; box-shadow: 0 6px 16px rgba(52, 199, 89, 0.3); }
}
.btn:active { transform: translateY(0) scale(0.96); box-shadow: 0 1px 2px rgba(0, 122, 255, 0.15); }
.btn.secondary { background: var(--bg-soft); border: 1px solid var(--border); color: var(--text); box-shadow: none; }
.btn.danger { background: var(--danger); box-shadow: 0 1px 2px rgba(255, 59, 48, 0.2); }
.btn.success { background: var(--success); box-shadow: 0 1px 2px rgba(52, 199, 89, 0.2); }
.btn.small { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn.full { display: flex; width: 100%; justify-content: center; }
.btn.dark { background: #2f363c; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.btn.dark:hover { background: #1f2429; box-shadow: 0 6px 16px rgba(0,0,0,0.3); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn:disabled::before { display: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-tint), 0 0 0 1px var(--primary); }

/* 表格内的小型彩色操作胶囊按钮（应用列表 / 密钥复制等，参考成熟验证系统的紧凑排版） */
.pill-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 22px; padding: 0 10px; border-radius: 7px; font-size: 12px; font-weight: 600;
  color: #fff; cursor: pointer; white-space: nowrap; user-select: none;
  transition: transform 0.15s var(--ease-spring), opacity 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}
.pill-btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.15); }
.pill-btn:active { transform: translateY(0) scale(0.94); }
.pill-teal { background: var(--primary); }
.pill-blue { background: #1e9fff; }
.pill-orange { background: #ffb800; }
.pill-red { background: var(--danger); }

.app-table th, .app-table td { padding: 9px 12px; }
.app-key-cell { display: flex; align-items: center; gap: 8px; }
.app-key-text { max-width: 210px; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- Forms ---------------- */

input, select, textarea {
  background: var(--bg-soft);
  border: 1px solid transparent;
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  width: 100%;
  min-height: 42px;
  font-family: inherit;
  transition: box-shadow 0.15s var(--ease-out), background 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px var(--primary-tint), 0 0 0 1px var(--primary);
}
textarea { resize: vertical; min-height: 78px; }
input::placeholder { color: var(--text-faint); }
select { cursor: pointer; }

.form-row { margin-bottom: 16px; }
.form-row label { display: block; margin-bottom: 7px; color: var(--text-dim); font-size: 12.5px; font-weight: 500; }
.form-inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-inline .form-row { flex: 1; min-width: 160px; margin-bottom: 0; }

/* 图标输入框（登录/注册页），参考成熟验证系统的排版：左侧固定图标 + 输入框 */
.field-icon { position: relative; }
.field-icon .field-icon-glyph {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
  pointer-events: none; transition: color 0.15s var(--ease-out); z-index: 1;
}
.field-icon .field-icon-glyph svg { width: 17px; height: 17px; }
.field-icon input { padding-left: 42px; }
.field-icon:focus-within .field-icon-glyph { color: var(--primary); }

.field-inline-btn { position: relative; }
.field-inline-btn input { padding-right: 108px; }
.field-inline-btn .btn.small { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); }

/* ---------------- 分组表单（新建应用等复杂表单） ---------------- */

.form-section {
  margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--border-soft);
  animation: sectionIn 0.36s var(--ease-out) backwards;
}
.form-section:nth-of-type(1) { animation-delay: 0.02s; }
.form-section:nth-of-type(2) { animation-delay: 0.06s; }
.form-section:nth-of-type(3) { animation-delay: 0.1s; }
.form-section:nth-of-type(4) { animation-delay: 0.14s; }
@keyframes sectionIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section-head { margin-bottom: 12px; }
.form-section-title {
  font-size: 12.5px; font-weight: 700; color: var(--text); letter-spacing: 0.01em;
  display: flex; align-items: center; gap: 7px;
}
.form-section-title::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--primary); display: inline-block; flex-shrink: 0; }
.form-section-desc { font-size: 11.5px; color: var(--text-faint); line-height: 1.6; margin: 4px 0 0 10px; }
.field-note { font-size: 11px; color: var(--text-faint); line-height: 1.65; margin: -6px 0 12px; padding: 8px 10px; background: var(--bg-soft); border-radius: 8px; }

/* 文件上传进度条 */
.upload-progress { margin-top: 10px; display: none; }
.upload-progress.show { display: block; animation: sectionIn 0.25s var(--ease-out); }
.upload-progress-head { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--text-dim); margin-bottom: 6px; }
.upload-progress-pct { font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.upload-progress-track { position: relative; height: 8px; border-radius: 6px; background: var(--bg-soft); overflow: hidden; }
.upload-progress-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%; border-radius: 6px;
  background: linear-gradient(90deg, var(--primary), #5ac8fa);
  transition: width 0.2s var(--ease-out);
}
.upload-progress-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.45) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: uploadShimmer 1.1s linear infinite;
}
@keyframes uploadShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.upload-progress-fill.done { background: linear-gradient(90deg, var(--success), #30d158); }
.upload-progress-fill.done::after { display: none; }

/* iOS 风格开关 */
.switch { position: relative; display: inline-block; width: 42px; height: 25px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: #e5e5ea; border-radius: 999px; cursor: pointer;
  transition: background 0.25s var(--ease-out);
}
.switch .track::before {
  content: ""; position: absolute; width: 21px; height: 21px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.25s var(--ease-spring);
}
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::before { transform: translateX(17px); }

/* ---------------- 接口开关列表 ---------------- */

.switch-list { display: flex; flex-direction: column; gap: 4px; max-height: 54vh; overflow-y: auto; }
.switch-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 4px; border-bottom: 1px solid var(--border-soft);
  animation: sectionIn 0.32s var(--ease-out) backwards;
}
.switch-item:last-child { border-bottom: none; }
.switch-item-info { min-width: 0; }
.switch-item-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.switch-item-desc { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; line-height: 1.5; }
.switch-item-path { font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }

/* ---------------- 应用设置：左侧竖向导航 + 右侧内容面板 ---------------- */

.settings-layout { display: flex; gap: 18px; align-items: flex-start; }
.settings-nav {
  width: 200px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px;
  background: var(--bg-elevated); border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  padding: 8px; box-shadow: var(--shadow-sm);
  animation: sectionIn 0.36s var(--ease-out) backwards;
}
.settings-nav-item {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px;
  cursor: pointer; border-left: 3px solid transparent; transition: background 0.18s var(--ease-out), border-color 0.18s var(--ease-out);
}
.settings-nav-item:hover { background: var(--bg-soft); }
.settings-nav-item.active { background: var(--primary-tint); border-left-color: var(--primary); }
.settings-nav-name { font-size: 13px; font-weight: 600; color: var(--text); }
.settings-nav-item.active .settings-nav-name { color: var(--primary-dim); }
.settings-nav-desc { font-size: 10.5px; color: var(--text-faint); }
.settings-content {
  flex: 1; min-width: 0; padding: 22px 24px;
  animation: sectionIn 0.36s var(--ease-out) 0.04s backwards;
}
.settings-content.pane-in { animation: sectionIn 0.28s var(--ease-out); }

@media (max-width: 860px) {
  .settings-layout { flex-direction: column; }
  .settings-nav { width: 100%; flex-direction: row; overflow-x: auto; }
  .settings-nav-item { flex-shrink: 0; border-left: none; border-bottom: 3px solid transparent; }
  .settings-nav-item.active { border-left-color: transparent; border-bottom-color: var(--primary); }
}

/* ---------------- Badges ---------------- */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
}
.badge.green { background: var(--success-tint); color: #1a9c40; }
.badge.red { background: var(--danger-tint); color: #d92c22; }
.badge.yellow { background: var(--warning-tint); color: #b5750a; }
.badge.gray { background: var(--gray-tint); color: var(--text-dim); }
.badge.blue { background: var(--primary-tint); color: var(--primary-dim); }

/* ---------------- Toolbar / misc ---------------- */

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.pager { display: flex; gap: 6px; margin-top: 14px; align-items: center; color: var(--text-dim); font-size: 12px; }

.mono { font-family: "SF Mono", Consolas, "Courier New", monospace; }
.dim { color: var(--text-dim); }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }

/* ---------------- Segmented tabs ---------------- */

.tabs {
  display: inline-flex; gap: 2px; margin-bottom: 18px; padding: 3px;
  background: var(--bg-soft); border-radius: 11px; position: relative;
}
.tabs .tab-indicator {
  position: absolute; top: 3px; bottom: 3px; left: 0;
  background: var(--bg-elevated); border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.32s var(--ease-spring), width 0.32s var(--ease-spring);
  z-index: 0;
}
.tabs .tab {
  padding: 7px 18px; cursor: pointer; color: var(--text-dim); font-size: 13px; font-weight: 600;
  border-radius: 8px; position: relative; z-index: 1; transition: color 0.2s var(--ease-out);
  white-space: nowrap;
}
.tabs .tab.active { color: var(--text); }

/* ---------------- Modal ---------------- */

.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  opacity: 0; transition: opacity 0.22s var(--ease-out);
}
.modal-mask.show { opacity: 1; }
.modal-mask.closing { opacity: 0; }
.modal-box {
  background: var(--bg-elevated); border-radius: var(--radius-xl);
  padding: 26px 26px 24px; width: 460px; max-width: 92vw; max-height: 86vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9) translateY(10px); opacity: 0;
  transition: transform 0.28s var(--ease-spring), opacity 0.22s var(--ease-out);
}
.modal-mask.show .modal-box { transform: scale(1) translateY(0); opacity: 1; }
.modal-mask.closing .modal-box { transform: scale(0.94) translateY(6px); opacity: 0; }
.modal-box h3 { margin-top: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.modal-box.narrow { width: 360px; padding: 30px 24px 24px; }
.modal-box.wide { width: 560px; }

/* ---------------- 自定义确认弹窗（替代原生 confirm） ---------------- */

.confirm-modal { text-align: center; }
.confirm-icon {
  width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 16px;
  display: inline-flex; align-items: center; justify-content: center;
  animation: confirmIconIn 0.42s var(--ease-spring);
}
.confirm-icon svg { width: 27px; height: 27px; }
.confirm-icon.warn { background: var(--warning-tint); color: var(--warning); }
.confirm-icon.danger { background: var(--danger-tint); color: var(--danger); }
@keyframes confirmIconIn { from { opacity: 0; transform: scale(0.4) rotate(-20deg); } to { opacity: 1; transform: scale(1) rotate(0deg); } }
.confirm-modal h3 { text-align: center; font-size: 16.5px; }
.confirm-msg { color: var(--text-dim); font-size: 13.5px; line-height: 1.65; margin: 0 0 22px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; justify-content: center; }

/* ---------------- Toast ---------------- */

.toast-stack {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: rgba(28, 28, 30, 0.94); color: #fff;
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  padding: 12px 14px 14px 14px; border-radius: 15px; min-width: 220px; max-width: 380px;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-18px) scale(0.92);
  transition: opacity 0.32s var(--ease-spring), transform 0.32s var(--ease-spring);
  position: relative; overflow: hidden;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.hide { opacity: 0; transform: translateY(-12px) scale(0.95); transition-duration: 0.22s; }
.toast-icon {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.16); color: #fff;
  animation: toastIconPop 0.4s var(--ease-spring) 0.05s backwards;
}
.toast-icon svg { width: 12px; height: 12px; }
@keyframes toastIconPop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.toast.success .toast-icon { background: var(--success); }
.toast.error .toast-icon { background: var(--danger); }
.toast.info .toast-icon { background: var(--primary); }
.toast-msg { flex: 1; line-height: 1.5; }
.toast-close {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.4);
  transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.toast-close svg { width: 9px; height: 9px; }
.toast-close:hover { background: rgba(255,255,255,0.14); color: #fff; }
.toast-bar {
  position: absolute; left: 0; bottom: 0; height: 2.5px; width: 100%;
  background: rgba(255, 255, 255, 0.3); transform-origin: left;
  animation: toastShrink 3.4s linear forwards;
}
.toast.success .toast-bar { background: var(--success); }
.toast.error .toast-bar { background: var(--danger); }
.toast.info .toast-bar { background: var(--primary); }
@keyframes toastShrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------------- Login ---------------- */

.login-wrap {
  position: relative;
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(0, 122, 255, 0.14), transparent 60%),
    radial-gradient(900px 500px at 85% 90%, rgba(88, 86, 214, 0.12), transparent 60%),
    var(--bg);
}

.login-back {
  position: absolute; top: 26px; left: 28px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px 8px 12px; border-radius: 999px;
  background: var(--bg-elevated); border: 1px solid var(--border-soft);
  color: var(--text-dim); font-size: 12.5px; font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease-spring), box-shadow 0.22s var(--ease-out), color 0.18s, background 0.18s;
  animation: loginBackIn 0.5s var(--ease-out);
}
.login-back svg { width: 14px; height: 14px; transition: transform 0.22s var(--ease-spring); }
.login-back:hover { color: var(--text); background: var(--bg-soft); box-shadow: var(--shadow); opacity: 1; transform: translateY(-1px); }
.login-back:hover svg { transform: translateX(-2px); }
.login-back:active { transform: translateY(0) scale(0.96); }
@keyframes loginBackIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
@media (max-width: 860px) {
  .login-back { top: 16px; left: 16px; padding: 7px 13px 7px 10px; font-size: 12px; }
}
.login-box {
  width: 396px; background: var(--bg-elevated);
  border-radius: var(--radius-xl); padding: 42px 36px 36px;
  box-shadow: var(--shadow-lg);
  animation: loginIn 0.5s var(--ease-spring);
}
@keyframes loginIn { from { opacity: 0; transform: translateY(18px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.login-brand { display: flex; justify-content: center; margin-bottom: 18px; }
.login-box h1 { text-align: center; font-size: 18px; font-weight: 700; margin: 0 0 28px; letter-spacing: -0.01em; color: var(--text); }
.login-box .form-row { margin-bottom: 16px; }
.login-box .btn { width: 100%; justify-content: center; margin-top: 12px; padding: 13px; min-height: 46px; font-size: 15px; }

/* 登录/注册协议勾选行 */
.agree-row { display: flex; align-items: flex-start; gap: 8px; margin: -2px 0 18px; font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.agree-row input[type="checkbox"] { margin-top: 1px; }

/* 登录/注册页底部左右分布的辅助链接行（超窄屏/大字号时自动换行，避免撑破卡片） */
.login-links { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 10px; margin-top: 18px; font-size: 13px; }
.login-links a { font-weight: 600; white-space: nowrap; }
.login-links .dim-txt { color: var(--text-dim); }

/* ---------------- 身份选择页（官网「登录」入口，跳转整页而非弹窗） ---------------- */

.entry-box { width: 460px; }
.entry-box h1 { margin-bottom: 8px; }
.entry-sub { text-align: center; color: var(--text-dim); font-size: 13px; margin: 0 0 26px; }
.role-cards { display: flex; flex-direction: column; gap: 12px; }
.role-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border-radius: var(--radius-lg);
  background: var(--bg-soft); border: 1px solid var(--border-soft);
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .role-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); }
}
.role-card-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #5856d6); color: #fff;
}
.role-card-icon svg { width: 22px; height: 22px; }
.role-card-info { flex: 1; min-width: 0; }
.role-card-name { font-size: 15px; font-weight: 700; color: var(--text); }
.role-card-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; line-height: 1.5; }
.role-card-actions { display: flex; gap: 8px; flex-shrink: 0; }
.role-card-actions a { flex-shrink: 0; }
.role-card-actions .btn { padding: 7px 14px; min-height: 32px; font-size: 12.5px; }

/* ---------------- Card keys box ---------------- */

.keys-box {
  background: var(--bg-soft); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 14px; max-height: 220px; overflow-y: auto;
}
.keys-box div { font-family: "SF Mono", Consolas, monospace; padding: 3px 0; font-size: 13px; }

.hint-box {
  background: var(--primary-tint); color: var(--primary-dim); border-radius: var(--radius);
  padding: 12px 14px; font-size: 12.5px; margin-bottom: 16px; line-height: 1.6;
}

/* ---------------- Checkbox ---------------- */

input[type="checkbox"] {
  width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0;
}

/* ---------------- Chart ---------------- */

.chart-wrap { width: 100%; overflow-x: auto; }
.chart-wrap svg { display: block; }
.chart-legend { display: flex; gap: 18px; margin-top: 10px; font-size: 12px; color: var(--text-dim); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------------- Mobile / responsive ---------------- */

.hamburger {
  display: none;
  background: var(--bg-soft); border: none; border-radius: 9px;
  width: 36px; height: 36px; font-size: 17px; cursor: pointer; color: var(--text);
  align-items: center; justify-content: center; flex-shrink: 0;
  transition: background 0.15s var(--ease-out), transform 0.15s var(--ease-spring);
}
.hamburger:active { transform: scale(0.92); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px); z-index: 59;
  opacity: 0; transition: opacity 0.25s var(--ease-out);
}

@media (max-width: 860px) {
  .content { padding: 16px 14px 40px; }
  .topbar { padding: 0 14px; height: 54px; font-size: 16px; }
  .hamburger { display: inline-flex; }

  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 60;
    width: 78vw; max-width: 300px;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease-out);
    box-shadow: var(--shadow-lg);
  }
  .sidebar .brand, .sidebar nav a .label { display: block; }
  .sidebar nav a { justify-content: flex-start; }

  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; opacity: 1; }
  body.sidebar-open { overflow: hidden; }

  /* 卡片内表格允许横向滚动，不撑破整体布局 */
  .card { padding: 16px; border-radius: 16px; }
  .card:has(table) { padding: 14px 0 6px; }
  .card:has(table) > *:not(table):not(.pager) { padding-left: 16px; padding-right: 16px; }
  .card table { display: block; overflow-x: auto; white-space: nowrap; padding: 0 14px 6px; }
  .card .pager { padding: 0 16px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px 14px; }
  .stat-card .value { font-size: 22px; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar > * { width: 100%; }
  .toolbar select, .toolbar input { width: auto; }
  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline .form-row { min-width: 0; }
  .form-inline .btn { width: 100%; justify-content: center; }

  /* iOS 上 input 字号低于 16px 会自动放大整页面，这里统一给到 16px 避免聚焦时跳变 */
  input, select, textarea { font-size: 16px; padding: 10px 12px; }
  .btn { padding: 10px 16px; font-size: 14px; min-height: 40px; }
  .btn.small { min-height: 34px; padding: 7px 12px; }

  .modal-box { width: 94vw; padding: 20px 18px; border-radius: 20px; }
  .login-box { width: 88vw; padding: 30px 22px; }

  .tabs { display: flex; overflow-x: auto; max-width: 100%; }
  .tabs .tab { padding: 8px 14px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .topbar { font-size: 15px; }
}
