:root {
  color-scheme: dark;
  font-family: 'Outfit', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #080B11;
  background-image: radial-gradient(at 0% 0%, hsla(242, 60%, 15%, 0.5) 0px, transparent 50%),
                    radial-gradient(at 100% 0%, hsla(295, 60%, 15%, 0.3) 0px, transparent 50%);
  color: #F3F4F6;
  min-height: 100vh;
}

body {
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.branding {
  display: flex;
  flex-direction: column;
}

.eyebrow {
  margin: 0 0 4px;
  color: #6366F1;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 11px;
}

h1 {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(to right, #FFFFFF, #9CA3AF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.session {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}

.session-badge {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #A5B4FC;
  padding: 4px 10px;
  border-radius: 9999px;
  font-weight: 500;
}

input, select, button {
  border-radius: 8px;
  font: inherit;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

input, select {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(17, 24, 39, 0.5);
  color: white;
  min-height: 40px;
  padding: 0 14px;
}

textarea {
  min-height: 92px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.5);
  color: white;
  padding: 12px 14px;
  font: inherit;
}

input:focus, select:focus {
  outline: none;
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background: rgba(17, 24, 39, 0.7);
}

button {
  min-height: 40px;
  padding: 0 18px;
  background: linear-gradient(135deg, #4F46E5, #3B82F6);
  border: none;
  color: white;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.45);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

button.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #E5E7EB;
  box-shadow: none;
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button.danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

button.danger:hover {
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.45);
}

/* Panels (Glassmorphism) */
.auth-panel, .panel {
  background: rgba(16, 22, 37, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.auth-panel {
  max-width: 440px;
  margin: 80px auto 0;
}

.auth-panel h2 {
  margin-top: 0;
  font-weight: 700;
  font-size: 24px;
}

.auth-panel form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.auth-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  font-size: 13px;
}

.auth-actions a {
  color: #93C5FD;
  text-decoration: none;
}

.auth-actions a:hover {
  color: #BFDBFE;
  text-decoration: underline;
}

.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.notice.success {
  border: 1px solid rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
  color: #A7F3D0;
}

.notice.error {
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
  color: #FCA5A5;
}

.muted, .meta {
  color: #9CA3AF;
  font-size: 13px;
}

.platform-menu {
  display: grid;
  gap: 8px;
  max-width: 520px;
}

.platform-menu-link {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.45);
  color: #F9FAFB;
  text-decoration: none;
}

.platform-menu-link:hover,
.platform-menu-link:focus {
  border-color: rgba(147, 197, 253, 0.55);
  background: rgba(30, 41, 59, 0.7);
  outline: none;
}

.menu-title {
  font-weight: 700;
}

.menu-meta {
  color: #9CA3AF;
  font-size: 13px;
}

/* Composer Form */
.composer {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  margin-bottom: 24px;
}

.event-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.schema-details {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 14px 0;
}

.event-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.event-fields label {
  display: grid;
  gap: 7px;
  color: #D1D5DB;
  font-size: 13px;
  font-weight: 600;
}

.console-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.product-recon {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.empty-state {
  color: #9CA3AF;
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

dt {
  color: #9CA3AF;
  font-size: 12px;
}

dd {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.banner {
  margin-bottom: 18px;
  padding: 14px 18px;
  border-left: 4px solid #EF4444;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
  color: #FCA5A5;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Tasks Grid & Card */
.tasks, .pending {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
}

.card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 18px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #6B7280; /* default slate */
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

/* State Colors */
.card.state-submitted::before { background: #F59E0B; }
.card.state-running::before { background: #3B82F6; }
.card.state-completed::before { background: #10B981; }
.card.state-failed::before { background: #EF4444; }
.card.state-cancelled::before { background: #4B5563; }

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 8px;
}

.status-badge.submitted { background: rgba(245, 158, 11, 0.15); color: #FBBF24; border: 1px solid rgba(245, 158, 11, 0.3); }
.status-badge.running { 
  background: rgba(59, 130, 246, 0.15); 
  color: #60A5FA; 
  border: 1px solid rgba(59, 130, 246, 0.3);
  animation: pulse-border 1.5s infinite;
}
.status-badge.completed { background: rgba(16, 185, 129, 0.15); color: #34D399; border: 1px solid rgba(16, 185, 129, 0.3); }
.status-badge.failed { background: rgba(239, 68, 68, 0.15); color: #F87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.status-badge.cancelled { background: rgba(75, 85, 99, 0.15); color: #9CA3AF; border: 1px solid rgba(75, 85, 99, 0.3); }

/* Confirmed Projection Pulse Animation */
.card.projected {
  animation: confirm-pulse 1s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Shimmering Loading State for Pending Card */
.card.pending-card {
  border-style: dashed;
  border-color: rgba(99, 102, 241, 0.4);
  color: #9CA3AF;
  background: linear-gradient(90deg, 
    rgba(16, 22, 37, 0.45) 0%, 
    rgba(99, 102, 241, 0.08) 50%, 
    rgba(16, 22, 37, 0.45) 100%);
  background-size: 200% 100%;
  animation: shimmer-bg 2s infinite linear;
}

.card.pending-card::before {
  background: linear-gradient(180deg, #6366F1, #3B82F6);
}

.title {
  font-weight: 700;
  font-size: 16px;
  color: #F9FAFB;
}

.payload-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 6px;
  word-break: break-all;
  color: #CBD5E1;
}

.error-text {
  color: #F87171;
  font-size: 12px;
  margin-top: 4px;
  font-weight: 500;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

/* Timeline/Command History */
.timeline {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.timeline h2 {
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.timeline-list {
  display: grid;
  gap: 10px;
  padding-left: 0;
  list-style: none;
}

.timeline-item {
  display: flex;
  gap: 16px;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  animation: slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.timeline-item .time {
  color: #6B7280;
  font-family: 'JetBrains Mono', monospace;
  min-width: 70px;
}

.timeline-item .status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  min-width: 100px;
}

.timeline-item .status-indicator.accepted { color: #60A5FA; }
.timeline-item .status-indicator.projected { color: #34D399; }
.timeline-item .status-indicator.rejected { color: #F87171; }

.timeline-item .msg {
  color: #D1D5DB;
  flex: 1;
}

/* Spinner and Loaders */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.1);
  border-top-color: #6366F1;
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

.loader-text {
  margin-top: 16px;
  color: #9CA3AF;
  font-weight: 500;
  font-size: 14px;
}

/* Animations */
@keyframes shimmer-bg {
  0% { background-position: 100% 0%; }
  100% { background-position: -100% 0%; }
}

@keyframes confirm-pulse {
  0% { 
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5); 
    border-color: rgba(99, 102, 241, 0.8);
    transform: scale(1.01);
  }
  100% { 
    box-shadow: 0 0 0 16px rgba(99, 102, 241, 0); 
    border-color: rgba(255, 255, 255, 0.05);
    transform: scale(1);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(59, 130, 246, 0.3); }
  50% { border-color: rgba(59, 130, 246, 0.8); }
}

@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

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

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

  .actions {
    justify-content: flex-start;
  }
}
