:root{--bg:#f4f8f9;--card:#fff;--elevated:#eef3f6;--border:#dce5e9;--ink:#17263a;--muted:#6a7c90;--accent:#0c796f;--accent-bg:#d8f3e9;--amber:#b17c37;--red:#b44b58;--font:'IBM Plex Sans Arabic',system-ui,sans-serif;color-scheme:light}
:root[data-nabd-theme="dark"]{--bg:#0c151e;--card:#16232d;--elevated:#20303d;--border:#334552;--ink:#f3f6fa;--muted:#b1becb;--accent:#6ed5ba;--accent-bg:#204343;--amber:#eac181;--red:#f18e9c;color-scheme:dark}
*{box-sizing:border-box}body{margin:0;background:var(--bg);font:14px/1.7 var(--font);color:var(--ink)}[hidden]{display:none!important}button,select{font:inherit}a{text-decoration:none;color:inherit}button{cursor:pointer}button:focus-visible,select:focus-visible,a:focus-visible,summary:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.history-skip{position:fixed;top:-80px;inset-inline-start:10px;padding:9px 15px;background:var(--accent);color:var(--card);z-index:80}.history-skip:focus{top:9px}
.history-header{background:var(--card);border-bottom:1px solid var(--border);padding:11px max(18px,calc((100vw - 1260px)/2));display:flex;align-items:center;gap:18px;position:sticky;top:0;z-index:40}
.history-header img{width:115px;height:42px;object-fit:contain}
.history-links{display:flex;flex:1;justify-content:center;gap:9px}
.history-links a{padding:7px 11px;color:var(--muted);font-weight:600;border-radius:9px}
.history-links a:hover,.history-links a:focus-visible{background:var(--elevated);color:var(--accent)}
.history-actions{display:flex;align-items:center;gap:7px}
.history-actions button,.history-actions a{border:1px solid var(--border);background:var(--card);color:var(--ink);padding:6px 10px;min-height:36px;border-radius:9px;font-weight:700;font-size:12px}
.history-actions a{background:var(--accent);color:var(--card);border-color:var(--accent)}
:root[data-nabd-theme="dark"] .history-actions a{color:#092325}
.history-main{max-width:1260px;padding:28px 18px 60px;margin:0 auto}
.history-hero{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:22px}
.history-eyebrow{font:700 11px/1.5 ui-monospace,monospace;letter-spacing:1.7px;color:var(--amber)}
.history-hero h1{font-size:clamp(24px,3vw,35px);line-height:1.35;margin:5px 0 7px}
.history-hero p{font-size:13px;color:var(--muted);margin:0;max-width:700px}
.history-not-trades{font-size:11px;color:var(--muted);border:1px solid var(--border);border-radius:99px;padding:7px 13px;white-space:nowrap}
.history-filter-panel{background:var(--card);border:1px solid var(--border);border-radius:15px;display:flex;flex-wrap:wrap;align-items:end;gap:10px;padding:15px;margin-bottom:12px}
.history-filter-panel label{display:flex;flex:1;min-width:135px;flex-direction:column;gap:5px;font-size:12px;font-weight:700}
.history-filter-panel select{background:var(--elevated);border:1px solid var(--border);border-radius:9px;min-height:43px;padding:7px 10px;color:var(--ink);max-width:100%;width:100%}
#history-refresh{background:var(--accent);color:var(--card);border:none;border-radius:9px;min-height:43px;padding:9px 24px;font-weight:800}
:root[data-nabd-theme="dark"] #history-refresh{color:#092325}
.history-details{display:flex;flex-wrap:wrap;gap:7px 17px;color:var(--muted);font-size:11px;padding:6px 2px 13px}
.history-alert{background:var(--card);border:1px solid var(--border);padding:18px;border-radius:13px;color:var(--ink);margin-bottom:15px}
.history-alert a{font-weight:800;color:var(--accent);text-decoration:underline}
.history-timeline{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.history-entry{background:var(--card);border:1px solid var(--border);border-radius:14px;padding:14px 17px;min-width:0}
.history-entry-head{display:flex;justify-content:space-between;flex-wrap:wrap;align-items:center;gap:7px}
.history-entry-head strong{font-size:14px}.history-entry-head small{font:12px/1.45 ui-monospace,monospace;color:var(--muted);direction:ltr;unicode-bidi:isolate}
.history-entry-status{border-radius:7px;padding:3px 8px;background:var(--elevated);color:var(--muted);font-size:11px;font-weight:700}
.history-entry[data-status="READY"] .history-entry-status{background:var(--accent-bg);color:var(--accent)}
.history-entry[data-status="STALE"] .history-entry-status,.history-entry[data-status="NEWS_BLOCK"] .history-entry-status{color:var(--amber)}
.history-entry[data-status="BLOCKED"] .history-entry-status{color:var(--red)}
.history-entry-sub{color:var(--muted);font-size:11px;display:flex;flex-wrap:wrap;gap:6px 15px;margin-top:4px}
.history-entry-score{color:var(--accent);font-weight:700}
.history-entry-reason{font-size:13px;margin:12px 0 0;min-height:37px;overflow-wrap:anywhere}
.history-entry details{border-top:1px solid var(--border);margin-top:11px;padding-top:10px}
.history-entry summary{cursor:pointer;font-size:11px;font-weight:700;color:var(--accent)}
.history-checks{padding:8px 0 0;display:grid;gap:4px}
.history-check{font-size:11px;display:flex;align-items:flex-start;gap:7px;color:var(--muted)}
.history-check[data-pass="true"] .history-check-icon{color:var(--accent)}.history-check[data-pass="false"] .history-check-icon{color:var(--red)}
.history-check-icon{font-weight:800;min-width:14px}
.history-skeleton{height:145px;border-radius:14px;border:1px solid var(--border);background:linear-gradient(100deg,var(--card),var(--elevated),var(--card));background-size:200% 100%;animation:history-pulse 1.6s linear infinite}
@keyframes history-pulse{to{background-position:-200% 0}}
.history-paging{text-align:center;margin-top:15px}
#history-more{border:1px solid var(--border);color:var(--accent);font-weight:750;background:var(--card);border-radius:9px;min-height:44px;padding:8px 20px}
.history-disclosure{border-top:1px solid var(--border);padding-top:18px;margin-top:28px;color:var(--muted);font-size:11px}
.history-disclosure p{margin:4px 0}
@media(max-width:750px){
 .history-header{flex-wrap:wrap;padding:9px 12px;gap:8px}.history-header img{width:87px;height:35px}
 .history-links{order:3;width:100%;justify-content:space-around;gap:2px}
 .history-links a{font-size:11px;padding:7px 5px}
 .history-actions{margin-inline-start:auto}
 .history-main{padding:16px 11px 40px}.history-hero{align-items:start;flex-direction:column;gap:8px}
 .history-not-trades{white-space:normal}
 .history-filter-panel{gap:8px;padding:10px}.history-filter-panel label{min-width:calc(50% - 6px)}
 #history-refresh{flex:1 1 100%}
 .history-timeline{grid-template-columns:1fr}
}
@media(prefers-reduced-motion:reduce){.history-skeleton{animation:none}}


/* Phase 8 history controls: searchable, exportable, chart contextual links. */
.history-search-label{flex:1 1 190px;min-width:min(190px,100%)}
.history-search-label input{display:block;width:100%;min-width:0;border:1px solid var(--border);border-radius:9px;background:var(--card);color:var(--ink);padding:9px 11px;font:inherit;font-size:13px;outline-offset:2px}
.history-search-label input:focus-visible{outline:2px solid var(--accent);border-color:var(--accent)}
#history-export{border:1px solid var(--border);border-radius:9px;background:var(--card);color:var(--accent);font-weight:700;min-height:39px;padding:7px 12px}
#history-export:disabled{opacity:.65;cursor:progress}
.history-chart-link{display:inline-flex;align-items:center;justify-content:center;gap:5px;align-self:flex-start;width:fit-content;margin-top:7px;padding:5px 11px;border:1px solid var(--border);border-radius:8px;font-size:12px;font-weight:700;color:var(--accent);background:var(--elevated)}
.history-chart-link:hover{border-color:var(--accent)}
@media(max-width:650px){
 .history-search-label{flex-basis:100%}
 #history-export{flex:1}
 .history-chart-link{font-size:11px}
}

/* Verified recommendation linkage: never shown as an executed trade by default. */
.history-recommendation{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:10px;padding-top:9px;border-top:1px dashed var(--border);color:var(--muted);font-size:11px}
.history-recommendation small{font-family:ui-monospace,monospace;font-size:11px;direction:ltr;unicode-bidi:isolate}
.history-verify-execution{padding:6px 9px;border:1px solid var(--border);border-radius:8px;color:var(--accent);background:var(--card);font:inherit;font-size:11px;font-weight:700;cursor:pointer}
.history-verify-execution:disabled{opacity:.5;cursor:progress}
.history-execution-result{font-size:11px;line-height:1.4}
@media(max-width:650px){.history-recommendation{align-items:flex-start;gap:6px}.history-verify-execution{width:100%}}
