/* BriefCase Dashboard Styles */
@import url('variables.css');

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background: var(--neutral);
  color: var(--gray-700);
  line-height: 1.5;
  min-height: 100vh;
}

/* App Layout */
.app {
  display: flex;
  min-height: 100vh;
}

.app.topnav-layout {
  flex-direction: column;
}

/* ============================================
   TOP NAVIGATION
   ============================================ */
.topnav {
  height: 56px;
  background: #072742;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.topnav-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.topnav-waffle {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.15s ease;
}

.topnav-waffle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.topnav-waffle svg {
  width: 20px;
  height: 20px;
}

.topnav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  padding-right: var(--space-4);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  margin-right: var(--space-2);
}

.topnav-logo-img {
  height: 28px;
  width: auto;
}

.topnav-main {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.topnav-link {
  padding: var(--space-2) var(--space-4);
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all 0.15s ease;
  position: relative;
}

.topnav-link:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
}

.topnav-link.active {
  color: var(--white);
}

.topnav-link.active::after {
  content: '';
  position: absolute;
  bottom: -17px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: var(--white);
  border-radius: 3px 3px 0 0;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topnav-icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.15s ease;
}

.topnav-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.topnav-icon-btn svg {
  width: 20px;
  height: 20px;
}

.topnav-avatar {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--secondary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.topnav-avatar:hover {
  opacity: 0.9;
}

.topnav-avatar-initials {
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
}

/* Dropdowns */
.dropdown {
  position: absolute;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--gray-200);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 200;
}

.dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.waffle-dropdown {
  top: 52px;
  left: var(--space-5);
  width: 280px;
  padding: var(--space-3);
}

.avatar-dropdown {
  top: 52px;
  right: var(--space-5);
  width: 260px;
}

.dropdown-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
}

.dropdown-app {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--gray-700);
  transition: background 0.15s ease;
}

.dropdown-app:hover {
  background: var(--gray-50);
}

.dropdown-app.active {
  background: #eef5fc;
}

.dropdown-app.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dropdown-app.disabled:hover {
  background: none;
}

.dropdown-app-icon {
  width: 40px;
  height: 40px;
  background: #eef5fc;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
  flex-shrink: 0;
}

.dropdown-app-icon svg {
  width: 20px;
  height: 20px;
}

.dropdown-app-info {
  min-width: 0;
}

.dropdown-app-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
}

.dropdown-app-status {
  font-size: 12px;
  color: var(--gray-400);
}

.dropdown-divider {
  height: 1px;
  background: var(--gray-200);
  margin: var(--space-2) 0;
}

.dropdown-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
}

.dropdown-user-avatar {
  width: 40px;
  height: 40px;
  background: var(--secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.dropdown-user-info {
  min-width: 0;
}

.dropdown-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-email {
  font-size: 12px;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-role {
  font-size: 11px;
  color: var(--gray-400);
  text-transform: capitalize;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--gray-600);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s ease;
}

.dropdown-item:hover {
  background: var(--gray-50);
  color: var(--primary);
}

.dropdown-item svg {
  width: 18px;
  height: 18px;
}

/* Sub-navigation Pills */
.subnav-pills {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-6);
  background: var(--gray-100);
  padding: var(--space-1);
  border-radius: var(--radius);
  width: fit-content;
}

.subnav-pill {
  padding: var(--space-2) var(--space-4);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.subnav-pill:hover {
  color: var(--primary);
}

.subnav-pill.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Subviews */
.subview {
  display: none;
}

.subview.active {
  display: block;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  color: var(--white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
}

.logo-section {
  padding: var(--space-5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.logo-icon {
  height: 24px;
  width: auto;
}

.logo-wordmark {
  height: 14px;
  width: auto;
}

/* Legacy - for old dashboard pages still using PNG */
.logo-img {
  height: 28px;
  width: auto;
  border-radius: var(--radius);
  object-fit: contain;
}

.logo-text {
  display: none;
}

/* Navigation */
.nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--space-3) var(--space-3) var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: var(--space-1);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.nav-item.active {
  background: var(--secondary);
  color: var(--white);
}

.nav-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.nav-item.disabled:hover {
  background: none;
  color: rgba(255, 255, 255, 0.7);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

/* User Section */
.user-section {
  padding: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: capitalize;
}

.logout-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.logout-btn:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
}

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

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-width);
}

/* Top nav layout overrides */
.topnav-layout .main {
  margin-left: 0;
  margin-top: 56px;
}

/* Header */
.header {
  background: var(--white);
  padding: var(--space-4) var(--space-8);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.search-box {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-4);
  width: 280px;
  transition: all 0.15s ease;
}

.search-box:focus-within {
  border-color: var(--secondary);
  background: var(--white);
}

.search-box svg {
  width: 18px;
  height: 18px;
  color: var(--gray-400);
  flex-shrink: 0;
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  width: 100%;
  font-family: inherit;
}

.search-box input::placeholder {
  color: var(--gray-400);
}

/* Content Area */
.content {
  flex: 1;
  padding: var(--space-6) var(--space-8);
}

/* ============================================
   VIEWS
   ============================================ */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* ============================================
   STATS CARDS
   ============================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-icon.blue {
  background: #4a91d4;
  color: var(--white);
}

.stat-icon.green {
  background: var(--success-light);
  color: var(--success);
}

.stat-icon.red {
  background: var(--error-light);
  color: var(--error);
}

.stat-icon.gray {
  background: #eef5fc;
  color: var(--secondary);
}

.stat-content {
  min-width: 0;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: var(--gray-500);
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-title svg {
  width: 20px;
  height: 20px;
  color: var(--secondary);
}

/* ============================================
   TABLE STYLES
   ============================================ */
.table-header {
  display: grid;
  grid-template-columns: 1fr 100px 100px 100px 150px;
  padding: var(--space-3) var(--space-6);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
}

.date-row {
  padding: var(--space-3) var(--space-6);
  background: var(--gray-50);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.date-row svg {
  width: 16px;
  height: 16px;
  color: var(--gray-400);
}

.exec-row {
  display: grid;
  grid-template-columns: 1fr 100px 100px 100px 150px;
  padding: 14px var(--space-6);
  border-bottom: 1px solid var(--gray-100);
  align-items: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.exec-row:hover {
  background: var(--gray-50);
}

.case-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.case-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.case-icon svg {
  width: 16px;
  height: 16px;
}

.case-icon.success {
  background: var(--success-light);
  color: var(--success);
}

.case-icon.failed {
  background: var(--error-light);
  color: var(--error);
}

.case-icon.running {
  background: var(--warning-light);
  color: var(--warning);
}

.case-details {
  min-width: 0;
}

.case-ref {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--primary);
  font-size: 13px;
}

.case-pipeline {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exec-time,
.exec-duration {
  font-size: 13px;
  color: var(--gray-600);
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.status.success {
  color: var(--success);
}

.status.failed {
  color: var(--error);
}

.status.running {
  color: var(--warning);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.success {
  background: var(--success);
}

.dot.failed {
  background: var(--error);
}

.dot.running {
  background: var(--warning);
  animation: pulse 1.5s ease-in-out infinite;
}

.dot.pending {
  background: var(--gray-300);
}

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

.actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  font-family: inherit;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:disabled:hover {
  border-color: var(--gray-200);
  color: var(--gray-600);
}

.btn svg {
  width: 14px;
  height: 14px;
}

.btn.primary {
  background: var(--secondary);
  border-color: var(--secondary);
  color: var(--white);
}

.btn.primary:hover {
  background: #1f5a94;
  border-color: #1f5a94;
}

.btn.success {
  background: var(--success);
  border-color: var(--success);
  color: var(--white);
}

.btn.success:hover {
  background: #0d9668;
  border-color: #0d9668;
}

.btn-lg {
  padding: 10px 20px;
  font-size: 14px;
}

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

/* ============================================
   BACK LINK
   ============================================ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--gray-600);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: var(--space-5);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--secondary);
}

.back-link svg {
  width: 20px;
  height: 20px;
}

/* ============================================
   DETAIL HEADER
   ============================================ */
.detail-header {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  box-shadow: var(--shadow);
}

.detail-info {
  display: flex;
  gap: var(--space-5);
}

.detail-icon {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.detail-icon svg {
  width: 28px;
  height: 28px;
}

.detail-icon.success {
  background: var(--success-light);
  color: var(--success);
}

.detail-icon.failed {
  background: var(--error-light);
  color: var(--error);
}

.detail-icon.running {
  background: var(--warning-light);
  color: var(--warning);
}

.detail-text {
  min-width: 0;
}

.detail-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--space-2);
}

.detail-status {
  margin-bottom: var(--space-3);
}

.detail-meta {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-500);
}

.meta-item svg {
  width: 16px;
  height: 16px;
}

.meta-item strong {
  color: var(--gray-700);
  font-weight: 500;
}

.detail-actions {
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ============================================
   TIMELINE
   ============================================ */
.timeline {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow);
}

.timeline-header {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--gray-100);
}

.step {
  display: flex;
}

.step-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-right: var(--space-5);
  width: 24px;
}

.step-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--white);
  z-index: 1;
  flex-shrink: 0;
}

.step-dot.success {
  background: var(--success);
  box-shadow: 0 0 0 2px var(--success);
}

.step-dot.failed {
  background: var(--error);
  box-shadow: 0 0 0 2px var(--error);
}

.step-dot.running {
  background: var(--warning);
  box-shadow: 0 0 0 2px var(--warning);
  animation: pulse 1.5s ease-in-out infinite;
}

.step-dot.pending {
  background: var(--gray-300);
  box-shadow: 0 0 0 2px var(--gray-300);
}

.connector {
  width: 2px;
  flex: 1;
  margin: var(--space-1) 0;
}

.connector.done {
  background: var(--success);
}

.connector.pending {
  background: var(--gray-200);
}

.step:last-child .connector {
  display: none;
}

.step-content {
  flex: 1;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  transition: border-color 0.15s ease;
}

.step-content:hover {
  border-color: var(--secondary);
}

.step-content.failed {
  background: var(--error-light);
  border-color: var(--error);
}

.step-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.step-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
}

.step-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  flex: 1;
}

.step-btns {
  display: flex;
  gap: 6px;
}

.step-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.step-btn:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.step-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.step-dur {
  font-size: 12px;
  color: var(--gray-500);
}

.step-desc {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: var(--space-2);
}

.step-time {
  font-size: 12px;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-time .dot {
  width: 6px;
  height: 6px;
}

.step-error {
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--white);
  border-left: 3px solid var(--error);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--error);
}

/* ============================================
   CHARTS SECTION
   ============================================ */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.chart-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow);
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: var(--space-4);
}

.chart-container {
  position: relative;
  height: 200px;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  background: var(--white);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 300px;
  max-width: 400px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--error);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error .toast-icon {
  color: var(--error);
}

.toast-message {
  flex: 1;
  font-size: 14px;
  color: var(--gray-700);
}

.toast-close {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: var(--space-1);
}

.toast-close:hover {
  color: var(--gray-600);
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  color: var(--gray-500);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--secondary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: var(--space-3);
}

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

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: var(--space-8);
  color: var(--gray-500);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--gray-300);
  margin-bottom: var(--space-4);
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: 14px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
  }

  /* Top nav responsive */
  .topnav {
    padding: 0 var(--space-3);
  }

  .topnav-left {
    gap: var(--space-2);
  }

  .topnav-logo {
    padding-right: var(--space-2);
    margin-right: 0;
    border-right: none;
  }

  .topnav-logo-text {
    display: none;
  }

  .topnav-main {
    display: none;
  }

  .topnav-link.active::after {
    display: none;
  }

  .waffle-dropdown {
    left: var(--space-3);
    width: calc(100vw - 32px);
    max-width: 320px;
  }

  .avatar-dropdown {
    right: var(--space-3);
    width: calc(100vw - 32px);
    max-width: 280px;
  }

  /* Show subnav pills as main nav on mobile */
  .subnav-pills {
    width: 100%;
    justify-content: center;
  }

  .header {
    padding: var(--space-4);
    flex-direction: column;
    gap: var(--space-3);
    align-items: stretch;
  }

  .search-box {
    width: 100%;
  }

  .content {
    padding: var(--space-4);
  }

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

  .table-header {
    display: none;
  }

  .exec-row {
    grid-template-columns: 1fr auto;
    gap: var(--space-3);
    padding: var(--space-4);
  }

  .exec-time,
  .exec-duration {
    display: none;
  }

  .detail-header {
    flex-direction: column;
    gap: var(--space-4);
  }

  .detail-actions {
    width: 100%;
  }

  .detail-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

/* ============================================
   LOGIN PAGE - New Figma Design
   ============================================ */
.login-page {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #E8F0F7;
  background-image: url('../assets/login-bg-pattern.svg');
  /* SVG viewBox is 1920x1280 - scale to cover viewport */
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
}

.login-card {
  background: var(--white);
  padding: 48px 40px;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  text-align: center;
  max-width: 420px;
  width: 100%;
  margin: var(--space-4);
}

.login-logo {
  margin-bottom: 24px;
}

.login-logo img {
  height: 48px;
  width: auto;
}

.login-heading {
  font-size: 16px;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-input-wrapper {
  position: relative;
}

.login-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  color: var(--gray-700);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.login-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(47, 120, 190, 0.1);
}

.login-input::placeholder {
  color: var(--gray-400);
}

.login-input-wrapper.has-error .login-input {
  border-color: var(--error);
  color: var(--error);
}

.login-input-wrapper.has-error .login-input:focus {
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--error-light);
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--error);
  text-align: left;
}

.login-error svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 24px;
  background: var(--secondary);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
  box-sizing: border-box;
}

.login-btn:hover {
  background: #1f5a94;
}

.login-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 32px 0;
}

.login-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.login-footer-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-footer-logo img {
  height: 24px;
  width: auto;
}

.login-footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.login-footer-links a {
  color: var(--gray-500);
  text-decoration: underline;
}

.login-footer-links a:hover {
  color: var(--secondary);
}

.login-footer-sep {
  color: var(--gray-300);
}

.login-footer-google {
  font-size: 12px;
  color: var(--gray-400);
}

.login-footer-google a {
  color: var(--gray-500);
  text-decoration: underline;
}

.login-footer-google a:hover {
  color: var(--secondary);
}

/* Login page responsive */
@media (max-width: 480px) {
  .login-bg {
    padding: var(--space-4);
    background-size: cover;
  }

  .login-card {
    padding: 32px 24px;
    margin: var(--space-2);
    border-radius: 12px;
  }

  .login-logo img {
    height: 40px;
  }

  .login-heading {
    font-size: 15px;
    margin-bottom: 20px;
  }

  .login-input {
    padding: 12px 14px;
    font-size: 16px; /* Prevents iOS zoom */
  }

  .login-btn {
    padding: 12px 20px;
    font-size: 15px;
  }

  .login-divider {
    margin: 24px 0;
  }

  .login-footer-logo img {
    height: 20px;
  }

  .login-footer-links {
    font-size: 12px;
  }

  .login-footer-google {
    font-size: 11px;
  }
}

@media (max-width: 360px) {
  .login-card {
    padding: 24px 16px;
  }

  .login-logo img {
    height: 36px;
  }
}

/* Legacy login styles - kept for backwards compat */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--neutral);
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 500;
  color: var(--gray-700);
  text-decoration: none;
  transition: all 0.15s ease;
  width: 100%;
}

.google-btn:hover {
  border-color: var(--gray-400);
  box-shadow: var(--shadow);
}

.google-btn svg {
  width: 20px;
  height: 20px;
}

/* Flash messages */
.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  font-size: 14px;
}

.flash-error {
  background: var(--error-light);
  color: var(--error);
}

.flash-success {
  background: var(--success-light);
  color: var(--success);
}

/* ============================================
   HISTORY VIEW
   ============================================ */
.history-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-6);
}

.history-filters {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow);
  height: fit-content;
  position: sticky;
  top: 80px;
}

.filter-section {
  margin-bottom: var(--space-5);
}

.filter-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select,
.filter-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--white);
  color: var(--gray-700);
  transition: border-color 0.15s ease;
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: var(--secondary);
}

.filter-input + .filter-input {
  margin-top: var(--space-2);
}

.history-main {
  min-width: 0;
}

.history-table-header {
  grid-template-columns: 40px 1fr 100px 100px 100px 150px;
}

.history-table-header .checkbox-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--secondary);
}

.exec-row.history-row {
  grid-template-columns: 40px 1fr 100px 100px 100px 150px;
}

.exec-row .checkbox-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Bulk Actions Bar */
.bulk-actions {
  background: var(--primary);
  color: var(--white);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.bulk-count {
  font-size: 14px;
  font-weight: 500;
}

.bulk-actions .btn {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

.bulk-actions .btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.bulk-actions .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
}

.bulk-actions .btn.primary:hover {
  background: #0d9668;
  border-color: #0d9668;
}

.bulk-actions .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.page-info {
  font-size: 14px;
  color: var(--gray-600);
}

/* ============================================
   SLIDE-IN DETAIL PANEL
   ============================================ */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.panel-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  height: 100vh;
  background: var(--white);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.detail-panel.open {
  transform: translateX(0);
}

.panel-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.panel-close {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.panel-close:hover {
  color: var(--gray-600);
  background: var(--gray-100);
}

.panel-close svg {
  width: 20px;
  height: 20px;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
}

/* Panel Execution Info */
.panel-exec-info {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--gray-200);
}

.panel-exec-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: var(--space-3);
}

.panel-exec-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.panel-meta-item {
  font-size: 13px;
  color: var(--gray-500);
}

.panel-meta-item strong {
  color: var(--gray-700);
  font-weight: 500;
}

/* Panel Timeline */
.panel-timeline-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: var(--space-4);
}

.panel-step {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: var(--space-3);
  transition: border-color 0.15s ease;
}

.panel-step:hover {
  border-color: var(--gray-300);
}

.panel-step.failed {
  background: var(--error-light);
  border-color: var(--error);
}

.panel-step-header {
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.panel-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.panel-step-dot.success {
  background: var(--success);
}

.panel-step-dot.failed {
  background: var(--error);
}

.panel-step-dot.running {
  background: var(--warning);
  animation: pulse 1.5s ease-in-out infinite;
}

.panel-step-dot.pending {
  background: var(--gray-300);
}

.panel-step-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
}

.panel-step-dur {
  font-size: 12px;
  color: var(--gray-500);
}

.panel-step-btns {
  display: flex;
  gap: 4px;
}

.panel-step-btn {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  transition: all 0.15s ease;
}

.panel-step-btn:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.panel-step-btn.active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: var(--white);
}

.panel-step-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Step Metadata Expansion */
.panel-step-metadata {
  display: none;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--gray-200);
  background: var(--white);
}

.panel-step-metadata.open {
  display: block;
}

.panel-step-metadata pre {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gray-700);
  background: var(--gray-50);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.panel-step-error {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid rgba(231, 76, 60, 0.2);
  background: var(--white);
  font-size: 13px;
  color: var(--error);
}

/* Panel Actions */
.panel-actions {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}

.panel-actions .btn {
  flex: 1;
  justify-content: center;
}

/* Responsive adjustments for history */
@media (max-width: 1024px) {
  .history-layout {
    grid-template-columns: 1fr;
  }

  .history-filters {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
  }

  .filter-section {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
  }

  .detail-panel {
    width: 100%;
  }
}
