/* Shell = SingleSessionShellWindow equivalent */

.vt-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 640px;
  background: var(--tc-bg);
  color: var(--tc-text-primary);
  overflow: hidden;
  padding-top: var(--tc-safe-top);
}

.vt-titlebar {
  height: var(--tc-titlebar-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  padding-inline: calc(16px + var(--tc-safe-left)) calc(16px + var(--tc-safe-right));
  background: var(--tc-shell-titlebar);
  border-bottom: 1px solid var(--tc-shell-pane-border);
  z-index: 50;
}

.vt-titlebar-start {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.vt-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--tc-text-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.vt-nav-toggle:hover {
  background: var(--tc-surface-hover);
  border-color: var(--tc-stroke);
}

.vt-nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.vt-shell.is-nav-open .vt-nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.vt-shell.is-nav-open .vt-nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.vt-shell.is-nav-open .vt-nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.vt-titlebar-logout {
  margin: 0;
}

.vt-titlebar-logout .tc-btn {
  height: 32px;
  font-size: 12px;
  padding: 0 12px;
}

.vt-logout-short {
  display: none;
}

.vt-titlebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.vt-titlebar-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--tc-brand-gradient);
}

.vt-titlebar-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vt-titlebar-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.vt-titlebar-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.vt-titlebar-subtitle {
  font-size: 10.5px;
  color: var(--tc-text-secondary);
  line-height: 1.2;
}

.vt-shell-body {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.vt-sidebar {
  width: var(--tc-sidebar-width);
  flex-shrink: 0;
  background: var(--tc-surface-muted);
  border-left: 1px solid var(--tc-shell-pane-border);
  display: flex;
  flex-direction: column;
  z-index: 10;
  overflow: hidden;
  min-height: 0;
}

.vt-pane-header {
  padding: 18px 12px 10px;
}

.vt-pane-header-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--tc-text-primary);
}

.vt-pane-header-subtitle {
  margin: 5px 0 0;
  font-size: 11.5px;
  color: var(--tc-text-secondary);
  line-height: 1.4;
}

.vt-pane-divider {
  height: 1px;
  margin: 14px 0 0;
  background: var(--tc-stroke);
}

.vt-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 12px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.vt-nav-section-label {
  margin: 12px 8px 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--tc-text-tertiary);
  text-transform: none;
}

.vt-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--tc-text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  border: 1px solid transparent;
}

.vt-nav-item:hover {
  background: var(--tc-surface-hover);
  color: var(--tc-text-primary);
}

.vt-nav-item.active {
  background: var(--tc-selected);
  border-color: var(--tc-teal);
  color: var(--tc-teal-light);
}

.vt-nav-item .vt-nav-icon {
  display: inline-flex;
  flex-shrink: 0;
  opacity: 0.9;
}

.vt-nav-busy-dot {
  margin-inline-start: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tc-amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc-amber) 28%, transparent);
  flex-shrink: 0;
}

.vt-jobs-hud {
  margin-bottom: 10px;
}

.vt-jobs-hud-item + .vt-jobs-hud-item {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--tc-stroke);
}

.vt-jobs-hud-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--tc-teal-light);
  text-decoration: none;
}

.vt-jobs-hud-link:hover {
  text-decoration: underline;
}

.vt-main {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: auto;
  background: transparent;
  padding-bottom: var(--tc-mobile-status-height);
}

.vt-nav-backdrop {
  display: none;
}

.vt-mobile-status {
  display: none;
}

.vt-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.vt-backdrop-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
}

.vt-backdrop-glow--primary {
  width: 480px;
  height: 480px;
  top: -140px;
  left: -100px; /* RTL: glow on "start" (right visually via absolute left in LTR coords of overlay) */
  right: auto;
  background: var(--tc-glow-teal);
  opacity: 0.9;
}

.vt-backdrop-glow--secondary {
  width: 400px;
  height: 400px;
  bottom: -60px;
  right: -80px;
  background: var(--tc-glow-indigo);
  opacity: 0.85;
}

.vt-backdrop-overlay {
  position: absolute;
  inset: 0;
  background: var(--tc-backdrop-overlay);
}

/* In RTL, place teal glow toward the visual right (pane side of content is left of sidebar which is on the right) */
[dir="rtl"] .vt-backdrop-glow--primary {
  left: auto;
  right: -100px;
}

[dir="rtl"] .vt-backdrop-glow--secondary {
  right: auto;
  left: -80px;
}

.vt-sidebar-footer {
  flex-shrink: 0;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--tc-stroke);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.12));
}

.vt-connection-hud {
  border: 1px solid var(--tc-stroke);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--tc-surface-card);
}

.vt-connection-hud--ok {
  border-color: color-mix(in srgb, var(--tc-teal) 55%, var(--tc-stroke));
}

.vt-connection-hud--bad {
  border-color: color-mix(in srgb, var(--tc-rose) 60%, var(--tc-stroke));
}

.vt-connection-hud--busy {
  border-color: color-mix(in srgb, var(--tc-amber) 55%, var(--tc-stroke));
}

.vt-connection-hud--idle {
  border-color: var(--tc-stroke);
}

.vt-connection-hud-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--tc-text-tertiary);
  margin-bottom: 6px;
}

.vt-connection-hud-message {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tc-text-primary);
  line-height: 1.45;
}

.vt-connection-hud--ok .vt-connection-hud-message { color: var(--tc-teal-light); }
.vt-connection-hud--bad .vt-connection-hud-message { color: var(--tc-rose); }
.vt-connection-hud--busy .vt-connection-hud-message { color: var(--tc-amber); }

.vt-connection-hud-detail {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--tc-text-secondary);
  line-height: 1.4;
}

.vt-connection-hud-log {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--tc-stroke);
  max-height: 96px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vt-connection-hud-log-line {
  margin: 0;
  font-size: 10.5px;
  color: var(--tc-text-tertiary);
  line-height: 1.35;
}

.vt-proxy-board-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.vt-proxy-board-main {
  flex: 1;
  min-width: 200px;
}

.vt-proxy-board-status {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 160px;
}

.vt-proxy-board-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  border: 1px solid var(--tc-stroke);
  background: color-mix(in srgb, var(--tc-surface-elevated) 80%, transparent);
  color: var(--tc-text-secondary);
}

.vt-proxy-board-pill.is-ok {
  color: var(--tc-teal-light);
  border-color: color-mix(in srgb, var(--tc-teal) 45%, transparent);
  background: color-mix(in srgb, var(--tc-teal) 14%, transparent);
}

.vt-proxy-board-pill.is-conflict,
.vt-proxy-board-pill.is-missing,
.vt-proxy-board-pill.is-warn {
  color: var(--tc-rose);
  border-color: color-mix(in srgb, var(--tc-rose) 45%, transparent);
  background: color-mix(in srgb, var(--tc-rose) 12%, transparent);
}

.vt-inline-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 120px;
  padding: 16px;
}

.vt-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--tc-teal) 25%, transparent);
  border-top-color: var(--tc-teal);
  animation: vt-spin 0.8s linear infinite;
}

@keyframes vt-spin {
  to { transform: rotate(360deg); }
}

/* Compact status chips (mobile bottom bar) */
.vt-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  max-width: 100%;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--tc-stroke);
  background: var(--tc-surface-card);
  color: var(--tc-text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: right;
  direction: rtl;
}

.vt-status-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--tc-text-tertiary);
}

.vt-status-chip--ok .vt-status-chip-dot {
  background: var(--tc-teal-light);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc-teal) 28%, transparent);
}

.vt-status-chip--bad .vt-status-chip-dot {
  background: var(--tc-rose);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc-rose) 28%, transparent);
}

.vt-status-chip--busy .vt-status-chip-dot {
  background: var(--tc-amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc-amber) 28%, transparent);
}

.vt-status-chip--idle .vt-status-chip-dot {
  background: var(--tc-text-tertiary);
}

.vt-status-chip-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}

.vt-status-chip-detail {
  display: none;
  font-size: 11px;
  font-weight: 500;
  color: var(--tc-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}

.vt-status-chip.is-expanded {
  border-radius: 14px;
  flex-wrap: wrap;
  max-width: min(100%, 420px);
}

.vt-status-chip.is-expanded .vt-status-chip-detail {
  display: block;
  flex: 1 1 100%;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .vt-shell {
    min-height: 0;
  }

  .vt-nav-toggle {
    display: inline-flex;
  }

  .vt-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    top: calc(var(--tc-titlebar-height) + var(--tc-safe-top));
    background: rgba(0, 0, 0, 0.45);
    z-index: 35;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .vt-shell.is-nav-open .vt-nav-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .vt-sidebar {
    position: fixed;
    top: calc(var(--tc-titlebar-height) + var(--tc-safe-top));
    bottom: 0;
    inset-inline-start: 0;
    width: min(280px, 86vw);
    border-left: none;
    border-inline-end: 1px solid var(--tc-shell-pane-border);
    z-index: 40;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    box-shadow: var(--tc-shadow-soft);
  }

  /* Physical translateX: drawer sits on visual right in RTL; +100% hides it off-screen to the right */
  [dir="ltr"] .vt-sidebar {
    transform: translateX(-100%);
  }

  .vt-shell.is-nav-open .vt-sidebar,
  [dir="ltr"] .vt-shell.is-nav-open .vt-sidebar {
    transform: none;
  }

  .vt-sidebar-footer {
    display: none;
  }

  .vt-mobile-status {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 30;
    min-height: 48px;
    padding: 8px 12px;
    padding-bottom: calc(8px + var(--tc-safe-bottom));
    padding-inline: calc(12px + var(--tc-safe-left)) calc(12px + var(--tc-safe-right));
    background: color-mix(in srgb, var(--tc-surface-muted) 92%, transparent);
    border-top: 1px solid var(--tc-shell-pane-border);
    backdrop-filter: blur(10px);
  }

  .vt-shell {
    --tc-mobile-status-height: calc(56px + var(--tc-safe-bottom));
    --tc-page-margin: 18px 14px 20px 14px;
  }

  .vt-nav-item {
    min-height: 44px;
  }

  .vt-proxy-board-main,
  .vt-proxy-board-status {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .vt-titlebar-subtitle {
    display: none;
  }

  .vt-pane-header {
    display: none;
  }

  .vt-shell {
    --tc-page-margin: 14px 12px 16px 12px;
  }

  .vt-logout-label {
    display: none;
  }

  .vt-logout-short {
    display: inline;
  }

  .vt-titlebar-logout .tc-btn {
    padding: 0 10px;
  }
}

@media (max-width: 480px) {
  .vt-titlebar {
    padding-inline: calc(10px + var(--tc-safe-left)) calc(10px + var(--tc-safe-right));
    gap: 8px;
  }

  .vt-titlebar-actions {
    gap: 6px;
  }

  .vt-theme-toggle span:not(.vt-theme-toggle-icon) {
    display: none;
  }

  .vt-shell {
    --tc-page-margin: 12px 10px 14px 10px;
  }
}
