/* =====================================================
   executiveHome.css v6 - Sales Table Modal + Comment Popup
   ธีม: Clean White + Green Accent
   รองรับ role: admin / executive / manager / user
   ===================================================== */

/* ── VARIABLES ── */
:root {
  --primary:      #f8fafc;
  --surface:      #ffffff;
  --surface2:     #f1f5f9;
  --surface3:     #e2e8f0;
  --accent:       #10b981;
  --accent-light: #d1fae5;
  --accent-dark:  #059669;
  --accent2:      #f59e0b;
  --accent2-light:#fef3c7;
  --accent3:      #ef4444;
  --blue:         #3b82f6;
  --blue-dark:    #0447b4;
  --blue-light:   #8dbffc;
  --blue-light1:  #aed7fd;
  --cyan-light:   #e7e7e7;
  --purple:       #8b5cf6;
  --text:         #111827;
  --text-muted:   #6b7280;
  --text-light:   #9ca3af;
  --text-med:     #5493ff;
  --border:       #e5e7eb;
  --border-accent: rgba(16,185,129,0.25);
  --shadow:       0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 24px rgba(0,0,0,0.1);
  --shadow-xl:    0 20px 60px rgba(0,0,0,0.18);
  --radius:       12px;
  --radius-sm:    8px;
  --transition:   0.15s ease;
  --unread-bg:    #f7f6b9;
  --unread-border: #f59e0b;
  --danger:       #ef4444;
  --info:         #0093ad;

  --line-radius:    #10c98b;


  
  /* Executive — ม่วง */
  --executive: #7c3aed;
  --executive-hover: #6d28d9;
  --executive-soft: #f3e8ff;
  --executive-border: #ddd6fe;
  --executive-text: #4c1d95;


   /* Alias for legacy references */
  --brand:          var(--manager);
  --brand-hover:    var(--manager-hover);
  --brand-soft:     var(--manager-soft);
  --brand-soft-2:   #dbeafe;
  --brand-light:    #93c5fd;
  --brand-strong:   var(--manager-text);

  /* ---- Sidebar gradient ---- */
  --ea-side-bg:     #0c87c9;
  --ea-side-bg-2:   #0ea5e9;
  --ea-side-hover:  rgba(255, 255, 255, 0.14);
  --ea-side-active: #0284c7;
  --ea-side-text:   #cffafe;

  /* ---- Surfaces ---- */
  --page-bg:        #f1f5f9;
  --surface:        #ffffff;
  --surface-soft:   #f8fafc;
  --surface-muted:  #f1f5f9;

  /* ---- Ink / text ---- */
  --ink:            #0f172a;
  --ink-1:          #1c1917;
  --ink-2:          #334155;
  --muted:          #64748b;
  --muted-strong:   #475569;
  --muted-soft:     #94a3b8;

  /* ---- Lines ---- */
  --line:           #e5e7eb;
  --line-soft:      #f1f5f9;
  --line-strong:    #cbd5e1;

  /* ---- Semantic ---- */
  --success:        #10b981;
  --success-text:   #047857;
  --info:           #3b82f6;
  --info-text:      #1e40af;
  --info-bg:        #dbeafe;
  --warning:        #f59e0b;
  --warning-text:   #78350f;
  --warning-bg:     #fef3c7;
  --danger:         #ef4444;
  --danger-text:    #b91c1c;
  --danger-bg:      #fee2e2;

  /* ---- Radii ---- */
  --r-sm:    8px;
  --r-md:    12px;
  --r-lg:    16px;
  --r-xl:    20px;
  --r-full:  999px;

  /* ---- Shadows ---- */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(15, 23, 42, 0.06);

  /* ---- Motion ---- */
  --t-fast: 150ms;
  --t-base: 200ms;
  --ease:   cubic-bezier(0.16, 1, 0.3, 1);


}



/* ===================================================
   MATERIAL ICONS - Base Setup
=================================================== */
.material-symbols-outlined {
  font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
  font-size: 20px;
  line-height: 1;
  color: var(--blue-dark);
  user-select: none;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-primary  { color: var(--primary); }
.icon-blue     { color: #0447b4; }
.icon-blue-dark{ color: #0093ad; }
.icon-green    { color: var(--accent); }
.icon-red      { color: var(--danger); }
.icon-orange   { color: #f59e0b; }
.icon-yellow   { color: #eab308; }
.icon-purple   { color: #a855f7; }
.icon-brown    { color: #92400e; }
.icon-cyan     { color: var(--info); }
.icon-white    { color: #ffffff; }
.icon-muted    { color: var(--text-muted); }

.icon-sm { font-size: 16px; }
.icon-md { font-size: 20px; }
.icon-lg { font-size: 24px; }
.icon-xl { font-size: 32px; }

.icon-filled {
  font-variation-settings: 'FILL' 1, 'wght' 500;
}

.emoji-status {
  font-size: 16px;
  line-height: 1;
}


/* =====================================================
   2. RESET & BASE
   ===================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Kanit", sans-serif;
  background: var(--primary);
  color: var(--text-muted);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* =====================================================
   3. MATERIAL ICONS
   ===================================================== */
.material-symbols-outlined {
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24;
  font-size: 20px;
  line-height: 1 !important;
  color: var(--blue-dark);
  user-select: none;
  flex-shrink: 0;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  vertical-align: middle;
}

.icon-primary  { color: var(--primary); }
.icon-blue     { color: #0447b4; }
.icon-blue-dark{ color: #0093ad; }
.icon-green    { color: var(--accent); }
.icon-red      { color: var(--danger); }
.icon-orange   { color: #f59e0b; }
.icon-yellow   { color: #eab308; }
.icon-purple   { color: #a855f7; }
.icon-brown    { color: #92400e; }
.icon-cyan     { color: var(--info); }
.icon-white    { color: #ffffff; }
.icon-muted    { color: var(--text-muted); }

.icon-sm { font-size: 16px; }
.icon-md { font-size: 20px; }
.icon-lg { font-size: 24px; }
.icon-xl { font-size: 32px; }

.icon-filled {
  font-variation-settings: "FILL" 1, "wght" 500;
}

.emoji-status {
  font-size: 16px;
  line-height: 1;
}

/* =====================================================
   4. APP LAYOUT
   ===================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  margin-left: 64px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =====================================================
   5. SIDEBAR
   ===================================================== */
.app-sidebar {
  width: 64px;
  min-height: 100vh;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 400;
  background: linear-gradient(180deg, var(--executive) 0%, var(--executive-hover) 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  box-shadow: 2px 0 14px rgba(7, 89, 133, 0.24);
  transition: width var(--t-base) var(--ease);
  overflow: visible;
}

.app-sidebar.collapsed { width: 64px; }
.app-sidebar.expanded  { width: 220px; }

/* ── SIDEBAR LOGO ── */
.sidebar-logo {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
  overflow: hidden;
  box-sizing: border-box;
  position: relative;              /* ✅ เพิ่ม */
  transition: padding var(--t-base) var(--ease),
              gap var(--t-base) var(--ease);
}

/* ✅ เพิ่มเส้นใต้ logo (เฉพาะตอน expanded) */
.app-sidebar.expanded .sidebar-logo::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);        /* เว้นซ้าย-ขวาด้านละ 16px */
  height: 1px;
  background: rgba(255, 255, 255, 0.25);
}

.app-sidebar.collapsed .sidebar-logo {
  height: 80px;
  padding: 18px 0 0 0;
  gap: 0;
}

.app-sidebar.expanded .sidebar-logo {
  height: auto;
  padding: 20px 12px 16px;
  gap: 10px;
}

.sidebar-logo-circle {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-logo-circle img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.sidebar-logo-circle span {
  font-size: 20px;
  font-weight: 800;
  color: #f97316;
}

/* ── BRAND TEXT (2 บรรทัด) ── */
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.15;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.sidebar-brand-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-brand-sub {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.4px;
  margin-top: 2px;
  white-space: nowrap;
}

.app-sidebar.collapsed .sidebar-brand-text {
  display: none;
}

.app-sidebar.expanded .sidebar-brand-text {
  display: flex;
}

/* ── SIDEBAR NAV ── */
.sidebar-nav {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 8px 0;
  position: relative;
  z-index: 50;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav-item {
  width: 100%;
  height: 48px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  position: relative;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.85);
  overflow: hidden;
  transition: color var(--t-fast), background var(--t-fast);
}

.sidebar-nav-item:hover,
.sidebar-nav-item.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: #ffffff;
  border-radius: 0 3px 3px 0;
}

.nav-icon-wrap {
  width: 64px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-nav-item .material-symbols-outlined {
  font-size: 22px !important;
  color: inherit !important;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.sidebar-nav-item.active .material-symbols-outlined {
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

.sidebar-nav-item .nav-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  transition: opacity var(--t-fast) var(--ease),
              max-width var(--t-base) var(--ease),
              padding var(--t-base) var(--ease);
}

.app-sidebar.collapsed .sidebar-nav-item .nav-label {
  opacity: 0;
  max-width: 0;
  padding: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-sidebar.expanded .sidebar-nav-item .nav-label {
  opacity: 1;
  max-width: 240px;
  padding-right: 12px;
  visibility: visible;
}

/* ── SIDEBAR DIVIDER ── */
.sidebar-divider {
  width: calc(100% - 18px);
  height: 1px;
  margin: 4px 9px;
  background: rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

/* ── SIDEBAR LOGOUT ── */
.sidebar-logout {
  width: 100%;
  height: 48px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  margin-bottom: 8px;
  border: none;
  background: transparent;
  font-family: "Kanit", sans-serif;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  transition: color var(--t-fast), background var(--t-fast);
}

.sidebar-logout:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-logout .material-symbols-outlined {
  width: 64px;
  font-size: 20px !important;
  color: inherit !important;
  flex-shrink: 0;
}

.sidebar-logout .nav-label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  transition: opacity var(--t-fast) var(--ease),
              max-width var(--t-base) var(--ease);
}

.app-sidebar.collapsed .sidebar-logout .nav-label {
  opacity: 0;
  max-width: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-sidebar.expanded .sidebar-logout .nav-label {
  opacity: 1;
  max-width: 160px;
  padding-right: 12px;
  visibility: visible;
}

/* ── COLLAPSE TOGGLE BUTTON ── */
.sidebar-collapse-btn {
  position: absolute;
  right: -16px;
  top: 76px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: linear-gradient(180deg, var(--executive) 0%, var(--executive-hover) 100%);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
  transition: transform var(--transition), background var(--transition);
  z-index: 550;


  /* position: absolute;
  top: 76px;
  right: -11px;
  width: 30px;
  height: 30px;
  background: linear-gradient(180deg, var(--executive) 0%, var(--executive-hover) 100%);
  border: 1.5px solid #ffffff;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  box-shadow: 0 4px 12px rgba(7, 89, 133, 0.25),
              0 2px 4px rgba(0, 0, 0, 0.08);
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  z-index: 500; */
}

.sidebar-collapse-btn:hover {
  transform: scale(1.08);
   background: linear-gradient(180deg, var(--executive) 0%, var(--executive-hover) 100%);
  box-shadow: 0 6px 16px rgba(7, 89, 133, 0.45);
}

.sidebar-collapse-btn:active {
  transform: scale(0.96);
}

.sidebar-collapse-btn .material-symbols-outlined {
  font-size: 18px !important;
  color: var(--info-bg) !important;
  font-variation-settings: "FILL" 0, "wght" 600, "GRAD" 0, "opsz" 24;
  transition: transform var(--t-base) var(--ease);
}

.app-sidebar.collapsed .sidebar-collapse-btn .material-symbols-outlined {
  transform: rotate(0deg);
}

.app-sidebar.expanded .sidebar-collapse-btn .material-symbols-outlined {
  transform: rotate(180deg);
}

/* ── TOOLTIP ตอน collapsed ── */
.app-sidebar.collapsed .sidebar-nav-item[title]:hover::after,
.app-sidebar.collapsed .sidebar-logout[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 600;
  font-family: "Kanit", sans-serif;
}

/* =====================================================
   6. TOP HEADER
   ===================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  padding: 0 24px;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 16px;+
  backdrop-filter: blur(10px);
}

.header-left {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.header-system-name {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}

.header-system-name .header-icon {
  width: 32px;
  height: 32px;
  background: var(--executive-soft);
  border: 1px solid var(--executive-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-system-name .header-icon .material-symbols-outlined {
  font-size: 18px !important;
  color: var(--executive) !important;
}

.header-subtitle {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
  padding-left: 40px;
  line-height: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-date-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--executive-soft);
  border: 1px solid var(--executive-border);
  color: var(--executive-text);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.header-date-pill .material-symbols-outlined {
  font-size: 15px !important;
  color: var(--executive) !important;
  
}

.header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--executive);
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: 10px;
  font-family: "Kanit", sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
}

.header-action-btn:hover {
  background: var(--executive-hover);
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.35);
  transform: translateY(-1px);
}

.header-action-btn .material-symbols-outlined {
  font-size: 16px !important;
  color: white !important;
}

.header-dev-badge {
  background: #f97316;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  
}

.header-user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--executive) 0%, var(--executive-hover) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.header-user-name {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

/* ── BREADCRUMB ── */
.app-breadcrumb {
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6b7280;
}

.app-breadcrumb a {
  color: #6b7280;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.app-breadcrumb a:hover {
  color: var(--executive);
}

.app-breadcrumb .bc-sep {
  color: #d1d5db;
  font-size: 16px;
}

.app-breadcrumb .bc-current {
  color: var(--executive);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.app-breadcrumb .material-symbols-outlined {
  font-size: 14px !important;
}

/* ── PAGE CONTENT WRAPPER ── */
.app-content {
  flex: 1;
  padding: 24px;
  background: var(--page-bg);
}

/* =====================================================
   7. PAGE HEADER
   ===================================================== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

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



.page-header-badge  {

  height:40px;

  padding:0 14px;

  border-radius:var(--r-full);

  display:flex;
  align-items:center;
  gap:8px;

  background: linear-gradient(135deg, #fff7ed, #fffbeb);
  border: 1px solid #fbbf24;
  color: #92400e;
  
  font-weight:600;

  white-space:nowrap;
}



.header-date-pill{

  height:40px;

  padding:0 14px;

  border-radius:var(--r-full);

  display:flex;
  align-items:center;
  gap:8px;

  background:#f5f3ff;

  border:
    1px solid #ddd6fe;

  color:#5b21b6;

  font-size:13px;
  font-weight:600;

  white-space:nowrap;
}

.page-header-badge .material-symbols-outlined,
.header-date-pill .material-symbols-outlined{
  font-size:18px !important;
}


/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
  .app-sidebar {
    width: 56px;
  }

  .app-main {
    margin-left: 56px;
  }

  .app-header {
    padding: 0 16px;
    height: 64px;
  }

  .header-subtitle {
    display: none;
  }

  .header-date-pill {
    display: none;
  }

  .header-system-name {
    font-size: 15px;
  }

  .app-content {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .header-user-name {
    display: none;
  }
}






/* ── SUMMARY CARDS ── */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.sum-card {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.sum-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-accent);
}

.sum-icon,
.sum-icon-desc,
.sum-icon-unread,
.sum-icon-cyan {
  font-size: 24px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.sum-icon       { background: var(--accent-light); }
.sum-icon-desc  { background: var(--blue-light1); }
.sum-icon-unread{ background: var(--accent2-light); }
.sum-icon-cyan  { background: var(--surface2); }

.sum-content { flex: 1; }

.sum-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.sum-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── CARD ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

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

.card-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.card-hint {
  font-size: 12px;
  background: var(--surface2);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 20px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* =====================================================
   🆕 VIEW TOGGLE
   ===================================================== */
.view-toggle {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.view-toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 6px;
  font-family: 'Kanit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}

.view-toggle-btn:hover {
  color: var(--text);
}

.view-toggle-btn.active {
  background: var(--surface);
  color: var(--blue-dark);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* View Panels */
.view-panel { display: none; }
.view-panel.active { display: block; }

/* ── SALES GRID ── */
.sales-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.sales-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.sales-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.sales-card.active {
  border-color: var(--accent);
  background: var(--accent-light);
}

.sales-card.has-unread::before {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  background: var(--accent2);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.sales-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.sales-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--blue-light1);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.sales-filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}

.sales-filter-btn:hover {
  background: var(--surface2);
  color: var(--blue-dark);
  border-color: var(--blue-light);
}

.sales-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.sales-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--blue);
}

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

/* =====================================================
   🆕 SALES QUICK PICK (Table view)
   ===================================================== */
.table-by-sales-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(59,140,233,0.06) 0%, rgba(96,214,250,0.06) 100%);
  border: 1px solid var(--blue-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--blue-dark);
}

.sales-quick-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.quick-pick-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  font-family: 'Kanit', sans-serif;
  text-align: left;
  transition: all var(--transition);
  position: relative;
}

.quick-pick-card:hover:not(.disabled) {
  border-color: var(--blue);
  box-shadow: var(--shadow-md);
  transform: translateX(2px);
}

.quick-pick-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quick-pick-card.has-unread {
  border-left: 3px solid var(--accent2);
}

.qp-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--blue-light1);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.qp-info {
  flex: 1;
  min-width: 0;
}

.qp-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.qp-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.qp-unread {
  color: var(--accent2);
  font-weight: 500;
}

.qp-arrow {
  color: var(--text-light);
  transition: transform var(--transition);
}

.quick-pick-card:hover:not(.disabled) .qp-arrow {
  transform: translateX(3px);
  color: var(--blue);
}

/* ── FILTER SECTION ── */
.filter-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

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

.filter-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.filter-group select,
.filter-group input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Kanit', sans-serif;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition);
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── BUTTONS ── */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Kanit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); box-shadow: 0 4px 12px rgba(16,185,129,0.3); }

.btn-secondary { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-export { background: transparent; color: var(--accent2); border: 1px solid rgba(245,158,11,0.3); }
.btn-export:hover { background: var(--accent2-light); border-color: var(--accent2); }

.btn-success { background: var(--accent); color: white; }
.btn-success:hover { background: var(--accent-dark); }

/* ── REPORTS CONTAINER (List view) ── */
.reports-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--surface);
}

.report-item:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-md);
}

.report-item.unread {
  background: var(--unread-bg);
  border-color: var(--unread-border);
  border-left: 3px solid var(--accent2);
}

.report-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--blue-light);
  color: var(--blue-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}

.report-info { flex: 1; min-width: 0; }

.report-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.report-sales {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.report-date {
  font-size: 13px;
  color: var(--text-med);
}

.report-details {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.report-detail-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.report-status { flex-shrink: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-unread { background: var(--accent2-light); color: #b45309; }
.badge-read   { background: var(--accent-light); color: var(--accent-dark); }
.badge-info   { background: var(--blue-light1); color: var(--blue-dark); }

.report-province {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

/* =====================================================
   💬 COMMENT STYLES — แยก 4 roles
   ===================================================== */
.comment-item {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 10px;
  border-left: 4px solid #ddd;
  background: #f9f9f9;
}

.comment-item.comment-admin {
  background: linear-gradient(135deg, #fde8e8 0%, #fbd5d5 100%);
  border-left-color: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}

.comment-item.comment-executive {
  background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
  border-left-color: #f0ad4e;
  box-shadow: 0 2px 8px rgba(240, 173, 78, 0.15);
}

.comment-item.comment-manager {
  background: linear-gradient(135deg, #e8f4fd 0%, #d1ecf1 100%);
  border-left-color: #17a2b8;
  box-shadow: 0 2px 8px rgba(23, 162, 184, 0.15);
}

.comment-item.comment-user {
  background: #f5f5f5;
  border-left-color: #6c757d;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.comment-author {
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.comment-date {
  font-size: 12px;
  color: #888;
  margin-left: auto;
}

.comment-role-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.comment-role-badge.comment-admin {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  color: #fff;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

.comment-role-badge.comment-executive {
  background: linear-gradient(135deg, #f0ad4e, #ec971f);
  color: #fff;
  box-shadow: 0 2px 4px rgba(240, 173, 78, 0.3);
}

.comment-role-badge.comment-manager {
  background: linear-gradient(135deg, #17a2b8, #138496);
  color: #fff;
  box-shadow: 0 2px 4px rgba(23, 162, 184, 0.3);
}

.comment-role-badge.comment-user {
  background: #7d7d6c;
  color: #fff;
}

.comment-text {
  color: #444;
  font-size: 14px;
  line-height: 1.6;
  /* white-space: pre-wrap; */
  word-break: break-word;
}

.no-comments {
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
}

.comments-list {
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 15px;
  padding-right: 5px;
}

.comments-list::-webkit-scrollbar { width: 6px; }
.comments-list::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
.comments-list::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
.comments-list::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }

.comment-header {
  font-weight: 600;
  font-size: 15px;
  color: #333;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-section {
  border-top: 1px solid #eee;
  padding-top: 15px;
  margin-top: 15px;
}

#commentInput,
#popupCommentInput {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  transition: border-color 0.2s;
}

#commentInput:focus,
#popupCommentInput:focus {
  outline: none;
  border-color: #17a2b8;
  box-shadow: 0 0 0 3px rgba(23, 162, 184, 0.1);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.modal-actions .btn {
  flex: 1;
  min-width: 150px;
}

/* ── PAGINATION ── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Kanit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
}

.page-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* =====================================================
   ── MODAL (เดิม + ใหม่) ──
   ===================================================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show {
  display: flex;
  animation: modal-fade-in 0.2s ease-out;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 🆕 z-index สูงกว่า sales modal */
#commentPopupModal { z-index: 10000; }

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: modal-slide-up 0.25s ease-out;
}

@keyframes modal-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* 🆕 Modal sizes */
.modal-content-xl {
  max-width: 1280px;
  box-shadow: var(--shadow-xl);
}

.modal-content-sm {
  max-width: 520px;
}

/* ปุ่มปิด */
.modal-content .close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f3f4f6;
  color: #6b7280;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  z-index: 10;
}

.modal-content .close-btn:hover {
  background: #e5e7eb;
  color: #111827;
  transform: scale(1.05);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 60px 18px 22px;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #111827;
  flex: 1;
  min-width: 0;
}

.modal-badges {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.modal-body {
  padding: 24px;
}

/* 🆕 Sales modal header layout */
.modal-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.sales-modal-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--blue-light1) 0%, var(--blue-light) 100%);
  color: var(--blue-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 700;
  flex-shrink: 0;
}

.sales-modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 🆕 Mini Summary */
.mini-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  background: linear-gradient(135deg, rgba(59,140,233,0.05) 0%, rgba(96,214,250,0.05) 100%);
  border: 1px solid var(--blue-light);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
}

.mini-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.mini-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue-dark);
  line-height: 1.2;
}

/* =====================================================
   🆕 SALES TABLE
   ===================================================== */
.sales-table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 65vh;
}

.sales-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  min-width: 860px;
  table-layout: fixed;
}

.sales-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.sales-table thead th {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.sales-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
  overflow-wrap: break-word;
  word-break: break-word;
}

.sales-table tbody tr {
  transition: background var(--transition);
}

.sales-table tbody tr:hover {
  background: #fafbfc;
}

.sales-table tbody tr.row-unread {
  background: var(--unread-bg);
  border-left: 3px solid var(--accent2);
}

.sales-table tbody tr.row-unread:hover {
  background: #f5f4a8;
}

.sales-table tbody tr.row-unread td:first-child {
  border-left: 3px solid var(--accent2);
}

/* Cell styles */
.td-date {
  white-space: nowrap;
}

.td-date-main {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.td-date-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.td-shop .shop-name {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.td-province {
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-muted);
}

.td-province .material-symbols-outlined {
  vertical-align: middle;
  margin-right: 2px;
}

/* products cell — ใช้ wrapper flex แทนการให้ td เป็น flex (กันเส้นกระโดด) */
.td-products {
  max-width: 200px;
}

.product-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.product-chip {
  display: inline-block;
  background: #fff7e6;
  color: #92400e;
  border: 1px solid #fde8b3;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.product-chip.more-chip {
  background: var(--surface2);
  color: var(--text-muted);
  border-color: var(--border);
}

.td-interest {
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
}

.td-note {
  min-width: 220px;
}

/* รายละเอียดการเข้าเยี่ยม — แสดงเต็ม / ย่อได้ */
.note-cell {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.note-cell.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--blue-dark);
  font-family: 'Kanit', sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 0 0;
  margin: 2px 0 0;
  cursor: pointer;
  transition: color var(--transition);
}

.note-toggle-btn:hover {
  color: var(--blue);
  text-decoration: underline;
}

.note-toggle-btn .material-symbols-outlined {
  font-size: 14px;
  transition: transform var(--transition);
}

.note-toggle-btn.expanded .material-symbols-outlined {
  transform: rotate(180deg);
}

.muted-text {
  color: var(--text-light);
  font-style: italic;
}

.col-status, .col-action {
  text-align: center;
}

/* Comment button in row */
.row-comment-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 16px;
  cursor: pointer;
  font-family: 'Kanit', sans-serif;
  color: var(--text-muted);
  transition: all var(--transition);
  font-size: 12px;
}

.row-comment-btn:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
  background: var(--blue-light1);
}

.row-comment-btn.has-comments {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.row-comment-btn.has-comments:hover {
  background: var(--accent);
  color: white;
}

.row-comment-btn.has-comments:hover .material-symbols-outlined {
  color: white;
}

.cmt-count {
  font-weight: 600;
}

/* =====================================================
   🆕 COMMENT POPUP — Shop info
   ===================================================== */
.popup-shop-info {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 4px;
}

.popup-shop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.popup-shop-row + .popup-shop-row {
  margin-top: 6px;
}

.popup-shop-name {
  font-weight: 600;
  color: var(--text);
}

.popup-province {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 4px;
}

.popup-shop-date {
  color: var(--text-muted);
  font-size: 12px;
}

/* =====================================================
   ── REPORT DETAIL MODAL (เดิม) ──
   ===================================================== */
.modal-body .info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 24px;
  background: #fafbfc;
  padding: 18px 20px;
  border-radius: 10px;
  margin-bottom: 18px;
  border: 1px solid #eef0f2;
}

.modal-body .info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.modal-body .info-label {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 4px;
}

.modal-body .info-value {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  word-break: break-word;
  line-height: 1.5;
}

.modal-body .info-item.full-width {
  grid-column: 1 / -1;
}

.modal-body .info-section {
  background: #fff8e7;
  border-left: 4px solid #f0ad4e;
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.modal-body .info-section .info-label {
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 8px;
}

.modal-body .note-box {
  font-size: 14px;
  color: #374151;
  line-height: 1.7;
  white-space: pre-wrap;
}

.modal-body .comment-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #e5e7eb;
}

.modal-body .comment-header {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 12px;
}

/* ── LOADING ── */
.loading {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 16px;
  color: var(--text);
  margin: 12px 0 6px;
}

.empty-state p {
  font-size: 13px;
  margin: 0;
}

.empty-icon-mat {
  font-size: 48px !important;
  color: var(--text-light);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  pointer-events: none;
  z-index: 10001;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── FOOTER ── */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-light);
  font-size: 13px;
}

/* =====================================================
   DATE RANGE SECTION
   ===================================================== */
.date-range-section {
  background: linear-gradient(135deg, rgba(25, 147, 247, 0.08) 0%, rgba(96, 214, 250, 0.08) 100%);
  border: 1px solid var(--blue-light);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.date-range-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.date-range-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue-dark);
}

.date-range-title .icon {
  font-size: 1.25rem;
}

.date-range-label {
  background: rgba(59, 140, 233, 0.15);
  color: var(--blue-dark);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.date-range-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.date-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 1);
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--blue-light);
}

.date-input-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.date-input-group input[type="date"] {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: 'Kanit', sans-serif;
  font-size: 0.9rem;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.date-input-group input[type="date"]:focus {
  outline: none;
  background: rgba(240, 243, 242, 0.1);
}

.date-input-group input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

.quick-range-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.quick-range-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-family: 'Kanit', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-range-btn:hover {
  background: rgba(0,117,212,0.1);
  border-color: rgba(0,117,212,0.3);
  color: var(--blue-dark);
}

.quick-range-btn.active {
  border-color: var(--text-med);
  color: var(--text-med);
  font-weight: 500;
}

/* Badge comment in list view */
.badge-comment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--blue-light1);
  color: var(--blue-dark);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

/* ===================================================
   🎯 GLOBAL ICON ALIGNMENT FIX
=================================================== */
.material-symbols-outlined {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  vertical-align: middle;
}

.badge,
.badge-comment,
.btn,
.comment-role-badge,
.report-detail-item,
.report-province,
.report-date,
.report-sales,
.quick-range-btn,
.date-range-label,
.sales-name,
.stat-label,
.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}

.page-header h1,
.card-header h2,
.date-range-title,
.comment-header,
.info-label {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}

.report-header,
.report-details,
.report-status,
.filter-actions,
.modal-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .modal-content-xl {
    max-width: 96vw;
  }
}

@media (max-width: 768px) {
  .container { padding: 16px; }

  .page-header { flex-direction: column; align-items: flex-start; }

  .date-range-header { flex-direction: column; align-items: flex-start; }
  .date-range-controls { width: 100%; }
  .date-input-group { flex: 1; min-width: 140px; }
  .quick-range-btns { width: 100%; justify-content: flex-start; }

  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .sales-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-row { grid-template-columns: 1fr; }

  .report-item {
    grid-template-columns: auto 1fr;
    gap: 12px;
  }

  .report-status {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .info-grid { grid-template-columns: 1fr; }

  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; justify-content: center; }

  /* 🆕 Sales table responsive — บนแท็บเล็ตยังพอดี ไม่ต้องเลื่อนซ้ายขวา */
  .sales-table { font-size: 12px; }
  .sales-table thead th,
  .sales-table tbody td {
    padding: 10px 8px;
  }

  .product-chip { font-size: 10px; padding: 2px 6px; max-width: 130px; }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .view-toggle-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  .modal-body .info-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .modal-header { padding: 16px 52px 16px 18px; }
  .modal-header h3 { font-size: 15px; width: 100%; }
  .modal-badges { margin-top: 4px; }

  .modal-body { padding: 16px; }

  .mini-summary {
    grid-template-columns: repeat(2, 1fr);
    padding: 12px;
  }

  .sales-quick-pick { grid-template-columns: 1fr; }
}


.comments-history .comment-item{
  min-height: unset !important;
  padding: 8px 10px !important;
  margin-bottom: 6px !important;
}

.comments-history .comment-meta{
  margin-bottom: 4px !important;
}

.comments-history .comment-text{
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.comments-history .comment-text > div{
  margin-top: 0 !important;
}