:root {
  --green: #22863a; --green-bg: #dcffe4;
  --yellow: #b08800; --yellow-bg: #fff8c5;
  --red: #cb2431; --red-bg: #ffeef0;
  --grey: #6a737d; --grey-bg: #f6f8fa;
  --blue: #0366d6; --border: #e1e4e8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
       font-size: 14px; color: #24292e; background: #fff; }
.header { background: #24292e; color: #fff; padding: 12px 24px; display: flex; align-items: center; gap: 16px; }
.header h1 { font-size: 18px; font-weight: 600; }
.header .stat { font-size: 12px; color: #959da5; }
.header .mode { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.mode-live { background: var(--green); color: #fff; }
.mode-static { background: var(--grey); color: #fff; }
.tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 24px; background: var(--grey-bg); }
.tab { padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; font-weight: 500; color: var(--grey); }
.tab:hover { color: #24292e; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.panel { display: none; padding: 16px 24px; }
.panel.active { display: block; }
.controls { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.controls input[type=text] { padding: 5px 10px; border: 1px solid var(--border); border-radius: 4px; width: 250px; }
.controls select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 4px; }
.controls label { font-size: 12px; color: var(--grey); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border); cursor: pointer;
     user-select: none; white-space: nowrap; background: var(--grey-bg); position: sticky; top: 0; z-index: 1; }
th:hover { background: #e8eaed; }
th .arrow { font-size: 10px; margin-left: 4px; }
td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr.conf-high { background: var(--green-bg); }
tr.conf-med { background: var(--yellow-bg); }
tr.conf-low { background: var(--red-bg); }
tr.conf-none { }
tr.flagged td:first-child { border-left: 3px solid var(--red); }
tr.qs-verified { opacity: 0.6; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.badge { display: inline-block; padding: 1px 6px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-grey { background: var(--grey-bg); color: var(--grey); }
.progress-bar { background: #e1e4e8; border-radius: 4px; height: 20px; overflow: hidden; width: 200px; display: inline-block; vertical-align: middle; }
.progress-fill { height: 100%; background: var(--green); transition: width 0.3s; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--grey-bg); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.stat-card h3 { font-size: 13px; color: var(--grey); margin-bottom: 4px; }
.stat-card .val { font-size: 24px; font-weight: 700; }
.stat-card .sub { font-size: 12px; color: var(--grey); margin-top: 4px; }
.decade-chart { display: flex; align-items: flex-end; gap: 2px; height: 100px; margin-top: 16px; }
.decade-bar { background: var(--blue); min-width: 24px; text-align: center; border-radius: 2px 2px 0 0;
              position: relative; cursor: default; }
.decade-bar .lbl { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%);
                   font-size: 10px; color: var(--grey); white-space: nowrap; }
.decade-bar .cnt { position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
                   font-size: 10px; color: var(--grey); }
.concert-row, .work-row { cursor: pointer; }
.concert-row:hover, .work-row:hover { background: #f1f8ff; }
.concert-detail, .work-detail { display: none; }
.concert-detail.open, .work-detail.open { display: table-row; }
.concert-detail td, .work-detail td { padding: 8px 10px 8px 32px; background: #fafbfc; }
.perf-table { width: 100%; font-size: 12px; }
.perf-table td { padding: 3px 8px; border: none; border-bottom: 1px solid #eee; }
.programme-table { width: 100%; font-size: 12px; }
.programme-table td { padding: 3px 8px; border: none; border-bottom: 1px solid #eee; }
.match-ok { color: var(--green); }
.match-miss { color: var(--red); }
.count { color: var(--grey); font-size: 12px; margin-left: 8px; }
.table-wrap { max-height: 75vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 4px; }
/* Action buttons */
.act-btn { border: none; background: none; cursor: pointer; padding: 2px 4px; border-radius: 3px; font-size: 14px; }
.act-btn:hover { background: #e1e4e8; }
.move-to-notes-btn, .rematch-works-btn, .delete-btn { font-size: 11px !important; color: #666; border: 1px solid #ccc !important; margin-left: 6px; }
.move-to-notes-btn:hover { background: #fff3cd !important; border-color: #f0ad4e !important; color: #856404; }
.rematch-works-btn:hover { background: #d4edda !important; border-color: #28a745 !important; color: #155724; }
.delete-btn:hover { background: var(--red-bg) !important; border-color: var(--red) !important; color: var(--red); }
.act-btn.active { background: var(--green-bg); }
.act-btns { white-space: nowrap; }
.qs-select { font-size: 11px; padding: 1px 4px; border: 1px solid var(--border); border-radius: 3px; }
.qid-edit { font-size: 12px; width: 90px; padding: 1px 4px; border: 1px solid var(--blue); border-radius: 3px; }
.comp-edit { font-size: 12px; width: 160px; padding: 1px 4px; border: 1px solid var(--blue); border-radius: 3px; }
/* Toast */
#toast { position: fixed; bottom: 24px; right: 24px; background: #24292e; color: #fff; padding: 10px 20px;
         border-radius: 6px; font-size: 13px; opacity: 0; transition: opacity 0.3s; z-index: 100; pointer-events: none; }
#toast.show { opacity: 1; }
/* Auth */
.auth-btn { background: #fff; color: #24292e; border: 1px solid #959da5; border-radius: 4px;
            padding: 4px 12px; cursor: pointer; font-size: 12px; font-weight: 600; margin-left: auto; }
.auth-btn:hover { background: #f6f8fa; }
#loading { text-align: center; padding: 60px 24px; color: var(--grey); font-size: 16px; }
