/* Portfolio Manager styles */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f6f7f9;
  color: #1c2430;
  font-size: 15px;
}
a { color: #1f5eff; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  background: #101827; color: #fff;
  padding: 0.6rem 1.4rem;
  position: sticky; top: 0; z-index: 50;
}
.brand-link { color: #fff; font-weight: 700; font-size: 1.05rem; }
.topbar nav { display: flex; gap: 0.2rem; flex: 1; align-items: center; }
.nav-link {
  color: #cbd5e1; padding: 0.45rem 0.7rem; border-radius: 6px;
  font-weight: 500; cursor: default;
}
a.nav-link:hover { background: #1e293b; color: #fff; text-decoration: none; }
.nav-link.active { background: #1e293b; color: #fff; }
.nav-group { position: relative; }
.nav-group:hover .dropdown { display: block; }
.dropdown {
  display: none; position: absolute; top: 100%; left: 0;
  background: #fff; border: 1px solid #dde3ea; border-radius: 8px;
  min-width: 210px; box-shadow: 0 8px 24px rgba(16,24,39,.14); padding: 0.35rem;
}
.dropdown a { display: block; padding: 0.5rem 0.8rem; color: #1c2430; border-radius: 6px; }
.dropdown a:hover { background: #eef2f7; text-decoration: none; }

.container { max-width: 1250px; margin: 1.4rem auto; padding: 0 1.2rem; }

h1 { font-size: 1.45rem; margin: 0.2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 0.6rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.8rem; }
.page-head .actions { display: flex; gap: 0.5rem; align-items: center; }

.flash { padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.notice { background: #e5f6ec; color: #14532d; border: 1px solid #b7e4c7; }
.flash.alert { background: #fdecec; color: #7f1d1d; border: 1px solid #f5c2c2; }

.card {
  background: #fff; border: 1px solid #e4e8ee; border-radius: 10px;
  padding: 1rem 1.2rem; margin-bottom: 1.2rem;
}
.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.stat {
  background: #fff; border: 1px solid #e4e8ee; border-radius: 10px;
  padding: 0.9rem 1.2rem; flex: 1; min-width: 180px;
}
.stat .label { color: #64748b; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.35rem; font-weight: 700; margin-top: 0.2rem; }

table.data { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e4e8ee; border-radius: 10px; overflow: hidden; }
table.data th {
  text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .03em;
  color: #64748b; background: #f8fafc; padding: 0.55rem 0.7rem; border-bottom: 1px solid #e4e8ee;
}
table.data td { padding: 0.5rem 0.7rem; border-bottom: 1px solid #eef1f5; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #f8fafc; }
table.data .num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.total td { font-weight: 700; background: #f1f5f9; }
.gain { color: #15803d; }
.loss { color: #b91c1c; }
.muted { color: #64748b; }
.small { font-size: 0.85rem; }

.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge.buy, .badge.confirmed, .badge.committed { background: #e5f6ec; color: #14532d; }
.badge.sell, .badge.failed { background: #fdecec; color: #7f1d1d; }
.badge.suggested, .badge.parsed, .badge.pending { background: #fef3c7; color: #92400e; }
.badge.neutral { background: #e2e8f0; color: #334155; }

.btn {
  display: inline-block; background: #1f5eff; color: #fff; border: none;
  padding: 0.5rem 0.95rem; border-radius: 8px; font-weight: 600; font-size: 0.9rem;
  cursor: pointer;
}
.btn:hover { background: #1848c7; text-decoration: none; color: #fff; }
.btn-secondary { background: #eef2f7; color: #1c2430; }
.btn-secondary:hover { background: #dde3ea; color: #1c2430; }
.btn-quiet { background: transparent; color: #cbd5e1; font-weight: 500; }
.btn-quiet:hover { background: #1e293b; color: #fff; }
.btn-danger { background: transparent; color: #b91c1c; font-weight: 500; padding: 0.2rem 0.4rem; }
.btn-danger:hover { background: #fdecec; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

form.standard { max-width: 560px; }
form.standard .field { margin-bottom: 0.9rem; }
form.standard label { display: block; font-weight: 600; margin-bottom: 0.25rem; font-size: 0.88rem; }
form.standard input[type=text], form.standard input[type=number], form.standard input[type=date],
form.standard input[type=password], form.standard input[type=email], form.standard input[type=file],
form.standard select, form.standard textarea {
  width: 100%; padding: 0.5rem 0.65rem; border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: 0.95rem; background: #fff;
}
form.standard .hint { color: #64748b; font-size: 0.8rem; margin-top: 0.2rem; }
.inline-form { display: inline; }
.errors { background: #fdecec; border: 1px solid #f5c2c2; color: #7f1d1d; border-radius: 8px; padding: 0.7rem 1rem; margin-bottom: 1rem; }

.filter-bar { display: flex; gap: 0.6rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar label { font-size: 0.8rem; font-weight: 600; display: block; margin-bottom: 0.2rem; }
.filter-bar input, .filter-bar select { padding: 0.4rem 0.6rem; border: 1px solid #cbd5e1; border-radius: 8px; }

.review-table input, .review-table select { width: 100%; border: 1px solid #cbd5e1; border-radius: 6px; padding: 0.3rem 0.4rem; font-size: 0.85rem; }
.review-table td { min-width: 80px; }

.auth-box { max-width: 380px; margin: 8vh auto; }
.table-scroll { overflow-x: auto; }

/* Portfolio switcher in the top bar */
.portfolio-switcher .nav-link { background: rgba(255,255,255,0.12); border-radius: 6px; font-weight: 700; }
.dropdown-btn { display: block; width: 100%; text-align: left; padding: 0.5rem 0.8rem; background: none; border: none; color: #1c2430; border-radius: 6px; cursor: pointer; font-size: 0.95rem; }
.dropdown-btn:hover { background: #eef2f7; }

/* Sortable table headers */
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { background: #374151; }
table.data th.sort-asc::after { content: " ▲"; font-size: 0.7em; }
table.data th.sort-desc::after { content: " ▼"; font-size: 0.7em; }

/* Page-head action bars: keep filter forms on one line with the buttons */
.page-head .actions .filter-bar { margin-bottom: 0; align-items: center; }
.page-head .actions .filter-bar > div { display: flex; align-items: center; gap: 0.35rem; }
.page-head .actions .filter-bar label { margin-bottom: 0; }

/* Dashboard: extra holdings hidden until expanded */
tr.extra-holding { display: none; }
table.data.show-all tr.extra-holding { display: table-row; }
