.main-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: #5bc0de;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.nav-links {
  display: flex;
  gap: 5px;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-card-dark);
}

.nav-links a.active {
  color: #fff;
  background: #5bc0de;
}

.theme-toggle {
  background: var(--bg-card-dark);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: var(--bg-hover);
}
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  color: var(--text-primary);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.refresh-info {
  color: var(--text-muted);
  font-size: 14px;
}

/* Summary Cards */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.summary-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--border-subtle);
}

.summary-card .value {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--text-primary);
}

.summary-card .label {
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
}

.summary-card.pending .value { color: #f0ad4e; }
.summary-card.syncing .value { color: #5bc0de; }
.summary-card.completed .value { color: #5cb85c; }
.summary-card.error .value { color: #d9534f; }
.summary-card.verified .value { color: #9b59b6; }

/* Actions Bar */
.actions-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.add-form {
  display: flex;
  gap: 10px;
}

input[type="text"],
select {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 10px 15px;
  border-radius: 6px;
  font-size: 14px;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: #5bc0de;
}

input[type="text"] {
  width: 150px;
}

button {
  background: #5bc0de;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

button:hover {
  background: #46b8da;
}

button.secondary {
  background: var(--border-strong);
  color: var(--text-primary);
}

button.secondary:hover {
  background: var(--border-subtle);
}

button.danger {
  background: #d9534f;
}

button.danger:hover {
  background: #c9302c;
}

button.warning {
  background: #f0ad4e;
}

button.warning:hover {
  background: #ec971f;
}

button.success {
  background: #5cb85c;
}

button.success:hover {
  background: #449d44;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar input[type="text"] {
  width: 200px;
}

.filter-count {
  color: var(--text-muted);
  font-size: 13px;
  margin-left: 10px;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

th, td {
  padding: 14px 16px;
  text-align: left;
}

th {
  background: var(--bg-card-dark);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-muted);
}

tr:not(:last-child) td {
  border-bottom: 1px solid var(--border-color);
}

tr:hover td {
  background: var(--bg-hover);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pending { background: #f0ad4e22; color: #f0ad4e; }
.status-claimed { background: #5bc0de22; color: #5bc0de; }
.status-syncing { background: #5bc0de22; color: #5bc0de; }
.status-verifying { background: #9b59b622; color: #9b59b6; }
.status-completed { background: #5cb85c22; color: #5cb85c; }
.status-error { background: #d9534f22; color: #d9534f; }
.status-disabled { background: #44444422; color: #888; }
.status-idle { background: #5cb85c22; color: #5cb85c; }
.status-locked { background: #f0ad4e22; color: #f0ad4e; }

/* Service Status Banner */
.status-banner {
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 14px;
}

.status-banner.error {
  background: #d9534f22;
  border: 1px solid #d9534f44;
  color: #d9534f;
}

.status-banner.warning {
  background: #f0ad4e22;
  border: 1px solid #f0ad4e44;
  color: #f0ad4e;
}

.status-banner.success {
  background: #5cb85c22;
  border: 1px solid #5cb85c44;
  color: #5cb85c;
}

/* Enabled/Disabled Badges */
.enabled-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: #5cb85c22;
  color: #5cb85c;
}

.disabled-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: #44444422;
  color: #888;
}

/* Verification Badges */
.verify-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
}

.verify-pass { background: #5cb85c33; color: #5cb85c; }
.verify-fail { background: #d9534f33; color: #d9534f; }
.verify-pending { background: #88888833; color: #888; }

/* Toggle Switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
  display: inline-block;
}

.toggle input {
  display: none;
}

.toggle .slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #d9534f;
  border-radius: 24px;
  transition: 0.2s;
}

.toggle .slider:before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.toggle input:checked + .slider {
  background: #5cb85c;
}

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

.toggle .slider:after {
  content: 'OFF';
  position: absolute;
  right: 6px;
  top: 5px;
  font-size: 9px;
  font-weight: 600;
  color: #fff;
}

.toggle input:checked + .slider:after {
  content: 'ON';
  left: 8px;
  right: auto;
}

/* Icon Buttons */
.btn-icon {
  background: transparent;
  padding: 6px 10px;
  font-size: 16px;
  color: var(--text-primary);
}

.btn-icon:hover {
  background: var(--bg-card-dark);
}

.btn-icon.danger:hover {
  background: #d9534f44;
}

/* Error/Issue Text */
.error-text {
  color: #d9534f;
  font-size: 12px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-text {
  color: #d9534f;
  font-size: 12px;
  max-width: 400px;
  word-wrap: break-word;
  white-space: normal;
}

/* Workers Section */
.workers-section {
  margin-top: 30px;
}

.workers-section h2 {
  font-size: 18px;
  margin-bottom: 15px;
  color: var(--text-primary);
}

.worker-card {
  display: inline-block;
  background: var(--bg-card);
  padding: 12px 18px;
  border-radius: 6px;
  margin-right: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border-subtle);
}

.worker-card .worker-id {
  font-weight: 600;
  margin-bottom: 4px;
}

.worker-card .worker-status {
  font-size: 12px;
  color: var(--text-muted);
}

.worker-card.working {
  border-left: 3px solid #5bc0de;
}

.worker-card.idle {
  border-left: 3px solid #5cb85c;
}

.worker-card.offline {
  border-left: 3px solid #888;
  opacity: 0.6;
}

/* Verification Section */
.verification-section {
  margin-top: 30px;
}

.verification-section h2 {
  font-size: 18px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.verification-section h2 button {
  padding: 6px 12px;
  font-size: 12px;
}

.verification-summary {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
}

.verification-summary .summary-card {
  padding: 12px 20px;
}

.verification-summary .summary-card .value {
  font-size: 24px;
}

/* Misc */
.no-data {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.bars-count {
  font-family: monospace;
  font-size: 13px;
}

.bars-count.remaining {
  color: #f0ad4e;
}

/* Progress Bar */
.progress-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  width: 60px;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #5bc0de, #5cb85c);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 35px;
}

.no-data-text {
  color: var(--text-hint);
}

.time-ago {
  color: var(--text-muted);
  font-size: 12px;
}

.row-number {
  color: var(--text-muted);
  font-size: 12px;
}

.table-check {
  color: #5cb85c;
  font-size: 16px;
}

.table-missing {
  color: var(--text-muted);
  font-size: 14px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 15px 20px;
  border-radius: 8px;
  border-left: 4px solid #5cb85c;
  box-shadow: 0 4px 12px var(--shadow-color);
  transform: translateX(120%);
  transition: transform 0.3s;
  z-index: 1000;
}

.toast.show {
  transform: translateX(0);
}

.toast.error {
  border-left-color: #d9534f;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--modal-backdrop);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-card);
  padding: 25px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 32px var(--shadow-heavy);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
}

.stats-table {
  width: 100%;
  background: transparent;
}

.stats-table td {
  padding: 8px 0;
}

.stats-table td:first-child {
  color: var(--text-muted);
}

.stats-table td:last-child {
  text-align: right;
  font-family: monospace;
}

.stats-note {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 12px;
}

/* Info Section */
.info-section {
  margin-top: 30px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.info-section h3 {
  font-size: 16px;
  margin-bottom: 15px;
  color: #5bc0de;
}

.info-section p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 10px;
}

.info-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-section li {
  color: var(--text-secondary);
  font-size: 13px;
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Responsive */
@media (max-width: 768px) {
  .actions-bar {
    flex-direction: column;
  }

  table {
    font-size: 13px;
  }

  th, td {
    padding: 10px 8px;
  }
}
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  color: var(--text-primary);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.refresh-info {
  color: var(--text-muted);
  font-size: 14px;
}

/* Breadcrumb Navigation */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.breadcrumb a {
  color: #5bc0de;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--border-subtle);
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 600;
}

/* Results Actions */
.results-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

/* Widget Link Icon */
.widget-link {
  color: #5bc0de;
  text-decoration: none;
  font-size: 14px;
  margin-left: 8px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.widget-link:hover {
  opacity: 1;
}

.widget-link-float {
  position: absolute;
  top: 0;
  right: 0;
}

/* Summary Cards */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.summary-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--border-subtle);
}

.summary-card .value {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--text-primary);
}

.summary-card .label {
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
}

.summary-card.pending .value { color: #f0ad4e; }
.summary-card.syncing .value { color: #5bc0de; }
.summary-card.completed .value { color: #5cb85c; }
.summary-card.error .value { color: #d9534f; }
.summary-card.verified .value { color: #9b59b6; }

/* Actions Bar */
.actions-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

input[type="text"],
input[type="number"],
select {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 10px 15px;
  border-radius: 6px;
  font-size: 14px;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: #5bc0de;
}

input[type="text"] {
  width: 150px;
}

button {
  background: #5bc0de;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

button:hover {
  background: #46b8da;
}

button.secondary {
  background: var(--border-strong);
  color: var(--text-primary);
}

button.secondary:hover {
  background: var(--border-subtle);
}

button.danger {
  background: #d9534f;
}

button.danger:hover {
  background: #c9302c;
}

button.warning {
  background: #f0ad4e;
}

button.warning:hover {
  background: #ec971f;
}

button.success {
  background: #5cb85c;
}

button.success:hover {
  background: #449d44;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar input[type="text"] {
  width: 200px;
}

.filter-count {
  color: var(--text-muted);
  font-size: 13px;
  margin-left: 10px;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

th, td {
  padding: 14px 16px;
  text-align: left;
}

th {
  background: var(--bg-card-dark);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-muted);
}

tr:not(:last-child) td {
  border-bottom: 1px solid var(--border-color);
}

tr:hover td {
  background: var(--bg-hover);
}

/* Status Badges (legacy) */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-success { background: #5cb85c22; color: #5cb85c; }
.status-error { background: #d9534f22; color: #d9534f; }
.status-pending { background: #88888833; color: #888; }
.status-running { background: #5bc0de22; color: #5bc0de; }

/* Status Banner */
.status-banner {
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 14px;
}

.status-banner.warning {
  background: #f0ad4e22;
  border: 1px solid #f0ad4e44;
  color: #f0ad4e;
}

/* Calculation Status Display */
.status-cell {
  min-width: 180px;
}

.calculation-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
}

.calculation-status .status-icon {
  font-size: 18px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.calculation-status .status-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.calculation-status .status-text {
  font-weight: 600;
  font-size: 13px;
}

.calculation-status .status-subtext {
  font-size: 11px;
  opacity: 0.7;
}

/* Status: Not Calculated */
.status-not-calculated {
  background: #88888815;
  border: 1px dashed var(--border-subtle);
}

.status-not-calculated .status-icon {
  color: #888;
  background: #88888822;
}

.status-not-calculated .status-text {
  color: #888;
}

/* Status: Calculating */
.status-calculating {
  background: #5bc0de22;
  border: 1px solid #5bc0de44;
}

.status-calculating .status-icon {
  color: #5bc0de;
  background: #5bc0de33;
  animation: spin 1.5s linear infinite;
}

.status-calculating .status-text {
  color: #5bc0de;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Status: Calculated (Success) */
.status-calculated {
  background: #5cb85c22;
  border: 1px solid #5cb85c44;
}

.status-calculated .status-icon {
  color: #5cb85c;
  background: #5cb85c33;
  font-weight: bold;
}

.status-calculated .status-text {
  color: #5cb85c;
}

/* Status: No Data */
.status-no-data {
  background: #f0ad4e22;
  border: 1px solid #f0ad4e44;
}

.status-no-data .status-icon {
  color: #f0ad4e;
  background: #f0ad4e33;
}

.status-no-data .status-text {
  color: #f0ad4e;
}

/* Status: Failed */
.status-failed {
  background: #d9534f22;
  border: 1px solid #d9534f44;
}

.status-failed .status-icon {
  color: #d9534f;
  background: #d9534f33;
  font-weight: bold;
}

.status-failed .status-text {
  color: #d9534f;
}

/* Calculation timestamp */
.calculation-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
  margin-top: 2px;
}

/* Row highlighting */
.row-has-data td {
  border-left: 3px solid #5cb85c;
}

.row-has-data td:first-child {
  border-left-width: 3px;
}

.row-no-data td {
  opacity: 0.7;
}

.row-no-data:hover td {
  opacity: 1;
}

/* Type Badges */
.type-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.type-average { background: #5bc0de22; color: #5bc0de; }
.type-heatmap { background: #9b59b622; color: #9b59b6; }
.type-stepper { background: #e67e2222; color: #e67e22; }
.type-overview { background: #2ecc7122; color: #2ecc71; }

/* Direction Badges */
.direction-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.direction-long { background: #5cb85c22; color: #5cb85c; }
.direction-short { background: #d9534f22; color: #d9534f; }
.direction-lookback { background: #337ab722; color: #337ab7; }

/* Stepper Summary Card */
.summary-card.stepper .value { color: #e67e22; }

/* Overview Summary Card */
.summary-card.overview .value { color: #2ecc71; }

/* Schedule Info */
.schedule-info {
  font-size: 12px;
  color: var(--text-muted);
}

.schedule-info.active {
  color: #5cb85c;
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
  display: inline-block;
}

.toggle input {
  display: none;
}

.toggle .slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #d9534f;
  border-radius: 24px;
  transition: 0.2s;
}

.toggle .slider:before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.toggle input:checked + .slider {
  background: #5cb85c;
}

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

.toggle .slider:after {
  content: 'OFF';
  position: absolute;
  right: 6px;
  top: 5px;
  font-size: 9px;
  font-weight: 600;
  color: #fff;
}

.toggle input:checked + .slider:after {
  content: 'ON';
  left: 8px;
  right: auto;
}

/* Icon Buttons */
.btn-icon {
  background: transparent;
  padding: 6px 10px;
  font-size: 14px;
  color: var(--text-primary);
}

.btn-icon:hover {
  background: var(--bg-card-dark);
}

.btn-icon.danger:hover {
  background: #d9534f44;
}

.btn-icon.warning:hover {
  background: #f0ad4e44;
}

.btn-icon.force-calc {
  color: #f0ad4e;
}

.btn-icon.force-calc:hover {
  background: #f0ad4e44;
}

.actions-cell {
  display: flex;
  gap: 4px;
}

/* Error Message */
.error-message {
  color: #d9534f;
  font-size: 11px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
  margin-top: 4px;
}

/* Misc */
.no-data {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.row-number {
  color: var(--text-muted);
  font-size: 12px;
}

.time-ago {
  color: var(--text-muted);
  font-size: 12px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 15px 20px;
  border-radius: 8px;
  border-left: 4px solid #5cb85c;
  box-shadow: 0 4px 12px var(--shadow-color);
  transform: translateX(120%);
  transition: transform 0.3s;
  z-index: 1000;
}

.toast.show {
  transform: translateX(0);
}

.toast.error {
  border-left-color: #d9534f;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--modal-backdrop);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-card);
  padding: 25px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 32px var(--shadow-heavy);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
}

.modal-close:hover {
  color: var(--text-primary);
  background: transparent;
}

/* Form */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.form-group input,
.form-group select {
  width: 100%;
  box-sizing: border-box;
}

.form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-checkbox input {
  width: auto;
  accent-color: #5bc0de;
}

.form-checkbox label {
  margin: 0;
  font-size: 14px;
  color: var(--text-primary);
}

.form-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* Info Section */
.info-section {
  margin-top: 30px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.info-section h3 {
  font-size: 16px;
  margin-bottom: 15px;
  color: #5bc0de;
}

.info-section p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 10px;
}

.info-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-section li {
  color: var(--text-secondary);
  font-size: 13px;
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-empty .hint {
  font-size: 13px;
  color: var(--text-hint);
  margin-top: 10px;
}

/* Chart Container */
.chart-container {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid var(--border-subtle);
}

.chart-container h3 {
  margin: 0 0 15px 0;
  font-size: 16px;
  color: #5bc0de;
}

.chart-container h4 {
  margin: 20px 0 10px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.chart-empty {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
  background: var(--bg-card);
  border-radius: 8px;
}

/* Chart Stats */
.chart-stats {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-value {
  font-size: 16px;
  font-weight: 600;
  font-family: monospace;
  color: var(--text-primary);
}

/* Heatmap */
.heatmap-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.heatmap-meta span {
  display: flex;
  gap: 5px;
}

.heatmap-meta strong {
  color: var(--text-secondary);
}

/* Top Levels */
.heatmap-top {
  margin-bottom: 30px;
}

.top-levels {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-level {
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--bg-card-dark);
  padding: 10px 15px;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.top-level .rank {
  font-size: 12px;
  color: var(--text-muted);
  width: 30px;
}

.top-level .price {
  font-family: monospace;
  font-size: 14px;
  font-weight: 600;
  width: 100px;
  color: var(--text-primary);
}

.top-level .hits {
  font-size: 13px;
  color: #5bc0de;
  z-index: 1;
}

.top-level .hits-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #5bc0de22, #9b59b622);
  z-index: 0;
}

/* Heatmap Grid */
.heatmap-grid-container {
  margin-top: 20px;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 4px;
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
  background: var(--bg-card-dark);
  border-radius: 6px;
}

.heatmap-cell {
  padding: 8px;
  border-radius: 4px;
  text-align: center;
  cursor: default;
  transition: transform 0.1s;
}

.heatmap-cell:hover {
  transform: scale(1.05);
  z-index: 1;
}

.heatmap-price {
  display: block;
  font-size: 11px;
  font-weight: 600;
  font-family: monospace;
}

.heatmap-hits {
  display: block;
  font-size: 10px;
  opacity: 0.8;
}

.heatmap-truncated {
  text-align: center;
  padding: 15px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Heatmap Legend */
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-gradient {
  flex: 1;
  max-width: 200px;
  height: 10px;
  background: linear-gradient(90deg, #1e3a5f, #5bc0de, #f0ad4e, #d9534f);
  border-radius: 5px;
}

/* Stepper Chart */
.stepper-time-range {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 20px;
  padding: 10px 15px;
  background: var(--bg-card-dark);
  border-radius: 6px;
}

.stepper-directions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.direction-card {
  background: var(--bg-card-dark);
  border-radius: 8px;
  padding: 20px;
  border-left: 4px solid;
}

.direction-card.long {
  border-left-color: #5cb85c;
}

.direction-card.short {
  border-left-color: #d9534f;
}

.direction-card h4 {
  margin: 0 0 15px 0;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.direction-card.long h4 {
  color: #5cb85c;
}

.direction-card.short h4 {
  color: #d9534f;
}

.direction-icon {
  font-size: 18px;
  font-weight: bold;
}

.direction-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.direction-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.direction-stat .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.direction-stat .value {
  font-size: 18px;
  font-weight: 600;
  font-family: monospace;
  color: var(--text-primary);
}

.direction-stat .value.completed {
  color: #5cb85c;
}

.direction-stat .value.active {
  color: #5bc0de;
}

.direction-stat .value.level {
  color: #f0ad4e;
}

.direction-progress {
  margin-top: 10px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}

.progress-bar {
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-fill.completed {
  background: linear-gradient(90deg, #5cb85c, #449d44);
}

.progress-label {
  font-size: 12px;
  color: #5cb85c;
  font-weight: 500;
}

.no-direction-data {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  background: var(--bg-card-dark);
  border-radius: 8px;
}

.stepper-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 15px;
  background: var(--bg-card-dark);
  border-radius: 6px;
  margin-top: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* Stepper Full Container */
.stepper-full-container {
  max-width: 100%;
}

/* Stepper Graphs Section */
.stepper-graphs-section {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 2px solid var(--border-color);
}

.stepper-graphs-section h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  color: #5bc0de;
}

/* Individual Graph Container */
.stepper-graph-container {
  background: var(--bg-card-dark);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 25px;
}

.stepper-graph-container h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: var(--text-primary);
}

.chart-description {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 15px 0;
}

/* Level Selector */
.level-selector {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding: 12px 15px;
  background: var(--bg-card);
  border-radius: 6px;
}

.level-selector label {
  font-size: 14px;
  color: var(--text-muted);
}

.level-selector select {
  min-width: 120px;
}

/* Custom Tooltip for Stepper Charts */
.stepper-tooltip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 15px;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.stepper-tooltip p {
  margin: 0 0 6px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.stepper-tooltip p:last-child {
  margin-bottom: 0;
}

.stepper-tooltip strong {
  color: #5bc0de;
}

/* Level Distribution */
.level-distribution {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.level-distribution h5 {
  margin: 0 0 15px 0;
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.level-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.level-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.level-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  width: 35px;
  text-align: right;
}

.level-bar-container {
  flex: 1;
  height: 20px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.level-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.level-count {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
}

/* Trend Legend */
.trend-legend {
  margin-top: 20px;
  padding: 15px;
  background: var(--bg-card);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trend-legend .legend-item {
  font-size: 12px;
}

/* Retry Button */
.retry-button {
  margin-top: 15px;
  padding: 8px 20px;
  background: #5bc0de;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.retry-button:hover {
  background: #46b8da;
}

/* Responsive */
@media (max-width: 768px) {
  .actions-bar {
    flex-direction: column;
  }

  table {
    font-size: 13px;
  }

  th, td {
    padding: 10px 8px;
  }

  .chart-stats {
    gap: 15px;
  }

  .heatmap-meta {
    flex-direction: column;
    gap: 8px;
  }
}

/* Breakeven Analysis */
.breakeven-model {
  padding: 12px 15px;
  background: var(--bg-card-dark);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

.breakeven-model code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  color: #5bc0de;
}

.breakeven-heatmap-wrapper {
  overflow-x: auto;
  margin-bottom: 20px;
}

.breakeven-table {
  border-collapse: collapse;
  background: transparent;
  min-width: auto;
  width: auto;
}

.breakeven-table th,
.breakeven-table td {
  padding: 0;
  text-align: center;
}

.breakeven-corner {
  padding: 8px 12px !important;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: none;
  white-space: nowrap;
  background: transparent !important;
}

.breakeven-header {
  padding: 6px 8px !important;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  background: transparent !important;
}

.breakeven-row-label {
  padding: 6px 12px !important;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-align: right !important;
}

.breakeven-cell {
  width: 56px;
  height: 40px;
  cursor: pointer;
  transition: outline 0.1s;
  border: 1px solid var(--breakeven-border);
  position: relative;
}

.breakeven-cell:hover,
.breakeven-cell-hover {
  outline: 2px solid #5bc0de;
  outline-offset: -2px;
  z-index: 1;
}

.breakeven-value {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.breakeven-cell-empty {
  background: transparent;
  border: none;
}

.breakeven-cell-na {
  width: 56px;
  height: 40px;
  color: var(--text-hint);
  font-size: 11px;
  border: 1px solid var(--breakeven-border);
}

/* Breakeven Detail Panel */
.breakeven-detail {
  padding: 15px;
  background: var(--bg-card-dark);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.breakeven-detail-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.breakeven-detail-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  font-size: 13px;
  color: var(--text-secondary);
}

.breakeven-detail-stats span {
  white-space: nowrap;
}

/* Best Combinations */
.breakeven-best {
  margin-top: 20px;
}

.breakeven-best h5 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.breakeven-best-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.breakeven-best-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px 15px;
  background: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.breakeven-best-rank {
  font-size: 12px;
  color: var(--text-muted);
  width: 30px;
}

.breakeven-best-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 160px;
}

.breakeven-best-pnl {
  font-size: 14px;
  font-weight: 600;
  font-family: monospace;
  min-width: 140px;
}

.breakeven-best-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Breakeven Legend */
.breakeven-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.breakeven-legend-bar {
  width: 80px;
  height: 10px;
  border-radius: 5px;
}

.breakeven-legend-bar.loss {
  background: linear-gradient(90deg, #d9534f, var(--breakeven-neutral));
}

.breakeven-legend-bar.profit {
  background: linear-gradient(90deg, var(--breakeven-neutral), #5cb85c);
}
/* Theme Variables — scoped to .cfd-root so they don't bleed into the host shell */
.cfd-root {
  --bg-body: #f5f6fa;
  --bg-card: #ffffff;
  --bg-card-dark: #f0f1f3;
  --bg-input: #f8f9fa;
  --bg-hover: #eef0f4;
  --text-primary: #222;
  --text-secondary: #555;
  --text-muted: #888;
  --text-hint: #aaa;
  --border-color: #ddd;
  --border-strong: #ccc;
  --border-subtle: #eee;
  --shadow-color: rgba(0,0,0,0.08);
  --shadow-heavy: rgba(0,0,0,0.15);
  --modal-backdrop: rgba(0,0,0,0.4);
  --chart-grid: #e0e0e0;
  --breakeven-border: #f5f6fa;
  --breakeven-neutral: #ddd;

  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
}

[data-theme="dark"] .cfd-root,
.cfd-root[data-theme="dark"] {
  --bg-body: #1a1a2e;
  --bg-card: #252540;
  --bg-card-dark: #1e1e32;
  --bg-input: #252540;
  --bg-hover: #2a2a45;
  --text-primary: #eee;
  --text-secondary: #aaa;
  --text-muted: #888;
  --text-hint: #666;
  --border-color: #333;
  --border-strong: #444;
  --border-subtle: #555;
  --shadow-color: rgba(0,0,0,0.3);
  --shadow-heavy: rgba(0,0,0,0.5);
  --modal-backdrop: rgba(0,0,0,0.7);
  --chart-grid: #333;
  --breakeven-border: #1a1a2e;
  --breakeven-neutral: #333;
}

* {
  box-sizing: border-box;
}

/* Embedded MFE tab bar */
.embedded-nav {
  display: flex;
  gap: 5px;
  padding: 10px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.embedded-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.embedded-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-card-dark);
}

.embedded-nav a.active {
  color: #fff;
  background: #5bc0de;
}
