/* ==============================================================================
   WREATH — Team Research Portal Design System
   SaaS Dashboard Theme (Light Mode, White Cards, Indigo/Purple Accent, Inter)
   Matches Attached Modern SaaS Reference UI
   ============================================================================== */

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

:root {
  /* Surface & Background Colors */
  --bg-app: #f4f6fa;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --bg-hover: #f1f4f9;

  /* Primary Brand & Accents (Purple / Indigo) */
  --primary: #5b52f9;
  --primary-hover: #4d44e5;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --primary-light: #eeebff;
  --primary-subtle: rgba(91, 82, 249, 0.08);

  /* Status Colors */
  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-success-text: #059669;

  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-warning-text: #d97706;

  --color-danger: #ef4444;
  --color-danger-bg: #fef2f2;
  --color-danger-text: #dc2626;

  --color-info: #06b6d4;
  --color-info-bg: #ecfeff;
  --color-info-text: #0891b2;

  --color-in-progress: #6366f1;
  --color-in-progress-bg: #eff2ff;

  --color-not-started: #94a3b8;
  --color-not-started-bg: #f1f5f9;

  /* Typography & Text */
  --text-main: #111827;
  --text-body: #374151;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --text-white: #ffffff;

  /* Borders & Dividers */
  --border-color: #eaedf3;
  --border-light: #f1f3f8;
  --border-focus: #5b52f9;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-card: 0 1px 3px rgba(16, 24, 40, 0.05), 0 4px 12px rgba(16, 24, 40, 0.02);
  --shadow-card-hover: 0 4px 16px rgba(16, 24, 40, 0.08);
  --shadow-dropdown: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-btn: 0 2px 8px rgba(91, 82, 249, 0.28);

  /* Radii */
  --radius-card: 16px;
  --radius-inner: 12px;
  --radius-btn: 10px;
  --radius-pill: 9999px;

  /* Dimensions */
  --sidebar-width: 240px;
  --header-height: 64px;

  /* Transitions */
  --transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==============================================================================
   BASE RESET
   ============================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-body);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: transparent;
}

input, select, textarea {
  font-family: inherit;
  font-size: 13.5px;
}

/* ==============================================================================
   APP LAYOUT (Sidebar + Main Content)
   ============================================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  overflow-y: auto;
}

.sidebar-header {
  padding: 22px 20px 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-stack-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(91, 82, 249, 0.3);
  flex-shrink: 0;
}

.logo-brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 8px 14px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 16px 10px 6px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8.5px 12px;
  border-radius: var(--radius-btn);
  font-size: 0.85rem;
  font-weight: 500;
  color: #4b5563;
  transition: var(--transition);
  text-align: left;
  width: 100%;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active .nav-icon {
  color: var(--primary);
}

.nav-icon {
  width: 18px;
  height: 18px;
  color: #6b7280;
  flex-shrink: 0;
  transition: var(--transition);
}

.nav-badge-pill {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--primary-subtle);
  color: var(--primary);
}

/* Sidebar Bottom User Profile Card */
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-sidebar);
}

.user-profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.user-profile-card:hover {
  border-color: #d1d5db;
}

.user-avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1e1b4b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  overflow: hidden;
  line-height: 1.25;
}

.user-name-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-text {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.user-logout-btn {
  color: #9ca3af;
  padding: 4px;
  border-radius: 6px;
  transition: var(--transition);
}

.user-logout-btn:hover {
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

/* MAIN CONTENT WRAPPER */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

/* TOP HEADER */
.top-header {
  height: var(--header-height);
  background: var(--bg-app);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

/* Global Search Bar */
.search-container {
  position: relative;
  width: 440px;
}

.search-icon-left {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: #9ca3af;
  pointer-events: none;
}

.global-search-input {
  width: 100%;
  height: 40px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 11px;
  padding: 0 46px 0 38px;
  font-size: 0.825rem;
  color: var(--text-main);
  transition: var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.global-search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(91, 82, 249, 0.12);
}

.search-shortcut-pill {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 7px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #9ca3af;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  pointer-events: none;
}

/* Header Right Actions */
.header-right-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.notification-bell-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  transition: var(--transition);
}

.notification-bell-btn:hover {
  border-color: #cbd5e1;
  color: var(--text-main);
}

.bell-badge-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-danger);
  border: 1.5px solid #ffffff;
}

/* Header User Profile Widget */
.header-profile-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 4px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.header-profile-widget:hover {
  background: rgba(0, 0, 0, 0.03);
}

.header-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1e1b4b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.header-user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.header-user-name {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text-main);
}

.header-user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ==============================================================================
   MAIN CANVAS & PAGE VIEWS
   ============================================================================== */
.canvas-body {
  padding: 6px 32px 48px 32px;
  flex: 1;
}

.view-section {
  display: none;
  animation: fadeIn 0.15s ease-out;
}

.view-section.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==============================================================================
   DASHBOARD HERO HEADER (Good Morning, Jay)
   ============================================================================== */
.dashboard-top-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.hero-welcome-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero-welcome-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.hero-top-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Sprint Milestone Card on Header */
.sprint-summary-pill-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.sprint-calendar-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.sprint-dates-col {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.sprint-day-label {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text-main);
}

.sprint-name-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sprint-progress-mini-col,
.sprint-progress-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 175px;
}

.sprint-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.675rem;
  color: var(--text-muted);
}

.sprint-date-range {
  white-space: nowrap;
}

.sprint-pct-badge {
  font-weight: 700;
  color: var(--primary);
  background: #eef2ff;
  padding: 1px 7px;
  border-radius: 9999px;
  font-size: 0.675rem;
  line-height: 1.3;
}

.sprint-mini-track,
.sprint-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}

.sprint-mini-fill,
.sprint-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* Primary Create Ticket Button */
.btn-create-ticket-hero {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-gradient);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.825rem;
  padding: 10px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow-btn);
  transition: var(--transition);
}

.btn-create-ticket-hero:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(91, 82, 249, 0.4);
}

/* ==============================================================================
   KPI CARDS ROW (5 Cards)
   ============================================================================== */
.kpi-summary-grid,
.kpi-row-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 110px;
  transition: var(--transition);
}

.kpi-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.kpi-card-header,
.kpi-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.kpi-icon-container,
.kpi-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-indigo, .kpi-icon-total { background: #f0edff; color: #5b52f9; }
.kpi-icon-green, .kpi-icon-completed { background: #ecfdf5; color: #10b981; }
.kpi-icon-blue, .kpi-icon-progress { background: #eff6ff; color: #3b82f6; }
.kpi-icon-gray, .kpi-icon-notstarted { background: #f1f5f9; color: #64748b; }
.kpi-icon-red, .kpi-icon-overdue { background: #fef2f2; color: #ef4444; }

.kpi-title-label,
.kpi-label-text {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-main-metric,
.kpi-value-number {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 4px 0 6px 0;
}

.kpi-footer-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-sub-text,
.kpi-sub-metric {
  font-size: 0.725rem;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-progress-bar-track,
.kpi-mini-bar {
  width: 100%;
  height: 4px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 4px;
}

.kpi-progress-bar-fill,
.kpi-mini-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.fill-green { background: #10b981; }
.fill-blue { background: #3b82f6; }
.fill-gray { background: #94a3b8; }
.fill-red { background: #ef4444; }

/* ==============================================================================
   MAIN 3-COLUMN DASHBOARD GRID
   ============================================================================== */
.dashboard-main-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr 1.25fr;
  gap: 16px;
}

/* REUSABLE CARD CONTAINER */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-heading-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.card-action-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  transition: var(--transition);
  padding: 2px 6px;
  border-radius: 6px;
}

.card-action-link:hover {
  background: var(--primary-light);
}

/* COLUMN 1: TEAM PROGRESS CARD */
.team-progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.team-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-avatar-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-color-1 { background: #e0e7ff; color: #4338ca; }
.avatar-color-2 { background: #d1fae5; color: #047857; }
.avatar-color-3 { background: #cffafe; color: #0e7490; }
.avatar-color-4 { background: #fee2e2; color: #b91c1c; }
.avatar-color-5 { background: #dbeafe; color: #1d4ed8; }
.avatar-color-6 { background: #fef3c7; color: #b45309; }
.avatar-color-7 { background: #ede9fe; color: #6d28d9; }
.avatar-color-8 { background: #e0f2fe; color: #0369a1; }
.avatar-color-9 { background: #f3e8ff; color: #7e22ce; }
.avatar-color-10 { background: #fae8ff; color: #86198f; }

.member-info-col {
  width: 140px;
  line-height: 1.2;
  overflow: hidden;
}

.member-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-role {
  font-size: 0.675rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-bar-container {
  flex: 1;
  height: 6px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
}

.member-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.member-stat-metric {
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-main);
  width: 65px;
  text-align: right;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.member-stat-ratio {
  color: var(--text-muted);
  font-weight: 500;
}

/* COLUMN 2: TASK STATUS OVERVIEW + DAILY PROGRESS TREND */
.content-card-column,
.col-charts-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Donut Chart Card */
.status-donut-chart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
}

.donut-chart-wrapper,
.donut-svg-container {
  position: relative;
  width: 130px;
  height: 130px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-center-badge,
.donut-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  line-height: 1.1;
}

.donut-center-number,
.donut-center-num {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.donut-center-label,
.donut-center-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.status-legend-col,
.donut-legend-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.legend-dot-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-body);
}

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

.dot-green { background: #10b981; }
.dot-blue { background: #6366f1; }
.dot-gray { background: #94a3b8; }
.dot-red { background: #ef4444; }

.legend-label {
  color: var(--text-muted);
  font-size: 0.725rem;
  flex: 1;
}

.legend-val,
.legend-count {
  font-size: 0.725rem;
  font-weight: 700;
  color: var(--text-main);
  margin-left: auto;
}

/* Daily Progress Trend Bar Chart */
.chart-select-sm {
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-body);
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 4px 10px;
  outline: none;
  cursor: pointer;
}

.trend-chart-box {
  padding-top: 10px;
}

.trend-bars-row,
.trend-bars-container {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 95px;
  gap: 8px;
  position: relative;
}

.trend-day-col,
.trend-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
}

.trend-bar-wrapper {
  height: 70px;
  width: 100%;
  max-width: 22px;
  background: #f1f5f9;
  border-radius: 4px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.trend-bar-fill,
.trend-bar-pillar {
  width: 100%;
  background: #6366f1;
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}

.trend-day-label {
  font-size: 0.675rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.trend-chart-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.my-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

#dashboard-team-progress-list,
#dashboard-my-tasks-list {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.my-task-item,
.task-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  transition: var(--transition);
  cursor: pointer;
}

.my-task-item:hover,
.task-item-row:hover {
  background: #f8fafc;
}

.my-task-item.completed-row {
  opacity: 0.65;
}

.task-check-circle,
.task-status-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: var(--transition);
}

.task-check-circle.checked {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #ffffff;
}

.task-title-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-meta-tags {
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-sprint-day {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
}

.task-meta-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.task-due-date-text {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.task-due-date-text.overdue {
  color: var(--color-danger);
}

.task-due-date-text.completed {
  color: var(--color-success);
}

.task-files-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.675rem;
  color: var(--text-muted);
}

.task-status-completed {
  background: var(--color-success);
  color: #ffffff;
}

.task-status-inprogress {
  border: 2px solid var(--primary);
  background: transparent;
}

.task-status-notstarted {
  border: 2px solid #cbd5e1;
  background: transparent;
}

.task-title-text {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.task-title-text:hover {
  color: var(--primary);
}

.task-priority-pill {
  font-size: 0.675rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  flex-shrink: 0;
}

.priority-high {
  background: #fee2e2;
  color: #b91c1c;
}

.priority-medium {
  background: #fef3c7;
  color: #b45309;
}

.priority-low {
  background: #ecfdf5;
  color: #047857;
}

.task-day-pill {
  font-size: 0.675rem;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}

.task-due-date {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 48px;
  text-align: right;
}

.task-due-date.urgent {
  color: var(--color-danger);
}

.task-due-date.today {
  color: var(--color-success);
}

.task-artifact-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.btn-more-dots {
  color: #9ca3af;
  padding: 2px 4px;
  border-radius: 4px;
}

.btn-more-dots:hover {
  color: var(--text-main);
  background: #e2e8f0;
}

/* ==============================================================================
   BOTTOM ROW (3 Cards: Deadlines, Recent Files, Recent Activity)
   ============================================================================== */
.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

/* Upcoming Deadlines */
.deadline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deadline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px;
  border-radius: 8px;
  transition: var(--transition);
}

.deadline-item:hover {
  background: #f8fafc;
}

.deadline-date-box {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1.1;
}

.deadline-month {
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-danger);
}

.deadline-day {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.deadline-content-col {
  flex: 1;
  overflow: hidden;
  line-height: 1.25;
}

.deadline-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deadline-member-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Recent Files Card */
.files-preview-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-preview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px;
  border-radius: 8px;
  transition: var(--transition);
}

.file-preview-item:hover {
  background: #f8fafc;
}

.file-type-badge {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: #ffffff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.file-badge-pdf { background: #ef4444; }
.file-badge-png { background: #3b82f6; }
.file-badge-docx { background: #2563eb; }
.file-badge-csv { background: #10b981; }

.file-meta-col {
  flex: 1;
  overflow: hidden;
  line-height: 1.25;
}

.file-title-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.file-title-name:hover {
  color: var(--primary);
}

.file-uploader-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.file-visibility-pill {
  font-size: 0.675rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}

.visibility-team {
  background: #ecfdf5;
  color: #059669;
}

.visibility-private {
  background: #f1f5f9;
  color: #64748b;
}

/* Recent Activity Card */
.activity-preview-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.activity-item-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.activity-avatar-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.activity-text-col {
  flex: 1;
  line-height: 1.25;
}

.activity-main-line {
  font-size: 0.775rem;
  color: var(--text-main);
}

.activity-main-line strong {
  font-weight: 700;
}

.activity-sub-snippet {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.activity-time-text {
  font-size: 0.675rem;
  color: var(--text-light);
  white-space: nowrap;
  margin-top: 2px;
}

/* ==============================================================================
   ALL TASKS & TASK MANAGEMENT TABLES
   ============================================================================== */
.table-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.filter-group-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-input-search {
  height: 36px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 0.8rem;
  color: var(--text-main);
  outline: none;
  min-width: 220px;
}

.filter-select {
  height: 36px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 0.8rem;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.table-responsive-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: #ffffff;
}

.saas-data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.825rem;
}

.saas-data-table th {
  background: #f8fafc;
  padding: 10px 14px;
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.saas-data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-body);
  vertical-align: middle;
}

.saas-data-table tr:hover td {
  background: #f8fafc;
}

/* Status Badges */
.status-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 0.725rem;
  font-weight: 700;
}

.status-completed {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.status-in-progress {
  background: var(--color-in-progress-bg);
  color: var(--primary);
}

.status-not-started {
  background: var(--color-not-started-bg);
  color: var(--color-not-started);
}

.status-overdue {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

.status-blocked {
  background: #fff1f2;
  color: #e11d48;
}

.status-submitted {
  background: #fef3c7;
  color: #b45309;
}

/* Action Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-gradient);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 7px 14px;
  border-radius: 8px;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(91, 82, 249, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(91, 82, 249, 0.35);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-body);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 7px 14px;
  border-radius: 8px;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* ==============================================================================
   TASK DETAIL DRAWER / MODAL
   ============================================================================== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.4);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: flex-end;
}

.drawer-overlay.active {
  display: flex;
}

.drawer-panel {
  width: 580px;
  max-width: 90vw;
  height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  animation: slideDrawer 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDrawer {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.drawer-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  background: #f8fafc;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.drawer-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-meta-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.drawer-meta-value {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text-main);
}

/* ==============================================================================
   MODALS (Create Ticket, Settings, Upload)
   ============================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(2px);
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-card);
  width: 540px;
  max-width: 100%;
  box-shadow: var(--shadow-dropdown);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScale 0.18s ease-out;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  color: #9ca3af;
  font-size: 1.25rem;
  padding: 4px;
  border-radius: 6px;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.modal-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 75vh;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 82, 249, 0.12);
}

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

.modal-footer {
  padding: 14px 22px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Dropzone for File Uploads */
.file-dropzone-box {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
  transition: var(--transition);
}

.file-dropzone-box:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Toast Notifications (legacy single-style, kept for back-compat) */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 48px));
}

.toast-msg {
  background: #111827;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.825rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideToast 0.2s ease-out;
}

/* Wreath snackbar system — typed cards, one visual language */
.wreath-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 12px 12px 12px 14px;
  font-size: 0.8rem;
  line-height: 1.5;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  animation: slideToast 0.22s ease-out;
}

.wreath-toast-success { border-left-color: #16a34a; }
.wreath-toast-error { border-left-color: #dc2626; }
.wreath-toast-info { border-left-color: #5b52f9; }

.wreath-toast-icon {
  flex-shrink: 0;
  display: inline-flex;
  margin-top: 1px;
}

.wreath-toast-success .wreath-toast-icon { color: #16a34a; }
.wreath-toast-error .wreath-toast-icon { color: #dc2626; }
.wreath-toast-info .wreath-toast-icon { color: #5b52f9; }

.wreath-toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.wreath-toast-close {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.wreath-toast-close:hover { color: var(--text-main); }

.wreath-toast-out {
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

@keyframes slideToast {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==============================================================================
   FULL-SCREEN AUTH GATE (Login page shown before any dashboard content)
   ============================================================================== */

/* Hide app when gate is active */
body.auth-gate-active .app-container {
  visibility: hidden;
  pointer-events: none;
  user-select: none;
}

#auth-fullscreen-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  background: #ffffff;
  transition: opacity 0.35s ease;
}

#auth-fullscreen-gate.gate-fade-out {
  opacity: 0;
  pointer-events: none;
}

/* ---- Left branding panel ---- */
.gate-left-panel {
  width: 45%;
  flex-shrink: 0;
  background: linear-gradient(145deg, #1e1b4b 0%, #312e81 40%, #4338ca 80%, #6366f1 100%);
  padding: 52px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.gate-left-panel::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.gate-left-panel::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -60px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.gate-brand-top {
  position: relative;
  z-index: 1;
}

.gate-brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.gate-brand-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  backdrop-filter: blur(8px);
}

.gate-brand-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.08em;
}

.gate-brand-sub {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
  letter-spacing: 0.05em;
}

.gate-hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
  margin-bottom: 12px;
}

.gate-hero-subtitle {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.6;
  max-width: 320px;
}

.gate-features {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.gate-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.gate-feature-icon-wrap {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.gate-feature-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
  display: block;
  margin-bottom: 1px;
}

.gate-feature-desc {
  font-size: 0.715rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.4;
}

.gate-left-footer {
  position: relative;
  z-index: 1;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.03em;
}

/* ---- Right form panel ---- */
.gate-right-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 48px;
  background: #f8fafc;
  overflow-y: auto;
}

.gate-form-box {
  width: 100%;
  max-width: 400px;
}

.gate-form-header {
  margin-bottom: 28px;
}

.gate-form-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.gate-form-subtitle {
  font-size: 0.825rem;
  color: #64748b;
}

/* Gate Tabs */
.gate-tabs {
  display: flex;
  background: #e2e8f0;
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 24px;
}

.gate-tab-btn {
  flex: 1;
  padding: 9px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  color: #64748b;
  transition: all 0.18s ease;
}

.gate-tab-btn.active {
  background: #ffffff;
  color: #1e1b4b;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Gate Inputs */
.gate-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.gate-form-label {
  font-size: 0.775rem;
  font-weight: 600;
  color: #374151;
}

.gate-form-input {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  padding: 10px 13px;
  font-size: 0.85rem;
  color: #0f172a;
  outline: none;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.gate-form-input:focus {
  border-color: #5b52f9;
  box-shadow: 0 0 0 3px rgba(91, 82, 249, 0.12);
}

.gate-form-input::placeholder {
  color: #94a3b8;
}

.gate-help-text {
  font-size: 0.685rem;
  color: #94a3b8;
  margin-top: 1px;
  display: block;
}

.gate-error-box {
  display: none;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 13px;
  color: #dc2626;
  font-size: 0.775rem;
  margin-bottom: 14px;
  line-height: 1.4;
}

.gate-submit-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #5b52f9 0%, #4338ca 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.18s ease;
  margin-top: 6px;
  letter-spacing: 0.01em;
}

.gate-submit-btn:hover {
  background: linear-gradient(135deg, #4d44e5 0%, #3730a3 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(91, 82, 249, 0.35);
}

.gate-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.gate-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 9999px;
  border: 1px solid transparent;
}

.gate-role-admin {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #ddd6fe;
}

.gate-role-member {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

/* Members must not create tickets (admin-only). Covers static hero buttons
   AND dynamically rendered empty-state buttons via the onclick hook.
   Upload-artifact and other member actions are untouched. */
body.role-member [onclick*="modal-create-task"] {
  display: none !important;
}

/* Members must not delete tickets either (admin-only danger zone) */
body.role-member .btn-delete-ticket {
  display: none !important;
}

/* Responsive: Stack panels on mobile */
@media (max-width: 768px) {
  #auth-fullscreen-gate {
    flex-direction: column;
  }

  .gate-left-panel {
    width: 100%;
    padding: 32px 24px;
    min-height: 200px;
  }

  .gate-hero-title {
    font-size: 1.5rem;
  }

  .gate-right-panel {
    padding: 24px 20px;
  }

  .gate-features {
    display: none;
  }
}

/* ==============================================================================
   JWT AUTH & SESSION UI
   ============================================================================== */
.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.725rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.session-chip.admin-chip {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #ddd6fe;
}

.session-chip.admin-chip:hover {
  background: #e0e7ff;
}

.session-chip.member-chip {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.session-chip.member-chip:hover {
  background: #d1fae5;
}

.session-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.session-dot.admin {
  background: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

.session-dot.member {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* User Dropdown */
.header-user-dropdown-menu {
  display: none;
  position: absolute;
  top: 64px;
  right: 28px;
  width: 290px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.12);
  z-index: 100;
  padding: 14px;
  animation: modalScale 0.15s ease-out;
}

.dropdown-user-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.dropdown-avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.dropdown-user-info {
  overflow: hidden;
}

.dropdown-user-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.dropdown-user-email {
  font-size: 0.725rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin-top: 1px;
}

.dropdown-session-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
  font-size: 0.75rem;
}

.dropdown-session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.dropdown-session-row:last-child {
  margin-bottom: 0;
}

.dropdown-nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.dropdown-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  text-decoration: none;
  transition: var(--transition);
}

.dropdown-nav-item:hover {
  background: #f1f5f9;
  color: var(--primary);
}

.dropdown-logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: #fef2f2;
  color: #dc2626;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.dropdown-logout-btn:hover {
  background: #fee2e2;
  color: #b91c1c;
}

/* Auth Tabs */
.auth-nav-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: #f8fafc;
  padding: 4px 16px 0 16px;
}

.auth-nav-tab {
  flex: 1;
  padding: 12px 8px;
  font-size: 0.825rem;
  font-weight: 600;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  transition: var(--transition);
}

.auth-nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #ffffff;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.form-help-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 3px;
  display: block;
}

/* Member Focus Banner on Dashboard */
.member-session-banner {
  background: linear-gradient(135deg, #f0fdf4 0%, #e0e7ff 100%);
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.member-session-banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.member-session-badge-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #5b52f9;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

/* ==============================================================================
   MOBILE RESPONSIVE LAYER (phones + small tablets)
   Sidebar becomes off-canvas with hamburger trigger; tables scroll sideways;
   heroes/forms/modals/drawer stack to full width.
   ============================================================================== */

/* Hamburger trigger — desktop hidden, injected in every top-header */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  background: #ffffff;
  border-radius: 10px;
  color: var(--text-main);
  cursor: pointer;
}

/* Click-away scrim behind the open mobile sidebar (created by app.js) */
.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 115;
}

.sidebar-scrim.show {
  display: block;
}

body.sidebar-lock {
  overflow: hidden;
}

@media (max-width: 900px) {
  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar {
    z-index: 120;
    box-shadow: 12px 0 40px rgba(15, 23, 42, 0.18);
  }

  .top-header {
    gap: 8px;
  }

  .search-container {
    flex: 1;
    min-width: 0;
  }

  .global-search-input {
    width: 100%;
  }

  .search-shortcut-pill {
    display: none;
  }

  /* Heroes: title stacks above actions, actions wrap */
  .dashboard-top-hero {
    flex-wrap: wrap;
    gap: 10px;
  }

  .hero-top-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  /* Two-column forms go single column */
  .form-row-2 {
    grid-template-columns: 1fr;
  }

  /* Data tables scroll horizontally instead of breaking layout */
  .table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .saas-data-table {
    min-width: 640px;
  }

  /* Cards that sit side-by-side get room to wrap */
  .my-task-item,
  .file-preview-row {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  /* Modals become bottom-anchored sheets */
  .modal-box {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
  }

  .modal-body {
    overflow-y: auto;
  }

  #modal-file-viewer .modal-box {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Toasts span the screen width */
  #toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 560px) {
  /* Full-width slide-over drawer on phones */
  .drawer-panel {
    width: 100vw;
    max-width: 100vw;
  }

  .header-user-text {
    display: none;
  }

  .hero-welcome-title {
    font-size: 1.25rem;
  }

  .hero-welcome-subtitle {
    font-size: 0.8rem;
  }

  .notification-bell-btn {
    display: none;
  }

  .btn-create-ticket-hero {
    flex: 1;
    justify-content: center;
  }
}
@media (max-width: 1200px) {
  .dashboard-main-grid {
    grid-template-columns: 1fr 1fr;
  }
  .dashboard-main-grid > .content-card:nth-child(3) {
    grid-column: span 2;
  }
  .kpi-row-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .dashboard-bottom-grid {
    grid-template-columns: 1fr 1fr;
  }
  .dashboard-bottom-grid > .content-card:last-child {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .top-header {
    padding: 0 16px;
  }
  .canvas-body {
    padding: 12px 16px 36px 16px;
  }
  .kpi-row-grid {
    grid-template-columns: 1fr 1fr;
  }
  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-main-grid > .content-card:nth-child(3) {
    grid-column: span 1;
  }
  .dashboard-bottom-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-bottom-grid > .content-card:last-child {
    grid-column: span 1;
  }
  .search-container {
    width: 220px;
  }
}
