/* ===== IHSG Storm v2 Design Tokens & Stylesheet =====
 * Design: Pam (UI Spec v2)
 * Themes: A Terang (Default) & B Malam (User Toggle)
 * No Tailwind CDN, zero build step
 */

@import url('../fonts/fonts.css');

:root {
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Space Mono', ui-monospace, Menlo, monospace;
  --rail: 72px;
  --topH: 54px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --gut: 16px;
  --maxw: 640px;
  --pane: 0px;
}

/* THEME A: TERANG (Default: warm paper, deep teal) */
[data-theme="a"], :root:not([data-theme="b"]) {
  --bg: #f5f4ef;
  --card: #ffffff;
  --sunk: #e6e5dd;
  --thead-bg: #e8e7de;
  --ink: #15181d;
  --ink2: #374151;
  --ink3: #4b5563;
  --line: rgba(21, 24, 29, .10);
  --line2: rgba(21, 24, 29, .24);
  --sel: #e8f3f0;
  --hover: #f1f0ea;
  --accent: #0b6e5f;
  --on-accent: #ffffff;
  --accent-text: #0b6e5f;
  --up: #0a7a4f;
  --up-bg: #e1f2e8;
  --down: #c0233f;
  --down-bg: #fae6ea;
  --flat: #4b5563;
  --flat-bg: #e6e5dd;
  --warn: #8a5a00;
  --asing: #1f5fbf;
  --scrip: #64748b;
  --c0: #15181d;
  --c1: #0b6e5f;
  --c2: #1f5fbf;
  --c3: #b7791f;
  --c4: #9a3b5a;
  --c5: #7b8794;
  --c-rest: #dcdad0;
  --num: var(--font);
  --r: 12px;
  --r-s: 8px;
  --shadow: 0 12px 40px -12px rgba(21, 24, 29, .25);
  --scrim: rgba(21, 24, 29, .45);
}

/* THEME B: MALAM (Dark graphite, amber accent, mono digits) */
[data-theme="b"] {
  --bg: #0c1016;
  --card: #141a22;
  --sunk: #151c26;
  --thead-bg: #141b24;
  --ink: #e8ecf2;
  --ink2: #c5cee0;
  --ink3: #94a3b8;
  --line: rgba(232, 236, 242, .09);
  --line2: rgba(232, 236, 242, .22);
  --sel: #1b2431;
  --hover: #18202a;
  --accent: #e9b44c;
  --on-accent: #1a1305;
  --accent-text: #e9b44c;
  --up: #34d399;
  --up-bg: rgba(52, 211, 153, .12);
  --down: #ff7088;
  --down-bg: rgba(255, 112, 136, .12);
  --flat: #94a3b8;
  --flat-bg: #151c26;
  --warn: #e9b44c;
  --asing: #6cb0ff;
  --scrip: #94a3b8;
  --c0: #e8ecf2;
  --c1: #e9b44c;
  --c2: #6cb0ff;
  --c3: #34d399;
  --c4: #c792ff;
  --c5: #6b7685;
  --c-rest: #232b36;
  --num: var(--mono);
  --r: 10px;
  --r-s: 7px;
  --shadow: 0 20px 60px -10px rgba(0, 0, 0, .7);
  --scrim: rgba(0, 0, 0, .6);
}

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scrollbar-gutter: stable;
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 500 15px/1.5 var(--font);
  font-feature-settings: normal;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

button, select, input, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
  text-align: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
  border-radius: 4px;
}

[x-cloak] {
  display: none !important;
}

.num {
  font-variant-numeric: tabular-nums;
  font-family: var(--num);
}

.i {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.i.s {
  width: 16px;
  height: 16px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

kbd {
  font: 600 11px var(--mono);
  border: 1px solid var(--line2);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--ink3);
}

/* ===== Responsive Breakpoints ===== */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.shell {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--gut);
  padding-right: var(--gut);
}

@media(min-width: 768px) {
  :root {
    --gut: 24px;
    --maxw: 720px;
  }
}

@media(min-width: 1024px) {
  :root {
    --gut: 20px;
    --maxw: 1200px;
    --pane: 320px;
  }
  body {
    padding-left: var(--rail);
  }
}

@media(min-width: 1280px) {
  :root {
    --gut: 28px;
    --maxw: 1280px;
    --pane: 380px;
  }
}

@media(min-width: 1440px) {
  :root {
    --gut: 36px;
    --maxw: 1400px;
    --pane: 420px;
  }
}

@media(min-width: 1920px) {
  :root {
    --gut: 48px;
    --maxw: 1680px;
    --pane: 480px;
  }
}

/* Sticky Top Bar */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}

.top-in {
  height: var(--topH);
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  letter-spacing: -.02em;
}

.sbtn {
  flex: 1 1 0;
  min-width: 0;
  max-width: 520px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: var(--card);
  color: var(--ink3);
  font-size: 14px;
}

.sbtn:hover {
  border-color: var(--ink3);
}

.sbtn span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.sbtn kbd {
  margin-left: auto;
  display: none;
}

/* Mobile Top Brand Lockup */
.top-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
  min-height: 40px;
}

.top-brand .logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 11.5px;
  display: grid;
  place-items: center;
  letter-spacing: -0.02em;
}

.top-brand-text {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}

.top-brand-text b {
  font-weight: 800;
  color: var(--ink);
}

@media(min-width: 1024px) {
  .sbtn kbd {
    display: block;
  }
  .top-brand {
    display: none;
  }
  .top .logo {
    display: none;
  }
  .top .theme-btn {
    display: none !important;
  }
}

@media(max-width: 350px) {
  .top-brand-text {
    display: none;
  }
}

.sbtn-short { display: inline; }
.sbtn-long { display: none; }
@media(min-width: 560px) {
  .sbtn-short { display: none; }
  .sbtn-long { display: inline; }
}

.theme-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: var(--r-s);
  border: 1px solid var(--line2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink2);
  flex-shrink: 0;
}

.theme-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.pro {
  margin-left: 0;
  flex-shrink: 0;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 99px;
  border: 1px solid var(--line2);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
}

.pro:hover {
  background: var(--hover);
}

/* Navigation: Bottom bar (<1024px) & Left rail (>=1024px) */
.bnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--card);
  border-top: 1px solid var(--line);
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink3);
  min-height: 48px;
  position: relative;
}

.nb[aria-current="page"] {
  color: var(--ink);
}

.nb[aria-current="page"] .i {
  color: var(--accent-text);
}

.nb[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0;
  width: 28px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
}

.nb:hover {
  color: var(--ink);
}

.rail {
  display: none;
}

@media(min-width: 1024px) {
  .bnav {
    display: none;
  }
  .rail {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--rail);
    background: var(--card);
    border-right: 1px solid var(--line);
    padding: 14px 8px;
    z-index: 30;
  }
  .rail-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin: 4px auto 14px;
    text-decoration: none;
    padding: 4px 2px;
    border-radius: var(--r-s);
    transition: background 0.15s var(--ease);
    width: 100%;
    cursor: pointer;
  }
  .rail-brand:hover {
    background: var(--hover);
  }
  .rail-brand .logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 800;
    font-size: 13px;
    display: grid;
    place-items: center;
    letter-spacing: -0.02em;
    margin: 0;
  }
  .rail-brand-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.05;
    text-align: center;
  }
  .rail-brand-name {
    font-weight: 800;
    font-size: 11px;
    letter-spacing: -0.01em;
    color: var(--ink);
  }
  .rail-brand-sub {
    font-weight: 800;
    font-size: 10px;
    letter-spacing: 0.03em;
    color: var(--ink3);
    text-transform: uppercase;
  }
  .rail .nb {
    border-radius: var(--r);
    min-height: 56px;
  }
  .rail .nb:hover {
    background: var(--hover);
  }
  .rail .nb[aria-current="page"] {
    background: var(--sel);
  }
  .rail .nb[aria-current="page"]::before {
    top: 50%;
    left: -8px;
    width: 3px;
    height: 26px;
    margin-top: -13px;
    border-radius: 0 3px 3px 0;
  }
  .rail .rail-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
}

main {
  padding-bottom: 96px;
}

@media(min-width: 1024px) {
  main {
    padding-bottom: 32px;
  }
}

/* Freshness indicator */
.fresh {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 0;
  font-size: 12px;
  color: var(--ink3);
}

.fresh .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  flex-shrink: 0;
}

.fresh button {
  margin-left: 4px;
  font-weight: 700;
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 28px;
  white-space: nowrap;
}

@media(max-width: 560px) {
  .fresh {
    align-items: flex-start;
    line-height: 1.4;
  }
  .fresh .dot {
    margin-top: 5px;
  }
}

/* Master-Detail Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media(min-width: 1200px) {
  .layout.has-pane {
    grid-template-columns: minmax(0, 1fr) var(--pane);
    column-gap: 24px;
    row-gap: 0;
    align-items: start;
  }
  .col {
    min-width: 0;
    grid-column: 1;
    grid-row: 1;
  }
  .layout.has-pane .pane {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: calc(var(--topH) + 12px);
    height: calc(100vh - var(--topH) - 24px);
    max-height: calc(100vh - var(--topH) - 24px);
    margin-top: 0;
    background: var(--card);
    border: 1px solid var(--line2);
    border-radius: var(--r);
    box-shadow: 0 4px 20px -2px rgba(21, 24, 29, 0.08);
    overflow: hidden;
  }
}

[data-theme="b"] .layout.has-pane .pane {
  box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.5);
}

.pane-wrap,
.layout.has-pane .pane > div:not(.pane-empty) {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.pane {
  display: none;
}

.pane-empty {
  margin: auto;
  padding: 32px 24px;
  text-align: center;
  color: var(--ink2);
  font-size: 14px;
  max-width: 280px;
}

.pane-empty .i {
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  color: var(--accent);
}

.pane-empty p {
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

.pane-empty .pane-hint {
  font-weight: 500;
  font-size: 12px;
  margin-top: 6px;
  color: var(--ink3);
}

/* Headings & Filter Tools */
.title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.title-wrap h1 {
  margin-top: 12px;
  margin-bottom: 0;
}

.tagline {
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--ink2);
  font-weight: 500;
  margin-top: 2px;
}

@media(min-width: 768px) {
  .tagline {
    font-size: 14px;
  }
}

h1 {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-top: 14px;
}

.sub {
  color: var(--ink3);
  font-size: 13px;
  margin-top: 2px;
}

@media(min-width: 1024px) {
  h1 {
    font-size: 26px;
    margin-top: 16px;
  }
}

.tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin: 10px 0 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  align-items: center;
}

.chip {
  flex-shrink: 0;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 99px;
  border: 1px solid var(--line2);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.chip[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.chip.lock-chip {
  border-style: dashed;
  color: var(--ink2);
}

.chip.lock-chip .i {
  color: var(--accent-text);
}

.sortsel {
  flex-shrink: 0;
  min-height: 36px;
  border: 1px solid var(--line2);
  border-radius: var(--r-s);
  background: var(--card);
  padding: 0 28px 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
  max-width: 200px;
  margin-left: auto;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23434a55' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

[data-theme="b"] .sortsel {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b4bcc8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

@media(max-width: 767px) {
  .tools {
    flex-wrap: wrap;
    gap: 8px;
  }
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    scroll-padding-inline: var(--gut);
    -webkit-overflow-scrolling: touch;
    width: calc(100% + (var(--gut) * 2));
    margin-inline: calc(var(--gut) * -1);
    padding-inline: var(--gut);
    padding-block: 4px;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
  .chips::-webkit-scrollbar {
    display: none;
  }
  .chip {
    scroll-snap-align: start;
    min-height: 44px;
    padding: 0 14px;
    font-size: 13px;
  }
  .sortsel {
    min-height: 44px;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-top: 6px;
    padding: 0 28px 0 12px;
  }
}

/* List with Container Queries */
.list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  container-type: inline-size;
}

.thead {
  display: none;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  padding: 12px 16px;
  min-height: 68px;
  width: 100%;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.row:last-child {
  border-bottom: 0;
}

.row:hover {
  background: var(--hover);
}

.row[aria-current="true"] {
  background: var(--sel);
}

.row[aria-current="true"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.row > * {
  min-width: 0;
}

.id {
  grid-row: 1/3;
}

.code {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -.01em;
  display: block;
}

.iss {
  color: var(--ink3);
  font-size: 13px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.px {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
  font-weight: 700;
  font-size: 15px;
}

.ch {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
}

.m3 {
  grid-column: 1/-1;
  font-size: 13px;
  color: var(--ink2);
  margin-top: 4px;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.holder-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.sub-hname {
  font-size: 11px;
  color: var(--ink3);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.cell {
  display: none;
}

.chg {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
  font-family: var(--num);
}

.chg.up {
  color: var(--up);
  background: var(--up-bg);
}

.chg.down {
  color: var(--down);
  background: var(--down-bg);
}

.chg.flat {
  color: var(--flat);
  background: var(--flat-bg);
}

.tag {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--sunk);
  color: var(--ink2);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.tag.l {
  color: var(--up);
}

.tag.f {
  color: var(--asing);
}

.tag.scrip {
  color: var(--scrip);
}

/* Column Hiding: Hidden in BOTH header and rows by default */
.opt1, .opt2, .opt3,
.list .opt1, .list .opt2, .list .opt3,
.thead .opt1, .thead .opt2, .thead .opt3 {
  display: none !important;
}

/* Skeleton & NA price styling */
.skel-px {
  width: 44px;
  height: 14px;
  display: inline-block;
  border-radius: 4px;
  vertical-align: middle;
}

.na-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink3);
  letter-spacing: 0.02em;
}

@container (min-width: 540px) {
  /* 4 columns: Kode/Emiten, Harga, +/-, Porsi Terbesar */
  .row, .thead {
    grid-template-columns: minmax(180px, 1.8fr) minmax(90px, 0.9fr) minmax(80px, 0.8fr) minmax(110px, 1.2fr);
  }
  .row {
    min-height: 52px;
    padding: 8px 16px;
  }
  .id {
    grid-row: auto;
  }
  .px, .ch {
    grid-row: auto;
    grid-column: auto;
  }
  .px {
    text-align: right;
  }
  .ch {
    justify-self: end;
  }
  .m3 {
    display: none;
  }
  .cell {
    display: block;
  }
  .cell.r {
    text-align: right;
  }
  .thead {
    display: grid;
    column-gap: 12px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--line2);
    background: var(--thead-bg, var(--sunk));
    font-size: 12px;
    font-weight: 700;
    color: var(--ink2);
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    min-height: 40px;
  }
  .thead .h {
    display: flex;
    align-items: center;
    min-height: 28px;
    line-height: 1.2;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink2);
  }
  .thead .r {
    justify-content: flex-end;
    text-align: right;
  }
  .thead button.h {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    color: var(--ink2);
    padding: 0;
  }
  .thead button.r {
    justify-content: flex-end;
  }
  .thead button:hover {
    color: var(--ink);
  }
  .inv .px, .inv .ch {
    display: none;
  }
}

@container (min-width: 660px) {
  /* 5 columns: + Pemegang >=1% (opt1) */
  .row, .thead {
    grid-template-columns: minmax(180px, 1.6fr) minmax(90px, 0.9fr) minmax(80px, 0.8fr) minmax(110px, 1.1fr) minmax(90px, 0.9fr);
  }
  span.opt1,
  .list span.opt1 {
    display: block !important;
  }
  button.opt1,
  .thead button.opt1 {
    display: inline-flex !important;
  }
}

@container (min-width: 760px) {
  /* 6 columns: + Pemegang Saham Terbesar (opt2) */
  .row, .thead {
    grid-template-columns: minmax(170px, 1.4fr) minmax(85px, 0.9fr) minmax(75px, 0.8fr) minmax(100px, 1fr) minmax(85px, 0.9fr) minmax(160px, 1.6fr);
  }
  span.opt1, span.opt2,
  .list span.opt1, .list span.opt2 {
    display: block !important;
  }
  button.opt1, button.opt2,
  .thead button.opt1, .thead button.opt2 {
    display: inline-flex !important;
  }
  .sub-hname {
    display: none !important;
  }
}

@container (min-width: 860px) {
  /* 7 columns: + Porsi Domestik (opt3) */
  .row, .thead {
    grid-template-columns: minmax(170px, 1.3fr) minmax(85px, 0.9fr) minmax(75px, 0.8fr) minmax(95px, 1fr) minmax(85px, 0.9fr) minmax(160px, 1.5fr) minmax(95px, 0.9fr);
  }
  span.opt1, span.opt2, span.opt3,
  .list span.opt1, .list span.opt2, .list span.opt3 {
    display: block !important;
  }
  button.opt1, button.opt2, button.opt3,
  .thead button.opt1, .thead button.opt2, .thead button.opt3 {
    display: inline-flex !important;
  }
  .sub-hname {
    display: none !important;
  }
}

.cell.nm {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  color: var(--ink2);
}

.cell.v {
  font-size: 14px;
  font-weight: 600;
}

.more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 16px 0 8px;
}

.note {
  font-size: 12px;
  color: var(--ink3);
}

.btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--r-s);
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn.pri {
  background: var(--accent);
  color: var(--on-accent);
}

.btn.pri:hover {
  filter: brightness(1.08);
}

.btn.sec {
  border: 1px solid var(--line2);
  background: var(--card);
}

.btn.sec:hover {
  border-color: var(--ink3);
}

/* States & Skeletons */
.skel {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
}

.sk {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--sunk) 25%, var(--line) 50%, var(--sunk) 75%);
  background-size: 200% 100%;
  animation: sh 1.3s linear infinite;
}

@keyframes sh {
  to {
    background-position: -200% 0;
  }
}

.loading-spinner {
  width: 26px;
  height: 26px;
  margin: 0 auto 10px;
  border: 3px solid var(--line);
  border-top-color: var(--pri);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.state {
  padding: 40px 24px;
  text-align: center;
  color: var(--ink2);
}

.state b {
  display: block;
  font-size: 16px;
  margin-bottom: 6px;
  color: var(--ink);
}

.state p {
  font-size: 14px;
  color: var(--ink3);
  max-width: 380px;
  margin: 0 auto 14px;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 76px;
  z-index: 70;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--r-s);
  max-width: 92vw;
  display: none;
}

.toast.on {
  display: block;
}

@media(min-width: 1024px) {
  .toast {
    bottom: 24px;
  }
}

/* Pro Lock Cards */
.lock {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--r);
  background: var(--sunk);
  border: 1px solid var(--line);
  margin-top: 14px;
}

.lock .i {
  color: var(--ink3);
  margin-top: 2px;
}

.lock h4 {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.lock p {
  font-size: 13px;
  color: var(--ink3);
  margin-top: 2px;
}

.lock .go {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 6px;
  min-height: 32px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-text);
}

.lock .go:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Cards & CSS Analytics */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
}

.card h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.grid2 {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

@media(min-width: 768px) {
  .grid2 {
    grid-template-columns: 1fr 1fr;
  }
  .grid2 .span2 {
    grid-column: 1/-1;
  }
}

.bars {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.bar {
  display: grid;
  grid-template-columns: minmax(80px, 140px) 1fr 52px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.bar .t {
  color: var(--ink2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar .tr {
  height: 10px;
  border-radius: 5px;
  background: var(--sunk);
  overflow: hidden;
}

.bar .tr i {
  display: block;
  height: 100%;
  background: var(--ink);
  border-radius: 5px;
  min-width: 3px;
}

.bar .v {
  text-align: right;
  font-weight: 700;
}

.seg {
  display: flex;
  height: 16px;
  border-radius: 8px;
  overflow: hidden;
  margin: 16px 0 12px;
  background: var(--sunk);
  gap: 2px;
}

.seg i {
  display: block;
  height: 100%;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink2);
}

.legend b {
  color: var(--ink);
}

.sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
}

/* Detail Master-Pane & Bottom Sheet */
.dh {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 8px 12px;
  border-bottom: 1px solid var(--line);
  min-height: 56px;
  flex-shrink: 0;
}

.dh .tt {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink2);
  flex: 1;
  padding-left: 4px;
}

.ib {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--r-s);
  color: var(--ink2);
}

.ib:hover {
  background: var(--hover);
  color: var(--ink);
}

.db {
  overflow-y: auto;
  padding: 20px 20px 32px;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
}

.db:focus {
  outline: none;
}

.big {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
}

.pr {
  font-size: 22px;
  font-weight: 800;
}

.d-iss {
  color: var(--ink3);
  font-size: 14px;
  margin-top: 2px;
}

.pline {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}

.stat {
  background: var(--sunk);
  border-radius: var(--r-s);
  padding: 12px 14px;
}

.stat span {
  display: block;
  font-size: 12px;
  color: var(--ink3);
}

.stat b {
  font-size: 18px;
  font-weight: 800;
}

.sec-h {
  font-size: 15px;
  font-weight: 700;
  margin: 22px 0 4px;
}

.own {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 12px;
}

.donut {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 24px;
  background: var(--card);
  border-radius: 50%;
}

.hold {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: center;
  padding: 12px 8px;
  margin: 0 -8px;
  border-bottom: 1px solid var(--line);
  width: calc(100% + 16px);
  border-radius: var(--r-s);
  min-height: 60px;
}

.hold:hover {
  background: var(--hover);
}

.hold:last-child {
  border-bottom: 0;
}

.hold .n {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  grid-column: 2;
}

.hold .m {
  grid-column: 2;
  font-size: 12px;
  color: var(--ink3);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.hold .p {
  grid-column: 3;
  grid-row: 1;
  font-weight: 800;
  font-size: 15px;
  text-align: right;
}

.hold .s {
  grid-column: 3;
  grid-row: 2;
  font-size: 12px;
  color: var(--ink3);
  text-align: right;
}

.hold .sw {
  grid-row: 1/3;
  margin: 0;
  width: 12px;
  height: 12px;
}

.hold.pf {
  grid-template-columns: minmax(0, 1fr) auto;
}

.hold.pf .n, .hold.pf .m {
  grid-column: 1;
}

/* Overlays: Scrim, Sheet, Palette Modal */
.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease);
}

.scrim.on {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: 92vh;
  height: 92dvh;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  transform: translateY(102%);
  transition: transform .26s var(--ease);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  visibility: hidden;
}

.sheet.on {
  transform: none;
  visibility: visible;
}

.sheet::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 36px;
  height: 4px;
  margin-left: -18px;
  border-radius: 2px;
  background: var(--line2);
}

.sheet .dh {
  padding-top: 14px;
}

@media(min-width: 768px) {
  .sheet {
    left: 50%;
    right: auto;
    width: 640px;
    margin-left: -320px;
  }
}

@media(min-width: 1024px) {
  .sheet {
    bottom: auto;
    top: 50%;
    height: auto;
    max-height: 86vh;
    width: 600px;
    margin-left: calc(-300px + var(--rail)/2);
    border-radius: var(--r);
    transform: translateY(-46%);
    opacity: 0;
    transition: transform .2s var(--ease), opacity .2s;
    overflow: hidden;
  }
  .sheet.on {
    transform: translateY(-50%);
    opacity: 1;
  }
  .sheet::before {
    display: none;
  }
  .sheet .dh {
    padding-top: 8px;
  }
}

/* Search Palette Modal */
.pal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  display: none;
  flex-direction: column;
}

.pal.on {
  display: flex;
}

.pal-box {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.pal-h {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.pal-h input {
  flex: 1;
  min-height: 48px;
  border: 1px solid var(--accent-text);
  border-radius: var(--r);
  padding: 0 14px;
  background: var(--card);
  font-size: 16px;
}

.pal-h input:focus-visible {
  outline: 0;
}

.pal-b {
  overflow-y: auto;
  padding: 8px 12px 24px;
  flex: 1;
}

.pal-b h5 {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink3);
  margin: 16px 8px 6px;
}

.pr-i {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 6px 12px;
  border-radius: var(--r-s);
}

.pr-i[aria-selected="true"], .pr-i:hover {
  background: var(--sel);
}

.pr-i .code {
  font-size: 15px;
  min-width: 52px;
}

.pr-i .iss {
  flex: 1;
}

.pr-i .r {
  font-size: 13px;
  color: var(--ink2);
  font-weight: 600;
}

@media(min-width: 1024px) {
  .pal {
    background: var(--scrim);
    align-items: center;
    padding-top: 12vh;
    justify-content: flex-start;
  }
  .pal-box {
    flex: none;
    width: 640px;
    max-height: 70vh;
    background: var(--bg);
    border: 1px solid var(--line2);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    margin-left: var(--rail);
  }
}

/* Form & Input styles for Feedback modal */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink2);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  border: 1px solid var(--line2);
  border-radius: var(--r-s);
  background: var(--card);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
}

.form-textarea {
  min-height: 96px;
  resize: vertical;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-text);
  outline: none;
}

/* FAQ view styles */
.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.faq-q {
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  gap: 12px;
}

.faq-a {
  margin-top: 8px;
  font-size: 14px;
  color: var(--ink2);
  line-height: 1.6;
}

/* Pricing Table in Pro Sheet */
.pt td {
  padding: 10px 8px 10px 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.pt td:nth-child(n+2) {
  white-space: nowrap;
}

/* One-line Footer */
.foot {
  padding-top: 8px;
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  font-size: 12px;
  color: var(--ink3);
  line-height: 1.5;
}

.foot span {
  white-space: nowrap;
}

.foot a {
  color: var(--ink3);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.foot a:hover {
  color: var(--ink);
}

@media(min-width: 1024px) {
  .foot {
    padding-bottom: 24px;
  }
}

@media(max-width: 520px) {
  .foot {
    font-size: 11px;
  }
  .foot span {
    white-space: normal;
  }
}

.view {
  display: none;
}

.view.on {
  display: block;
}

@media(prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Whale Map Responsive Container & State Styles */
.whale-map-container {
  width: 100%;
  height: 320px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  position: relative;
  background: var(--card);
  overflow: hidden;
  touch-action: pan-y;
}

@media (max-width: 1023px) {
  .whale-map-container {
    height: 280px;
  }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.whale-loading,
.whale-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--card);
  z-index: 2;
}
