/* Kane's Wrath Rebuild workspace. Colour carries one meaning only: tiberium green
   is a published promotion, steel gray is unpublished, amber is a stale denominator.
   Every one of those also carries a word, so the page survives without colour. */
.rebuild-page{
  --page:#101114;--panel:#17181b;--raised:#1c1e23;
  --line:#2a2c31;--line-strong:#3a3e47;
  --ink:#e6e8eb;--ink-faint:#787f8b;--ink-mono:#b9c2cb;
  --published:#59d5a0;--published-dim:#3f7f67;--stale:#e2b473;
}
body.rebuild-page{height:100dvh;overflow:hidden;background:var(--page);font-family:Inter,system-ui,-apple-system,sans-serif;color:var(--ink)}
.rebuild-page::before,.rebuild-page::after{display:none}.rebuild-page .topbar{flex-shrink:0;background:#141517;backdrop-filter:none}.rebuild-page .topbar__tick{display:none}
.rebuild{height:calc(100dvh - var(--site-header-height, 46px));display:grid;grid-template-rows:auto auto minmax(0,1fr);padding:0;margin:0;max-width:none;font:13px/1.4 Inter,system-ui,sans-serif}
.rebuild button{font:12px Inter,system-ui,sans-serif;border:0;border-radius:5px;background:none;color:#b3b8c2;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:6px;padding:7px 9px}
.rebuild button:hover{background:#2a2d33;color:#f2f5f7}
.rebuild button:focus-visible,.rebuild input:focus-visible,.rebuild select:focus-visible,.rebuild canvas:focus-visible,.rebuild th:focus-visible{outline:2px solid #64d5a6;outline-offset:-2px}
.rebuild .icon-button{width:30px;height:30px;padding:7px;flex:none}
.ui-icon{width:16px;height:16px;display:block;filter:invert(1);opacity:.65;flex:none}.icon-button:hover .ui-icon{opacity:1}

/* Title bar ---------------------------------------------------------------- */
.workspace-bar{display:flex;align-items:center;gap:24px;padding:11px 24px;background:var(--panel);border-bottom:1px solid var(--line);min-width:0}
.workspace-title{flex:none;position:relative}
.workspace-title h1{font-family:inherit;font-size:17px;font-weight:600;letter-spacing:-.45px;line-height:1.3;margin:0}
.provenance{display:flex;align-items:center;gap:8px;margin-top:5px}
.checkpoint{color:var(--ink-faint);font:10px ui-monospace,monospace}
.freshness{font:10px Inter,system-ui,sans-serif!important;padding:2px 8px!important;border-radius:11px!important;border:1px solid #34373e!important;color:#8b939e!important;white-space:nowrap}
.freshness::before{content:'\2022';margin-right:5px;font-size:11px}
.freshness.current{color:#86cdab!important;border-color:#2f4a3c!important;background:#1b2823}
/* The stale state is a triangle and a sentence as well as amber. */
.freshness.behind{color:var(--stale)!important;border-color:#4e3f2a!important;background:#2a2318}
.freshness.behind::before{content:'\25B2';font-size:8px;vertical-align:1px}
.map-search{position:relative;display:flex;align-items:center;gap:9px;margin-left:auto;width:330px;min-width:160px;background:#202227;border:1px solid #303239;border-radius:7px;padding:0 11px;height:36px}
.map-search input{font:12px Inter,system-ui,sans-serif;width:100%;min-width:0;background:none;border:0;color:#dfe3e8;outline:0;padding:0}
.map-search input::placeholder{color:#858993}.map-search:focus-within{border-color:#6c9385}
.map-search kbd{font:10px ui-monospace,monospace;color:var(--ink-faint);border:1px solid #3a3d43;padding:1px 4px;border-radius:3px}
.live-status{font-size:10px;color:#8b939e;white-space:nowrap;flex:none}
.live-status::before{content:'';display:inline-block;width:5px;height:5px;margin-right:6px;vertical-align:2px;border-radius:50%;background:#727781}
.live-status.connected{color:#a0b4ac}.live-status.connected::before{background:var(--published)}

.provenance-panel{position:absolute;z-index:30;top:calc(100% + 9px);left:0;width:400px;max-width:calc(100vw - 32px);background:var(--raised);border:1px solid var(--line-strong);border-radius:8px;box-shadow:0 10px 34px #0009;padding:16px 17px}
.provenance-panel[hidden]{display:none}
.provenance-panel h2{font:500 12px/1.4 Inter,system-ui,sans-serif;color:#dfe4ea;margin:0 0 12px}
.provenance-panel dl{display:grid;grid-template-columns:136px minmax(0,1fr);gap:7px 12px;margin:0;font-size:11px}
.provenance-panel dt{color:var(--ink-faint)}
.provenance-panel dd{margin:0;color:var(--ink-mono);font:10px ui-monospace,monospace;overflow-wrap:anywhere}
.provenance-panel p{font:11px/1.55 Inter,system-ui,sans-serif;color:#8d949e;margin:13px 0 0}
.provenance-panel p#prov-lag{color:#d7b07b;background:#241f16;border:1px solid #453823;border-radius:6px;padding:9px 11px}
.provenance-panel p[hidden]{display:none}

/* Totals ------------------------------------------------------------------- */
.stat-strip{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));background:var(--panel);border-bottom:1px solid var(--line)}
.stat{display:flex;flex-direction:column;gap:3px;padding:13px 24px 15px;border-left:1px solid var(--line);min-width:0}
.stat:first-child{border-left:0}
.stat>span{font-size:10px;letter-spacing:.3px;text-transform:uppercase;color:#777e89}
.stat>strong{font-size:23px;line-height:1.15;font-weight:600;letter-spacing:-1px;color:var(--ink)}
.stat--primary>strong{color:var(--published)}
.stat>small{font:10px ui-monospace,monospace;color:#6f7883;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stat>small span{font:inherit;color:#8d96a0}
.progress-track{height:3px;background:#34383f;overflow:hidden;border-radius:3px;margin-top:6px}
.progress-track span{display:block;width:0;height:100%;background:var(--published)}
/* The second measure is deliberately quieter than the headline count. */
.byte-track span{background:var(--published-dim)}

/* Explorer ----------------------------------------------------------------- */
.explorer{position:relative;display:grid;grid-template-columns:238px minmax(0,1fr);min-height:0;overflow:hidden}
.explorer.sidebar-hidden{grid-template-columns:0 minmax(0,1fr)}
.categories{display:flex;flex-direction:column;background:var(--panel);border-right:1px solid var(--line);min-height:0;min-width:0;overflow:hidden}
.aside-heading{display:flex;align-items:center;justify-content:space-between;padding:15px 16px 11px;color:#8f949e;font-size:11px;font-weight:500;letter-spacing:.2px}
#status-filter,#sort-order{margin:0 12px 9px;padding:8px 10px;width:calc(100% - 24px);border:1px solid #32353d;border-radius:5px;background:#202227;color:#aeb5be;font:11px Inter,system-ui,sans-serif;outline:none}
#sort-order{margin-bottom:13px}
.all-category{justify-content:space-between!important;margin:0 9px 9px;border:1px solid transparent!important;padding:9px 10px!important;font-weight:500!important}
.all-category small{font:10px ui-monospace,monospace;color:#7e8995}
.all-category.active{background:#26392f!important;border-color:#304d3f!important;color:#91e3bc!important}
#category-list{overflow-y:auto;min-height:0;flex:1;padding:0 9px 12px;scrollbar-width:thin;scrollbar-color:#383b42 transparent;overscroll-behavior:contain}
.rebuild .category{display:block;width:100%;text-align:left;padding:9px 10px;margin:2px 0;border:1px solid transparent}
.category-top{display:flex;justify-content:space-between;align-items:center;gap:9px}
.category-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}
.category-top small{font:10px ui-monospace,monospace;color:#6f7883}
.rebuild .category.active{background:#222f29;border-color:#30483a;color:#a5dfbf}.category.active small{color:#79b895}
.category-bar{height:2px;background:#2e3138;border-radius:2px;margin-top:7px;overflow:hidden}
.category-bar span{display:block;height:100%;background:#477a63}
.category-foot{display:flex;justify-content:space-between;gap:9px;margin-top:6px}
.category-foot small{font:9px ui-monospace,monospace;color:#646c77}.category.active .category-foot small{color:#7e9c8c}
.sidebar-summary{flex:none;display:grid;gap:8px;padding:14px 18px;background:#191a1e;border-top:1px solid var(--line);font-size:10px;color:#858d98}
.sidebar-summary>span{display:flex;align-items:center;gap:7px}
.sidebar-summary strong{margin-left:auto;font:10px ui-monospace,monospace;color:#a3acb6}
.sidebar-summary i{width:6px;height:6px;border-radius:2px}
.sidebar-summary>small{color:#656c76;font-size:9px;line-height:1.45;padding-top:3px;border-top:1px solid #23252a}
.green{background:var(--published)}.gray{background:#46515e}.bytes{background:var(--published-dim)}

/* Workspace: a view bar over the map or the table -------------------------- */
.workspace{grid-column:2;display:grid;grid-template-rows:auto minmax(0,1fr);min-width:0;min-height:0;overflow:hidden}
.view-bar{display:flex;align-items:center;gap:10px;padding:8px 14px;background:#141619;border-bottom:1px solid var(--line);min-width:0}
.segmented{display:flex;gap:2px;padding:2px;background:#1e2126;border:1px solid #2e3139;border-radius:7px;flex:none}
.segmented button{padding:5px 13px!important;border-radius:5px!important;font-size:11px!important;color:#919aa4}
.segmented button.active{background:#2b3a33;color:#9fe0c0}
.field{display:flex;align-items:center;gap:7px;font-size:11px;color:var(--ink-faint);flex:none}
.field select{border:1px solid #2e3139;border-radius:5px;background:#1e2126;color:#aeb5be;font:11px Inter,system-ui,sans-serif;padding:5px 8px;outline:none}
#open-sidebar{display:none}.sidebar-hidden #open-sidebar{display:flex}
#map-home{margin-left:auto;font-size:11px!important;color:#9aa3ad}
#current-category{font-size:11px;color:#93dab7;background:#1e2a24;border:1px solid #2c4034;border-radius:5px;padding:5px 10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:220px;flex:none}
#current-category[hidden]{display:none}

.map-panel{position:relative;min-width:0;min-height:0;overflow:hidden;background:var(--page)}
.map-panel[hidden]{display:none}
#function-map{display:block;width:100%;height:100%;touch-action:none;cursor:grab;outline:none}#function-map:active{cursor:grabbing}
.map-controls{position:absolute;bottom:18px;left:18px;display:flex;align-items:center;gap:5px;border:1px solid #34373e;border-radius:8px;background:var(--raised);box-shadow:0 4px 16px #0004;padding:5px}
.map-controls output{font:11px ui-monospace,monospace;text-align:center;min-width:45px;color:#a7afb9}
.control-divider{height:18px;width:1px;background:#353940;margin:0 4px}
.gesture-hint{position:absolute;bottom:33px;left:50%;transform:translateX(-50%);font-size:10px;color:#5e6570;pointer-events:none;white-space:nowrap}
.gesture-hint span{margin:0 8px}
#minimap{position:absolute;right:18px;bottom:18px;width:160px;height:100px;border:1px solid #32353b;border-radius:7px;background:#17191eee;cursor:crosshair;box-shadow:0 4px 16px #0004}
.map-message{position:absolute;inset:0;display:grid;place-items:center;color:#8c959f;background:#101114e8;font-size:12px;pointer-events:none}.map-message[hidden]{display:none}
.map-tooltip{position:absolute;z-index:3;max-width:310px;padding:9px 11px;background:#24272eee;border:1px solid #3e444e;border-radius:6px;box-shadow:0 5px 20px #0007;pointer-events:none;font-size:11px}
.map-tooltip strong{display:block;overflow-wrap:anywhere;color:#e5ecea;font-weight:500}
.map-tooltip span{display:block;margin-top:4px;color:#8a969f;font:10px ui-monospace,monospace}
.function-detail{position:absolute;right:18px;top:16px;width:300px;max-width:calc(100% - 36px);background:var(--raised);border:1px solid var(--line-strong);border-radius:8px;box-shadow:0 8px 32px #0006;padding:17px;z-index:4}
.function-detail[hidden]{display:none}
.detail-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:9px}
#detail-status{font-size:10px;font-weight:500;color:#76d9aa}#detail-status.pending{color:#939ba7}
.function-detail h2{font:500 14px/1.5 ui-monospace,monospace;color:#e6eee9;overflow-wrap:anywhere;margin:0 0 20px}
.function-detail dl{display:grid;grid-template-columns:96px minmax(0,1fr);gap:9px 12px;font-size:11px;margin:0}
.function-detail dt{color:var(--ink-faint)}
.function-detail dd{color:var(--ink-mono);margin:0;overflow-wrap:anywhere;font:11px ui-monospace,monospace}

/* Table view --------------------------------------------------------------- */
.table-panel{overflow:auto;min-height:0;background:var(--page);scrollbar-width:thin;scrollbar-color:#383b42 transparent}
.table-panel[hidden]{display:none}
.subsystem-table{width:100%;border-collapse:collapse;font-size:12px}
.subsystem-table th,.subsystem-table td{padding:10px 16px;text-align:left;border-bottom:1px solid #212429;white-space:nowrap}
.subsystem-table thead th{position:sticky;top:0;z-index:2;background:#16181c;color:#8d949e;font:500 10px Inter,system-ui,sans-serif;letter-spacing:.35px;text-transform:uppercase;cursor:pointer;user-select:none;border-bottom:1px solid var(--line)}
.subsystem-table thead th:hover{color:#cfd6dd}
.subsystem-table thead th[aria-sort]{color:#9fe0c0}
.subsystem-table thead th[aria-sort]::after{content:'\25BC';font-size:7px;margin-left:6px;vertical-align:2px}
.subsystem-table thead th[aria-sort="ascending"]::after{content:'\25B2'}
.subsystem-table .numeric{text-align:right;font:11px ui-monospace,monospace;color:var(--ink-mono)}
.subsystem-table tbody tr{cursor:pointer}
.subsystem-table tbody tr:hover{background:#191c21}
.subsystem-table tbody tr.active{background:#1d2a24}
.subsystem-table tbody tr.active th{color:#a5dfbf}
.subsystem-table tbody th{font-weight:500;color:#d3d9df}
/* The subsystem name stays put while the measures scroll sideways. */
.subsystem-table th:first-child{position:sticky;left:0;z-index:1;background:var(--page)}
.subsystem-table thead th:first-child{z-index:3}
.subsystem-table tbody tr:hover th:first-child{background:#191c21}
.subsystem-table tbody tr.active th:first-child{background:#1d2a24}
.subsystem-table tfoot th:first-child{z-index:3;background:#16181c}
.subsystem-table tfoot th,.subsystem-table tfoot td{position:sticky;bottom:0;background:#16181c;border-top:1px solid var(--line);border-bottom:0;color:#aab2bb;font-weight:500}
.meter{display:flex;align-items:center;gap:9px;min-width:130px;max-width:190px}
.meter-track{flex:1;height:4px;background:#2e3138;border-radius:3px;overflow:hidden}
.meter-track span{display:block;height:100%;background:var(--published)}
.meter.byte .meter-track span{background:var(--published-dim)}
.meter small{font:10px ui-monospace,monospace;color:#8d96a0;width:38px;text-align:right}

#search-results{position:absolute;z-index:20;left:0;right:0;top:43px;max-height:390px;overflow:auto;background:#202228;border:1px solid #393d46;border-radius:7px;box-shadow:0 8px 28px #0008;padding:5px}
#search-results button{display:block;width:100%;text-align:left;padding:10px;font-size:11px;overflow-wrap:anywhere}
#search-results small{display:block;font:10px ui-monospace,monospace;color:#7e8995;margin-top:5px}
#search-results p{padding:10px;font-size:11px;color:#969fa9}

@media(max-width:1180px){
  .workspace-bar{gap:16px;padding:10px 18px}.stat{padding:12px 18px 14px}.stat>strong{font-size:20px}
  .gesture-hint{display:none}.map-search{width:260px}.workspace-title h1{font-size:15px}
}
@media(max-width:900px){
  .live-status{display:none}
  .stat-strip{grid-template-columns:repeat(2,minmax(0,1fr))}
  .stat:nth-child(3),.stat:nth-child(4){border-top:1px solid var(--line)}
  .stat:nth-child(3){border-left:0}
}
@media(max-width:720px){
  body.rebuild-page{--site-header-height:46px}
  .rebuild-page .topbar{height:46px;min-height:46px;flex-wrap:nowrap;padding:0 8px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}
  .rebuild-page .topbar::-webkit-scrollbar{display:none}
  .rebuild-page .topbar__meta,.rebuild-page .topbar__mark{display:none}
  .rebuild-page .topnav{flex:none}.rebuild-page .topnav a{white-space:nowrap}
  .workspace-bar{flex-wrap:wrap;gap:12px;padding:12px 16px}
  .stat{padding:9px 14px 11px}.stat>strong{font-size:18px}.stat>span{font-size:9px}.progress-track{margin-top:5px}
  .workspace-title{flex:1}.map-search{order:3;width:100%;height:34px;margin:0}
  .provenance-panel{width:calc(100vw - 32px);left:-4px}
  .explorer{grid-template-columns:0 minmax(0,1fr)}
  .categories{position:absolute;z-index:8;left:0;top:0;bottom:0;width:232px;box-shadow:10px 0 28px #0008;transform:translateX(-100%);transition:transform .16s ease}
  .explorer.mobile-sidebar-open .categories{transform:translateX(0)}
  #open-sidebar{display:flex;order:-1}
  .view-bar{padding:7px 10px;gap:7px}.field{display:none}
  .map-controls{left:12px;bottom:12px}#minimap{width:110px;height:69px;right:12px;bottom:12px}
  .function-detail{top:12px;right:12px;width:280px}
  #current-category{max-width:120px}.map-tooltip{max-width:260px}
  .subsystem-table th,.subsystem-table td{padding:9px 11px}
  .meter{min-width:100px}
}
