/* ============================================================
   城就 · Dashboard Design System
   风格：清晰、现代、有层次，不像问卷
   ============================================================ */

:root {
  --bg: #f5f6fa;
  --bg-gradient: radial-gradient(ellipse 100% 80% at 50% 0%, #e8ecff 0%, #f5f6fa 50%, #f8f0f4 100%);
  --card-bg: #ffffff;
  --card-border: #e8e8f0;
  --text: #1b1f3b;
  --text-secondary: #5d647e;
  --text-muted: #9ca3af;
  --primary: #4f46e5;
  --primary-soft: #6366f1;
  --primary-light: #eef2ff;
  --accent: #ec4899;
  --border: #e2e4ee;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 2px 12px rgba(27, 31, 59, 0.06), 0 1px 4px rgba(27, 31, 59, 0.04);
  --shadow-lg: 0 8px 30px rgba(27, 31, 59, 0.1), 0 4px 12px rgba(27, 31, 59, 0.06);
  --shadow-focus: 0 0 0 4px rgba(79, 70, 229, 0.12);
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  background-size: cover;
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Progress Bar ── */
.progress-track {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(79, 70, 229, 0.08);
  z-index: 10001;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4f46e5, #ec4899);
  border-radius: 0 999px 999px 0;
  transition: width 0.35s ease;
}

/* ── Container ── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 24px 140px;
}

/* ── Header ── */
.header {
  text-align: center;
  padding: 56px 0 44px;
  position: relative;
}
.header h1 {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 45%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header p {
  color: var(--text-secondary);
  margin-top: 12px;
  font-size: 1.05rem;
  font-weight: 400;
}
.header::after {
  content: '';
  display: block;
  width: 60px; height: 4px;
  margin: 24px auto 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #4f46e5, #ec4899);
}

/* ── Dashboard Layout ── */
.dashboard { display: block; }
.main-column { min-width: 0; }

/* ── Masonry Grid ── */
.masonry-grid {
  columns: 2;
  column-gap: 24px;
  padding-top: 4px;
}
.masonry-grid .card {
  break-inside: avoid;
  margin-bottom: 24px;
  width: 100%;
}
.masonry-grid .card:hover {
  transform: translateY(-2px);
}

@media (max-width: 700px) {
  .masonry-grid { columns: 1; }
}

/* ── Action Bar ── */
.action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(27, 31, 59, 0.08);
  padding: 16px 24px;
}
.action-bar-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.action-bar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.action-bar-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.action-bar-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.action-bar-btns {
  display: flex;
  gap: 12px;
}
.action-bar-btns .btn {
  width: auto;
  flex: none;
  padding: 12px 24px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .action-bar-inner { flex-direction: column; align-items: stretch; }
  .action-bar-info { text-align: center; }
  .action-bar-btns { flex-direction: column; }
  .action-bar-btns .btn { width: 100%; }
}

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}
.card-header {
  padding: 20px 26px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, #f8f9ff 0%, #ffffff 100%);
}
.card-header .icon { font-size: 1.3rem; }
.card-header h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.card-header .badge {
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  font-weight: 600;
  margin-left: auto;
}
.card-body { padding: 26px; }

/* Card accent variations */
#card-profile .card-header { border-top: 4px solid #4f46e5; }
#card-city .card-header { border-top: 4px solid #10b981; }
#card-work .card-header { border-top: 4px solid #f59e0b; }
#card-fun .card-header { border-top: 4px solid #ec4899; }
#card-city { background: linear-gradient(180deg, #ffffff 0%, #f6fef9 100%); }
#card-work { background: linear-gradient(180deg, #ffffff 0%, #fffbf0 100%); }
#card-fun { background: linear-gradient(180deg, #ffffff 0%, #fff5f9 100%); }

/* ── Form Sections ── */
.form-section {
  padding-bottom: 26px;
  margin-bottom: 26px;
  border-bottom: 1px dashed var(--border);
}
.form-section:last-child,
.form-section-noborder {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--primary-light);
  border-radius: 999px;
}
.section-title::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

/* ── Grid Layouts ── */
.form-grid { display: grid; gap: 18px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-group-wide { grid-column: 1 / -1; }

@media (max-width: 700px) {
  .form-grid-2,
  .form-grid-3 { grid-template-columns: 1fr; }
}

/* ── Form Elements ── */
.form-group { display: flex; flex-direction: column; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text);
}
.form-label .unit { font-weight: 400; color: var(--text-muted); font-size: 0.75rem; }
.form-label .required { color: var(--danger); margin-left: 2px; }

input[type="text"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: #fbfbfe;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  color: var(--text);
}
input:hover, select:hover, textarea:hover { border-color: #c5cbe0; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
  background: #fff;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 96px; }
select { cursor: pointer; }

/* Disabled / readonly state */
input:disabled, select:disabled, input[readonly] {
  background: #eef0f7;
  border-color: #e1e4f0;
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}
.form-group.disabled .form-label { color: var(--text-muted); }
.form-group.disabled select { background: #eef0f7; border-color: #e1e4f0; }

/* ── Radio / Checkbox Group ── */
.radio-group { display: flex; flex-wrap: wrap; gap: 10px; }
.radio-group label {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 500;
  transition: all var(--transition);
  background: #fbfbfe;
  user-select: none;
}
.radio-group label:hover {
  border-color: var(--primary-soft);
  background: var(--primary-light);
  color: var(--primary);
}
.radio-group label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12);
}
.radio-group input[type="radio"],
.radio-group input[type="checkbox"] { accent-color: var(--primary); }

/* ── Legacy Row ── */
.row { display: flex; gap: 18px; }
.row > * { flex: 1; }
@media (max-width: 600px) { .row { flex-direction: column; } }

/* ── City Data Grid ── */
.city-data-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.city-data-item {
  background: #f8f9ff;
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.city-data-item:hover {
  border-color: var(--primary-soft);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}
.city-data-item .label { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.city-data-item .value { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.city-data-item .detail { font-size: 0.74rem; color: var(--text-secondary); margin-top: 2px; }

/* ── Score Display ── */
.score-display {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  background: var(--primary-light);
  border: 1px solid rgba(79, 70, 229, 0.12);
  border-radius: var(--radius-sm);
  margin-top: 10px;
  flex-wrap: wrap;
}
.score-number { font-size: 1.5rem; font-weight: 800; color: var(--primary); line-height: 1; }
.score-label { font-size: 0.85rem; color: var(--text-secondary); }

.risk-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; }
.risk-极低 { background: #d1fae5; color: #065f46; }
.risk-低 { background: #e0f2fe; color: #075985; }
.risk-中低 { background: #fef3c7; color: #92400e; }
.risk-中高 { background: #fed7aa; color: #9a3412; }
.risk-高 { background: #fecaca; color: #991b1b; }
.risk-极高 { background: #fecaca; color: #7f1d1d; }

/* ── Fun Module ── */
.fun-result {
  padding: 16px 18px;
  background: linear-gradient(135deg, #fff7ed, #fdf2f8);
  border: 1px solid rgba(244, 114, 182, 0.15);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}
.fun-result h4 { font-size: 0.92rem; margin-bottom: 8px; font-weight: 700; }
.fun-result p { font-size: 0.83rem; color: var(--text-secondary); margin-bottom: 4px; }

/* ── Summary Card ── */
.summary-card {
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 40%, #7c3aed 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: 0 12px 40px rgba(79, 70, 229, 0.25);
}
.summary-card h2 { font-size: 1.18rem; margin-bottom: 18px; font-weight: 700; }
.summary-score { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.summary-score .big-number { font-size: 3.6rem; font-weight: 900; line-height: 1; letter-spacing: -0.03em; }
.summary-score .big-label { font-size: 0.86rem; opacity: 0.8; line-height: 1.5; }
.summary-verdict {
  font-size: 1.22rem; font-weight: 700;
  padding: 10px 22px; border-radius: var(--radius-sm);
  display: inline-block;
  background: rgba(255,255,255,0.18);
  margin-bottom: 16px;
}
.summary-detail { font-size: 0.88rem; opacity: 0.92; line-height: 1.8; }
.summary-detail li { margin-bottom: 6px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 650;
  cursor: pointer; border: none; font-family: inherit;
  transition: all var(--transition);
  letter-spacing: 0.01em;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover { background: linear-gradient(135deg, #4338ca, #6d28d9); box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4); transform: translateY(-1px); }
.btn-secondary { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-skip { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); padding: 8px 18px; font-size: 0.83rem; font-weight: 500; }

.btn-ai {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.3);
}
.btn-ai:hover { background: linear-gradient(135deg, #db2777, #7c3aed); box-shadow: 0 6px 20px rgba(236, 72, 153, 0.4); transform: translateY(-1px); }
.btn-ai:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-group { display: flex; gap: 14px; }
.btn-group-vertical { flex-direction: column; }
.btn-group .btn { flex: 1; }
@media (max-width: 500px) { .btn-group { flex-direction: column; } }

/* ── Streaming ── */
.streaming-container { margin-top: 24px; display: none; }
.streaming-container.active { display: block; }
.streaming-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: var(--primary-light);
  border: 1px solid rgba(79, 70, 229, 0.12);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-weight: 600; font-size: 0.87rem; color: var(--primary);
}
.streaming-spinner {
  width: 16px; height: 16px;
  border: 2px solid #c7d2fe; border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.streaming-content {
  padding: 22px;
  background: #fbfbfe;
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  min-height: 120px; max-height: 600px; overflow-y: auto;
  font-size: 0.88rem; line-height: 1.9;
  white-space: pre-wrap; word-break: break-word;
}
.streaming-content .cursor-blink::after { content: '\25cd'; animation: blink 0.8s step-end infinite; color: var(--primary); }
@keyframes blink { 50% { opacity: 0; } }

.ai-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600;
  background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff;
  margin-left: 8px; vertical-align: middle;
}

/* ── Login Overlay ── */
.login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-gradient);
  padding: 24px;
}
.login-overlay::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 20%, rgba(79, 70, 229, 0.1), transparent),
    radial-gradient(ellipse 60% 60% at 85% 80%, rgba(236, 72, 153, 0.08), transparent);
  pointer-events: none;
}
.login-overlay.hidden { display: none; }
.login-card {
  width: 100%; max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 16px 52px rgba(27, 31, 59, 0.12);
  padding: 42px 36px;
  position: relative;
  border-top: 5px solid var(--primary);
}
.login-hero { text-align: center; margin-bottom: 34px; }
.login-hero h1 {
  font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(135deg, #4f46e5, #ec4899);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.login-hero p { margin-top: 8px; font-size: 0.86rem; color: var(--text-secondary); }
.login-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 22px; text-align: center; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.83rem; font-weight: 600; color: var(--text); }
.field-input {
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.9rem; font-family: inherit;
  background: #fbfbfe;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field-input:hover { border-color: #c5cbe0; }
.field-input:focus { outline: none; border-color: var(--primary); box-shadow: var(--shadow-focus); background: #fff; }
.login-error { font-size: 0.83rem; font-weight: 500; color: var(--danger); }
.login-notice { font-size: 0.83rem; font-weight: 500; color: var(--success); }
.login-btn {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 650; font-family: inherit;
  cursor: pointer; transition: all var(--transition);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}
.login-btn:hover { box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35); transform: translateY(-1px); }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; }
.login-switch {
  background: transparent; border: none; padding: 0;
  font-size: 0.86rem; font-weight: 500; font-family: inherit;
  color: var(--primary); cursor: pointer; text-align: center;
  transition: color var(--transition);
}
.login-switch:hover { color: #4338ca; text-decoration: underline; }
.login-divider { display: flex; align-items: center; gap: 12px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-divider-text { font-size: 0.78rem; color: var(--text-muted); }
.login-skip {
  width: 100%; padding: 12px;
  background: #fbfbfe; color: var(--text-secondary);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.87rem; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: all var(--transition);
}
.login-skip:hover { background: #f4f5f9; border-color: #c5cbe0; }
.login-sso {
  width: 100%; padding: 12px;
  background: #fbfbfe; color: #6d28d9;
  border: 1.5px solid #ddd6fe; border-radius: var(--radius-sm);
  font-size: 0.87rem; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: all var(--transition);
}
.login-sso:hover { background: #f5f3ff; border-color: #a78bfa; }

/* ── User Bar ── */
.user-bar {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
  border-radius: var(--radius) var(--radius) 0 0;
}
.user-bar .user-email { color: var(--text-secondary); font-weight: 500; }
.user-bar .logout-btn {
  padding: 5px 14px; background: transparent;
  color: var(--danger); border: 1px solid #fecaca;
  border-radius: 7px; font-size: 0.78rem; cursor: pointer;
  font-family: inherit; font-weight: 500;
  transition: all var(--transition);
}
.user-bar .logout-btn:hover { background: #fef2f2; border-color: #fca5a5; }

/* ── Misc ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.note { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }
.toggle-section { display: none; }
.toggle-section.active { display: block; }
.error-msg { color: var(--danger); font-size: 0.78rem; margin-top: 4px; display: none; }

/* ── Prompt Modal ── */
.prompt-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  padding: 24px;
}
.prompt-card {
  width: 100%; max-width: 380px;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 16px 52px rgba(27, 31, 59, 0.15);
  padding: 36px 30px;
  text-align: center;
  border-top: 5px solid var(--primary);
}
.prompt-icon { font-size: 2.4rem; margin-bottom: 14px; }
.prompt-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.prompt-desc { font-size: 0.86rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 24px; }
.prompt-buttons { display: flex; flex-direction: column; gap: 10px; }
.prompt-btn {
  width: 100%; padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 600; font-family: inherit;
  cursor: pointer; border: none;
  transition: all var(--transition);
}
.prompt-btn:active { transform: scale(0.97); }
.prompt-btn-primary { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25); }
.prompt-btn-primary:hover { box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35); }
.prompt-btn-ghost { background: #fff; color: var(--primary); border: 1.5px solid #c7d2fe; }
.prompt-btn-ghost:hover { background: var(--primary-light); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Selection ── */
::selection { background: rgba(79, 70, 229, 0.15); }
