/* Premium Glassmorphic stylesheet with Neon Highlights and Dark/Light Mode support */

:root {
  /* Common Accent Colors */
  --neon-cyan: #06b6d4;
  --neon-purple: #8b5cf6;
  --neon-pink: #ec4899;
  --neon-amber: #eab308;
  --neon-green: #22c55e;
  --neon-red: #ef4444;
  
  --font-display: 'Outfit', 'Sarabun', sans-serif;
  --sidebar-width: 280px;
  --transition-speed: 0.3s;

  /* Theme Specific (Dark Theme Default) */
  --bg-gradient: linear-gradient(135deg, #090d16 0%, #111827 100%);
  --panel-bg: rgba(17, 24, 39, 0.55);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-border-focus: rgba(6, 182, 212, 0.3);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-inverse: #0f172a;
  
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  --glow-cyan: 0 0 15px rgba(6, 182, 212, 0.35);
  --glow-purple: 0 0 15px rgba(139, 92, 246, 0.3);
  --glow-red: 0 0 15px rgba(239, 68, 68, 0.4);
  --glow-amber: 0 0 12px rgba(234, 179, 8, 0.3);
  --glow-green: 0 0 12px rgba(34, 197, 94, 0.3);
  
  --input-bg: rgba(17, 24, 39, 0.7);
  --table-header-bg: rgba(15, 23, 42, 0.6);
  --table-row-hover: rgba(255, 255, 255, 0.03);
  
  --scrollbar-track: #0f172a;
  --scrollbar-thumb: rgba(255, 255, 255, 0.15);
}

/* Light Theme Overrides */
body.light-theme {
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  --panel-bg: rgba(255, 255, 255, 0.7);
  --panel-border: rgba(99, 102, 241, 0.12);
  --panel-border-focus: rgba(99, 102, 241, 0.4);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-inverse: #ffffff;
  
  --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.06);
  --glow-cyan: 0 0 15px rgba(6, 182, 212, 0.2);
  --glow-purple: 0 0 15px rgba(139, 92, 246, 0.2);
  --glow-red: 0 0 15px rgba(239, 68, 68, 0.25);
  --glow-amber: 0 0 12px rgba(234, 179, 8, 0.2);
  --glow-green: 0 0 12px rgba(34, 197, 94, 0.2);
  
  --input-bg: rgba(255, 255, 255, 0.9);
  --table-header-bg: rgba(226, 232, 240, 0.8);
  --table-row-hover: rgba(99, 102, 241, 0.04);
  
  --scrollbar-track: #f1f5f9;
  --scrollbar-thumb: rgba(99, 102, 241, 0.2);
}

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

body {
  font-family: var(--font-display);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition-speed), color var(--transition-speed);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Offline Connection Banner */
.connection-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(90deg, #b91c1c 0%, #ef4444 100%);
  color: white;
  text-align: center;
  padding: 8px 16px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  animation: slideDown 0.4s ease-out;
}
.connection-banner.hidden {
  display: none !important;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

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

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  padding: 24px;
  position: fixed;
  height: 100vh;
  z-index: 99;
  box-shadow: var(--card-shadow);
  transition: background var(--transition-speed), border-color var(--transition-speed);
}

.sidebar-header {
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: white;
  padding: 2px;
  object-fit: contain;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.15);
}

.logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1.5px;
  background: linear-gradient(90deg, #06b6d4, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Connection indicator badge */
.network-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 20px;
  width: fit-content;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

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

.network-badge.online .badge-dot {
  background: var(--neon-green);
  box-shadow: var(--glow-green);
  animation: pulseGreen 1.5s infinite;
}

.network-badge.offline {
  border-color: rgba(239, 68, 68, 0.3);
}
.network-badge.offline .badge-dot {
  background: var(--neon-red);
  box-shadow: var(--glow-red);
  animation: pulseRed 1.5s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}
@keyframes pulseRed {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-grow: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all 0.25s ease;
}

.menu-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
  transform: translateX(4px);
}

.menu-item.active {
  color: var(--neon-cyan);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.15);
  box-shadow: inset 0 0 10px rgba(6, 182, 212, 0.03);
  font-weight: 600;
}

body.light-theme .menu-item.active {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.18);
  color: #6366f1;
}

.sidebar-footer {
  margin-top: auto;
}

.theme-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  padding: 12px;
  border-radius: 12px;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.theme-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.02);
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 40px;
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
}

/* Views Section Control */
.view-section {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.view-section.active {
  display: block;
}

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

/* View Header */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 16px;
}

.view-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(90deg, #06b6d4, #0891b2);
  color: white;
}
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: var(--glow-cyan);
}

.btn-success {
  background: linear-gradient(90deg, #22c55e, #16a34a);
  color: white;
}
.btn-success:hover {
  filter: brightness(1.1);
  box-shadow: var(--glow-green);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--panel-border);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--panel-border);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--text-muted);
}

.btn-neon-cyan:hover {
  box-shadow: var(--glow-cyan);
  border-color: var(--neon-cyan);
}

/* Glass Panels */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: border-color var(--transition-speed), background var(--transition-speed);
}

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

.stat-card {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--panel-border-focus);
  box-shadow: 0 12px 24px rgba(0,0,0,0.25);
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--neon-cyan);
  opacity: 0.6;
}

.stat-card:nth-child(2)::after { background: var(--neon-amber); }
.stat-card:nth-child(3)::after { background: var(--neon-cyan); }
.stat-card:nth-child(4)::after { background: var(--neon-green); }

.stat-header {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  margin: 10px 0;
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.5px;
}

.stat-footer {
  font-size: 11px;
  color: var(--text-muted);
}

.text-amber { color: var(--neon-amber) !important; text-shadow: 0 0 8px rgba(234, 179, 8, 0.2); }
.text-cyan { color: var(--neon-cyan) !important; text-shadow: 0 0 8px rgba(6, 182, 212, 0.2); }
.text-green { color: var(--neon-green) !important; text-shadow: 0 0 8px rgba(34, 197, 94, 0.2); }

/* Progress cards */
.progress-section-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 992px) {
  .progress-section-grid {
    grid-template-columns: 1fr;
  }
}

.progress-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 15px;
}

.progress-card h3, .rings-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.progress-bar-container {
  height: 20px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), #3b82f6);
  box-shadow: var(--glow-cyan);
  border-radius: 10px;
  transition: width 0.8s cubic-bezier(0.1, 0.8, 0.25, 1);
}

.progress-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
}

/* Department rings */
.rings-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 20px;
  padding: 10px 0;
}

.ring-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(0, 0, 0, 0.2);
  stroke-width: 8;
}

.ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.1, 0.8, 0.25, 1);
}

.ring-prod-color {
  stroke: var(--neon-cyan);
  filter: drop-shadow(0 0 5px rgba(6, 182, 212, 0.4));
}

.ring-lab-color {
  stroke: var(--neon-purple);
  filter: drop-shadow(0 0 5px rgba(139, 92, 246, 0.4));
}

.ring-info {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.ring-percent {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}

.ring-label {
  font-size: 8px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

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

.chart-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
}

.chart-container h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Operational grid (Deadlines & Operators) */
.operational-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

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

.scrollable-panel {
  max-height: 350px;
  overflow-y: auto;
}

.scrollable-panel h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  background: var(--panel-bg);
  padding-bottom: 10px;
  z-index: 1;
}

.warning-border {
  border-color: rgba(239, 68, 68, 0.15) !important;
}

.alert-list, .operator-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

/* Overdue Warning Alert Card */
.alert-card {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: all 0.25s ease;
}

.alert-card:hover {
  background: rgba(239, 68, 68, 0.08);
  transform: translateX(2px);
}

.alert-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alert-title {
  font-weight: 600;
  font-size: 14px;
}

.alert-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.alert-badge {
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  text-transform: uppercase;
}

.alert-badge.overdue {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  animation: pulseRedGlow 1.5s infinite;
}

.alert-badge.warning {
  background: rgba(234, 179, 8, 0.2);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

@keyframes pulseRedGlow {
  0% { box-shadow: 0 0 0px rgba(239, 68, 68, 0); }
  50% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }
  100% { box-shadow: 0 0 0px rgba(239, 68, 68, 0); }
}

/* Team Operator list styling */
.operator-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.operator-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.operator-name {
  font-weight: 600;
  font-size: 14px;
}

.operator-task {
  font-size: 12px;
  color: var(--text-muted);
}

.operator-stats {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.operator-done-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--neon-green);
}

.operator-done-lbl {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Master Table Panel */
.table-panel {
  margin-top: 24px;
  overflow: hidden;
}

.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.table-header-row h3 {
  font-size: 16px;
  font-weight: 600;
}

.table-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Form Fields */
.form-input {
  background: var(--input-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  font-family: var(--font-display);
  transition: all 0.25s ease;
}

.form-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.2);
}

#search-task {
  width: 200px;
}

/* Master Table Design */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.master-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.master-table th {
  background: var(--table-header-bg);
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--panel-border);
}

.master-table td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--panel-border);
  color: var(--text-main);
  transition: background 0.2s ease;
}

.master-table tbody tr:hover td {
  background: var(--table-row-hover);
}

/* Badges */
.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-low {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.badge-medium {
  background: rgba(234, 179, 8, 0.15);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.25);
}
.badge-high {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-todo {
  background: rgba(234, 179, 8, 0.1);
  color: var(--neon-amber);
}
.badge-progress {
  background: rgba(6, 182, 212, 0.1);
  color: var(--neon-cyan);
}
.badge-done {
  background: rgba(34, 197, 94, 0.1);
  color: var(--neon-green);
}

.badge-prod {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.25);
}
.badge-lab {
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.25);
}
.badge-lab-type {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.25);
}

/* Planning View Form Panel */
.form-panel {
  max-width: 800px;
  margin: 0 auto;
}

.form-row {
  margin-bottom: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

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

@media (max-width: 768px) {
  .grid-3, .grid-2 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

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

.col-12 {
  width: 100%;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.required {
  color: var(--neon-red);
}

.form-help {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 30px;
  border-top: 1px solid var(--panel-border);
  padding-top: 20px;
}

/* Kanban Boards */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  min-height: calc(100vh - 180px);
}

@media (max-width: 992px) {
  .kanban-board {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

.kanban-column {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  padding: 16px;
  max-height: calc(100vh - 150px);
}

@media (max-width: 992px) {
  .kanban-column {
    max-height: 500px;
  }
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 16px;
}

.column-title {
  font-weight: 700;
  font-size: 15px;
}

.column-count {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

.column-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 2px;
}

/* Task Cards */
.task-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  position: relative;
  transition: all 0.25s ease;
}

.task-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--panel-border-focus);
}

.task-card.deadline-warning {
  border-color: rgba(239, 68, 68, 0.25);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.05);
}

.task-card.deadline-warning::before {
  content: "⏳ เกินกำหนด";
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--neon-red);
  font-size: 9px;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.card-tags {
  display: flex;
  gap: 6px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-main);
  padding-right: 50px; /* clear warning badge */
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.card-assignee {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.card-date {
  font-weight: 400;
}

/* Quick Action Workflow Buttons */
.card-actions {
  display: flex;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 10px;
  margin-top: 4px;
}

.btn-card {
  flex: 1;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: white;
}

.btn-card-start {
  background: rgba(6, 182, 212, 0.15);
  color: var(--neon-cyan);
  border-color: rgba(6, 182, 212, 0.25);
}
.btn-card-start:hover {
  background: var(--neon-cyan);
  color: var(--text-inverse);
  box-shadow: var(--glow-cyan);
}

.btn-card-done {
  background: rgba(34, 197, 94, 0.15);
  color: var(--neon-green);
  border-color: rgba(34, 197, 94, 0.25);
}
.btn-card-done:hover {
  background: var(--neon-green);
  color: var(--text-inverse);
  box-shadow: var(--glow-green);
}

.btn-card-pause {
  background: rgba(234, 179, 8, 0.15);
  color: var(--neon-amber);
  border-color: rgba(234, 179, 8, 0.25);
}
.btn-card-pause:hover {
  background: var(--neon-amber);
  color: var(--text-inverse);
  box-shadow: var(--glow-amber);
}

.btn-card-reject {
  background: rgba(239, 68, 68, 0.15);
  color: var(--neon-red);
  border-color: rgba(239, 68, 68, 0.25);
}
.btn-card-reject:hover {
  background: var(--neon-red);
  color: var(--text-inverse);
  box-shadow: var(--glow-red);
}

.btn-card-forward {
  background: rgba(6, 182, 212, 0.15);
  color: var(--neon-cyan);
  border-color: rgba(6, 182, 212, 0.25);
}
.btn-card-forward:hover {
  background: var(--neon-cyan);
  color: var(--text-inverse);
  box-shadow: var(--glow-cyan);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(7, 10, 19, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 90%;
  max-width: 500px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-backdrop.show .modal-content {
  transform: scale(1);
}

.task-detail-modal {
  max-width: 650px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.modal-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 90%;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s ease;
}

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

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--panel-border);
  padding-top: 20px;
  margin-top: 20px;
}

/* Detail Modal Specifics */
.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  font-size: 13px;
  background: rgba(0,0,0,0.15);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
}

.detail-desc-box {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
}

.detail-desc-box p {
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}

.priority-badge {
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 700;
  border-radius: 4px;
  text-transform: uppercase;
}

/* Comments Section in Detail Modal */
.comments-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--panel-border);
  padding-top: 16px;
}

.comments-section h3 {
  font-size: 14px;
  font-weight: 600;
}

.comments-timeline {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.comment-bubble {
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comment-bubble.is-completion {
  border-color: rgba(34, 197, 94, 0.25);
  background: rgba(34, 197, 94, 0.02);
}

.comment-bubble.is-completion .comment-text {
  color: var(--neon-green);
  font-weight: 500;
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
}

.comment-sender {
  color: var(--neon-cyan);
}

.comment-text {
  line-height: 1.4;
}

.add-comment-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.width-30 { width: 30%; }
.width-60 { width: 60%; flex-grow: 1; }

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
    padding: 16px;
  }

  .sidebar-header {
    margin-bottom: 16px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .sidebar-menu {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .menu-item {
    flex: 1 1 calc(50% - 8px);
    padding: 10px 12px;
    font-size: 13px;
    justify-content: center;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 20px;
  }
  
  #search-task {
    width: 100%;
  }
}

/* Planning View Split Layout */
.planning-container {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 992px) {
  .planning-container {
    grid-template-columns: 1fr;
  }
}

.planned-list-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 580px;
}

.planned-list-panel h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

.planned-tasks-scroll {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
  padding-right: 4px;
}

.planned-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}

.planned-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--panel-border-focus);
}

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

.planned-card-body {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.planned-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 8px;
}

.btn-small {
  padding: 6px 12px !important;
  font-size: 11px !important;
  border-radius: 6px !important;
}

/* Light Theme Modal Overrides */
body.light-theme .modal-content {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1) !important;
}

body.light-theme .detail-meta-grid {
  background: rgba(0, 0, 0, 0.03) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .detail-desc-box {
  background: rgba(0, 0, 0, 0.01) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .comment-bubble {
  background: rgba(0, 0, 0, 0.03) !important;
  border-color: rgba(0, 0, 0, 0.06) !important;
}

body.light-theme .comment-bubble.is-completion {
  background: rgba(34, 197, 94, 0.06) !important;
  border-color: rgba(34, 197, 94, 0.2) !important;
}
