/* Vue App Shell Layout */
#app {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 100;
}

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr;
  height: 100vh;
  background: var(--bg);
}

/* Sidebar */
.sidebar {
  grid-row: 1 / -1;
  position: sticky;
  top: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-md);
  border-bottom: 1px solid var(--line);
  height: var(--topbar-height);
}

.sidebar__brand-mark {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
}

.sidebar__brand-mark span { color: var(--accent); }

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px;
  flex: 1;
}

.sidebar__tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: left;
}

.sidebar__tab:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.sidebar__tab--active {
  background: var(--accent-soft);
  color: var(--ink);
  border: 1px solid var(--accent-border);
}

.sidebar__tab-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

/* TopBar */
.topbar {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height);
  overflow: hidden;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}

.topbar__filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  padding: 0 8px;
  min-width: 0;
}

.topbar__filters .tf {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  font-size: 0;
}

.topbar__filters .tf .input,
.topbar__filters .tf .select {
  height: 30px;
  font-size: 0.75rem;
  padding: 2px 6px;
  min-width: 0;
}

.topbar__filters .tf-search .input {
  width: 150px;
}

.topbar__filters .btn {
  height: 30px;
  font-size: 0.75rem;
  padding: 2px 10px;
  flex-shrink: 0;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Main Content */
.main-content {
  grid-column: 2;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* View Stubs */
.view-stub {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  color: var(--muted);
}

.view-stub__icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.view-stub__title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 8px;
}

.view-stub__text {
  font-size: 0.88rem;
  max-width: 400px;
  margin: 0;
}

/* Hide legacy layout when Vue is active */
body.vue-active > header,
body.vue-active > footer,
body.vue-active > .fab,
body.vue-active #appPanel {
  display: none !important;
}

/* ── Sidebar website section ─────────────── */
.sidebar__website {
  padding: 10px 16px 6px;
  border-bottom: 1px solid var(--line);
}
.sidebar__website-select {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 6px;
}
.sidebar__website-select:focus {
  outline: none;
  border-color: var(--accent-border);
}
.sidebar__website-name {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--ink);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__website-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sidebar-stat {
  font-size: 0.72rem;
  color: var(--muted);
}
.sidebar__website--empty {
  padding-bottom: 10px;
}
.sidebar__website--empty span {
  font-size: 0.78rem;
}

/* ── Sidebar active runs ─────────────────── */
.sidebar__runs {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  margin-top: auto;
}
.sidebar__runs-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--good);
  margin-bottom: 6px;
}
.sidebar__runs-dot {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--good);
  animation: pulse-dot 1.5s ease-in-out infinite;
}
.sidebar__run-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 0.72rem;
  color: var(--muted);
}
.sidebar__run-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.sidebar__run-pulse {
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--good);
  animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── FAB (Vue) ────────────────────────────── */
.fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  z-index: 999;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fab:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 24px rgba(0,0,0,0.45);
}
.fab:active {
  transform: scale(0.96);
}

/* ── Vue Login Panel ───────────────────────── */
.vue-login-container {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  min-height: 0;
  background:
    radial-gradient(circle at top right, var(--accent-soft), transparent 32%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-elevated) 100%);
}

