body[data-page="app"] .section {
  padding-top: 1.5rem;
}

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

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

.auth-panel,
.org-panel {
  max-width: 460px;
  margin: 0 auto 3rem;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

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

.panel-form {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.panel-form label {
  font-weight: 600;
  color: var(--text);
}

.panel-card input,
.panel-card textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-family: var(--font-body);
}

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

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

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

.org-card {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 0.5rem;
}

.nav-btn {
  border: none;
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.nav-btn.active {
  background: var(--accent);
  color: #fff;
}

.nav-btn.ghost {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.panel-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

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

.inline-form input[type="file"] {
  max-width: 220px;
}

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

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

.queue-item.skeleton {
  min-height: 64px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.04));
  animation: pulse 1.2s ease-in-out infinite;
  border: none;
}

.queue-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.12);
}

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

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

.split {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
}

.detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: grid;
  gap: 1rem;
}

.detail-section {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.detail h3 {
  margin: 0.2rem 0;
}

.evidence-item {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.evidence-item textarea {
  min-height: 90px;
}

.evidence-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.owner-grid {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 0.6rem;
  align-items: center;
  margin: 0.8rem 0;
}

.owner-grid label {
  font-weight: 600;
}

.owner-grid select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-family: var(--font-body);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-alt);
}

.badge.alert {
  background: rgba(249, 115, 22, 0.18);
  color: #7c2d12;
}

.badge.warn {
  background: rgba(251, 191, 36, 0.2);
  color: #78350f;
}

.badge.ok {
  background: rgba(34, 197, 94, 0.18);
  color: #14532d;
}

.audit-list {
  display: grid;
  gap: 0.7rem;
}

.audit-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
}

.notice {
  color: var(--muted);
}

.tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-alt);
  font-size: 0.75rem;
  margin-left: 0.4rem;
  position: relative;
}

.tip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 140%;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #f8fafc;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.tip:hover::after {
  opacity: 1;
}

.command-palette {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  z-index: 50;
}

.command-palette[hidden] {
  display: none !important;
}

.palette-card {
  width: min(520px, 92vw);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.2rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.8rem;
}

.palette-card input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.palette-list {
  display: grid;
  gap: 0.5rem;
}

.palette-item {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  cursor: pointer;
  font-weight: 600;
}

.sim-row {
  display: grid;
  gap: 0.3rem;
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
}

.system-grid {
  display: grid;
  gap: 0.75rem;
}

.system-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.2rem;
  border-bottom: 1px solid var(--border);
}

.system-row:last-child {
  border-bottom: none;
}

.demo-highlight {
  outline: 3px solid rgba(249, 115, 22, 0.35);
  outline-offset: 4px;
  border-radius: 14px;
}

.demo-tooltip {
  position: fixed;
  z-index: 70;
  max-width: min(360px, 84vw);
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.demo-tooltip p {
  margin: 0;
  font-size: 0.95rem;
}

.demo-tooltip .notice {
  color: rgba(226, 232, 240, 0.85);
  font-size: 0.85rem;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 1100px) {
  .app-panel {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .split {
    grid-template-columns: 1fr;
  }
}
