:root {
  --navy-900: #0a1a3a;
  --navy-800: #0f2350;
  --navy-700: #16306a;
  --navy-600: #1f4490;
  --navy-500: #2e5dba;
  --navy-400: #4d7ed9;
  --navy-300: #8fb1ee;
  --navy-100: #dbe7fb;
  --navy-50:  #f1f5fd;
  --white:    #ffffff;
  --ink:      #0a1a3a;
  --muted:    #5b6a87;
  --border:   #d8e1f3;
  --green:    #1f9d55;
  --red:      #d33a3a;
  --amber:    #c98b00;
  --shadow:   0 2px 12px rgba(10, 26, 58, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--white);
  color: var(--ink);
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header {
  background: var(--navy-900);
  color: var(--white);
  border-bottom: 1px solid var(--navy-800);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { color: var(--white); font-weight: 700; font-size: 18px; letter-spacing: 0.2px; text-decoration: none; }
.brand-mark { color: var(--navy-300); margin-right: 4px; }
.main-nav { display: flex; align-items: center; gap: 18px; }
.main-nav a { color: var(--navy-100); text-decoration: none; }
.main-nav a:hover { color: var(--white); }
.inline-form { display: inline; margin: 0; }
.btn-link {
  background: none; border: 0; color: var(--navy-100); cursor: pointer; padding: 0; font: inherit;
}
.btn-link:hover { color: var(--white); }

/* Buttons */
.btn {
  display: inline-block; padding: 8px 14px; border-radius: 6px;
  font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid transparent; font-size: 14px;
}
.btn-primary { background: var(--navy-500); color: var(--white); }
.btn-primary:hover { background: var(--navy-600); }
.btn-secondary { background: var(--white); color: var(--navy-700); border-color: var(--navy-500); }
.btn-secondary:hover { background: var(--navy-50); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-ghost { background: transparent; color: var(--navy-600); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 60px; padding: 18px 0; color: var(--muted); font-size: 13px;
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; }
.footer-links a { color: var(--navy-600); text-decoration: none; margin-left: 14px; }
.footer-links a:hover { color: var(--navy-800); }

/* Messages */
.messages { margin-top: 14px; }
.message { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; background: var(--navy-50); border: 1px solid var(--navy-100); color: var(--navy-800); }
.message.error { background: #fdecec; border-color: #f5bcbc; color: var(--red); }
.message.success { background: #e8f7ee; border-color: #b3e2c2; color: var(--green); }

/* Headings */
h1, h2, h3, h4 { color: var(--navy-900); margin-top: 0; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

/* Forms */
form .field { margin-bottom: 14px; }
form label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; color: var(--navy-800); }
form .help { color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email], select, textarea {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--ink);
  background: var(--white); border: 1px solid var(--border); border-radius: 6px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy-400); border-color: var(--navy-500); }
.md-editor { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.errorlist { color: var(--red); list-style: none; padding: 0; margin: 4px 0; font-size: 13px; }

/* Cards / lists */
.pick-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.pick-card h3 { margin: 0 0 4px; font-size: 17px; }
.pick-card h3 a { color: var(--navy-800); text-decoration: none; }
.pick-card h3 a:hover { color: var(--navy-500); }
.pick-meta { color: var(--muted); font-size: 13px; }
.pick-meta a { color: var(--navy-600); text-decoration: none; }
.pick-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  background: var(--navy-50); color: var(--navy-700); border: 1px solid var(--navy-100); text-decoration: none;
}
.tag.short { background: #fdecec; border-color: #f5bcbc; color: var(--red); }
.tag:hover { background: var(--navy-100); }

.metric-row { display: flex; gap: 18px; margin-top: 10px; flex-wrap: wrap; }
.metric { font-size: 13px; color: var(--muted); }
.metric strong { display: block; font-size: 16px; color: var(--ink); }
.metric .pos { color: var(--green); }
.metric .neg { color: var(--red); }

/* Layout helpers */
.row { display: flex; gap: 24px; }
.row > .main { flex: 1; min-width: 0; }
.row > .side { width: 280px; }
@media (max-width: 800px) {
  .row { flex-direction: column; }
  .row > .side { width: auto; }
}
.panel { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.panel h3 { font-size: 15px; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--navy-700); }

/* Filters */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.filters .field { margin: 0; }

/* Pick detail */
.pick-hero { padding: 20px 22px; background: linear-gradient(135deg, var(--navy-800), var(--navy-600)); color: var(--white); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 18px; }
.pick-hero h1 { color: var(--white); margin-bottom: 6px; }
.pick-hero .pick-meta { color: var(--navy-100); }
.pick-hero a { color: var(--navy-100); }
.pick-hero .tag {
  background: var(--navy-500);
  color: var(--white) !important;
  border-color: var(--navy-400);
  font-weight: 600;
}
.pick-hero .tag:hover { background: var(--navy-400); color: var(--white) !important; }
.pick-hero .tag.short {
  background: #b73838;
  color: var(--white) !important;
  border-color: #d05050;
}
.pick-hero .tag.short:hover { background: #c34646; color: var(--white) !important; }
.hero-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; margin-top: 16px; }
.hero-metric strong { display: block; font-size: 22px; color: var(--white); }
.hero-metric span { color: var(--navy-100); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.hero-metric .pos { color: #7fd9a4; }
.hero-metric .neg { color: #ffb1b1; }

/* Chart */
.chart-wrap { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 12px; box-shadow: var(--shadow); }
#chart { height: 360px; }
.chart-legend { display: flex; gap: 16px; padding: 8px 4px 0; font-size: 13px; color: var(--muted); }
.chart-legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.chart-toolbar { display: flex; justify-content: flex-end; padding: 0 4px 8px; }
.benchmark-picker { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.benchmark-picker label { margin: 0; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.benchmark-picker select,
.benchmark-picker input[type=text] { width: auto; min-width: 260px; padding: 4px 8px; font-size: 13px; }

/* Markdown body */
.markdown-body { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 18px 22px; box-shadow: var(--shadow); }
.markdown-body h1 { font-size: 24px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.markdown-body h2 { font-size: 19px; }
.markdown-body h3 { font-size: 16px; }
.markdown-body table {
  border-collapse: collapse;
  margin: 12px 0;
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  white-space: nowrap;
  vertical-align: top;
}
.markdown-body th { background: var(--navy-50); }
.markdown-body code { background: var(--navy-50); padding: 1px 4px; border-radius: 3px; font-size: 13px; }
.markdown-body pre { background: var(--navy-50); padding: 12px; border-radius: 6px; overflow-x: auto; }
.markdown-body blockquote { border-left: 3px solid var(--navy-300); padding-left: 12px; color: var(--muted); margin-left: 0; }
.markdown-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 12px auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(10, 26, 58, 0.08);
}

/* Formset rows */
.legs-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.legs-table th { background: var(--navy-50); padding: 6px 8px; text-align: left; font-size: 13px; color: var(--navy-700); }
.legs-table td { padding: 6px 8px; vertical-align: top; }
.legs-table input, .legs-table select { padding: 6px 8px; }

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.admin-table th { background: var(--navy-50); color: var(--navy-700); font-weight: 600; letter-spacing: 0.2px; }
.admin-table tr:hover td { background: var(--navy-50); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 5px; }

/* Chart legend hover */
.legend-item { cursor: default; padding: 2px 6px; border-radius: 4px; transition: background 0.1s; }
.legend-item:hover { background: var(--navy-50); }
.legend-item.series-active { background: var(--navy-100); font-weight: 700; }

/* Ticker autocomplete */
.ac-dropdown {
  position: absolute; z-index: 999;
  background: var(--white); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 20px rgba(10, 26, 58, 0.12);
  max-height: 320px; overflow-y: auto; min-width: 280px;
  font-size: 13px;
}
.ac-item { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--navy-50); }
.ac-item:last-child { border-bottom: none; }
.ac-item.ac-active, .ac-item:hover { background: var(--navy-50); }
.ac-ticker { font-weight: 700; color: var(--navy-800); font-family: ui-monospace, monospace; }
.ac-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-empty { padding: 10px 12px; color: var(--muted); font-style: italic; }

/* Notification bell */
.nav-bell { position: relative; text-decoration: none; padding: 2px 4px; }
.nav-bell-badge {
  position: absolute; top: -6px; right: -8px;
  background: var(--red); color: var(--white);
  font-size: 11px; font-weight: 700; line-height: 1;
  padding: 2px 6px; border-radius: 999px;
  min-width: 16px; text-align: center;
}

/* Avatars */
.avatar {
  display: inline-block; border-radius: 50%; object-fit: cover; background: var(--navy-100);
  border: 1px solid var(--border);
}
.avatar.xs { width: 22px; height: 22px; }
.avatar.sm { width: 32px; height: 32px; }
.avatar.lg { width: 96px; height: 96px; font-size: 36px; }
.avatar-placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy-500), var(--navy-700));
  color: var(--white); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}

/* Profile page */
.profile-head { display: flex; gap: 18px; align-items: flex-start; }
.profile-head .avatar.lg { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3); }
.profile-info { flex: 1; min-width: 0; }
.profile-bio { margin: 8px 0 0; color: var(--navy-100); white-space: pre-wrap; }

.portfolio-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.portfolio-history-item {
  padding: 10px 12px; border-left: 3px solid var(--navy-300);
  background: var(--navy-50); border-radius: 0 6px 6px 0; margin-bottom: 8px;
}
.portfolio-history-head { display: flex; justify-content: space-between; align-items: baseline; }

.bio-input { font-family: inherit; }

/* Forum / comments */
.forum { margin-top: 28px; }
.forum-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.forum-tab {
  padding: 10px 16px; border-radius: 8px 8px 0 0;
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px;
  border: 1px solid transparent; border-bottom: none;
  position: relative; top: 1px;
}
.forum-tab:hover { color: var(--navy-700); background: var(--navy-50); }
.forum-tab.active { color: var(--navy-800); background: var(--white); border-color: var(--border); }
.forum-count {
  display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 999px;
  background: var(--navy-50); color: var(--navy-700); font-size: 12px; margin-left: 4px;
}
.forum-tab.active .forum-count { background: var(--navy-500); color: var(--white); }

.forum-toolbar { display: flex; gap: 8px; align-items: center; margin: 6px 0 14px; }
.chip {
  display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12px;
  background: var(--white); color: var(--navy-700); border: 1px solid var(--border); text-decoration: none; font-weight: 600;
}
.chip.active { background: var(--navy-500); color: var(--white); border-color: var(--navy-500); }
.chip:hover { background: var(--navy-50); }

.comment-form textarea {
  width: 100%; min-height: 70px; padding: 10px;
  border: 1px solid var(--border); border-radius: 8px; resize: vertical; font: inherit;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.comment-list { margin-top: 10px; }
.comment {
  display: flex; gap: 12px;
  padding: 12px 14px; background: var(--white); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.vote-col { display: flex; flex-direction: column; align-items: center; min-width: 40px; }
.vote-form { display: flex; flex-direction: column; align-items: center; margin: 0; gap: 4px; }
.vote-btn {
  background: transparent; border: 1px solid transparent; cursor: pointer;
  color: var(--muted); font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 4px;
}
.vote-btn:hover:not(:disabled) { background: var(--navy-50); color: var(--navy-700); }
.vote-btn:disabled { cursor: not-allowed; opacity: 0.5; }
.vote-btn.up.voted { color: var(--green); background: #e8f7ee; }
.vote-btn.down.voted { color: var(--red); background: #fdecec; }
.vote-score { font-weight: 700; font-size: 14px; color: var(--ink); }
.vote-score.pos { color: var(--green); }
.vote-score.neg { color: var(--red); }

.comment-body { flex: 1; min-width: 0; }
.comment-meta { font-size: 13px; }
.comment-meta a { color: var(--navy-700); text-decoration: none; font-weight: 600; }
.comment-text { margin-top: 4px; word-wrap: break-word; }

/* Misc */
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
.muted { color: var(--muted); }
.kbd { font-family: ui-monospace, monospace; background: var(--navy-50); padding: 1px 6px; border-radius: 3px; font-size: 12px; }
.empty { color: var(--muted); padding: 30px; text-align: center; border: 1px dashed var(--border); border-radius: 10px; }
