[hidden] {
  display: none !important;
}

.app-header {
  background: rgba(10, 16, 25, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: var(--banner-height);
  z-index: 20;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto 4rem;
  padding: 0 1.5rem;
}

.auth-panel,
.org-panel {
  display: flex;
  justify-content: center;
}

.panel-card {
  background: rgba(16, 24, 36, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 2rem;
  width: min(520px, 100%);
  box-shadow: var(--shadow);
}

.app-panel .panel-card {
  width: 100%;
}

.panel-card h2,
.panel-card h3 {
  font-family: var(--font-display);
}

.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 1.5rem 0;
}

.app-panel {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
}

.sidebar {
  display: grid;
  gap: 0.6rem;
  align-content: start;
}

.org-card {
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(16, 24, 36, 0.9);
}

.nav-btn {
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.nav-btn.active,
.nav-btn:hover {
  border-color: rgba(79, 255, 210, 0.4);
  color: var(--text);
}

.nav-btn.ghost {
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--accent);
}

.panel {
  padding: 1.2rem 1.4rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 19, 30, 0.85);
  box-shadow: var(--shadow);
}

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

.panel-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 2fr;
  gap: 1rem;
}

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

.queue-item {
  padding: 0.8rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(16, 24, 36, 0.85);
  cursor: pointer;
}

.queue-item:hover {
  border-color: rgba(79, 255, 210, 0.35);
}

.detail {
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(16, 24, 36, 0.6);
}

.detail-header h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.detail-card {
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 19, 30, 0.8);
}

.detail-card h4 {
  margin-top: 0;
  font-family: var(--font-display);
}

.status-pill {
  display: inline-flex;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(79, 255, 210, 0.16);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
  align-items: center;
}

.narrative-output {
  white-space: pre-wrap;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(6, 10, 16, 0.7);
  border-radius: 12px;
  padding: 0.8rem;
  min-height: 120px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.narrative-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.precedent-box {
  display: grid;
  gap: 0.6rem;
}

.diff-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.diff-controls select {
  min-width: 220px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(9, 14, 20, 0.85);
  color: var(--text);
  padding: 0.5rem 0.7rem;
}

.graph-view {
  width: 100%;
  height: 220px;
  border-radius: 12px;
  border: 1px solid rgba(79, 255, 210, 0.3);
  background: rgba(8, 13, 20, 0.7);
}

.graph-view svg {
  width: 100%;
  height: 100%;
}

.panel-card form input,
.panel-card form select {
  background: rgba(9, 14, 20, 0.85);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(16, 24, 36, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 0.7rem 1rem;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

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

.is-hidden {
  display: none;
}

@media (max-width: 900px) {
  .app-panel {
    grid-template-columns: 1fr;
  }
  .panel-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    grid-auto-flow: column;
    overflow-x: auto;
  }
}
