/* ============================
   Reports CSS — RiskTiger
   ============================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: linear-gradient(135deg, #23243a 0%, #181c24 100%);
  color: #f2f2f2;
  font-family: "Segoe UI", "Roboto", Arial, sans-serif;
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body.light-mode {
  background: linear-gradient(135deg, #f5f7fa 0%, #e3f0ff 100%);
  color: #23243a;
}

/* --- App Container --- */
#app {
  background: rgba(32, 34, 54, 0.98);
  color: #f2f2f2;
  border-radius: 0;
  box-shadow: none;
  padding: 0.5rem 0.8rem 1rem 0.8rem;
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

body.light-mode #app {
  background: #fff;
  color: #23243a;
  box-shadow: 0 0.4rem 3.2rem rgba(180, 180, 180, 0.15);
}

@media (max-width: 768px) {
  #app {
    width: 100%;
    padding: 1vw;
    margin: 0;
    border-radius: 0;
  }
}

/* --- Header --- */
.report-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.report-header h1 {
  text-align: center;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  padding: 0.5rem 1.5rem;
  border-radius: 0.8rem;
  background: linear-gradient(90deg, #23243a 80%, #2a2e3d 100%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  flex: 1;
}

body.light-mode .report-header h1 {
  background: linear-gradient(90deg, #f5f7fa 80%, #c3cfe2 100%);
  color: #23243a;
}

/* --- Tabs Row --- */
.tabs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #23243a;
  border-radius: 0.8rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  padding: 0.4rem 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

body.light-mode .tabs-row {
  background-color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tab-button {
  padding: 0.5em 1.2em;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  background-color: transparent;
  color: #e0e0e0;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  border-radius: 0.6em;
}

.tab-button:hover {
  color: #ffb300;
  border-color: #3b7fc7;
}

.tab-button.active {
  background-color: #3b7fc7;
  color: #fff;
  border-color: #3b7fc7;
}

body.light-mode .tab-button {
  color: #23243a;
}

body.light-mode .tab-button:hover {
  background-color: #e3f0ff;
  color: #3b7fc7;
}

body.light-mode .tab-button.active {
  background-color: #3b7fc7;
  color: #fff;
}

/* --- Status Bar (WS + Subscription info) --- */
.status-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.ws-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.ws-status-dot.connected {
  background: #43a047;
  box-shadow: 0 0 6px #43a047;
}

.ws-status-dot.disconnected {
  background: #e63946;
  box-shadow: 0 0 6px #e63946;
}

.ws-status-text {
  font-size: 0.85em;
}

.sub-status {
  font-size: 0.82em;
  color: #ffb300;
  font-weight: 600;
}

body.light-mode .sub-status {
  color: #1976d2;
}

/* --- Toolbar --- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.8rem 0;
  flex-wrap: wrap;
  background: rgba(245, 247, 250, 0.1);
  border-radius: 0.8em;
  padding: 0.6em 1em;
  border: 1.5px solid rgba(227, 240, 255, 0.2);
}

body.light-mode .toolbar {
  background: rgba(245, 247, 250, 0.6);
  border: 1.5px solid #e3f0ff;
}

.toolbar .search-input {
  padding: 0.5em 0.9em;
  font-size: 0.92em;
  border-radius: 0.5em;
  border: 2px solid #555;
  background: #181c24;
  color: #f2f2f2;
  outline: none;
  min-width: 180px;
  max-width: 300px;
  transition: border-color 0.2s;
}

.toolbar .search-input:focus {
  border-color: #3b7fc7;
  box-shadow: 0 0 0 2px rgba(59, 127, 199, 0.2);
}

body.light-mode .toolbar .search-input {
  background: #fff;
  color: #23243a;
  border: 2px solid #bbb;
}

.toolbar .refresh-btn {
  padding: 0.45em 1em;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid #3b7fc7;
  background: #3b7fc7;
  color: #fff;
  border-radius: 0.5em;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}

.toolbar .refresh-btn:hover {
  background: #1565c0;
  border-color: #1565c0;
}

.toolbar .refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body.light-mode .toolbar .refresh-btn {
  background: #1976d2;
  border-color: #1976d2;
}

body.light-mode .toolbar .refresh-btn:hover {
  background: #1565c0;
  border-color: #1565c0;
}

.toolbar .reset-search-btn {
  padding: 0.45em 1em;
  font-size: 0.9em;
  font-weight: 600;
  border-radius: 0.45em;
  border: 2px solid #e65100;
  background: #bf360c;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.toolbar .reset-search-btn:hover {
  background: #d84315;
  border-color: #ff6d00;
}

body.light-mode .toolbar .reset-search-btn {
  background: #e65100;
  border-color: #e65100;
}

body.light-mode .toolbar .reset-search-btn:hover {
  background: #bf360c;
  border-color: #bf360c;
}

.toolbar .record-count {
  font-size: 0.88em;
  color: #90caf9;
  font-weight: 600;
  margin-left: auto;
}

body.light-mode .toolbar .record-count {
  color: #1976d2;
}

/* --- Theme Toggle --- */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.theme-toggle .toggle-icon {
  font-size: 1em;
  user-select: none;
  pointer-events: none;
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #bfc9d1;
  border-radius: 34px;
  transition: background 0.3s;
}

.theme-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 4px;
  bottom: 4px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
}

.theme-switch input:checked+.theme-slider {
  background: #3b7fc7;
}

.theme-switch input:checked+.theme-slider:before {
  transform: translateX(18px);
  background: #23243a;
}

/* --- Report Content Area --- */
.report-content {
  border: 1px solid #333;
  border-radius: 0.8em;
  padding: 0;
  background-color: #23243a;
  color: #f2f2f2;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  margin-top: 0.5rem;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.light-mode .report-content {
  background-color: #fff;
  color: #23243a;
  border: 1px solid #c3cfe2;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* --- Report Table --- */
.report-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.report-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: "Fira Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 0.82em;
  min-width: 1200px;
}

.report-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.report-table th {
  background: linear-gradient(90deg, #1976d2 60%, #1565c0 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.88em;
  letter-spacing: 0.3px;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 3px solid #0d47a1;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.report-table th:hover {
  background: linear-gradient(90deg, #1565c0 60%, #0d47a1 100%);
}

.report-table th .sort-arrow {
  font-size: 0.75em;
  margin-left: 4px;
  opacity: 0.6;
}

.report-table th .sort-arrow.active {
  opacity: 1;
  color: #ffb300;
}

body.light-mode .report-table th {
  background: linear-gradient(90deg, #bdd1f2 60%, #90caf9 100%);
  color: #23243a;
  border-bottom: 3px solid #90caf9;
}

.report-table td {
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid rgba(25, 118, 210, 0.15);
  color: #e0e0e0;
  font-weight: 500;
  transition: background 0.15s;
}

body.light-mode .report-table td {
  color: #23243a;
  border-bottom: 1px solid #e3f0ff;
}

.report-table tr:nth-child(even) td {
  background: rgba(100, 181, 246, 0.08);
}

.report-table tr:nth-child(odd) td {
  background: rgba(35, 36, 58, 0.6);
}

body.light-mode .report-table tr:nth-child(even) td {
  background: rgba(100, 181, 246, 0.06);
}

body.light-mode .report-table tr:nth-child(odd) td {
  background: #fff;
}

.report-table tr:hover td {
  background: rgba(25, 118, 210, 0.18);
  color: #90caf9;
}

body.light-mode .report-table tr:hover td {
  background: #e3f0ff;
  color: #1976d2;
}

/* Serial number column */
.report-table th.serial-col,
.report-table td.serial-col {
  width: 2.5em;
  text-align: center;
  font-weight: bold;
  color: #90caf9;
}

body.light-mode .report-table th.serial-col,
body.light-mode .report-table td.serial-col {
  color: #1976d2;
}

/* Numeric columns right-align */
.report-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.report-table th.num {
  text-align: right;
}

/* Highlight negative values */
.report-table td.negative {
  color: #e63946;
  font-weight: 700;
}

body.light-mode .report-table td.negative {
  color: #c62828;
}

/* Highlight positive values */
.report-table td.positive {
  color: #43a047;
  font-weight: 700;
}

/* Row flash animation when updated */
@keyframes row-flash {
  0% {
    background: rgba(255, 179, 0, 0.35);
  }

  100% {
    background: transparent;
  }
}

.report-table tr.row-updated td {
  animation: row-flash 1.2s ease-out;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #888;
  font-size: 1.1em;
}

body.light-mode .empty-state {
  color: #999;
}

/* --- Loading Spinner --- */
.loading-spinner {
  text-align: center;
  padding: 2rem;
  color: #ffb300;
  font-size: 1em;
}

/* --- ACK Toast --- */
.ack-toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  padding: 0.7em 1.3em;
  border-radius: 0.7em;
  font-size: 0.9em;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: opacity 0.3s;
}

.ack-toast.success {
  background: #43a047;
  color: #fff;
}

.ack-toast.error {
  background: #e63946;
  color: #fff;
}

/* --- Column Chooser --- */
.col-chooser-wrapper {
  position: relative;
  display: inline-block;
}

.col-chooser-btn {
  padding: 0.45em 1em;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid #555;
  background: transparent;
  color: #e0e0e0;
  border-radius: 0.5em;
  transition: background 0.2s, border-color 0.2s;
}

.col-chooser-btn:hover {
  background: rgba(59, 127, 199, 0.2);
  border-color: #3b7fc7;
}

body.light-mode .col-chooser-btn {
  color: #23243a;
  border-color: #bbb;
}

body.light-mode .col-chooser-btn:hover {
  background: #e3f0ff;
  border-color: #3b7fc7;
}

.col-chooser-dropdown {
  position: absolute;
  top: 110%;
  left: 0;
  z-index: 2000;
  background: #2a2e3d;
  border: 1px solid #555;
  border-radius: 0.6em;
  padding: 0.5em 0.6em;
  min-width: 200px;
  max-height: 350px;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body.light-mode .col-chooser-dropdown {
  background: #fff;
  border: 1px solid #c3cfe2;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.col-chooser-item {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.85em;
  padding: 0.3em 0.4em;
  border-radius: 0.3em;
  cursor: pointer;
  color: #e0e0e0;
  white-space: nowrap;
  transition: background 0.15s;
}

.col-chooser-item:hover {
  background: rgba(59, 127, 199, 0.15);
}

body.light-mode .col-chooser-item {
  color: #23243a;
}

body.light-mode .col-chooser-item:hover {
  background: #e3f0ff;
}

.col-chooser-item input[type="checkbox"] {
  accent-color: #3b7fc7;
  cursor: pointer;
}

/* --- Summary Row (tfoot) --- */
.report-table tfoot {
  position: sticky;
  bottom: 0;
  z-index: 9;
}

.report-table .summary-row td {
  background: linear-gradient(90deg, #1a237e 60%, #0d47a1 100%);
  color: #ffb300;
  font-weight: 700;
  font-size: 0.85em;
  padding: 8px 12px;
  border-top: 2px solid #0d47a1;
  white-space: nowrap;
}

body.light-mode .report-table .summary-row td {
  background: linear-gradient(90deg, #e3f0ff 60%, #bdd1f2 100%);
  color: #1565c0;
  border-top: 2px solid #90caf9;
}

.summary-label {
  font-weight: 600;
  opacity: 0.8;
  margin-right: 3px;
  font-size: 0.9em;
}

/* --- Table Footer Status Bar --- */
.table-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6em 1em;
  background: linear-gradient(90deg, #1a237e 60%, #23243a 100%);
  border-top: 1px solid #0d47a1;
  font-size: 0.88em;
  font-weight: 600;
  color: #90caf9;
  gap: 1rem;
  flex-wrap: wrap;
}

body.light-mode .table-footer-bar {
  background: linear-gradient(90deg, #e3f0ff 60%, #f5f7fa 100%);
  border-top: 1px solid #90caf9;
  color: #1976d2;
}

.footer-record-count {
  color: #ffb300;
}

body.light-mode .footer-record-count {
  color: #1565c0;
}

.footer-batch-info {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.batch-complete {
  color: #43a047;
  font-weight: 700;
}

.batch-loading {
  color: #ffb300;
  animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* --- Footer Timer --- */
.footer-timer {
  color: #43a047;
  font-weight: 700;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 0.3em;
  margin-left: auto;
}

body.light-mode .footer-timer {
  color: #2e7d32;
}

/* --- Child Toolbar --- */
.child-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5em 0.8em;
  margin-bottom: 0.3em;
  flex-wrap: wrap;
}

.child-toolbar .record-count {
  font-size: 0.88em;
  color: #90caf9;
  font-weight: 600;
  margin-left: auto;
}

body.light-mode .child-toolbar .record-count {
  color: #1976d2;
}

.child-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 60vh;
}

/* --- Virtual Scrolling Spacers --- */
.report-table tr.vspacer td {
  padding: 0;
  border: none;
  background: transparent !important;
  line-height: 0;
  font-size: 0;
}

body.light-mode .report-table tr.vspacer td {
  background: transparent !important;
}

/* --- Draggable Column Headers --- */
.report-table th[draggable="true"] {
  cursor: grab;
}

.report-table th[draggable="true"]:active {
  cursor: grabbing;
  opacity: 0.7;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .tabs-row {
    padding: 0.3rem 0.5rem;
  }

  .tab-button {
    padding: 0.4em 0.7em;
    font-size: 0.82em;
  }

  .toolbar {
    padding: 0.4em 0.6em;
  }

  .toolbar .search-input {
    min-width: 120px;
  }

  .report-table {
    font-size: 0.75em;
  }

  .report-table th,
  .report-table td {
    padding: 6px 6px;
  }
}

/* ============================
   Token Input Screen
   ============================ */
.token-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.token-card {
  background: rgba(42, 46, 61, 0.98);
  border: 1px solid #3b7fc7;
  border-radius: 1.2rem;
  padding: 3rem 2.5rem;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

body.light-mode .token-card {
  background: #fff;
  border: 1px solid #c3cfe2;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1);
}

.token-card h1 {
  color: #3b7fc7;
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.token-card p {
  color: #aaa;
  font-size: 0.95em;
  margin-bottom: 1.5rem;
}

body.light-mode .token-card p {
  color: #666;
}

.token-input {
  width: 100%;
  padding: 0.8em 1em;
  font-size: 1em;
  border: 2px solid #555;
  border-radius: 0.6em;
  background: #181c24;
  color: #f2f2f2;
  outline: none;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}

.token-input:focus {
  border-color: #3b7fc7;
  box-shadow: 0 0 0 3px rgba(59, 127, 199, 0.25);
}

body.light-mode .token-input {
  background: #f5f7fa;
  color: #23243a;
  border: 2px solid #bbb;
}

.token-btn {
  width: 100%;
  padding: 0.8em;
  font-size: 1.05em;
  font-weight: 700;
  border: none;
  border-radius: 0.6em;
  background: #3b7fc7;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.token-btn:hover {
  background: #1565c0;
}

.token-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.token-error {
  color: #e63946;
  font-size: 0.9em;
  margin-top: 0.8rem;
  font-weight: 600;
}

/* ============================
   Main Tabs Row (Dashboard / Reports)
   ============================ */
.main-tabs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1100;
  background-color: #1a1b2e;
  border-radius: 0.8rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  padding: 0.4rem 1rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

body.light-mode .main-tabs-row {
  background-color: #e3f0ff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.main-tabs {
  display: flex;
  gap: 0.4rem;
}

.main-tab-button {
  padding: 0.6em 1.5em;
  font-size: 1.05em;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  background-color: transparent;
  color: #e0e0e0;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  border-radius: 0.6em;
}

.main-tab-button:hover {
  color: #ffb300;
  border-color: #3b7fc7;
}

.main-tab-button.active {
  background-color: #3b7fc7;
  color: #fff;
  border-color: #3b7fc7;
}

body.light-mode .main-tab-button {
  color: #23243a;
}

body.light-mode .main-tab-button:hover {
  background-color: #c3ddf7;
}

body.light-mode .main-tab-button.active {
  background-color: #3b7fc7;
  color: #fff;
}

/* ============================
   Export Button
   ============================ */
.export-btn {
  padding: 0.45em 1em;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid #43a047;
  background: #43a047;
  color: #fff;
  border-radius: 0.5em;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s;
  white-space: nowrap;
}

.export-btn:hover {
  background: #2e7d32;
  border-color: #2e7d32;
}

.export-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body.light-mode .export-btn {
  background: #2e7d32;
  border-color: #2e7d32;
}

body.light-mode .export-btn:hover {
  background: #1b5e20;
  border-color: #1b5e20;
}

/* ============================
   Dashboard Content
   ============================ */
.dashboard-content {
  padding: 0.5rem 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.dash-section-title {
  color: #90caf9;
  font-size: 1.05em;
  font-weight: 700;
  margin: 0.5rem 0 0.4rem 0;
}

body.light-mode .dash-section-title {
  color: #1565c0;
}

/* Branch Search Bar */
.dash-branch-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  background: rgba(245, 247, 250, 0.1);
  border-radius: 0.8em;
  padding: 0.6em 1em;
  border: 1.5px solid rgba(227, 240, 255, 0.2);
  flex-wrap: wrap;
}

body.light-mode .dash-branch-bar {
  background: rgba(245, 247, 250, 0.6);
  border: 1.5px solid #e3f0ff;
}

.dash-branch-bar input {
  padding: 0.5em 0.9em;
  font-size: 0.92em;
  border-radius: 0.5em;
  border: 2px solid #555;
  background: #181c24;
  color: #f2f2f2;
  outline: none;
  min-width: 180px;
}

.dash-branch-bar input:focus {
  border-color: #3b7fc7;
}

body.light-mode .dash-branch-bar input {
  background: #fff;
  color: #23243a;
  border: 2px solid #bbb;
}

.dash-branch-bar button {
  padding: 0.45em 1em;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid #3b7fc7;
  background: #3b7fc7;
  color: #fff;
  border-radius: 0.5em;
}

.dash-branch-bar button:hover {
  background: #1565c0;
}

.dash-branch-bar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dash-loading-text {
  color: #ffb300;
  font-size: 0.9em;
}

.dash-error-text {
  color: #e63946;
  font-size: 0.9em;
}

/* Summary Cards */
.summary-cards {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.summary-card {
  flex: 1 1 160px;
  min-width: 140px;
  background: rgba(59, 127, 199, 0.12);
  border: 1px solid rgba(59, 127, 199, 0.3);
  border-radius: 0.8em;
  padding: 0.6em 1em;
  text-align: center;
}

body.light-mode .summary-card {
  background: #e3f0ff;
  border: 1px solid #90caf9;
}

.card-label {
  font-size: 0.82em;
  color: #90caf9;
  font-weight: 600;
  margin-bottom: 0.4em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

body.light-mode .card-label {
  color: #1565c0;
}

.card-value {
  font-size: 1.3em;
  font-weight: 700;
  color: #fff;
}

body.light-mode .card-value {
  color: #23243a;
}

/* Dashboard Chart */
.dash-chart-container {
  background: rgba(35, 36, 58, 0.8);
  border-radius: 1rem;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  position: relative;
  height: 240px;
}

body.light-mode .dash-chart-container {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.dash-chart-title {
  text-align: center;
  font-size: 0.95em;
  font-weight: 600;
  color: #90caf9;
  margin-bottom: 0.5rem;
}

body.light-mode .dash-chart-title {
  color: #1565c0;
}

/* Top Customers Grid */
.dash-top-customers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
  overflow: hidden;
}

.dash-top-tile {
  background: rgba(35, 36, 58, 0.8);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

body.light-mode .dash-top-tile {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.dash-top-tile h3 {
  font-size: 0.95em;
  color: #ffb300;
  margin-bottom: 0.6rem;
  font-weight: 700;
}

body.light-mode .dash-top-tile h3 {
  color: #1565c0;
}

.dash-top-scroll {
  max-height: 300px;
  overflow-y: auto;
}

.dash-top-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82em;
}

.dash-top-table th {
  background: rgba(25, 118, 210, 0.25);
  color: #90caf9;
  padding: 6px 8px;
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

body.light-mode .dash-top-table th {
  background: #e3f0ff;
  color: #1565c0;
}

.dash-top-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(25, 118, 210, 0.1);
  color: #e0e0e0;
  white-space: nowrap;
}

body.light-mode .dash-top-table td {
  color: #23243a;
  border-bottom: 1px solid #e3f0ff;
}

.dash-top-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- Login Overlay --- */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(24, 28, 36, 0.97);
  z-index: 9999;
}

body.light-mode .login-overlay {
  background: rgba(245, 247, 250, 0.97);
}

.login-box {
  background: #23243a;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 380px;
  text-align: center;
}

body.light-mode .login-box {
  background: #fff;
  box-shadow: 0 8px 32px rgba(180, 180, 180, 0.3);
}

.login-logo {
  width: 64px;
  margin-bottom: 1rem;
}

.login-box h2 {
  margin-bottom: 1.5rem;
  color: #fff;
  font-size: 1.4rem;
  font-weight: 600;
}

body.light-mode .login-box h2 {
  color: #23243a;
}

.login-field {
  margin-bottom: 1rem;
  text-align: left;
}

.login-field label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
  color: #aaa;
  font-weight: 500;
}

body.light-mode .login-field label {
  color: #555;
}

.login-field input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border: 1px solid #444;
  background: #181c24;
  color: #f2f2f2;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.login-field input:focus {
  border-color: #667eea;
}

.login-field input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body.light-mode .login-field input {
  background: #f5f7fa;
  color: #23243a;
  border-color: #ccc;
}

.login-divider {
  border: none;
  border-top: 1px solid #333;
  margin: 1.2rem 0;
}

body.light-mode .login-divider {
  border-top-color: #e0e0e0;
}

.login-error {
  color: #E63946;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  text-align: left;
}

.login-btn {
  width: 100%;
  padding: 0.7rem;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
  transition: opacity 0.2s, transform 0.1s;
}

.login-btn:hover {
  opacity: 0.9;
}

.login-btn:active {
  transform: scale(0.98);
}