* {
  box-sizing: border-box;
}

:root {
  --ai-btn-glow-upload: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  --ai-btn-glow-complete: linear-gradient(135deg, #059669 0%, #22c55e 100%);
  --ai-btn-glow-remind: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.login-page {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.login-bg-layer {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #f7f1ea 0%, #ffe9e4 100%);
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.login-bg-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(140deg, rgba(2, 6, 23, 0.75), rgba(2, 6, 23, 0.45));
  z-index: 1;
}

.login-page-particle .login-bg-overlay {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.35), rgba(255, 245, 244, 0.08));
}

.login-page-particle .login-bg-layer::before,
.login-page-particle .login-bg-layer::after {
  content: '';
  position: absolute;
  inset: -20%;
  background-size: 260px 260px;
  pointer-events: none;
}

.login-page-particle .login-bg-layer::before {
  background-image:
    radial-gradient(circle at 20% 30%, rgba(250, 204, 196, 0.45) 0 4px, transparent 5px),
    radial-gradient(circle at 80% 50%, rgba(250, 204, 196, 0.35) 0 3px, transparent 4px),
    radial-gradient(circle at 40% 80%, rgba(237, 228, 219, 0.55) 0 4px, transparent 5px);
  animation: loginParticleFloatA 18s linear infinite;
}

.login-page-particle .login-bg-layer::after {
  background-image:
    radial-gradient(circle at 35% 25%, rgba(244, 190, 180, 0.3) 0 3px, transparent 4px),
    radial-gradient(circle at 70% 70%, rgba(240, 221, 209, 0.5) 0 4px, transparent 5px),
    radial-gradient(circle at 55% 45%, rgba(250, 204, 196, 0.38) 0 2px, transparent 3px);
  animation: loginParticleFloatB 24s linear infinite;
}

@keyframes loginParticleFloatA {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to { transform: translate3d(-40px, -30px, 0) rotate(360deg); }
}

@keyframes loginParticleFloatB {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to { transform: translate3d(45px, 35px, 0) rotate(-360deg); }
}

.login-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.login-card,
.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.login-card {
  padding: 32px;
}

.login-card-glass {
  width: 100%;
  max-width: 430px;
  padding: 40px 34px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 28px 60px rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.4;
  color: #021624;
  text-align: center;
}

.login-brand {
  margin-bottom: 18px;
}

.login-logo {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.8px;
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  box-shadow: 0 12px 24px rgba(14, 165, 233, 0.35);
}

.login-logo-img {
  width: auto;
  height: auto;
  max-width: 220px;
  max-height: 120px;
  margin: 0 auto 14px;
  display: block;
  border-radius: 0;
  object-fit: contain;
  border: none;
  box-shadow: none;
}

.login-subtitle,
.muted {
  color: #6b7280;
}

.login-subtitle {
  text-align: center;
  color: #cbd5e1;
}

.login-input-group label {
  color: #021624;
  font-weight: 700;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-input-group {
  width: 100%;
  min-width: 100%;
}

.login-input-group input {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #021BC8;
}

.login-input-group input::placeholder {
  color: #cbd5e1;
}

.login-input-group input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
}

.login-submit-btn {
  background: linear-gradient(90deg, #0ea5e9 0%, #2563eb 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}

.main-content {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 24px 32px;
}

.navbar {
  background: #0f172a;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand h1 {
  margin: 0;
  font-size: 22px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.nav-link,
.nav-user {
  color: #e5e7eb;
}

.nav-link.active {
  color: #fff;
  font-weight: 700;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-header h2 {
  margin: 0 0 8px;
}

.page-actions {
  display: flex;
  gap: 12px;
}

.card {
  padding: 20px;
  margin-bottom: 20px;
}

.form-card h2,
.form-card h3,
.form-card label {
  font-weight: 700;
}

.form-card .form-group label {
  color: #0f172a;
}

.form-card input,
.form-card select,
.form-card textarea {
  border-color: #cbd5e1;
  background: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.form-actions-enhanced {
  display: flex;
  gap: 12px;
  align-items: center;
}

.form,
.filter-form,
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.filter-form {
  align-items: flex-end;
}

.grid-form .form-group {
  flex: 1 1 calc(33.333% - 16px);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}

.form-group.inline {
  min-width: 160px;
}

.inline-grow {
  flex: 1 1 240px;
}

.full-width {
  flex: 1 1 100%;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
}

textarea {
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: 0.2s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-ai {
  position: relative;
  overflow: hidden;
  height: 42px;
  padding: 0 16px;
  font-weight: 700;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.2);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.btn-ai::before {
  content: '';
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.btn-ai:hover::before {
  opacity: 1;
}

.btn-ai:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.28);
}

.btn-ai:disabled,
.btn-ai[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ai:disabled:hover,
.btn-ai[disabled]:hover {
  transform: none;
}

.btn-ai:disabled::before,
.btn-ai[disabled]::before {
  opacity: 0;
}

.btn-ai-upload::before {
  background: var(--ai-btn-glow-upload);
}

.btn-ai-upload {
  background: rgba(37, 99, 235, 0.12);
  color: #1e3a8a;
}

.btn-ai-complete::before {
  background: var(--ai-btn-glow-complete);
}

.btn-ai-complete {
  background: rgba(5, 150, 105, 0.12);
  color: #065f46;
}

.btn-ai-remind::before {
  background: var(--ai-btn-glow-remind);
}

.btn-ai-remind {
  background: rgba(217, 119, 6, 0.14);
  color: #92400e;
}

.btn-ai-reset {
  background: rgba(100, 116, 139, 0.14);
  color: #334155;
}

.node-modal .inline-form .btn-ai {
  align-self: flex-start;
  margin-top: 32px;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 14px;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-secondary {
  background: #0f766e;
  color: #fff;
}

.btn-light {
  background: #e5e7eb;
  color: #111827;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-warning {
  background: #d97706;
  color: #fff;
}

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
}

.login-card .alert-error {
  background: rgba(127, 29, 29, 0.88);
  color: #fecaca;
  border: 1px solid rgba(254, 202, 202, 0.3);
}

.alert-success {
  background: #dcfce7;
  color: #166534;
}

.notice-banner {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  min-width: 320px;
  max-width: min(860px, calc(100vw - 24px));
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

.project-grid,
.stats-grid {
  display: grid;
  gap: 20px;
}

.project-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.scenario-panel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.scenario-panel {
  min-height: 520px;
}

.scenario-panel h3 {
  margin: 0;
}

.scenario-panel-section h4 {
  margin: 0 0 10px;
}

.scenario-project-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scenario-project-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
  color: #1d4ed8;
}

.scenario-project-item:hover {
  background: #eff6ff;
}

.scenario-project-title-link:hover {
  text-decoration: none;
}

.scenario-project-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.stage-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  animation: stageMarkBlink 2.8s ease-in-out infinite;
}

.stage-mark-售前 {
  background: #019fe8;
}

.stage-mark-售中 {
  background: #e95412;
}

.stage-mark-售后 {
  background: #349239;
}

.stage-mark-default {
  background: #e5e7eb;
  color: #374151;
}

@keyframes stageMarkBlink {
  0% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.18);
  }
  100% {
    filter: brightness(1);
  }
}

.scenario-project-actions {
  margin: 0;
  display: flex;
  justify-content: flex-end;
}

.scenario-project-alert {
  display: inline-flex;
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.scenario-project-alert-success {
  background: #dcfce7;
  color: #166534;
}

.scenario-project-alert-warning {
  background: #ffedd5;
  color: #9a3412;
}

.scenario-project-alert-danger {
  background: #fee2e2;
  color: #991b1b;
}

.scenario-project-alert-neutral {
  background: #e2e8f0;
  color: #334155;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.project-card-header,
.progress-label,
.timeline-header,
.project-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-meta,
.card-actions,
.project-dates,
.node-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e0ecff;
  color: #1d4ed8;
  font-size: 13px;
}

.badge-status {
  background: #ecfdf5;
  color: #047857;
}

.progress-box {
  margin: 16px 0;
}

.progress-bar {
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-value {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
}

.danger {
  color: #dc2626;
}

.detail-card h3 {
  margin-top: 0;
}

.section-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.sidebar-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-item {
  border: 1px solid #e5e7eb;
  border-left: 5px solid #2563eb;
  border-radius: 12px;
  padding: 16px;
  background: #f8fafc;
}

.timeline-item.status-已完成 {
  border-left-color: #16a34a;
}

.timeline-item.status-已完结 {
  border-left-color: #15803d;
}

.timeline-item.status-已逾期 {
  border-left-color: #dc2626;
}

.timeline-item.status-待开始 {
  border-left-color: #9ca3af;
}

.timeline-meta,
.node-note,
.login-tips,
.node-description {
  margin-top: 10px;
}

.node-description {
  padding: 10px 12px;
  border-radius: 10px;
  background: #eef6ff;
  color: #1e3a8a;
  line-height: 1.6;
}

.badge-branch {
  background: #fff7ed;
  color: #c2410c;
}

.badge-parallel {
  background: #ecfeff;
  color: #0f766e;
}

.badge-system {
  background: #f5f3ff;
  color: #6d28d9;
}

.card-subsection {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #d1d5db;
}

.attachment-list,
.reminder-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.attachment-item,
.reminder-item {
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}

.attachment-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
}

.attachment-file-link {
  font-weight: 600;
  color: #1d4ed8;
  word-break: break-all;
}

.attachment-file-link:hover {
  text-decoration: underline;
}

.attachment-delete-form {
  margin: 0;
  justify-self: end;
}

.attachment-item small {
  color: #6b7280;
}

.flow-board {
  background: linear-gradient(160deg, #f7fbff 0%, #eef4ff 100%);
}

.flow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.flow-node-card {
  position: relative;
  border: 1px solid #d6e2ff;
  border-left: 5px solid #2563eb;
  border-radius: 14px;
  background: #fff;
  padding: 14px 14px 12px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.flow-node-complete-mark {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(22, 163, 74, 0.28);
}

.flow-node-mark-in-progress {
  background: #0284c7;
  box-shadow: 0 6px 14px rgba(2, 132, 199, 0.28);
}

.flow-node-mark-pending {
  background: #64748b;
  box-shadow: 0 6px 14px rgba(100, 116, 139, 0.28);
}

.flow-node-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}

.flow-node-card.is-locked {
  opacity: 0.72;
  border-left-color: #94a3b8;
}

.flow-node-lock-tip {
  display: inline-flex;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
}

.flow-node-card.status-待开始 {
  border-left-color: #64748b;
}

.flow-node-card.status-进行中 {
  border-left-color: #0ea5e9;
}

.flow-node-card.status-已完成,
.flow-node-card.status-已完结 {
  border-left-color: #16a34a;
}

.flow-node-card.status-已逾期 {
  border-left-color: #dc2626;
}

.flow-node-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.flow-node-title {
  display: block;
  margin-top: 8px;
  font-size: 15px;
}

.flow-node-status {
  display: inline-flex;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
}

.flow-node-meta {
  display: block;
  margin-top: 8px;
  color: #475569;
  font-size: 13px;
}

.flow-node-meta-strong {
  font-weight: 700;
  color: #1e3a8a;
}

.flow-node-meta-deadline {
  font-weight: 700;
  font-size: 13px;
  color: #92400e;
}

.node-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.node-modal.open {
  display: flex;
}

.node-modal-dialog {
  width: min(1440px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.node-modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  padding: 18px 22px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.node-modal-header h3 {
  margin: 0;
}

.node-modal-close {
  border: none;
  background: #e5e7eb;
  color: #111827;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.node-modal-body {
  padding: 18px 22px 22px;
}

.node-modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.node-modal-block h4 {
  margin: 0 0 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.empty-state {
  text-align: center;
  padding: 32px 20px;
}

.footer {
  padding: 24px;
  text-align: center;
  color: #6b7280;
}

@media (max-width: 960px) {
  .section-grid {
    grid-template-columns: 1fr;
  }

  .node-modal-row {
    grid-template-columns: 1fr;
  }

  .scenario-panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-container,
  .page-header,
  .project-card-header,
  .progress-label,
  .timeline-header,
  .project-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .grid-form .form-group,
  .form-group.inline,
  .inline-grow {
    flex: 1 1 100%;
  }

  .main-content {
    padding: 16px;
  }

  .table {
    display: block;
    overflow-x: auto;
  }
}
