/* =====================================================
   EE88 STREAM DASHBOARD — styles.css
   Dark industrial theme. Thuần CSS, không framework.
   ===================================================== */

/* =====================================================
   1. CSS VARIABLES / DESIGN TOKENS
   ===================================================== */
:root {
  /* --- Màu nền --- */
  --bg-base:        #0f1117;
  --bg-surface:     #1a1d27;
  --bg-elevated:    #2a2d37;

  /* --- Màu border --- */
  --border-default: #2a2d37;
  --border-light:   #1a1d27;

  /* --- Màu chữ --- */
  --text-primary:   #e0e0e0;
  --text-muted:     #888;
  --text-gold:      #ffd700;
  --text-gold-hover:#ffed4a;
  --text-white:     #fff;

  /* --- Màu trạng thái --- */
  --color-green:    #22c55e;
  --color-red:      #ef4444;
  --color-orange:   #f97316;
  --color-blue:     #3b82f6;
  --color-blue-hover:#2563eb;
  --color-red-hover: #dc2626;

  /* --- Alpha overlays --- */
  --green-bg:  #22c55e33;
  --red-bg:    #ef444433;
  --green-tag: #22c55e22;
  --red-tag:   #ef444422;
  --orange-tag:#f9731622;
  --blue-tag:  #3b82f622;

  /* --- Layout --- */
  --radius-sm:  4px;
  --radius-md:  6px;
  --font-ui:    -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}


/* =====================================================
   2. RESET & BASE
   ===================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
}

/* =====================================================
   MATERIAL SYMBOLS — icon sizing & alignment
   ===================================================== */
.material-symbols-rounded {
  font-size: 22px;
  line-height: 1;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}

/* Icon trong button icon-only (sync table) */
.btn-sync-one .material-symbols-rounded { font-size: 20px; }

/* Icon trong tab */
.tab .material-symbols-rounded          { font-size: 20px; }

/* Spin animation cho icon sync đang chạy */
.sync-status-running .material-symbols-rounded {
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* =====================================================
   3. HEADER
   ===================================================== */
.header {
  background: var(--bg-surface);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-default);
}

.header h1 {
  font-size: 18px;
  color: var(--text-gold);
}

/* --- Account bar --- */
.acct-bar {
  display: flex;
  gap: 8px;
  margin-left: auto;
  align-items: center;
  flex-wrap: wrap;
}

.acct-bar select,
.acct-bar input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-white);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.acct-bar select {
  min-width: 140px;
  cursor: pointer;
}
.acct-bar select option.alive { color: #4ade80; font-weight: 600; }
.acct-bar select option.dead  { color: #f87171; }

.acct-bar input.name-input   { width: 100px; }
.acct-bar input.cookie-input { width: 260px; }

.acct-bar button {
  border: none;
  padding: 5px 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.btn-add            { background: var(--text-gold);  color: #000; display: inline-flex; align-items: center; gap: 4px; }
.btn-add:hover      { background: var(--text-gold-hover); }
.btn-del            { background: var(--color-red);  color: var(--text-white); padding: 5px 9px; display: inline-flex; align-items: center; }
.btn-del:hover      { background: var(--color-red-hover); }

/* --- Cookie status badge --- */
.status {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 10px;
}
.status.on       { background: var(--green-bg);  color: var(--color-green); }
.status.off      { background: var(--red-bg);    color: var(--color-red); }
.status.checking { background: #2a2d37;          color: #aaa; }
.status.clickable { cursor: pointer; }
.status.clickable:hover { filter: brightness(1.25); }


/* =====================================================
   4. TABS NAV
   ===================================================== */
.btn-export-all {
  margin-left: 4px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #f97316, #ffd700);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  align-self: center;
  transition: opacity 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-export-all:hover { opacity: 0.85; }

.tabs {
  display: flex;
  gap: 2px;
  padding: 8px 20px;
  background: var(--bg-surface);
}

.tab {
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: 13px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tab.active { background: var(--bg-base); color: var(--text-gold); }
.tab:hover  { color: var(--text-white); }

/* Tab Đồng bộ — màu xanh */
.tab-sync               { color: var(--color-blue); }
.tab-sync:hover         { color: #60a5fa; }
.tab-sync.active        { background: var(--bg-base); color: var(--color-blue); }


/* =====================================================
   5. PANEL LAYOUT (chứa filter + table)
   ===================================================== */
.panel {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 99px); /* header ~57px + tabs ~42px */
  overflow: hidden;
}


/* =====================================================
   6. FILTERS BAR
   ===================================================== */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

.filters input,
.filters select {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-white);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.filters button {
  background: var(--color-blue);
  color: var(--text-white);
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.filters button:hover { background: var(--color-blue-hover); }

/* Badge tổng bản ghi trong filter bar */
.total-count-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(255,215,0,0.12);
  color: var(--text-gold);
  font-weight: 600;
  white-space: nowrap;
}

/* Quick-date select trong filters */
.filters select#f_quick_date {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-gold);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}


/* =====================================================
   7. INFO / COUNT LINE
   ===================================================== */
.info {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.info span {
  color: var(--text-gold);
  font-weight: 600;
}


/* =====================================================
   8. TABLE — BASE STYLES (dùng bên ngoài virtual scroller)
   ===================================================== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead { background: var(--bg-surface); }

th {
  padding: 8px 10px;
  text-align: center;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border-default);
  border-right:  1px solid var(--border-default);
  white-space: nowrap;
}
th:last-child { border-right: none; }

td {
  padding: 7px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  border-right:  1px solid var(--border-light);
  white-space: nowrap;
}
td:last-child { border-right: none; }

tr:hover { background: #1a1d2799; }

/* --- Money values --- */
.money      { color: var(--color-green); font-weight: 600; }
.money.neg  { color: var(--color-red); }

/* --- Tag badges --- */
.tag            { padding: 2px 6px; border-radius: 3px; font-size: 11px; }
.tag-green      { background: var(--green-tag);  color: var(--color-green); }
.tag-red        { background: var(--red-tag);    color: var(--color-red); }
.tag-orange     { background: var(--orange-tag); color: var(--color-orange); }
.tag-blue       { background: var(--blue-tag);   color: var(--color-blue); }


/* =====================================================
   9. FILTERS TOPBAR — count + load-more nằm trong filters bar
   ===================================================== */


.table-topbar__count {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.table-topbar__count b {
  color: var(--text-gold);
  font-weight: 600;
}

.table-topbar__load {
  background: var(--color-blue);
  color: var(--text-white);
  border: none;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s;
}
.table-topbar__load:hover { background: var(--color-blue-hover); }
.table-topbar__load span  { color: var(--text-gold); }

.load-more-bar {
  display: flex;
  justify-content: flex-end;
  padding: 6px 2px;
  flex-shrink: 0;
}


/* =====================================================
   10. VIRTUAL SCROLLER
   ===================================================== */
#tableArea {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#virtualScroller {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: scroll;
  overflow-x: auto;
  border: 1px solid var(--border-default);
  /* Ẩn scrollbar — chỉ scroll bằng nội dung */
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE/Edge */
}
#virtualScroller::-webkit-scrollbar { display: none; } /* Chrome/Safari */

/* Table bên trong scroller */
#virtualScroller table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
  background: var(--bg-base);
}

/* Sticky header bên trong scroller */
#virtualScroller thead {
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 10;
}

#virtualScroller thead th {
  padding: 8px 10px;
  text-align: center;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border-default);
  border-right:  1px solid var(--border-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#virtualScroller thead th:last-child { border-right: none; }

#virtualScroller tbody td {
  padding: 7px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  border-right:  1px solid var(--border-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#virtualScroller tbody td:last-child { border-right: none; }

#virtualScroller tbody tr:hover { background: #1a1d2799; }

/* Spacer rows dùng cho virtual scroll padding */
.vscroll-spacer { border: none !important; }


/* =====================================================
   10. LOAD MORE BUTTON
   ===================================================== */
.loadMoreContainer {
  text-align: center;
  padding: 12px;
  border-top: 1px solid var(--border-default);
  flex-shrink: 0;
}
.loadMoreContainer button {
  background: var(--color-blue);
  color: var(--text-white);
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}


/* =====================================================
   11. LOADING / EMPTY STATE
   ===================================================== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* --- Wave loading text --- */
.loading-wave {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 3px;
  padding: 48px 20px;
  min-height: 120px;
}

.loading-wave span {
  display: inline-block;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-gold);
  animation: waveChar 1.2s ease-in-out infinite;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
  line-height: 1;
}

/* Mỗi chữ delay lệch nhau 0.08s */
.loading-wave span:nth-child(1)  { animation-delay: 0.00s; }
.loading-wave span:nth-child(2)  { animation-delay: 0.08s; }
.loading-wave span:nth-child(3)  { animation-delay: 0.16s; }
.loading-wave span:nth-child(4)  { animation-delay: 0.24s; }
.loading-wave span:nth-child(5)  { animation-delay: 0.32s; }
.loading-wave span:nth-child(6)  { animation-delay: 0.40s; }
.loading-wave span:nth-child(7)  { animation-delay: 0.48s; }
.loading-wave span:nth-child(8)  { animation-delay: 0.56s; }
.loading-wave span:nth-child(9)  { animation-delay: 0.64s; }
.loading-wave span:nth-child(10) { animation-delay: 0.72s; }
.loading-wave span:nth-child(11) { animation-delay: 0.80s; }
.loading-wave span:nth-child(12) { animation-delay: 0.88s; }
.loading-wave span:nth-child(13) { animation-delay: 0.96s; }
.loading-wave span:nth-child(14) { animation-delay: 1.04s; }
.loading-wave span:nth-child(15) { animation-delay: 1.12s; }

@keyframes waveChar {
  0%, 100% {
    transform: translateY(0);
    color: var(--text-gold);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
  }
  40% {
    transform: translateY(-14px);
    color: #fff;
    text-shadow: 0 0 18px rgba(255, 215, 0, 0.9);
  }
}


/* =====================================================
   12. SUMMARY TABLE (total_data — nằm dưới cùng)
   ===================================================== */
.summary-table-wrap {
  flex-shrink: 0;
  overflow-x: auto;
  border-top: 2px solid var(--text-gold);
  margin-top: 4px;
  /* Ẩn scrollbar nhưng vẫn scroll được */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.summary-table-wrap::-webkit-scrollbar { display: none; }

.summary-table {
  width: max-content;        /* co giãn theo nội dung */
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: var(--bg-surface);
}

.summary-table thead th {
  padding: 6px 12px;
  text-align: center;
  color: var(--text-gold);
  font-weight: 600;
  font-size: 11px;
  border-right: 1px solid var(--border-default);
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.summary-table thead th:last-child { border-right: none; }

.summary-table tbody td {
  padding: 7px 12px;
  text-align: center;
  border-right: 1px solid var(--border-default);
  white-space: nowrap;
  font-weight: 600;
  font-size: 13px;
}
.summary-table tbody td:last-child { border-right: none; }

.summary-table__gold {
  color: var(--text-gold);
  font-size: 14px;
}


/* =====================================================
   14. EXPORT ALL MODAL
   ===================================================== */
#exportModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.export-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(3px);
}

.export-modal__box {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 28px 32px;
  min-width: 480px;
  max-width: 560px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.export-modal__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-gold);
  margin-bottom: 20px;
  text-align: center;
  letter-spacing: 0.5px;
}

/* --- Tab rows --- */
.export-modal__tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.et-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-radius: 6px;
  border: 1px solid var(--border-default);
  transition: border-color 0.2s;
}
.et-row.et-done  { border-color: var(--color-green); }
.et-row.et-error { border-color: var(--color-red); }

.et-icon { font-size: 16px; width: 22px; text-align: center; }

.et-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.et-count {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 120px;
  text-align: right;
}
.et-row.et-done  .et-count { color: var(--color-green); font-weight: 600; }
.et-row.et-error .et-count { color: var(--color-red); }

/* --- Overall progress bar --- */
.export-modal__overall {
  display: flex;
  align-items: center;
  gap: 12px;
}

.export-modal__bar {
  flex: 1;
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.export-modal__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-blue), var(--text-gold));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.export-modal__pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-gold);
  min-width: 36px;
  text-align: right;
}


/* =====================================================
   SYNC PAGE
   ===================================================== */
.sync-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 0;
}

/* Toolbar */
.sync-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 12px;
  flex-shrink: 0;
}
.sync-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-gold);
}
.sync-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sync-days-label {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.sync-days-input {
  width: 60px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-white);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: center;
}
.btn-sync-start {
  background: var(--color-blue);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-sync-start:hover { background: var(--color-blue-hover); }
.btn-sync-stop {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-default);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}
.btn-sync-stop:hover { color: var(--color-red); border-color: var(--color-red); }

/* Table */
.sync-table-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  scrollbar-width: thin;
  scrollbar-color: var(--bg-elevated) transparent;
}
.sync-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.sync-table thead th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
.sync-table thead th.col-agent { text-align: left; }
.sync-table tbody tr { border-bottom: 1px solid var(--border-light); }
.sync-table tbody tr:hover { background: var(--bg-elevated); }
.sync-table tbody tr:last-child { border-bottom: none; }
.sync-table td { padding: 7px 10px; vertical-align: middle; }

.sync-agent { font-weight: 600; color: var(--text-white); min-width: 100px; }
.sync-st    { min-width: 90px; }
.sync-empty { text-align: center; color: var(--text-muted); padding: 32px !important; }

/* Progress cell */
.sync-prog { min-width: 100px; text-align: center; }
.sync-dash { color: var(--bg-elevated); font-size: 13px; }

/* Progress bar */
.sb-wrap {
  height: 5px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 3px;
}
.sb {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.sb-run  { background: var(--color-blue); }
.sb-done { background: var(--color-green); }

.sb-num {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.sync-dr {
  font-size: 10px;
  color: var(--color-blue);
  margin-top: 2px;
  white-space: nowrap;
}

/* Status badges */
.ss {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.ss-idle { background: var(--bg-elevated); color: var(--text-muted); }
.ss-q    { background: var(--blue-tag);    color: var(--color-blue); }
.ss-run  { background: var(--blue-tag);    color: #60a5fa; animation: ss-pulse 1.2s infinite; }
.ss-done { background: var(--green-tag);   color: var(--color-green); }
.ss-err  { background: var(--red-tag);     color: var(--color-red); }
@keyframes ss-pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

.sync-err-msg {
  font-size: 10px;
  color: var(--color-red);
  margin-top: 2px;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Action buttons */
.sync-actions { text-align: center; white-space: nowrap; }
.bso {
  background: var(--color-blue);
  color: #fff;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  margin: 0 2px;
  transition: background 0.15s;
}
.bso:hover      { background: var(--color-blue-hover); }
.bso.bso-stop   { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border-default); }
.bso.bso-stop:hover  { color: var(--color-red); border-color: var(--color-red); }
.bso.bso-reset  { background: var(--bg-elevated); color: var(--text-gold); border: 1px solid var(--border-default); }
.bso.bso-reset:hover { background: var(--text-gold); color: #000; border-color: var(--text-gold); }
.bso.bso-del    { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border-default); }
.bso.bso-del:hover   { color: var(--color-red); border-color: var(--color-red); }

/* =====================================================
   SYNC DETAIL MODAL
   ===================================================== */
.sd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.sd-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  width: 96vw;
  max-width: 1400px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.sd-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-gold);
}

.sd-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sd-close:hover { color: var(--color-red); border-color: var(--color-red); }

.sd-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sd-loading, .sd-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-size: 13px;
}

.sd-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.sd-stat-label { color: var(--text-muted); }
.sd-stat-val   { color: var(--text-white); font-weight: 600; }

/* Table */
.sd-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-elevated) transparent;
}

.sd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.sd-table thead th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 8px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
.sd-table thead th:first-child { text-align: left; }

.sd-table tbody tr { border-bottom: 1px solid var(--border-light); }
.sd-table tbody tr:hover { background: #1a1d2744; }

.sd-table td {
  padding: 7px 12px;
  text-align: right;
  white-space: nowrap;
  color: var(--text-primary);
}
.sd-date { text-align: left !important; color: var(--text-muted); font-family: monospace; }
.sd-rc   { text-align: center !important; color: var(--text-muted); }

/* Grand total row — sticky dưới header */
.sd-grand td {
  background: #1a2035;
  color: var(--text-white);
  font-weight: 700;
  border-top: 2px solid var(--text-gold);
  border-bottom: 2px solid var(--text-gold);
  position: sticky;
  top: 31px;
  z-index: 1;
}
.sd-grand td:first-child { color: var(--text-gold); text-align: left; }

/* Positive/negative numbers */
.sd-pos { color: var(--color-green); }
.sd-neg { color: var(--color-red); }

/* Clickable progress cell */
.sync-prog-click {
  cursor: pointer;
  transition: background 0.15s;
}
.sync-prog-click:hover {
  background: var(--bg-elevated);
}
.sync-prog-click:hover .sb-wrap {
  opacity: 0.85;
}
