:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.82);
  --solid: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --tertiary: #98989d;
  --line: rgba(0, 0, 0, 0.08);
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --green: #248a3d;
  --orange: #c93400;
  --red: #d70015;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.07);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(circle at 80% -10%, rgba(0, 113, 227, 0.08), transparent 32%), var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button, .button {
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  color: #fff;
  border-radius: 12px;
  background: var(--blue);
  font-weight: 600;
  font-size: 13px;
  transition: transform 0.15s, background 0.15s, opacity 0.15s, box-shadow 0.15s;
}

button:hover, .button:hover {
  background: var(--blue-hover);
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.25);
}

button:active, .button:active {
  transform: scale(0.98);
}

button:disabled, .button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

button.secondary, .button.secondary {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

button.secondary:hover, .button.secondary:hover {
  background: rgba(0, 0, 0, 0.08);
  box-shadow: none;
}

button.danger, .button.danger {
  background: #fff0f1;
  color: var(--red);
}

button.danger:hover, .button.danger:hover {
  background: #ffe5e7;
  box-shadow: 0 4px 14px rgba(215, 0, 21, 0.15);
}

.route-progress {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--blue);
  opacity: 0;
  transition: width 0.35s, opacity 0.2s;
}

.is-loading .route-progress {
  width: 75%;
  opacity: 1;
}

.center-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.install-card, .login-card {
  width: min(100%, 460px);
  padding: 40px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.09);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(145deg, #2997ff, #0068d4);
  box-shadow: 0 12px 26px rgba(0, 113, 227, 0.24);
  font-size: 24px;
  font-weight: 700;
}

.brand-mark.small {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  font-size: 19px;
}

.brand-mark.tiny {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 15px;
}

.eyebrow {
  margin: 22px 0 6px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.install-card h1, .login-card h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.lead {
  margin: 8px 0 24px;
  color: var(--muted);
  font-size: 13px;
}

label {
  display: block;
  margin-top: 18px;
  color: #333336;
  font-size: 13px;
  font-weight: 550;
}

label small {
  margin-left: 6px;
  font-weight: 400;
  color: var(--tertiary);
}

input, select, textarea {
  width: 100%;
  margin-top: 7px;
  padding: 11px 14px;
  color: var(--text);
  border: 1px solid #d2d2d7;
  border-radius: 11px;
  outline: 0;
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  font-size: 13px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 24px;
  color: var(--tertiary);
  font-size: 11px;
}

.alert {
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 12px;
  color: #a50011;
  background: #fff0f1;
  border: 1px solid rgba(215, 0, 21, 0.1);
  font-size: 13px;
}

.success-alert {
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 12px;
  color: #1b632c;
  background: #edf8f0;
  border: 1px solid rgba(36, 138, 61, 0.15);
  font-size: 13px;
}

.privacy {
  margin: 22px 0 0;
  text-align: center;
  color: var(--tertiary);
  font-size: 11px;
}

/* 后台 App Shell 布局 */
.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

aside {
  position: fixed;
  z-index: 20;
  width: 250px;
  height: 100vh;
  padding: 24px 16px;
  border-right: 1px solid var(--line);
  background: rgba(248, 248, 250, 0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 24px;
}

.side-brand b {
  font-size: 15px;
  font-weight: 700;
  display: block;
}

.side-brand small {
  margin-top: 1px;
  color: var(--tertiary);
  font-size: 11px;
  display: block;
}

nav {
  display: grid;
  gap: 4px;
}

nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 11px;
  color: #4b4b4e;
  font-size: 13px;
  font-weight: 520;
  transition: all 0.16s ease;
}

nav a i {
  display: grid;
  place-items: center;
  width: 20px;
  color: #7b7b80;
  font-style: normal;
  font-size: 15px;
}

nav a:hover {
  background: rgba(0, 0, 0, 0.045);
  color: var(--text);
}

nav a.active {
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  font-weight: 600;
}

nav a.active i {
  color: var(--blue);
}

.side-foot {
  position: absolute;
  left: 24px;
  bottom: 24px;
  color: var(--tertiary);
  font-size: 11px;
  display: flex;
  align-items: center;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: #34c759;
  box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.12);
}

.dashboard {
  grid-column: 2;
  width: 100%;
  max-width: 1440px;
  padding: 48px clamp(24px, 4vw, 64px) 80px;
}

.dashboard > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

.dashboard header .eyebrow {
  margin: 0 0 6px;
}

.dashboard header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.dashboard header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  padding: 6px 13px;
  border-radius: 999px;
  color: var(--green);
  background: #eaf8ed;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

.status-pill i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: #34c759;
}

/* 面板与通用卡片 */
.panel {
  padding: 24px;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--surface);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  margin-top: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* Toast 提示容器 */
#toast-region {
  position: fixed;
  z-index: 1100;
  top: 20px;
  right: 20px;
  display: grid;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
  max-width: 380px;
  padding: 13px 16px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(20px);
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  background: #34c759;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.toast.error span {
  background: var(--red);
}

.toast p {
  margin: 0;
  color: #2c2c2e;
  font-size: 12px;
  line-height: 1.4;
}

/* 响应式 */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  aside {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .side-brand, .side-foot {
    display: none;
  }
  aside nav {
    display: flex;
    justify-content: flex-start;
    overflow-x: auto;
    gap: 6px;
  }
  nav a {
    flex: 0 0 auto;
    padding: 8px 12px;
  }
  nav a i {
    display: none;
  }
  .dashboard {
    grid-column: 1;
    padding: 30px 16px 60px;
  }
}
