/* ── Custom font ── */
body {
  font-family: 'Inter', sans-serif;
}

/* ── Robot metric popover (dark theme) ─────────────────────────────────────── */
.popover.robot-metric-popover {
  --bs-popover-bg: #1a1e24;
  --bs-popover-border-color: rgba(255, 255, 255, 0.12);
  --bs-popover-header-bg: rgba(59, 130, 246, 0.15);
  --bs-popover-header-color: #e5e7eb;
  --bs-popover-body-color: #d1d5db;
  --bs-popover-max-width: 280px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.popover.robot-metric-popover .popover-header {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.popover.robot-metric-popover .popover-body {
  font-size: 0.75rem;
  line-height: 1.45;
}
.popover.robot-metric-popover .popover-body code {
  background: rgba(255, 255, 255, 0.06);
  color: #93c5fd;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.72rem;
}
.popover.robot-metric-popover .popover-arrow::after {
  border-top-color: #1a1e24;
  border-bottom-color: #1a1e24;
}

/* ── Demo mode: hide all write/mutate UI ───────────────────────────────────── */
body.demo-mode .league-edit-btn,
body.demo-mode #addLeagueTrigger,
body.demo-mode #killSwitchCard .form-check,
body.demo-mode #simulatorModeToggle,
body.demo-mode #mfaSetupCard,
body.demo-mode button.robot-delete-btn,
body.demo-mode button.robot-edit-btn,
body.demo-mode .robot-reset-btn,
body.demo-mode #addRobotBtn,
body.demo-mode #calendarBtn ~ * .form-check-input {
  display: none !important;
}
body.demo-mode [data-hide-in-demo] {
  display: none !important;
}
body.demo-mode [data-disable-in-demo] {
  pointer-events: none !important;
  opacity: 0.5 !important;
}
#demoBadge {
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  color: #fff;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ── Login card ── */
.login-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #1a1d21;
}

.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.login-divider span {
  padding: 0 0.75rem;
}

/* ── Navbar ── */
#mainNavbar {
  background: #0f1117;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── Tab nav: btn-check radio toggle ── */
.tab-nav .btn {
  font-size: 0.82rem;
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 600;
  height: 32px;
  display: inline-flex;
  align-items: center;
}

#gamesFilterContainer .btn-group,
#gamesFilterContainer select {
  flex-shrink: 0;
}

#totalCountWrapper {
  text-align: center;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Filter strip ── */
.filter-area {
  background: #12151a;
  min-height: 0;
  overflow: hidden;
  /* no transition – instant show/hide to avoid jank on tab switch */
  border-bottom: 0px solid transparent;
  padding: 0;
}

.filter-area.has-filter {
  min-height: 50px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  overflow: visible;
}

#gamesFilterContainer.tab-hidden,
#sessionsFilterContainer.tab-hidden,
#robotsFilterContainer.tab-hidden {
  display: none !important;
  visibility: hidden;
}

/* ── Tables ── */
#tabContent {
  min-height: 400px;
}

.table-container.tab-hidden {
  display: none;
}

/* Table header green accent */
.table thead th {
  background: #198754;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-color: #157347;
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}


/* ── Status badges (Bootstrap-style, custom colours) ── */
.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

.status-complete {
  background: #374151;
  color: #9ca3af;
}

.status-closed {
  background: #fee2e2;
  color: #991b1b;
}

.status-other {
  background: #fef3c7;
  color: #92400e;
}

.status-halftime {
  background: #e0f2fe;
  color: #0369a1;
}

.status-inprogress {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #10b981;
}

.status-inprogress::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  margin-right: 4px;
  vertical-align: baseline;
  position: relative;
  top: -0.5px;
  animation: blink-dot 2s ease-in-out infinite;
  animation-delay: var(--blink-delay, 0ms);
}

.status-interrupted {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #f59e0b;
}

.status-interrupted::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  margin-right: 4px;
  vertical-align: baseline;
  position: relative;
  top: -0.5px;
  animation: blink-dot 2s ease-in-out infinite;
  animation-delay: var(--blink-delay, 0ms);
}

@keyframes blink-dot {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Session blinking green dot ── */
.session-blink-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  vertical-align: middle;
  position: relative;
  top: -0.5px;
  animation: blink-dot 2s ease-in-out infinite;
  animation-delay: var(--blink-delay, 0ms);
}

/* ── Session blinking yellow dot (resting/entering orders) ── */
.session-blink-dot-yellow {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  vertical-align: middle;
  position: relative;
  top: -0.5px;
  animation: blink-dot 2s ease-in-out infinite;
  animation-delay: var(--blink-delay, 0ms);
}

/* ── Flash animation for live bid/ask changes ── */
@keyframes highlightFlash {
  0% {
    color: #ef4444;
  }

  30% {
    color: #ef4444;
  }

  100% {
    color: inherit;
  }
}

.flash-update {
  animation: highlightFlash 1s ease-out;
  display: inline-block;
}

/* ── Error bar ── */
#error-msg {
  display: none;
}

/* ── Recommendation button ── */
.rec-btn {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
}

/* ── Winner/Order status pills ── */
.order-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
}

.bg-purple {
  background-color: #6f42c1 !important;
  color: #fff !important;
}

/* ── Info button ── */
.info-btn {
  background: transparent;
  border: none;
  color: #adb5bd;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 1.1rem;
}

.info-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.info-btn:active {
  transform: scale(0.9);
}

.copy-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #198754;
  color: white;
  padding: 8px 20px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.copy-toast.show {
  opacity: 1;
}

/* ── Settings inputs ── */
.settings-num-input {
  width: 80px;
  text-align: center;
}

/* ── Emulator banner ── */
body>.alert-warning {
  position: fixed;
  bottom: 0;
  width: 100%;
  margin: 0;
  border-radius: 0;
  font-size: 0.8rem;
  text-align: center;
  z-index: 9999;
}

/* ════════════════════════════════════════
   RESPONSIVE / MOBILE
   ════════════════════════════════════════ */

/* ── Login card ── */
@media (max-width: 480px) {
  #login-container {
    align-items: flex-start;
    padding: 40px 16px 16px;
  }

  .login-card {
    width: 100% !important;
  }
}

/* ── Tab labels: desktop — hide icons, show inline text ── */
.tab-short { display: none; }
.tab-icon { display: none !important; }

/* ── Settings button: icon style on desktop ── */
@media (min-width: 768px) {
  #tabNav label[for="settingsToggle"] {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.2em;
  }
  #tabNav label[for="settingsToggle"] .tab-label { display: none; }
  #tabNav label[for="settingsToggle"] .tab-icon { display: inline-block !important; font-size: 20px; }
}

/* ── Navbar: всё на одной строке (tablet) ── */
@media (min-width: 768px) and (max-width: 991.98px) {
  #mainNavbar .container-fluid {
    flex-wrap: nowrap;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  #tabNav {
    margin-left: 0 !important;
  }

  .tab-nav .btn {
    font-size: 0.75rem;
    padding: 3px 8px;
  }
}

/* ── Mobile: hide scrollbar ── */
@media (max-width: 767.98px) {
  html, body {
    scrollbar-width: none;           /* Firefox */
    -ms-overflow-style: none;        /* IE/Edge */
  }
  html::-webkit-scrollbar,
  body::-webkit-scrollbar {
    display: none;                   /* Chrome/Safari */
  }
}

/* ── Mobile: bottom tab bar ── */
@media (max-width: 767.98px) {
  #mainNavbar .container-fluid {
    flex-wrap: nowrap;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  /* Bottom tab bar — iOS style */
  #tabNav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    background: rgba(15, 17, 23, 0.92);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex !important;
    justify-content: space-around;
    gap: 0 !important;
    padding: 10px 8px calc(55px + env(safe-area-inset-bottom));
    margin: 0;
  }

  /* Hide radio inputs in tab bar */
  #tabNav .btn-check {
    position: absolute;
    clip: rect(0, 0, 0, 0);
  }

  #tabNav .btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.6rem;
    font-weight: 500;
    padding: 6px 0 2px;
    border-radius: 0;
    text-align: center;
    border: none !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.35) !important;
    transition: color 0.15s ease;
    letter-spacing: 0.02em;
  }

  #tabNav .btn:hover,
  #tabNav .btn:focus {
    box-shadow: none !important;
  }

  #tabNav .btn-check:checked + .btn {
    color: #4ade80 !important;
    background: transparent !important;
  }


  /* Show Material icons above labels on mobile */
  .tab-icon.material-symbols-rounded {
    display: block !important;
    font-size: 28px;
    margin-bottom: 1px;
  }

  .tab-full { display: none; }
  .tab-short { display: inline; }

  /* Add bottom padding to page content so it's not hidden behind tab bar */
  #tabContent {
    padding-bottom: 110px !important;
  }
}

/* Mobile period buttons hidden on desktop */
#sessionsPeriodBtns {
  display: none;
}

/* ── Filter area ── */
@media (max-width: 767.98px) {
  .filter-area.has-filter {
    min-height: auto;
    overflow: visible;
    padding: 10px 0;
  }

  #gamesFilterContainer {
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .filter-area input[type="date"],
  .filter-area select {
    flex: 1;
    min-width: 0;
  }

  /* ── Sessions filter: collapsible on mobile ── */
  #sessionsFilterToggle {
    display: inline-flex !important;
  }

  /* Show mobile period buttons next to filter icon */
  #sessionsPeriodBtns {
    display: inline-flex !important;
  }

  #sessionsPeriodBtns .btn {
    font-size: 0.85rem;
    padding: 5px 14px;
  }

  /* Hide desktop period buttons on mobile */
  #sessionsDesktopPeriodBtns {
    display: none !important;
  }

  #sessionsFilterPanel {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 8px 0 0;
    width: 100%;
  }

  #sessionsFilterPanel.sessions-filter-collapsed {
    display: none !important;
  }

  #sessionsFilterPanel > .d-flex {
    width: 100%;
  }

  #sessionsFilterPanel select,
  #sessionsFilterPanel input[type="date"] {
    width: 100% !important;
    flex: 1;
    min-width: 0;
  }

  #sessionsDateRow {
    flex-wrap: wrap;
    gap: 6px !important;
  }

  #sessionsDateRow input[type="date"] {
    flex: 1 1 100px;
    min-width: 100px;
  }
}

/* Hide mobile-only cards on desktop */
.session-card-mobile {
  display: none;
}
.session-collapse-mobile {
  display: none;
}

/* ── Карточные таблицы на мобильных ── */
@media (max-width: 767.98px) {

  /* Убираем горизонтальный скролл — не нужен с карточками */
  .table-responsive {
    overflow-x: visible;
  }

  /* Скрываем шапку таблицы */
  .table thead {
    display: none;
  }

  /* Каждая строка — отдельная карточка */
  .table tbody tr {
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 10px;
    background: #1a1d21;
    overflow: hidden;
  }
  /* Chart rows: full width, no card styling */
  .table tbody tr[id$="_chart"] {
    border: none !important;
    border-radius: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  .table tbody tr[id$="_chart"] > td {
    display: block !important;
    padding: 4px 0 !important;
    width: 100% !important;
  }

  /* Каждая ячейка — строка «метка : значение» (only direct table cells, not nested) */
  .table > tbody > tr > td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 14px;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    font-size: 0.85rem;
    flex-wrap: wrap;
  }

  .table > tbody > tr > td:last-child {
    border-bottom: none !important;
  }

  /* Show mobile collapse, hide desktop collapse */
  .session-collapse-desktop { display: none !important; }
  .session-collapse-mobile { display: block !important; }

  /* Restore normal table display inside collapse (orders table) */
  #robotsTable .collapse .table { font-size: 0.72rem; }
  #robotsTable .collapse .table thead { display: table-header-group !important; }
  #robotsTable .collapse .table thead tr { display: table-row !important; border: none !important; border-radius: 0 !important; margin: 0 !important; background: transparent !important; }
  #robotsTable .collapse .table tbody tr { display: table-row !important; border: none !important; border-radius: 0 !important; margin: 0 !important; background: transparent !important; overflow: visible !important; }
  #robotsTable .collapse .table tbody td,
  #robotsTable .collapse .table thead th {
    display: table-cell !important;
    padding: 3px 6px !important;
    border: none !important;
    font-size: 0.72rem;
    flex-wrap: nowrap;
  }
  #robotsTable .collapse .table tbody td::before {
    display: none !important;
    content: none !important;
  }
  /* Prevent horizontal overflow on collapse content */
  #robotsTable .collapse > div {
    overflow-x: auto;
  }

  /* Метка из data-label */
  .table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    flex-shrink: 0;
    min-width: 90px;
  }
} /* end mobile media query — robot cards below apply at all sizes */

/* ── Robot compact cards (all viewports) ── */
#robotConfigsTable {
  table-layout: fixed !important;
  width: 100% !important;
}
#robotConfigsTable thead {
  display: none;
}
#robotConfigsTable tbody tr {
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  margin-bottom: 10px;
  background: #1a1d21;
  overflow: hidden;
}
#robotConfigsTable tbody td {
  border: none !important;
}
#robotConfigsTable tbody td::before {
  display: none !important;
  content: none !important;
}
.robot-card-mobile {
    display: block !important;
    padding: 0 !important;
    border-bottom: none !important;
  }
  .robot-card-mobile::before {
    display: none !important;
  }
  #robotConfigsTable tbody td:not(.robot-card-mobile) {
    display: none !important;
  }
  .robot-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 14px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .robot-card-body {
    padding: 0;
  }
  /* Meta line directly below header: robot_id · league + strategy badge. */
  .robot-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  }
  .robot-card-meta-id {
    font-family: var(--bs-font-monospace, monospace);
    font-size: 0.65rem;
    color: #9ca3af;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Section: a grouped block of rows (Setup / Performance). */
  .robot-card-section {
    padding: 6px 14px;
  }
  .robot-card-section + .robot-card-section {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
  }
  .robot-card-section-label {
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 0.58rem;
    color: #6b7280;
    padding: 2px 0 4px;
  }
  .robot-card-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    column-gap: 8px;
    align-items: baseline;
    padding: 3px 0;
    font-size: 0.75rem;
    line-height: 1.45;
  }
  .robot-card-row-label {
    color: #9ca3af;
    font-size: 0.7rem;
  }
  .robot-card-row-value {
    text-align: right;
    min-width: 0;
    word-break: break-word;
  }
  .robot-card-actions {
    display: flex;
    gap: 8px;
    padding: 8px 14px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }
  /* Setup section: labels left, pill-chip values right */
  .robot-setup-row {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    column-gap: 8px;
    align-items: center;
    padding: 4px 0;
  }
  .robot-setup-label {
    color: #9ca3af;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
  }
  .robot-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
  }
  .robot-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.3;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
    white-space: nowrap;
  }
  .robot-chip--primary {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.35);
    color: #93c5fd;
    font-weight: 600;
  }
  .robot-chip--success {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.32);
    color: #86efac;
  }
  .robot-chip--danger {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.32);
    color: #fca5a5;
  }
  .robot-chip--warning {
    background: rgba(234, 179, 8, 0.14);
    border-color: rgba(234, 179, 8, 0.32);
    color: #fde68a;
  }
  .robot-chip--info {
    background: rgba(56, 189, 248, 0.14);
    border-color: rgba(56, 189, 248, 0.32);
    color: #7dd3fc;
  }
  /* Setup action row: toggle + Edit + More, sits under Risk chip row */
  .robot-setup-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(255, 255, 255, 0.06);
  }
  .robot-setup-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    user-select: none;
    min-height: 32px;
  }
  .robot-setup-toggle .form-check-input {
    margin: 0;
    float: none;
    flex-shrink: 0;
    cursor: pointer;
  }
  .robot-setup-toggle-text {
    font-size: 0.72rem;
    font-weight: 600;
    color: #9ca3af;
    letter-spacing: 0.3px;
    cursor: pointer;
    margin: 0;
  }
  .robot-setup-toggle:has(input:checked) .robot-setup-toggle-text {
    color: #86efac;
  }
  .robot-setup-edit {
    font-weight: 500;
    font-size: 0.72rem;
    padding: 3px 12px;
    border-radius: 8px;
    color: #9ca3af;
    border-color: rgba(255, 255, 255, 0.1);
  }
  .robot-setup-edit:hover {
    color: #e5e7eb;
    background: rgba(255, 255, 255, 0.04);
  }
  .robot-setup-actions {
    justify-content: flex-start;
  }
  .robot-setup-actions .dropdown {
    margin-left: auto;
  }
  .robot-setup-more {
    width: 36px;
    padding: 4px 0;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1;
    color: #9ca3af;
    border-color: rgba(255, 255, 255, 0.1);
  }
  .robot-setup-more:hover {
    color: #e5e7eb;
    background: rgba(255, 255, 255, 0.04);
  }
  /* Performance: 3-column grid of square metric cells. */
  .robot-metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-top: 4px;
  }
  .robot-metric {
    display: block;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 6px 4px;
    text-align: center;
    background: rgba(255, 255, 255, 0.015);
    min-width: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
  }
  .robot-metric:hover,
  .robot-metric:focus {
    background: rgba(59, 130, 246, 0.10);
    border-color: rgba(59, 130, 246, 0.35);
    outline: none;
  }
  .robot-metric--wide {
    grid-column: 1 / -1;
  }
  /* Robot config-change history rows inside the expanded card. */
  .robot-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 2px;
  }
  .robot-history-row {
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    padding: 5px 7px;
    background: rgba(255, 255, 255, 0.015);
  }
  .robot-history-meta {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 0.6rem;
    color: #6b7280;
    margin-bottom: 2px;
  }
  .robot-history-ts {
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
  }
  .robot-history-who {
    color: #6b7280;
  }
  .robot-history-who::before { content: '· '; }
  .robot-history-changes {
    font-size: 0.68rem;
    line-height: 1.4;
    word-break: break-word;
  }
  .robot-history-field {
    color: #93c5fd;
    font-weight: 500;
  }
  .robot-metric-label {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    line-height: 1.2;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .robot-metric-value {
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Period toggle (30d / 1y / All) — lives in the section label row. */
  .robot-period-toggle {
    display: inline-flex;
    gap: 2px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    padding: 1px;
    background: rgba(0, 0, 0, 0.2);
  }
  .robot-period-btn {
    background: transparent;
    color: #9ca3af;
    border: none;
    padding: 2px 5px;
    font-size: 0.58rem;
    border-radius: 3px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.3;
  }
  .robot-period-btn:hover {
    color: #e5e7eb;
  }
  .robot-period-btn.is-active {
    background: rgba(59, 130, 246, 0.25);
    color: #e5e7eb;
  }
  /* Collapsed state: hide everything except the header */
  .robot-card-mobile[data-expanded="0"] .robot-card-body,
  .robot-card-mobile[data-expanded="0"] .robot-card-actions {
    display: none !important;
  }
  .robot-card-mobile[data-expanded="0"] .robot-card-header {
    border-bottom: none;
  }
  .robot-card-header {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
  }
  .robot-card-chevron {
    display: inline-block;
    width: 12px;
    color: #6b7280;
    font-size: 0.7rem;
    transition: transform 0.15s ease;
    transform-origin: center;
  }
.robot-card-mobile[data-expanded="1"] .robot-card-chevron {
  transform: rotate(90deg);
}

@media (max-width: 767.98px) {
  /* ── Session compact cards on mobile ── */
  #robotsTable {
    table-layout: fixed !important;
    width: 100% !important;
  }
  .session-card-mobile {
    display: block !important;
    padding: 0 !important;
    border-bottom: none !important;
  }
  .session-card-mobile::before {
    display: none !important;
  }
  #robotsTable > tbody > tr > td:not(.session-card-mobile) {
    display: none !important;
  }
  /* Show collapse row cells */
  #robotsTable > tbody > tr > td[colspan] {
    display: block !important;
    padding: 0 !important;
    border: none !important;
  }
  #robotsTable > tbody > tr > td[colspan]::before {
    display: none !important;
  }
  /* Collapse row should merge with card above — no separate card styling */
  #robotsTable tbody tr.session-collapse-row {
    border: none !important;
    margin: 0 0 10px 0 !important;
    margin-top: -11px !important;
    background: transparent !important;
    border-radius: 0 0 10px 10px !important;
    overflow: hidden;
  }
  .session-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .session-card-body {
    padding: 2px 12px;
  }
  .session-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    font-size: 0.82rem;
  }
  .session-card-row span:first-child {
    font-size: 0.72rem;
  }
  .session-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 12px 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  /* ── Games dashboard: sessions stack vertically ── */
  #milestoneTable tbody td[data-label="Sessions"] {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  /* ── Games dashboard: карточки без меток ── */
  #milestoneTable tbody td[data-label="Start Time"] {
    display: block;
    padding: 10px 14px 4px;
    border-bottom: none !important;
  }
  #milestoneTable tbody td[data-label="Start Time"]::before {
    display: none;
  }

  #milestoneTable tbody td[data-label="Game"] {
    display: block;
    padding: 4px 14px 10px;
    overflow-x: auto;
  }
  #milestoneTable tbody td[data-label="Game"]::before {
    display: none;
  }
  /* Вложенные таблички (scoreboard) не ломаем */
  #milestoneTable tbody td[data-label="Game"] table {
    margin: 0 !important;
  }
  #milestoneTable tbody td[data-label="Game"] table thead {
    display: table-header-group;
  }
  #milestoneTable tbody td[data-label="Game"] table tbody tr {
    display: table-row;
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    background: transparent;
    overflow: visible;
  }
  #milestoneTable tbody td[data-label="Game"] table tbody td,
  #milestoneTable tbody td[data-label="Game"] table thead th {
    display: table-cell !important;
    padding: 2px 6px !important;
    border: none !important;
    border-bottom: none !important;
    font-size: 0.82rem;
    flex-wrap: nowrap;
  }
  #milestoneTable tbody td[data-label="Game"] table tbody td::before {
    display: none !important;
    content: none !important;
  }

  /* ── Остальные таблицы: метка сверху для составного контента ── */
  .table tbody td[data-label="Game Title"],
  .table tbody td[data-label="Game Name"],
  .table tbody td[data-label="Type"] {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  /* Settings: ширина числовых инпутов */
  .settings-num-input {
    width: 90px !important;
  }
}

/* Today-card Wins / Losses split tile. Two equal cells separated by a
   thin divider, each showing count + dollar amount. */
.ov-today-wl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.ov-today-wl-cell {
  border-radius: 6px;
  padding: 4px 6px;
  text-align: center;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}
.ov-today-wl-wins .ov-today-wl-count { color: #22c55e; }
.ov-today-wl-losses .ov-today-wl-count { color: #ef4444; }
.ov-today-wl-label {
  color: #6b7280;
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.ov-today-wl-count {
  color: #e5e7eb;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.05;
}
.ov-today-wl-amt {
  font-size: 0.62rem;
  font-weight: 500;
  opacity: 0.85;
}

/* Today card — unified shell */
.ov-today-card {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background 0.3s ease;
}
.ov-today-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.ov-today-title {
  font-weight: 700;
  color: #f3f4f6;
  font-size: 0.9rem;
  letter-spacing: 0.2px;
}
.ov-today-sessions-chip {
  font-size: 0.65rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 2px 9px;
  letter-spacing: 0.3px;
}
.ov-today-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Hero P&L */
.ov-today-hero {
  text-align: center;
}
.ov-today-hero-label {
  color: #9ca3af;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 2px;
}
.ov-today-hero-value {
  font-weight: 800;
  font-size: 1.8rem;
  line-height: 1.1;
  letter-spacing: -0.5px;
  margin: 2px 0;
}
.ov-today-hero-breakdown {
  margin-top: 4px;
  font-size: 0.72rem;
  color: #cbd5e1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
}
.ov-today-hero-breakdown > span,
.ov-today-hero-breakdown > a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ov-pnl-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  font-size: 0.7rem;
  line-height: 1.2;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.ov-pnl-pill-label {
  color: #9ca3af;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 0.6rem;
}
.ov-pnl-pill-value {
  color: #e5e7eb;
  font-weight: 700;
}
.ov-pnl-pill-warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  cursor: pointer;
}
.ov-pnl-pill-warn:hover {
  background: rgba(245, 158, 11, 0.18);
}
.ov-pnl-pill-warn .ov-pnl-pill-value {
  color: #fbbf24;
}
.ov-pnl-pill-icon {
  font-size: 0.7rem;
  line-height: 1;
}

/* W/L grid with centered Win Rate */
.ov-today-wl-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 4px;
  align-items: stretch;
  padding: 4px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.ov-today-wl-cell {
  padding: 8px 6px;
}
.ov-today-wl-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  min-width: 62px;
}
.ov-today-winrate-value {
  font-weight: 700;
  color: #e5e7eb;
  font-size: 0.95rem;
  line-height: 1.05;
  margin-top: 1px;
}

/* Chips row */
.ov-today-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ov-today-chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  font-size: 0.72rem;
}
.ov-today-chip-icon {
  font-size: 0.8rem;
  opacity: 0.9;
}
.ov-today-chip-label {
  color: #9ca3af;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.ov-today-chip-value {
  margin-left: auto;
  color: #e5e7eb;
}
.ov-today-chip-reverse {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
}