@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg-canvas: #f8fafc;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active-text: #ffffff;
  --card-bg: #ffffff;
  --card-border: rgba(15, 23, 42, 0.06);
  --card-shadow: 0 1px 3px rgba(15, 23, 42, 0.02), 0 10px 40px -10px rgba(15, 23, 42, 0.04);
  --card-shadow-hover: 0 10px 30px -10px rgba(239, 68, 68, 0.12), 0 20px 50px -15px rgba(15, 23, 42, 0.08);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --brand-red: #ef4444;
  --brand-orange: #f97316;
  --brand-gradient: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
  --brand-gradient-hover: linear-gradient(135deg, #dc2626 0%, #ea580c 100%);
  --brand-glowing: 0 4px 20px rgba(239, 68, 68, 0.35);
  
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font-family); background: var(--bg-canvas); color: var(--text-primary); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; border: none; background: none; white-space: nowrap !important; }
a { text-decoration: none; color: inherit; }

/* Grid & Layout */
.app-container { min-height: 100vh; display: flex; flex-direction: row; background: var(--bg-canvas); width: 100%; }

/* Navigation - Floating Sidebar Style */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: var(--sidebar-bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 10px 0 30px rgba(15, 23, 42, 0.05);
  padding: 24px 16px;
  transition: var(--transition-smooth);
}
.top-nav-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 32px;
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
.brand-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--brand-gradient);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: var(--brand-glowing);
}
.brand-logo-text h1 {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.top-nav-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.top-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 600;
  transition: var(--transition-smooth);
  white-space: nowrap !important;
}
.top-nav-btn svg {
  opacity: 0.7;
  transition: var(--transition-smooth);
}
.top-nav-btn:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-active-text);
}
.top-nav-btn:hover svg {
  opacity: 1;
  transform: translateX(2px);
}
.top-nav-btn.active {
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--brand-glowing);
}
.top-nav-btn.active svg {
  opacity: 1;
}
.nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.nav-badge.blue {
  background: #3b82f6;
}

/* Main Canvas Area */
.main-canvas {
  flex: 1;
  margin-left: 260px;
  padding: 40px 48px;
  max-width: calc(100% - 260px);
  min-height: 100vh;
}

/* Top bar headers */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 20px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 24px;
}
.header-title h2 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}
.header-title p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13.5px;
  transition: var(--transition-smooth);
  white-space: nowrap !important;
  user-select: none;
}
.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: var(--brand-glowing);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.45);
}
.btn-secondary {
  background: #fff;
  color: var(--text-secondary);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.25);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.btn-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.btn-danger:hover {
  background: #fee2e2;
  transform: translateY(-1px);
}
.btn-sm {
  padding: 6px 14px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}

/* Cards & Stats */
.card-grid {
  display: grid;
  gap: 24px;
}
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--card-shadow);
  transition: var(--transition-smooth);
}
.card-header-title {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--card-shadow);
  text-align: left;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand-gradient);
  opacity: 0;
  transition: var(--transition-smooth);
}
.stat-card:hover::before {
  opacity: 1;
}
.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  font-weight: 700;
}
.stat-val {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
}
.stat-lbl {
  font-size: 13.5px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Tables */
.table-card {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  width: 100%;
  padding: 8px 0;
}
.table-wrapper {
  width: 100%;
  overflow-x: auto;
}
.custom-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
.custom-table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  text-align: left;
  white-space: nowrap;
}
.custom-table td {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: var(--text-primary);
  transition: var(--transition-smooth);
}
.custom-table tr:last-child td {
  border-bottom: none;
}
.custom-table tr:hover td {
  background: #f8fafc;
}

/* Cells */
.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(249, 115, 22, 0.08));
  color: var(--brand-red);
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(239, 68, 68, 0.15);
  flex-shrink: 0;
}
.user-name {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-primary);
}
.user-email {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: capitalize;
  white-space: nowrap;
}
.pill-new, .pill-pending {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fef3c7;
}
.pill-assigned, .pill-in_progress {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #e0f2fe;
}
.pill-active, .pill-done, .pill-approved, .pill-converted, .pill-completed, .pill-sent {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #dcfce7;
}
.pill-lost, .pill-rejected, .pill-cancelled, .pill-failed {
  background: #f8fafc;
  color: var(--text-secondary);
  border: 1px solid #e2e8f0;
}
.pill-urgent, .pill-high {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fee2e2;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 64px 32px;
  background: #fff;
  border: 2px dashed rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.empty-state h4 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  max-width: 400px;
  line-height: 1.5;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.25s ease-out;
}
.modal-content {
  background: #fff;
  border-radius: var(--radius-lg);
  width: min(540px, 100%);
  padding: 32px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.2);
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--card-border);
}
.modal-header h3 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-secondary);
}
.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 23, 42, 0.12);
  outline: none;
  font-size: 14px;
  transition: var(--transition-smooth);
}
.form-control:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}
select.form-control {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 14px center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
  appearance: none;
}

.custom-select {
  padding: 8px 32px 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 23, 42, 0.12);
  outline: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  appearance: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.custom-select:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Step Checklist Items */
.step-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-md);
  transition: var(--transition-smooth);
}
.step-item:hover {
  border-color: rgba(15, 23, 42, 0.15);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.02);
}
.step-item.status-done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.step-item.status-skipped {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.04);
}
.step-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  transition: var(--transition-smooth);
}
.status-done .step-badge {
  background: #10b981;
  color: #ffffff;
}
.status-skipped .step-badge {
  background: #cbd5e1;
  color: #ffffff;
}
.step-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  transition: var(--transition-smooth);
}
.status-done .step-title {
  color: #15803d;
}
.status-skipped .step-title {
  color: #94a3b8;
  text-decoration: line-through;
}
.step-client-action {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand-red);
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
  }
  .top-nav {
    position: sticky;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 16px 20px;
  }
  .top-nav-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
  }
  .brand-logo {
    margin-bottom: 0;
  }
  .top-nav-links {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding: 4px 0;
    width: auto;
  }
  .top-nav-btn {
    padding: 8px 14px;
  }
  .main-canvas {
    margin-left: 0;
    padding: 24px 20px;
    max-width: 100%;
  }
  .grid-4, .grid-3, .grid-2 {
    grid-template-columns: 1fr;
  }
}
