/* =========================================================
   OVERVIEW CANVAS & SVG
========================================================= */

.overview-canvas {
  position: absolute;
  inset: 0;
  z-index: 5;               /* trên grid */
}

/* SVG chỉ để vẽ connector, không bao giờ chặn click */
.overview-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;               /* dưới box */
}

/* =========================================================
   OVERVIEW BOX
========================================================= */

.overview-box {
  position: absolute;
  z-index: 10;              /* LUÔN nằm trên cùng */
  pointer-events: auto;     /* đảm bảo nhận click */
  background: #f4f8ff;
  border: 1px solid #0e42ab;
  border-radius: 6px;
  padding: 6px 8px;
  text-align: center;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column; 
}
#overview-canvas{margin-top:30px}
.overview-box:hover {
  background: #D2E3FF;              /* xanh nhạt như toolbar */
  border-color: #93c5fd;             /* blue-300 */
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.45),
    0 4px 8px rgba(30, 64, 175, 0.15);
}

/* =========================================================
   BOX CONTENT
========================================================= */

.overview-box .box-title {
  font-weight: 600;
  font-size: 12px;
  padding-bottom: 4px;
  margin-bottom: 2px;
  border-bottom: 1px solid #cbd5e1;
  color: #0e42ab;
}

.overview-box .box-sub {
  font-size: 10px;
  line-height: 1.2;
  white-space: pre-line;
  color: #0e42ab;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}




 


/* =========================================================
   BOX VALUES (NORMAL FORMS)
========================================================= */

.box-values {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  text-align: center;
}

.box-values div {
  line-height: 18px;
}

/* =========================================================
   BOX VALUES – FORM 05 (CENTERED)
========================================================= */

.box-values-incomeStatement {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
  color: #374151;
  text-align: center;

  pointer-events: none;     /* value không chặn click box */
}

/* Separator line */
.box-values-incomeStatement div:last-child::before {
  content: "";
  display: block;
  width: 60%;
  margin: 4px auto 0;
  border-bottom: 1px solid #94a3b8;
}

/* =========================================================
   GRID (EXCEL BACKGROUND) – PHẢI NẰM DƯỚI
========================================================= */

#colHeaders,
#rowHeaders,
#gridInner {
  position: relative;
  z-index: 1;
  pointer-events: none;     /* QUAN TRỌNG: grid chỉ để nhìn */
}

/* =========================================================
   TOOLBAR / SHEET TAB (GIỮ NGUYÊN)
========================================================= */

.toolbar-hoversoft {
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.toolbar-hoversoft:hover {
  background-color: #e8f0fe;
  border-color: #60a5fa;
  color: #1e3a8a;
}

.sheet-tab {
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  border-bottom: none;
  background: #f9fafb;
  color: #374151;
  cursor: pointer;
}

.sheet-tab:hover {
  background: #f3f4f6;
  color: #2563eb !important;
}


#planning-overview {
  height: 100%;
}
#planning-overview-container {
  height: 100%;
}

/* =========================
   GRID VARIABLES (EXCEL)
   ========================= */
:root {
  --row-h: 18px;
  --col-w: 96px;
  --row-header-w: 40px;
}

/* =========================
   GRID WRAPPER (ABSOLUTE)
   ========================= */
#planning-overview {
  position: absolute;
  inset: 0;
}

/* =========================
   COLUMN HEADERS
   ========================= */
#colHeaders {
  position: absolute;
  top: 0;
  left: var(--row-header-w);
  right: 0;

  height: var(--row-h);
  display: flex;

  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  z-index: 2;

  box-sizing: border-box;
  pointer-events: none;
}

/* =========================
   COLUMN HEADER CELLS
   ========================= */
.col-header-cell {
  width: var(--col-w);
  min-width: var(--col-w);
  max-width: var(--col-w);

  height: var(--row-h);
  line-height: var(--row-h);

  text-align: center;
  box-sizing: border-box;
  border-right: 1px solid #e5e7eb;
  flex: 0 0 var(--col-w);   /* QUAN TRỌNG */
}


/* =========================
   ROW HEADERS
   ========================= */
#rowHeaders {
  position: absolute;
  top: var(--row-h);
  left: 0;
  bottom: 0;

  width: var(--row-header-w);

  background: #f9fafb;
  border-right: 1px solid #e5e7eb;
  z-index: 2;

  box-sizing: border-box;
  pointer-events: none;
}

.row-header-cell {
  height: var(--row-h);
  line-height: var(--row-h);
  text-align: right;
  padding-right: 6px;
  box-sizing: border-box;
}

/* =========================
   GRID BACKGROUND
   ========================= */
#gridInner {
  position: absolute;
  top: var(--row-h);
  left: var(--row-header-w);
  right: 0;
  bottom: 0;

  z-index: 1;
  pointer-events: none;

  background-image:
    linear-gradient(to right, #e5e7eb 1px, transparent 1px),
    linear-gradient(to bottom, #e5e7eb 1px, transparent 1px);

  background-size:
    var(--col-w) var(--row-h),
    var(--col-w) var(--row-h);

  /* QUAN TRỌNG: KHÓA GỐC GRID */
  background-position: 0 0;
}
.row-headers{
  margin-top: 1px ;
}
.col-headers{
  margin-left: 1px;

}


/* =========================================================
   FIXED OVERVIEW DESIGN COORDINATES
   DevTools / viewport changes clip the canvas; they do not
   resize or recenter the business flowchart.
   ========================================================= */
:root {
  --overview-design-width: 1400px;
}

#planning-overview {
  min-width: var(--overview-design-width);
}

#overview-canvas,
.overview-canvas {
  left: 0;
  right: auto;
  width: var(--overview-design-width);
}

#colHeaders,
#gridInner {
  right: auto;
  width: calc(var(--overview-design-width) - var(--row-header-w));
}
