.sheets-content {
  padding: 24px;
}

.sheets-top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.sheets-top h1 {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

.sheets-top p {
  margin: 4px 0 0;
  font-weight: 600;
  font-size: 13px;
  color: #64748b;
}

.sheets-top p a {
  color: var(--green);
  text-decoration: none;
}

.sheets-top small {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  color: #94a3b8;
}

.sheets-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.sheets-actions button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-pull-sheet {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
}

.btn-pull-sheet:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-open-sheet {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
}

.btn-open-sheet:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.sheets-actions .primary {
  color: #fff;
  border: none;
  background: #008a4b;
  box-shadow: 0 2px 8px rgba(0, 138, 75, 0.25);
}

.sheets-actions .primary:hover {
  background: #00733e;
}

/* ============================================================
   STATS CARDS (CLEAN & ALIGNED)
============================================================ */
.sheets-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
}

.icon-wrap svg {
  width: 22px;
  height: 22px;
}

.icon-wrap.green { color: #059669; background: #ecfdf5; }
.icon-wrap.blue { color: #2563eb; background: #eff6ff; }
.icon-wrap.yellow { color: #d97706; background: #fffbeb; }
.icon-wrap.purple { color: #7c3aed; background: #f5f3ff; }

.stat-card > div {
  flex: 1;
  min-width: 0;
}

.stat-card p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.stat-card strong {
  display: block;
  margin: 2px 0;
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card small {
  margin: 0;
  color: #94a3b8;
  font-size: 11.5px;
  display: block;
}

.text-green {
  color: #059669 !important;
}

/* ============================================================
   WORKSPACE & MAIN PANELS
============================================================ */
.sheets-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
}

@media (max-width: 1100px) {
  .sheets-workspace {
    grid-template-columns: 1fr;
  }
}

.sheets-main-panel {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

/* MODERN PILL TABS (NEVER GETS HIDDEN OR CUT OFF) */
.sheets-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.sheets-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.sheets-tabs button:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}

.sheets-tabs button.active {
  background: #008a4b !important;
  color: #ffffff !important;
  border-color: #008a4b !important;
  box-shadow: 0 2px 8px rgba(0, 138, 75, 0.3) !important;
}

/* Script Banner Card */
.script-banner-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 22px;
  border: 1.5px solid #a7f3d0;
  border-radius: 12px;
  background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.08);
}

.sbc-icon {
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.sbc-text {
  flex: 1;
  min-width: 0;
}

.sbc-text h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 800;
  color: #065f46;
}

.sbc-text p {
  margin: 0;
  font-size: 12.5px;
  color: #047857;
  line-height: 1.4;
}

.btn-goto-guide {
  height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: #059669;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25);
  transition: all 0.2s ease;
}

.btn-goto-guide:hover {
  background: #047857;
  transform: translateY(-1px);
}

/* Tab Panes */
.tab-pane {
  display: none;
  padding: 24px;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.panel-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-box-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 800;
  color: #1e293b;
}

.panel-box-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* Real-time Toggle Switch */
.live-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--green);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 13px;
  color: #1e293b;
}

/* Form Styles */
.config-form .form-group {
  margin-bottom: 20px;
}

.config-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 13.5px;
  color: #1e293b;
}

.config-form .req {
  font-size: 12px;
  color: #ef4444;
  font-weight: 500;
  margin-left: 6px;
}

.input-with-action {
  display: flex;
  gap: 10px;
}

.input-with-action input,
.config-form input[type="url"] {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13.5px;
  outline: none;
  background: #fdfefe;
  transition: border-color 0.2s ease;
}

.input-with-action input:focus,
.config-form input[type="url"]:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 159, 99, 0.12);
}

.btn-test {
  height: 44px;
  padding: 0 16px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-test:hover {
  background: #dbeafe;
}

.config-form small {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

/* Checkbox Modules */
.sheet-modules-selection {
  margin: 24px 0 20px;
  padding: 16px 18px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.sheet-modules-selection h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 800;
  color: #1e293b;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.custom-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}

.custom-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.form-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

.btn-save-config {
  height: 44px;
  padding: 0 24px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 159, 99, 0.25);
  transition: all 0.2s ease;
}

.btn-save-config:hover {
  background: #0d8a56;
}

.save-status {
  font-size: 13.5px;
  font-weight: 700;
  color: #059669;
}

/* ============================================================
   TAB 2: BULK SYNC CARDS (BALANCED RESPONSIVE GRID)
============================================================ */
.bulk-sync-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

@media (max-width: 900px) {
  .bulk-sync-grid {
    grid-template-columns: 1fr;
  }
}

.bulk-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
  min-height: 210px;
  box-sizing: border-box;
}

.bulk-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.bulk-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.bc-icon {
  display: flex;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
}

.bc-icon svg {
  width: 24px;
  height: 24px;
}

.bc-icon.green { color: #059669; background: #ecfdf5; }
.bc-icon.blue { color: #2563eb; background: #eff6ff; }
.bc-icon.purple { color: #7c3aed; background: #f5f3ff; }
.bc-icon.yellow { color: #d97706; background: #fffbeb; }

.bulk-card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.bulk-card p {
  margin: 0 0 20px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.55;
  flex: 1;
}

.btn-bulk-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  padding: 0 18px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.btn-bulk-item:hover {
  background: #008a4b;
  color: #ffffff;
  border-color: #008a4b;
  box-shadow: 0 3px 10px rgba(0, 138, 75, 0.28);
}

/* ============================================================
   TAB 3: LOGS TABLE
============================================================ */
.btn-clear-logs {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
}

.btn-clear-logs:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.logs-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.logs-table th,
.logs-table td {
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  text-align: left;
  font-size: 12.5px;
  white-space: nowrap;
}

.logs-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 800;
}

.badge-log {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
}

.badge-log.success {
  color: #065f46;
  background: #d1fae5;
}

.badge-log.error {
  color: #991b1b;
  background: #fee2e2;
}

.empty-logs {
  text-align: center !important;
  color: #94a3b8;
  padding: 30px !important;
}

/* ============================================================
   TAB 4: SETUP GUIDE & CODE (CLEAN WRAPPING, NO CUTOFF)
============================================================ */
.guide-steps {
  display: grid;
  gap: 18px;
}

.step-card {
  display: flex;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  box-sizing: border-box;
  max-width: 100%;
  align-items: flex-start;
}

.step-num {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: #008a4b;
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 138, 75, 0.25);
}

.step-body {
  flex: 1 1 0%;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.step-body h3 {
  margin: 0 0 6px;
  font-size: 15.5px;
  font-weight: 800;
  color: #1e293b;
  word-break: break-word;
}

.step-body p {
  margin: 0;
  font-size: 13.5px;
  color: #475569;
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: break-word;
}

.step-body a {
  color: #008a4b;
  font-weight: 700;
  text-decoration: underline;
  word-break: break-all;
}

.step-body ul {
  margin: 10px 0 0;
  padding-left: 20px;
  font-size: 13px;
  color: #475569;
  line-height: 1.6;
}

.code-box-wrap {
  position: relative;
  margin-top: 14px;
  background: #0f172a;
  border-radius: 10px;
  overflow: hidden;
  max-width: 100%;
}

.btn-copy-code {
  position: absolute;
  top: 10px;
  right: 12px;
  height: 32px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 5;
}

.btn-copy-code:hover {
  background: #008a4b;
}

.code-box-wrap pre {
  margin: 0;
  padding: 18px;
  max-height: 340px;
  overflow: auto;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  box-sizing: border-box;
}

/* ============================================================
   SIDE CARDS
============================================================ */
.sheets-side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.side-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.side-card h2 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 800;
  color: #1e293b;
}

.side-card p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.feature-item {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.feature-item:last-child {
  margin-bottom: 0;
}

.f-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.f-dot.green { background: #10b981; }
.f-dot.blue { background: #3b82f6; }
.f-dot.purple { background: #8b5cf6; }

.feature-item b {
  display: block;
  font-size: 13.5px;
  color: #1e293b;
}

.feature-item p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.btn-wa-help {
  display: block;
  text-align: center;
  padding: 10px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-wa-help:hover {
  background: #dcfce7;
}

/* ============================================================
   RESPONSIVE DESIGN (DESKTOP / TABLET / MOBILE)
============================================================ */
@media (max-width: 1100px) {
  .sheets-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .sheets-workspace {
    grid-template-columns: 1fr;
  }
  .bulk-sync-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sheets-content {
    padding: 72px 14px 24px !important;
  }

  .sheets-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .sheets-top h1 {
    font-size: 20px;
    line-height: 1.3;
  }

  .sheets-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .sheets-actions button {
    width: 100%;
    justify-content: center;
    flex: 1;
  }

  .sheets-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Tabs: Smooth horizontal swipe with clean pill buttons */
  .sheets-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    padding: 10px 12px !important;
    gap: 6px !important;
  }

  .sheets-tabs::-webkit-scrollbar {
    display: none !important;
  }

  .sheets-tabs button {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    font-size: 12.5px !important;
    height: 36px !important;
    padding: 0 12px !important;
  }

  /* Banner Card Script: Stack vertically to prevent squished text */
  .script-banner-card {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    padding: 14px 16px !important;
  }

  .sbc-icon {
    width: 38px !important;
    height: 38px !important;
    font-size: 22px !important;
  }

  .sbc-text {
    width: 100% !important;
  }

  .sbc-text h3 {
    font-size: 15px !important;
    line-height: 1.4 !important;
    word-break: normal !important;
    white-space: normal !important;
    margin-bottom: 6px !important;
  }

  .sbc-text p {
    font-size: 12.5px !important;
    line-height: 1.5 !important;
    word-break: normal !important;
    white-space: normal !important;
  }

  .script-banner-card .btn-goto-guide,
  .script-banner-card #btnQuickCopyScript {
    width: 100% !important;
    justify-content: center !important;
    height: 40px !important;
    margin-top: 4px !important;
  }

  /* Input with action & test connection buttons */
  .input-with-action {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .input-with-action input,
  .config-form input[type="url"] {
    width: 100% !important;
    height: 44px !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
  }

  .input-with-action .btn-test,
  .input-with-action button {
    width: 100% !important;
    height: 42px !important;
    margin: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  /* Form footer actions */
  .form-footer {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .form-footer button,
  .form-footer .btn-save-config,
  .form-footer .btn-goto-guide {
    width: 100% !important;
    margin-left: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    box-sizing: border-box !important;
  }

  .tab-pane {
    padding: 16px 14px !important;
  }

  .panel-box-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  /* Service Email banner */
  #serviceEmailBanner {
    padding: 12px !important;
  }

  #serviceEmailBanner > div {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  #serviceEmailBanner code {
    word-break: break-all !important;
    white-space: normal !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  #btnCopyClientEmail {
    width: 100% !important;
    height: 38px !important;
  }

  /* Step guide */
  .step-card {
    flex-direction: column !important;
    padding: 14px !important;
    gap: 10px !important;
  }

  .code-box-wrap pre {
    padding: 48px 12px 14px !important;
    font-size: 11px !important;
  }

  .btn-copy-code {
    top: 8px !important;
    right: 8px !important;
    left: 8px !important;
    width: calc(100% - 16px) !important;
    text-align: center !important;
  }

  /* Embed toolbar & input */
  .embed-header-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 12px 14px !important;
  }

  .embed-header-actions {
    width: 100% !important;
  }

  .btn-embed-action {
    flex: 1 !important;
    justify-content: center !important;
  }

  .embed-url-input-wrap {
    flex-direction: column !important;
    width: 100% !important;
  }

  .embed-url-input-wrap input,
  .embed-url-input-wrap button {
    width: 100% !important;
  }

  /* Spreadsheet toolbar & subtabs */
  .sheet-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 12px 14px !important;
  }

  .sheet-toolbar-actions {
    width: 100% !important;
  }

  .btn-sheet-tool {
    flex: 1 !important;
  }

  .sheet-subtabs-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 8px 10px !important;
  }

  .sheet-search-wrap,
  .sheet-search-wrap input {
    width: 100% !important;
  }

  /* Formula Bar: Horizontal Scroll on Mobile to keep Total Sum visible */
  .sheet-formula-bar {
    display: flex !important;
    align-items: center !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    white-space: nowrap !important;
    gap: 8px !important;
    padding: 8px 10px !important;
  }

  .sheet-formula-bar::-webkit-scrollbar {
    display: none !important;
  }

  .fx-label {
    flex-shrink: 0 !important;
  }

  .fx-input {
    flex: 1 0 auto !important;
    min-width: 140px !important;
    max-width: 220px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .fx-result-pill {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .fx-result-pill span,
  .fx-result-pill strong {
    white-space: nowrap !important;
  }

  .sheet-kpi-bar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    padding: 10px 14px !important;
  }
}

/* ============================================================
   LIVE SPREADSHEET VIEWER (GOOGLE SHEETS TABLE STYLES)
============================================================ */
.spreadsheet-container {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.sheet-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.sheet-title-info {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 300px;
}

.sheet-file-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.sheet-file-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: #0f172a;
  flex-wrap: wrap;
}

.sheet-cloud-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 10px;
  white-space: nowrap;
}

.sheet-meta-info {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-top: 3px;
  line-height: 1.4;
}

.sheet-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-sheet-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #1e293b;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-sheet-tool:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-sheet-tool.primary {
  background: #008a4b;
  color: #ffffff;
  border-color: #008a4b;
  box-shadow: 0 2px 8px rgba(0, 138, 75, 0.25);
}

.btn-sheet-tool.primary:hover {
  background: #00733e;
}

/* Formula Bar */
.sheet-formula-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.fx-label {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #94a3b8;
  font-weight: 900;
  font-style: italic;
  font-size: 13px;
  flex-shrink: 0;
}

.fx-input {
  flex: 1;
  font-size: 12.5px;
  color: #0f172a;
  background: #f8fafc;
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.fx-result-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: #065f46;
  white-space: nowrap;
  flex-shrink: 0;
}

.fx-result-pill strong {
  font-size: 13px;
  color: #047857;
  white-space: nowrap;
}

/* ============================================================
   REAL-TIME BREAKDOWN PANEL (INDO-CAIRO, CAIRO-INDO, BANK)
============================================================ */
.sheet-breakdown-panel {
  padding: 14px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.breakdown-direction-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

@media (max-width: 900px) {
  .breakdown-direction-grid {
    grid-template-columns: 1fr;
  }
}

.direction-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.direction-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.direction-card.active {
  border-width: 2px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.direction-card.indo-cairo {
  background: linear-gradient(135deg, #f0fdf4 0%, #e6f7ef 100%);
  border-color: #bbf7d0;
}

.direction-card.indo-cairo.active {
  border-color: #10b981;
  background: #ecfdf5;
}

.direction-card.cairo-indo {
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
  border-color: #bfdbfe;
}

.direction-card.cairo-indo.active {
  border-color: #3b82f6;
  background: #eff6ff;
}

.direction-card.tukar-cash {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fde68a;
}

.direction-card.tukar-cash.active {
  border-color: #d97706;
  background: #fef3c7;
}

.direction-card.grand-total {
  background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
  border-color: #f5d0fe;
}

.direction-card.grand-total.active {
  border-color: #a855f7;
  background: #faf5ff;
}

.direction-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.direction-flag {
  font-size: 14px;
  font-weight: 800;
}

.direction-pill {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.direction-pill.indo {
  background: #dcfce7;
  color: #15803d;
}

.direction-pill.cairo {
  background: #dbeafe;
  color: #1d4ed8;
}

.direction-pill.cash {
  background: #fef3c7;
  color: #b45309;
}

.direction-pill.all {
  background: #f3e8ff;
  color: #7e22ce;
}

.direction-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  background: rgba(255, 255, 255, 0.8);
  padding: 2px 6px;
  border-radius: 6px;
}

.direction-amount {
  font-size: 20px;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.2;
}

.direction-card.indo-cairo .direction-amount {
  color: #047857;
}

.direction-card.cairo-indo .direction-amount {
  color: #1d4ed8;
}

.direction-card.tukar-cash .direction-amount {
  color: #b45309;
}

.direction-card.grand-total .direction-amount {
  color: #7e22ce;
}

.direction-sub {
  font-size: 11px;
  color: #64748b;
}

/* Bank Breakdown Section */
.bank-breakdown-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.bank-breakdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bank-breakdown-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
}

.active-filter-tag {
  padding: 2px 8px;
  border-radius: 6px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 800;
}

.btn-clear-bank-filter {
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-clear-bank-filter:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.bank-chips-grid {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.bank-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 12px;
  color: #1e293b;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.bank-chip:hover {
  border-color: #008a4b;
  background: #f0fdf4;
  transform: translateY(-1px);
}

.bank-chip.active {
  background: #008a4b !important;
  color: #ffffff !important;
  border-color: #008a4b !important;
  box-shadow: 0 2px 8px rgba(0, 138, 75, 0.25);
}

.bank-chip.active b,
.bank-chip.active span,
.bank-chip.active em {
  color: #ffffff !important;
}

.bank-chip-name {
  font-weight: 800;
}

.bank-chip-amount {
  font-weight: 800;
  color: #047857;
}

.bank-chip-count {
  font-size: 10.5px;
  color: #64748b;
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Badges inside spreadsheet cells */
.badge-direction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 11.5px;
}

.badge-direction.indo {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.badge-direction.cairo {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.badge-direction.cash {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-bank {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 11.5px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.badge-bank.dana { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-bank.gopay { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.badge-bank.jago { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-bank.seabank { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.badge-bank.bsi { background: #f0fdfa; color: #0f766e; border-color: #99f6e4; }
.badge-bank.bca { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.badge-bank.bri { background: #f8fafc; color: #1e293b; border-color: #cbd5e1; }
.badge-bank.bni { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.badge-bank.mandiri { background: #fefce8; color: #854d0e; border-color: #fef08a; }


/* Sheet Subtabs Bar */
.sheet-subtabs-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
}

.sheet-tabs-list {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.sheet-subtab {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.sheet-subtab:hover {
  background: #e2e8f0;
}

.sheet-subtab.active {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.badge-count {
  background: #e2e8f0;
  color: #334155;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10.5px;
  font-weight: 800;
}

.sheet-subtab.active .badge-count {
  background: #ecfdf5;
  color: #047857;
}

.sheet-search-wrap input {
  height: 30px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
  background: #fff;
  width: 180px;
}

.sheet-search-wrap input:focus {
  border-color: var(--green);
}

/* Grid Table */
.spreadsheet-grid-wrap {
  width: 100%;
  max-height: 480px;
  overflow: auto;
  position: relative;
  background: #fff;
}

.spreadsheet-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  font-size: 12.5px;
}

/* Column Letter Header (Row 0: A, B, C...) */
.spreadsheet-table thead tr.col-letters-row th {
  background: #f8fafc;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  border: 1px solid #e2e8f0;
  padding: 4px 6px;
}

.spreadsheet-table thead tr.col-headers-row th {
  background: #008a4b;
  color: #ffffff;
  font-weight: 800;
  padding: 10px 14px;
  border: 1px solid #00753f;
  text-align: left;
  white-space: nowrap;
}

.spreadsheet-table td {
  padding: 9px 12px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
  color: #1e293b;
}

.spreadsheet-table tr:hover td {
  background: #f0fdf4 !important;
}

/* Row Number Cell (Leftmost Column) */
.row-num-cell {
  background: #f8fafc !important;
  color: #94a3b8 !important;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  width: 38px;
  min-width: 38px;
  border-right: 2px solid #cbd5e1 !important;
  user-select: none;
}

/* Total Summary Row */
.total-summary-row td {
  background: #ecfdf5 !important;
  border-top: 2px solid #10b981 !important;
  border-bottom: 2px solid #10b981 !important;
  font-weight: 900 !important;
  color: #065f46 !important;
}

.total-summary-row .total-title {
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.total-summary-row .total-value {
  color: #047857 !important;
  font-size: 14px;
}

/* Cell Badges */
.cell-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
}

.cell-badge.verified,
.cell-badge.paid,
.cell-badge.done {
  background: #dcfce7;
  color: #15803d;
}

.cell-badge.pending,
.cell-badge.wait {
  background: #fef3c7;
  color: #b45309;
}

.cell-badge.rejected {
  background: #fee2e2;
  color: #b91c1c;
}

/* KPI Bottom Bar */
.sheet-kpi-bar {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  padding: 10px 18px;
  background: #f8fafc;
  border-top: 1px solid #cbd5e1;
  font-size: 12.5px;
  color: #475569;
}

.kpi-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.text-green-bold {
  color: #059669;
  font-size: 14px;
  font-weight: 900;
}

/* ============================================================
   LIVE EMBED GOOGLE SHEETS TAB
============================================================ */
.embed-panel-box {
  padding: 0 !important;
  overflow: hidden;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
}

.embed-header-toolbar {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  gap: 16px;
  flex-wrap: wrap;
}

.embed-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 300px;
}

.embed-header-icon {
  font-size: 26px;
  flex-shrink: 0;
  line-height: 1;
}

.embed-header-title strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: #1e293b;
}

.embed-header-title p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.embed-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-embed-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #1e293b;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-embed-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-embed-action.primary {
  background: #008a4b;
  color: #ffffff;
  border-color: #008a4b;
  box-shadow: 0 2px 6px rgba(0, 138, 75, 0.25);
}

.btn-embed-action.primary:hover {
  background: #00733e;
}

.embed-placeholder {
  padding: 60px 20px;
  text-align: center;
  max-width: 650px;
  margin: 0 auto;
}

.embed-placeholder-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.embed-placeholder h3 {
  color: #1e293b;
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
}

.embed-placeholder p {
  color: #64748b;
  margin: 0 auto 20px;
  font-size: 14px;
  line-height: 1.5;
}

.embed-url-input-wrap {
  display: flex;
  gap: 10px;
  justify-content: center;
  max-width: 560px;
  margin: 0 auto 12px;
  flex-wrap: wrap;
}

.embed-url-input-wrap input {
  flex: 1 1 320px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #ffffff;
}

.embed-url-input-wrap input:focus {
  border-color: #008a4b;
  box-shadow: 0 0 0 3px rgba(0, 138, 75, 0.12);
}

.embed-url-input-wrap button {
  height: 42px;
  background: #008a4b;
  color: #ffffff;
  padding: 0 22px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 138, 75, 0.25);
}

.embed-url-input-wrap button:hover {
  background: #00733e;
}

.embed-iframe {
  width: 100%;
  height: 750px;
  border: none;
  display: none;
}

