/* ==========================================================================
   CSS Custom Properties & Design Tokens
   ========================================================================== */
:root {
  --font-primary: 'Outfit', 'Sarabun', sans-serif;
  
  /* Color Palette - Premium Light Glassmorphism Theme */
  --bg-body: #f1f5f9;
  --bg-gradient: linear-gradient(135deg, #eef2f6 0%, #e2e8f0 100%);
  --window-bg: rgba(255, 255, 255, 0.65);
  --window-border: rgba(255, 255, 255, 0.8);
  
  --panel-bg: rgba(255, 255, 255, 0.45);
  --panel-border: rgba(255, 255, 255, 0.55);
  
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(255, 255, 255, 0.95);
  --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.04);
  --card-shadow-hover: 0 16px 48px 0 rgba(31, 38, 135, 0.09);
  
  /* Status Colors */
  --color-total: #8b5cf6; /* Purple */
  --color-total-bg: rgba(139, 92, 246, 0.1);
  --color-todo: #3b82f6; /* Blue */
  --color-todo-bg: rgba(59, 130, 246, 0.1);
  --color-progress: #f59e0b; /* Amber/Yellow */
  --color-progress-bg: rgba(245, 158, 11, 0.1);
  --color-review: #a855f7; /* Violet */
  --color-review-bg: rgba(168, 85, 247, 0.1);
  --color-done: #10b981; /* Emerald */
  --color-done-bg: rgba(16, 185, 129, 0.1);
  --color-overdue: #f43f5e; /* Rose */
  --color-overdue-bg: rgba(244, 63, 94, 0.1);
  
  /* Priority Colors */
  --priority-low: #64748b;
  --priority-medium: #f59e0b;
  --priority-high: #ef4444;
  
  /* Text Colors */
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  /* Animations */
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-card: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

/* ==========================================================================
   Base Structure & Layout
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-primary);
  color: var(--text-main);
  background: var(--bg-body);
  background-attachment: fixed;
  min-height: 100vh;
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
}

/* Background Blur Blobs */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  opacity: 0.65;
}

.blob-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(199, 210, 254, 0.7) 0%, rgba(199, 210, 254, 0) 70%);
  top: -10%;
  left: 10%;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(254, 205, 211, 0.6) 0%, rgba(254, 205, 211, 0) 70%);
  bottom: -5%;
  right: 5%;
}

.blob-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(209, 250, 229, 0.7) 0%, rgba(209, 250, 229, 0) 70%);
  bottom: 30%;
  left: -10%;
}

/* App Desktop-like Window */
.app-window {
  width: 100%;
  max-width: 1440px;
  background: var(--window-bg);
  backdrop-filter: blur(24px) saturate(120%);
  -webkit-backdrop-filter: blur(24px) saturate(120%);
  border: 1px solid var(--window-border);
  border-radius: 32px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.06);
  padding: 2.5rem;
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

* {
  scrollbar-color: rgba(0, 0, 0, 0.12) rgba(0, 0, 0, 0.02);
  scrollbar-width: thin;
}

/* ==========================================================================
   Header & Navigation (Top Bar)
   ========================================================================== */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.navbar-left .logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-icon {
  stroke: #4f46e5;
  stroke-width: 2.5px;
  width: 32px;
  height: 32px;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--text-main);
  line-height: 1.1;
}

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

/* Segmented Navigation Control */
.segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.04);
  padding: 0.25rem;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.01);
}

.control-btn {
  border: none;
  background: transparent;
  padding: 0.6rem 1.6rem;
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.control-btn:hover {
  color: var(--text-main);
}

.control-btn.active {
  background: white;
  color: #4f46e5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* User Switcher Dropdown */
.profile-switcher {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 9999px;
  padding: 0.5rem 1rem 0.5rem 1.25rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
}

.profile-switcher:hover {
  border-color: #4f46e5;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.08);
}

.profile-info {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.profile-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.profile-name {
  font-size: 0.9rem;
  color: var(--text-main);
  font-weight: 600;
}

.profile-avatar {
  font-size: 1.25rem;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

/* Dropdown Menu Popover */
.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12);
  z-index: 200;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: dropdownFade 0.2s ease-out forwards;
}

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

.profile-dropdown.open {
  display: flex;
}

.dropdown-header {
  padding: 0.85rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-light);
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-smooth);
}

.dropdown-item:hover {
  background: rgba(79, 70, 229, 0.06);
  color: #4f46e5;
  padding-left: 1.5rem;
}

.dropdown-item.active {
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
  font-weight: 600;
}

.dropdown-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  padding: 0.6rem;
}

.btn-reset-data {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem;
  background: rgba(239, 68, 68, 0.06);
  border: 1px dashed rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  color: #ef4444;
  font-family: var(--font-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-reset-data:hover {
  background: rgba(239, 68, 68, 0.12);
  transform: translateY(-1px);
}

/* ==========================================================================
   Content Views & Animations
   ========================================================================== */
.content-view {
  display: none;
  flex-direction: column;
  gap: 2rem;
  animation: viewFade 0.4s ease-out forwards;
}

.content-view.active {
  display: flex;
}

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

/* ==========================================================================
   View 1: Supervisor Dashboard Layout
   ========================================================================== */

/* Hero Title Section */
.hero-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.hero-left h1 {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

/* Stats Grid (5 Columns) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem;
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--card-shadow);
  transition: var(--transition-smooth);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
  background: rgba(255, 255, 255, 0.55);
}

.stat-icon-box {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-box.total { background: var(--color-total-bg); color: var(--color-total); }
.stat-icon-box.todo { background: var(--color-todo-bg); color: var(--color-todo); }
.stat-icon-box.in-progress { background: var(--color-progress-bg); color: var(--color-progress); }
.stat-icon-box.review { background: var(--color-review-bg); color: var(--color-review); }
.stat-icon-box.done { background: var(--color-done-bg); color: var(--color-done); }

.stat-icon-box i {
  width: 22px;
  height: 22px;
  stroke-width: 2.5px;
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-desc {
  font-size: 0.72rem;
  color: var(--text-light);
  font-weight: 500;
}

/* Dashboard Middle Row: Donut & Workload Card */
.dashboard-middle-row {
  display: grid;
  grid-template-columns: 4.5fr 5.5fr;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .dashboard-middle-row {
    grid-template-columns: 1fr;
  }
}

.glass-card {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--card-shadow);
  padding: 1.5rem 2rem;
}

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

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.card-header-icon {
  width: 18px;
  height: 18px;
  color: var(--text-light);
}

.flex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Donut Chart Layout */
.donut-chart-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.chart-wrapper {
  position: relative;
  width: 170px;
  height: 170px;
  flex-shrink: 0;
}

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

.donut-center-text .percentage {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}

.donut-center-text .label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 2px;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 140px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.legend-label-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.legend-item .pct {
  font-weight: 600;
  color: var(--text-main);
}

/* Workload Progress Card & List */
.btn-manage-team {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem;
  background: white;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 10px;
  color: var(--text-muted);
  font-family: var(--font-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.01);
  transition: var(--transition-smooth);
}

.btn-manage-team:hover {
  border-color: #4f46e5;
  color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
}

.workload-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.workload-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.workload-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 140px;
  font-weight: 600;
  font-size: 0.9rem;
}

.workload-user .avatar {
  font-size: 1.1rem;
  background: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0,0,0,0.04);
}

.workload-bar-wrapper {
  flex-grow: 1;
  background: rgba(0, 0, 0, 0.04);
  height: 8px;
  border-radius: 9999px;
  overflow: hidden;
  margin: 0 1.25rem;
  position: relative;
}

.workload-bar {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5 0%, #a855f7 100%);
  border-radius: 9999px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.workload-text {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 120px;
  text-align: right;
}

.workload-text strong {
  color: var(--text-main);
  font-weight: 600;
}

/* ==========================================================================
   Table Row: Global Tasks
   ========================================================================== */
.table-card {
  padding: 1.5rem 0 0; /* Let scroll container go full width on edges */
}

.table-header-flex {
  padding: 0 2rem 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  flex-wrap: wrap;
  gap: 1rem;
}

.table-filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Search Box */
.search-box {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 0.4rem 0.85rem;
  gap: 0.5rem;
  min-width: 240px;
  transition: var(--transition-smooth);
}

.search-box:focus-within {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.search-box i {
  width: 16px;
  height: 16px;
  color: var(--text-light);
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-primary);
  font-size: 0.88rem;
  color: var(--text-main);
  width: 100%;
}

/* Dropdown Filters */
.table-filters select {
  padding: 0.45rem 1rem;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  font-family: var(--font-primary);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.table-filters select:hover {
  border-color: #4f46e5;
  color: var(--text-main);
}

.table-scroll-container {
  overflow-x: auto;
  width: 100%;
  padding: 0 1rem;
}

.tasks-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.tasks-table th {
  padding: 1.15rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid rgba(0, 0, 0, 0.04);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tasks-table td {
  padding: 1.15rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  color: var(--text-main);
}

.tasks-table tbody tr {
  transition: var(--transition-smooth);
}

.tasks-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Avatar Badge Styles */
.avatar-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.65rem;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.01);
  font-size: 0.85rem;
}

.avatar-badge.mini {
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
}

.avatar-badge .avatar-icon {
  font-size: 1rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.02);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Badges for Priority */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge.priority-low { background: #f1f5f9; color: var(--priority-low); }
.badge.priority-medium { background: #fef3c7; color: var(--priority-medium); }
.badge.priority-high { background: #fee2e2; color: var(--priority-high); }

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
}

.status-badge.todo { background: var(--color-todo-bg); color: var(--color-todo); }
.status-badge.in-progress { background: var(--color-progress-bg); color: var(--color-progress); }
.status-badge.review { background: var(--color-review-bg); color: var(--color-review); }
.status-badge.done { background: var(--color-done-bg); color: var(--color-done); }
.status-badge.overdue { background: var(--color-overdue-bg); color: var(--color-overdue); }

/* Table control buttons */
.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.btn-icon:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text-main);
}

.btn-icon.delete:hover {
  background: rgba(239, 68, 68, 0.06);
  color: #ef4444;
}

/* ==========================================================================
   View 2: Member Kanban Board Layout
   ========================================================================== */
.kanban-top-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.kanban-info-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.info-label {
  font-weight: 600;
}

.kanban-board-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .kanban-board-container {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 650px) {
  .kanban-board-container {
    grid-template-columns: 1fr;
  }
}

.kanban-column {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 1.15rem;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 520px;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

.kanban-column.drag-over {
  border-color: #4f46e5;
  background: rgba(255, 255, 255, 0.65);
}

.kanban-column .column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  margin-bottom: 0.25rem;
}

.kanban-column .title-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.todo { background: var(--color-todo); }
.status-dot.in-progress { background: var(--color-progress); }
.status-dot.review { background: var(--color-review); }
.status-dot.done { background: var(--color-done); }

.kanban-column .column-header h2 {
  font-size: 1rem;
  font-weight: 700;
}

.col-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: white;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(0,0,0,0.04);
}

.column-cards {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex-grow: 1;
  min-height: 400px;
}

/* Kanban Card Styles */
.kanban-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.01);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  cursor: grab;
  transition: var(--transition-card);
  position: relative;
  overflow: hidden;
  padding-left: 1.25rem;
}

.kanban-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
  border-color: rgba(79, 70, 229, 0.15);
}

.kanban-card.dragging {
  opacity: 0.45;
  transform: scale(0.97);
}

.card-priority {
  width: 5px;
  height: 20px;
  border-radius: 2px;
  position: absolute;
  left: 0;
  top: 1rem;
}

.card-priority.low { background: var(--priority-low); }
.card-priority.medium { background: var(--priority-medium); }
.card-priority.high { background: var(--priority-high); }

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(0,0,0,0.02);
  padding-top: 0.6rem;
}

.card-date {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--text-light);
  font-weight: 500;
}

.card-date.alert-due {
  color: var(--color-overdue);
  font-weight: 600;
}

.card-date i {
  width: 12px;
  height: 12px;
}

.no-tasks-card {
  text-align: center;
  color: var(--text-light);
  font-size: 0.8rem;
  padding: 3rem 1rem;
  border: 1.5px dashed rgba(0,0,0,0.03);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.no-tasks-card i {
  width: 28px;
  height: 28px;
  stroke: rgba(0,0,0,0.1);
}

/* ==========================================================================
   Buttons Global Styles
   ========================================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  border: none;
  border-radius: 12px;
  color: white;
  font-family: var(--font-primary);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.22);
  transition: var(--transition-smooth);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.3);
  opacity: 0.95;
}

.btn-primary i {
  width: 16px;
  height: 16px;
  stroke-width: 2.5px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  background: white;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  color: var(--text-muted);
  font-family: var(--font-primary);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: rgba(0,0,0,0.12);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.12);
  border-radius: 12px;
  color: #ef4444;
  font-family: var(--font-primary);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-danger:hover {
  background: #ef4444;
  color: white;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.18);
}

/* ==========================================================================
   Modals (Dialogs) Styling & Transitions
   ========================================================================== */
dialog {
  margin: auto;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px) saturate(120%);
  -webkit-backdrop-filter: blur(24px) saturate(120%);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.12);
  padding: 0;
  width: 90%;
  max-width: 580px;
  outline: none;
  
  /* Modern top-layer transition setup */
  opacity: 0;
  transform: scale(0.95) translateY(10px);
  transition: 
    opacity 0.25s ease, 
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), 
    display 0.25s allow-discrete, 
    overlay 0.25s allow-discrete;
  transition-behavior: allow-discrete;
}

dialog[open] {
  opacity: 1;
  transform: scale(1) translateY(0);
}

@starting-style {
  dialog[open] {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
}

/* Dialog Backdrop */
dialog::backdrop {
  background-color: rgba(15, 23, 42, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: 
    display 0.25s allow-discrete, 
    overlay 0.25s allow-discrete, 
    background-color 0.25s ease, 
    backdrop-filter 0.25s ease;
}

dialog[open]::backdrop {
  background-color: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

@starting-style {
  dialog[open]::backdrop {
    background-color: rgba(15, 23, 42, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
}

/* Reduced Motion preference */
@media (prefers-reduced-motion: reduce) {
  dialog {
    transform: none !important;
    transition-duration: 0.15s !important;
  }
  @starting-style {
    dialog[open] {
      transform: none !important;
    }
  }
}

.modal-content-wrapper {
  padding: 2rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-close {
  background: rgba(0, 0, 0, 0.04);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.btn-close:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  transform: rotate(90deg);
}

/* Form Groups & Layout in Modals */
form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.required {
  color: #ef4444;
}

input[type="text"],
input[type="date"],
select,
textarea {
  padding: 0.7rem 1rem;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  font-family: var(--font-primary);
  font-size: 0.92rem;
  color: var(--text-main);
  outline: none;
  transition: var(--transition-smooth);
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

/* Textarea using field-sizing content */
textarea {
  field-sizing: content;
  min-height: 80px;
  max-height: 220px;
  resize: none;
  width: 100%;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Detail Modal Styles */
.detail-modal {
  padding: 2rem;
}

.detail-header-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-start;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

.detail-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}

.detail-section h3 i {
  width: 14px;
  height: 14px;
}

.detail-description-text {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.35);
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.02);
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  background: rgba(255, 255, 255, 0.25);
  padding: 1rem 1.25rem;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.01);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.meta-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.meta-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
}

.deadline-highlight.danger {
  color: var(--color-overdue);
  font-weight: 600;
}

.detail-actions {
  justify-content: space-between;
}

/* ==========================================================================
   Member Management Styles
   ========================================================================== */
.member-manager-body {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.members-list-container h3,
.add-member-form-box h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.85rem;
  border-bottom: 1px solid rgba(0,0,0,0.02);
  padding-bottom: 0.35rem;
}

.members-edit-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.member-edit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  background: white;
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.01);
}

.member-edit-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.member-edit-info .emoji {
  font-size: 1.15rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.02);
  display: flex;
  align-items: center;
  justify-content: center;
}

.member-edit-info .role-tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-light);
  background: rgba(0,0,0,0.03);
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
}

.member-edit-actions {
  display: flex;
  gap: 0.25rem;
}

.add-member-form-box {
  background: rgba(255, 255, 255, 0.35);
  border: 1px dashed rgba(0, 0, 0, 0.05);
  padding: 1.15rem;
  border-radius: 16px;
}

.add-member-form-box form {
  gap: 0.85rem;
}

/* ==========================================================================
   Mobile Responsive Adjustments (@media Queries)
   ========================================================================== */

/* Tablet & Mobile Screens (< 768px) */
@media (max-width: 768px) {
  body {
    padding: 1rem;
  }

  .app-window {
    padding: 1.25rem;
    border-radius: 24px;
    gap: 1.75rem;
    min-height: auto;
  }

  /* Stack Navbar */
  .navbar {
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
    padding-bottom: 1.25rem;
  }

  .navbar-left {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }

  .navbar-center {
    width: 100%;
    order: 3; /* Push segmented controls to the bottom of header */
    display: flex;
    justify-content: center;
  }

  .segmented-control {
    width: 100%;
  }

  .control-btn {
    flex: 1;
    text-align: center;
    padding: 0.55rem 0.5rem;
    font-size: 0.88rem;
  }

  .navbar-right {
    width: 100%;
    order: 2;
  }

  .profile-switcher {
    width: 100%;
    justify-content: space-between;
    padding: 0.45rem 1rem;
  }

  .profile-dropdown {
    width: 100%; /* Dropdown covers full width on mobile switcher */
  }

  /* Hero Section Stacking */
  .hero-section {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .hero-left h1 {
    font-size: 1.45rem;
  }

  .hero-left p {
    font-size: 0.88rem;
  }

  /* Stats Grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .stat-card {
    padding: 0.95rem;
    border-radius: 16px;
    gap: 0.75rem;
  }

  .stat-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .stat-icon-box i {
    width: 18px;
    height: 18px;
  }

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

  .stat-label {
    font-size: 0.78rem;
  }

  .stat-desc {
    font-size: 0.65rem;
  }

  /* Middle row grid collapse */
  .dashboard-middle-row {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .glass-card {
    padding: 1.25rem 1.5rem;
    border-radius: 20px;
  }

  /* Table Filters stacking */
  .table-header-flex {
    padding: 0 1.25rem 1.15rem;
  }

  .table-filters {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.65rem;
  }

  .search-box {
    min-width: 100%;
  }

  .table-filters select {
    width: 100%;
  }

  /* Swipeable Kanban Board (UX Breakthrough on Mobile) */
  .kanban-board-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 1rem;
    padding: 0.25rem 0.25rem 1.25rem;
    width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .kanban-column {
    flex: 0 0 85%;
    scroll-snap-align: center;
    min-height: 480px;
    padding: 1rem;
  }

  /* Add swiping visual cue */
  .kanban-top-actions::after {
    content: "← เลื่อนซ้าย-ขวาเพื่อดูบอร์ดแต่ละช่อง →";
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
    text-align: center;
    width: 100%;
    order: 3;
    margin-top: 0.5rem;
  }

  .kanban-top-actions {
    flex-wrap: wrap;
  }

  .btn-primary {
    padding: 0.6rem 1.15rem;
    font-size: 0.88rem;
  }
}

/* Small Mobile Screens (< 520px) */
@media (max-width: 520px) {
  /* Stack stats grid into 1 column on tiny screens */
  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* Donut chart layout stack */
  .donut-chart-section {
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
  }

  .donut-legend {
    width: 100%;
  }

  /* Stack workload rows vertically for clean progress visual */
  .workload-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.25);
    padding: 0.85rem;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.01);
  }

  .workload-user {
    width: 100%;
  }

  .workload-bar-wrapper {
    width: 100%;
    margin: 0.25rem 0;
  }

  .workload-text {
    width: 100%;
    text-align: left;
    font-size: 0.78rem;
  }

  /* Modals padding and sizes */
  .modal-content-wrapper {
    padding: 1.25rem;
  }

  .modal-header {
    margin-bottom: 1.15rem;
  }

  form {
    gap: 0.95rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .modal-actions {
    margin-top: 1.15rem;
    padding-top: 0.95rem;
  }
}

