:root {
  color-scheme: dark;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.4;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1e1b4b, #020617);
  color: #e2e8f0;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
  position: relative;
}

/* User Info Header - Posicionamento absoluto no topo direito */
.user-container {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  position: absolute;
  top: 0.25rem;
  right: 0;
  left: 0;
  pointer-events: none;
  z-index: 10;
}

.user-info-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.875rem;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(2, 6, 23, 0.5);
  pointer-events: auto;
  transition: all 0.2s ease;
}

.user-info-header:hover {
  background: rgba(2, 6, 23, 0.95);
  border-color: rgba(148, 163, 184, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(2, 6, 23, 0.6);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 0.8rem;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.user-email {
  font-size: 0.68rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.btn-logout {
  padding: 0.35rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 7px;
  color: #fca5a5;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-logout svg {
  width: 18px;
  height: 18px;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fecaca;
  transform: scale(1.05);
}

.btn-logout:active {
  transform: scale(0.95);
}

/* Ajusta header principal para não ficar sob o user card */
.page-header {
  position: relative;
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Responsividade */
@media (max-width: 768px) {
  .user-container {
    position: relative;
    top: 0;
    right: 0;
    left: 0;
    margin-bottom: 1.5rem;
  }

  .page-header {
    padding-top: 0;
  }

  .user-info-header {
    padding: 0.5rem 0.875rem;
  }

  .user-avatar {
    width: 30px;
    height: 30px;
    font-size: 0.7rem;
  }

  .user-name {
    font-size: 0.8rem;
    max-width: 120px;
  }

  .user-email {
    display: none;
  }
}

.page-header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.2;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  color: #a5b4fc;
  margin: 0;
  line-height: 1.4;
}

.subtitle {
  margin: 0;
  color: #cbd5f5;
  font-size: 0.95rem;
  line-height: 1.5;
}

code {
  background: rgba(148, 163, 184, 0.1);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: #f8fafc;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.card {
  background: rgba(2, 6, 23, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(2, 6, 23, 0.5);
}

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

.label {
  font-weight: 600;
}

.status-pill {
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #334155;
  color: #f8fafc;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.status-pill::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill[data-state='success'] {
  background: #0f766e;
  color: #d1fae5;
}

.status-pill[data-state='running'] {
  background: #2563eb;
  color: #bfdbfe;
  animation: pulse 2s ease-in-out infinite;
}

.status-pill[data-state='warning'] {
  background: #ca8a04;
  color: #fef3c7;
}

.status-pill[data-state='error'] {
  background: #dc2626;
  color: #fecaca;
}

.status-pill[data-state='idle'] {
  background: #475569;
  color: #cbd5e1;
}

.meta {
  display: flex;
  gap: 2rem;
  margin: 0 0 1rem;
  padding: 0;
  flex-wrap: wrap;
}

.meta > div {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.meta dt {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
}

.meta dt::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.7;
}

.meta dt:has(+ [data-started-at])::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M10 8l6 4-6 4V8z'/%3E%3C/svg%3E");
}

.meta dt:has(+ [data-finished-at])::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M9 12l2 2 4-4'/%3E%3C/svg%3E");
}

.meta dt:has(+ [data-duration])::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 6v6l4 2'/%3E%3C/svg%3E");
}

.meta dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.3;
}

.message {
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.progress {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.progress-value {
  font-weight: 600;
}

.progress-bar {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.progress-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6366f1, #22d3ee);
  transition: width 0.3s ease-in-out;
}

.progress-hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: #cbd5f5;
}

.execution-info {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.15);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.execution-clock {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  transform: rotate(-90deg);
}

.clock-bg {
  fill: none;
  stroke: rgba(148, 163, 184, 0.2);
  stroke-width: 4;
}

.clock-progress {
  fill: none;
  stroke: #22d3ee;
  stroke-width: 4;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 1s linear;
  stroke-linecap: round;
}

.execution-details {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.execution-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-weight: 500;
}

.execution-time {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e2e8f0;
}

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

.stat-item {
  padding: 0.85rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.15);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 90px;
}

.stat-item.highlight-warning {
  background: rgba(202, 138, 4, 0.15);
  border-color: rgba(202, 138, 4, 0.4);
}

.stat-item.highlight-danger {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.4);
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #cbd5f5;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  min-height: 2.6rem;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: auto;
}

.stat-item.highlight-warning .stat-value {
  color: #fbbf24;
}

.stat-item.highlight-danger .stat-value {
  color: #f87171;
}

.refresh-hint {
  font-size: 0.85rem;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.refresh-hint::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22d3ee;
  animation: pulse 2s ease-in-out infinite;
}

.muted {
  color: #94a3b8;
  margin: 0;
}

.page-footer {
  margin-top: 2.5rem;
  padding-bottom: 1rem;
  font-size: 0.9rem;
  text-align: center;
}

.error {
  color: #f87171;
  min-height: 1rem;
  margin: 0.25rem 0 0;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

@media (max-width: 768px) {
  .page {
    padding: 1.5rem 1rem 2rem;
  }

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

  .stats {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
}

@media (max-width: 600px) {
  .card {
    padding: 1.25rem;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .meta {
    flex-direction: column;
    gap: 0.85rem;
  }

  .meta > div {
    flex: none;
  }

  .meta dd {
    font-size: 0.85rem;
  }

  .page-header h1 {
    font-size: 1.5rem;
  }
}
