/* ── Task panel left side ────────────────────────────────────── */
#task-panel {
  position: fixed; top: 80px; left: 14px; z-index: 55;
  width: 200px; max-height: calc(100vh - 160px);
  overflow-y: auto; overflow-x: hidden;
  padding: 8px; border-radius: 10px;
  background: linear-gradient(180deg, rgba(13,34,64,0.92), rgba(5,15,30,0.95));
  border: 2px solid #2a5a8a; box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  scrollbar-width: thin; scrollbar-color: rgba(96,165,250,0.3) transparent;
}
#task-panel::-webkit-scrollbar { width: 4px; }
#task-panel::-webkit-scrollbar-thumb { background: rgba(96,165,250,0.3); border-radius: 4px; }
#task-panel-header {
  font-size: 11px; font-weight: 700; color: #60a5fa; margin-bottom: 6px;
  display: flex; align-items: center; gap: 5px;
  padding-bottom: 5px; border-bottom: 1px solid rgba(96,165,250,0.15);
}
#task-panel-header .task-count {
  font-size: 9px; color: #94a3b8; font-weight: 600;
  background: rgba(255,255,255,0.08); padding: 1px 6px; border-radius: 8px;
}
#task-bar { display: flex; flex-direction: column; gap: 5px; }
.task-card {
  padding: 6px 8px; border-radius: 8px; font-size: 9px;
  background: rgba(59,130,246,0.12); border: 1px solid rgba(96,165,250,0.25); transition: all 0.3s;
  position: relative;
}
.task-card:hover { border-color: rgba(96,165,250,0.5); background: rgba(59,130,246,0.18); }
.task-card.claimed { opacity: 0.15; transform: scale(0.95); }
.task-card .task-title { font-weight: 600; margin-bottom: 2px; color: #e2e8f0; line-height: 1.3; }
.task-card .task-skills { font-size: 8px; color: #64748b; margin-bottom: 2px; }
.task-card .reward { color: #ffd700; font-weight: 700; font-size: 10px; }
.task-bids { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 3px; }
.bid-tag {
  font-size: 8px; padding: 2px 6px; border-radius: 6px;
  background: rgba(96,165,250,0.2); color: #93c5fd; font-weight: 600;
  display: flex; align-items: center; gap: 3px;
  border: 1px solid rgba(96,165,250,0.3);
}
.bid-tag img {
  width: 14px; height: 12px; object-fit: cover; image-rendering: pixelated;
}

/* ── Analytics modal ───────────────────────────────────────── */
#analytics-overlay {
  position: fixed; inset: 0; z-index: 300; display: none;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  justify-content: center; align-items: center;
}
#analytics-overlay.open { display: flex; }
#analytics-modal {
  width: 700px; max-width: 90vw; max-height: 85vh;
  background: linear-gradient(180deg, #0d2240, #091830);
  border: 2px solid #2a5a8a; border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.7);
  overflow: hidden;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid rgba(42,90,138,0.3);
}
.modal-header h2 { font-size: 15px; color: #ffd700; }
.modal-close {
  background: none; border: none; color: #64748b; font-size: 18px; cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(255,255,255,0.1); color: #fff; }
.modal-body { padding: 14px 18px; overflow-y: auto; max-height: calc(85vh - 50px); }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.modal-section h3 {
  font-size: 11px; color: #60a5fa; text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid rgba(42,90,138,0.3); padding-bottom: 4px; margin-bottom: 6px;
}
.row { display: flex; align-items: center; gap: 5px; padding: 3px 0; }
.row .dot { width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 3px currentColor; }
.row .nm { width: 65px; font-weight: 600; font-size: 11px; }
.row .bar { flex: 1; height: 5px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.row .fill { height: 100%; border-radius: 3px; transition: width 0.5s; }
.row .val { width: 45px; text-align: right; font-variant-numeric: tabular-nums; font-size: 10px; color: #94a3b8; }
#log { font-size: 9px; font-family: 'Courier New', monospace; max-height: 200px; overflow-y: auto; color: #64748b; }
#log div { padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.02); }

/* ── Metrics cards ────────────────────────────────────────── */
/* ── Guide modal ──────────────────────────────────────────── */
#guide-overlay {
  position: fixed; inset: 0; z-index: 310; display: none;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  justify-content: center; align-items: center;
}
#guide-overlay.open { display: flex; }
#guide-modal {
  width: 780px; max-width: 92vw; max-height: 88vh;
  background: linear-gradient(180deg, #0d2240, #091830);
  border: 2px solid #2a5a8a; border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.7); overflow: hidden;
  display: flex; flex-direction: column;
}
#guide-tabs {
  display: flex; gap: 0; padding: 0 18px; border-bottom: 1px solid rgba(42,90,138,0.3);
  overflow-x: auto; scrollbar-width: none;
}
#guide-tabs::-webkit-scrollbar { display: none; }
.guide-tab {
  background: none; border: none; color: #64748b; font-size: 11px; font-weight: 600;
  padding: 10px 14px; cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; transition: all 0.2s;
}
.guide-tab:hover { color: #94a3b8; }
.guide-tab.active { color: #ffd700; border-bottom-color: #ffd700; }
#guide-body {
  padding: 18px 22px; overflow-y: auto; flex: 1;
  font-size: 12px; line-height: 1.6; color: #cbd5e1;
}
#guide-body h3.guide-page-title {
  font-size: 16px; color: #ffd700; margin: 0 0 14px 0;
  padding-bottom: 8px; border-bottom: 1px solid rgba(42,90,138,0.3);
}
#guide-body h4 { font-size: 12px; color: #60a5fa; margin: 16px 0 6px 0; }
#guide-body p { margin: 8px 0; }
#guide-body ul, #guide-body ol { margin: 6px 0; padding-left: 20px; }
#guide-body li { margin: 3px 0; }
#guide-body code {
  background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 3px;
  font-family: 'Courier New', monospace; font-size: 11px; color: #facc15;
}
#guide-body a { color: #60a5fa; text-decoration: none; }
#guide-body a:hover { text-decoration: underline; }
.guide-table {
  width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 11px;
}
.guide-table td, .guide-table th {
  padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: top; text-align: left;
}
.guide-table th { color: #60a5fa; font-weight: 600; font-size: 10px; text-transform: uppercase; }
.guide-table td:first-child { white-space: nowrap; color: #e2e8f0; width: 140px; }
.guide-table tr:hover { background: rgba(255,255,255,0.03); }
#btn-guide {
  font-size: 14px; font-weight: 700; width: 28px; height: 28px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

.metrics-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px;
}
.metric-card {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(42,90,138,0.3);
  border-radius: 8px; padding: 8px 10px; text-align: center;
}
.metric-label { font-size: 9px; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.metric-value { font-size: 18px; font-weight: 700; color: #e2e8f0; font-variant-numeric: tabular-nums; }
.metrics-revenue { margin-bottom: 14px; padding: 8px 10px; background: rgba(255,255,255,0.03); border-radius: 8px; }
.metrics-revenue h3 {
  font-size: 11px; color: #60a5fa; text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid rgba(42,90,138,0.3); padding-bottom: 4px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.rev-row { font-size: 11px; padding: 5px 0; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.rev-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.rev-label { width: 60px; font-weight: 600; flex-shrink: 0; }
.rev-val { flex: 1; color: #94a3b8; }
.rev-spark { flex-shrink: 0; width: 120px; height: 24px; text-align: right; }
.detection-table { margin-bottom: 10px; }

/* ── Transactions dialog ──────────────────────────────────── */
#tx-overlay {
  position: fixed; inset: 0; z-index: 300; display: none;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  justify-content: center; align-items: center;
}
#tx-overlay.open { display: flex; }
#tx-modal {
  width: 550px; max-width: 90vw; max-height: 80vh;
  background: linear-gradient(180deg, #0d2240, #091830);
  border: 2px solid #2a5a8a; border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.7); overflow: hidden;
}
.tx-row {
  display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
  align-items: flex-start;
}
.tx-icon { font-size: 14px; flex-shrink: 0; width: 20px; text-align: center; }
.tx-info { flex: 1; }
.tx-type { font-weight: 600; font-size: 11px; }
.tx-detail { font-size: 10px; color: #94a3b8; margin-top: 1px; }
.tx-amount { font-weight: 700; font-size: 11px; flex-shrink: 0; }
.tx-amount.pos { color: #4ade80; }
.tx-amount.neg { color: #f87171; }
.tx-amount.neutral { color: #94a3b8; }
.tx-empty { color: #475569; text-align: center; padding: 20px; }

/* ── Fish info panel ───────────────────────────────────────── */
#fish-panel {
  position: fixed; top: 0; right: -340px; width: 340px; height: 100vh;
  background: linear-gradient(180deg, #0d2240, #091830);
  border-left: 2px solid #2a5a8a; z-index: 250;
  transition: right 0.3s; overflow-y: auto; padding: 16px;
  box-shadow: -5px 0 20px rgba(0,0,0,0.5);
}
#fish-panel.open { right: 0; }
.fish-panel-close {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; color: #64748b; font-size: 18px; cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.fish-panel-close:hover { background: rgba(255,255,255,0.1); color: #fff; }
.fp-name { font-size: 18px; font-weight: 700; color: #ffd700; margin-bottom: 4px; }
.fp-behavior { font-size: 11px; color: #64748b; margin-bottom: 12px; }
.fp-stat { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 12px; }
.fp-stat .label { color: #94a3b8; }
.fp-stat .value { font-weight: 600; }
.fp-trust-bar { height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; margin: 4px 0 12px; overflow: hidden; }
.fp-trust-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.fp-memory { font-size: 10px; color: #64748b; margin-top: 10px; }
.fp-memory div { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,0.03); }
.fp-link {
  display: inline-block; margin-top: 12px; padding: 6px 12px; border-radius: 8px;
  background: linear-gradient(180deg, #60a5fa, #2563eb); color: #fff;
  font-size: 11px; font-weight: 600; text-decoration: none; border: 1px solid #1d4ed8;
}
.fp-link:hover { filter: brightness(1.1); }
.fp-brain { margin-top: 12px; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 8px; }
.fp-brain-header { font-size: 12px; font-weight: 700; color: #60a5fa; margin-bottom: 6px; }
.fp-brain-section { margin-bottom: 6px; }
.fp-brain-section summary { cursor: pointer; list-style: none; }
.fp-brain-section summary::before { content: '\25B8 '; color: #475569; }
.fp-brain-section[open] summary::before { content: '\25BE '; }
.fp-brain-label { font-size: 10px; font-weight: 600; color: #94a3b8; padding: 2px 0; }
.fp-brain-pre {
  font-size: 9px; font-family: 'Courier New', monospace; color: #cbd5e1;
  background: rgba(0,0,0,0.3); border-radius: 4px; padding: 6px 8px;
  margin: 3px 0; white-space: pre-wrap; word-break: break-word;
  overflow-y: auto; line-height: 1.4;
}
.fp-brain-md {
  font-size: 10px; color: #cbd5e1;
  background: rgba(0,0,0,0.3); border-radius: 4px; padding: 8px 10px;
  margin: 3px 0; word-break: break-word;
  overflow-y: auto; line-height: 1.5;
}
.fp-brain-md strong { color: #ffd700; }
.fp-brain-md em { color: #93c5fd; font-style: italic; }
.fp-brain-md code { background: rgba(255,255,255,0.08); padding: 1px 4px; border-radius: 3px; font-size: 9px; font-family: 'Courier New', monospace; }
.fp-brain-md ul, .fp-brain-md ol { margin: 4px 0; padding-left: 16px; }
.fp-brain-md li { margin: 2px 0; }
.fp-brain-md p { margin: 4px 0; }
.fp-brain-md h1,.fp-brain-md h2,.fp-brain-md h3 { font-size: 11px; color: #60a5fa; margin: 6px 0 3px; }
.fp-brain-tool { margin: 3px 0; }
.fp-brain-tool-name {
  display: inline-block; font-size: 9px; font-weight: 700; color: #facc15;
  background: rgba(250,204,21,0.1); padding: 1px 6px; border-radius: 3px;
}
.fp-brain-empty { font-size: 10px; color: #475569; font-style: italic; padding: 8px 0; }
/* ── Job history timeline ─────────────────────────────────── */
.fp-job-history { padding: 4px 0; }
.fp-job-group { margin-bottom: 8px; }
.fp-job-title { font-size: 9px; font-weight: 700; color: #e2e8f0; margin-bottom: 2px; }
.fp-job-event {
  font-size: 8px; padding: 2px 0 2px 12px; color: #94a3b8;
  border-left: 2px solid rgba(255,255,255,0.1); margin-left: 4px;
}
.fp-job-event.won { border-left-color: #4ade80; color: #86efac; }
.fp-job-event.paid { border-left-color: #4ade80; color: #86efac; }
.fp-job-event.judged { border-left-color: #60a5fa; color: #93c5fd; }
.fp-job-event.submitted { border-left-color: #facc15; color: #fde047; }
.fp-job-event.failed { border-left-color: #f87171; color: #fca5a5; }
.fp-job-event.expired { border-left-color: #f87171; color: #fca5a5; }
.fp-job-event.disputed { border-left-color: #a855f7; color: #c4b5fd; }
.fp-job-event.lost_bid { border-left-color: #64748b; color: #64748b; }
.fp-job-event.rated { border-left-color: #38bdf8; color: #7dd3fc; }
.fp-job-event.accepted { border-left-color: #4ade80; color: #86efac; }

.fp-chat { margin-top: 8px; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 6px; }
.fp-chat-header { font-size: 11px; font-weight: 700; color: #38bdf8; margin-bottom: 4px; }
.fp-chat-msg {
  font-size: 9px; padding: 4px 8px; margin: 3px 0; border-radius: 6px;
  line-height: 1.4; word-break: break-word;
}
.fp-chat-msg.sent {
  background: rgba(56,189,248,0.12); border-left: 2px solid #38bdf8; margin-left: 10px;
}
.fp-chat-msg.recv {
  background: rgba(168,85,247,0.12); border-left: 2px solid #a855f7; margin-right: 10px;
}
.fp-chat-meta { font-size: 8px; color: #64748b; margin-bottom: 1px; }
.fp-chat-text { color: #cbd5e1; }
