/* ============================================================
   Karhoosh v6 — unified visual layer (1405-08-08)
   Loaded LAST in <head>. Brand colors are taken from the logo
   (navy → royal blue, cyan accent). Font: Yekan Bakh (licensed
   for karhooshai.com, defined in karhoosh-font.css).
   Rollback: remove the <link> to this file in includes/header.php
   ============================================================ */
:root{
  --kh-bg:#F5F6F8;
  --kh-surface:#FFFFFF;
  --kh-ink:#0E1B3D;
  --kh-ink-2:#4A5675;
  --kh-ink-3:#5E6884;
  --kh-line:rgba(14,27,61,.09);
  --kh-line-2:rgba(14,27,61,.16);
  --kh-blue:#0A4FD1;
  --kh-blue-hover:#083FAA;
  --kh-blue-soft:#EAF1FE;
  --kh-navy:#071A4A;
  --kh-cyan:#12B9C8;
  --kh-cyan-soft:#E6F8FA;
  --kh-cyan-ink:#06606A;
  --kh-r-lg:24px;--kh-r-md:16px;--kh-r-sm:12px;
  --kh-shadow:0 1px 2px rgba(14,27,61,.04),0 12px 32px -18px rgba(14,27,61,.22);
}

/* ---------- base ---------- */
html{scroll-behavior:smooth}
html body.kh-shell{background:var(--kh-bg)!important;color:var(--kh-ink)!important;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}
html body.kh-shell main{min-height:50vh}
html body.kh-shell :where(h1,h2,h3,h4){color:var(--kh-ink);letter-spacing:0;text-shadow:none}
html body.kh-shell :where(p,li){color:var(--kh-ink-2)}
html body.kh-shell a{color:var(--kh-blue)}
html body.kh-shell :focus-visible{outline:3px solid rgba(10,79,209,.35)!important;outline-offset:2px}
html body.kh-shell ::selection{background:var(--kh-blue-soft)}

/* ---------- header ---------- */
html body.kh-shell .site-header{position:sticky!important;top:0;z-index:50;background:rgba(255,255,255,.97)!important;-webkit-backdrop-filter:none!important;backdrop-filter:none!important;border-bottom:1px solid var(--kh-line)!important;box-shadow:none!important}
html body.kh-shell .site-header .nav{min-height:64px!important;max-width:1200px!important;margin:0 auto!important;padding:0 24px!important;gap:24px}
/* logo: the PNG has wide empty margins — show only the mark */
html body.kh-shell .site-header .brand{display:block!important;position:relative!important;overflow:hidden!important;width:120px!important;height:36px!important;flex:0 0 auto;padding:0!important;margin:0!important;background:none!important}
html body.kh-shell .site-header .brand img{position:absolute!important;max-width:none!important;max-height:none!important;min-height:0!important;object-fit:fill!important;width:153.2px!important;height:76.6px!important;top:-19.3px!important;left:-17.5px!important;right:auto!important;margin:0!important;filter:none!important}
html body.kh-shell .desktop-nav{gap:4px!important}
html body.kh-shell .desktop-nav>a,html body.kh-shell .desktop-nav summary{color:var(--kh-ink)!important;font-size:14.5px!important;font-weight:500!important;padding:8px 12px!important;border-radius:10px!important;background:none!important;border:0!important;opacity:.86}
html body.kh-shell .desktop-nav>a:hover,html body.kh-shell .desktop-nav summary:hover{opacity:1;background:rgba(14,27,61,.05)!important}
html body.kh-shell .kh-dropdown-panel{background:#fff!important;border:1px solid var(--kh-line)!important;border-radius:var(--kh-r-md)!important;box-shadow:var(--kh-shadow)!important;padding:8px!important}
html body.kh-shell .kh-dropdown-panel a{color:var(--kh-ink)!important;border-radius:10px!important;font-size:14px!important}
html body.kh-shell .kh-dropdown-panel a:hover{background:var(--kh-bg)!important}
html body.kh-shell .apple-actions summary{color:var(--kh-ink)!important;background:none!important;border:1px solid var(--kh-line-2)!important;border-radius:999px!important;font-size:14px!important;padding:7px 14px!important}
html body.kh-shell .apple-link{color:var(--kh-ink)!important;font-size:14.5px!important;font-weight:500!important}
html body.kh-shell .apple-pill{background:var(--kh-blue)!important;color:#fff!important;border:0!important;border-radius:999px!important;padding:9px 18px!important;font-size:14px!important;font-weight:600!important;box-shadow:none!important}
html body.kh-shell .apple-pill:hover{background:var(--kh-blue-hover)!important}
/* logged-in: account dropdown already contains logout — hide the duplicate pill */
html body.kh-shell .apple-actions .kh-account-dropdown~.apple-pill{display:none!important}
html body.kh-shell .apple-menu-btn{background:transparent!important;border:1px solid var(--kh-line-2)!important;border-radius:12px!important;box-shadow:none!important;width:44px!important;height:44px!important}
html body.kh-shell .apple-menu-icon path{stroke:var(--kh-ink)!important}

/* ---------- market ticker ---------- */
html body.kh-shell #kh-market-ticker{background:#fff!important;border-bottom:1px solid var(--kh-line)!important;color:var(--kh-ink)!important;box-shadow:none!important;display:flex;align-items:center;flex-wrap:wrap;max-width:none}
html body.kh-shell #kh-market-ticker .kh-ticker-ribbon{flex:1 1 600px;min-width:0;background:transparent!important;border:0!important;min-height:40px!important;height:40px!important}
html body.kh-shell #kh-market-ticker .kh-ticker-label{background:var(--kh-cyan-soft)!important;color:var(--kh-cyan-ink)!important;border-radius:999px!important;padding:3px 12px!important;margin-inline:16px 8px!important;font-size:12.5px!important;font-weight:700!important;box-shadow:none!important;height:auto!important;align-self:center}
html body.kh-shell #kh-market-ticker .kh-ticker-track,html body.kh-shell #kh-market-ticker .kh-ticker-track *{color:var(--kh-ink-2)!important;font-size:13px!important}
html body.kh-shell #kh-market-ticker .kh-ticker-track :where(b,strong){color:var(--kh-ink)!important;font-weight:700!important}
html body.kh-shell #kh-market-ticker .kh-ticker-pause{background:transparent!important;color:var(--kh-ink-3)!important;border:0!important;width:40px!important;height:40px!important}
html body.kh-shell #kh-market-ticker .kh-ticker-meta{flex:0 0 auto;background:transparent!important;border:0!important;padding:0 16px!important;display:flex!important;gap:10px;align-items:center;min-height:40px}
html body.kh-shell #kh-market-ticker .kh-ticker-meta,html body.kh-shell #kh-market-ticker .kh-ticker-meta *{color:var(--kh-ink-3)!important;font-size:12px!important}
html body.kh-shell #kh-market-ticker .kh-ticker-window{-webkit-mask-image:linear-gradient(90deg,transparent,#000 32px,#000 calc(100% - 32px),transparent);mask-image:linear-gradient(90deg,transparent,#000 32px,#000 calc(100% - 32px),transparent)}

/* ---------- shared components ---------- */
html body.kh-shell .container{max-width:1200px!important;padding-inline:24px!important}
html body.kh-shell .section{padding-block:64px!important}
html body.kh-shell :where(.btn,.kh-action,.mini-btn,.kh-result-primary,.kc-next){font-weight:600!important;border-radius:999px!important;transition:background .15s,border-color .15s,color .15s;box-shadow:none!important;text-shadow:none!important}
html body.kh-shell :where(.btn.primary,.kh-action:not(.kh-action-outline),.kc-next,.kh-result-primary,.mini-btn.primary){background:var(--kh-blue)!important;color:#fff!important;border:1px solid var(--kh-blue)!important}
html body.kh-shell :where(.btn.primary,.kh-action:not(.kh-action-outline),.kc-next,.kh-result-primary,.mini-btn.primary):hover{background:var(--kh-blue-hover)!important;border-color:var(--kh-blue-hover)!important}
html body.kh-shell :where(.btn.secondary,.btn:not(.primary),.kh-action-outline,.mini-btn:not(.primary)){background:#fff!important;color:var(--kh-ink)!important;border:1px solid var(--kh-line-2)!important}
html body.kh-shell :where(.btn,.kh-action,.kc-next,.kh-result-primary){min-height:46px;padding-inline:22px!important}
html body.kh-shell :where(.form-card,.dash-card,.my-assistant-card,.kh-plan,.kc-sample-card,.auth-card .form-card,.kh-asset-panel,.kh-pnl-record,.kh-current,.ticket-list>*){background:var(--kh-surface)!important;border:1px solid var(--kh-line)!important;border-radius:var(--kh-r-lg)!important;box-shadow:var(--kh-shadow)!important}
html body.kh-shell :where(input[type=text],input[type=email],input[type=password],input[type=number],input[type=tel],input:not([type]),select,textarea){border:1px solid var(--kh-line-2)!important;border-radius:var(--kh-r-sm)!important;background:#fff!important;color:var(--kh-ink)!important;min-height:46px;box-shadow:none!important}
html body.kh-shell :where(input,select,textarea):focus{border-color:var(--kh-blue)!important;box-shadow:0 0 0 4px rgba(10,79,209,.12)!important;outline:none!important}
html body.kh-shell :where(.eyebrow,.kh-eyebrow,.kh-result-eyebrow){display:inline-block;background:var(--kh-cyan-soft)!important;color:var(--kh-cyan-ink)!important;border:0!important;border-radius:999px!important;padding:4px 12px!important;font-size:13px!important;font-weight:600!important;letter-spacing:0!important}
html body.kh-shell :where(.status-badge){border-radius:999px!important}
html body.kh-shell .error-box,html body.kh-shell .kc-error{border-radius:var(--kh-r-sm)!important}

/* page titles on inner pages */
html body.kh-shell main :where(.section,.kh-subscription,.kh-sub-checkout) h1{font-size:clamp(30px,4vw,44px)!important;font-weight:800!important;line-height:1.4!important;color:var(--kh-ink)!important}

/* ---------- homepage ---------- */
html body.kh-shell.kc-home .kc-page{background:transparent!important}
html body.kh-shell.kc-home .kc-hero{max-width:1200px!important;margin:0 auto!important;padding:80px 24px 64px!important;display:grid!important;grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr)!important;gap:56px!important;align-items:center!important;background:transparent!important}
html body.kh-shell.kc-home .kc-start{background:transparent!important;border:0!important;box-shadow:none!important;padding:0!important;text-align:right!important}
html body.kh-shell.kc-home .kc-start .kh-eyebrow{margin:0 0 18px!important}
html body.kh-shell.kc-home .kc-start h1.kh-portfolio-title{font-size:clamp(36px,5vw,60px)!important;line-height:1.35!important;font-weight:800!important;color:var(--kh-ink)!important;margin:0 0 18px!important;text-align:right!important;text-wrap:balance}
html body.kh-shell.kc-home .kc-start h1.kh-portfolio-title em{font-style:normal;color:var(--kh-blue)}
html body.kh-shell.kc-home .kc-lead{font-size:clamp(17px,1.6vw,20px)!important;line-height:1.9!important;color:var(--kh-ink-2)!important;margin:0 0 28px!important;max-width:540px;text-align:right!important}
html body.kh-shell.kc-home .kc-form{background:var(--kh-surface)!important;border:1px solid var(--kh-line)!important;border-radius:var(--kh-r-lg)!important;box-shadow:var(--kh-shadow)!important;padding:24px!important;max-width:580px}
html body.kh-shell.kc-home .kc-form fieldset{border:0!important;padding:0!important;margin:0!important;background:none!important}
html body.kh-shell.kc-home .kc-form legend{font-size:17px!important;font-weight:700!important;color:var(--kh-ink)!important;margin-bottom:12px!important;display:flex;align-items:center;gap:10px}
html body.kh-shell.kc-home .kc-form legend span{width:28px;height:28px;border-radius:999px;background:var(--kh-blue-soft)!important;color:var(--kh-blue)!important;display:inline-flex!important;align-items:center;justify-content:center;font-size:14px!important;border:0!important}
html body.kh-shell.kc-home .kc-input{border:1px solid var(--kh-line-2)!important;border-radius:var(--kh-r-md)!important;background:#fff!important;min-height:56px;overflow:hidden;box-shadow:none!important}
html body.kh-shell.kc-home .kc-input:focus-within{border-color:var(--kh-blue)!important;box-shadow:0 0 0 4px rgba(10,79,209,.12)!important}
html body.kh-shell.kc-home .kc-input input{border:0!important;box-shadow:none!important;font-size:18px!important;min-height:54px}
html body.kh-shell.kc-home .kc-input b{color:var(--kh-ink-2)!important;background:var(--kh-bg)!important;border:0!important;font-weight:600!important}
html body.kh-shell.kc-home .kc-next{width:100%;min-height:54px!important;font-size:16px!important;margin-top:14px!important}
html body.kh-shell.kc-home .kc-hint{color:var(--kh-ink-3)!important;font-size:13.5px!important}
html body.kh-shell.kc-home .kc-choice span{border:1px solid var(--kh-line-2)!important;border-radius:var(--kh-r-md)!important;background:#fff!important;box-shadow:none!important}
html body.kh-shell.kc-home .kc-choice input:checked+span{border-color:var(--kh-blue)!important;background:var(--kh-blue-soft)!important;box-shadow:0 0 0 1px var(--kh-blue) inset!important}
html body.kh-shell.kc-home .kc-controls button[data-prev]{background:#fff!important;color:var(--kh-ink)!important;border:1px solid var(--kh-line-2)!important;border-radius:999px!important}
html body.kh-shell.kc-home .kc-sample-link{color:var(--kh-blue)!important;font-weight:600!important}
html body.kh-shell.kc-home .kc-free{text-align:center}
/* sample card */
html body.kh-shell.kc-home .kc-preview{background:transparent!important;border:0!important;box-shadow:none!important;padding:0!important}
html body.kh-shell.kc-home .kc-sample-card{padding:28px!important}
html body.kh-shell.kc-home .kc-sample-badge{background:var(--kh-cyan-soft)!important;color:var(--kh-cyan-ink)!important;border:0!important;border-radius:999px!important}
html body.kh-shell.kc-home .kc-sample-card h2{font-size:20px!important;color:var(--kh-ink)!important}
html body.kh-shell.kc-home .kc-sample-total{color:var(--kh-ink-2)!important}
html body.kh-shell.kc-home .kc-sample-rows li{border-color:var(--kh-line)!important}
html body.kh-shell.kc-home .kc-sample-rows strong{color:var(--kh-ink)!important;font-size:18px!important}
html body.kh-shell.kc-home .kc-dot.kc-fixed{background:var(--kh-blue)!important}
html body.kh-shell.kc-home .kc-dot.kc-gold{background:var(--kh-cyan)!important}
html body.kh-shell.kc-home .kc-dot.kc-cash{background:#A9B6D6!important}
html body.kh-shell.kc-home .kc-sample-note{color:var(--kh-ink-3)!important;font-size:13px!important}
html body.kh-shell.kc-home .kc-sample-meta>div{background:var(--kh-surface)!important;border:1px solid var(--kh-line)!important;border-radius:var(--kh-r-md)!important;box-shadow:none!important}
/* how it works */
html body.kh-shell.kc-home .kc-explain{max-width:1200px!important;margin:0 auto!important;padding:24px 24px 88px!important;background:transparent!important}
html body.kh-shell.kc-home .kc-explain>div{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:16px!important}
html body.kh-shell.kc-home .kc-explain article{background:var(--kh-surface)!important;border:1px solid var(--kh-line)!important;border-radius:var(--kh-r-lg)!important;padding:28px!important;box-shadow:none!important;counter-increment:khstep}
html body.kh-shell.kc-home .kc-explain>div{counter-reset:khstep}
html body.kh-shell.kc-home .kc-explain article::before{content:counter(khstep,persian);display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:12px;background:var(--kh-navy);color:#fff;font-weight:800;margin-bottom:16px}
html body.kh-shell.kc-home .kc-explain article b{display:block;font-size:19px!important;color:var(--kh-ink)!important;margin-bottom:6px}
html body.kh-shell.kc-home .kc-explain article p{color:var(--kh-ink-2)!important;margin:0!important}
html body.kh-shell.kc-home .kc-explain>.kc-hint{text-align:center!important;margin-top:24px!important}
html body.kh-shell.kc-home .kc-explain::before{content:"کارهوش چطور کمکت می‌کند؟";display:block;font-size:clamp(26px,3vw,34px);font-weight:800;color:var(--kh-ink);margin:0 0 24px}
/* result block */
html body.kh-shell.kc-home .kh-result{max-width:1200px;margin-inline:auto!important;background:var(--kh-surface)!important;border:1px solid var(--kh-line)!important;border-radius:28px!important;box-shadow:var(--kh-shadow)!important}

/* ---------- footer ---------- */
html body.kh-shell .kh-footer{background:#fff!important;border-top:1px solid var(--kh-line)!important;padding:0!important;color:var(--kh-ink-2)!important;margin-top:0!important;box-shadow:none!important}
html body.kh-shell .kh-footer .container{padding-block:48px 28px!important}
html body.kh-shell .kh-footer .v51-footer-grid{gap:32px!important}
html body.kh-shell .kh-footer .v51-footer-about img{display:block;height:96px!important;width:192px!important;max-height:none!important;max-width:none!important;object-fit:fill!important;margin:-24px -20px -26px -22px!important;background:none!important;padding:0!important;border-radius:0!important}
html body.kh-shell .kh-footer h4{color:var(--kh-ink)!important;font-size:14px!important;font-weight:700!important}
html body.kh-shell .kh-footer a{color:var(--kh-ink-2)!important;font-size:14px!important;text-decoration:none!important}
html body.kh-shell .kh-footer a:hover{color:var(--kh-blue)!important}
html body.kh-shell .kh-footer p{color:var(--kh-ink-3)!important;font-size:13.5px!important}
html body.kh-shell .kh-footer .v51-footer-bottom{border-top:1px solid var(--kh-line)!important;color:var(--kh-ink-3)!important;font-size:12.5px!important;background:none!important}
html body.kh-shell .kh-footer .v51-footer-bottom span{color:var(--kh-ink-3)!important}

/* ---------- responsive ---------- */
@media (max-width:900px){
  html body.kh-shell.kc-home .kc-hero{grid-template-columns:1fr!important;padding:40px 16px 40px!important;gap:32px!important}
  html body.kh-shell.kc-home .kc-explain{padding:8px 16px 56px!important}
  html body.kh-shell.kc-home .kc-explain>div{grid-template-columns:1fr!important}
  html body.kh-shell .container{padding-inline:16px!important}
  html body.kh-shell .site-header .nav{padding:0 16px!important}
  html body.kh-shell #kh-market-ticker .kh-ticker-meta{display:none!important}
}
@media (max-width:540px){
  html body.kh-shell.kc-home .kc-start h1.kh-portfolio-title{font-size:34px!important}
  html body.kh-shell.kc-home .kc-form{padding:18px!important}
  html body.kh-shell .section{padding-block:40px!important}
}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}

/* ---------- fixes v6.1 ---------- */
html body.kh-shell.kc-home .kc-form .kc-next,html body.kh-shell.kc-home .kc-form .kc-next:active,html body.kh-shell.kc-home .kc-form .kc-next:focus{background:var(--kh-blue)!important;background-image:none!important;border-color:var(--kh-blue)!important;color:#fff!important}
html body.kh-shell.kc-home .kc-form .kc-next:hover{background:var(--kh-blue-hover)!important}
html body.kh-shell.kc-home .kc-sample-meta b{color:var(--kh-ink)!important}
html body.kh-shell.kc-home .kc-sample-meta span{color:var(--kh-ink-3)!important}
html body.kh-shell.kc-home .kc-explain{border-top:0!important}

/* ---------- v6.2 — inner pages (dashboard, product, results) ---------- */
html body.kh-shell :is(.dashboard-page,.kh-dashboard-assets,.kh-pnl-summary,.kh-portfolios,.kh-saved-portfolio,.kh-field-heading,.kh-help-button,.kh-pnl-gain,.kh-account-extras,.kh-account-extras summary,.kh-saved-row,.kh-snapshot-heading,.kh-snapshot-metrics,.kh-snapshot-date,.kh-snapshot-groups,.dash-card,.kh-portfolio-list){color:var(--kh-ink)!important}
html body.kh-shell main :is(h1,h2,h3,h4){color:var(--kh-ink)!important;text-shadow:none!important}
html body.kh-shell :is(.kh-dashboard-assets,.kh-pnl-summary,.kh-saved-portfolio){background:var(--kh-surface)!important;border:1px solid var(--kh-line)!important;border-radius:var(--kh-r-lg)!important;box-shadow:var(--kh-shadow)!important}
html body.kh-shell .kh-snapshot-bar{border-radius:999px!important;overflow:hidden;gap:3px}
html body.kh-shell .kh-snapshot-bar>:nth-child(4n+1),html body.kh-shell .kh-snapshot-groups>:nth-child(4n+1) i,html body.kh-shell.kc-home .kh-result-series-0{background:var(--kh-blue)!important}
html body.kh-shell .kh-snapshot-bar>:nth-child(4n+2),html body.kh-shell .kh-snapshot-groups>:nth-child(4n+2) i,html body.kh-shell.kc-home .kh-result-series-1{background:var(--kh-cyan)!important}
html body.kh-shell .kh-snapshot-bar>:nth-child(4n+3),html body.kh-shell .kh-snapshot-groups>:nth-child(4n+3) i,html body.kh-shell.kc-home .kh-result-series-2{background:#A9B6D6!important}
html body.kh-shell .kh-snapshot-bar>:nth-child(4n+4),html body.kh-shell .kh-snapshot-groups>:nth-child(4n+4) i,html body.kh-shell.kc-home .kh-result-series-3{background:var(--kh-navy)!important}
html body.kh-shell :is(.kh-snapshot-link,.dash-icon,.kh-saved-portfolio summary,.kh-portfolios summary){color:var(--kh-blue)!important}
html body.kh-shell .kh-capital-overview{background:var(--kh-navy)!important;border:0!important;border-radius:var(--kh-r-lg)!important;color:#fff!important}
html body.kh-shell .kh-capital-overview :is(h1,h2,h3,h4,strong,b,p,span){color:#fff!important}
html body.kh-shell .kh-capital-overview a{color:#7FE3EC!important}
html body.kh-shell .kh-sub-status{background:var(--kh-blue-soft)!important;color:var(--kh-ink)!important;border:0!important;border-radius:var(--kh-r-sm)!important}
html body.kh-shell .kh-live-offline{border-radius:var(--kh-r-sm)!important}
html body.kh-shell :is(.btn.primary,.kh-action:not(.kh-action-outline),.kh-result-primary,.mini-btn.primary){background:var(--kh-blue)!important;background-image:none!important;color:#fff!important;border:1px solid var(--kh-blue)!important;border-radius:999px!important;box-shadow:none!important}
html body.kh-shell :is(.btn.primary,.kh-action:not(.kh-action-outline),.kh-result-primary,.mini-btn.primary):hover{background:var(--kh-blue-hover)!important;border-color:var(--kh-blue-hover)!important}
html body.kh-shell :is(.btn.secondary,.btn:not(.primary),.kh-action-outline,.mini-btn:not(.primary)){background:#fff!important;background-image:none!important;color:var(--kh-ink)!important;border:1px solid var(--kh-line-2)!important;border-radius:999px!important;box-shadow:none!important}
html body.kh-shell :is(.form-card,.dash-card,.my-assistant-card,.kh-plan,.kh-asset-panel,.kh-pnl-record,.kh-current){border-color:var(--kh-line)!important;border-top-color:var(--kh-line)!important;border-radius:var(--kh-r-lg)!important}

/* ---------- v6.3 — account pages (login/register/dashboard) ---------- */
html body.kh-shell :is(.kh-auth,.kh-dashboard){background:transparent!important;color:var(--kh-ink)!important}
html body.kh-shell :is(.kh-auth,.kh-dashboard) h1{color:var(--kh-ink)!important;font-weight:800!important}
html body.kh-shell .kh-auth .auth-card{background:var(--kh-surface)!important;border:1px solid var(--kh-line)!important;border-radius:28px!important;box-shadow:var(--kh-shadow)!important;padding:36px!important}
html body.kh-shell .kh-auth label{color:var(--kh-ink)!important}
html body.kh-shell .kh-auth input:not([type=hidden]):not([type=checkbox]):not([type=radio]){border:1px solid var(--kh-line-2)!important;border-radius:var(--kh-r-sm)!important;color:var(--kh-ink)!important}
html body.kh-shell :is(.kh-auth,.kh-dashboard) .btn.primary{background:var(--kh-blue)!important;border-color:var(--kh-blue)!important;color:#fff!important;border-radius:999px!important}
html body.kh-shell :is(.kh-auth,.kh-dashboard) .btn.primary:hover{background:var(--kh-blue-hover)!important;border-color:var(--kh-blue-hover)!important}
html body.kh-shell .kh-dashboard :is(.btn.secondary,.mini-btn:not(.primary)){background:#fff!important;color:var(--kh-ink)!important;border:1px solid var(--kh-line-2)!important;border-radius:999px!important}
html body.kh-shell .kh-auth .success-box{background:var(--kh-cyan-soft)!important;color:var(--kh-cyan-ink)!important;border:0!important;border-radius:var(--kh-r-sm)!important}
html body.kh-shell .kh-dashboard .dash-card strong{color:var(--kh-ink)!important}

/* ---------- v6.4 — header pill (logged out), auth details ---------- */
html body.kh-shell .site-header .apple-actions .apple-pill{background:var(--kh-blue)!important;background-image:none!important;color:#fff!important;border:0!important;border-radius:999px!important}
html body.kh-shell .site-header .apple-actions .apple-pill:hover{background:var(--kh-blue-hover)!important}
html body.kh-shell .kh-auth .auth-card .form-card{border:0!important;box-shadow:none!important;padding:0!important;background:transparent!important}
html body.kh-shell .kh-auth a:not(.btn){color:var(--kh-blue)!important}

/* ---------- v6.5 — advisor pages (advice.php, admin-advice.php) ---------- */
html body.kh-shell .kha .container{max-width:960px!important}
html body.kh-shell .kha-head{margin-bottom:24px}
html body.kh-shell .kha-head h1{margin:12px 0 6px!important}
html body.kh-shell .kha-muted{color:var(--kh-ink-3)!important}
html body.kh-shell .kha-note{background:var(--kh-blue-soft);color:var(--kh-ink);border-radius:var(--kh-r-sm);padding:12px 16px;margin:0 0 16px}
html body.kh-shell .kha-error{background:#FDECEC;color:#8A1C1C}
html body.kh-shell .kha-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin:0 0 16px}
html body.kh-shell .kha-stat{background:var(--kh-surface);border:1px solid var(--kh-line);border-radius:var(--kh-r-lg);padding:18px 20px;display:flex;flex-direction:column;gap:4px}
html body.kh-shell .kha-stat span{color:var(--kh-ink-3);font-size:14px}
html body.kh-shell .kha-stat strong{font-size:26px;font-weight:800;color:var(--kh-ink);font-variant-numeric:tabular-nums}
html body.kh-shell .kha-stat strong small{font-size:13px;font-weight:500;color:var(--kh-ink-3)}
html body.kh-shell .kha-stat>small{color:var(--kh-ink-3);font-size:12.5px}
html body.kh-shell .kha-up,html body.kh-shell .kha-up strong{color:#0B7A43!important}
html body.kh-shell .kha-down,html body.kh-shell .kha-down strong{color:#B42318!important}
html body.kh-shell .kha-card{background:var(--kh-surface);border:1px solid var(--kh-line);border-radius:var(--kh-r-lg);box-shadow:var(--kh-shadow);padding:24px;margin:0 0 16px}
html body.kh-shell .kha-card h2{font-size:20px!important;margin:0 0 12px!important}
html body.kh-shell .kha-card-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;margin:0 0 12px}
html body.kh-shell .kha-card-head h2{margin:0!important}
html body.kh-shell .kha-profile fieldset{border:0;padding:0;margin:0 0 16px}
html body.kh-shell .kha-profile legend{font-weight:700;color:var(--kh-ink);margin-bottom:10px}
html body.kh-shell .kha-pills{display:flex;flex-wrap:wrap;gap:8px}
html body.kh-shell .kha-pills label{cursor:pointer}
html body.kh-shell .kha-pills input{position:absolute;opacity:0;pointer-events:none}
html body.kh-shell .kha-pills span{display:inline-flex;align-items:center;min-height:44px;padding:0 18px;border:1px solid var(--kh-line-2);border-radius:999px;background:#fff;color:var(--kh-ink);font-size:15px}
html body.kh-shell .kha-pills input:checked+span{background:var(--kh-blue);border-color:var(--kh-blue);color:#fff}
html body.kh-shell .kha-pills input:focus-visible+span{outline:3px solid rgba(10,79,209,.35);outline-offset:2px}
html body.kh-shell .kha-field{display:grid;gap:6px;margin:0 0 16px;font-weight:600;color:var(--kh-ink)}
html body.kh-shell .kha-field :is(input,textarea){width:100%;padding:10px 14px;font:inherit;font-weight:400}
html body.kh-shell .kha-profile-line{color:var(--kh-ink-2);margin:0 0 16px;font-size:14.5px}
html body.kh-shell .kha-advice-top{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8px;margin-bottom:10px;font-size:13.5px}
html body.kh-shell .kha-date{color:var(--kh-ink-3)}
html body.kh-shell .kha-approved{background:var(--kh-cyan-soft);color:var(--kh-cyan-ink);border-radius:999px;padding:2px 12px;font-weight:600}
html body.kh-shell .kha-advice h2{font-size:22px!important;line-height:1.6!important}
html body.kh-shell .kha-view{color:var(--kh-ink-2);line-height:2;margin:0 0 16px}
html body.kh-shell .kha-actions{list-style:none;padding:0;margin:0 0 16px;display:grid;gap:10px}
html body.kh-shell .kha-act{border:1px solid var(--kh-line);border-radius:var(--kh-r-md);padding:14px 16px;background:#FBFCFE}
html body.kh-shell .kha-act-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px}
html body.kh-shell .kha-act-head b{font-size:16.5px;color:var(--kh-ink)}
html body.kh-shell .kha-act p{margin:0 0 4px;color:var(--kh-ink-2);line-height:1.9}
html body.kh-shell .kha-act small{color:var(--kh-ink-3);font-size:12.5px}
html body.kh-shell .kha-chip{border-radius:999px;padding:3px 12px;font-size:13.5px;font-weight:700;background:#EEF1F6;color:var(--kh-ink)}
html body.kh-shell .kha-act-buy .kha-chip,html body.kh-shell .kha-act-increase .kha-chip{background:#E3F5EA;color:#0B6B3A}
html body.kh-shell .kha-act-sell .kha-chip,html body.kh-shell .kha-act-reduce .kha-chip{background:#FDECEC;color:#9B1C1C}
html body.kh-shell .kha-watch h3{font-size:15px!important;margin:0 0 6px!important}
html body.kh-shell .kha-watch ul{margin:0 0 12px;padding-inline-start:20px;color:var(--kh-ink-2)}
html body.kh-shell .kha-sources{font-size:13px;color:var(--kh-ink-3)}
html body.kh-shell .kha-disclaimer{font-size:12.5px;color:var(--kh-ink-3);border-top:1px solid var(--kh-line);padding-top:12px;margin:12px 0 0;line-height:1.9}
html body.kh-shell .kha-locked{text-align:center}
html body.kh-shell .kha-bar{display:flex;height:12px;border-radius:999px;overflow:hidden;gap:3px;margin:4px 0 10px}
html body.kh-shell .kha-s0{background:var(--kh-blue)}html body.kh-shell .kha-s1{background:var(--kh-cyan)}html body.kh-shell .kha-s2{background:#A9B6D6}html body.kh-shell .kha-s3{background:var(--kh-navy)}html body.kh-shell .kha-s4{background:#6FA8F5}
html body.kh-shell .kha-legend{list-style:none;padding:0;margin:0 0 14px;display:flex;flex-wrap:wrap;gap:6px 18px;font-size:13.5px;color:var(--kh-ink-2)}
html body.kh-shell .kha-legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-inline-end:6px}
html body.kh-shell .kha-table-wrap{overflow-x:auto}
html body.kh-shell .kha-table{width:100%;border-collapse:collapse;font-size:14.5px}
html body.kh-shell .kha-table th{text-align:right;color:var(--kh-ink-3);font-weight:600;font-size:13px;padding:8px 10px;border-bottom:1px solid var(--kh-line)}
html body.kh-shell .kha-table td{padding:12px 10px;border-bottom:1px solid var(--kh-line);vertical-align:top;color:var(--kh-ink);font-variant-numeric:tabular-nums}
html body.kh-shell .kha-table td small{display:block;color:var(--kh-ink-3);font-size:12.5px}
html body.kh-shell .kha-old{border-top:1px solid var(--kh-line);padding:10px 0}
html body.kh-shell .kha-old summary{cursor:pointer;color:var(--kh-ink)}
html body.kh-shell .kha-old summary span{color:var(--kh-ink-3);margin-inline-end:8px}
html body.kh-shell .kha-old ul{color:var(--kh-ink-2);font-size:14px;line-height:1.9}
html body.kh-shell .kha-remove{display:inline-flex;gap:6px;align-items:center;font-size:13px;color:#9B1C1C;margin-top:6px}
html body.kh-shell .kha-buttons{display:flex;flex-wrap:wrap;gap:10px}
@media (max-width:540px){html body.kh-shell .kha-card{padding:18px}html body.kh-shell .kha-stat strong{font-size:22px}}

/* ---------- v6.6 — keep ticker inside the viewport ---------- */
html body.kh-shell #kh-market-ticker{overflow:hidden!important;max-width:100vw}
html body.kh-shell #kh-market-ticker .kh-ticker-ribbon{display:flex!important;align-items:center;max-width:100%;min-width:0;overflow:hidden}
html body.kh-shell #kh-market-ticker .kh-ticker-window{flex:1 1 auto;min-width:0;overflow:hidden!important}
html body.kh-shell .kha-pills label{position:relative}
html body.kh-shell .kha-pills input{width:1px!important;height:1px!important;min-height:0!important;margin:0!important;padding:0!important;inset:50% auto auto 50%}
html body.kh-shell .kha-remove{white-space:nowrap}
html body.kh-shell .kha-remove input{width:18px!important;height:18px!important;min-height:0!important;margin:0!important;padding:0!important;flex:0 0 auto}

/* ---------- v6.7 — new-advice badge, email preference ---------- */
html body.kh-shell .kha-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:#E5484D;margin-inline-start:6px;vertical-align:middle;box-shadow:0 0 0 2px #fff}
html body.kh-shell .kha-mail-pref{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;background:var(--kh-bg);border-radius:var(--kh-r-sm);padding:10px 14px;margin:14px 0 0;font-size:14px;color:var(--kh-ink-2)}
html body.kh-shell .kha-mail-pref .btn{min-height:40px!important;padding-inline:16px!important;font-size:13.5px!important}

/* ---------- v6.8 — advice scorecard ---------- */
html body.kh-shell .khs-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin:0 0 16px}
html body.kh-shell .khs-stat{background:var(--kh-bg);border-radius:var(--kh-r-md);padding:14px 16px;display:flex;flex-direction:column;gap:2px}
html body.kh-shell .khs-stat span{color:var(--kh-ink-3);font-size:13.5px}
html body.kh-shell .khs-stat strong{font-size:28px;font-weight:800;color:var(--kh-ink)}
html body.kh-shell .khs-stat small{color:var(--kh-ink-3);font-size:12.5px}
html body.kh-shell .khs-table td small{display:block}
html body.kh-shell .khs-pct{text-align:right;white-space:nowrap}
html body.kh-shell .khs-chip{display:inline-block;border-radius:999px;padding:2px 10px;font-size:12.5px;font-weight:700;background:#EEF1F6;color:var(--kh-ink-2);white-space:nowrap}
html body.kh-shell .khs-correct{background:#E3F5EA;color:#0B6B3A}
html body.kh-shell .khs-wrong{background:#FDECEC;color:#9B1C1C}
html body.kh-shell .khs-pending{background:var(--kh-blue-soft);color:var(--kh-blue)}
@media (max-width:600px){html body.kh-shell .khs-stats{grid-template-columns:1fr 1fr;gap:8px}html body.kh-shell .khs-stat{padding:10px 12px}html body.kh-shell .khs-stat strong{font-size:22px}html body.kh-shell .khs-table thead{display:none}html body.kh-shell .khs-table,html body.kh-shell .khs-table tbody{display:block}html body.kh-shell .khs-table tr{display:grid;grid-template-columns:1fr auto;gap:4px 12px;padding:12px 0;border-bottom:1px solid var(--kh-line)}html body.kh-shell .khs-table td{border:0!important;padding:0!important}html body.kh-shell .khs-table td:nth-child(1){order:0;grid-column:1/-1;color:var(--kh-ink-3);font-size:12.5px}html body.kh-shell .khs-table td:nth-child(2){order:1}html body.kh-shell .khs-table td:nth-child(5){order:2;text-align:left}html body.kh-shell .khs-table td:nth-child(3){order:3;color:var(--kh-ink-2)}html body.kh-shell .khs-table td:nth-child(4){order:4;text-align:left}}

/* ---------- v6.9 — portfolio health, rebalancing, timeline ---------- */
html body.kh-shell .khr h3{font-size:16px!important;margin:18px 0 10px!important}
html body.kh-shell .khr-health{list-style:none;padding:0;margin:0 0 6px;display:grid;gap:8px}
html body.kh-shell .khr-health li{display:flex;gap:10px;align-items:flex-start;padding:10px 12px;border-radius:var(--kh-r-sm);background:var(--kh-bg);color:var(--kh-ink-2);font-size:14.5px;line-height:1.8}
html body.kh-shell .khr-health li span{flex:0 0 22px;height:22px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:800;margin-top:3px}
html body.kh-shell .khr-health .khr-ok span{background:#E3F5EA;color:#0B6B3A}
html body.kh-shell .khr-health .khr-warn span{background:#FFF1DB;color:#8A5300}
html body.kh-shell .khr-rows{display:grid;gap:12px}
html body.kh-shell .khr-row-head{display:flex;justify-content:space-between;gap:8px;font-size:14.5px;margin-bottom:6px}
html body.kh-shell .khr-row-head b{color:var(--kh-ink)}
html body.kh-shell .khr-row-head small{color:var(--kh-ink-3)}
html body.kh-shell .khr-track{position:relative;height:10px;border-radius:999px;background:#E9EDF5;overflow:visible}
html body.kh-shell .khr-fill{position:absolute;inset-block:0;inset-inline-start:0;border-radius:999px;background:var(--kh-blue)}
html body.kh-shell .khr-off .khr-fill{background:#E08A00}
html body.kh-shell .khr-target{position:absolute;top:-4px;width:2px;height:18px;background:var(--kh-ink);border-radius:2px}
html body.kh-shell .khr-trade{margin:6px 0 0;font-size:13.5px;color:var(--kh-ink-2)}
html body.kh-shell .khr-status{margin:16px 0 8px;padding:10px 14px;border-radius:var(--kh-r-sm);font-size:14px;line-height:1.9}
html body.kh-shell .khr-status.khr-warn{background:#FFF6E8;color:#6B4200}
html body.kh-shell .khr-status.khr-ok{background:#E9F7EF;color:#0B5B32}
html body.kh-shell .khr-cash{margin-top:16px;display:grid;gap:8px;font-size:14.5px;color:var(--kh-ink)}
html body.kh-shell .khr-cash>div{display:flex;flex-wrap:wrap;gap:8px}
html body.kh-shell .khr-cash input{flex:1 1 200px;min-width:0;padding:10px 14px;font:inherit}
html body.kh-shell .khr-alloc{list-style:none;padding:0;margin:10px 0 0;display:grid;gap:6px}
html body.kh-shell .khr-alloc li{display:flex;justify-content:space-between;padding:8px 12px;background:var(--kh-blue-soft);border-radius:var(--kh-r-sm);color:var(--kh-ink)}
html body.kh-shell .khr-svg{width:100%;height:auto;display:block;margin:4px 0}
html body.kh-shell .khr-axis{stroke:var(--kh-line-2);stroke-width:1}
html body.kh-shell .khr-line-port{fill:none;stroke:var(--kh-blue);stroke-width:3;stroke-linejoin:round;stroke-linecap:round}
html body.kh-shell .khr-line-gold{fill:none;stroke:#C9A24E;stroke-width:2.5;stroke-dasharray:6 5;stroke-linejoin:round}
html body.kh-shell .khr-legend{list-style:none;padding:0;margin:6px 0 0;display:flex;flex-wrap:wrap;gap:8px 20px;font-size:14px;color:var(--kh-ink-2)}
html body.kh-shell .khr-legend i{display:inline-block;width:18px;height:3px;border-radius:2px;margin-inline-end:6px;vertical-align:middle}
html body.kh-shell .khr-key-port{background:var(--kh-blue)}
html body.kh-shell .khr-key-gold{background:#C9A24E}

/* ---------- v6.10 — price alerts ---------- */
html body.kh-shell .khal-form{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;align-items:end}
html body.kh-shell .khal-form label{display:grid;gap:6px;font-size:13.5px;font-weight:600;color:var(--kh-ink)}
html body.kh-shell .khal-form :is(select,input){width:100%;min-height:46px;padding:0 12px;font:inherit;font-weight:400}
html body.kh-shell .khal-form .btn{min-height:46px}
html body.kh-shell .khal-list{list-style:none;padding:0;margin:16px 0 0;display:grid;gap:8px}
html body.kh-shell .khal-list li{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--kh-line);border-radius:var(--kh-r-md);background:#FBFCFE}
html body.kh-shell .khal-list li>div{display:grid;gap:2px;font-size:14px;color:var(--kh-ink-2)}
html body.kh-shell .khal-list li b{color:var(--kh-ink)}
html body.kh-shell .khal-list li small{color:var(--kh-ink-3);font-size:12.5px}
html body.kh-shell .khal-list .khal-triggered{background:#E9F7EF;border-color:#CDEBD9}
html body.kh-shell .khal-list .btn{min-height:38px!important;padding-inline:14px!important;font-size:13px!important}
/* v6.11 — UI/UX Pro Max checklist: contrast, focus, reduced motion, skip link, pointer */
html body.kh-shell :focus-visible{outline:2px solid #0A4FD1!important;outline-offset:2px}
html body.kh-shell .kha-pills input:focus-visible+span{outline:2px solid #0A4FD1!important;outline-offset:2px}
html body.kh-shell :where(button,[type=submit],[type=button],select,summary,label:has(>input[type=radio]),label:has(>input[type=checkbox])){cursor:pointer}
html body.kh-shell .kh-skip{position:absolute;top:-80px;right:16px;z-index:10000;background:var(--kh-navy);color:#fff!important;padding:10px 18px;border-radius:12px;font-weight:600;font-size:14px;text-decoration:none!important;transition:top .15s}
html body.kh-shell .kh-skip:focus{top:12px}
html body.kh-shell #kh-main:focus{outline:none!important}
@media (prefers-reduced-motion:reduce){html body.kh-shell *,html body.kh-shell *::before,html body.kh-shell *::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}html body.kh-shell #kh-market-ticker .kh-ticker-track{animation:none!important;transform:none!important}}
