/* ============================================================
   INVESTRA - CSV buttons, watchlist, glossary, report actions (features.css, Round 16)
   Tokens only (both themes). Linked immediately before responsive.css.
   ============================================================ */
/* CSV */
.tbl-tools { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.section-head > .sh-right { margin-left: auto; min-width: 0; }
@media (max-width: 1023.98px) { .section-head { flex-wrap: wrap; } }
@media (pointer: coarse), (max-width: 1023.98px) { .csv-btn { min-height: 44px; padding: 0 12px; font-size: 12px; } }

/* watchlist star */
.wl-star { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; margin-left: 4px; border: 0; background: none; cursor: pointer; vertical-align: middle; color: var(--text-muted); }
.wl-star::after { content: ""; position: absolute; inset: -9px; }
.wl-star svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.wl-star-md svg { width: 18px; height: 18px; }
.wl-star.on { color: var(--gold); }
.wl-star.on svg { fill: var(--gold); stroke: var(--gold); animation: wlPop .18s ease-out; }
.wl-star:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
@keyframes wlPop { 50% { transform: scale(1.25); } }
@media (prefers-reduced-motion: reduce) { .wl-star.on svg { animation: none; } }
@media (hover: hover) and (pointer: fine) {
  td .wl-star:not(.on) { opacity: 0; }
  tr:hover td .wl-star:not(.on), td .wl-star:focus-visible { opacity: .6; }
}
@media (hover: none), (pointer: coarse) { td .wl-star:not(.on) { opacity: .55; } .wl-star::after { inset: -11px; } }

/* report action chips (Watch, Download PDF) */
.rp .rp-chip.rp-act { cursor: pointer; font-family: var(--font-sans, inherit); font-weight: 600; color: var(--text); background: var(--bg-input); }
.rp .rp-chip.rp-act:hover { border-color: var(--gold); color: var(--gold); }
.rp .rp-chip.rp-act[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); background: var(--gold-dim); }
.rp .rp-chip.rp-act svg { width: 12px; height: 12px; }
@media (pointer: coarse), (max-width: 1023.98px) { .rp .rp-chip.rp-act { min-height: 44px; padding: 0 12px; } }
.rp-print-head, .rp-print-foot { display: none; }

/* CHAKRAVYUH card + star */
.ck-card-wrap { position: relative; display: flex; }
.ck-card-wrap > .ck-card { flex: 1; min-width: 0; }
.ck-card-wrap > .wl-star { position: absolute; right: 10px; bottom: 10px; }

/* toast */
.wl-toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); z-index: 1150; max-width: min(92vw, 420px); display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--bg-card); color: var(--text); border: 1px solid var(--border-gold, var(--border)); box-shadow: 0 12px 30px var(--glass-shadow, rgba(0,0,0,.35)); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.wl-toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.wl-undo { flex: none; min-height: 40px; padding: 0 12px; border: 0; background: none; color: var(--gold); font-weight: 700; cursor: pointer; }

/* home strip */
.wl-strip { display: flex; flex-direction: column; gap: 10px; }
.wl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wl-n { font-family: var(--font-mono); font-size: 12px; color: var(--gold); background: var(--gold-dim); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
.wl-clear, .wl-more, .wl-hint-x { background: none; border: 0; color: var(--text-muted); font-size: 12.5px; font-weight: 600; cursor: pointer; min-height: 36px; padding: 0 6px; }
.wl-clear:hover, .wl-more:hover { color: var(--gold); }
.wl-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 1px dashed var(--border); border-radius: 12px; font-size: 12.5px; color: var(--text-sub); }
.wl-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.wl-cardwrap { position: relative; min-width: 0; }
.wl-card { display: flex; flex-direction: column; gap: 6px; min-height: 118px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text); text-decoration: none; }
.wl-card:hover { border-color: var(--border-gold, var(--gold)); }
.wl-l1 { display: flex; align-items: center; gap: 8px; min-width: 0; padding-right: 26px; }
.wl-l1 b { font-family: var(--font-mono); font-size: 13px; }
.wl-l1 span { font-size: 12px; color: var(--text-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wl-l2, .wl-l3, .wl-l4 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--text-sub); }
.wl-l4 { font-family: var(--font-mono); color: var(--text); }
.wl-src, .wl-since { font-family: var(--font-sans, inherit); color: var(--text-muted); font-size: 11px; }
.wl-up { color: var(--teal); } .wl-dn { color: var(--coral); }
.wl-x { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--text-muted); font-size: 17px; cursor: pointer; }
.wl-x:hover { color: var(--coral); }
.wl-note { font-size: 11px; color: var(--text-muted); }
@media (min-width: 600px) and (max-width: 1023.98px) { .wl-row { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
@media (max-width: 599.98px) {
  .wl-row { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .wl-cardwrap { flex: 0 0 min(78vw, 280px); scroll-snap-align: start; }
}

/* glossary terms + popover / sheet */
.gl { text-decoration: underline dotted 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--gold) 65%, transparent); cursor: help; }
.gl:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 3px; }
.gl-pop { position: fixed; z-index: 1150; width: min(300px, calc(100vw - 24px)); padding: 12px 40px 12px 14px; border-radius: 12px; background: var(--bg-card); color: var(--text); border: 1px solid var(--border-strong, var(--border)); box-shadow: 0 14px 34px var(--glass-shadow, rgba(0,0,0,.35)); font-size: 13px; line-height: 1.5; }
.gl-pop[hidden] { display: none; }
.gl-pop-t { display: block; font-size: 13px; margin-bottom: 4px; color: var(--gold); }
.gl-pop-d { margin: 0 0 6px; color: var(--text-sub); }
.gl-pop-more { font-size: 12px; color: var(--gold); font-weight: 600; }
.gl-pop-x { position: absolute; top: 4px; right: 4px; width: 40px; height: 40px; border: 0; background: none; color: var(--text-muted); font-size: 18px; cursor: pointer; }
.gl-pop.sheet { left: 12px !important; right: 12px; top: auto !important; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); width: auto; font-size: 12.5px; }
@media (pointer: coarse) { th .sort-icon { display: inline-flex; min-width: 28px; min-height: 28px; align-items: center; justify-content: center; } }
.gx-tip-wl { margin-top: 6px; font-size: 11.5px; color: var(--text-muted); }
.gx-tip-wl.on { color: var(--gold); }
.wl-l2 .grade-chip { display: inline-block; min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 6px; font-family: var(--font-mono); font-size: 11px; font-weight: 800; color: #fff; }

/* touch targets below 1024 / on touch (R16 WP-14): 44 px boxes, or a 44 px hit area around inline terms */
@media (pointer: coarse), (max-width: 1023.98px) {
  .wl-clear, .wl-more, .wl-hint-x { min-height: 44px; padding: 0 10px; }
  .wl-x { width: 44px; height: 44px; top: 2px; right: 2px; }
  .wl-l1 { padding-right: 40px; }
  .gl { position: relative; }
  .gl::after { content: ""; position: absolute; inset: -15px -4px; }
}
