/* App shell: Desktop SaaS Sidebar Layout up to 2100px */

* {
  box-sizing: border-box;
}

body {
  background-color: #f1f3f5;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.app {
  display: flex;
  width: 100%;
  max-width: 2100px;
  min-height: 100vh;
  background: var(--white);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.08);
  position: relative;
}

/* ---------- Left Sidebar ---------- */
.app-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 2px solid var(--ink);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1rem 1rem;
  border-bottom: 2px solid var(--ink);
  cursor: pointer;
  user-select: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.brand-badge {
  font-size: .625rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--purple);
  letter-spacing: .05em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .625rem .75rem;
  border: 2px solid transparent;
  border-radius: 12px;
  background: transparent;
  font-size: .875rem;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: all .12s ease;
  position: relative;
}

.nav-item:hover {
  background: var(--purple-hover);
  border-color: var(--ink);
  transform: translateX(3px);
}

.nav-item.active {
  background: var(--lime);
  border-color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  font-weight: 800;
}

.nav-item .i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-divider {
  height: 1px;
  background: #e2e8f0;
  margin: .5rem 0;
}

.nav-section-title {
  font-size: .6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray);
  padding: .25rem .5rem;
}

.nav-badge {
  position: absolute;
  right: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 2px solid var(--ink);
  border-radius: 99px;
  background: var(--crimson);
  color: var(--white);
  font-size: .6875rem;
  font-weight: 800;
  line-height: 1;
}

.nav-count-badge {
  position: absolute;
  right: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border: 1.5px solid var(--ink);
  border-radius: 99px;
  background: var(--white);
  color: var(--ink);
  font-size: .6875rem;
  font-weight: 800;
}

/* Sidebar Run Bar Dock */
.sidebar-runbar {
  flex: none;
  padding: .875rem .75rem;
  border-top: 2px solid var(--ink);
  background: #fdfdfd;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.sidebar-run-buttons {
  display: flex;
  align-items: center;
  gap: .375rem;
}

.run-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  margin: 0 !important;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font-size: 1.125rem;
  cursor: pointer;
  transition: all .12s ease;
  box-shadow: 1.5px 1.5px 0 var(--ink);
  box-sizing: border-box;
  line-height: 1;
}

.run-btn::after,
.run-btn::before {
  display: none !important;
}

.run-btn:hover {
  transform: translateY(-1px);
  box-shadow: 2px 2px 0 var(--ink);
}

.run-btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

.run-btn.run-start {
  flex: 1;
  background: var(--lime);
  font-size: .875rem;
  font-weight: 800;
  gap: .375rem;
}

.run-btn.run-start.active {
  background: var(--purple-hover);
}

.run-btn.run-pause {
  width: 44px;
  background: #fffbe6;
}

.run-btn.run-pause.active {
  background: #ffe58f;
}

.run-btn.run-stop {
  width: 44px;
  background: #fff0f0;
  color: var(--crimson);
}

.run-btn.run-stop:hover {
  background: var(--crimson);
  color: var(--white);
}

.sidebar-speed-ctrl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--white);
  box-shadow: 1.5px 1.5px 0 var(--ink);
}

.speed-lbl {
  font-size: .75rem;
  font-weight: 800;
  color: var(--gray);
  text-transform: uppercase;
}

.speed-step-btn {
  width: 24px;
  height: 26px;
  background: transparent;
  border: 0;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background .12s;
  padding: 0;
}

.speed-step-btn:hover {
  background: var(--purple-hover);
}

.speed-indicator-badge {
  font-size: .75rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--ink);
  min-width: 24px;
  text-align: center;
}

.speed-indicator-badge.warn {
  background: var(--crimson);
  color: var(--white);
}

/* ---------- App Content Area ---------- */
.app-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-topbar {
  flex: none;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 2px solid var(--ink);
  background: var(--white);
}

.topbar-crumb {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: .75rem;
}

/* VPS Resource & Auto-Boost Indicator Pill in Topbar */
.vps-resource-pill {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .75rem;
  border: 2px solid var(--ink);
  border-radius: 99px;
  background: #f8fafc;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: .8125rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}

.vps-resource-pill:hover {
  transform: translateY(-1px);
  box-shadow: 3px 3px 0 var(--ink);
  background: #f1f5f9;
}

.vps-pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  animation: vpsPulse 2s infinite;
  flex-shrink: 0;
}

.vps-pulse-dot.warn {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
}

.vps-pulse-dot.danger {
  background: var(--crimson);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

@keyframes vpsPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.vps-ram-text {
  color: var(--ink);
  font-family: inherit;
  font-size: .8125rem;
  font-weight: 700;
}

.vps-boost-badge {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--purple);
  color: var(--white);
  font-size: .6875rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.vps-boost-badge.manual {
  background: #64748b;
}

.avatar {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--purple);
  color: var(--white);
  font-weight: 800;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  transition: .15s ease;
}

.avatar:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 var(--ink);
}

.banner-inline {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .25rem .625rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--crimson);
  color: var(--white);
  font-size: .75rem;
  font-weight: 700;
}

.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  isolation: isolate;
}

.pane {
  padding-top: 0;
}

.subbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.subbar h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

/* In-page Modal Backdrop & Box */
.inpage-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(3px);
}

.inpage-modal-box {
  width: 100%;
  max-width: 1800px;
  height: 90vh;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 16px;
  box-shadow: 6px 6px 0 var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleUp .15s ease-out;
}

.inpage-modal-header {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: var(--purple);
  border-bottom: 2px solid var(--ink);
  color: var(--white);
}

.inpage-modal-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.inpage-modal-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  transition: all .12s;
}

.inpage-modal-close-btn:hover {
  background: var(--crimson);
  color: var(--white);
  transform: scale(1.05);
}

.inpage-modal-body {
  flex: 1;
  min-height: 0;
  background: #f8fafc;
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* Toast */
.toast {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  z-index: 2000;
  padding: .75rem 1.25rem;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--ink);
  color: var(--white);
  font-weight: 700;
  text-align: center;
  box-shadow: 4px 4px 0 var(--purple);
}

/* Responsive Mobile Layout */
@media (max-width: 900px) {
  .app {
    flex-direction: column;
  }
  .app-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: 0;
    border-bottom: 2px solid var(--ink);
  }
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: .5rem;
  }
  .nav-item {
    white-space: nowrap;
    width: auto;
  }
  .nav-divider, .nav-section-title {
    display: none;
  }
  .app-content {
    height: auto;
  }
}
