

:root{
  --bg: #edf3ef;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --text: #102a43;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --border: #e5e7eb;

  --brand-900: #064e3b;
  --brand-800: #065f46;
  --brand-700: #047857;
  --brand-600: #10b981;

  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 14px;

  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(0, 139, 77, 0.05);

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;

  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-15: 15px;
  --fs-18: 18px;
  --fs-22: 22px;

  --maxw: 1220px;
}

.expense-dashboard-body1{
  margin: 0;
  background: var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
}

/* Outer wrapper */
.expense-dashboard-wrapper{
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: var(--s-7) var(--s-4);
  box-sizing: border-box;
  background: var(--bg);
}

.expense-dashboard-inner{
  width: 100%;
  max-width: var(--maxw);
}

/* Main card */
.expense-layout{
  width: 100%;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px 24px 26px;
  box-sizing: border-box;
}

/* Header */
.expense-layout__header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: var(--s-4);
}

.expense-layout__header-left{ min-width: 0; }

.expense-layout__title-row{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.expense-layout__title{
  font-size: var(--fs-22);
  font-weight: 650;
  margin: 0;
  color: var(--brand-900);
}

.expense-layout__title-pill{
  font-size: var(--fs-12);
  padding: 4px 10px;
  border-radius: 999px;
  background: #e0f2f1;
  color: var(--brand-700);
  border: 1px solid rgba(4, 120, 87, 0.2);
}

.expense-layout__subtitle{
  margin: 6px 0 0;
  font-size: var(--fs-13);
  color: var(--muted);
}

.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
}

.expense-layout__header-right{
  display: flex;
  align-items: flex-end;
  gap: var(--s-4);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.expense-month-switcher__label{
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-12);
  color: #4b5563;
}

.expense-month-switcher__label span{
  font-weight: 600;
  color: var(--brand-700);
}

.expense-month-switcher__label select{
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #d1fae5;
  background: #f0fdf4;
  font-size: var(--fs-13);
  color: var(--brand-900);
  outline: none;
}

.expense-month-switcher__label select:focus{
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.18);
}

/* Header stats */
.expense-header-stats{
  display: flex;
  align-items: stretch;
  gap: var(--s-3);
}

.expense-header-stat{
  min-width: 120px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-align: right;
}

.expense-header-stat__label{
  display: block;
  font-size: var(--fs-11);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  margin-bottom: 2px;
}

.expense-header-stat__value{
  font-size: var(--fs-14);
  font-weight: 650;
  color: #111827;
}

/* Grid layout (responsive by default) */
.expense-layout__grid{
  margin-top: var(--s-3);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
}

/* When enough space, switch to 2 cols */
@media (min-width: 980px){
  .expense-layout__grid{
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1.1fr);
  }
}

/* Panels */
.expense-panel{
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  padding: 14px 14px 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.expense-panel__header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}

.expense-panel__header--chart{ margin-bottom: var(--s-2); }

.expense-panel__title{
  font-size: var(--fs-15);
  font-weight: 650;
  margin: 0 0 2px;
  color: #0f5132;
}

.expense-panel__subtitle{
  margin: 0;
  font-size: var(--fs-12);
  color: var(--muted);
}

.expense-panel__badge-row{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Chips */
.chip{
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-11);
  border-radius: 999px;
  padding: 3px 10px;
  border: 1px solid transparent;
  line-height: 1.2;
}

.chip--soft{
  background: #e0f2f1;
  color: var(--brand-700);
  border-color: rgba(4,120,87,0.35);
}

.chip--outline{
  background: var(--surface-2);
  color: #4b5563;
  border-color: var(--border);
}

.expense-panel__empty-chart{
  margin-top: var(--s-4);
  font-size: var(--fs-13);
  color: var(--muted-2);
}


.expense-panel--table{ min-height: 260px; }


/* 1) Outer: giữ border + bo góc, nhưng scroll ngang vẫn ok */
.expense-table__outer{
  margin-top: 4px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #fff;

  /* Quan trọng: clip bo góc */
  overflow: hidden;

  /* Quan trọng: vẫn scroll ngang */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 2) Table: để riêng border model cho ổn định */
.expense-table{
  width: 100%;
  min-width: 640px;           /* mobile không bó cột */
  border-collapse: separate;
  border-spacing: 0;
}

/* 3) Bo góc trực tiếp cho 2 ô th góc trên để nền xanh “ăn” bo góc */
.expense-table thead th:first-child{
  border-top-left-radius: 14px;
}
.expense-table thead th:last-child{
  border-top-right-radius: 14px;
}

/* 4) Nếu bạn muốn bo góc đáy luôn (khi scroll vẫn đẹp) */
.expense-table tbody tr:last-child td:first-child{
  border-bottom-left-radius: 14px;
}
.expense-table tbody tr:last-child td:last-child{
  border-bottom-right-radius: 14px;
}

/* 5) Tránh cảm giác double-line ở phần body */
.expense-table tbody tr{ border-bottom: 0; }   /* bỏ border ở tr */
.expense-table td{ border-bottom: 1px solid #e5e7eb; }
.expense-table tbody tr:last-child td{ border-bottom: 0; }

/* (Optional) nếu vẫn thấy Safari/Chrome clip hơi “lạ” */
.expense-table__outer{
  -webkit-mask-image: -webkit-radial-gradient(white, black);
}


.expense-table{
  width: 100%;
  min-width: 640px;           
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-13);
}

.expense-table thead{
  background: linear-gradient(90deg, #008b4d, #00aa63);
  color: #f9fafb;
}

.expense-table th,
.expense-table td{
  padding: 9px 12px;
  vertical-align: middle;
}

.expense-table th{
  font-weight: 600;
  font-size: var(--fs-11);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(15,23,42,0.12);
  white-space: nowrap;
}

.expense-table tbody tr:nth-child(even){ background: var(--surface-2); }
.expense-table tbody tr:hover{ background: #ecfdf5; }

.expense-table__empty{
  text-align: center;
  padding: 20px 12px;
  color: var(--muted-2);
  font-size: var(--fs-13);
}

.col-stt{
  width: 56px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.col-date{
  width: 110px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.col-name{ width: 52%; }
.col-group{ width: 20%; }
.col-amount{
  width: 18%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.expense-name-cell{
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
}

.expense-name-cell__dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.18);
  flex: 0 0 auto;
}

.expense-name-cell__text{
  min-width: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.group-pill{
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: var(--fs-11);
  background: #edf2ff;
  color: #3730a3;
  border: 1px solid rgba(129,140,248,0.5);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.amount-text{
  font-weight: 650;
  color: var(--brand-800);
}


.expense-panel--chart{ min-height: 260px; }

.expense-chart-card{
  margin-top: var(--s-2);
  background: radial-gradient(circle at top left, #e6f4ec 0, #ffffff 58%);
  border-radius: var(--r-md);
  border: 1px solid rgba(0,139,77,0.25);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.expense-chart-main{
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
  align-items: center;
}

@media (min-width: 520px){
  .expense-chart-main{
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: var(--s-2);
  }
}

.expense-chart-main__canvas{
  position: relative;
  max-width: 280px;
  margin: 0 auto;
}

.expense-chart-main__canvas canvas{
  width: 100% !important;
  height: auto !important;
}

.expense-chart-main__center{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.center-percent{
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-900);
}
.center-label{
  margin-top: 2px;
  font-size: var(--fs-11);
  color: #4b5563;
}

.expense-chart-main__summary{
  text-align: left;
}

.summary-label{
  margin: 0 0 4px;
  font-size: var(--fs-11);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.summary-value{
  margin: 0;
  font-size: var(--fs-18);
  font-weight: 750;
  color: #022c22;
}
.summary-muted{
  margin: 4px 0 0;
  font-size: var(--fs-12);
  color: var(--muted);
}

.expense-chart-legend{
  margin-top: 2px;
  padding-top: var(--s-2);
  border-top: 1px dashed rgba(15,23,42,0.12);
}

.legend-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--fs-12);
  padding: 4px 0;
}

.legend-row__left{
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.legend-row__right{
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 0 0 auto;
}

.legend-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.legend-label{
  color: #374151;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  min-width: 0;
  max-width: 32ch;
}

.legend-amount{
  font-variant-numeric: tabular-nums;
  color: #111827;
}
.legend-percent{
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.legend-dot--c1{ background: #008b4d; }
.legend-dot--c2{ background: #00aa63; }
.legend-dot--c3{ background: #f4b000; }
.legend-dot--c4{ background: #3b82f6; }
.legend-dot--c5{ background: #8b5cf6; }
.legend-dot--c6{ background: #f97316; }


@media (max-width: 640px){
  .expense-dashboard-wrapper{ padding: 18px 10px; }
  .expense-layout{
    padding: 16px 14px 18px;
    border-radius: 18px;
  }
  .expense-layout__title{ font-size: 19px; }

  .expense-layout__header{
    flex-direction: column;
    align-items: flex-start;
  }
  .expense-layout__header-right{
    width: 100%;
    justify-content: flex-start;
  }

  .expense-header-stats{
    width: 100%;
    flex-wrap: wrap;
  }
  .expense-header-stat{
    flex: 1 1 160px;
    min-width: 0;
  }
}
.expense-layout .button,
.expense-layout button,
.expense-layout fieldset,
.expense-layout input,
.expense-layout select,
.expense-layout textarea{
  margin-bottom: 0 !important;
}
/* RESET padding cho bảng expense (đè các rule td:first-child/last-child global) */
.expense-table th,
.expense-table td{
  padding: 8px 12px !important;
}

/* nếu bạn muốn cột # (first) hơi sát hơn */
.expense-table th:first-child,
.expense-table td:first-child{
  padding-left: 12px !important;
  padding-right: 12px !important;
}

/* nếu bạn muốn cột tiền (last) có khoảng thở bên phải */
.expense-table th:last-child,
.expense-table td:last-child{
  padding-left: 12px !important;
  padding-right: 12px !important;
}
/* .col-stt,.col-date{color:white} */