/* BAZAD Operations 0.4.8: single source of truth for header/sidebar and AI landing.
   Loaded after existing CSS to isolate fixes from legacy feature styles. */
:root { --bazad-shell-header: 76px; --bazad-shell-sidebar: 252px; }
.top {
  display: flex; align-items:center; direction:rtl; height:var(--bazad-shell-header); min-height:var(--bazad-shell-header);
  padding-inline:clamp(12px,1.8vw,26px); gap:clamp(10px,1.3vw,22px);
  border-bottom:1px solid rgba(241,192,118,.13); box-shadow:0 2px 10px rgba(4,12,30,.07);
}
.top-primary { display:flex; align-items:center; gap:12px; min-width:0; flex:0 0 auto; }
.top-primary .menu-toggle { flex:0 0 40px; width:40px; height:40px; min-width:40px; min-height:40px; padding:7px; background:transparent; color:#fff; border:1px solid transparent; border-radius:9px; }
.top-primary .menu-toggle:hover { border-color:#6b7892; background:#1b2a49; }
.top .brand { min-width:0!important; display:flex; align-items:center; gap:0!important; flex:none; }
.top .brand .official-logo { width:67px; }
.top .top-product { display:flex; flex-direction:column; justify-content:center; align-items:flex-start; gap:3px; min-width:0; color:#fff; font:750 13px/1.3 Cairo,Arial,sans-serif; }
.top .top-product .product-short { display:none; }
.top .top-product .top-slogan { display:block; position:static; max-width:none; margin:0; white-space:nowrap; overflow:visible; font:600 10px/1.3 Cairo,Arial,sans-serif; color:#F1C076; letter-spacing:0; }
.top .global-search { flex:1 1 340px!important; width:auto!important; max-width:510px!important; min-width:160px!important; margin:0 auto!important; }
.top-ai-shortcut { flex:0 0 auto; min-height:38px; padding:7px 12px; display:inline-flex; align-items:center; justify-content:center; gap:6px; border:1px solid rgba(241,192,118,.58); border-radius:11px; text-decoration:none; color:#F1C076; font:750 12px/1.2 Cairo,Arial,sans-serif; white-space:nowrap; }
.top-ai-shortcut:hover { color:#fff; background:#223251; }
.top-ai-shortcut span:first-child { font-size:18px; }
.top .top-actions { display:flex; align-items:center; justify-content:flex-end; flex:0 0 auto; min-width:0; gap:9px; margin-inline-start:0!important; }
.top .top-actions .top-icon { display:grid!important; place-items:center; height:40px; min-width:40px; margin:0; }
.top .account-dropdown { margin:0; }
.top .account-dropdown>summary { min-height:44px; margin:0; gap:9px; padding:0; }
.top .identity { margin:0!important; max-width:200px; gap:8px; }
.top .identity>div { display:block; min-width:0; }
.top .identity strong { font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:115px; }
.top .identity small { font-size:10px; white-space:nowrap; }
.top .identity .avatar { width:38px; height:38px; flex:none; }
.top .account-dropdown-menu { inset-inline-end:0; }
.rail { top:var(--bazad-shell-header)!important; right:0; bottom:0; width:var(--bazad-shell-sidebar); padding:0 10px 23px; display:flex; flex-direction:column; overflow-y:auto; overscroll-behavior:contain; }
.workspace { margin-right:var(--bazad-shell-sidebar); }
.sidebar-context { flex:0 0 auto; position:sticky; top:0; z-index:2; display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:69px; padding:11px 11px 12px; margin-inline:-10px; padding-inline:22px 12px; background:#fff; border-bottom:1px solid #e5e9f0; }
.sidebar-context-content { min-width:0; display:flex; flex-direction:column; justify-content:center; gap:3px; }
.sidebar-context-eyebrow { font:700 10px/1.5 Cairo,Arial,sans-serif; color:#6e7786; }
.sidebar-context strong { margin:0; font:750 12px/1.55 Cairo,Arial,sans-serif; color:#0A142F; }
.sidebar-context #closeMenu { display:none; flex:none; border:1px solid #e1e7ef; background:white; color:#0A142F; min-width:38px; width:38px; height:38px; min-height:38px; padding:3px; border-radius:9px; }
.rail nav { flex:1 0 auto; padding:10px 0; }
.rail .nav-group { margin:2px 0; border:0; background:transparent; padding:0; }
.rail .nav-group summary { margin:0; padding:10px 12px; min-height:43px; border-radius:8px; font-size:13px; line-height:1.5; }
.rail .nav-group a { font-size:12px; padding:9px 10px; min-height:40px; line-height:1.5; }
.rail .sidebar-ai-entry { display:flex; align-items:center; gap:10px; min-height:64px; text-decoration:none; margin:4px 0 12px; border-radius:12px; background:#0a142f; color:white; padding:10px 12px; border:1px solid #cfa361; box-shadow:0 3px 12px rgba(10,20,47,.12); }
.rail .sidebar-ai-entry:hover { color:white; background:#162b53; }
.rail .sidebar-ai-entry[aria-current="page"] { background:#192d54; outline:2px solid #F1C076; outline-offset:-2px; }
.sidebar-ai-symbol { font-size:22px; flex:0 0 26px; text-align:center; color:#F1C076; }
.sidebar-ai-label { display:flex; flex-direction:column; gap:2px; min-width:0; }
.sidebar-ai-label strong { font-size:14px; line-height:1.3; direction:ltr; text-align:right; color:#fff; }
.sidebar-ai-label small { color:#eed1a2; font-size:11px; line-height:1.4; }
/* Structured new-conversation welcome replaces the large empty chat surface. */
.bazad-ai-welcome { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:8px; min-height:180px; padding:13px 8px; color:#1e344e; }
.bazad-ai-welcome-symbol { display:grid; place-items:center; width:44px; height:44px; flex:none; background:#0a142f; color:#F1C076; font-size:24px; border-radius:15px; margin-bottom:2px; }
.bazad-ai-welcome h3 { margin:0; font-size:16px; line-height:1.4; }
.bazad-ai-welcome p { margin:0; font-size:12px; line-height:1.7; color:#68788e; max-width:310px; }
.bazad-ai-welcome-actions { width:100%; display:grid; grid-template-columns:1fr; gap:6px; max-width:330px; margin-top:7px; }
.bazad-ai-welcome-actions button { display:block; width:100%; min-height:34px; font-size:11px; color:#2c435e; background:#fff; border:1px solid #dce4ed; border-radius:9px; text-align:center; padding:5px 9px; }
.bazad-ai-welcome-actions button:hover { color:#0a142f; border-color:#dbb879; background:#fff9ee; }
.bazad-ai-suggestions[hidden] { display:none!important; }
/* On /ai, dock the chat in the page instead of covering its KPIs and content. */
.ai-chat-dock { min-width:0; }
.ai-chat-dock[hidden] { display:none!important; }
.ai-chat-dock .bazad-ai-panel { position:relative; bottom:auto; left:auto; display:flex; width:100%; height:min(570px,72dvh); min-height:340px; max-width:none; margin:0; box-shadow:0 8px 28px rgba(10,20,47,.14); border-color:#ced9e5; }
.ai-chat-dock.bazad-ai-expanded .bazad-ai-panel { width:100%; height:min(750px,calc(100dvh - 125px)); }
.ai-chat-dock .bazad-ai-messages { padding:16px; }
.ai-chat-dock .bazad-ai-message { max-width:86%; font-size:13px; }
.ai-chat-dock .bazad-ai-head strong { font-size:16px; }
@media(max-width:600px) { .ai-chat-dock .bazad-ai-panel,.ai-chat-dock.bazad-ai-expanded .bazad-ai-panel { width:100%; height:min(520px,calc(100dvh - 100px)); min-height:250px; } .ai-chat-dock .bazad-ai-message {max-width:95%;} }
/* Independent AI page rather than a duplicate KPI dashboard. */
.ai-workspace-page { display:grid; gap:16px; }
.ai-landing-head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:18px; background:linear-gradient(115deg,#0a142f,#18345b); color:#fff; border:1px solid #314365; border-radius:16px; padding:22px clamp(17px,2.5vw,30px); }
.ai-kicker { display:inline-flex; align-items:center; gap:7px; font-size:12px; color:#F1C076; font-weight:700; }
.ai-landing-head h1 { font-size:clamp(25px,2.4vw,34px); color:#fff; line-height:1.4; margin:1px 0 3px; }
.ai-landing-head p { font-size:13px; color:#e0e8f3; margin:0; max-width:650px; }
.ai-start-button { color:#0a142f; background:#F1C076; font-weight:800; font-size:13px; padding-inline:19px; min-height:43px; }
.ai-start-button:hover { color:#0a142f; background:#f5d394; }
.ai-landing-grid { display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); gap:15px; }
.ai-ask-panel,.ai-summary-panel,.ai-followups-panel { border:1px solid #dce3eb; border-radius:15px; background:white; padding:20px; min-width:0; }
.ai-ask-panel h2,.ai-summary-panel h2,.ai-followups-panel h2 { margin:0 0 8px; font-size:18px; }
.ai-ask-panel p { margin:0 0 11px; font-size:12px; color:#54647d; }
.ai-quick-prompts { display:grid; gap:7px; }
.ai-quick-prompts button { display:flex; align-items:center; justify-content:space-between; padding:10px 12px; background:#f8fafc; color:#17304e; border:1px solid #e0e7ef; border-radius:9px; min-height:41px; text-align:start; font-size:12px; }
.ai-quick-prompts button:hover { color:#152741; background:#f9f1e5; border-color:#e4c996; }
.ai-quick-prompts button span { font-size:15px; color:#99703d; }
.ai-section-title { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; }
.ai-section-title>span { font-size:11px; color:#60718c; }
.ai-summary-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; margin:12px 0; }
.ai-summary-grid>div { padding:12px; border:1px solid #e1e7ee; border-radius:10px; display:flex; flex-direction:column; gap:5px; }
.ai-summary-grid span { font-size:12px; color:#586a81; }
.ai-summary-grid strong { font-size:27px; line-height:1.3; color:#0A142F; }
.ai-local-label { font-size:11px!important; line-height:1.7; color:#64758b!important; margin:10px 0 0!important; }
.ai-mode-links { display:flex; gap:7px; flex-wrap:wrap; margin:11px 0; }
.ai-mode-links a { display:inline-flex; align-items:center; min-height:36px; font-size:12px; text-decoration:none; padding:6px 12px; border:1px solid #dbe2ec; border-radius:22px; color:#2f465e; background:#f9fafc; font-weight:700; }
.ai-mode-links a.is-current { background:#0a142f; color:white; border-color:#0a142f; }
.ai-mode-summary { font-size:13px; margin:10px 0 15px; }
.ai-followup-list { background:#f8fafc; border-radius:11px; padding:12px 15px; display:grid; gap:9px; }
.ai-followup-list h3 { margin:0; font-size:14px; }
.ai-followup-list a { font-size:12px; }
.ai-explain-btn { margin-top:12px; font-size:12px; }
.ai-settings-panel { background:#fff; border:1px solid #dce3eb; border-radius:12px; margin:0; padding:0 18px; }
.ai-settings-panel>summary { margin:0; min-height:47px; display:flex; align-items:center; font-size:13px; color:#203650; }
.ai-settings-content { border-top:1px solid #edf0f4; padding:11px 0 17px; }
.ai-settings-content p { font-size:12px; color:#5b6b7f; }
@media(max-width:1250px){
  .top .top-product .top-slogan { display:none; }
  .top .global-search { max-width:400px!important; }
  .top .identity>div { display:none; }
}
@media(max-width:1000px){
  :root { --bazad-shell-header:66px; --bazad-shell-sidebar:252px; }
  .top { gap:8px; }
  .top-primary { gap:6px; }
  .top .brand .official-logo { width:65px; }
  .top .global-search { display:none!important; }
  .top .global-search.search-visible { display:flex!important; position:absolute; top:calc(100% - 1px); inset-inline:10px; max-width:none!important; min-width:0!important; width:auto!important; z-index:60; padding:5px 12px; }
  .top .top-search-button { display:inline-flex; }
  .top-ai-shortcut { padding-inline:10px; min-width:38px; }
  .top-ai-shortcut span:last-child { display:none; }
  .top .top-actions { margin-inline-start:0!important; }
  .top .identity .avatar { display:grid!important; }
  .rail { top:0!important; width:min(88vw,300px); max-width:300px; }
  .rail .sidebar-context #closeMenu { display:inline-flex; }
  .workspace { margin:0!important; }
  .ai-landing-grid { grid-template-columns:1fr; }
}
@media(max-width:600px){
  :root { --bazad-shell-header:62px; }
  .top { gap:5px; padding-inline:8px; }
  .top-primary { gap:3px; }
  .top-primary .menu-toggle { min-width:37px; width:37px; min-height:38px; height:38px; padding:5px; }
  .top .brand .official-logo { width:54px; }
  .top .top-product { display:none; }
  .top .top-actions { gap:2px; }
  .top .top-actions .top-icon { min-width:34px; height:37px; }
  .top .top-search-button { width:36px; min-width:36px; height:38px; min-height:38px; padding:5px; }
  .top-ai-shortcut { min-width:34px; height:37px; min-height:37px; padding:5px; border-radius:9px; }
  .top .identity .avatar { width:32px; height:32px; }
  .top .account-dropdown>summary { min-height:37px; }
  .ai-landing-head { align-items:stretch; }
  .ai-landing-head .ai-start-button { width:100%; }
  .ai-ask-panel,.ai-summary-panel,.ai-followups-panel { padding:14px; }
}
@media print { .top-ai-shortcut { display:none!important; } }
