*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, sans-serif; font-size: 14px; display: flex; height: 100vh; overflow: hidden; background: #f5f5f5; }

aside {
  width: 220px; min-width: 220px; background: #1e1e2e; color: #cdd6f4;
  overflow-y: auto; display: flex; flex-direction: column;
}
aside h1 { font-size: 13px; font-weight: 600; padding: 14px 16px; color: #89b4fa; letter-spacing: .05em; text-transform: uppercase; border-bottom: 1px solid #313244; }
aside ul { list-style: none; padding: 6px 0; }
aside li { padding: 6px 16px; cursor: pointer; border-radius: 4px; margin: 1px 6px; }
aside li:hover { background: #313244; }
aside li.active { background: #45475a; color: #89b4fa; font-weight: 600; }

main { flex: 1; overflow-y: auto; padding: 24px; }

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.toolbar h2 { font-size: 18px; font-weight: 700; color: #1e1e2e; }
.back-btn { background: #e0e0e0; border: none; border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.back-btn:hover { background: #d0d0d0; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
thead th { background: #1e1e2e; color: #cdd6f4; text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
tbody tr { border-bottom: 1px solid #f0f0f0; }
tbody tr:last-child { border-bottom: none; }
tbody tr.clickable:hover { background: #f0f4ff; cursor: pointer; }
tbody td { padding: 9px 14px; color: #333; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fk-label { color: #1a6ef7; }

.pagination { display: flex; align-items: center; gap: 10px; margin-top: 16px; color: #555; font-size: 13px; }
.pagination button { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 5px 12px; cursor: pointer; }
.pagination button:hover:not(:disabled) { background: #f0f0f0; }
.pagination button:disabled { opacity: .4; cursor: default; }

.detail-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.12); overflow: hidden; max-width: 700px; }
.detail-card dl { display: grid; grid-template-columns: 200px 1fr; }
.detail-card .field { display: contents; }
.detail-card .field:not(:last-child) dt,
.detail-card .field:not(:last-child) dd { border-bottom: 1px solid #f0f0f0; }
.detail-card dt { background: #f8f8f8; padding: 10px 16px; font-weight: 600; color: #555; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.detail-card dd { padding: 10px 16px; color: #333; word-break: break-all; }
.detail-card a { color: #1a6ef7; text-decoration: none; }
.detail-card a:hover { text-decoration: underline; }

.related-section { margin-top: 24px; max-width: 900px; }
.related-section h3 { font-size: 13px; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.related-panel { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.12); margin-bottom: 10px; overflow: hidden; }
.related-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; user-select: none; }
.related-header:hover { background: #f8f8f8; }
.related-title { font-weight: 600; color: #1e1e2e; }
.related-via { font-size: 12px; color: #888; }
.related-count { background: #e8eef8; color: #1a6ef7; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.related-toggle { margin-left: auto; font-size: 12px; color: #888; background: #f0f0f0; border: none; border-radius: 4px; padding: 3px 10px; cursor: pointer; }
.related-body { border-top: 1px solid #f0f0f0; }
.related-body table { border-radius: 0; box-shadow: none; }
.related-body .pagination { padding: 10px 16px; margin-top: 0; border-top: 1px solid #f0f0f0; }
.related-loading { padding: 20px; text-align: center; color: #888; }

.pipeline-section { border-top: 1px solid #313244; padding: 12px 10px 6px; }
.pipeline-section h2 { font-size: 11px; font-weight: 600; color: #6c7086; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; padding: 0 6px; }
.pipeline-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.pipeline-btn { background: #313244; border: none; border-radius: 5px; color: #cdd6f4; font-size: 12px; padding: 6px 4px; cursor: pointer; text-align: center; }
.pipeline-btn:hover:not(:disabled) { background: #45475a; }
.pipeline-btn:disabled { opacity: .45; cursor: default; }
.pipeline-btn.running { color: #89b4fa; }
.pipeline-btn.form-open { background: #45475a; color: #89b4fa; }
.pipeline-status { font-size: 11px; margin-top: 8px; padding: 0 6px; min-height: 16px; color: #6c7086; }
.pipeline-status.ok { color: #a6e3a1; }
.pipeline-status.err { color: #f38ba8; }

.pipeline-window-row { display: flex; align-items: center; gap: 5px; padding: 6px 6px 0; font-size: 11px; color: #6c7086; }
.pipeline-window-row input[type=number] { width: 48px; background: #181825; border: 1px solid #45475a; border-radius: 4px; color: #cdd6f4; font-size: 11px; padding: 3px 4px; text-align: center; -moz-appearance: textfield; }
.pipeline-window-row input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.pipeline-window-row input[type=number]:focus { outline: none; border-color: #89b4fa; }
.pipeline-window-row input[type=number]:disabled { opacity: .45; }

.collect-form { padding: 8px 10px 6px; border-top: 1px solid #313244; }
.collect-form label { display: block; font-size: 10px; font-weight: 600; color: #6c7086; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px; }
.collect-form select { width: 100%; background: #181825; border: 1px solid #45475a; border-radius: 4px; color: #cdd6f4; font-size: 12px; padding: 5px 6px; margin-bottom: 8px; cursor: pointer; appearance: none; }
.collect-form select:focus { outline: none; border-color: #89b4fa; }
.collect-form-actions { display: flex; gap: 5px; }
.collect-run-btn { flex: 1; background: #1a6ef7; border: none; border-radius: 4px; color: #fff; font-size: 12px; padding: 6px; cursor: pointer; }
.collect-run-btn:hover { background: #1558cc; }
.collect-cancel-btn { background: #313244; border: none; border-radius: 4px; color: #cdd6f4; font-size: 12px; padding: 6px 10px; cursor: pointer; }
.collect-cancel-btn:hover { background: #45475a; }

.clear-section { border-top: 1px solid #313244; padding: 10px 10px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.clear-btn { background: #3b1d24; border: 1px solid #5b2333; border-radius: 5px; color: #f38ba8; font-size: 12px; padding: 7px 4px; cursor: pointer; text-align: center; }
.clear-btn:hover { background: #5b2333; }

thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { background: #2e2e40; }

.delete-all-btn { background: #3b1d24; border: 1px solid #5b2333; border-radius: 6px; color: #f38ba8; font-size: 13px; padding: 5px 12px; cursor: pointer; margin-left: auto; }
.delete-all-btn:hover:not(:disabled) { background: #5b2333; }
.delete-all-btn:disabled { opacity: .4; cursor: default; }
.row-delete-btn { background: none; border: none; color: #f38ba8; cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 4px; }
.row-delete-btn:hover:not(:disabled) { background: #fde8ec; }
.row-delete-btn:disabled { opacity: .4; cursor: default; }

.empty { color: #888; padding: 32px; text-align: center; }
.loading { color: #888; padding: 32px; text-align: center; }

.detail-action-btn { background: #1a6ef7; border: none; border-radius: 6px; color: #fff; font-size: 13px; padding: 6px 14px; cursor: pointer; }
.detail-action-btn:hover { background: #1558cc; }

.arb-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.12); padding: 24px 28px; max-width: 700px; margin-bottom: 16px; }
.arb-match { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.arb-team { font-size: 22px; font-weight: 700; color: #1e1e2e; }
.arb-vs { font-size: 14px; color: #888; font-weight: 500; }
.arb-meta { font-size: 13px; color: #666; }
.arb-meta span + span::before { content: ' · '; }

.arb-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 700px; margin-bottom: 24px; }
.arb-stat { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.12); padding: 16px; }
.arb-stat-label { display: block; font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.arb-stat-value { display: block; font-size: 20px; font-weight: 700; color: #1e1e2e; }
.profit-pos { color: #2ea043; }
.profit-neg { color: #d93025; }

.arb-bets h3 { font-size: 13px; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }

.market-badge { display: inline-block; background: #e8eef8; color: #1a6ef7; font-size: 13px; font-weight: 600; padding: 3px 12px; border-radius: 12px; margin-bottom: 8px; }
.arb-bets-rounded { margin-top: 24px; }
tfoot td { padding: 9px 14px; font-weight: 600; color: #555; border-top: 2px solid #f0f0f0; }
.arb-tfoot-label { text-align: right; }
