.closepilot-app {
  background: var(--bg);
}

.app-header {
  position: sticky;
  top: var(--banner-height);
  z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.app-shell {
  display: block;
}

.auth-panel,
.org-panel {
  padding: 2rem 0 4rem;
}

.auth-panel .panel-card,
.org-panel .panel-card {
  max-width: 480px;
  margin: 0 auto;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.4rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
}

.panel-card h3 {
  margin-top: 0;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.2rem 0;
}

.panel-card form,
.panel-form {
  display: grid;
  gap: 0.75rem;
}

.panel-card input,
.panel-card select,
.panel-card textarea,
.panel-form input,
.panel-form select,
.panel-form textarea {
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.panel-form textarea {
  min-height: 120px;
  resize: vertical;
}

.app-panel {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  padding: 0 1.5rem 3rem;
}

.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.2rem;
  display: grid;
  gap: 0.6rem;
  height: fit-content;
  position: sticky;
  top: calc(var(--banner-height) + 90px);
}

.org-card {
  background: var(--surface-alt);
  border-radius: 14px;
  padding: 0.8rem 1rem;
}

.nav-btn {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--font-body);
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.nav-btn.active {
  border-color: rgba(31, 122, 63, 0.35);
  background: rgba(31, 122, 63, 0.1);
}

.nav-btn.ghost {
  border-color: var(--border);
  background: var(--surface);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.4rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.queue-list {
  display: grid;
  gap: 0.8rem;
}

.queue-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  background: var(--surface-alt);
  cursor: pointer;
}

.queue-item.active {
  border-color: rgba(31, 122, 63, 0.45);
  background: rgba(31, 122, 63, 0.1);
}

.queue-item h4 {
  margin: 0 0 0.4rem;
}

.queue-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
}

.approval-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.detail {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  background: #fff;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.inline-form input,
.inline-form select {
  flex: 1 1 160px;
}

.notice {
  color: var(--muted);
  font-size: 0.9rem;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.graph-view {
  min-height: 320px;
  overflow: auto;
}

.graph-view svg {
  width: 100%;
  height: auto;
  min-width: 520px;
}

.graph-node {
  cursor: pointer;
}

.graph-node rect {
  fill: #ffffff;
  stroke: rgba(15, 20, 17, 0.18);
  stroke-width: 1;
  rx: 14;
  ry: 14;
}

.graph-node.critical rect {
  stroke: rgba(31, 122, 63, 0.65);
  stroke-width: 2;
}

.graph-node.blocked rect {
  fill: rgba(223, 152, 74, 0.12);
  stroke: rgba(223, 152, 74, 0.55);
}

.graph-node.done rect {
  fill: rgba(31, 122, 63, 0.08);
}

.graph-node text {
  font-family: var(--font-body);
  font-size: 12px;
  fill: var(--text);
}

.graph-edge {
  stroke: rgba(15, 20, 17, 0.22);
  stroke-width: 2;
  fill: none;
}

.graph-edge.critical {
  stroke: rgba(31, 122, 63, 0.65);
}

.replay-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.replay-controls input[type="range"] {
  flex: 1;
}

.replay-meta {
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 84px;
  text-align: right;
}

.log-stream {
  display: grid;
  gap: 0.7rem;
  max-height: 520px;
  overflow: auto;
}

.log-stream .queue-item {
  cursor: default;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.65);
}

.pill.good {
  border-color: rgba(31, 122, 63, 0.4);
  background: rgba(31, 122, 63, 0.08);
  color: rgba(15, 63, 39, 0.9);
}

.pill.warn {
  border-color: rgba(223, 152, 74, 0.45);
  background: rgba(223, 152, 74, 0.12);
  color: #7a4a0f;
}

.pill.bad {
  border-color: rgba(170, 60, 60, 0.45);
  background: rgba(170, 60, 60, 0.12);
  color: rgba(170, 60, 60, 0.9);
}

@media (max-width: 1100px) {
  .app-panel {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
  .split {
    grid-template-columns: 1fr;
  }
}
