/* ==========================================================================
   Pre-Construction Task & Kanban System - Design System & Stylesheet
   ========================================================================== */

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

:root {
  /* Color Palette - Modern Corporate Tech */
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-header: rgba(15, 23, 42, 0.85);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  
  --border-color: #334155;
  --border-highlight: #475569;
  
  /* Primary & Accent Colors */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;
  
  /* 7 Workflow Stage Colors (ตรวจงาน Clearing removed) */
  --stage-1: #f43f5e; /* ยังไม่ส่งมอบ */
  --stage-2: #06b6d4; /* รับมอบพื้นที่ */
  --stage-3: #3b82f6; /* นัดผู้รับเหมาเข้าสำรวจ */
  --stage-4: #8b5cf6; /* ผู้รับเหมานำเสนอราคา */
  --stage-5: #f59e0b; /* เข้า Clearing */
  --stage-6: #14b8a6; /* เก็บค่าระดับพื้นที่ */
  --stage-7: #10b981; /* จบ */
  
  /* Shadows & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.35);
  
  --font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables Overrides */
[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-header: rgba(255, 255, 255, 0.9);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --border-color: #e2e8f0;
  --border-highlight: #cbd5e1;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-highlight);
}

/* Application Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header Navbar */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo-img {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--border-highlight);
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--accent-cyan);
  font-weight: 500;
}

/* User & Role Switcher Bar */
.role-switcher-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.role-switcher-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.user-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.user-badge-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.user-badge-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(99, 102, 241, 0.4);
  font-weight: 600;
}

.user-avatar-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Right Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Navigation Tabs */
.view-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-card);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.tab-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
}

.btn-admin {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}
.btn-admin:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}
.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.btn-icon:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1800px;
  width: 100%;
  margin: 0 auto;
}

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

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

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

/* Section Titles */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title-group h2 {
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-title-group p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* KPI Summary Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--kpi-accent, var(--primary));
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

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

.kpi-icon-wrapper {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--kpi-accent, var(--primary));
}

.kpi-value-main {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.kpi-ratio-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

.kpi-progress-track {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
}

.kpi-progress-fill {
  height: 100%;
  background: var(--kpi-accent, var(--primary));
  transition: width 0.5s ease-out;
}

.kpi-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.kpi-pending-branches-list {
  font-size: 0.75rem;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.1);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-top: 0.35rem;
  line-height: 1.3;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.badge-info { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.badge-danger { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.badge-primary { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }

/* Manager Dashboard Widgets Grid Ratio: 2/3 (Pending Branches) and 1/3 (Stage Summary) */
.dashboard-widgets-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

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

.widget-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.widget-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Pending Branches Report Widget (Oldest First) */
.pending-branches-list-widget {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 420px;
  overflow-y: auto;
}

.pending-branch-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem;
  background: var(--bg-main);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 0.5rem;
}

.pending-branch-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.pending-tags-group {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.elapsed-days-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.12);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* Stage Breakdown Chart Mini */
.stage-summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.stage-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.7rem;
  background: var(--bg-main);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  border: 1px solid var(--border-color);
}

.stage-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.stage-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Master Data Table */
.data-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-controls {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.search-filter-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 1;
}

.input-search, .select-filter {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
}

.input-search:focus, .select-filter:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-search {
  min-width: 220px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.custom-table th {
  background: var(--bg-main);
  padding: 0.85rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.custom-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.custom-table tr:last-child td {
  border-bottom: none;
}

.custom-table tr:hover td {
  background: var(--bg-card-hover);
}

/* KANBAN BOARD VIEW STYLING */
.kanban-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--bg-card);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.kanban-board-container {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  min-height: calc(100vh - 240px);
  align-items: flex-start;
}

.kanban-column {
  flex: 0 0 310px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 230px);
}

.kanban-column-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 10;
}

.column-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
}

.column-color-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.column-count-badge {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.kanban-cards-wrapper {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  flex: 1;
  min-height: 150px;
}

.kanban-cards-wrapper.drag-over {
  background: var(--primary-light);
  border-radius: var(--radius-md);
}

/* Kanban Card Component */
.kanban-card {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.95rem;
  cursor: grab;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
}

.kanban-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.kanban-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.card-branch-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.card-code {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: monospace;
}

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

/* Progress bar inside card */
.card-progress-section {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.card-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.card-progress-bar {
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.card-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Checklist Badges Row */
.card-checklist-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mini-check-badge {
  font-size: 0.68rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.mini-check-badge.checked {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.3);
}

/* Card Footer Row */
.card-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.2rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
}

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

.assignee-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-due-date {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.card-actions-quick {
  display: flex;
  gap: 0.25rem;
}

.quick-move-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.quick-move-btn:hover {
  color: var(--text-main);
  border-color: var(--primary);
  background: var(--primary-light);
}

/* MODAL WINDOW STYLING */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-backdrop.active .modal-card {
  transform: scale(1);
}

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

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

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

.form-control {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

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

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.checkbox-group-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--bg-main);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   EXECUTIVE 1-PAGE A4 PRINT STYLESHEET (LANDSCAPE)
   ========================================================================== */
@media print {
  @page {
    size: A4 landscape;
    margin: 6mm 8mm;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 9.5pt !important;
  }

  /* Hide Non-Printable Elements AND Hide Master Data Table for 1-Page A4 fit */
  .header,
  .view-tabs,
  .header-actions,
  .role-switcher-container,
  .table-controls,
  .btn,
  .quick-move-btn,
  .modal-backdrop,
  .toast-container,
  #view-kanban,
  .search-filter-group,
  .data-table-container {
    display: none !important;
  }

  #view-manager {
    display: block !important;
  }

  .main-content {
    padding: 0 !important;
    max-width: 100% !important;
  }

  .section-header h2 {
    font-size: 15pt !important;
    color: #000000 !important;
  }

  .section-header p {
    font-size: 9pt !important;
    color: #444444 !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 8pt !important;
    margin-bottom: 12pt !important;
  }

  .kpi-card {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    padding: 8pt !important;
    border-radius: 6px !important;
    box-shadow: none !important;
  }

  .kpi-title {
    font-size: 8.5pt !important;
    color: #333333 !important;
  }

  .kpi-value-main {
    font-size: 15pt !important;
    color: #000000 !important;
    margin-bottom: 2pt !important;
  }

  .dashboard-widgets-grid {
    grid-template-columns: 2fr 1fr !important;
    gap: 12pt !important;
    margin-bottom: 10pt !important;
  }

  .widget-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    padding: 10pt !important;
    border-radius: 6px !important;
  }

  .widget-title {
    font-size: 10pt !important;
    color: #000000 !important;
    margin-bottom: 6pt !important;
  }

  .badge-tag {
    border: 1px solid #cbd5e1 !important;
    color: #000000 !important;
    font-size: 7.5pt !important;
    padding: 1pt 4pt !important;
  }
}

/* Responsive Rules */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .role-switcher-container {
    overflow-x: auto;
  }
  
  .form-row-2, .form-row-3 {
    grid-template-columns: 1fr;
  }
  
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}
