:root {
  --bg: #0d1117; --panel: #161b22; --panel2: #1c2330;
  --line: #273244; --text: #e6edf3; --dim: #9aa7b4; --accent: #ff7a18;
  --accent2: #ffc24a; --green: #3fb950; --red: #f85149; --blue: #58a6ff;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
h1 { font-size: 20px; margin: 0 0 14px; font-weight: 650; }
h1 small, .tag { color: var(--dim); font-weight: 400; font-size: 12px; margin-left: 8px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: .3px; }
.logo {
  color: var(--accent); margin-right: 4px;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.tabs { display: flex; gap: 4px; }
.tab {
  background: none; border: none; color: var(--dim); padding: 8px 14px;
  border-radius: 7px; cursor: pointer; font-size: 14px;
}
.tab:hover { color: var(--text); background: var(--panel2); }
.tab.active { color: var(--text); background: var(--panel2); box-shadow: inset 0 -2px 0 var(--accent); }

main { padding: 22px; max-width: 1200px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px; margin-bottom: 16px;
}
.row-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--dim); }
input, select, textarea {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 7px; padding: 8px 10px; font: inherit; min-width: 140px;
}
textarea { min-height: 70px; resize: vertical; width: 100%; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

button {
  cursor: pointer; border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); padding: 9px 14px; font: inherit;
}
button:hover { border-color: var(--dim); }
button.primary {
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  color: #1a1000; border: none; font-weight: 650;
}
button.primary:hover { filter: brightness(1.06); }
button.sm { padding: 6px 11px; font-size: 13px; }
button.ghost { background: none; }
button.danger { color: var(--red); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }

.band { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 16px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 12px 16px; min-width: 120px; flex: 1;
}
.stat .k { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.stat .v { font-size: 19px; font-weight: 650; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat.hero { border-color: var(--accent); }
.stat .v.green { color: var(--green); } .stat .v.red { color: var(--red); }

.split { display: grid; grid-template-columns: 300px 1fr; gap: 18px; }
.col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 13px; cursor: pointer;
}
.list-item:hover { border-color: var(--dim); }
.list-item.sel { border-color: var(--accent); background: var(--panel2); }
.list-item .t { font-weight: 600; }
.list-item .m { color: var(--dim); font-size: 12px; margin-top: 3px; }
.empty { color: var(--dim); padding: 40px; text-align: center; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.pill.researching { background: #1f3a5f; color: var(--blue); }
.pill.bidding { background: #4a3410; color: var(--accent2); }
.pill.submitted { background: #23303f; color: var(--dim); }
.pill.won { background: #14351f; color: var(--green); }
.pill.lost { background: #3a1717; color: var(--red); }
.pill.no_bid { background: #2b2b2b; color: var(--dim); }
.pill.requested { background: #23303f; color: var(--dim); }
.pill.received { background: #1f3a5f; color: var(--blue); }
.pill.selected { background: #14351f; color: var(--green); }
.pill.declined { background: #3a1717; color: var(--red); }

.section-title { font-size: 13px; font-weight: 650; color: var(--dim); text-transform: uppercase;
  letter-spacing: .5px; margin: 18px 0 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }
.muted { color: var(--dim); }
.mono { font-variant-numeric: tabular-nums; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex;
  align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; width: 460px; max-width: 92vw; max-height: 88vh; overflow-y: auto; }
.modal h2 { margin: 0 0 14px; font-size: 17px; }
.modal .row { margin-bottom: 10px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--accent); color: var(--text);
  padding: 11px 18px; border-radius: 8px; opacity: 0; transition: opacity .25s;
  pointer-events: none; z-index: 99; }
#toast.show { opacity: 1; }

.hidden { display: none !important; }
.userbox { display: flex; align-items: center; gap: 10px; font-size: 12px; }
#login-gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #1c2330, var(--bg)); z-index: 100; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px; width: 340px; display: flex; flex-direction: column; gap: 12px; }
.login-card label { gap: 6px; }
.brand.big { font-size: 26px; font-weight: 700; margin-bottom: 4px; }

.verdict { display: inline-block; padding: 4px 14px; border-radius: 8px; font-weight: 700; font-size: 15px; }
.verdict.GO, .verdict.LEANGO { background: #14351f; color: var(--green); }
.verdict.TOSSUP { background: #4a3410; color: var(--accent2); }
.verdict.NOBID { background: #3a1717; color: var(--red); }
.bar { height: 7px; background: var(--bg); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.factor { margin-bottom: 10px; }
.factor .fh { display: flex; justify-content: space-between; font-size: 13px; }
.narrative { background: var(--panel2); border-left: 3px solid var(--accent); padding: 12px 14px;
  border-radius: 6px; margin-top: 12px; white-space: pre-wrap; }
.proposal { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 16px; max-height: 520px; overflow-y: auto; font-size: 13px; line-height: 1.6; }

@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .tabs .tab { padding: 8px 9px; }
}
