:root {
  --bg: #070a14;
  --card: #101a33;
  --text: #eef2ff;
  --muted: #aab6d9;
  --muted2: #7f8bb8;
  --head: #dbe4ff;
  --border: #25345f;
  --good: #22c55e;
  --bad: #fb7185;
  --neutral: #60a5fa;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial;
  background: radial-gradient(1200px 800px at 10% 0%, rgba(96, 165, 250, .12), transparent 60%),
    radial-gradient(900px 700px at 90% 10%, rgba(34, 197, 94, .10), transparent 55%),
    linear-gradient(180deg, #070a14, #0b1020 25%, #0b1020);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text);
  padding-top: 80px;
}

/* Hide scrollbar for whole page */
html,
body {
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE/Edge */
  overflow-x: hidden;
  /* Prevent horizontal scroll */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  /* Chrome/Safari/Opera */
}


.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

header {
  padding: 1rem 0;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 10;
  background: rgba(11, 16, 32, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.brand {
  font-weight: 700;
  letter-spacing: .2px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  /* Reset auto margin */
  margin-left: 0;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Toolbar removed */

input[type="file"] {
  color: var(--muted);
}

main input[type="text"],
main input[type="number"],
main select,
main input[type="date"] {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0c142a;
  color: var(--text);
  outline: none;
}

input[type="number"] {
  width: 160px;
}

select {
  min-width: 150px;
}

button {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0c142a;
  color: var(--text);
  cursor: pointer;
}

button:hover {
  filter: brightness(1.08);
}

main {
  padding: 14px 14px 30px;
  max-width: 1500px;
  margin: 0 auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.card {
  background: linear-gradient(180deg, rgba(16, 26, 51, .96), rgba(10, 16, 34, .96));
  border: 1px solid rgba(34, 48, 86, .95);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
  min-width: 0;
  /* Important for grid items to shrink */
}

.card h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--muted);
  font-weight: 650;
}

.span-12 {
  grid-column: span 12;
}

.span-8 {
  grid-column: span 8;
}

.span-6 {
  grid-column: span 6;
}

.span-4 {
  grid-column: span 4;
}

/* Responsive adjustments for mobile devices */
@media (max-width: 768px) {

  /* Stack grid columns vertically if needed, but prefer fluid grids where possible */
  .grid {
    grid-template-columns: 1fr;
    gap: 10px;
    /* Tighter gap on mobile */
  }

  /* === MOBILE TYPOGRAPHY REDUCTION === */
  html {
    font-size: 14px;
    /* Base scale reduction */
  }

  /* Reduce Heading Sizes */
  h1 {
    font-size: 1.5rem !important;
  }

  h2 {
    font-size: 1.25rem !important;
  }

  h3 {
    font-size: 1rem !important;
  }

  /* Reduce KPI Card Text */
  .dir-card .v {
    font-size: 16px !important;
  }

  .dir-card .dir-title {
    font-size: 11px !important;
  }

  .dir-card .k,
  .dir-card .s {
    font-size: 11px !important;
  }

  /* Reduce Table Text */
  th,
  td {
    font-size: 12px !important;
    padding: 6px 8px !important;
  }

  .metric-panel .panel-title {
    font-size: 11px !important;
  }


  /* Antigravity: Enforce 44px Touch Targets (Fitts' Law) */
  /* Modified: Reduced min-height for config inputs to save space */
  button,
  .nav-link,
  .sidebar-link {
    min-height: 44px;
    font-size: 16px;
  }

  /* Force KPI Grid to 2 Columns */
  .kpi-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .kpi-tile {
    padding: 8px !important;
  }

  .kpi-tile .kpi-value {
    font-size: 18px !important;
    /* Smaller font to fit 2 cols */
  }

  .kpi-tile .kpi-label,
  .kpi-tile .kpi-sub {
    font-size: 11px !important;
  }

  /* Consolidate all config input styles for perfect uniformity */
  .controls input,
  .controls select {
    min-height: 32px !important;
    height: 32px !important;
    font-size: 12px !important;
    padding: 0 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: center;
    appearance: none;
    /* Normalize native UI */
    -webkit-appearance: none;
  }

  /* Ensure select arrow is still visible or handled if needed, 
     but for now priority is size uniformity. */

  .controls button {
    min-height: 32px !important;
    height: 32px !important;
    padding: 0 8px !important;
    font-size: 12px !important;
    width: 100% !important;
  }

  /* Import Section Mobile Fix */
  .import-section {
    flex-wrap: wrap !important;
    justify-content: center;
    gap: 10px !important;
  }

  .import-section button {
    width: 100% !important;
    /* Full width import button */
    justify-content: center;
  }

  .import-section a {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
  }

  .span-12,
  .span-8,
  .span-6,
  .span-4,
  .span-3,
  .metric-panel.span-2,
  .overview-panels,
  .topbottom-grid,
  .overview-dirgrid {
    grid-column: span 1 !important;
    grid-template-columns: 1fr !important;
  }

  /* Wrap controls and stretch inputs */
  .controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: end;
    gap: 8px !important;
  }

  .control-item {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  /* Remove redundant blocks as we consolidated above */
  .controls label {
    margin-left: 0 !important;
    margin-bottom: 2px !important;
    display: block;
    font-size: 11px !important;
  }

  /* Adjust padding and font sizes */
  .container {
    padding: 0 10px;
  }

  main {
    padding: 10px;
  }

  h3 {
    font-size: 1.1rem;
  }

  /* OPTIMIZATION: Tổng quan (Overview) Table */
  .summary-table td,
  .metric-panel td {
    padding: 4px 6px !important;
    /* Compact padding */
  }

  .summary-table b,
  .metric-panel b {
    font-size: 13px !important;
    /* Smaller bold text */
  }

  /* Adjust font size specific for summary table rows */
  .summary-table .muted2,
  .metric-panel .muted2 {
    font-size: 11px !important;
  }

  /* Ensure chips are smaller too */
  .chip {
    padding: 0 6px !important;
    font-size: 11px !important;
    height: 20px !important;
    line-height: 18px !important;
  }

  /* Ensure tables scroll smoothly and don't squash columns */
  .table-scroll {
    overflow-x: auto;
  }

  .table-scroll table {
    min-width: 1500px;
    /* Force scroll if screen is narrower than this */
  }

  /* Explicitly prevent squashing of columns in orders table */
  .orders-table {
    table-layout: auto;
    /* Allow columns to expand to fit content */
  }

  .orders-table th,
  .orders-table td {
    min-width: 240px;
    white-space: nowrap;
    /* Keep text on one line */
    overflow: visible;
    /* Show full text */
    text-overflow: clip;
    /* No ellipses */
  }

  .orders-table th:first-child,
  .orders-table td:first-child {
    min-width: 180px;
  }


  .orders-table th,
  .orders-table td {
    border-right: 1px solid rgba(34, 48, 86, .75);
  }

  .orders-table th:last-child,
  .orders-table td:last-child {
    border-right: none;
  }

  .orders-table .tag {
    font-size: 14px;
  }

  /* Adjust tab buttons for wrap */
  .tabs {
    justify-content: flex-start;
    /* Or center if preferred */
    gap: 6px;
  }

  .tab-btn {
    flex: 1 1 auto;
    /* Allow buttons to shrink/grow */
    text-align: center;
    font-size: 13px;
    padding: 8px 10px;
  }
}

@media (max-width: 1100px) {

  .span-8,
  .span-6,
  .span-4,
  .span-3 {
    grid-column: span 12;
  }

  input[type="number"] {
    width: 140px;
  }

  select {
    min-width: 140px;
  }
}

/* Custom: Span 12 on very large screens only */
@media (min-width: 1500px) {
  .span-xl-12 {
    grid-column: span 12 !important;
  }
}

.chart {
  width: 100%;
  height: 360px;
  min-width: 0;
  /* Fix flex/grid child overflow */
}

.chart-xl {
  width: 100%;
  height: 520px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  /* Ensure it never exceeds parent */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* smooth scroll on iOS */
  border-radius: 12px;
  border: 1px solid rgba(34, 48, 86, .75);
  background: rgba(12, 20, 42, 0.2);
}

.table-wrap table {
  margin-bottom: 0;
  /* remove bottom gap if any */
  border-radius: 0;
  /* let container handle corners */
  border: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  /* overflow: hidden; -- breaks sticky header */
  border-radius: 12px;
}

/* Allow text wrapping for note/description columns */
.text-wrap {
  white-space: normal !important;
  word-break: break-word;
  /* Force break if needed */
  min-width: 120px;
  /* Slightly smaller min-width */
  max-width: 200px;
  /* Cap width to force wrap sooner */
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(34, 48, 86, .75);
  text-align: left;
}

th {
  color: var(--head);
  font-weight: 650;
  background: rgba(12, 20, 42, .6);
}

tr:last-child td {
  border-bottom: none;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
}

.tag.good {
  color: var(--good);
}

.tag.bad {
  color: var(--bad);
}

.note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.error {
  color: #ffb4b4;
}

.range-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.range-box {
  flex: 1 1 340px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(12, 20, 42, .35);
}

.range-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}

.range-title b {
  color: #fff;
  font-size: 12px;
}

input[type="range"] {
  width: 100%;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Top/Bottom trades + selection highlight */
.click-row {
  cursor: pointer;
}

.click-row:hover {
  background: rgba(96, 165, 250, .10);
}

tr.selected-row td {
  background: rgba(96, 165, 250, .18);
}

.topbottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 1100px) {
  .topbottom-grid {
    grid-template-columns: 1fr;
  }
}


th.num,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}



/* Better readability */
.pos {
  color: var(--good);
}

.neg {
  color: var(--bad);
}

.muted2 {
  color: var(--muted2);
}

.small {
  font-size: 12px;
}

td,
.card h3 {
  font-variant-numeric: tabular-nums;
}

/* Tags more visible */
.tag {
  background: rgba(148, 163, 184, .06);
}

.tag.good {
  border-color: rgba(34, 197, 94, .35);
  background: rgba(34, 197, 94, .10);
}

.tag.bad {
  border-color: rgba(251, 113, 133, .35);
  background: rgba(251, 113, 133, .10);
}

/* Special metrics tables (Overview vNext) */
.metrics-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.metrics-table col.col-label {
  width: 40%;
}

.metrics-table col.col-num {
  width: 20%;
}

.metrics-table thead th {
  background: rgba(12, 20, 42, .58);
}

.metrics-table thead tr:first-child th {
  text-transform: uppercase;
  letter-spacing: .6px;
  font-size: 12px;
}

.metrics-table td {
  vertical-align: middle;
  height: 38px;
}

.metrics-table td:first-child {
  color: #c6d2f3;
}

.metrics-table .unit {
  color: var(--muted2);
  font-size: 12px;
  margin-left: 2px;
}

.metrics-table .sub {
  font-size: 12px;
  margin-top: 2px;
}

.metrics-table tbody tr td {
  background: rgba(12, 20, 42, .18);
}

.metrics-table tbody tr:hover td {
  background: rgba(96, 165, 250, .08);
}

.metrics-table tbody tr+tr td {
  border-top: 1px solid rgba(34, 48, 86, .35);
}

.m-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.15;
}

.m-title {
  font-weight: 650;
}

.m-term {
  color: var(--muted2);
  font-size: 12px;
  font-weight: 500;
}

.overview-dirgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

@media (max-width: 1100px) {
  .overview-dirgrid {
    grid-template-columns: 1fr;
  }
}

.dir-card {
  border: 1px solid rgba(34, 48, 86, .85);
  background: rgba(12, 20, 42, .24);
  border-radius: 16px;
  padding: 10px 12px;
}

.dir-card .dir-title {
  text-transform: uppercase;
  letter-spacing: .6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.dir-card .dir-sub {
  font-size: 12px;
  color: var(--muted2);
  font-weight: 600;
}

.dir-card .dir-kpis {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 12px;
}

.dir-card .k {
  font-size: 12px;
  color: var(--muted2);
}

.dir-card .v {
  font-size: 18px;
  font-weight: 850;
  margin-top: 2px;
}

.dir-card .s {
  font-size: 12px;
  color: var(--muted2);
  margin-top: 2px;
}

.overview-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 1100px) {
  .overview-panels {
    grid-template-columns: 1fr;
  }
}

.metric-panel {
  border: 1px solid rgba(34, 48, 86, .85);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(12, 20, 42, .22);
}

.metric-panel .panel-head {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(34, 48, 86, .6);
  display: none !important;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.metric-panel .panel-title {
  text-transform: uppercase;
  letter-spacing: .6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 850;
}

.metric-panel .panel-note {
  font-size: 12px;
  color: var(--muted2);
}

.metric-panel table {
  border-radius: 0;
}

.metric-panel.span-2 {
  grid-column: span 2;
}

@media (max-width: 1100px) {
  .metric-panel.span-2 {
    grid-column: span 1;
  }
}

/* Header Navigation - Glass Pill Style */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  /* Tighter gap */
  margin: 0 20px;
  padding: 2px;
  /* Reduced container padding */
  background: rgba(255, 255, 255, 0.03);
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-link {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 12px;
  /* Reduced button padding */
  border-radius: 99px;
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  line-height: normal;
  /* Ensure consistent height */
}

/* Responsive Tabs: Turn into buttons on small screens */
@media (max-width: 1024px) {
  .header-nav {
    flex-wrap: wrap;
    justify-content: center;
    background: transparent;
    /* Remove container pill bg */
    border: none;
    border-radius: 0;
    padding: 10px 0;
    gap: 8px;
    height: auto;
    /* Allow growth */
  }

  .nav-link {
    background: rgba(255, 255, 255, 0.08);
    /* Give inactive buttons a background */
    padding: 8px 16px;
    /* Larger touch target */
  }
}

/* Tabs: group cards for easier navigation */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 14px 0;
}

.tab-btn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(37, 52, 95, .9);
  background: rgba(12, 20, 42, .38);
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .1px;
}

.tab-btn:hover {
  background: rgba(96, 165, 250, .10);
  color: var(--text);
}

.tab-btn.active {
  background: rgba(96, 165, 250, .18);
  border-color: rgba(96, 165, 250, .35);
  color: var(--text);
}

.tab-hint {
  color: var(--muted2);
  font-size: 12px;
  margin-top: -8px;
  margin-bottom: 12px;
}

.is-hidden {
  display: none !important;
}

/* Regime table: match Overview pattern (fixed layout) */
/* Regime table: shared style with Overview */
.regime-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.regime-table th,
.regime-table td {
  white-space: normal !important;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 8px 6px;
  vertical-align: top;
  border-bottom: none;
  /* Let metrics-table logic handle borders */
}

/* On mobile, wrapping might be bad for numbers, so we specifically handle small screens */
@media (max-width: 768px) {

  /* Force all tables to scroll horizontally instead of squashing */
  .regime-table,
  .metrics-table,
  table {
    min-width: 600px;
    /* Ensure enough width for content */
    table-layout: auto;
    /* Let columns expand */
  }

  .regime-table th,
  .regime-table td,
  .metrics-table th,
  .metrics-table td,
  td,
  th {
    white-space: nowrap;
    /* Prevent wrapping */
    overflow: visible;
    font-size: 12px;
    padding: 8px 6px;
  }

  /* Hide scrollbars for cleaner look (optional but consistent with Orders) */
  .table-wrap {
    overflow-x: auto;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
  }

  .table-wrap::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
  }
}

/* Regime table: more intuitive chips */
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(37, 52, 95, .8);
  background: rgba(148, 163, 184, .06);
  font-size: 12px;
  line-height: 18px;
}

.chip.good {
  color: var(--good);
  border-color: rgba(34, 197, 94, .35);
  background: rgba(34, 197, 94, .10);
}

.chip.bad {
  color: var(--bad);
  border-color: rgba(251, 113, 133, .35);
  background: rgba(251, 113, 133, .10);
}

.chip.neutral {
  color: var(--neutral2);
  border-color: rgba(96, 165, 250, .22);
  background: rgba(96, 165, 250, .06);
}

/* Orders table (summary-only) */
/* Orders table (redesigned) */
.table-scroll {
  max-height: 560px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(34, 48, 86, .75);
  border-radius: 12px;

  /* Hide scrollbar for Chrome, Safari and Opera */
  &::-webkit-scrollbar {
    display: none;
  }

  /* Hide scrollbar for IE, Edge and Firefox */
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
}

.orders-table {
  min-width: 1000px;
  /* Force horizontal scroll if container is smaller */
  table-layout: fixed;
}

.orders-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(12, 20, 42, .94);
}

.orders-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orders-table td.sig {
  max-width: 22ch;
}

.orders-table tbody tr:nth-child(odd) td {
  background: rgba(12, 20, 42, .18);
}

.orders-table tbody tr:nth-child(even) td {
  background: rgba(12, 20, 42, .26);
}

.orders-table tbody tr:hover td {
  background: rgba(96, 165, 250, .10);
}

.orders-table td.wrap {
  white-space: normal;
}

.orders-table td.tradecell {
  white-space: normal;
}

.orders-table tr.trade-summary td {
  background: rgba(12, 20, 42, .42);
  border-top: 1px solid rgba(96, 165, 250, .22);
}

.orders-table tr.trade-summary td:first-child {
  border-left: 3px solid rgba(96, 165, 250, .38);
}

.orders-table tr.order-row td {
  background: rgba(12, 20, 42, .18);
}

.orders-table tr.trade-summary:hover td,
.orders-table tr.order-row:hover td {
  background: rgba(96, 165, 250, .10);
}

.trade-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.trade-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.trade-id {
  font-weight: 750;
  letter-spacing: .2px;
}

.trade-sub {
  margin-top: 3px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 18px;
}

.badge.summary {
  color: var(--neutral2);
  border-color: rgba(96, 165, 250, .35);
  background: rgba(96, 165, 250, .10);
}

.badge.entry {
  color: var(--good);
  border-color: rgba(34, 197, 94, .35);
  background: rgba(34, 197, 94, .10);
}

.badge.exit {
  color: var(--bad);
  border-color: rgba(251, 113, 133, .35);
  background: rgba(251, 113, 133, .10);
}

.badge.other {
  color: var(--neutral2);
  border-color: rgba(96, 165, 250, .22);
  background: rgba(96, 165, 250, .06);
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bullet {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .05);
  flex: 0 0 auto;
}

.bullet.entry {
  background: rgba(34, 197, 94, .75);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .12);
}

.bullet.exit {
  background: rgba(251, 113, 133, .80);
  box-shadow: 0 0 0 3px rgba(251, 113, 133, .12);
}

.bullet.other {
  background: rgba(96, 165, 250, .75);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .10);
}

.orders-table td.order-step {
  padding-left: 14px;
  white-space: normal;
}

.orders-table .dir-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
}

.orders-table .dir-badge.long {
  color: var(--good);
  border-color: rgba(34, 197, 94, .35);
  background: rgba(34, 197, 94, .10);
}

.orders-table .dir-badge.short {
  color: var(--bad);
  border-color: rgba(251, 113, 133, .35);
  background: rgba(251, 113, 133, .10);
}



/* Number formatting & alignment */
.num,
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.center {
  text-align: center;
}


/* Responsive Regime Tables */
.regime-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.regime-table th,
.regime-table td {
  padding: 10px 10px;
  vertical-align: middle;
  white-space: nowrap;
}

.regime-table td.period {
  overflow: hidden;
  text-overflow: ellipsis;
}


/* KPI tiles (fluid grid - resilient layout) */
.kpi-grid {
  display: grid;
  /* Antigravity: RAM Pattern (Repeat, Auto, Minmax) */
  /* Fits as many 160px+ columns as possible, no media queries needed */
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

/* Replaces hardcoded column media queries */

.kpi-tile {
  background: rgba(12, 20, 42, .35);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
}

.kpi-tile .kpi-label {
  color: var(--muted2);
  font-size: 12px;
}

.kpi-tile .kpi-value {
  font-size: 24px;
  font-weight: 800;
  margin-top: 4px;
}

.kpi-tile .kpi-sub {
  color: var(--muted2);
  font-size: 12px;
  margin-top: 2px;
}

/* Collapsible Details & Summary */
/* Collapsible Details & Summary */
/* details ruleset removed */

/* Hide ALL default markers aggressively */
summary::-webkit-details-marker,
summary::marker {
  display: none !important;
  content: "" !important;
  color: transparent !important;
  font-size: 0 !important;
  opacity: 0 !important;
}

summary {
  display: block;
  list-style: none !important;
  list-style-type: none !important;
  /* Firefox specific */
  list-style-image: none !important;
  cursor: pointer;
  outline: none;
  position: relative;
  padding-left: 0;
  /* No space needed since arrow is gone */
}

summary:focus {
  outline: none;
}

/* Collapsible details */
.details {
  border: 1px solid rgba(37, 52, 95, .55);
  border-radius: 14px;
  padding: 8px 10px;
  background: rgba(12, 20, 42, .18);
}

.details>summary {
  cursor: pointer;
  color: var(--head);
  font-weight: 750;
  list-style: none;
}

.details>summary::-webkit-details-marker {
  display: none;
}

.details>summary:before {
  content: '?';
  display: inline-block;
  margin-right: 8px;
  color: var(--muted2);
  transform: rotate(0deg);
  transition: transform .15s ease;
}

.details[open]>summary:before {
  transform: rotate(90deg);
}

.tabs {
  display: flex;
  gap: 10px;
}

.tab-btn {
  background: none;
  border: none;
  color: #94a3b8;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 600;
}

.tab-btn.active {
  color: #f8fafc;
  border-bottom: 2px solid #38bdf8;
}

.tab-btn:hover {
  color: #e2e8f0;
}

/* Responsive Tabs */
.mobile-only {
  display: none;
}

.desktop-only {
  display: inline-block;
}

@media (max-width: 768px) {
  .mobile-only {
    display: block;
  }

  .desktop-only {
    display: none !important;
  }

  .tabs.main-tabs {
    display: block;
    /* Stack/block layout for the select */
  }
}

/* Custom Mobile Dropdown */
.mobile-dropdown {
  position: relative;
  width: 100%;
  z-index: 50;
}

.dropdown-trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(16, 26, 51, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  color: #e2e8f0;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.dropdown-trigger:active {
  transform: scale(0.99);
}

.dropdown-trigger svg {
  width: 20px;
  height: 20px;
  color: #94a3b8;
}

.dropdown-menu {
  position: absolute;
  top: 110%;
  left: 0;
  width: 100%;
  background: rgba(16, 26, 51, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  padding: 12px 16px;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
}

.dropdown-item.active {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  font-weight: 600;
}

/* Mobile Sidebar Drawer */
.icon-btn {
  background: none;
  border: none;
  color: #cbd5e1;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

.sidebar-drawer {
  position: fixed;
  top: 0;
  left: -280px;
  /* Hidden off-screen */
  width: 280px;
  height: 100%;
  background: rgba(16, 26, 51, 0.95);
  border-right: 1px solid rgba(148, 163, 184, 0.15);
  backdrop-filter: blur(16px);
  z-index: 9999;
  padding: 20px;
  transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 10px 0 25px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.sidebar-drawer.active {
  left: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-link {
  text-decoration: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  padding: 12px 16px;
  border-radius: 8px;
  transition: all 0.2s;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.sidebar-link.active {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  font-weight: 700;
}

/* Hide Main Tabs on Mobile */
@media (max-width: 768px) {
  .main-tabs {
    display: none !important;
    /* Hide the desktop buttons completely */
  }
}

/* Header Navigation */
.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 0 20px;
  overflow-x: auto;
  /* Allow scroll on small screens if needed */
}

.nav-link {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
  position: relative;
  white-space: nowrap;
  transition: color 0.2s;
}

.nav-link:hover {
  color: #fff;
  filter: none;
  /* Override default button hover filter */
}

/* Active State: Underline */
.nav-link.active {
  color: #60a5fa;
  /* Blue accent */
}

.nav-link.active::after {
  content: ' ';
  position: absolute;
  bottom: -4px;
  /* Adjust based on header padding */
  left: 0;
  width: 100%;
  height: 2px;
  /* Slightly tighter gap for pills */
  margin: 0 20px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.03);
  /* Very subtle container bg */
  border-radius: 99px;
  /* Container pill */
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-link {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 99px;
  /* Pill shape */
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.nav-link:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.05);
}

/* Active State: Glass Pill with Glow */
.nav-link.active {
  color: #fff;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(30, 64, 175, 0.2));
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow: 0 0 15px rgba(96, 165, 250, 0.15), inset 0 0 10px rgba(96, 165, 250, 0.05);
  text-shadow: 0 0 8px rgba(96, 165, 250, 0.4);
}

.nav-link.active::after {
  display: none;
  /* Remove the old underline */
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  /* Hidden on desktop */
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
}

.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Mobile Sidebar Styling */
.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s;
}

.mobile-sidebar-overlay.active {
  display: block;
  opacity: 1;
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  right: -280px;
  /* Hidden by default */
  width: 280px;
  height: 100%;
  background: rgba(11, 16, 32, 0.95);
  backdrop-filter: blur(16px);
  border-left: 1px solid var(--border);
  z-index: 999;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.mobile-sidebar.active {
  right: 0;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text);
}

.close-sidebar-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
}

.sidebar-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-link {
  background: transparent;
  border: none;
  text-align: left;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.sidebar-link.active {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  font-weight: 600;
}

/* EXECUTION TABLE: Force text wrapping on mobile */
@media (max-width: 768px) {

  .execution-table td,
  .execution-table th {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }
}

/* Responsive Logic: Switch between Header Tabs and Hamburger */
@media (max-width: 1024px) {
  .header-nav {
    display: none !important;
  }

  .mobile-menu-btn {
    display: block !important;
    margin-left: auto;
  }
}

/* =========================================
   PRO Feature Locking Styles
   ========================================= */

/* Relative container for the tab content to position overlay */
.main-tab-content {
  position: relative;
  min-height: 400px;
  /* Ensure height for overlay */
}

/* Blur the content when locked */
.blur-content {
  filter: blur(8px);
  pointer-events: none;
  /* Prevent clicking through */
  user-select: none;
  opacity: 0.5;
  transition: all 0.5s ease;
}

/* The Overlay Card */
.lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 10, 20, 0.85);
  backdrop-filter: blur(10px);
}

.lock-card {
  background: rgba(16, 26, 51, 0.95);
  border: 1px solid rgba(255, 215, 0, 0.3);
  /* Gold border for premium vibe */
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.1);
  backdrop-filter: blur(10px);
  animation: floatUp 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes floatUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.lock-icon-large {
  color: #f59e0b;
  /* Amber/Gold */
  margin-bottom: 20px;
  filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.4));
}

.lock-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #fff 0%, #ffd700 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lock-desc {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 25px;
}

.btn-pro {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 99px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-pro:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
  filter: brightness(1.1);
}

/* =========================================
   Login & Modal Styles
   ========================================= */

.btn-login {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 6px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  margin-left: 10px;
}

.btn-login:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-pro-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
  animation: pulseGlow 2s infinite;
  transition: transform 0.2s;
}

.btn-pro-badge:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
  }

  50% {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
  }

  100% {
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: rgba(16, 26, 51, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  width: 90%;
  max-width: 400px;
  padding: 30px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  z-index: 10;
  transform: translateY(0);
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.modal-header {
  text-align: center;
  margin-bottom: 25px;
}

.modal-icon {
  width: 48px;
  height: 48px;
  color: #f59e0b;
  margin-bottom: 15px;
}

.modal-header h3 {
  font-size: 1.5rem;
  color: white;
  margin: 0 0 5px;
}

.input-group {
  margin-bottom: 15px;
  text-align: left;
}

.input-group label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 500;
}

.input-group input {
  width: 100%;
  padding: 12px 15px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: white;
  font-size: 15px;
  transition: all 0.2s;
  box-sizing: border-box;
  /* Important for padding */
}

.input-group input:focus {
  border-color: #f59e0b;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.login-error {
  color: #fb7185;
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 15px;
  text-align: center;
}

.btn-submit {
  width: 100%;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter 0.2s;
}

.btn-submit:hover {
  filter: brightness(1.1);
}

/* Unlock State Utilities */
.is-unlocked .lock-overlay {
  display: none !important;
}

.is-unlocked .blur-content {
  filter: none !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  user-select: auto !important;
}

/* =======================
   Heatmap Table (Custom)
======================= */
.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 2px;
  font-size: 13px;
  table-layout: fixed;
}

.heatmap-table th,
.heatmap-table td.year-label,
.heatmap-table td.label-cell {
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  border: none;
  padding: 10px 4px;
}

.heatmap-table td {
  background: rgba(255, 255, 255, 0.03);
  text-align: right;
  /* S? can ph?i d?p hon */
  vertical-align: middle;
  color: var(--text);
  padding: 10px 8px;
  border-radius: 4px;
  border: none;
  font-weight: 500;
}

/* Center align for some cols if needed, but numbers usually right */
.heatmap-table td.box-cell {
  text-align: center;
  /* Heatmap boxes usually center text in image */
}

/* M�u � gi?ng ?nh: Xanh/�? n?n d?m, ch? s�ng */
.heatmap-table td.cell-win {
  background: #14532d;
  /* Green 900 */
  color: #fff;
}

.heatmap-table td.cell-loss {
  background: #7f1d1d;
  /* Red 900 */
  color: #fff;
}

.heatmap-table td.cell-total {
  background: #1e293b;
  font-weight: bold;
}

.heatmap-table td.cell-total.pos {
  background: #065f46;
  /* Emerald 800 */
  color: #fff;
}

.heatmap-table td.cell-total.neg {
  background: #991b1b;
  /* Red 800 */
  color: #fff;
}

/* Average Row */
.heatmap-table tr.row-avg td {
  background: transparent !important;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.heatmap-table tr.row-avg td.label-cell {
  text-align: left;
  padding-left: 10px;
}

/* Counts Row */
.heatmap-table tr.row-counts td {
  background: transparent !important;
  font-size: 11px;
  padding-top: 4px;
  vertical-align: top;
}

.c-up {
  color: var(--good);
  margin-right: 6px;
  font-weight: 700;
}

.c-down {
  color: var(--bad);
  font-weight: 700;
}

/* Override .chart height */
#yearMonthHeatmap {
  height: auto !important;
  min-height: 200px;
  overflow-x: auto;
  background: transparent;
  /* X�a bg n?u c� */
}


/* =======================
   Heatmap Table (Fixed v2)
======================= */
#yearMonthHeatmap {
  height: auto !important;
  min-height: 200px;
  overflow-x: auto !important;
  background: transparent;
  border-radius: 8px;
  display: block !important;
}

.heatmap-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 2px;
  font-size: 13px;
  table-layout: fixed;
}

.heatmap-table th,
.heatmap-table td.year-label,
.heatmap-table td.label-cell {
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  border: none;
  padding: 10px 12px;
  white-space: nowrap;
}

/* Sticky Column Rules */
.heatmap-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 11;
  background-color: #0f182d;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.heatmap-table td.year-label,
.heatmap-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 10;
  background-color: #0f182d;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.heatmap-table tr.row-avg td.label-cell,
.heatmap-table tr.row-counts td.label-cell {
  position: sticky;
  left: 0;
  z-index: 10;
  background-color: #0f182d !important;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.heatmap-table td {
  background: rgba(255, 255, 255, 0.03);
  text-align: right;
  vertical-align: middle;
  color: var(--text);
  padding: 10px 8px;
  border-radius: 2px;
  border: none;
  font-weight: 500;
  min-width: 65px;
}

.heatmap-table td.cell-win {
  background: #14532d;
  color: #fff;
}

.heatmap-table td.cell-loss {
  background: #7f1d1d;
  color: #fff;
}

.heatmap-table td.cell-total {
  background: #1e293b;
  font-weight: bold;
}

.heatmap-table td.cell-total.pos {
  background: #065f46;
  color: #fff;
}

.heatmap-table td.cell-total.neg {
  background: #991b1b;
  color: #fff;
}

.heatmap-table tr.row-avg td:not(.label-cell) {
  background: transparent !important;
  border-top: 1px solid var(--border);
}

.heatmap-table tr.row-counts td:not(.label-cell) {
  background: transparent !important;
}

.heatmap-table td.box-cell {
  text-align: center;
}

.heatmap-table tr.row-avg td.label-cell {
  text-align: left;
  padding-left: 14px;
}

.c-up {
  color: var(--good);
  margin-right: 6px;
  font-weight: 700;
}

.c-down {
  color: var(--bad);
  font-weight: 700;
}


/* HIDE SCROLLBAR OVERRIDE */
#yearMonthHeatmap {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

#yearMonthHeatmap::-webkit-scrollbar {
  display: none !important;
}


/* Average % Row Style */
.heatmap-table tr.row-avg-pct td:not(.label-cell) {
  background: transparent !important;
}

.heatmap-table tr.row-avg-pct td.label-cell {
  position: sticky;
  left: 0;
  z-index: 10;
  background-color: #0f182d !important;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  text-align: left;
  padding-left: 14px;
}


/* FONT SIZE OVERRIDE */
.heatmap-table {
  font-size: 14px !important;
}

.heatmap-table th,
.heatmap-table td.year-label,
.heatmap-table td.label-cell {
  font-size: 14px !important;
  font-weight: 650 !important;
  color: var(--head) !important;
}

.modal-header {
  text-align: center;
  margin-bottom: 25px;
}

.modal-icon {
  width: 48px;
  height: 48px;
  color: #f59e0b;
  margin-bottom: 15px;
}

.modal-header h3 {
  font-size: 1.5rem;
  color: white;
  margin: 0 0 5px;
}

.input-group {
  margin-bottom: 15px;
  text-align: left;
}

.input-group label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 500;
}

.input-group input {
  width: 100%;
  padding: 12px 15px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: white;
  font-size: 15px;
  transition: all 0.2s;
  box-sizing: border-box;
  /* Important for padding */
}

.input-group input:focus {
  border-color: #f59e0b;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.login-error {
  color: #fb7185;
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 15px;
  text-align: center;
}

.btn-submit {
  width: 100%;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter 0.2s;
}

.btn-submit:hover {
  filter: brightness(1.1);
}

/* Unlock State Utilities */
.is-unlocked .lock-overlay {
  display: none !important;
}

.is-unlocked .blur-content {
  filter: none !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  user-select: auto !important;
}

/* =======================
   Heatmap Table (Custom)
======================= */
.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 2px;
  font-size: 13px;
  table-layout: fixed;
}

.heatmap-table th,
.heatmap-table td.year-label,
.heatmap-table td.label-cell {
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  border: none;
  padding: 10px 4px;
}

.heatmap-table td {
  background: rgba(255, 255, 255, 0.03);
  text-align: right;
  /* S? can ph?i d?p hon */
  vertical-align: middle;
  color: var(--text);
  padding: 10px 8px;
  border-radius: 4px;
  border: none;
  font-weight: 500;
}

/* Center align for some cols if needed, but numbers usually right */
.heatmap-table td.box-cell {
  text-align: center;
  /* Heatmap boxes usually center text in image */
}

/* M�u � gi?ng ?nh: Xanh/�? n?n d?m, ch? s�ng */
.heatmap-table td.cell-win {
  background: #14532d;
  /* Green 900 */
  color: #fff;
}

.heatmap-table td.cell-loss {
  background: #7f1d1d;
  /* Red 900 */
  color: #fff;
}

.heatmap-table td.cell-total {
  background: #1e293b;
  font-weight: bold;
}

.heatmap-table td.cell-total.pos {
  background: #065f46;
  /* Emerald 800 */
  color: #fff;
}

.heatmap-table td.cell-total.neg {
  background: #991b1b;
  /* Red 800 */
  color: #fff;
}

/* Average Row */
.heatmap-table tr.row-avg td {
  background: transparent !important;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.heatmap-table tr.row-avg td.label-cell {
  text-align: left;
  padding-left: 10px;
}

/* Counts Row */
.heatmap-table tr.row-counts td {
  background: transparent !important;
  font-size: 11px;
  padding-top: 4px;
  vertical-align: top;
}

.c-up {
  color: var(--good);
  margin-right: 6px;
  font-weight: 700;
}

.c-down {
  color: var(--bad);
  font-weight: 700;
}

/* Override .chart height */
#yearMonthHeatmap {
  height: auto !important;
  min-height: 200px;
  overflow-x: auto;
  background: transparent;
  /* X�a bg n?u c� */
}


/* =======================
   Heatmap Table (Fixed v2)
======================= */
#yearMonthHeatmap {
  height: auto !important;
  min-height: 200px;
  overflow-x: auto !important;
  background: transparent;
  border-radius: 8px;
  display: block !important;
}

.heatmap-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 2px;
  font-size: 13px;
  table-layout: fixed;
}

.heatmap-table th,
.heatmap-table td.year-label,
.heatmap-table td.label-cell {
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  border: none;
  padding: 10px 12px;
  white-space: nowrap;
}

/* Sticky Column Rules */
.heatmap-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 11;
  background-color: #0f182d;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.heatmap-table td.year-label,
.heatmap-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 10;
  background-color: #0f182d;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.heatmap-table tr.row-avg td.label-cell,
.heatmap-table tr.row-counts td.label-cell {
  position: sticky;
  left: 0;
  z-index: 10;
  background-color: #0f182d !important;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.heatmap-table td {
  background: rgba(255, 255, 255, 0.03);
  text-align: right;
  vertical-align: middle;
  color: var(--text);
  padding: 10px 8px;
  border-radius: 2px;
  border: none;
  font-weight: 500;
  min-width: 65px;
}

.heatmap-table td.cell-win {
  background: #065f46;
  color: #fff;
}

.heatmap-table td.cell-loss {
  background: #9f4040;
  color: #fff;
}

.heatmap-table td.cell-total {
  background: #1e293b;
  font-weight: bold;
}

.heatmap-table td.cell-total.pos {
  background: #14532d;
  color: #fff;
}

.heatmap-table td.cell-total.neg {
  background: #991b1b;
  color: #fff;
}

.heatmap-table tr.row-avg td:not(.label-cell) {
  background: transparent !important;
  border-top: 1px solid var(--border);
}

.heatmap-table tr.row-counts td:not(.label-cell) {
  background: transparent !important;
}

.heatmap-table td.box-cell {
  text-align: center;
}

.heatmap-table tr.row-avg td.label-cell {
  text-align: left;
  padding-left: 14px;
}

.c-up {
  color: var(--good);
  margin-right: 6px;
  font-weight: 700;
}

.c-down {
  color: var(--bad);
  font-weight: 700;
}


/* HIDE SCROLLBAR OVERRIDE */
#yearMonthHeatmap {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

#yearMonthHeatmap::-webkit-scrollbar {
  display: none !important;
}


/* Average % Row Style */
.heatmap-table tr.row-avg-pct td:not(.label-cell) {
  background: transparent !important;
}

.heatmap-table tr.row-avg-pct td.label-cell {
  position: sticky;
  left: 0;
  z-index: 10;
  background-color: #0f182d !important;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  text-align: left;
  padding-left: 14px;
}


/* FONT SIZE OVERRIDE */
.heatmap-table {
  font-size: 14px !important;
}

.heatmap-table th,
.heatmap-table td.year-label,
.heatmap-table td.label-cell {
  font-size: 14px !important;
  font-weight: 650 !important;
  color: var(--head) !important;
}

/* MOBILE OPTIMIZATIONS FOR HEATMAP */
@media (max-width: 768px) {
  .heatmap-table td {
    min-width: 45px !important;
    /* Reduce from 65px */
    padding: 4px 2px !important;
    font-size: 11px !important;
  }

  .heatmap-table th,
  .heatmap-table td.year-label,
  .heatmap-table td.label-cell {
    padding: 4px 2px !important;
    font-size: 11px !important;
  }

  .heatmap-table {
    border-spacing: 1px !important;
  }
}

/* Data Health Table Fix */
.health-table td:last-child {
  white-space: normal !important;
  min-width: 140px;
}

/* =======================
   Modern Heatmap V2
   Grid Layout: Year | Jan-Dec | Total
======================= */
.modern-heatmap-grid {
  display: grid;
  grid-template-columns: 60px repeat(12, 1fr) 70px;
  gap: 6px;
  width: 100%;
  margin-top: 10px;
  align-items: center;
}

/* Headers */
.mh-cell.mh-head {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 4px;
}

/* Year Label */
/* Year Label */
.mh-cell.mh-year {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Center align like headers */
  height: 44px;
  /* Maintain height alignment with value cells */
}

/* Value Cells */
.mh-cell.mh-val {
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  /* Allow stacking */
  align-items: center;
  justify-content: center;
  height: 44px;
  line-height: 1.1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: default;
}

.mh-cell.mh-val:hover {
  transform: scale(1.1);
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  position: relative;
}

.mh-cell.mh-zero {
  color: transparent;
  /* Clean look if empty */
}

/* Total Cell */
.mh-cell.mh-total {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  height: 44px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .heatmap-modern-wrapper {
    overflow-x: auto;
    padding-bottom: 10px;
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .heatmap-modern-wrapper::-webkit-scrollbar {
    display: none;
  }

  .modern-heatmap-grid {
    min-width: 800px;
    /* Force horizontal scroll */
    gap: 4px;
  }

  .mh-cell.mh-val,
  .mh-cell.mh-total {
    height: 36px;
    font-size: 11px;
    border-radius: 4px;
  }
}

/* =======================
   Day-Hour Heatmap V2 (9 Time Slots)
======================= */
.day-hour-grid {
  display: grid;
  /* Label | 9 Time Slots | Total */
  grid-template-columns: 80px repeat(9, 1fr) 70px;
  gap: 6px;
  width: 100%;
  margin-top: 10px;
  align-items: center;
}

/* Mobile Responsive for Day-Hour */
@media (max-width: 768px) {
  .day-hour-grid {
    min-width: 700px;
    gap: 4px;
  }
}