/* Sesi Live + Cloud shell — ported from Tauri overview/live-sessions/accounts */

.view[hidden] {
  display: none !important;
}

.main {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-surface);
}

.main > .view {
  flex: 1;
  min-height: 0;
  display: none;
  flex-direction: column;
  overflow: auto;
  padding: 22px 24px;
  background: var(--bg-base);
}

.main > .view.active {
  display: flex;
}

.main > .view[data-view="live"].active {
  padding: 0;
  overflow: hidden;
  background: var(--bg-surface);
}

.sidebar-section-label {
  padding: 12px 14px 6px;
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* —— Fleet header / body / stats (overview.css) —— */

.fleet-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  background: var(--bg-surface);
}

.fleet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 56px;
  box-sizing: border-box;
}

.fleet-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.fleet-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  justify-content: flex-end;
}

.fleet-header-actions .accounts-search-wrap {
  flex: 0 0 auto;
}

.fleet-sse-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.fleet-sse-pill[data-tone="success"] {
  color: var(--status-success-fg);
  border-color: color-mix(in srgb, var(--status-success-fg) 30%, transparent);
  background: color-mix(in srgb, var(--status-success-fg) 10%, transparent);
}

.fleet-sse-pill[data-tone="warn"] {
  color: var(--status-warning-fg, #fbbf24);
}

.fleet-sse-pill[data-tone="muted"] {
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--status-muted-fg);
  opacity: 0.45;
}

.fleet-sse-pill[data-tone="success"] .status-dot {
  background: var(--status-success-fg);
  opacity: 1;
  box-shadow: 0 0 6px var(--status-success-glow);
}

.fleet-sse-pill[data-tone="warn"] .status-dot {
  background: var(--status-warning-fg, #fbbf24);
  opacity: 1;
}

.fleet-body {
  flex: 1;
  overflow: auto;
  padding: 20px;
  min-height: 0;
}

.fleet-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.fleet-stat-card {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fleet-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fleet-stat-card strong {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.fleet-hint {
  margin: 0 0 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* —— Search (accounts.css) —— */

.accounts-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
}

.accounts-search {
  width: 76px;
  min-width: 0;
  height: 26px;
  padding: 0 6px 0 26px;
  font-family: var(--font);
  font-size: 12px;
  color: var(--text-secondary);
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 7px center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s, width 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.accounts-search::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.accounts-search::placeholder {
  color: var(--text-muted);
}

.accounts-search:hover {
  color: var(--text-primary);
  background-color: var(--bg-hover);
}

.accounts-search:focus,
.accounts-search:not(:placeholder-shown) {
  width: 160px;
}

.accounts-search:focus {
  color: var(--text-primary);
  background-color: var(--bg-hover);
  border-color: var(--border-strong);
  box-shadow: none;
}

/* —— Live toolbar / filters / table (live-sessions.css) —— */

.live-sessions-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  flex: 1;
  padding-bottom: 0;
}

.live-sessions-body > .fleet-stats {
  margin-bottom: 16px;
}

.live-sessions-body > .fleet-hint {
  margin-bottom: 16px;
}

.live-sessions-body > .live-session-toolbar {
  margin-bottom: 12px;
}

.live-sessions-body > .live-session-table-wrap {
  flex: 1;
  min-height: 0;
  margin: 0 -20px 0;
  border-top: 1px solid var(--border);
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-radius: 0;
  background: transparent;
  overflow: auto;
}

.live-session-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.live-session-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.live-filter {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.live-filter.is-active {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-hover);
  box-shadow: none;
}

.live-session-toolbar-end {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.live-worker-filter {
  min-width: 120px;
  max-width: 220px;
  border: 1px solid var(--border);
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 6px 36px 6px 10px;
  font-family: var(--font);
  font-size: 12px;
}

.live-filter-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.table-wrap {
  flex: 1;
  overflow: auto;
  min-width: 0;
}

.accounts-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.live-sessions-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-surface);
}

.live-sessions-table {
  width: 100%;
  min-width: 1560px;
  max-width: none;
}

.accounts-table.live-sessions-table {
  table-layout: fixed;
  width: 100%;
}

.live-sessions-table th,
.live-sessions-table td {
  font-size: 11px;
  padding: 6px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.live-sessions-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10.5px;
  text-overflow: clip;
}

.live-sessions-table tbody tr:hover td {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.live-sessions-table .mono {
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.accounts-table.live-sessions-table .col-index,
.accounts-table.live-sessions-table .cell-index {
  width: 2.2%;
  min-width: 0;
  max-width: none;
  text-align: right;
  color: var(--text-muted);
}

.accounts-table.live-sessions-table .col-name,
.accounts-table.live-sessions-table .cell-name {
  width: 8.4%;
}

.accounts-table.live-sessions-table .col-state,
.accounts-table.live-sessions-table .cell-state {
  width: 5.5%;
}

.accounts-table.live-sessions-table .col-game,
.accounts-table.live-sessions-table .cell-game {
  width: 11%;
}

.accounts-table.live-sessions-table .col-lv,
.accounts-table.live-sessions-table .cell-lv {
  width: 2%;
  text-align: right;
}

.accounts-table.live-sessions-table .col-vip,
.accounts-table.live-sessions-table .cell-vip {
  width: 2.2%;
  text-align: right;
}

.accounts-table.live-sessions-table .col-balance,
.accounts-table.live-sessions-table .cell-balance {
  width: 5.5%;
  text-align: right;
}

.accounts-table.live-sessions-table .col-objective,
.accounts-table.live-sessions-table .cell-objective {
  width: 5%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.accounts-table.live-sessions-table .col-target,
.accounts-table.live-sessions-table .cell-target {
  width: 3.5%;
  text-align: right;
}

.accounts-table.live-sessions-table .col-phase,
.accounts-table.live-sessions-table .cell-phase {
  width: 4.5%;
}

.accounts-table.live-sessions-table .col-cap,
.accounts-table.live-sessions-table .cell-cap {
  width: 5.7%;
  text-align: right;
}

.accounts-table.live-sessions-table .col-bet,
.accounts-table.live-sessions-table .cell-bet,
.accounts-table.live-sessions-table .col-win,
.accounts-table.live-sessions-table .cell-win {
  width: 4.3%;
  text-align: right;
}

.accounts-table.live-sessions-table .col-pnl,
.accounts-table.live-sessions-table .cell-pnl {
  width: 4.8%;
  text-align: right;
}

.accounts-table.live-sessions-table .col-run,
.accounts-table.live-sessions-table .cell-run {
  width: 3.6%;
  text-align: right;
}

.accounts-table.live-sessions-table .col-proxy,
.accounts-table.live-sessions-table .cell-proxy {
  width: 6.5%;
  color: var(--text-secondary);
}

.accounts-table.live-sessions-table .col-note,
.accounts-table.live-sessions-table .cell-note {
  width: 11%;
}

.accounts-table.live-sessions-table .col-worker,
.accounts-table.live-sessions-table .cell-worker {
  width: 6%;
  color: var(--text-secondary);
}

.accounts-table.live-sessions-table .col-actions,
.accounts-table.live-sessions-table .cell-actions {
  width: 4%;
  text-align: center;
  overflow: visible;
}

.live-sessions-table--hide-worker.accounts-table .col-note,
.live-sessions-table--hide-worker.accounts-table .cell-note {
  width: 17%;
}

.live-sessions-table--hide-worker .col-worker,
.live-sessions-table--hide-worker .cell-worker {
  display: none;
}

.live-sessions-table .live-session-stop {
  min-width: 0;
  padding: 2px 8px;
  font-size: 11px;
  height: auto;
}

.live-sessions-table .live-session-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: var(--text-primary);
}

.live-sessions-table .cell-win.monitor-up,
.live-sessions-table .cell-pnl.monitor-up,
.monitor-up {
  color: var(--success, #22c55e);
}

.live-sessions-table .cell-win.monitor-down,
.live-sessions-table .cell-pnl.monitor-down,
.monitor-down {
  color: var(--danger, #ef4444);
}

.live-section-row td {
  padding: 8px 10px 4px;
  border-bottom: none;
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

.live-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
}

.live-session-empty td {
  padding: 24px 12px;
  text-align: center;
}

.live-sessions-empty {
  margin: 0;
}

/* —— Mobile cards (web-only; desktop never shows these) —— */

.live-mobile-only {
  display: none;
}

.live-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.live-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.live-card-head strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.live-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 0 0 10px;
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
}

.live-card-grid dt {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0;
}

.live-card-grid dd {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.live-card-actions {
  display: flex;
  justify-content: flex-end;
}

.live-section-label--cards {
  margin: 16px 0 8px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

@media (max-width: 960px) {
  .fleet-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .fleet-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fleet-header {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
  }

  .fleet-header-actions {
    flex-wrap: wrap;
  }

  .accounts-search-wrap {
    flex: 1 1 100%;
  }

  .accounts-search,
  .accounts-search:focus,
  .accounts-search:not(:placeholder-shown) {
    width: 100%;
  }

  .live-desktop-only {
    display: none !important;
  }

  .live-mobile-only {
    display: block !important;
  }

  .live-sessions-body > .live-session-table-wrap {
    margin: 0;
    border-top: none;
  }
}
