:root {
  --paper: #e8e2d4;
  --card: #fbf9f4;
  --card-line: #c9c0ac;
  --ink: #26241f;
  --ink-soft: #6b6455;
  --rise: #2f6f4f;
  --rise-bg: #e3ede6;
  --fall: #8b2e2e;
  --fall-bg: #f2e4e0;
  --brass: #a97a1f;
  --brass-bg: #f3e9d2;
  --serif: "Source Serif 4", "Noto Serif SC", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --sans: "Inter", -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  background-image:
    repeating-linear-gradient(transparent, transparent 27px, rgba(38,36,31,0.035) 28px);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

/* ---- App shell: sidebar + main area ---- */
.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 2px solid var(--ink);
  display: flex;
  flex-direction: column;
  padding: 26px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  margin: 4px 0 0;
  letter-spacing: -0.01em;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 32px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  background: none;
  border: none;
  padding: 11px 12px;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-icon { font-size: 8px; color: var(--brass); }
.nav-item:hover { background: var(--paper); }
.nav-item.active { background: var(--ink); color: var(--card); }
.nav-item.active .nav-icon { color: inherit; }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-clock {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
}

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

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--card-line);
  padding: 14px 28px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tg-status {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
  background: #ece7db;
  color: var(--ink-soft);
  align-self: flex-start;
}
.tg-status.on { background: var(--rise-bg); color: var(--rise); }
.tg-status.off { background: var(--fall-bg); color: var(--fall); }

.btn-ghost {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
  border-radius: 3px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-ghost:hover { background: var(--ink); color: var(--card); }

.btn-primary {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  background: var(--ink);
  color: var(--card);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 9px 16px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.btn-primary:hover { opacity: 0.82; }

/* ---- Ticker tape ---- */
.ticker-tape {
  overflow: hidden;
  border-bottom: 1px solid var(--card-line);
  background: var(--ink);
}
.ticker-tape-inner {
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--card);
  padding: 7px 0;
  animation: scroll-left 30s linear infinite;
  display: inline-block;
}
.ticker-tape-inner span.up { color: #8fd6ac; }
.ticker-tape-inner span.down { color: #e8a3a3; }
.ticker-tape-inner .sep { color: #5a564a; margin: 0 14px; }
@keyframes scroll-left {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---- Board / content views ---- */
.board {
  flex: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 32px 80px;
  width: 100%;
  box-sizing: border-box;
}
.content-view { display: none; }
.content-view.active { display: block; }

.view-header { margin-bottom: 16px; }
.view-header h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  margin: 0 0 4px;
}
.view-header-hint {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-soft);
}

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: auto;
    height: auto;
    position: relative;
    flex-direction: row;
    align-items: center;
    padding: 12px 14px;
    gap: 14px;
    flex-wrap: wrap;
  }
  .sidebar-brand h1 { font-size: 18px; }
  .sidebar-nav {
    flex-direction: row;
    margin-top: 0;
    flex-wrap: wrap;
    gap: 4px;
  }
  .nav-item { padding: 8px 10px; font-size: 13px; }
  .sidebar-footer { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; gap: 8px; }
  .sidebar-clock { display: none; }
  .board { padding: 16px 14px 60px; }
  .topbar { padding: 10px 14px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .btn-ghost { font-size: 12px; padding: 6px 10px; }
}

@media (max-width: 520px) {
  #addForm { grid-template-columns: 1fr !important; }
  .trade-form-row { grid-template-columns: 1fr !important; }
  .note-form-row { grid-template-columns: 1fr !important; }
  .journal-form-row { grid-template-columns: 1fr !important; }
  .level-form { grid-template-columns: 1fr !important; }
  .kline-chart { height: 260px; }
  .chart-period-row { flex-wrap: wrap; row-gap: 6px; }
  .chart-legend { margin-left: 0; width: 100%; }
  .dash-todo-row { flex-wrap: wrap; }
}

.add-card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 4px;
  padding: 20px 22px;
  margin-bottom: 32px;
}
.add-card h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 18px;
  margin: 0 0 14px;
}
#addForm {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 2fr auto;
  gap: 12px;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field-wide { grid-column: span 1; }
.field label {
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 600;
  letter-spacing: 0.03em;
}
.field input {
  font-family: var(--mono);
  font-size: 14px;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}
.field input:focus { outline: 2px solid var(--brass); outline-offset: 1px; }
.hint { font-size: 12px; color: var(--fall); margin: 10px 2px 0; min-height: 16px; }

@media (max-width: 860px) {
  #addForm { grid-template-columns: 1fr 1fr; }
}

/* ---- Ledger cards ---- */
.ledger {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.empty-state {
  grid-column: 1 / -1;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink-soft);
  text-align: center;
  padding: 40px 0;
}

.stock-card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-left: 4px solid var(--ink);
  border-radius: 3px;
  padding: 16px 18px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.stock-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(38,36,31,0.12);
}
.stock-card.rise { border-left-color: var(--rise); }
.stock-card.fall { border-left-color: var(--fall); }
.stock-card.target-hit { border-left-color: var(--brass); background: var(--brass-bg); }

.stock-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.stock-ticker {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
}
.stock-name {
  font-size: 12px;
  color: var(--ink-soft);
  display: block;
  margin-top: 1px;
}
.stock-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}
.stock-badge.rise { color: var(--rise); background: var(--rise-bg); }
.stock-badge.fall { color: var(--fall); background: var(--fall-bg); }
.stock-badge.flat { color: var(--ink-soft); background: #ece7db; }

.stock-price {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 600;
  margin: 10px 0 4px;
  font-variant-numeric: tabular-nums;
}

.stock-target-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  border-top: 1px dashed var(--card-line);
  padding-top: 8px;
  margin-top: 8px;
}
.stock-target-row b { color: var(--ink); font-weight: 600; }

.stock-thesis {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 13px;
  color: var(--ink);
  margin-top: 10px;
  line-height: 1.45;
  border-left: 2px solid var(--card-line);
  padding-left: 9px;
}

.card-thesis {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--card-line);
}
.card-thesis-badges {
  display: flex;
  gap: 5px;
  margin-bottom: 5px;
}
.card-thesis-text {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.45;
  margin: 0;
}
.card-thesis-empty {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--card-line);
}

.stock-alert-flag {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  color: var(--brass);
  margin-top: 8px;
}

.stock-delete {
  font-size: 11px;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-top: 10px;
  text-decoration: underline;
}
.stock-delete:hover { color: var(--fall); }

/* ---- Drawer ---- */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(38,36,31,0.35);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(880px, 96vw);
  background: var(--card);
  border-left: 1px solid var(--ink);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 21;
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-inner { padding: 22px 24px 60px; }
.drawer-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 1px solid var(--card-line);
  padding-bottom: 14px;
}
.drawer-header h3 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 2px 0 0; }
.drawer-price {
  font-family: var(--mono); font-size: 26px; font-weight: 600;
  margin: 16px 0 6px;
}
.chart-section { margin: 8px 0 20px; }
.chart-period-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.period-btn {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--ink-soft);
}
.period-btn:hover { background: var(--paper); }
.period-btn.active {
  background: var(--ink);
  color: var(--card);
  border-color: var(--ink);
}
.chart-legend {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 5px;
}
.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-left: 8px;
}
.legend-dot:first-child { margin-left: 0; }
.legend-dot.ema8 { background: #4a7fc9; }
.legend-dot.ema13 { background: #c96e4a; }
.kline-chart {
  width: 100%;
  height: 320px;
}

#journalForm { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
#journalForm textarea {
  font-family: var(--serif);
  font-size: 14px;
  min-height: 70px;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 10px;
  resize: vertical;
}
#journalForm .btn-primary { align-self: flex-end; }

.levels-section {
  border-top: 1px solid var(--card-line);
  border-bottom: 1px solid var(--card-line);
  padding: 16px 0;
  margin-bottom: 20px;
}
.levels-section h4 {
  font-family: var(--serif);
  font-size: 14px;
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-weight: 500;
}
.level-form {
  display: grid;
  grid-template-columns: 90px 100px 1fr auto;
  gap: 6px;
  margin-bottom: 10px;
}
.level-form input, .level-form select {
  font-family: var(--mono);
  font-size: 12.5px;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 6px 8px;
  background: #fff;
  color: var(--ink);
}
.level-form button { font-size: 12px; padding: 6px 10px; }

.level-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--card-line);
  font-size: 12.5px;
}
.level-item:last-child { border-bottom: none; }
.level-item-main { flex: 1; }
.level-item-price {
  font-family: var(--mono);
  font-weight: 600;
}
.level-item-price.above { color: var(--rise); }
.level-item-price.below { color: var(--fall); }
.level-item-note {
  font-family: var(--serif);
  color: var(--ink-soft);
  margin-top: 2px;
}
.level-item-del {
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  padding: 0;
  white-space: nowrap;
}
.level-item-del:hover { color: var(--fall); }
.level-empty {
  font-size: 12.5px;
  color: var(--ink-soft);
}

.journal-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.journal-form-row select, .journal-form-row input {
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 6px 8px;
  background: #fff;
  color: var(--ink);
}

.journal-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 4px 0 6px;
}
.badge {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}
.badge.up { color: var(--rise); background: var(--rise-bg); }
.badge.down { color: var(--fall); background: var(--fall-bg); }
.badge.sideways { color: var(--ink-soft); background: #ece7db; }
.badge.status-pending { color: var(--brass); background: var(--brass-bg); }
.badge.status-correct { color: var(--rise); background: var(--rise-bg); }
.badge.status-incorrect { color: var(--fall); background: var(--fall-bg); }
.badge.status-watching { color: var(--ink-soft); background: #ece7db; }

.journal-review-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.journal-review-actions button {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--card-line);
  background: #fff;
  border-radius: 3px;
  padding: 4px 9px;
  cursor: pointer;
}
.journal-review-actions button:hover { background: var(--paper); }
.journal-review-actions button.correct:hover { border-color: var(--rise); color: var(--rise); }
.journal-review-actions button.incorrect:hover { border-color: var(--fall); color: var(--fall); }

.review-intro {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink-soft);
  margin: 14px 0 18px;
}
.review-list { display: flex; flex-direction: column; gap: 16px; }
.review-item {
  border: 1px solid var(--card-line);
  border-left: 3px solid var(--brass);
  border-radius: 3px;
  padding: 12px 14px;
}
.review-item-ticker {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14px;
}
.review-item-price-line {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin: 4px 0;
}
.review-item-content {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 13.5px;
  margin: 6px 0;
  line-height: 1.5;
}
.review-empty {
  font-family: var(--serif);
  color: var(--ink-soft);
  font-size: 14px;
  text-align: center;
  padding: 30px 0;
}

.journal-list { display: flex; flex-direction: column; gap: 14px; }
.journal-entry {
  border-left: 2px solid var(--card-line);
  padding-left: 12px;
}
.journal-entry-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
}
.journal-entry-content {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.5;
  margin: 4px 0 0;
}

/* ---- 大盘观察笔记 ---- */
.note-form {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 4px;
  padding: 18px 20px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.note-form-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1.3fr 1fr;
  gap: 8px;
}
.note-form-row input {
  font-family: var(--mono);
  font-size: 12.5px;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}
.note-form textarea {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 14px;
  min-height: 120px;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 12px;
  resize: vertical;
  line-height: 1.6;
}
.note-form .btn-primary { align-self: flex-end; }

@media (max-width: 860px) {
  .note-form-row { grid-template-columns: 1fr 1fr; }
}

.sector-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.sector-chip {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--card-line);
  border-radius: 12px;
  padding: 4px 12px;
  cursor: pointer;
  color: var(--ink-soft);
}
.sector-chip:hover { background: var(--paper); }
.sector-chip.active {
  background: var(--ink);
  color: var(--card);
  border-color: var(--ink);
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.note-card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-left: 4px solid var(--brass);
  border-radius: 3px;
  padding: 16px 20px;
}
.note-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.note-card-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 16px;
  margin: 0;
}
.note-card-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.note-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.note-badge {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--brass-bg);
  color: var(--brass);
}
.note-badge.ticker { background: #ece7db; color: var(--ink-soft); }
.note-card-content {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  max-height: 120px;
  overflow: hidden;
  position: relative;
}
.note-card-content.expanded { max-height: none; }
.note-card-fade {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--card));
  pointer-events: none;
}
.note-card-actions {
  display: flex;
  gap: 14px;
  margin-top: 10px;
}
.note-card-actions button {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.note-card-actions button:hover { color: var(--ink); }
.notes-empty {
  font-family: var(--serif);
  color: var(--ink-soft);
  font-size: 14px;
  text-align: center;
  padding: 30px 0;
}

/* ---- 交易复盘 ---- */
.trade-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.trade-stat-box {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 4px;
  padding: 14px 16px;
}
.trade-stat-label {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 600;
}
.trade-stat-value {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 600;
  margin-top: 4px;
}
.trade-stat-value.positive { color: var(--rise); }
.trade-stat-value.negative { color: var(--fall); }

@media (max-width: 860px) {
  .trade-stats { grid-template-columns: repeat(2, 1fr); }
}

.trade-form {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 4px;
  padding: 18px 20px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.trade-form-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.trade-form-row .field-wide { grid-column: 1 / -1; }
.trade-form-row .field label {
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}
.trade-form-row .field input,
.trade-form-row .field select {
  width: 100%;
  font-family: var(--mono);
  font-size: 12.5px;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}
.trade-form textarea {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 14px;
  min-height: 100px;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 12px;
  resize: vertical;
  line-height: 1.6;
}
.trade-form .btn-primary { align-self: flex-end; }

@media (max-width: 860px) {
  .trade-form-row { grid-template-columns: 1fr 1fr; }
}

.setup-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.trades-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.trade-card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 14px 18px;
}
.trade-card.win { border-left: 4px solid var(--rise); }
.trade-card.loss { border-left: 4px solid var(--fall); }
.trade-card.breakeven { border-left: 4px solid var(--ink-soft); }
.trade-card.open { border-left: 4px solid var(--brass); }

.trade-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.trade-card-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 15px;
}
.trade-card-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
}
.trade-card-pnl {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 16px;
}
.trade-card-pnl.positive { color: var(--rise); }
.trade-card-pnl.negative { color: var(--fall); }

.trade-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.trade-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: #ece7db;
  color: var(--ink-soft);
}
.trade-badge.long { background: var(--rise-bg); color: var(--rise); }
.trade-badge.short { background: var(--fall-bg); color: var(--fall); }
.trade-badge.result-win { background: var(--rise-bg); color: var(--rise); }
.trade-badge.result-loss { background: var(--fall-bg); color: var(--fall); }
.trade-badge.result-open { background: var(--brass-bg); color: var(--brass); }

.trade-card-prices {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.trade-card-content {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.trade-card-actions {
  margin-top: 8px;
}
.trade-card-actions button {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.trade-card-actions button:hover { color: var(--fall); }
.trades-empty {
  font-family: var(--serif);
  color: var(--ink-soft);
  font-size: 14px;
  text-align: center;
  padding: 30px 0;
}

/* ---- 今日总览 ---- */
.dashboard-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.dash-card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 4px;
  padding: 18px 22px;
}
.dash-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.dash-card-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 16px;
  margin: 0;
}
.dash-card-link {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--brass);
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: underline;
}
.dash-empty {
  font-family: var(--serif);
  font-weight: 300;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.dash-alert-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--card-line);
  font-family: var(--mono);
  font-size: 13px;
}
.dash-alert-row:last-child { border-bottom: none; }
.dash-todo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-family: var(--sans);
  font-size: 13.5px;
}
.dash-todo-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brass);
  flex-shrink: 0;
}
.dash-todo-dot.done { background: var(--rise); }
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 860px) {
  .dash-grid { grid-template-columns: 1fr; }
}
.dash-note-preview {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
  max-height: 80px;
  overflow: hidden;
}
.dash-stat-row {
  display: flex;
  gap: 20px;
  font-family: var(--mono);
  font-size: 13px;
}
.dash-stat-row b { font-size: 18px; }

/* ---- 交易分板块 ---- */
.trades-group { margin-bottom: 22px; }
.trades-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.trades-group-count {
  font-family: var(--mono);
  font-size: 11px;
  background: #ece7db;
  padding: 1px 7px;
  border-radius: 8px;
}
.trades-group-header.win .trades-group-count { background: var(--rise-bg); color: var(--rise); }
.trades-group-header.loss .trades-group-count { background: var(--fall-bg); color: var(--fall); }
.trades-group-header.open .trades-group-count { background: var(--brass-bg); color: var(--brass); }

/* ---- 形态胜率统计 ---- */
.setup-stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.setup-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--card-line);
}
.setup-stat-row:last-child { border-bottom: none; }
.setup-stat-name { font-family: var(--sans); font-weight: 600; }
.setup-stat-rate.positive { color: var(--rise); }
.setup-stat-rate.negative { color: var(--fall); }

/* ---- 交易截图 ---- */
.trade-image-upload {
  margin-top: 4px;
}
.trade-image-upload input[type="file"] {
  font-family: var(--sans);
  font-size: 12px;
}
.trade-card-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.trade-card-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  cursor: pointer;
}
.image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: zoom-out;
}
.image-lightbox.open { display: flex; }
.image-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 4px;
}

/* ---- AI 辅助判断 ---- */
.btn-ai {
  width: 100%;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, #2b2620, #46392a);
  color: #f3e9d2;
  border: 1px solid var(--brass);
  border-radius: 4px;
  padding: 10px 16px;
  cursor: pointer;
  margin-bottom: 14px;
  transition: opacity 0.15s ease;
}
.btn-ai:hover { opacity: 0.85; }
.btn-ai:disabled { opacity: 0.5; cursor: not-allowed; }

.journal-entry.source-ai {
  border-left-color: var(--brass);
  background: linear-gradient(90deg, rgba(169,122,31,0.06), transparent 60%);
}
.badge.source-ai {
  background: #2b2620;
  color: #f3e9d2;
}

/* ---- 观察清单分类 ---- */
.category-group-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 16px;
  margin: 24px 0 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.category-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
#ledger > .category-group-title,
#ledger > .category-group {
  grid-column: 1 / -1;
}
.category-group-title:first-child { margin-top: 4px; }
.category-group-count {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}
.stock-card-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}
.stock-recat {
  font-size: 11px;
  color: var(--brass);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.stock-recat:hover { opacity: 0.75; }

/* ---- 笔记关键判断 ---- */
.key-judgments-section {
  border: 1px dashed var(--card-line);
  border-radius: 4px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.key-judgments-section h4 {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0;
}
.key-judgment-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr 1fr auto;
  gap: 8px;
  align-items: center;
}
.key-judgment-row input,
.key-judgment-row select {
  font-family: var(--mono);
  font-size: 12.5px;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 7px 9px;
  background: #fff;
  color: var(--ink);
}
.kj-remove {
  background: none;
  border: none;
  color: var(--fall);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}
@media (max-width: 860px) {
  .key-judgment-row { grid-template-columns: 1fr 1fr; }
}
.note-card-kj {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.key-judgment-tag {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 10px;
  background: var(--brass-bg);
  color: var(--brass);
}
.key-judgment-tag.stance-agree { background: #e3f0e7; color: var(--rise); }
.key-judgment-tag.stance-doubt { background: #f6e6e6; color: var(--fall); }

/* ---- 笔记详情抽屉 ---- */
.note-drawer-kj {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}
.note-drawer-content {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 15.5px;
  line-height: 1.85;
  border-top: 1px solid var(--card-line);
  border-bottom: 1px solid var(--card-line);
  padding: 20px 0;
  margin: 10px 0 20px;
  white-space: pre-wrap;
}
.note-tab-layout {
  display: flex;
  gap: 16px;
  margin: 10px 0 16px;
  min-height: 220px;
}
.note-tab-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 150px;
  flex-shrink: 0;
}
.note-tab {
  text-align: center;
  background: none;
  border: none;
  padding: 12px 10px;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.note-tab:hover { background: var(--paper); }
.note-tab.active { background: var(--ink); color: var(--card); }
.note-tab-panes {
  flex: 1;
  border-left: 1px solid var(--card-line);
  padding-left: 16px;
}
.note-tab-pane { display: none; }
.note-tab-pane.active { display: block; }
.note-tab-pane .note-drawer-content {
  border: none;
  padding: 0;
  margin: 0;
}
.note-summary-field {
  width: 100%;
  font-family: var(--serif);
  font-size: 13.5px;
  min-height: 200px;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 10px;
  resize: vertical;
  line-height: 1.6;
  box-sizing: border-box;
}
.note-summary-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.note-summary-actions .hint {
  font-size: 11px;
  color: var(--ink-soft);
}

/* ---- 每日复盘 ---- */
.daily-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}
.daily-calendar {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 4px;
  padding: 16px;
}
.daily-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
}
.daily-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.daily-cal-weekday {
  text-align: center;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-soft);
  padding: 4px 0;
}
.daily-cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12.5px;
  cursor: pointer;
  position: relative;
}
.daily-cal-cell.empty { cursor: default; }
.daily-cal-cell:not(.empty):hover { background: var(--paper); }
.daily-cal-cell.is-today { border: 1px solid var(--brass); }
.daily-cal-cell.is-selected { background: var(--ink); color: var(--card); }
.daily-cal-cell.has-data::after {
  content: "";
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brass);
}
.daily-cal-cell.is-selected.has-data::after { background: var(--card); }
.daily-detail {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 4px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.daily-detail h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  margin: 0;
}
.daily-journal-refs h4,
.daily-summary h4 {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 6px;
}
.daily-journal-refs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#dailyUserNotes {
  font-family: var(--serif);
  font-size: 14px;
  min-height: 100px;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 10px;
  resize: vertical;
  line-height: 1.6;
}
.daily-detail-actions {
  display: flex;
  gap: 10px;
}
.daily-summary {
  border-top: 1px solid var(--card-line);
  padding-top: 12px;
}
.daily-summary p {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
}
@media (max-width: 860px) {
  .daily-layout { grid-template-columns: 1fr; }
}

/* ---- 笔记摘要列表条目 ---- */
.note-summary-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.note-summary-empty {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 12px;
}
.note-summary-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 0;
  border-bottom: 1px solid var(--card-line);
}
.note-summary-item:first-child { padding-top: 0; }
.note-summary-item-text {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
}
.note-summary-item button {
  background: none;
  border: none;
  color: var(--fall);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  flex-shrink: 0;
}
.note-summary-add-row {
  display: flex;
  gap: 8px;
}
.note-summary-input {
  flex: 1;
  font-family: var(--serif);
  font-size: 13.5px;
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 8px 10px;
}
.note-summary-add-btn {
  background: var(--ink);
  color: var(--card);
  border: none;
  border-radius: 3px;
  padding: 0 14px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.note-summary-add-btn:hover { opacity: 0.85; }

/* ---- 摘要条目编辑 ---- */
.note-summary-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.note-summary-item-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11.5px;
  padding: 0;
  color: var(--ink-soft);
  opacity: 0.75;
}
.note-summary-item-actions button:hover { opacity: 1; }
.note-summary-edit-input {
  flex: 1;
  font-family: var(--serif);
  font-size: 13.5px;
  border: 1px solid var(--brass);
  border-radius: 3px;
  padding: 6px 8px;
}
.note-summary-save-item {
  background: var(--ink);
  color: var(--card);
  border: none;
  border-radius: 3px;
  padding: 4px 10px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 8px;
}

/* ---- 原文编辑 ---- */
.note-drawer-content-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}
#noteEditContentTextarea {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.7;
  min-height: 220px;
  border: 1px solid var(--brass);
  border-radius: 3px;
  padding: 12px;
  resize: vertical;
}
#noteEditContentActions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}


#noteDrawer {
  width: min(1000px, 96vw);
}
