/* ==========================================================================
   QLDTC TUEBA - Modern Youthful SaaS Design System
   ========================================================================== */

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', 'Plus Jakarta Sans', sans-serif;

  /* Vibrant Modern Color Palette */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #3b82f6 100%);
  
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --line: #e2e8f0;
  --line-subtle: #f1f5f9;

  /* Sidebar Gradient */
  --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);

  /* Status Colors */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --danger: #f43f5e;
  --danger-bg: #fff1f2;
  --danger-border: #fecdd3;

  --info: #0284c7;
  --info-bg: #e0f2fe;
  --info-border: #bae6fd;

  /* Depth & Shadows */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 10px 10px -5px rgba(15, 23, 42, 0.03);
  --shadow-glow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text);
  letter-spacing: -0.02em;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-hover);
}

button, input, select, textarea {
  font-family: inherit;
}

/* ==========================================================================
   Layout Shell
   ========================================================================== */

.app-shell {
  min-height: 100vh;
  display: flex;
}

/* Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: var(--sidebar-bg);
  color: #fff;
  padding: 0 16px 24px;
  z-index: 30;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15);
}

.brand {
  height: 80px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--primary-gradient);
  color: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-glow);
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-text strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  line-height: 1.1;
}

.brand-text span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #818cf8;
  letter-spacing: 1.8px;
  margin-top: 2px;
}

.sidebar nav {
  padding-top: 20px;
}

.sidebar nav a {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #94a3b8;
  padding: 9px 14px;
  border-radius: 10px;
  margin: 3px 0;
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.2s ease;
  position: relative;
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.75;
  transition: all 0.2s ease;
}

.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(3px);
}

.sidebar nav a:hover .nav-icon {
  opacity: 1;
  transform: scale(1.05);
}

.sidebar nav a.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3) 0%, rgba(59, 130, 246, 0.15) 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.sidebar nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10%;
  bottom: 10%;
  width: 4px;
  background: #818cf8;
  border-radius: 0 4px 4px 0;
}

.sidebar nav a.active .nav-icon {
  opacity: 1;
  color: #818cf8;
}

.nav-label {
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  margin: 24px 12px 8px;
  text-transform: uppercase;
}

/* Main Content Area */
.main {
  margin-left: 260px;
  min-height: 100vh;
  width: calc(100% - 260px);
  display: flex;
  flex-direction: column;
}

/* Topbar Header */
.topbar {
  height: 76px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.icon-btn {
  display: none;
  border: 0;
  background: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text);
  padding: 6px;
  border-radius: 8px;
}

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

.top-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* User Box Topbar */
.userbox {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.notification-bell {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #f1f5f9;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.notification-bell:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.bell-icon {
  width: 20px;
  height: 20px;
}

.pulse-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(244, 63, 94, 0.4);
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 4px 14px 4px 6px;
  border-radius: 30px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.user-meta strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.user-meta small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: #ffe4e6;
  transform: translateY(-1px);
}

.logout-icon {
  width: 16px;
  height: 16px;
}

/* Main Content Body */
.content {
  padding: 32px 36px 60px;
  max-width: 1540px;
  margin: 0 auto;
  width: 100%;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
}

.page-head h1 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--text);
}

.page-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.eyebrow {
  font-size: 12px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ==========================================================================
   Buttons & Inputs
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--primary-gradient);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn.primary:hover {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
}

.btn.danger {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.btn.danger:hover {
  background: #ffe4e6;
}

.btn.full {
  width: 100%;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.actions form {
  margin: 0;
}

/* Inputs & Form Control */
label {
  display: block;
  color: #334155;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 14px;
}

input, select, textarea {
  width: 100%;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 11px 14px;
  background: #ffffff;
  color: var(--text);
  margin-top: 6px;
  outline: none;
  font-size: 14px;
  transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.filters input {
  max-width: 340px;
  margin: 0;
}

.filters select {
  max-width: 220px;
  margin: 0;
}

/* ==========================================================================
   Cards & KPI Stat Boxes
   ========================================================================== */

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

.card.narrow {
  max-width: 780px;
}

.card h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 18px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-head h2 {
  margin: 0;
}

/* Stats Grid */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #94a3b8;
}

.stat.blue::before { background: linear-gradient(90deg, #3b82f6, #0284c7); }
.stat.red::before { background: linear-gradient(90deg, #f43f5e, #e11d48); }
.stat.green::before { background: linear-gradient(90deg, #10b981, #059669); }

.stat:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.stat strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  margin: 8px 0 4px;
  color: var(--text);
  line-height: 1.1;
}

.stat small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Project Metrics Summary Bar */
.project-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.project-metrics > div {
  background: #ffffff;
  padding: 18px 22px;
}

.project-metrics span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.project-metrics strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

/* ==========================================================================
   Tables & Status Badges
   ========================================================================== */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-subtle);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th {
  text-align: left;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: #f8fafc;
  padding: 14px 16px;
  border-bottom: 2px solid var(--line);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-subtle);
  vertical-align: middle;
  font-size: 13.5px;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: #f8fafc;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 14px;
}

/* Pill Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.badge.in_progress, .badge.active, .badge.on_track {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-border);
}

.badge.completed {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.badge.late, .badge.overdue, .badge.disabled {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

/* Progress bar */
.progress {
  width: 110px;
  height: 8px;
  background: #e2e8f0;
  border-radius: 6px;
  display: inline-block;
  overflow: hidden;
  margin-right: 10px;
  vertical-align: middle;
}

.progress i {
  height: 100%;
  display: block;
  background: var(--primary-gradient);
  border-radius: 6px;
  transition: width 0.3s ease;
}

/* ==========================================================================
   Alerts, Tabs & Details
   ========================================================================== */

.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

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

.alert.success {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid var(--success-border);
}

.alert.danger {
  background: var(--danger-bg);
  color: #9f1239;
  border: 1px solid var(--danger-border);
}

.alert.fade {
  opacity: 0.45;
}

/* Navigation Tabs */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 2px solid var(--line);
  margin: 0 0 24px;
  padding-bottom: 2px;
}

.tabs > * {
  white-space: nowrap;
  padding: 12px 18px;
  color: var(--text-muted);
  font-weight: 600;
  border-radius: 10px 10px 0 0;
  transition: all 0.2s ease;
}

.tabs a:hover {
  color: var(--primary);
  background: #f1f5f9;
}

.tabs b {
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
  font-weight: 700;
}

.details {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  margin: 0;
}

.details dt {
  color: var(--text-muted);
  font-weight: 600;
}

.details dd {
  margin: 0;
  font-weight: 700;
  color: var(--text);
}

/* ==========================================================================
   Auth / Login Screen Modern Visuals
   ========================================================================== */

.auth-page {
  min-height: 100vh;
  background: radial-gradient(circle at 15% 15%, #312e81 0%, #0f172a 50%, #020617 100%);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
  top: -100px;
  right: -100px;
  border-radius: 50%;
  pointer-events: none;
}

.login-shell {
  width: 100%;
  padding: 24px;
  z-index: 10;
}

.login-card {
  max-width: 440px;
  margin: auto;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 42px 38px;
  box-shadow: 0 25px 70px -15px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  background: var(--primary-gradient);
  color: #fff;
  border-radius: 16px;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-glow);
}

.login-logo svg {
  width: 30px;
  height: 30px;
}

.login-card h1 {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--text);
}

.login-card .sub {
  text-align: center;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 28px;
  font-size: 13.5px;
}

.login-foot {
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  margin: 24px 0 0;
  font-weight: 600;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 1024px) {
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .main {
    margin-left: 0;
    width: 100%;
  }
  .icon-btn {
    display: flex;
    margin-right: 12px;
  }
  .sidebar-open .sidebar {
    transform: translateX(0);
  }
  .sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 25;
  }
}

@media (max-width: 650px) {
  .content {
    padding: 20px 16px;
  }
  .topbar {
    padding: 0 16px;
  }
  .top-title {
    display: none;
  }
  .user-meta {
    display: none;
  }
  .stats, .project-metrics, .form-row {
    grid-template-columns: 1fr;
  }
  .page-head {
    flex-direction: column;
  }
  .filters {
    flex-direction: column;
  }
  .filters input, .filters select {
    max-width: none;
  }
  .login-card {
    padding: 30px 24px;
  }
}
