:root {
  --bg: #eef3fb;
  --panel: #ffffff;
  --panel-soft: #f7faff;
  --line: #dbe6f5;
  --text: #1e293b;
  --muted: #64748b;
  --brand: #2563eb;
  --brand-soft: #dbeafe;
  --positive: #d92d20;
  --negative: #16a34a;
  --warning: #ea580c;
  --shadow: 0 14px 32px rgba(37, 99, 235, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 28%),
    linear-gradient(180deg, #f4f8ff 0%, #eef3fb 100%);
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.sidebar,
.content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.brand,
.sidebar .card,
.toolbar,
.table-card {
  padding: 18px;
}

.brand {
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 50%, #eef4ff 100%);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 16px;
}

h3 {
  margin: 0;
  font-size: 22px;
}

.muted,
.note,
.toolbar-tip {
  color: var(--muted);
}

.note,
.status-line {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.detail-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge.running {
  color: #166534;
  background: #dcfce7;
}

.badge.stopped {
  color: #92400e;
  background: #ffedd5;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.summary-item {
  padding: 12px;
  border-radius: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.summary-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.summary-item strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 130px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbfdff;
  outline: none;
}

textarea:focus,
.file-picker:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.28);
}

.action-row,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-right {
  justify-content: flex-end;
}

.notification-controls,
.detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

button:hover {
  transform: translateY(-1px);
}

button.primary {
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.22);
}

button.ghost {
  color: var(--brand);
  background: #eff6ff;
  border-color: #bfdbfe;
}

button.danger {
  color: #ffffff;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  box-shadow: 0 10px 20px rgba(249, 115, 22, 0.2);
}

button.inline-danger {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
  padding: 6px 10px;
  border-radius: 10px;
}

button.inline-action {
  padding: 6px 10px;
  border-radius: 10px;
}

.file-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  border: 1px dashed #93c5fd;
  border-radius: 14px;
  background: #f8fbff;
  color: var(--brand);
  cursor: pointer;
  text-align: center;
  padding: 16px;
}

.file-picker input {
  display: none;
}

.watch-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.watch-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
}

.watch-item.selectable {
  cursor: pointer;
}

.watch-item.selectable:hover {
  border-color: #93c5fd;
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.5);
}

.watch-item.active {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fbff 100%);
  border-color: #93c5fd;
}

.watch-item-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.watch-item-name strong,
.table-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-item-name span {
  color: var(--muted);
  font-size: 12px;
}

.watch-item-meta {
  text-align: right;
  min-width: 78px;
}

.watch-item-meta strong,
.watch-item-meta span {
  display: block;
}

.table-card {
  min-height: 600px;
}

.detail-card {
  padding: 18px;
}

.detail-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.category-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #1e40af;
  background: #dbeafe;
}

.large-empty {
  padding: 48px 12px;
}

.fund-detail-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fund-detail-primary {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fund-detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 62%, #f8fbff 100%);
}

.fund-detail-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.fund-detail-inline-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.inline-stat {
  min-width: 142px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #dbeafe;
}

.inline-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.inline-stat strong {
  display: block;
  font-size: 18px;
}

.meta-pill {
  min-width: 132px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #dbeafe;
}

.meta-pill span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.meta-pill strong {
  display: block;
  font-size: 16px;
}

.table-wrapper {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
}

.detail-table {
  min-width: 980px;
}

.holding-table {
  min-width: 1480px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #edf4ff;
  color: #1d4ed8;
}

.sort-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sort-button:hover {
  transform: none;
  color: #2563eb;
}

.sort-button.active {
  color: #0f3fae;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 14px;
  white-space: nowrap;
}

.holding-table th:nth-child(1),
.holding-table th:nth-child(2),
.holding-table th:nth-child(3),
.holding-table th:nth-child(4),
.holding-table th:nth-child(5),
.holding-table th:nth-child(16),
.holding-table th:nth-child(17),
.holding-table td:nth-child(1),
.holding-table td:nth-child(2),
.holding-table td:nth-child(3),
.holding-table td:nth-child(4),
.holding-table td:nth-child(5),
.holding-table td:nth-child(16),
.holding-table td:nth-child(17),
.detail-table th:nth-child(1),
.detail-table th:nth-child(2),
.detail-table th:nth-child(3),
.detail-table th:nth-child(9),
.detail-table th:nth-child(10),
.detail-table td:nth-child(1),
.detail-table td:nth-child(2),
.detail-table td:nth-child(3),
.detail-table td:nth-child(9),
.detail-table td:nth-child(10) {
  text-align: left;
}

tbody tr:hover {
  background: #f8fbff;
}

tbody tr.clickable-row {
  cursor: pointer;
}

tbody tr.clickable-row:hover {
  background: #eff6ff;
}

tbody tr.active-row {
  background: #eef4ff;
}

.type-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.type-tag.fund {
  color: #1d4ed8;
  background: #dbeafe;
}

.type-tag.stock {
  color: #166534;
  background: #dcfce7;
}

.action-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.positive {
  color: var(--positive);
  font-weight: 700;
}

.negative {
  color: var(--negative);
  font-weight: 700;
}

.neutral {
  color: var(--muted);
}

.status-ok {
  color: #166534;
}

.status-error {
  color: #b91c1c;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 12px;
}

.locked-body {
  min-height: 100%;
  background: linear-gradient(135deg, #f0f5ff 0%, #ffffff 45%, #e6f7ff 100%);
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  background: #fff;
  border: 1px solid rgba(24, 144, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0, 39, 102, 0.12);
}

.auth-title {
  font-size: 28px;
  line-height: 1.3;
  color: rgba(0, 39, 102, 1);
  font-weight: bold;
}

.auth-subtitle,
.auth-tip {
  color: #666;
  line-height: 1.7;
}

.auth-subtitle {
  margin-top: 12px;
}

.auth-tip {
  margin-top: 14px;
  font-size: 13px;
}

.auth-label {
  display: block;
  margin-top: 20px;
  margin-bottom: 8px;
  color: rgba(49, 70, 89, 1);
  font-weight: bold;
}

.auth-input {
  width: 100%;
  height: 48px;
  border: 1px solid #d9d9d9;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input:focus {
  border-color: #1890ff;
  box-shadow: 0 0 0 4px rgba(24, 144, 255, 0.12);
}

.auth-submit {
  width: 100%;
  height: 48px;
  margin-top: 18px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(90deg, #1890ff, #455bfb);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

.auth-error {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff1f0;
  color: #cf1322;
  line-height: 1.6;
}

.remember-bar {
  display: flex;
  justify-content: flex-end;
  padding: 12px 18px 0;
}

.remember-reset {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(24, 144, 255, 0.08);
  color: #1890ff;
  font-size: 13px;
  text-decoration: none;
}

.remember-reset:hover {
  background: #1890ff;
  color: #fff;
}

@media (max-width: 1180px) {
  .page-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    background: #eef3fb;
  }

  .page-shell {
    padding: 12px;
    gap: 12px;
  }

  .brand,
  .sidebar .card,
  .toolbar,
  .table-card {
    padding: 14px;
    border-radius: 14px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
  }

  .toolbar-right {
    justify-content: flex-start;
  }

  .fund-detail-hero {
    flex-direction: column;
  }

  .fund-detail-meta {
    width: 100%;
    justify-content: flex-start;
  }

  .fund-detail-inline-stats {
    width: 100%;
  }

  .action-cell {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .auth-card {
    padding: 24px;
  }

  .auth-title {
    font-size: 24px;
  }
}
