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

/* ─── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:        #F4F6FB;
  --panel:     #FFFFFF;
  --panel-alt: #F8F9FC;

  /* Text */
  --ink:   #111827;
  --ink-2: #374151;
  --muted: #6B7280;
  --faint: #9CA3AF;

  /* Borders */
  --line:   #E5E7EB;
  --line-2: #D1D5DB;

  /* Brand — Indigo */
  --brand:       #6366F1;
  --brand-dark:  #4338CA;
  --brand-mid:   #818CF8;
  --brand-light: #EEF2FF;

  /* Accent — Violet */
  --accent:       #8B5CF6;
  --accent-light: #F5F3FF;

  /* Status */
  --ready:    #059669;
  --review:   #D97706;
  --draft:    #6B7280;
  --posted:   #2563EB;
  --danger:   #DC2626;

  /* Shadows */
  --s1: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --s2: 0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  --s3: 0 20px 60px rgba(0,0,0,.14), 0 4px 20px rgba(0,0,0,.06);

  /* Radii */
  --r1: 6px;
  --r2: 10px;
  --r3: 14px;

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Thai', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ─── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: 26px; font-weight: 700; line-height: 1.2; margin-bottom: 12px; }
h2 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* ─── APP LAYOUT ─────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
  position: relative; /* v921: ให้ sticker/sticky layer ยึดกับหน้า (absolute) ไม่ใช่จอ (fixed) → เลื่อนไปกับเนื้อหา */
}

/* ─── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  gap: 0;
}

/* Logo block */
.sidebar > div:first-child {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
}

.sidebar-logo {
  width: 76px;
  height: auto;
  display: block;
  border-radius: var(--r1);
}

.intro { display: none; } /* Hidden in new design */

/* Nav tabs */
.nav-tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 10px;
}
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: 10px; }
.nav-group-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted, #8a93ad); padding: 4px 10px 2px; opacity: .85;
}

.tab-button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: none;
  border-radius: var(--r2);
  padding: 9px 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .14s, color .14s;
}
.tab-button:hover { background: var(--bg); color: var(--ink); }
.tab-button.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}

/* Stats / summary panels */
.summary-panel {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.summary-panel h2 {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 10px;
}

.metric span {
  display: block;
  font-size: 30px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -.5px;
}

.metric small, .metric-row small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.metric-row strong {
  display: block;
  font-size: 20px;
  font-weight: 700;
}

/* Connected accounts */
.social-panel { margin-top: 0; }

.connection-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}
.connection-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.connection-row-status { flex: 1; min-width: 0; line-height: 1.35; }
.connection-row-actions { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }
.connection-row-bottom { display: flex; justify-content: flex-end; }

.connect-link {
  border-radius: var(--r1);
  padding: 4px 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .14s;
}
.connect-link:hover { background: var(--brand-dark); }
.connect-link.logout-link { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.connect-link.logout-link:hover { background: var(--danger); color: #fff; }

/* Sidebar user badge */
.sidebar-user {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel-alt);
}
.sidebar-user-name { font-weight: 600; color: var(--ink); font-size: 13px; }
.sidebar-user-role { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.sidebar-user-time { color: var(--faint); font-size: 11px; margin-top: 3px; }

/* Eyebrow label */
.eyebrow {
  margin: 0 0 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ─── WORKSPACE ──────────────────────────────────────────────── */
.workspace {
  min-width: 0;
  padding: 24px 28px 40px;
  background: var(--bg);
  transition: background .2s;
}
.workspace.dark-mode {
  background: #080e1c;
  padding: 0;
}
.workspace.dark-mode .topbar { display: none; }

/* ─── TOPBAR ─────────────────────────────────────────────────── */
.topbar,
.section-head,
.post-card-head,
.form-actions,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-actions { flex-wrap: wrap; justify-content: flex-start; }
/* บล็อกเก็บลิงก์โพสต์ + engagement */
.post-live { margin: 10px 0; padding: 10px 12px; border: 1px solid #d7def0; border-radius: 10px; background: #f6f8ff; }
.post-live-head { font-size: 12.5px; font-weight: 700; color: #3b46c4; margin-bottom: 8px; }
.post-live-linkrow { display: flex; gap: 6px; margin-bottom: 8px; }
.post-live-linkrow .posted-link { flex: 1; border: 1.5px solid var(--line); border-radius: 7px; padding: 7px 9px; font-size: 12.5px; font-family: inherit; }
.post-live-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.post-live-stats label { display: flex; align-items: center; gap: 3px; font-size: 12px; }
.post-live-stats input { width: 100%; min-width: 0; border: 1.5px solid var(--line); border-radius: 6px; padding: 5px 6px; font-size: 12px; font-family: inherit; }
.post-live-saved { font-size: 12px; color: #1a8f4a; margin-left: 8px; font-weight: 600; }
@media (max-width: 520px) { .post-live-stats { grid-template-columns: repeat(2, 1fr); } }
/* เครื่องมือเสริมหน้า Ads */
.ads-extra-tools { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.ads-tool-det summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--brand-dark, #3b46c4); }
.ads-tool-hint { font-size: 11.5px; color: var(--muted); margin: 6px 0; }
/* v213: Campaign Insights — KPI แถวสรุป + ตารางแคมเปญให้เป็นตารางจริง (มีเส้น/หัวตาราง/zebra) */
.ads-insights-kpi { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.ads-ins-k { flex: 1 1 96px; min-width: 90px; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 10px; padding: 8px 10px; text-align: center; }
.ads-ins-k span { display: block; font-size: 15px; font-weight: 800; color: #111827; line-height: 1.2; }
.ads-ins-k small { display: block; font-size: 10.5px; color: #6b7280; margin-top: 2px; }
.ads-ins-tbl { width: 100%; border-collapse: collapse; font-size: 12px; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; }
.ads-ins-tbl thead th { background: #eef2ff; color: #3730a3; font-weight: 700; font-size: 11px; text-align: right; padding: 7px 9px; border-bottom: 2px solid #c7d2fe; white-space: nowrap; }
.ads-ins-tbl thead th:first-child { text-align: left; }
.ads-ins-tbl tbody td { padding: 6px 9px; border-bottom: 1px solid #f1f5f9; text-align: right; color: #334155; white-space: nowrap; }
.ads-ins-tbl tbody td:first-child { text-align: left; font-weight: 600; color: #1e293b; }
.ads-ins-tbl tbody tr:nth-child(even) { background: #f9fafb; }
.ads-ins-tbl tbody tr:hover { background: #eef2ff; }
.ads-tool-row { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.ads-tool-row input { flex: 1; min-width: 180px; border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; }
.ads-tool-result { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fafbff; font-size: 13px; }
.ads-ai-out { line-height: 1.6; }
.ads-ai-out h4 { margin: 10px 0 4px; color: var(--brand-dark, #3b46c4); }
.ads-sheet-wrap { overflow-x: auto; }
.ads-sheet-tbl { border-collapse: collapse; width: 100%; font-size: 12px; }
.ads-sheet-tbl th, .ads-sheet-tbl td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; white-space: nowrap; }
.ads-sheet-tbl th { background: #eef1fb; font-weight: 700; position: sticky; top: 0; }
/* เทียบเพจ */
.cmp-area { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fafbff; }
.cmp-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.cmp-chip { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.cmp-pick select { border: 1.5px solid var(--line); border-radius: 7px; padding: 5px 8px; font-size: 13px; }
.cmp-chart-title { font-weight: 700; font-size: 13px; margin: 8px 0 4px; color: var(--brand-dark, #3b46c4); }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 4px; font-size: 12px; }
.cmp-leg, .cmp-tbl td:first-child { display: inline-flex; align-items: center; gap: 5px; }
.cmp-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cmp-svg { width: 100%; max-width: 580px; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
.cmp-tbl { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.cmp-tbl th, .cmp-tbl td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }
.cmp-tbl th { background: #eef1fb; font-weight: 700; }
.cmp-up { color: #2f9e44; font-weight: 700; }
.cmp-down { color: #e03131; font-weight: 700; }
.topbar { margin-bottom: 22px; }
.topbar h2 { margin-bottom: 0; font-size: 21px; font-weight: 700; }
.topbar-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ─── BUTTONS ────────────────────────────────────────────────── */
.icon-button,
.primary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  border-radius: var(--r2);
  border: 1px solid transparent;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  transition: background .13s, border-color .13s, box-shadow .13s;
  white-space: nowrap;
}

.icon-button, .ghost-button {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink-2);
}
.icon-button:hover, .ghost-button:hover {
  border-color: var(--line-2);
  background: var(--panel-alt);
}
/* ── Liquid glass effect บนปุ่มในระบบ ── */
.icon-button, .primary-button, .ghost-button, .danger-button {
  position: relative; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 1px 3px rgba(16,24,64,.08);
}
.icon-button::before, .primary-button::before, .ghost-button::before, .danger-button::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.2px;
  background: linear-gradient(180deg, rgba(255,255,255,.6) 0%, rgba(255,255,255,.14) 32%, rgba(255,255,255,0) 52%, rgba(255,255,255,0) 64%, rgba(255,255,255,.22) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; z-index: 1;
}
/* แสงกวาดตอน hover */
.icon-button::after, .primary-button::after, .ghost-button::after, .danger-button::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-18deg); transition: left .5s ease; pointer-events: none; z-index: 1;
}
.icon-button:hover::after, .primary-button:hover::after, .ghost-button:hover::after, .danger-button:hover::after { left: 130%; }
.primary-button { backdrop-filter: saturate(1.2); }
.primary-button:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 4px 16px rgba(99,102,241,.45); transform: translateY(-1px); }
.ghost-button:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 3px 10px rgba(16,24,64,.12); transform: translateY(-1px); }

.primary-button {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 1px 4px rgba(99,102,241,.3);
}
.primary-button:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  box-shadow: 0 2px 8px rgba(99,102,241,.4);
}

.danger-button {
  border-color: #FCA5A5;
  background: #FEF2F2;
  color: var(--danger);
}
.danger-button:hover { background: #FEE2E2; }

.small { min-height: 30px; padding: 5px 11px; font-size: 12px; }

/* ─── VIEWS ──────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* Ads Intelligence */
.ads-dashboard {
  display: grid;
  gap: 16px;
}

.ads-control-panel,
.ads-panel,
.ads-kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r3);
  padding: 18px;
  box-shadow: var(--s1);
}

.ads-filter-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) minmax(130px, .7fr) minmax(120px, .6fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.ads-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ads-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.ads-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ads-kpi span {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.ads-kpi small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.ads-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
  gap: 16px;
}

.ads-sync-time {
  color: var(--muted);
  font-size: 12px;
}

.ads-page-summary,
.ads-insight-list,
.ads-library-list {
  display: grid;
  gap: 10px;
}

.ads-page-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r2);
  background: var(--panel-alt);
}

.ads-page-card img,
.ads-page-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.ads-page-avatar {
  display: grid;
  place-items: center;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 800;
}

.ads-page-card strong,
.ads-page-card span,
.ads-page-card a,
.ads-page-metrics {
  display: block;
}

.ads-page-card span,
.ads-page-metrics,
.ads-ad-card p,
.ads-post-table small {
  color: var(--muted);
  font-size: 12px;
}

.ads-page-metrics {
  margin-top: 4px;
}

.ads-page-metrics b {
  color: var(--ink);
}

.ads-page-metrics a,
.ads-ad-card a,
.ads-post-table a {
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration: none;
}

.ads-insight-item {
  padding: 12px 14px;
  border-left: 3px solid var(--brand);
  border-radius: var(--r1);
  background: var(--brand-light);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.6;
}

.ads-library-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ads-ad-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r2);
  background: var(--panel);
}

.ads-ad-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.ads-ad-head span {
  padding: 2px 8px;
  border-radius: 999px;
  background: #ECFDF5;
  color: #047857;
  font-weight: 700;
}

.ads-ad-card h4 {
  margin: 0;
  font-size: 14px;
}

.ads-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ads-chip-row span {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
}

.ads-post-table {
  overflow-x: auto;
}

.ads-post-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.ads-post-table th,
.ads-post-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.ads-post-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.ads-post-table td strong,
.ads-post-table td small {
  display: block;
}

/* ─── COMPOSER / CARDS / SECTIONS ───────────────────────────── */
.composer,
.queue,
.calendar-grid,
.library-layout > section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r3);
  padding: 20px;
  box-shadow: var(--s1);
}

.composer { display: grid; gap: 20px; margin-bottom: 18px; }
/* v420: Section dividers ในฟอร์มโพสต์ */
.form-section-head { display:flex; align-items:center; gap:10px; background:linear-gradient(90deg,#1a2d4a,#0f1a2e88); border-left:4px solid #3a6fd6; border-radius:0 8px 8px 0; padding:10px 16px; margin:6px 0 2px; }
.form-section-head--post { border-left-color:#10b981; background:linear-gradient(90deg,#0d2b20,#0f1a2e88); }
.form-section-icon { font-size:18px; line-height:1; }
.form-section-title { font-size:14px; font-weight:700; color:#eef1ff; }
.form-section-sub { font-size:11.5px; color:#7f8aa6; margin-left:4px; }

/* ─── FORMS ──────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
/* ช่องแบรนด์: ชิดบน ไม่ให้ยืดตามแถวที่สูงกว่า (ข้างช่องผู้รับผิดชอบที่มี 2 อินพุต) */
.form-grid label.brand-field { align-self: start; }
/* Utility: span all columns */
.col-span-2 { grid-column: 1 / -1; }

label, fieldset {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}

fieldset { margin: 0; border: 0; padding: 0; }
legend { margin-bottom: 10px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }

input, select, textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--r1);
  padding: 9px 12px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
  font-size: 13.5px;
  transition: border-color .14s, box-shadow .14s;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

input::placeholder, textarea::placeholder { color: var(--faint); }

/* ─── PLATFORM GRID ──────────────────────────────────────────── */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.platform-option {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1.5px solid var(--line);
  border-radius: var(--r1);
  background: var(--panel);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .14s, background .14s;
}

.platform-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.platform-option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand-dark);
}

/* ─── Platform account sub-selector ──────────────────────────── */
.platform-option-wrap {
  display: contents; /* ไม่กิน layout ของ grid */
}
.platform-account-badge {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
  margin-top: 1px;
}
.platform-accounts {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 8px;
  background: var(--brand-light);
  border: 1px solid var(--brand);
  border-radius: var(--r1);
  margin-top: -4px;
  margin-bottom: 2px;
}
.platform-account-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 20px;
  background: white;
  border: 1px solid var(--line);
}
.platform-account-item:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand-dark);
}
.platform-account-item input { display: none; }
.platform-account-single {
  font-size: 12px;
  color: var(--brand-dark);
  padding: 2px 4px;
}

/* ─── v423/v424: Post Filter Row (person dropdown + status bar) ── */
.post-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0 2px; }
.psf-person-sel { background: var(--panel); border: 1.5px solid var(--line); border-radius: 20px; padding: 5px 26px 5px 10px; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; outline: none; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a8ab0'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; min-width: 110px; transition: border-color .15s, color .15s; }
.psf-person-sel:hover, .psf-person-sel:focus { border-color: #5b8dee; color: var(--ink); }
.psf-person-sel option { background: #fff; color: #111827; }
.psf-sep { width: 1px; height: 22px; background: var(--line); flex-shrink: 0; }
.post-status-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.psf-btn { background: var(--panel); border: 1.5px solid var(--line); border-radius: 20px; padding: 5px 14px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background .15s, color .15s, border-color .15s; white-space: nowrap; }
.psf-btn:hover { border-color: #5b8dee; color: #5b8dee; }
.psf-btn.active { background: #1a3a6b; border-color: #5b8dee; color: #eef1ff; }
/* สีตาม status เมื่อ active */
.psf-btn.active[data-status="draft"] { background: #2d2d3d; border-color: #7c91c7; color: #c4cfe8; }
.psf-btn.active[data-status="doing"] { background: #2a1f00; border-color: #f59e0b; color: #fcd34d; }
.psf-btn.active[data-status="review"] { background: #001e3c; border-color: #3b82f6; color: #93c5fd; }
.psf-btn.active[data-status="ready"] { background: #052e16; border-color: #10b981; color: #6ee7b7; }
.psf-btn.active[data-status="posted"] { background: #1a0533; border-color: #a855f7; color: #d8b4fe; }

/* ─── POST CARDS ─────────────────────────────────────────────── */
.post-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.post-card {
  display: grid;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: var(--r3);
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--s1);
  transition: box-shadow .18s, border-color .18s, transform .18s;
}
.post-card:hover {
  box-shadow: var(--s2);
  border-color: var(--line-2);
  transform: translateY(-1px);
}

.post-date {
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 1px;
}

.post-card h4 {
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 0;
  color: var(--ink);
  line-height: 1.4;
}

/* ─── STATUS PILLS ───────────────────────────────────────────── */
.status-pill, .platform-pills button {
  border-radius: 999px;
  border: 0;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .01em;
}

.platform-pills button:hover { background: var(--brand-light); color: var(--brand); }

.status-pill.ready  { background: #D1FAE5; color: #065F46; }
.status-pill.review { background: #FEF3C7; color: #92400E; }
.status-pill.draft  { background: #F3F4F6; color: #4B5563; }
.status-pill.posted { background: #DBEAFE; color: #1E40AF; }
.status-pill.doing  { background: #FEF0E0; color: #B45309; }
/* โหมดเฉพาะงานฉัน — เต็มหน้า แยกพาร์ท */
.tasks-mine-full { display: flex; flex-direction: column; gap: 16px; max-width: 980px; margin: 0 auto; }
.mine-sec { background: var(--panel, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 14px; padding: 14px 16px; }
.mine-sec-head { font-size: 15px; font-weight: 700; color: var(--ink, #1f2933); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.mine-sec-n { font-size: 12px; font-weight: 700; color: #4f46e5; background: #eef2ff; border-radius: 999px; padding: 1px 9px; }
.mine-sec .task-items { display: flex; flex-direction: column; gap: 8px; }
.mine-sec .task-item { width: 100%; }
.mine-sec-fix { border-color: #f0a500; background: #fffaf0; }
.mine-sec-fix .mine-sec-head { color: #b35a00; }
/* แผงสิทธิ์ Ads */
.ads-access-panel { margin-top: 16px; padding: 14px 16px; border: 1px solid #c7d2fe; border-radius: 12px; background: #f5f7ff; }
.ads-access-panel h4 { margin: 0 0 4px; font-size: 14px; color: #3730a3; }
.ads-access-row { display: flex; gap: 8px; margin: 8px 0; }
.ads-access-row input { flex: 1; padding: 8px 11px; border: 1.5px solid #c7d2fe; border-radius: 8px; font-size: 13px; }
.ads-access-grants { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; }
.ads-grant { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #1f2933; cursor: pointer; }
.ads-grant input { width: auto; }
/* Affiliate / Influencer hub */
.aff-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.aff-menu { position: relative; }
.aff-menu-pop { position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; background: #fff; border: 1px solid var(--line,#e5e7eb); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 8px; z-index: 50; display: none; flex-direction: column; gap: 4px; }
.aff-menu-pop.open { display: flex; }
.aff-menu-sec { font-size: 11px; font-weight: 700; color: #8a96b8; text-transform: uppercase; padding: 6px 8px 2px; }
.aff-menu-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 9px 10px; border: none; background: none; border-radius: 8px; font-size: 13.5px; font-family: inherit; color: var(--ink,#1f2933); cursor: pointer; }
.aff-menu-item:hover { background: #f1f4ff; }
.aff-menu-check { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.aff-menu-check input[type="checkbox"] { margin: 0; flex: 0 0 auto; width: auto; }
/* กล่องต้นทุนในฟอร์มแคมเปญ — ตัวอักษรสว่างบนพื้นเข้ม */
.aff-cost-box { color: #eef1ff; }
.aff-menu-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: #4b5563; padding: 5px 8px; }
.aff-menu-field select, .aff-menu-field input { padding: 7px 9px; border: 1.5px solid var(--line,#cbd5e1); border-radius: 8px; font-size: 13px; font-family: inherit; }
.aff-filter-badge { align-items: center; background: #4f46e5; color: #fff; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.aff-cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 10px; margin-bottom: 12px; }
.aff-card { background: var(--panel,#fff); border: 1px solid var(--line,#e5e7eb); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.aff-card span { font-size: 12px; color: var(--muted,#6b7280); }
.aff-card b { font-size: 22px; color: #4f46e5; font-weight: 700; }
.aff-minis { display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 10px; margin-bottom: 18px; }
.aff-mini { background: #f5f7ff; border: 1px solid #e0e7ff; border-radius: 10px; padding: 10px 12px; }
.aff-mini-t { font-size: 12.5px; font-weight: 700; color: #3730a3; margin-bottom: 6px; }
.aff-mini-row { display: flex; justify-content: space-between; font-size: 13px; color: #1f2933; padding: 2px 0; border-bottom: 1px solid #eef2ff; }
.aff-block { margin-bottom: 22px; }
.aff-sec-head { font-size: 15px; font-weight: 700; color: var(--ink,#1f2933); margin: 6px 0 10px; }
.aff-table-wrap { overflow-x: auto; }
.aff-table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 13px; }
.aff-table th { text-align: left; padding: 8px 10px; background: #eef2ff; color: #3730a3; font-weight: 600; white-space: nowrap; position: sticky; top: 0; z-index: 2; }
.aff-table td { padding: 8px 10px; border-bottom: 1px solid var(--line,#eef0f4); vertical-align: top; }
.aff-handle { font-size: 11.5px; color: #6b7280; }
.aff-badge { display: inline-block; font-size: 11.5px; font-weight: 600; color: #3730a3; background: #eef2ff; border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.aff-f { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: #eef1ff; margin: 6px 0; }
.aff-f input, .aff-f select { padding: 8px 10px; border: 1.5px solid #2f3f63; border-radius: 8px; font-size: 13px; font-family: inherit; background: #0a1020; color: #fff; }
.aff-f select option { background: #0a1020; color: #fff; }
.avatar-box .avatar-sub, .avatar-box .tasks-sub { color: #b9c2e0; }
.aff-f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.aff-form-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.aff-form-sec { font-size: 12.5px; font-weight: 700; color: #8ab4ff; margin: 14px 0 2px; border-top: 1px solid #2f3f63; padding-top: 10px; }
.aff-cost-box { background: #0a1020; border: 1px solid #2f3f63; border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.aff-cost-row { display: flex; justify-content: space-between; font-size: 12.5px; color: #b9c2e0; padding: 3px 0; }
.aff-cost-row b { color: #eef1ff; }
.aff-cost-row.total { border-top: 1px solid #2f3f63; margin-top: 4px; padding-top: 6px; font-weight: 700; }
.aff-cost-row.total span { color: #eef1ff; }
.aff-cost-row.pos b { color: #4ade80; }
.aff-cost-row.neg b { color: #f87171; }
.aff-card b.pos { color: #16a34a; }
.aff-card b.neg { color: #dc2626; }
.aff-net-pos { color: #16a34a; font-weight: 600; }
.aff-net-neg { color: #dc2626; font-weight: 600; }
/* v573: affiliate campaign card grid */
.aff-camp-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(300px,1fr)); gap: 16px; margin: 4px 0; }
.aff-camp-card { background: #fff; border: 1.5px solid #e0e7ff; border-radius: 14px; padding: 16px 18px; cursor: pointer; transition: box-shadow .18s, border-color .18s, transform .14s; display: flex; flex-direction: column; gap: 7px; outline: none; }
.aff-camp-card:hover { box-shadow: 0 6px 24px rgba(79,70,229,.14); border-color: #818cf8; transform: translateY(-2px); }
.aff-camp-card:focus { box-shadow: 0 0 0 3px rgba(99,102,241,.22); border-color: #6366f1; }
.aff-camp-card.selected { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.18), 0 6px 20px rgba(79,70,229,.12); }
.aff-cc-top { display: flex; align-items: center; gap: 8px; }
.aff-cc-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px rgba(0,0,0,.08); }
.aff-cc-name { font-size: 14px; font-weight: 700; color: #1f2933; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aff-cc-plat { flex-shrink: 0; }
.aff-cc-obj { font-size: 12.5px; color: #4b5563; line-height: 1.5; }
.aff-cc-meta { font-size: 11.5px; color: #6b7280; }
.aff-cc-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.aff-cc-chip { display: inline-block; font-size: 11.5px; background: #f1f4ff; color: #4f46e5; border-radius: 999px; padding: 2px 10px; font-weight: 600; }
.aff-cc-bar-lab { font-size: 11px; color: #6b7280; margin-top: 2px; margin-bottom: 4px; }
.aff-cc-bar { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.aff-cc-bar > div { height: 100%; border-radius: 4px; transition: width .4s ease; }
.aff-cc-foot { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-top: 4px; padding-top: 10px; border-top: 1px solid #f0f3ff; }
/* v573: affiliate step panel */
@keyframes aff-panel-in { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
.aff-step-panel { background: #f8f9ff; border: 1.5px solid #c7d2fe; border-radius: 14px; padding: 18px 20px; margin-top: 14px; animation: aff-panel-in .2s ease; }
.aff-step-panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.aff-step-panel-title { font-size: 14px; font-weight: 700; color: #3730a3; }
.aff-step-panel-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.aff-sp-row { background: #fff; border: 1px solid #e0e7ff; border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.aff-sp-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.aff-sp-lab { font-size: 13px; font-weight: 600; color: #1f2933; }
.aff-sp-count { font-size: 12px; color: #4f46e5; font-weight: 700; white-space: nowrap; }
.aff-sp-bar { height: 9px; background: #e5e7eb; border-radius: 5px; overflow: hidden; }
.aff-sp-bar > div { height: 100%; border-radius: 5px; transition: width .4s ease; }
.aff-sp-pend { margin-top: 8px; }
.aff-sp-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.aff-sp-name { font-size: 11.5px; background: #fee2e2; color: #b91c1c; padding: 2px 9px; border-radius: 999px; }
.aff-hint-sm { font-size: 11.5px; color: #8a96b8; margin: 2px 0 6px; line-height: 1.5; }
.af-sheet-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.af-sheet-row .af-sheet-label { flex: 0 0 38%; padding: 7px 9px; border: 1.5px solid #2f3f63; border-radius: 8px; background: #0a1020; color: #fff; font-size: 12.5px; font-family: inherit; }
.af-sheet-row .af-sheet-url { flex: 1; padding: 7px 9px; border: 1.5px solid #2f3f63; border-radius: 8px; background: #0a1020; color: #fff; font-size: 12.5px; font-family: inherit; }
.af-sheet-row .af-sheet-del { border: none; background: #3a2030; color: #fca5a5; border-radius: 7px; width: 30px; cursor: pointer; }
.aff-step { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; margin: 1px 2px; white-space: nowrap; }
.aff-step.ok { background: #dcfce7; color: #166534; }
.aff-step.no { background: #f1f5f9; color: #64748b; }
.aff-step.fail { background: #fee2e2; color: #b91c1c; }
.aff-judge-step { margin-left: 8px; flex: 0 0 auto; }
.aff-judge-list { max-height: 300px; overflow-y: auto; border: 1px solid #2f3f63; border-radius: 8px; padding: 6px 8px; background: #0a1020; }
.aff-judge-row { display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-size: 13px; color: #eef1ff; border-bottom: 1px solid #1a2740; }
.avatar-box .aff-judge-list { color: #eef1ff; }
.aff-funnel { background: #f5f7ff; border: 1px solid #e0e7ff; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.aff-funnel-head { font-size: 13.5px; font-weight: 700; color: #3730a3; margin-bottom: 8px; }
.aff-funnel-step { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.aff-funnel-lab { flex: 0 0 130px; font-size: 12.5px; color: #1f2933; }
.aff-funnel-bar { flex: 1; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.aff-funnel-bar > div { height: 100%; background: #6366f1; border-radius: 4px; }
.aff-funnel-n { flex: 0 0 90px; text-align: right; font-size: 12px; color: #4f46e5; font-weight: 600; }
.aff-pending { margin-top: 8px; font-size: 12.5px; color: #1f2933; line-height: 1.7; border-top: 1px dashed #c7d2fe; padding-top: 6px; }
.aff-miss { color: #b91c1c; font-size: 11px; }
.aff-tier { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin: 1px 1px; white-space: nowrap; }
.aff-tier.role-Affiliate { background: #fef3c7; color: #92400e; }
.aff-tier.role-KOL { background: #dbeafe; color: #1e40af; }
.aff-tier.role-Influencer { background: #f3e8ff; color: #6b21a8; }
.aff-tier.tier-plain { background: #eef2ff; color: #3730a3; }
.aff-tier.grade.ga { background: #dcfce7; color: #166534; }
.aff-tier.grade.gb { background: #fef9c3; color: #854d0e; }
.aff-tier.grade.gc { background: #fee2e2; color: #b91c1c; }
.aff-tier.grade.gn { background: #e5e7eb; color: #6b7280; }
.aff-pass { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.aff-pass.ok { background: #dcfce7; color: #166534; }
.aff-pass.no { background: #fee2e2; color: #b91c1c; }
.aff-rec { font-size: 11px; color: #4f46e5; margin-top: 3px; }
.aff-rec-chip { display: inline-block; font-size: 11px; background: #eef2ff; color: #3730a3; border-radius: 6px; padding: 1px 7px; margin: 1px 2px; }
/* Gantt แผนแคมเปญ */
.cp-gantt { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; margin: 4px 0; }
.cp-gantt-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.cp-gantt-lab { flex: 0 0 200px; font-size: 12px; color: #1f2933; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-gantt-track { flex: 1; height: 16px; background: #f1f5f9; border-radius: 4px; position: relative; }
.cp-gantt-bar { position: absolute; top: 2px; height: 12px; border-radius: 4px; min-width: 4px; }
.avatar-box .cp-assignee { padding: 5px 7px; border: 1.5px solid #cbd5e1; border-radius: 7px; font-size: 12px; font-family: inherit; max-width: 180px; }
.aff-auto-card { background: #0a1020; border: 1px solid #2f3f63; border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.aff-auto-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; color: #eef1ff; font-size: 13.5px; }
.aff-auto-result { background: #1a2740; border-radius: 8px; padding: 8px 10px; margin-top: 6px; font-size: 12.5px; color: #eef1ff; line-height: 1.6; max-height: 180px; overflow-y: auto; }
/* ตาราง/การ์ดในป๊อปอัปพื้นเข้ม — ใส่พื้นขาวให้อ่านออก */
.avatar-box .aff-table-wrap { background: #fff; border-radius: 8px; padding: 2px; margin: 4px 0; }
.avatar-box .aff-table td { color: #1f2933; }
.avatar-box .aff-cards { margin: 6px 0 10px; }
.avatar-box .aff-form-sec { color: #8ab4ff; }
.aff-goal { min-width: 120px; }
.aff-goal-n { font-size: 12px; color: var(--ink,#1f2933); margin-bottom: 3px; }
.aff-goal-n b { color: #4f46e5; }
.aff-goal-bar { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.aff-goal-bar > div { height: 100%; background: #4f46e5; border-radius: 3px; }
/* ผู้ช่วยการตลาดในเว็บ */
#mktAssistBtn { position: fixed; left: 22px; bottom: 22px; width: 54px; height: 54px; border-radius: 50%; border: none; background: linear-gradient(135deg,#6366f1,#8b5cf6); color: #fff; font-size: 24px; cursor: pointer; box-shadow: 0 6px 18px rgba(99,102,241,.45); z-index: 9000; display: none; align-items: center; justify-content: center; }
#mktAssistBtn:hover { transform: scale(1.06); }
#mktAssistPanel { position: fixed; left: 22px; bottom: 86px; width: 380px; max-width: calc(100vw - 44px); height: 540px; max-height: calc(100vh - 120px); background: #0f1a2e; border: 1px solid #2f3f63; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.5); z-index: 9001; flex-direction: column; overflow: hidden; }
.ma-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: #0a1020; color: #eef1ff; font-weight: 700; font-size: 14px; }
.ma-head .ma-x { background: none; border: none; color: #b9c2e0; font-size: 16px; cursor: pointer; }
.ma-modes { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid #2f3f63; }
.ma-mode { flex: 1; padding: 7px; border-radius: 8px; border: 1px solid #2f3f63; background: #0a1020; color: #b9c2e0; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.ma-mode.active { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.ma-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ma-hint { color: #8a96b8; font-size: 12.5px; text-align: center; padding: 16px 8px; }
.ma-row { font-size: 13px; line-height: 1.55; padding: 9px 12px; border-radius: 10px; max-width: 90%; word-wrap: break-word; }
.ma-user { align-self: flex-end; background: #4f46e5; color: #fff; }
.ma-bot { align-self: flex-start; background: #1a2740; color: #eef1ff; }
.ma-bot .ma-h { font-weight: 700; color: #8ab4ff; margin: 6px 0 2px; }
.ma-load { color: #b9c2e0; }
.ma-err { color: #fca5a5; }
.ma-input { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid #2f3f63; }
.ma-input textarea { flex: 1; resize: none; padding: 8px 10px; border: 1.5px solid #2f3f63; border-radius: 8px; background: #0a1020; color: #fff; font-family: inherit; font-size: 13px; }
.ma-input #maSend { padding: 0 16px; border: none; border-radius: 8px; background: #4f46e5; color: #fff; font-weight: 600; cursor: pointer; }
.ma-input #maSend:hover { background: #4338ca; }
.calendar-item.status-doing { border-left-color: #f59f00; background: #FFF8EC; }
.picker-item-status.doing { background: #FEF0E0; color: #B45309; }
.task-item-status.doing { background: #f59f00; }

.caption-preview, .notes-value {
  margin-bottom: 0;
  color: var(--ink-2);
  line-height: 1.55;
  font-size: 13px;
}

.platform-pills { display: flex; flex-wrap: wrap; gap: 5px; }

.post-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
}
.post-meta div { min-width: 0; }
.post-meta dt {
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.post-meta dd { margin: 2px 0 0; font-size: 13px; overflow-wrap: anywhere; }

.empty-state {
  grid-column: 1 / -1;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r2);
  padding: 40px 24px;
  color: var(--faint);
  text-align: center;
  font-size: 14px;
  background: var(--panel-alt);
}

/* ─── CALENDAR ───────────────────────────────────────────────── */
.calendar-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0 12px; gap: 10px;
}
.calendar-nav-center {
  display: flex; align-items: center; gap: 8px;
  flex: 1; justify-content: center;
}

.cal-select {
  padding: 6px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--r1);
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color .14s;
}
.cal-select:focus { border-color: var(--brand); }

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--faint);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-day {
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: 8px;
  background: var(--panel);
  transition: border-color .14s;
}
.calendar-day:hover { border-color: var(--line-2); }

.calendar-day.today {
  border-color: var(--brand);
  background: var(--brand-light);
}

.calendar-day strong {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.calendar-day.today strong { color: var(--brand); }

.calendar-item {
  margin-top: 4px;
  border-radius: var(--r1);
  border-left: 3px solid var(--accent);
  padding: 4px 7px;
  background: var(--accent-light);
  font-size: 11px;
  cursor: pointer;
  line-height: 1.4;
  transition: opacity .14s, transform .14s;
}
.calendar-item:hover { opacity: .8; transform: translateX(1px); }

.calendar-item.status-posted  { border-left-color: #065F46; background: #F0FDF4; }
.calendar-item.status-ready   { border-left-color: var(--brand); background: var(--brand-light); }
.calendar-item.status-review  { border-left-color: #D97706; background: #FFFBEB; }
.calendar-item.status-draft   { border-left-color: var(--faint); background: #F9FAFB; }

/* ─── LIBRARY ────────────────────────────────────────────────── */
.library-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.prompt-list { display: grid; gap: 10px; }

.prompt-card {
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: 14px;
  background: var(--panel);
  box-shadow: var(--s1);
  transition: box-shadow .14s;
}
.prompt-card:hover { box-shadow: var(--s2); }
.prompt-card h4 { margin-bottom: 5px; }
.prompt-card p { margin-bottom: 0; color: var(--muted); line-height: 1.5; font-size: 13px; }

.checklist { display: grid; gap: 10px; }
.checklist label {
  display: flex; align-items: flex-start;
  gap: 10px; color: var(--ink-2); font-weight: 500;
  font-size: 13px; line-height: 1.45;
}
.checklist input { width: 15px; height: 15px; margin-top: 2px; accent-color: var(--brand); }

/* ─── PUBLISH RESULT ─────────────────────────────────────────── */
.publish-result {
  border-radius: var(--r1); padding: 10px 13px;
  background: var(--panel-alt); color: var(--ink-2);
  font-size: 13px; line-height: 1.5; white-space: pre-line;
}
.publish-result.error   { background: #FEF2F2; color: var(--danger); }
.publish-result.success { background: #ECFDF5; color: #065F46; }
.reupload-prompt { display:flex; flex-direction:column; gap:6px; }
.reupload-prompt p { margin:0; }
.reupload-label {
  display:inline-flex; align-items:center; gap:6px; cursor:pointer;
  background:var(--danger); color:#fff; border-radius:var(--r1);
  padding:7px 14px; font-size:13px; font-weight:600;
  width:fit-content; transition: opacity .15s;
}
.reupload-label:hover { opacity:.85; }

/* ─── CAPTION BUILDER ────────────────────────────────────────── */
.cb-headline-wrap {
  display: grid; gap: 5px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.cb-headline-label {
  font-size: 11px; font-weight: 700; color: var(--brand-dark);
  text-transform: uppercase; letter-spacing: .05em;
}
.cb-headline-input {
  width: 100%; padding: 8px 12px;
  font-size: 13.5px; font-weight: 500;
  border: 1.5px solid var(--brand); border-radius: var(--r1);
  background: var(--brand-light); color: var(--ink); outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.cb-headline-input:focus {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.cb-headline-input::placeholder { color: var(--faint); font-weight: 400; }

.cb-product-picker {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.cb-product-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.cb-product-btn {
  border: 2px solid var(--pcolor, #ccc); border-radius: 999px; padding: 5px 13px;
  background: #fff; color: var(--pcolor, #333); font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: background .14s, color .14s, transform .1s;
}
.cb-product-btn:hover { background: var(--pcolor, #eee); color: #fff; }
.cb-product-btn.active { background: var(--pcolor, #333); color: #fff; transform: scale(1.04); }

.cb-product-divider {
  font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0 10px; letter-spacing: .02em;
}

.cb-wrap {
  border: 1.5px solid var(--brand); border-radius: var(--r2);
  overflow: hidden; background: var(--panel);
}
.cb-toggle {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 11px 16px; background: var(--brand-light);
  color: var(--brand-dark); font-size: 13.5px; font-weight: 700;
  cursor: pointer; list-style: none; user-select: none;
  transition: background .14s;
}
.cb-toggle::-webkit-details-marker { display: none; }
.cb-wrap[open] .cb-toggle { border-bottom: 1px solid var(--line); }
.cb-status { font-size: 12px; font-weight: 600; color: var(--muted); }

.cb-inner {
  padding: 16px;
  display: block;
}
.cb-sections { min-width: 0; }

.cb-loading { color: var(--muted); font-size: 13.5px; padding: 8px 0; }
.cb-section { display: grid; gap: 7px; }
.cb-section-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cb-section-label {
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.cb-selected-text {
  font-size: 13px; color: var(--brand-dark); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px;
}

.cb-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.cb-pill {
  border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 11px;
  background: var(--panel); color: var(--ink); font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: border-color .12s, background .12s, color .12s;
}
.cb-pill:hover { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); }
.cb-pill.selected { border-color: var(--brand); background: var(--brand); color: #fff; }
.cb-pill.cb-custom-trigger { border-style: dashed; border-color: var(--faint); color: var(--muted); }
.cb-pill.cb-custom-trigger:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.cb-custom-row { display: flex; gap: 6px; align-items: center; }
.cb-custom-row input {
  flex: 1; min-width: 0; padding: 7px 10px; font-size: 13px;
  border: 1.5px solid var(--brand); border-radius: var(--r1);
}
.cb-custom-row button {
  border: 1.5px solid var(--brand); border-radius: var(--r1); padding: 7px 12px;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 600;
}

.cb-preview-wrap {
  margin-top: 16px; padding-top: 16px;
  border-top: 2px solid var(--line);
  display: grid; gap: 10px; align-content: start;
}
.cb-preview-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.cb-clear-btn { border: 0; background: none; color: var(--danger); font-size: 12px; font-weight: 700; cursor: pointer; padding: 2px 5px; }
.cb-preview-text {
  min-height: 220px; border: 1.5px solid var(--line); border-radius: var(--r2);
  padding: 13px 15px; background: var(--panel-alt); font-size: 13.5px;
  line-height: 1.85; white-space: pre-wrap; color: var(--ink);
  overflow-y: auto; max-height: 460px;
}
.cb-preview-empty { color: var(--faint); font-style: italic; }
.cb-apply-btn { width: 100%; justify-content: center; }
.cb-apply-note { margin: 4px 0 0; font-size: 11.5px; color: var(--muted); font-style: italic; }

/* ─── BADGES ─────────────────────────────────────────────────── */
.badge-row { display: flex; flex-wrap: wrap; gap: 5px; min-height: 0; }
.badge-row:empty { display: none; }

.stage-badge, .format-badge, .pillar-badge {
  border-radius: 999px; padding: 2px 9px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .01em; white-space: nowrap;
}

.stage-badge.awareness    { background: #DBEAFE; color: #1E40AF; }
.stage-badge.consideration{ background: #D1FAE5; color: #065F46; }
.stage-badge.conversion   { background: #FED7AA; color: #9A3412; }
.stage-badge.retention    { background: #EDE9FE; color: #5B21B6; }

/* ─── CALENDAR FUNNEL COLORS ─────────────────────────────────── */
.calendar-item.funnel-awareness    { border-left-color: #1E40AF; background: #EFF6FF; }
.calendar-item.funnel-consideration{ border-left-color: #065F46; background: #F0FDF4; }
.calendar-item.funnel-conversion   { border-left-color: #9A3412; background: #FFF7ED; }
.calendar-item.funnel-retention    { border-left-color: #5B21B6; background: #F5F3FF; }

/* ─── CALENDAR LEGEND ────────────────────────────────────────── */
.cal-legend-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.legend-label { font-size: 11px; color: var(--muted); min-width: 52px; font-weight: 600; }
.funnel-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 11.5px; }

.funnel-legend-item { padding: 2px 8px; border-radius: 4px; border-left: 3px solid transparent; font-weight: 500; }
.funnel-legend-item.awareness    { border-left-color: #1E40AF; background: #EFF6FF; color: #1E40AF; }
.funnel-legend-item.consideration{ border-left-color: #065F46; background: #F0FDF4; color: #065F46; }
.funnel-legend-item.conversion   { border-left-color: #9A3412; background: #FFF7ED; color: #9A3412; }
.funnel-legend-item.retention    { border-left-color: #5B21B6; background: #F5F3FF; color: #5B21B6; }

.pillar-legend-item { padding: 2px 8px; border-radius: 4px; border-right: 3px solid transparent; font-weight: 500; }
.pillar-legend-item.education { border-right-color: #1E40AF; background: #EFF6FF; color: #1E40AF; }
.pillar-legend-item.product   { border-right-color: #B45309; background: #FFFBEB; color: #B45309; }
.pillar-legend-item.lifestyle { border-right-color: #BE185D; background: #FDF2F8; color: #BE185D; }
.pillar-legend-item.promotion { border-right-color: #C2410C; background: #FFF7ED; color: #C2410C; }
.pillar-legend-item.behind    { border-right-color: #7C3AED; background: #FAF5FF; color: #7C3AED; }
.pillar-legend-item.funnel-p  { border-right-color: #047857; background: #ECFDF5; color: #047857; }

/* ─── FORMAT / PILLAR BADGES ─────────────────────────────────── */
.format-badge.static { background: #E0F2FE; color: #0369A1; }
.format-badge.album  { background: #FEF9C3; color: #92400E; }

.pillar-badge { background: #F3F4F6; color: #6B7280; }
.pillar-badge.pillar-education    { background: #EFF6FF; color: #1E40AF; }
.pillar-badge.pillar-product      { background: #FFFBEB; color: #B45309; }
.pillar-badge.pillar-lifestyle    { background: #FDF2F8; color: #BE185D; }
.pillar-badge.pillar-promotion    { background: #FFF7ED; color: #C2410C; }
.pillar-badge.pillar-behind       { background: #FAF5FF; color: #7C3AED; }
.pillar-badge.pillar-funnel       { background: #ECFDF5; color: #047857; }
.pillar-badge.pillar-entertainment{ background: #FAF5FF; color: #7C3AED; }
.pillar-badge.pillar-brand        { background: #FFF1F2; color: #BE123C; }

/* ─── PILLAR RIGHT BORDER IN CALENDAR ───────────────────────── */
.calendar-item.pillar-cal-education    { border-right: 3px solid #1E40AF; }
.calendar-item.pillar-cal-product      { border-right: 3px solid #B45309; }
.calendar-item.pillar-cal-lifestyle    { border-right: 3px solid #BE185D; }
.calendar-item.pillar-cal-promotion    { border-right: 3px solid #C2410C; }
.calendar-item.pillar-cal-behind       { border-right: 3px solid #7C3AED; }
.calendar-item.pillar-cal-funnel       { border-right: 3px solid #047857; }
.calendar-item.pillar-cal-entertainment{ border-right: 3px solid #7C3AED; }
.calendar-item.pillar-cal-brand        { border-right: 3px solid #BE123C; }

/* ─── MOCK POST PREVIEW ──────────────────────────────────────── */
.post-preview-wrap { width: 100%; }

.preview-tabs { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
.preview-tab {
  padding: 4px 12px; border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--panel-alt); color: var(--muted);
  font-size: 12px; font-weight: 500; cursor: pointer; transition: all .13s;
}
.preview-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.preview-frame {
  border-radius: var(--r3); border: 1.5px solid var(--line);
  background: #fff; overflow: hidden; max-width: 360px; margin: 0 auto;
  display: flex; flex-direction: column; box-shadow: var(--s2);
}
.preview-frame.feed   .preview-media { aspect-ratio: 1/1; }
.preview-frame.reel   .preview-media,
.preview-frame.tiktok .preview-media,
.preview-frame.story  .preview-media { aspect-ratio: 9/16; max-height: 480px; }
.preview-frame.facebook .preview-media { aspect-ratio: 16/9; }

.preview-profile { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.preview-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.preview-username { font-size: 13px; font-weight: 600; flex: 1; }
.preview-more { font-size: 18px; color: var(--muted); cursor: pointer; }

.preview-media {
  width: 100%; background: var(--bg); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.preview-media img, .preview-media video, .preview-media iframe {
  width: 100%; height: 100%; object-fit: cover;
}
.preview-no-media { text-align: center; color: var(--muted); font-size: 13px; padding: 32px 16px; line-height: 1.6; }
.preview-ext-link { color: var(--brand); font-size: 14px; font-weight: 600; text-decoration: none; padding: 24px; }
.preview-actions { display: flex; gap: 16px; padding: 10px 14px; font-size: 20px; }
.preview-save { margin-left: auto; }
.preview-caption { padding: 4px 14px 6px; font-size: 13px; line-height: 1.55; color: var(--ink); }
.preview-hashtags { padding: 0 14px 12px; font-size: 12px; color: #4F46E5; font-weight: 500; }

.caption-direction-preview {
  margin: 0; color: var(--muted); font-size: 13px; font-style: italic; line-height: 1.5;
}
.caption-direction-preview:empty { display: none; }

/* ─── IMPORT BUTTON ──────────────────────────────────────────── */
#importBtn { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); }

/* ─── MODALS ─────────────────────────────────────────────────── */
.picker-overlay {
  position: fixed; inset: 0; background: rgba(17,24,39,.45);
  z-index: 1100; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.picker-overlay.visible { opacity: 1; pointer-events: all; }

.picker-modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -48%) scale(.97);
  width: min(540px, 94vw); max-height: 80vh;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r3); box-shadow: var(--s3);
  z-index: 1101; display: flex; flex-direction: column;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.picker-modal.open { opacity: 1; pointer-events: all; transform: translate(-50%, -50%) scale(1); }

.picker-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.picker-modal-head h3 { margin: 0; font-size: 15px; }
.picker-modal-head .eyebrow { margin: 0 0 2px; }

.picker-modal-body {
  display: flex; flex-direction: column; gap: 9px;
  padding: 14px 18px 20px; overflow-y: auto; flex: 1;
  background: var(--panel-alt); border-radius: 0 0 var(--r3) var(--r3);
}

.picker-search {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--line); border-radius: var(--r1);
  font-size: 13.5px; background: var(--panel); color: var(--ink); outline: none;
  transition: border-color .14s;
}
.picker-search:focus { border-color: var(--brand); }

.picker-new-btn {
  width: 100%; padding: 10px 14px;
  border: 1.5px dashed var(--brand); border-radius: var(--r2);
  background: transparent; color: var(--brand);
  font-size: 13.5px; font-weight: 600; cursor: pointer; text-align: left;
  transition: background .13s;
}
.picker-new-btn:hover { background: var(--brand-light); }

.picker-list { display: flex; flex-direction: column; gap: 6px; }
.picker-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 0; }

.picker-item {
  display: flex; flex-direction: column; gap: 5px;
  padding: 11px 14px; border: 1px solid var(--line);
  border-radius: var(--r2); cursor: pointer;
  transition: border-color .13s, background .13s; background: var(--panel);
}
.picker-item:hover { border-color: var(--brand); background: var(--brand-light); }
.picker-item-top { display: flex; align-items: center; gap: 8px; }
.picker-item-date {
  font-size: 11px; color: var(--muted); background: var(--panel-alt);
  border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; white-space: nowrap;
}
.picker-item-status { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 4px; }
.picker-item-status.posted  { background: #D1FAE5; color: #065F46; }
.picker-item-status.ready   { background: #DBEAFE; color: #1E40AF; }
.picker-item-status.review  { background: #FEF3C7; color: #92400E; }
.picker-item-status.draft   { background: #F3F4F6; color: #4B5563; }
.picker-item-title { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.picker-item-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.picker-item-platform {
  font-size: 11px; padding: 2px 7px; border-radius: 4px;
  background: var(--panel-alt); border: 1px solid var(--line); color: var(--muted);
}
.picker-item-format { font-size: 11px; padding: 2px 7px; border-radius: 4px; background: var(--brand-light); color: var(--brand); }

/* Headline row with picker */
.campaign-input-row { display: flex; gap: 8px; align-items: center; }
.campaign-input-row input { flex: 1; }
.campaign-input-row .cb-pick-btn { flex-shrink: 0; align-self: stretch; }

.cb-headline-row { display: flex; gap: 8px; align-items: flex-end; }
.cb-headline-row .cb-headline-input { flex: 1; }
.cb-pick-btn {
  flex-shrink: 0; padding: 8px 12px;
  border: 1.5px solid var(--line); border-radius: var(--r1);
  background: var(--panel); color: var(--ink-2);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: border-color .13s, background .13s;
}
.cb-pick-btn:hover { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }

/* ─── SYNC / GDRIVE MODALS ───────────────────────────────────── */
.sync-step {
  font-size: 13px; line-height: 1.6; padding: 12px 14px;
  background: var(--brand-light); border-radius: var(--r1);
  border-left: 3px solid var(--brand); color: var(--ink);
}
.sync-code-wrap { border: 1px solid var(--line); border-radius: var(--r1); overflow: hidden; }
.sync-code-wrap summary {
  padding: 9px 13px; font-size: 13px; font-weight: 600;
  cursor: pointer; background: var(--panel-alt); list-style: none;
}
.sync-code {
  margin: 0; padding: 12px 14px; font-size: 11.5px; line-height: 1.6;
  background: #1E1E2E; color: #CDD6F4;
  overflow-x: auto; max-height: 220px; white-space: pre;
}
.sync-label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.sync-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #065F46; color: #fff; padding: 10px 20px; border-radius: var(--r2);
  font-size: 13px; font-weight: 600; z-index: 2000;
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.sync-toast.show { opacity: 1; }

.gdrive-overlay {
  position: fixed; inset: 0; background: rgba(17,24,39,.45);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 200;
}
.gdrive-overlay.visible { opacity: 1; pointer-events: all; }

.gdrive-modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -48%) scale(.97);
  width: min(540px, 92vw); background: var(--panel);
  border-radius: var(--r3); box-shadow: var(--s3);
  z-index: 201; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.gdrive-modal.open { opacity: 1; pointer-events: all; transform: translate(-50%, -50%) scale(1); }

.gdrive-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--line);
}
.gdrive-modal-head h3 { margin: 0; font-size: 16px; }
.gdrive-modal-head .eyebrow { margin: 0 0 2px; }
.gdrive-modal-body { padding: 18px 22px 22px; display: grid; gap: 12px; }

.gdrive-format-tabs { display: flex; flex-direction: column; gap: 5px; margin: 6px 0 12px; }
.gdrive-format-tab {
  display: flex; flex-direction: column; gap: 2px; padding: 9px 13px;
  border: 1px solid var(--line); border-radius: var(--r1); background: var(--panel-alt);
}
.gdrive-format-tab strong { font-size: 13px; color: var(--ink); }
.gdrive-format-tab span  { font-size: 12px; color: var(--muted); line-height: 1.5; }
.gdrive-format-tab code  { font-size: 11px; background: var(--line); padding: 1px 5px; border-radius: 3px; }

.gdrive-hint { margin: 0; font-size: 13.5px; color: var(--ink); line-height: 1.5; }
.gdrive-sub  { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.gdrive-input {
  width: 100%; padding: 9px 13px; font-size: 13.5px;
  border: 1.5px solid var(--line); border-radius: var(--r1); outline: none;
  transition: border-color .14s;
}
.gdrive-input:focus { border-color: var(--brand); }
.gdrive-actions { display: flex; justify-content: flex-end; gap: 8px; }
.gdrive-result { padding: 10px 14px; border-radius: var(--r1); font-size: 13px; font-weight: 600; }
.gdrive-result.success { background: #ECFDF5; color: #065F46; }
.gdrive-result.error   { background: #FEF2F2; color: var(--danger); }

/* ─── BRIEF DRAWER ───────────────────────────────────────────── */
.brief-overlay {
  position: fixed; inset: 0; background: rgba(17,24,39,.38);
  z-index: 90; opacity: 0; pointer-events: none; transition: opacity .22s;
}
.brief-overlay.visible { opacity: 1; pointer-events: auto; }

.brief-drawer {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.96);
  width: min(560px, 94vw); max-height: 88vh; height: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--s3); z-index: 100;
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  overflow: hidden;
}
.brief-drawer.open { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }

.brief-drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--brand); color: #fff; flex-shrink: 0;
}
.brief-drawer-title { flex: 1; min-width: 0; }
.brief-day-label {
  margin: 0 0 4px; font-size: 11px; font-weight: 700;
  color: rgba(255,255,255,.65); text-transform: uppercase; letter-spacing: .05em;
}
.brief-drawer-head h3 { margin: 0 0 10px; font-size: 16px; line-height: 1.35; color: #fff; }
.brief-drawer-head .ghost-button {
  flex-shrink: 0; background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.25); color: #fff; margin-top: 2px;
}
.brief-drawer-head .ghost-button:hover { background: rgba(255,255,255,.25); }

.brief-body { flex: 1 1 auto; min-height: 0; overflow-y: scroll; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 16px 20px 20px; display: grid; gap: 12px; align-content: start; }
/* scrollbar เห็นชัด */
.brief-body::-webkit-scrollbar { width: 10px; }
.brief-body::-webkit-scrollbar-thumb { background: rgba(99,102,241,.45); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
.brief-body::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,.7); background-clip: padding-box; }
.brief-body::-webkit-scrollbar-track { background: transparent; }
.brief-body { scrollbar-width: thin; scrollbar-color: rgba(99,102,241,.5) transparent; }

/* Caption Direction — scrollbar ในกล่องตัวเอง (ข้อความยาวเลื่อนได้) */
.cd-scroll { max-height: 240px; overflow-y: auto; padding-right: 8px; }
.cd-scroll::-webkit-scrollbar { width: 9px; }
.cd-scroll::-webkit-scrollbar-thumb { background: rgba(99,102,241,.5); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
.cd-scroll::-webkit-scrollbar-track { background: rgba(99,102,241,.1); border-radius: 6px; }
.cd-scroll { scrollbar-width: thin; scrollbar-color: rgba(99,102,241,.55) rgba(99,102,241,.1); }

.brief-section { border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; }
.brief-section-head {
  padding: 7px 14px; background: var(--panel-alt);
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--line);
}
.brief-section-body {
  padding: 12px 14px 0 14px; font-size: 13.5px; line-height: 1.6; color: var(--ink); background: var(--panel);
  position: relative; min-height: 48px; overflow: visible; /* v428: ไม่ตัดเนื้อหา — resize จะ set overflow:auto ผ่าน JS */
}
/* v307: drag-to-resize handle */
.brief-resize-handle {
  display: flex; align-items: center; justify-content: center;
  height: 14px; margin: 8px -14px 0;
  background: var(--bg2, #f4f6fb); border-top: 1px solid var(--line, #e8eaf0);
  cursor: ns-resize; user-select: none; color: var(--muted, #9aa0b4); font-size: 12px;
  transition: background .15s;
}
.brief-resize-handle:hover { background: var(--primary-10, #ede9fe); color: var(--primary, #4f46e5); }
.brief-resize-dots { pointer-events: none; letter-spacing: 2px; }

.brief-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.brief-do .brief-section-head   { background: #ECFDF5; color: #065F46; border-color: #A7F3D0; }
.brief-dont .brief-section-head { background: #FEF2F2; color: var(--danger); border-color: #FCA5A5; }

.brief-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.brief-meta-item dt {
  font-size: 10.5px; font-weight: 700; color: var(--faint);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px;
}
.brief-meta-item dd { margin: 0; font-size: 13.5px; color: var(--ink); font-weight: 600; }

.brief-cta-box {
  border: 1px solid #FCD34D; border-radius: var(--r1);
  padding: 11px 14px; background: #FFFBEB; font-size: 13.5px;
  color: #92400E; line-height: 1.5;
}
.brief-no-caption {
  display: flex; flex-direction: column; gap: 4px;
  border: 1.5px dashed var(--line-2); border-radius: var(--r2);
  padding: 15px 17px; background: var(--panel-alt); color: var(--muted);
  font-size: 13px; line-height: 1.5;
}
.brief-no-caption span { font-weight: 600; color: var(--ink); font-size: 14px; }
.brief-no-caption small { font-size: 12px; color: var(--muted); }

/* ─── v426fix: preview-extra (multiple uploaded images strip) ─── */
.preview-extra-strip { display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto; background: #f8f8f8; }
.preview-extra-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 2px solid transparent; cursor: pointer; flex-shrink: 0; transition: border-color .15s; }
.preview-extra-thumb:hover { border-color: var(--brand); }

/* ─── v432: Brief View — new flat layout ────────────────────── */
.bv-wrap { display: flex; flex-direction: column; }
.bv-img { width: 100%; background: #f0f0f0; }
.bv-img img { width: 100%; height: auto; display: block; cursor: zoom-in; }
.bv-no-img { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 13px; background: #f8f9fc; border-bottom: 1px solid var(--line); }
.bv-no-img a { color: var(--brand); }
.bv-people-row { display: flex; align-items: stretch; background: #fff; border-bottom: 1px solid var(--line); }
.bv-person { flex: 1; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; min-width: 0; }
.bv-person-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.bv-person-name { font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bv-sep { width: 1px; background: var(--line); flex-shrink: 0; margin: 6px 0; }
.bv-section { padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.bv-label { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px; }
.bv-caption { font-size: 14px; line-height: 1.75; color: var(--ink); word-break: break-word; }
.bv-muted { font-size: 13px; color: var(--muted); font-style: italic; }
.bv-text { font-size: 13.5px; line-height: 1.65; color: var(--ink-2); word-break: break-word; }
.bv-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.bv-meta-item dt { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.bv-meta-item dd { font-size: 13px; font-weight: 600; color: var(--ink); margin: 0; }
.bv-do-dont { display: flex; border-bottom: 1px solid var(--line); }
.bv-do { flex: 1; padding: 12px 14px; background: #f0fdf4; border-right: 1px solid var(--line); }
.bv-dont { flex: 1; padding: 12px 14px; background: #fff5f5; }
.bv-do-lbl { font-size: 11px; font-weight: 700; margin-bottom: 6px; letter-spacing: .04em; }
.bv-ref-img { width: 100%; height: auto; display: block; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; margin-top: 6px; }
.bv-tags { font-size: 13px; color: #4f46e5; font-weight: 600; word-break: break-word; }
.bv-done-badge { padding: 14px 16px; background: #f0fdf4; border-bottom: 1px solid #86efac; color: #15803d; font-size: 13.5px; font-weight: 600; }
/* ─── brief-done-banner (legacy, keep for safety) ─────────── */
.brief-done-banner { display:flex;align-items:center;gap:10px;background:#052e16;border:1.5px solid #10b981;border-radius:10px;padding:12px 16px;color:#6ee7b7;font-size:13.5px;font-weight:600;margin-top:8px; }
.brief-done-icon { font-size: 18px; }

.brief-button {
  border: 1.5px solid #FCD34D; background: #FFFBEB;
  color: #92400E; font-weight: 700;
}
.brief-button:hover { background: #FEF9C3; }

/* ─── TODAY POPUP ────────────────────────────────────────────── */
.today-modal { max-width: 520px; max-height: 88vh; display: flex; flex-direction: column; }
.today-modal .gdrive-modal-head { flex: 0 0 auto; }
.today-modal .gdrive-modal-body { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.today-post-item {
  border: 1px solid var(--line); border-radius: var(--r2);
  padding: 14px 16px; margin-bottom: 10px; background: var(--panel);
  box-shadow: var(--s1);
}
.today-post-item.highlighted { border-color: var(--brand); background: var(--brand-light); }
.today-post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.today-post-time { font-size: 13px; font-weight: 700; color: var(--brand); min-width: 42px; }
.today-post-name { font-size: 14.5px; font-weight: 600; flex: 1; }
.today-post-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.today-post-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.today-postpone-panel {
  margin-top: 12px; padding: 12px; background: var(--panel-alt);
  border-radius: var(--r1); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
.today-postpone-label, .today-check-label {
  display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500;
}
.today-check-label { flex-direction: row; align-items: center; gap: 8px; }
.today-done-msg { margin-top: 8px; font-size: 13px; color: #065F46; font-weight: 600; }

/* ─── IDEA LIBRARY ───────────────────────────────────────────── */
.idea-library-section { grid-column: 1 / -1; }
.idea-card {
  border: 1px solid var(--line); border-radius: var(--r2);
  padding: 14px 16px; margin-bottom: 10px; background: var(--panel);
  box-shadow: var(--s1); transition: box-shadow .14s;
}
.idea-card:hover { box-shadow: var(--s2); }
.idea-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 10px; }
.idea-date { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.idea-orig-date { color: var(--brand); }
.idea-title { font-size: 14.5px; font-weight: 600; }
.idea-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.idea-platforms { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.idea-caption { font-size: 13px; color: var(--muted); margin: 0 0 10px; line-height: 1.5; white-space: pre-line; }
.idea-actions { display: flex; gap: 8px; }

/* ─── GENERIC MODAL ─────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--panel, #fff);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%; max-width: 480px;
  padding: 28px;
  animation: loginFadeIn .2s ease;
}
.modal-head { margin-bottom: 18px; }
.modal-head h3 { font-size: 1.1rem; font-weight: 700; margin: 0 0 6px; }
.modal-sub { color: var(--muted); font-size: 0.82rem; margin: 0; }
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ─── PAGE PICKER ────────────────────────────────────────────── */
.page-picker-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.page-picker-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px;
  border: 1.5px solid var(--line);
  cursor: pointer; transition: all .15s;
  user-select: none;
}
.page-picker-item:hover { border-color: var(--brand); background: var(--brand-light, #eef2ff); }
.page-picker-item.selected {
  border-color: var(--brand); background: var(--brand-light, #eef2ff);
}
.page-picker-check {
  width: 20px; height: 20px; border-radius: 6px;
  border: 2px solid var(--line); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; transition: all .15s;
}
.page-picker-item.selected .page-picker-check {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.page-picker-info { flex: 1; min-width: 0; }
.page-picker-name { font-weight: 600; font-size: 0.88rem; }
.page-picker-meta { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.page-picker-ig { display: inline-block; margin-left: 6px; color: #c2255c; }

/* ─── LOGIN SCREEN ───────────────────────────────────────────── */
/* ══ หน้า Login — ธีมอวกาศ Orbis (liquid glass + นีออน) ══ */

.login-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: #010828;
  display: flex; align-items: flex-start; justify-content: center;
  overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; /* v1212: จอเตี้ย/แนวนอน เลื่อนดูฟอร์มได้ */
  animation: loginFadeIn .5s ease;
}
@keyframes loginFadeIn { from { opacity: 0; } to { opacity: 1; } }
/* วิดีโอพื้นหลังเต็มจอ */
.login-bg-video {
  position: fixed; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0; opacity: .85;
}
.login-bg-tint {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, rgba(1,8,40,.35) 0%, rgba(1,8,40,.82) 70%, #010828 100%);
}
/* ดาว/เท็กซ์เจอร์จาง ๆ (self-contained ไม่พึ่งไฟล์) */
.login-stars {
  position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: .5;
  mix-blend-mode: lighten;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,.5), transparent),
    radial-gradient(1.5px 1.5px at 85% 20%, rgba(111,255,0,.5), transparent),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 55% 15%, rgba(255,255,255,.4), transparent);
}
/* liquid glass (ใช้ร่วมกับ .login-box) */
.liquid-glass {
  background: rgba(255,255,255,0.02);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: none; box-shadow: inset 0 1px 1px rgba(255,255,255,.1);
  position: relative; overflow: hidden;
}
.liquid-glass::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.4px;
  background: linear-gradient(180deg, rgba(255,255,255,.45) 0%, rgba(255,255,255,.15) 20%, rgba(255,255,255,0) 40%, rgba(255,255,255,0) 60%, rgba(255,255,255,.15) 80%, rgba(255,255,255,.45) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.login-box {
  position: relative; z-index: 5;
  width: 100%; max-width: 410px; margin: auto 16px;
  padding: 40px 38px 34px; text-align: center;
  border-radius: 28px;
}
.login-accent {
  display: block; font-family: 'Condiment', cursive; color: #6FFF00;
  font-size: 30px; line-height: 1; margin-bottom: 6px;
  transform: rotate(-2deg); mix-blend-mode: exclusion; opacity: .95;
}
.login-logo-wrap { margin: 4px 0 14px; }
.login-logo {
  width: 220px; max-width: 70%; height: auto; border-radius: 18px;
  background: transparent; padding: 0;
  filter: drop-shadow(0 4px 26px rgba(111,255,0,.3));
}
.login-title {
  font-family: 'Anton', sans-serif; color: #EFF4FF; font-size: 30px;
  font-weight: 400; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px;
}
.login-neon-bar { display: block; width: 56px; height: 6px; border-radius: 4px; margin: 0 auto 12px; background: #6FFF00; box-shadow: 0 0 14px rgba(111,255,0,.7); }
.login-sub { color: rgba(239,244,255,.55); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 26px; font-family: ui-monospace, monospace; }
.login-form  { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 11px; font-weight: 700; color: rgba(239,244,255,.6); letter-spacing: .08em; text-transform: uppercase;
  font-family: ui-monospace, monospace;
}
.login-input {
  padding: 12px 15px; border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04);
  color: #EFF4FF; font-size: 14.5px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
#loginBranch option { background: #0b1226; color: #eff4ff; } /* v1214: ตัวเลือกสาขาอ่านออกในลิสต์เลือก */
.login-input:focus {
  border-color: #6FFF00; background: rgba(111,255,0,.05);
  box-shadow: 0 0 0 3px rgba(111,255,0,.18);
}
.login-input::placeholder { color: rgba(239,244,255,.25); }
.login-btn {
  margin-top: 8px; padding: 14px 20px;
  background: #6FFF00; color: #010828; border: none; border-radius: 12px;
  font-family: 'Anton', sans-serif; font-size: 15px; font-weight: 400; letter-spacing: 1px; text-transform: uppercase; cursor: pointer;
  box-shadow: 0 4px 22px rgba(111,255,0,.4);
  transition: background .15s, box-shadow .2s, transform .12s, color .15s;
}
.login-btn:hover { background: #EFF4FF; color: #010828; box-shadow: 0 8px 30px rgba(111,255,0,.55); transform: translateY(-2px); }
.login-btn:active { transform: translateY(0); }
.login-btn-ghost {
  margin-top: 2px; padding: 11px 20px;
  background: transparent; color: rgba(239,244,255,.5);
  border: 1px solid rgba(255,255,255,.15); border-radius: 12px;
  font-family: ui-monospace, monospace; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; transition: all .15s;
}
.login-btn-ghost:hover { color: #6FFF00; border-color: rgba(111,255,0,.5); }
.user-badge { display:inline-block; font-size:0.65rem; font-weight:700; padding:1px 7px; border-radius:20px; vertical-align:middle; margin-left:4px; }
.user-badge.verified { background:#22c55e22; color:#22c55e; border:1px solid #22c55e55; }
.user-badge.personal { background:#f59e0b22; color:#f59e0b; border:1px solid #f59e0b55; }
.login-version { margin-top: 22px; font-family: 'Anton', sans-serif; font-size: 11px; color: rgba(239,244,255,.3); letter-spacing: 2.5px; text-transform: uppercase; }

/* ─── SIDEBAR LOGO / USER ────────────────────────────────────── */
.sidebar-logo {
  width: 76px; height: auto; display: block;
  border-radius: var(--r1); margin-bottom: 2px;
}

/* ─── RESPONSIVE / ฟิตตามอุปกรณ์ ─────────────────────────────── */
/* ปุ่มเมนูมือถือ + drawer (ซ่อนบนเดสก์ท็อป) */
.mobile-nav-toggle { display: none; }
.mobile-nav-backdrop { display: none; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 1fr; }
  /* sidebar = drawer เลื่อนเข้า/ออก */
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 1200;
    width: 264px; max-width: 84vw; height: 100vh;
    transform: translateX(-102%); transition: transform .25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-nav-backdrop { display: block; position: fixed; inset: 0; z-index: 1100; background: rgba(8,11,24,.5); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .mobile-nav-backdrop.show { opacity: 1; pointer-events: auto; }
  .mobile-nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    position: fixed; top: 12px; left: 12px; z-index: 1000;
    width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
    background: var(--panel); color: var(--ink); font-size: 20px; cursor: pointer;
    box-shadow: 0 2px 10px rgba(16,24,64,.12);
  }
  .workspace { padding-top: 64px; }   /* เว้นที่ให้ปุ่มเมนู */
  .form-grid, .platform-grid, .post-list, .library-layout, .ads-library-list, .ads-kpi-grid, .ads-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ads-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tasks-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 700px) {
  .workspace { padding: 64px 14px 16px; }
  .sidebar { padding: 16px; }
  .topbar, .section-head, .form-actions, .post-card-head {
    align-items: stretch; flex-direction: column;
  }
  .form-grid, .platform-grid, .post-list,
  .calendar-grid, .library-layout, .post-meta,
  .ads-filter-grid, .ads-kpi-grid, .ads-dashboard-grid, .ads-library-list,
  .tasks-grid, .o3-status-grid {
    grid-template-columns: 1fr !important;
  }
  .topbar-actions, .tasks-toolbar, .ai-btn-row, .ads-actions { flex-wrap: wrap; }
  /* โมดัล/ป๊อปอัพ ฟิตจอ */
  .avatar-box, .avatar-box-wide, .bjm-modal, .modal-box, .gdrive-modal { max-width: 94vw !important; width: 94vw !important; }
  .avatar-modal, .bjm-backdrop { padding: 10px; }
  /* ตารางเลื่อนแนวนอนได้ */
  .kpi-tbl, .mp-table, .ads-sheet-tbl, .cmp-tbl { display: block; overflow-x: auto; white-space: nowrap; }
  /* office controls */
  .o3-hint { flex-wrap: wrap; gap: 6px; }
  .o3-status-grid { gap: 8px; }
  /* น้องบอท ไม่บังเนื้อหา */
  #nbBtn .nb-btn-tx { display: none; }
}

/* จอเล็กมาก (มือถือแนวตั้ง) */
@media (max-width: 420px) {
  .login-box { padding: 30px 22px; }
  .login-title { font-size: 25px; }
  .login-logo { width: 180px; }
  h2, .topbar h2 { font-size: 18px; }
}

/* ═══════════════════════════════════════════════════════════════
   MEDIA PICKER — form
   ═══════════════════════════════════════════════════════════════ */
.media-picker-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}
.media-picker-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.media-picker-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
}
.media-picker-hint {
  font-size: 12px;
  color: var(--muted);
}

/* Drop zone */
.media-drop-zone {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: var(--r2);
  background: var(--panel-alt);
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  overflow: hidden;
}
.media-drop-zone:hover,
.media-drop-zone.drag-over {
  border-color: var(--accent);
  background: hsl(199 80% 96%);
}
.media-drop-zone.drag-over { box-shadow: 0 0 0 3px hsl(199 80% 85% / .4); }

.media-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  font-size: 0;
  pointer-events: none; /* label handles click */
}
.media-drop-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px;
  pointer-events: none;
}
.media-drop-icon { font-size: 22px; }
.media-drop-hint span { font-size: 13px; color: var(--ink-2); text-align: center; }
.media-drop-sub { font-size: 11px !important; color: var(--muted) !important; }

/* ─── Local Path Row (วิดีโอไฟล์ใหญ่) ─────────────────────────── */
.local-path-row {
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
}
.large-video-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2, #f8f9fa);
  border: 1.5px dashed var(--border, #dee2e6);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.large-video-label:hover {
  border-color: var(--accent, #4361ee);
  background: #f0f3ff;
}
.large-video-icon { font-size: 20px; }
.large-video-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent, #4361ee);
}
.large-video-hint {
  font-size: 11px;
  color: var(--muted, #aaa);
  margin-left: auto;
}
.large-video-selected {
  display: block;
  margin-top: 6px;
  padding: 6px 12px;
  background: #e9f5e9;
  border-radius: 6px;
  font-size: 12px;
  color: #2e7d32;
  font-weight: 600;
}
.media-pick-link {
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  pointer-events: all;
  text-decoration: underline;
}

/* Thumbnail grid in form */
.media-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.media-thumb-item {
  position: relative;
  width: 90px;
  border-radius: var(--r1);
  overflow: hidden;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.media-thumb-img {
  width: 90px;
  height: 72px;
  object-fit: cover;
  display: block;
}
.media-thumb-placeholder {
  width: 90px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.media-video-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 10px;
  border-radius: 4px;
  padding: 1px 4px;
}
.media-thumb-name {
  font-size: 10px;
  color: var(--ink-2);
  padding: 3px 4px;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: center;
}
.media-remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 10px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}
.media-thumb-item:hover .media-remove-btn { opacity: 1; }

/* ── Card media strip (post cards) ─────────────────────────── */
.card-media-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 6px;
}
.card-media-thumb {
  position: relative;
  width: 64px;
  height: 52px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  cursor: zoom-in;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.15s;
}
.card-media-thumb:hover img { opacity: 0.85; }
.card-media-video-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 9px;
  border-radius: 3px;
  padding: 1px 3px;
  pointer-events: none;
}
.card-media-no-thumb {
  font-size: 11px;
  color: var(--ink-2);
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  text-align: center;
}

/* ── Media Lightbox ─────────────────────────────────────────── */
.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.82);
}
.media-lightbox-box {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 90vw;
  max-height: 90vh;
  flex-direction: column;
}
.media-lb-content {
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-lb-img {
  max-width: 80vw;
  max-height: 75vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  object-fit: contain;
}
.media-lb-no-thumb {
  color: #fff;
  font-size: 60px;
  padding: 40px;
}
.media-lb-caption {
  color: rgba(255,255,255,.75);
  font-size: 13px;
  text-align: center;
  max-width: 60vw;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.media-lb-close,
.media-lb-prev,
.media-lb-next {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.media-lb-close:hover,
.media-lb-prev:hover,
.media-lb-next:hover { background: rgba(255,255,255,.3); }
.media-lb-close {
  position: absolute;
  top: -48px;
  right: 0;
  font-size: 16px;
}
.media-lightbox-box {
  flex-direction: row;
}
.media-lightbox-box > .media-lb-content { order: 2; }
.media-lightbox-box > .media-lb-prev   { order: 1; }
.media-lightbox-box > .media-lb-next   { order: 3; }
.media-lightbox-box > .media-lb-caption { display: none; }
.media-lightbox {
  flex-direction: column;
}
/* reapply column layout correctly */
.media-lightbox-box {
  flex-direction: column;
  position: relative;
}
.media-lightbox-box .media-lb-prev,
.media-lightbox-box .media-lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}
.media-lightbox-box .media-lb-prev { left: -50px; }
.media-lightbox-box .media-lb-next { right: -50px; }

/* ─── TODAY SECTION HEADER ──────────────────────────────────── */
.today-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(90deg, #EEF2FF 0%, #F5F3FF 100%);
  border: 1.5px solid #C7D2FE;
  border-radius: var(--r2);
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-dark);
  margin-bottom: 8px;
}
.today-dot {
  width: 10px; height: 10px;
  background: var(--brand);
  border-radius: 50%;
  animation: pulse-dot 1.8s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(1.4); }
}
.today-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  background: var(--brand);
  color: #fff;
  padding: 2px 10px;
  border-radius: 20px;
}
.other-posts-divider {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 4px 4px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

/* ─── AUTO POST TOGGLE ───────────────────────────────────────── */
.autopost-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  margin-bottom: 2px;
}
.autopost-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  min-width: 80px;
}
.autopost-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink-2);
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--line);
  background: var(--panel);
  transition: border-color .15s, background .15s;
}
.autopost-option input { display: none; }
.autopost-option.is-active.autopost-manual {
  border-color: #64748b;
  background: #f1f5f9;
  color: #334155;
}
.autopost-option.is-active.autopost-auto {
  border-color: #7c3aed;
  background: #ede9fe;
  color: #5b21b6;
  font-weight: 700;
}
.autopost-hint {
  font-size: 11.5px;
  color: var(--muted);
  flex: 1;
  min-width: 100%;
  padding-top: 2px;
}

/* ─── Auto Post topbar indicator ─────────────────────────── */
.autopost-indicator {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  background: #ede9fe !important;
  border-color: #7c3aed !important;
  color: #5b21b6 !important;
  font-weight: 700;
}
.autopost-queue-count {
  background: #7c3aed;
  color: white;
  border-radius: 20px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

/* ─── VISIBILITY TOGGLE ──────────────────────────────────────── */
.visibility-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  margin-bottom: 2px;
}
.visibility-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  min-width: 80px;
}
.vis-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink-2);
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  transition: border-color .15s, background .15s;
}
.vis-option input[type="radio"] { display: none; }
.vis-option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 600;
}


/* ═══════════════════════════════════════════════════════════════
   PLATFORM PUBLISH PICKER (popover)
   ═══════════════════════════════════════════════════════════════ */
.post-card { position: relative; }

.publish-picker {
  position: absolute;
  bottom: calc(100% - 36px);
  left: 0;
  z-index: 500;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r3);
  box-shadow: var(--s3);
  width: 240px;
  overflow: hidden;
  animation: pp-in 0.15s ease;
}
@keyframes pp-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--line);
}
.pp-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.pp-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
  cursor: pointer;
}
.pp-close:hover { color: var(--ink); }
.pp-options {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pp-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--r1);
  cursor: pointer;
  transition: background .12s;
  user-select: none;
  position: relative;
}
.pp-option:hover { background: var(--panel-alt); }
.pp-check { display: none; }
.pp-icon { font-size: 17px; line-height: 1; flex-shrink: 0; }
.pp-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  flex: 1;
}
/* Custom checkbox */
.pp-box {
  width: 17px; height: 17px;
  border-radius: 4px;
  border: 2px solid var(--line-2);
  background: var(--panel);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  transition: background .12s, border-color .12s;
}
.pp-option.is-checked {
  background: var(--brand-light);
}
.pp-option.is-checked .pp-box {
  background: var(--brand);
  border-color: var(--brand);
}
.pp-option.is-checked .pp-box::after { content: "✓"; }

.pp-footer {
  display: flex;
  gap: 6px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
  background: var(--panel-alt);
}
.pp-all, .pp-confirm {
  flex: 1;
  justify-content: center;
  font-size: 12px;
  min-height: 30px;
  padding: 5px 8px;
}
.pp-confirm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ─── Post Type Tag (in media picker header) ─────────────────── */
.post-type-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background .2s, color .2s;
  background: var(--surface2, #f1f3f5);
  color: var(--ink, #222);
  margin-left: auto;
  white-space: nowrap;
}
.post-type-tag[data-type="text"]  { background: #e9ecef; color: #495057; }
.post-type-tag[data-type="image"] { background: #d0ebff; color: #1864ab; }
.post-type-tag[data-type="album"] { background: #e3fafc; color: #0c8599; }
.post-type-tag[data-type="reel"]  { background: #fff0f6; color: #a61e4d; }
.post-type-tag[data-type="video"] { background: #f3f0ff; color: #5f3dc4; }


.cal-stats-total {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-muted, #666);
  margin-right: 4px;
}
.cal-stats-empty {
  font-size: 0.75rem;
  color: var(--ink-muted, #999);
  font-style: italic;
}
.cal-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: default;
  transition: transform .15s;
}
.cal-type-chip:hover { transform: scale(1.06); }
.cal-type-chip small { font-weight: 400; opacity: .75; font-size: 0.68rem; }
.cal-type-chip.type-text  { background: #e9ecef; color: #495057; }
.cal-type-chip.type-image { background: #d0ebff; color: #1864ab; }
.cal-type-chip.type-album { background: #e3fafc; color: #0c8599; }
.cal-type-chip.type-reel  { background: #fff0f6; color: #a61e4d; }
.cal-type-chip.type-video { background: #f3f0ff; color: #5f3dc4; }

/* ─── Post Type Row ──────────────────────────────────────────── */
.post-type-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 0 6px;
  border-top: 1px solid var(--border, #e9ecef);
}
.post-type-row-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted, #666);
  white-space: nowrap;
  min-width: 72px;
}
.post-type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  flex: 1;          /* ขยายเต็มช่องว่าง ดัน brief-btn ไปขวา */
  min-width: 0;
}
.pt-chip {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border, #dee2e6);
  background: var(--surface, #fff);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  color: var(--ink-muted, #555);
  white-space: nowrap;
}
.pt-chip:hover { border-color: var(--accent, #4361ee); color: var(--accent, #4361ee); }
.pt-chip.active[data-type="text"]  { background: #e9ecef; border-color: #868e96; color: #495057; }
.pt-chip.active[data-type="image"] { background: #d0ebff; border-color: #1971c2; color: #1864ab; }
.pt-chip.active[data-type="album"] { background: #e3fafc; border-color: #0c8599; color: #0c8599; }
.pt-chip.active[data-type="reel"]  { background: #fff0f6; border-color: #c2255c; color: #a61e4d; }
.pt-chip.active[data-type="video"] { background: #f3f0ff; border-color: #7048e8; color: #5f3dc4; }

/* ─── Post Type Lock ─────────────────────────────────────────── */
.pt-chips-locked .pt-chip {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}
.pt-lock-hint {
  font-size: 11px;
  color: var(--text-muted, #aaa);
  margin-top: 4px;
  display: none;
}
.pt-chips-locked-visible {
  display: block;
}

/* ─── Content Category Chips ─────────────────────────────────── */
.content-category-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cat-chip {
  padding: 5px 13px;
  border-radius: 20px;
  border: 1.5px solid var(--border, #e0e0e0);
  background: var(--surface, #fff);
  color: var(--text, #333);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.cat-chip:hover { border-color: var(--accent, #4361ee); color: var(--accent, #4361ee); }
.cat-chip.active[data-cat="Education"]  { background: #e3f2fd; border-color: #1565c0; color: #1565c0; }
.cat-chip.active[data-cat="Product"]    { background: #fce4ec; border-color: #c62828; color: #c62828; }
.cat-chip.active[data-cat="Lifestyle"]  { background: #f3e5f5; border-color: #6a1b9a; color: #6a1b9a; }
.cat-chip.active[data-cat="Promotion"]  { background: #fff3e0; border-color: #e65100; color: #e65100; }
.cat-chip.active[data-cat="Behind"]     { background: #e8f5e9; border-color: #2e7d32; color: #2e7d32; }

/* ─── Brief Toggle Button ─────────────────────────────────────── */
.brief-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border, #dee2e6);
  background: var(--surface, #fff);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  color: var(--ink-muted, #555);
  white-space: nowrap;
  margin-left: auto;
}
.brief-toggle-btn:hover,
.brief-toggle-btn.active {
  background: #fff9db;
  border-color: #f59f00;
  color: #e67700;
}
.brief-toggle-icon { font-size: 0.9em; }

/* ─── Inline Brief Section ────────────────────────────────────── */
.inline-brief-section {
  background: #fffdf0;
  border: 1.5px solid #ffe066;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: briefSlideIn .2s ease;
}
@keyframes briefSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.brief-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: #856404;
}
.brief-section-close {
  background: none;
  border: none;
  font-size: 0.75rem;
  color: #aaa;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background .15s;
}
.brief-section-close:hover { background: #ffe8cc; color: #e67700; }
.inline-brief-section .form-grid { gap: 10px; }
.inline-brief-section label { font-size: 0.8rem; }
.inline-brief-section input,
.inline-brief-section select,
.inline-brief-section textarea {
  font-size: 0.82rem;
  background: #fff;
}
/* ensure [hidden] always hides even if CSS sets display */
[hidden] { display: none !important; }

/* ─── Cal Stats Bar — two-row layout ─────────────────────────── */
.cal-type-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface2, #f8f9fa);
  border: 1px solid var(--border, #dee2e6);
  border-radius: 10px;
  margin-bottom: 10px;
}
.cal-stats-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.cal-stats-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-muted, #888);
  min-width: 48px;
}
/* Pillar chips */
.cal-pillar-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: default;
  background: color-mix(in srgb, var(--pc, #666) 15%, white);
  color: var(--pc, #444);
  border: 1px solid color-mix(in srgb, var(--pc, #666) 30%, transparent);
  transition: transform .15s;
}
.cal-pillar-chip:hover { transform: scale(1.06); }
.cal-pillar-chip small { font-weight: 400; opacity: .75; font-size: 0.68rem; }

/* ─── Planner Two-Column Layout ──────────────────────────────── */
.planner-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: start;
  margin-bottom: 18px;
}
@media (max-width: 900px) {
  .planner-layout { grid-template-columns: 1fr; }
  .post-preview-panel { position: static; }
}

/* ─── Preview Panel ───────────────────────────────────────────── */
.post-preview-panel {
  position: sticky;
  top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r3);
  padding: 14px;
  box-shadow: var(--s1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.preview-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.preview-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-muted, #666);
}
.preview-tabs {
  display: flex;
  gap: 4px;
}
.preview-tab {
  padding: 3px 10px;
  border-radius: 12px;
  border: 1.5px solid var(--border, #dee2e6);
  background: none;
  cursor: pointer;
  color: var(--ink-muted, #888);
  transition: all .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 10px;
}
.preview-tab.active {
  background: var(--accent, #4361ee);
  border-color: var(--accent, #4361ee);
  color: #fff;
}
.ptab-plat {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}
.ptab-account {
  font-size: 0.6rem;
  font-weight: 400;
  opacity: 0.75;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Connected indicator dot before account name */
.ptab-account.connected::before {
  content: "●";
  color: #40c057;
  margin-right: 2px;
  font-size: 0.55rem;
}
.preview-tab.active .ptab-account.connected::before { color: #a9e34b; }
.ptab-account.disconnected { opacity: 0.5; }

/* ─── Phone Frame ─────────────────────────────────────────────── */
.preview-phone {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}
.preview-card { font-size: 0.8rem; }

/* Post header */
.preview-post-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 6px;
}
.preview-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4361ee, #7209b7);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.preview-meta { flex: 1; line-height: 1.2; }
.preview-username { font-weight: 700; font-size: 0.75rem; }
.preview-time { font-size: 0.65rem; color: #999; }
.preview-more { color: #bbb; font-size: 1rem; margin-left: auto; cursor: default; }

/* Media box — aspect-ratio driven by data-media-type on previewCard */
.preview-media-box {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;           /* default: image = 1:1 */
  background: #111;
  overflow: hidden;
  transition: aspect-ratio 0.25s ease;
}
/* Video content → 9:16 portrait */
.preview-card[data-media-type="video"] .preview-media-box { aspect-ratio: 9/16; }
/* Image / album → 1:1 square */
.preview-card[data-media-type="image"] .preview-media-box,
.preview-card[data-media-type="album"] .preview-media-box { aspect-ratio: 1/1; }
/* No media → lighter bg */
.preview-card[data-media-type="none"]  .preview-media-box,
.preview-card:not([data-media-type])   .preview-media-box { background: #f0f0f0; }

/* ─── Facebook multi-image collage ───────────────────────────── */
.preview-fb-grid {
  position: absolute; inset: 0;
  display: grid; gap: 2px; background: #fff;
  grid-template-columns: 1fr 1fr;
}
.preview-fb-grid[data-count="1"] { grid-template-columns: 1fr; }
.preview-fb-grid[data-count="3"] .fb-grid-cell:first-child { grid-column: 1 / -1; }
.fb-grid-cell { position: relative; overflow: hidden; }
.fb-grid-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fb-grid-more {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); color: #fff; font-size: 30px; font-weight: 700;
}

/* ─── Album carousel nav ─────────────────────────────────────── */
.album-nav {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  padding: 0 6px;
}
.album-arrow {
  pointer-events: all;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(4px);
  color: #333;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  transition: background .15s, transform .1s;
}
.album-arrow:hover { background: #fff; transform: scale(1.1); }
.album-arrow:disabled { opacity: .3; cursor: default; transform: none; }

/* Slide counter (top-right badge) */
.album-counter {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  pointer-events: none;
  letter-spacing: .02em;
}

/* Dot indicators (bottom centre) */
.album-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  pointer-events: none;
}
.album-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
  transition: background .15s, transform .15s;
}
.album-dot.active {
  background: #fff;
  transform: scale(1.3);
}

.preview-media-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px; color: #bbb; font-size: 0.75rem;
}
.preview-media-empty span:first-child { font-size: 2rem; }
.preview-img, .preview-video {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.preview-video-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.2);
}
.preview-play-btn {
  width: 44px; height: 44px;
  border-radius: 50%; border: none;
  background: rgba(255,255,255,.85);
  font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.preview-play-btn:hover { transform: scale(1.1); }

/* Caption area */
.preview-caption-area {
  padding: 8px 10px;
  line-height: 1.5;
  font-size: 0.76rem;
}
.preview-caption-user { font-weight: 700; margin-right: 5px; }
.preview-caption-text { color: #222; white-space: pre-wrap; word-break: break-word; }
.preview-hashtags {
  color: #1877f2;
  font-size: 0.72rem;
  margin-top: 3px;
  word-break: break-word;
}

/* Reactions */
.preview-reactions {
  display: flex;
  border-top: 1px solid #f0f0f0;
  padding: 4px 0;
}
.preview-reactions span {
  flex: 1; text-align: center;
  font-size: 0.65rem; color: #666;
  padding: 4px;
  cursor: default;
}

/* ─── Cover Selector ──────────────────────────────────────────── */
.cover-selector {
  background: #f8f9fa;
  border-top: 1px solid #eee;
  padding: 8px 10px;
}
.cover-selector-head {
  display: flex; align-items: center;
  justify-content: space-between;
  font-size: 0.73rem; font-weight: 600; margin-bottom: 6px;
}
.cover-actions { display: flex; gap: 6px; }
.cover-btn {
  padding: 3px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border, #dee2e6);
  background: #fff;
  font-size: 0.68rem; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.cover-btn:hover { border-color: var(--accent,#4361ee); color: var(--accent,#4361ee); }
.cover-upload-label { display: inline-flex; align-items: center; }
.cover-frame-strip {
  display: flex; gap: 4px;
  overflow-x: auto; padding: 4px 0;
  scrollbar-width: thin;
}
.cover-frame {
  flex-shrink: 0;
  width: 52px; height: 36px;
  border-radius: 4px;
  border: 2px solid transparent;
  object-fit: cover; cursor: pointer; transition: border .15s;
}
.cover-frame.selected { border-color: var(--accent,#4361ee); }
.cover-thumb-preview {
  width: 100%; max-height: 80px;
  object-fit: cover; border-radius: 6px; margin-top: 4px;
}

/* ─── Composer margin fix (remove bottom margin, handled by layout) ── */
.planner-layout > .composer { margin-bottom: 0; padding: 24px; }

/* ─── Platform fieldset separator ──────────────────────────────── */
.composer fieldset {
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.composer fieldset legend {
  padding-right: 10px;
}

/* ─── Out-of-month posts popup ─────────────────────────────────── */
.oom-backdrop {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15, 25, 20, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.oom-modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 760px;
  max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,.3);
}
/* ตัวกรองช่องทางสื่อ */
.oom-chan-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 2px 22px 6px; font-size: 12.5px; color: var(--muted); }
.oom-chan-bar select { padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 13px; font-family: inherit; }
.oom-chan-head { font-size: 12.5px; font-weight: 800; color: var(--brand-dark, #3b46c4); background: var(--brand-light, #eef2ff); border-radius: 8px; padding: 5px 10px; margin: 10px 0 2px; position: sticky; top: 0; }
.oom-chip { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #e0e7ff; color: #3730a3; margin-left: 6px; vertical-align: middle; }
.oom-head { padding: 20px 22px 12px; }
.oom-head h3 { margin: 0 0 6px; font-size: 18px; }
.oom-head p { margin: 0; font-size: 13px; color: var(--muted); }

/* Auto-scheduler panel */
.oom-auto {
  margin: 4px 22px 8px; padding: 14px 16px;
  background: var(--brand-light, #eef2ff); border: 1.5px solid var(--brand, #5b6ef5);
  border-radius: 12px; display: grid; gap: 10px;
}
.oom-auto-title { font-weight: 700; font-size: 14px; color: var(--brand-dark, #3b46c4); }
.oom-preset-row { display: flex; flex-wrap: wrap; gap: 6px; }
.oom-preset {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
.oom-preset:hover { border-color: var(--brand); }
.oom-preset.active { background: var(--brand, #5b6ef5); color: #fff; border-color: var(--brand, #5b6ef5); }
.oom-auto-fields {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px;
}
.oom-auto-fields label {
  display: grid; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted);
}
.oom-auto-fields input {
  padding: 7px 8px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 13px;
}
.oom-apply-auto { width: 100%; justify-content: center; }

.oom-list { overflow-y: auto; padding: 6px 22px; }
.oom-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center; gap: 8px 14px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.oom-row-info { display: grid; gap: 2px; min-width: 0; }
.oom-row-title {
  font-weight: 700; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.oom-row-date { font-size: 12px; color: var(--muted); }
.oom-row-actions { display: flex; align-items: center; gap: 6px; }
.oom-date { padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 13px; width: 140px; }
.oom-row.is-locked .oom-date {
  background: #f1f3f5; color: var(--muted); border-style: dashed; cursor: not-allowed;
}
.oom-row.is-locked .oom-row-date { color: var(--brand-dark, #3b46c4); font-weight: 600; }
.oom-foot {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 14px 22px 18px; border-top: 1px solid var(--line);
}
.primary-button.small, .oom-row-actions .primary-button.small { padding: 6px 12px; font-size: 13px; }

@media (max-width: 560px) {
  .oom-row { grid-template-columns: 1fr; }
  .oom-row-actions { flex-wrap: wrap; }
}

/* ─── Team tasks board ─────────────────────────────────────────── */
.tasks-head { margin-bottom: 16px; }
.tasks-head h3 { margin: 0 0 4px; }
.tasks-sub { margin: 0; font-size: 13px; color: var(--muted); }
.tasks-board { display: block; }
.tasks-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  align-items: start;
}
/* v385 — approval banner in tasks view (table by name + priority color) */
.task-approval-box { border: 2px solid #e03c00; background: #fff3ee; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(224,60,0,.12); }
.task-approval-head { font-weight: 700; font-size: 14px; color: #c0290a; margin-bottom: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.task-approval-person { margin-bottom: 10px; }
.task-approval-person-name { font-weight: 700; font-size: 13px; color: #7a2010; margin-bottom: 4px; padding: 2px 0; border-bottom: 1px solid #f5b8a0; }
.task-approval-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.task-approval-table th { background: #fde0d0; color: #8a2000; font-weight: 600; padding: 5px 8px; text-align: left; border-bottom: 1px solid #f5b8a0; white-space: nowrap; }
.task-approval-row td { padding: 5px 8px; border-bottom: 1px dashed #f5cfc0; vertical-align: middle; }
.task-approval-row:last-child td { border-bottom: none; }
.task-approval-prio { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 20px; border: 1px solid; white-space: nowrap; }
.task-approval-jtitle { font-weight: 600; color: #1a1a2e; max-width: 260px; }
.task-approval-jmeta { color: #7a4030; white-space: nowrap; }
.task-approval-jdue { white-space: nowrap; font-size: 12px; color: #8a2000; }
.team-review-box { border: 1.5px solid #f59f00; background: #fff8e6; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.team-review-head { font-weight: 700; font-size: 14px; color: #b25c00; margin-bottom: 8px; }
.team-review-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px dashed #f0d9a0; font-size: 13px; flex-wrap: wrap; }
.team-review-item.is-mine { font-weight: 600; }
.team-review-item a { color: var(--brand, #5b6ef5); font-weight: 600; white-space: nowrap; }

.bj-ref-preview img { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); margin-top: 4px; }
.bj-team-hint { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; font-weight: 400; }
.bj-autoswitch { font-size: 13px; color: var(--ink); font-weight: 500; cursor: pointer; line-height: 1.4; }
.bj-team-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: #3730a3; background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
.bj-ref-thumb { width: 100%; max-height: 160px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); margin: 6px 0; cursor: zoom-in; }
.bj-dates { font-size: 11.5px; color: var(--muted); margin: 3px 0; }
.bj-subs { margin: 8px 0; padding: 8px 10px; background: var(--panel-alt); border-radius: 8px; font-size: 12.5px; }
.bj-sub { padding: 3px 0; }
.bj-submit { margin: 6px 0; font-size: 13px; }
.bj-submit summary { cursor: pointer; font-weight: 600; color: var(--brand-dark, #3b46c4); }
.bj-submit-body { display: grid; gap: 6px; margin-top: 6px; }
.bj-submit-body select, .bj-submit-body input { border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 13px; }
.task-col {
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--panel);
  overflow: hidden; display: flex; flex-direction: column;
}
.task-col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--brand-light, #eef2ff);
  border-bottom: 1px solid var(--line);
}
.task-owner { font-weight: 700; font-size: 14px; color: var(--brand-dark, #3b46c4); }
.task-total { font-size: 12px; color: var(--muted); font-weight: 600; }
.task-stats { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 14px 4px; }
.task-stat {
  font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: #eef0f3; color: #555;
}
.task-stat.draft   { background: #f1f3f5; color: #687076; }
.task-stat.review  { background: #fff4e0; color: #b25c00; }
.task-stat.ready   { background: #e3f0ff; color: #1565c0; }
.task-stat.posted  { background: #e3f7e8; color: #1b7a3d; }
.task-items { padding: 8px 14px 14px; display: grid; gap: 7px; }
.task-item {
  display: grid; grid-template-columns: 10px 1fr auto; align-items: center;
  gap: 4px 8px; padding: 7px 0; border-bottom: 1px dashed var(--line);
}
.task-item:last-child { border-bottom: 0; }
.task-item-status { width: 9px; height: 9px; border-radius: 50%; background: #ccc; }
.task-item-status.draft  { background: #adb5bd; }
.task-item-status.review { background: #f59f00; }
.task-item-status.ready  { background: #1565c0; }
.task-item-status.posted { background: #2f9e44; }
.task-item-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-item-date { font-size: 11px; color: var(--muted); white-space: nowrap; }
.task-item-plats { grid-column: 2 / -1; font-size: 11px; color: var(--brand, #5b6ef5); }
.task-item-carry { grid-column: 2 / -1; width: fit-content; font-size: 9px; font-weight: 700; background: #fef3c7; color: #b45309; border-radius: 6px; padding: 1px 6px; margin-top: 1px; }
.task-sub-label { font-size: 11px; font-weight: 700; color: var(--muted); margin: 8px 14px 2px; }
summary.task-sub-label { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 7px; user-select: none; }
summary.task-sub-label::-webkit-details-marker { display: none; }
summary.task-sub-label::before { content: "▼"; font-size: 13px; color: var(--brand, #6366f1); transition: transform .15s; display: inline-block; }
.task-sec:not([open]) > summary.task-sub-label::before { transform: rotate(-90deg); }
summary.task-sub-label:hover { color: var(--brand, #6366f1); }
summary.task-sub-label:hover::before { color: var(--brand-dark, #3b46c4); }
.task-job { cursor: pointer; border-radius: 6px; }
.task-job:hover { background: var(--brand-light, #eef2ff); }
.task-item { position: relative; }
.task-del-btn {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  opacity: 0; background: none; border: none; cursor: pointer;
  color: #ef4444; font-size: 14px; padding: 2px 4px; border-radius: 4px;
  line-height: 1; transition: opacity .15s; pointer-events: none;
}
.task-item:hover .task-del-btn { opacity: 1; pointer-events: auto; }
.task-del-btn:hover { background: #fee2e2; }
.task-item-status.todo { background: #adb5bd; }
.task-item-status.doing { background: #f59f00; }
.task-item-status.done { background: #2f9e44; }

/* ─── Brief jobs (Marketplace/อื่นๆ) ───────────────────────────── */
.bj-layout { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; transition: grid-template-columns .2s ease; }
/* เมื่อหุบคิวงาน → ฟอร์มบรีฟยืดเต็ม คิวเหลือแถบบางด้านขวา */
.bj-layout:has(.bj-queue.collapsed) { grid-template-columns: 1fr auto; }
.bj-queue.collapsed { min-width: 0; }
.bj-queue.collapsed .section-head { flex-direction: column; align-items: stretch; gap: 6px; }
@media (max-width: 860px) { .bj-layout, .bj-layout:has(.bj-queue.collapsed) { grid-template-columns: 1fr; } }
.bj-form label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.bj-form input, .bj-form select, .bj-form textarea {
  width: 100%; box-sizing: border-box; border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; font-family: inherit;
}
.bj-list { display: grid; gap: 10px; }
.bj-card { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel); }
.bj-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.bj-card-head strong { font-size: 14.5px; }
.bj-status { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.bj-status.todo { background: #f1f3f5; color: #687076; }
.bj-status.doing { background: #fff4e0; color: #b25c00; }
.bj-status.review { background: #e3f0ff; color: #1565c0; }
.bj-status.done { background: #e3f7e8; color: #1b7a3d; }
.bj-meta { font-size: 12px; color: var(--muted); margin: 5px 0; }
.bj-brief { font-size: 13px; line-height: 1.55; margin: 6px 0; white-space: pre-wrap; }
.bj-link { font-size: 12.5px; color: var(--brand, #5b6ef5); font-weight: 600; }
.bj-actions { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.bj-actions select { border: 1.5px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: 12.5px; }

/* 🏆 แรงค์ & รางวัล */
.lb-reward { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg,#fff3bf,#ffe8cc); border: 1px solid #ffd43b; border-radius: 12px; padding: 12px 14px; margin: 8px 0 6px; color: #5c3c00; }
.lb-reward-ic { font-size: 32px; }
.lb-reward b { font-size: 15px; }
.lb-reward-sub { font-size: 11.5px; color: #87642a; margin-top: 2px; }
.lb-reward-empty { display: block; color: #8a6d3b; font-size: 13px; }
.lb-list { display: grid; gap: 6px; }
.lb-row { display: grid; grid-template-columns: 36px 1fr auto 22px; grid-template-areas: "m n p t" "m b b b" ". d d d"; align-items: center; gap: 2px 8px; background: #0e1426; border: 1px solid #243154; border-radius: 9px; padding: 8px 12px; color: #e6eefc; }
.lb-row.top1 { background: linear-gradient(135deg,#1a2540,#243154); border-color: #ffd43b; }
.lb-row.is-me { outline: 2px solid #6366f1; }
.lb-medal { grid-area: m; font-size: 20px; font-weight: 800; text-align: center; color: #cfe0ff; }
.lb-name { grid-area: n; font-weight: 700; }
.lb-pts { grid-area: p; font-weight: 800; color: #ffd43b; }
.lb-break { grid-area: b; font-size: 11px; color: #9fb6dd; }
.lb-det-toggle { grid-area: t; background: none; border: none; color: #7a8eb0; cursor: pointer; font-size: 14px; padding: 0; line-height: 1; text-align: center; }
.lb-det-toggle:hover { color: #ffd43b; }
.lb-detail { grid-area: d; font-size: 11.5px; color: #9fb6dd; border-top: 1px solid #1e2d4a; padding-top: 6px; margin-top: 4px; }
.lb-det-row { margin-bottom: 4px; line-height: 1.6; }
.lb-det-chip { display: inline-block; background: #1a2540; border: 1px solid #2a3a5a; border-radius: 5px; padding: 1px 8px; margin: 2px 3px 2px 0; font-size: 11px; color: #b9c2e0; }
.lb-formula { background: #0a1020; border: 1px solid #1e2d4a; border-radius: 8px; padding: 9px 12px; margin-bottom: 8px; font-size: 12px; color: #9fb6dd; line-height: 1.7; }
.lb-formula-row { color: #b9c2e0; }
.lb-formula-hint { font-size: 11px; color: #5a7099; margin-top: 3px; font-style: italic; }
.lb-shop { display: grid; gap: 6px; }
.lb-shop-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #0e1426; border: 1px solid #243154; border-radius: 9px; padding: 8px 12px; color: #e6eefc; font-size: 13px; }
.lb-cost { color: #ffd43b; font-weight: 700; margin-left: auto; margin-right: 8px; }
.lb-headcfg { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.lb-headcfg summary { cursor: pointer; font-weight: 700; color: #cfe0ff; }
.lb-cfg-sec { margin: 10px 0; padding: 10px; background: #0e1426; border: 1px solid #243154; border-radius: 8px; }
.lb-cfg-sec b { display: block; margin-bottom: 6px; color: #e6eefc; font-size: 12.5px; }
.lb-cfg-sec .ads-tool-row { margin-bottom: 8px; }
.lb-cfg-sec .ads-tool-row input { background: #16203a; color: #fff; border-color: #2f3f63; }
.lb-cfg-sec button { margin: 4px 6px 0 0; }
.lb-headcfg .ads-tool-row { gap: 8px; }
/* แบนเนอร์รางวัลในหน้า Office */
.o3-reward-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; background: linear-gradient(135deg,#fff3bf,#ffe8cc); border: 1px solid #ffd43b; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; color: #5c3c00; }
.o3-reward-more { margin-left: auto; background: #5c3c00; color: #fff; border: none; border-radius: 6px; padding: 4px 10px; font-size: 11.5px; cursor: pointer; }
.o3-rankbadge { position: absolute; top: -4px; left: -2px; font-size: 15px; z-index: 6; }
.o3-scard-fig { position: relative; }
.o3-scard-pts { margin-left: auto; font-size: 10.5px; font-weight: 700; color: #ffb15d; }
/* จัดการทีม/องค์กร */
.tm-team { border: 1px solid #243154; background: #0e1426; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.tm-team-head { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.tm-team-head input { border: 1.5px solid #2f3f63; border-radius: 7px; padding: 7px 9px; background: #16203a; color: #fff; font-size: 13px; }
.tm-name { flex: 2; min-width: 140px; } .tm-org { flex: 1; min-width: 110px; }
.tm-del { background: none; border: none; cursor: pointer; font-size: 15px; }
.tm-members { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-mem { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: #cfe0ff; background: #16203a; border: 1px solid #2a3a5e; border-radius: 999px; padding: 3px 10px; cursor: pointer; }
#taskTeamFilter { border: none; font: inherit; background: transparent; color: var(--text, #1c2430); }
.queue-toggle { margin-left: auto; }
.bj-queue.collapsed #bjList { display: none; }
.bj-queue.collapsed #bjFilter, .bj-queue.collapsed #bjQAssignee { display: none; }
.bj-alert { border: 1.5px solid #f59f00; background: #fff8e6; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.bj-alert-head { font-weight: 700; font-size: 14px; color: #b25c00; margin-bottom: 8px; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; user-select: none; }
.bj-alert-head::-webkit-details-marker { display: none; }
.bj-alert-head::before { content: "▾"; display: inline-block; transition: transform .15s; font-size: 12px; }
.bj-alert:not([open]) .bj-alert-head { margin-bottom: 0; }
.bj-alert:not([open]) .bj-alert-head::before { transform: rotate(-90deg); }
.bj-alert-toggle { margin-left: auto; font-size: 11px; font-weight: 600; color: #b25c00; background: rgba(245,159,0,.15); border-radius: 999px; padding: 2px 10px; }
.bj-alert-item { padding: 8px 0; border-top: 1px dashed #f0d9a0; font-size: 13px; }
.bj-alert-item small { color: var(--muted); }
.bj-alert-jobs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.bj-alert-job { font-size: 12px; background: #fff; border: 1px solid #f0d9a0; border-radius: 999px; padding: 3px 8px; display: inline-flex; align-items: center; gap: 6px; }
.bj-alert-shift { border: 0; background: var(--brand, #5b6ef5); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 11px; cursor: pointer; }
.bj-alert-ok { margin-top: 6px; border: 1.5px solid #2f9e44; background: #fff; color: #1b7a3d; border-radius: 8px; padding: 4px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.bj-alert-ok:hover { background: #e3f7e8; }

/* compact queue rows */
.bj-row {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--panel);
  padding: 10px 12px; cursor: pointer; font: inherit; transition: border-color .12s, background .12s;
}
.bj-row:hover { border-color: var(--brand, #5b6ef5); background: var(--brand-light, #eef2ff); }
.bj-count-bar { font-size: 12px; font-weight: 600; color: #5b6ef5; background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 8px; padding: 5px 12px; margin-bottom: 8px; }
.bj-count-filter { font-weight: 400; color: #7a8eb0; }
/* ── Approval Workflow v380 ── */
.bj-approval-form-wrap { margin: 8px 0; padding: 10px 12px; background: #fefce8; border: 1.5px solid #fde047; border-radius: 8px; }
.bj-approval-form-label { font-size: 12px; font-weight: 700; color: #854d0e; margin-bottom: 6px; }
.bj-approval-select { width: 100%; padding: 7px 10px; border: 1px solid #fde047; border-radius: 6px; background: #fff; color: #854d0e; font-size: 13px; font-weight: 600; }
.bj-approval-pending { background: #fffbeb; border: 1.5px solid #fbbf24; border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.bj-approval-header { font-size: 12px; font-weight: 700; color: #92400e; margin-bottom: 8px; }
.bj-approval-card { background: #fff; border: 1px solid #fde68a; border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bj-approval-info { flex: 1; min-width: 0; }
.bj-approval-title { font-size: 13px; font-weight: 600; color: #1e293b; overflow-wrap: break-word; } /* v444: ห้ามตัดย่อ — อนุญาตให้ wrap */
.bj-approval-by { font-size: 11px; color: #92400e; margin-top: 2px; }
.bj-approve-btn { background: #10b981; color: #fff; border: none; border-radius: 6px; padding: 4px 12px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.bj-approve-btn:hover { background: #059669; }
.bj-reject-btn { background: #ef4444; color: #fff; border: none; border-radius: 6px; padding: 4px 12px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.bj-reject-btn:hover { background: #dc2626; }
.bj-my-pending-wrap { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.bj-my-pending-header { font-size: 12px; font-weight: 700; color: #0369a1; margin-bottom: 6px; }
.bj-my-pending { background: #fff; border: 1px solid #bae6fd; border-radius: 7px; padding: 7px 10px; margin-bottom: 5px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bj-my-rejected { border-color: #fca5a5; background: #fff5f5; }
.bj-my-pending-status { font-size: 11px; color: #0369a1; }
.bj-row.bj-row-rejected { border-color: #f0a500; border-width: 2px; background: #fff8ec; flex-wrap: wrap; animation: bj-reject-glow 2s ease-in-out 3; }
@keyframes bj-reject-glow { 0%,100% { box-shadow: none; } 50% { box-shadow: 0 0 0 3px #fbbf2455; } }
.bj-row-reject-note { width: 100%; font-size: 12px; color: #b35a00; margin-top: 2px; text-align: left; white-space: normal; }
.bj-row-reject-by { color: #999; font-size: 11px; }
/* v617: Task board bulk select */
.task-sel-icon { display: none; flex: 0 0 auto; margin-right: 4px; font-size: 15px; color: #6366f1; }
.tasks-board.task-select-mode .task-sel-icon { display: inline; }
/* v897: fix task row layout — คอลัมน์คงที่ ไม่เลื่อนเวลาเปิดโหมดเลือก */
.task-item:not(.kb-card) { grid-template-columns: 0 10px 1fr auto; }
.tasks-board.task-select-mode .task-item:not(.kb-card) { grid-template-columns: 18px 10px 1fr auto; }
.task-item:not(.kb-card) > .task-sel-icon { grid-column: 1; margin-right: 0; }
.task-item:not(.kb-card) > .task-item-status { grid-column: 2; }
.task-item:not(.kb-card) > .task-item-title { grid-column: 3; }
.task-item:not(.kb-card) > .task-item-date { grid-column: 4; }
.task-item:not(.kb-card) > .task-item-plats { grid-column: 3 / -1; }
.task-item:not(.kb-card) > .task-item-carry { grid-column: 3 / -1; }
.task-item.task-item-sel { background: rgba(99,102,241,.12) !important; border-color: #6366f1 !important; }
#taskBulkDeleteBar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #f0f0ff; border: 1px solid #c7d2fe; border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
/* v616: Bulk select mode */
.bj-sel-icon { display: none; flex: 0 0 auto; margin-right: 4px; font-size: 15px; color: #6366f1; }
.bj-list.bj-select-mode .bj-sel-icon { display: inline; }
.bj-row.bj-row-sel { background: rgba(99,102,241,.12) !important; border-color: #6366f1 !important; }
#bjBulkDeleteBar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #f0f0ff; border: 1px solid #c7d2fe; border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.bj-bulk-count { color: #4338ca; font-weight: 600; }
/* v429: Review Schedule Widget */
.rv-sched-wrap { background: #f0f6ff; border: 1.5px solid #bfdbfe; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.rv-sched-title { font-size: 13px; font-weight: 800; color: #1e40af; margin-bottom: 10px; }
.rv-sched-sub { font-size: 11.5px; font-weight: 500; color: #60a5fa; margin-left: 6px; }
.rv-session { border-radius: 9px; overflow: hidden; margin-bottom: 8px; border: 1px solid #dbeafe; background: #fff; }
.rv-session:last-child { margin-bottom: 0; }
.rv-session-past { opacity: .65; border-color: #e2e8f0; }
.rv-session-head { display: flex; align-items: center; gap: 8px; background: #eff6ff; padding: 7px 12px; font-size: 12.5px; }
.rv-session-time { font-weight: 800; color: #1d4ed8; }
.rv-session-day { color: #64748b; font-size: 11.5px; }
.rv-session-count { margin-left: auto; background: #dbeafe; color: #1e40af; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 20px; }
.rv-past-tag { font-size: 11px; color: #94a3b8; }
.rv-session-jobs { padding: 6px 10px 8px; display: flex; flex-direction: column; gap: 4px; }
.rv-job { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); padding: 3px 4px; border-radius: 5px; }
.rv-job-mine { background: #fefce8; border: 1px solid #fde68a; }
.rv-pos { font-size: 11px; font-weight: 800; color: #3b82f6; min-width: 26px; }
.rv-job-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-job-by { font-size: 11px; color: #94a3b8; white-space: nowrap; }
.rv-mine-tag { font-size: 10.5px; font-weight: 700; color: #d97706; white-space: nowrap; }
/* badge บนแถวงานในคิว */
.rv-row-badge { display: inline-flex; align-items: center; gap: 3px; background: #dbeafe; color: #1d4ed8; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 20px; margin-left: 6px; vertical-align: middle; white-space: nowrap; }

/* v381: Approval session popup | v421: กว้างขึ้น + scroll ชัด */
.bj-asession-box { background: #0f1a2e; border-radius: 16px; padding: 22px 24px; min-width: 340px; max-width: 720px; width: 94vw; max-height: 90vh; overflow-y: scroll; color: #eef1ff; scrollbar-width: thin; scrollbar-color: #3a6fd6 #0f1a2e; }
/* v801: ขยายกล่องคิวรออนุมัติ — ชนะ .avatar-box (width:min(420px,92vw)) ด้วย specificity สองคลาส */
.avatar-box.bj-asession-box { width: min(860px, 95vw); max-width: 860px; }
.bj-asession-box::-webkit-scrollbar { width: 6px; }
.bj-asession-box::-webkit-scrollbar-track { background: #0f1a2e; border-radius: 10px; }
.bj-asession-box::-webkit-scrollbar-thumb { background: #3a6fd6; border-radius: 10px; }
.bj-asession-head { font-size: 16px; font-weight: 800; color: #eef1ff; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.bj-asession-close { margin-left: auto; background: none; border: none; color: #b9c2e0; font-size: 18px; cursor: pointer; line-height: 1; }
.bj-asession-close:hover { color: #fff; }
.bj-asession-section-hd { font-size: 12px; font-weight: 700; color: #7c91c7; text-transform: uppercase; letter-spacing: 0.05em; margin: 10px 0 6px; }
.bj-asession-list { display: flex; flex-direction: column; gap: 12px; }
.bj-asession-card { background: #172038; border: 1px solid #2a3a5c; border-radius: 10px; padding: 16px 18px; }
.bj-asession-card-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.bj-asession-title { font-size: 15px; font-weight: 700; color: #eef1ff; flex: 1; }
.bj-asession-meta { font-size: 11px; color: #7c91c7; margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.bj-asession-info { font-size: 12.5px; color: #b9c2e0; margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 10px; }
.bj-asession-brief { font-size: 13px; color: #c4cfe8; background: #0a1020; border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; white-space: pre-wrap; line-height: 1.7; border-left: 3px solid #2a4a7a; }
.bj-asession-link { font-size: 12px; color: #60a5fa; word-break: break-all; }
.bj-asession-link:hover { color: #93c5fd; text-decoration: underline; }
.bj-asn-link-row { font-size: 12px; color: #9fb6dd; background: rgba(96,165,250,.08); border: 1px solid rgba(96,165,250,.2); border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; word-break: break-all; }
.bj-asn-items-wrap { border: 1px solid #1e3a5f; border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.bj-asn-item { padding: 8px 10px; border-bottom: 1px solid #1a2d4a; background: #0a1020; }
.bj-asn-item:last-child { border-bottom: none; }
.bj-asn-item-head { font-size: 12.5px; margin-bottom: 3px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.bj-asn-item-num { color: #7f8aa6; font-size: 11px; }
.bj-asn-item-kind { font-size: 10.5px; background: #1e3a5f; color: #9fb6dd; border-radius: 4px; padding: 1px 6px; }
.bj-asn-item-brief { font-size: 12.5px; color: #c4cfe8; white-space: pre-wrap; margin: 5px 0 4px; line-height: 1.6; background: rgba(255,255,255,.04); border-radius: 5px; padding: 6px 9px; }
.bj-asn-specs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.bj-asn-spec { font-size: 11px; background: #0f1a2e; color: #b9c2e0; border: 1px solid #1e3a5f; border-radius: 4px; padding: 2px 7px; }
.bj-asession-ref { max-width: 120px; max-height: 80px; border-radius: 6px; border: 1px solid #2a3a5c; object-fit: cover; margin-bottom: 6px; }
.bj-asession-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.bj-asession-img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1.5px solid #2a3a5c; cursor: zoom-in; transition: transform .15s, border-color .15s; }
.bj-asession-img:hover { transform: scale(1.08); border-color: #5b8dee; }
/* v388: camp pending section */
.camp-pending-box { border: 2px solid #f59e0b; background: #1a1200; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(245,158,11,.15); }
.camp-pending-head { font-weight: 700; font-size: 14px; color: #facc15; margin-bottom: 10px; }
.camp-pending-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.camp-pending-table th { background: #2a1e00; color: #facc15; font-weight: 600; padding: 5px 8px; text-align: left; border-bottom: 1px solid #4a3800; white-space: nowrap; }
.camp-pending-row td { padding: 6px 8px; border-bottom: 1px dashed #2a2000; vertical-align: middle; color: #eef1ff; }
.camp-pending-row:last-child td { border-bottom: none; }
.camp-pending-name { font-weight: 600; color: #fff; max-width: 220px; }
.camp-pending-sent { background: #1a1200; border: 1.5px solid #a16207; border-radius: 8px; color: #facc15; font-size: 13px; padding: 10px 14px; margin-bottom: 14px; }
.bj-asession-actions { display: flex; gap: 8px; margin-top: 10px; }
.bj-asession-due { background: #1c2d4a; border: 1px solid #3b82f6; border-radius: 10px; padding: 12px 14px; }
.bj-asession-due .bj-asession-title { color: #93c5fd; }
.bj-approval-header-btn { background: #1e3a5f; border: 1px solid #3b82f6; color: #93c5fd; border-radius: 8px; padding: 4px 12px; font-size: 12px; font-weight: 700; cursor: pointer; margin-left: auto; }
.bj-approval-header-btn:hover { background: #2a4d7a; color: #bfdbfe; }
/* chatbot alert bubble */
.nb-msg.nb-alert .nb-txt { background: #fff4e0; border: 1.5px solid #f0a500; color: #7a4400; }
.nb-chip.nb-chip-ok { background: #14532d; border-color: #16a34a; color: #bbf7d0; }
.nb-chip.nb-chip-ok:hover { background: #166534; border-color: #22c55e; color: #fff; }
.nb-badge { position: absolute; top: -6px; right: -6px; background: #ef4444; color: #fff; border-radius: 50%; min-width: 18px; height: 18px; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 3px; pointer-events: none; }
.bj-row-status { width: 9px; height: 9px; border-radius: 50%; background: #ccc; flex-shrink: 0; }
.bj-row-status.todo { background: #adb5bd; } .bj-row-status.doing { background: #f59f00; }
.bj-row-status.review { background: #1565c0; } .bj-row-status.done { background: #2f9e44; }
.bj-row-title { font-weight: 700; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bj-row-count { font-size: 12px; color: var(--brand-dark, #3b46c4); font-weight: 600; white-space: nowrap; }
.bj-row-due { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* items editor */
.bj-items-editor { margin-bottom: 10px; border: 1.5px dashed var(--line); border-radius: 10px; padding: 10px; }
.bj-items-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.bj-items-empty { font-size: 12px; color: var(--faint); font-style: italic; }
.bj-items-actions { display: inline-flex; align-items: center; gap: 8px; }
.bj-items-count { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.bj-items-count input { width: 56px; padding: 4px 6px; border: 1.5px solid var(--line); border-radius: 6px; font-size: 13px; }
.bj-item-row { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 6px; display: grid; gap: 6px; }
.bj-item-top { display: flex; gap: 6px; }
.bj-item-top .bj-item-title { flex: 1; }
.bj-item-del { border: 0; background: rgba(0,0,0,.45); color: #fff; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; flex-shrink: 0; }
.bj-item-img-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bj-item-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.bj-item-thumbwrap { position: relative; display: inline-block; }
.bj-item-thumbwrap .bj-item-imgdel { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: #c0392b; color: #fff; border: 2px solid #fff; font-size: 10px; line-height: 1; padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.bjm-item-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.bjm-item-imgs .bjm-item-img { max-width: 120px; max-height: 120px; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; }
.pr-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }
.pr-high { background: #ffe3e3; color: #c0392b; border: 1px solid #ffb3b3; }
.pr-med { background: #fff3bf; color: #b25c00; border: 1px solid #ffe08a; }
.pr-low { background: #e6fcf0; color: #2b8a3e; border: 1px solid #b2f2cf; }
.bjm-img-click { cursor: zoom-in; transition: transform .12s; }
.bjm-img-click:hover { transform: scale(1.04); box-shadow: 0 3px 12px rgba(16,24,64,.2); }
.bjm-item-zoom { margin-left: auto; background: #eef1fb; border: 1px solid var(--line); border-radius: 7px; color: var(--brand-dark,#3b46c4); font-size: 11.5px; font-weight: 700; padding: 3px 9px; cursor: pointer; }
.bjm-item-zoom:hover { background: #e2e8ff; }
/* ป๊อปอัปดูชิ้นงานเดี่ยว ภาพใหญ่ */
.bi-backdrop { position: fixed; inset: 0; z-index: 10000; background: rgba(6,9,22,.78); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(2px); }
.bi-modal { background: #fff; border-radius: 18px; width: min(820px, 96vw); max-height: 92vh; overflow-y: auto; }
.bi-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.bi-head b { font-size: 16px; }
.bi-body { padding: 16px 18px 22px; }
.bi-stage { position: relative; background: #0e1426; border-radius: 12px; display: flex; align-items: center; justify-content: center; min-height: 320px; max-height: 64vh; overflow: hidden; }
.bi-stage img { max-width: 100%; max-height: 64vh; object-fit: contain; display: block; }
.bi-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: none; background: rgba(255,255,255,.85); color: #1c2430; font-size: 26px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.bi-nav:hover { background: #fff; }
.bi-prev { left: 10px; } .bi-next { right: 10px; }
.bi-count { position: absolute; bottom: 10px; right: 12px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.bi-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.bi-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.bi-thumb.on { border-color: var(--brand,#6366f1); }
.bi-actions { margin-top: 10px; }
.bi-brief { white-space: pre-wrap; background: #f6f8ff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.6; margin-top: 12px; color: var(--text,#1c2430); }
/* ตารางย่อยในชิ้นงานบรีฟ */
.bj-item-specs { display: grid; gap: 5px; margin: 6px 0; }
.bj-spec-head { display: grid; grid-template-columns: 130px 1fr 28px; gap: 6px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 0 2px; }
.bj-spec-row { display: grid; grid-template-columns: 130px 1fr 28px; gap: 6px; align-items: center; }
.bj-spec-row input { border: 1.5px solid var(--line); border-radius: 7px; padding: 6px 8px; font-size: 12.5px; font-family: inherit; width: 100%; }
.bj-spec-del { background: none; border: 1px solid var(--line); border-radius: 6px; color: #c0392b; cursor: pointer; font-size: 12px; padding: 4px 0; }
.bj-spec-del:hover { background: rgba(192,57,43,.1); }
.bj-spec-add { width: fit-content; }
/* ตารางย่อยตอนแสดงในป๊อปอัพรายละเอียด */
.bjm-spec-tbl { border-collapse: collapse; margin-top: 6px; width: 100%; font-size: 12.5px; }
.bjm-spec-tbl th { text-align: left; background: rgba(99,102,241,.08); color: var(--brand-dark, #3b46c4); font-weight: 700; padding: 4px 8px; border: 1px solid var(--line); white-space: nowrap; width: 130px; vertical-align: top; }
.bjm-spec-tbl td { padding: 4px 8px; border: 1px solid var(--line); white-space: pre-wrap; }
.bj-item-noimg { font-size: 11.5px; color: var(--faint); }
.bj-item-imgdel { border: 0; background: none; color: var(--danger); font-size: 11.5px; cursor: pointer; }
.bjm-item-img { width: 100%; max-height: 200px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); margin: 6px 0; background: #fff; }

/* job modal */
.bjm-backdrop { position: fixed; inset: 0; z-index: 9999; background: rgba(15,25,20,.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.bjm-modal { background: #fff; border-radius: 14px; width: 100%; max-width: 600px; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 18px 50px rgba(0,0,0,.3); }
.bjm-head { display: flex; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.bjm-head h3 { margin: 0 0 4px; font-size: 18px; }
.bjm-head p { margin: 0; font-size: 12.5px; color: var(--muted); }
.bjm-body { overflow-y: auto; padding: 14px 20px; display: grid; gap: 14px; }
.bjm-section > b { display: block; margin-bottom: 6px; color: var(--brand-dark, #3b46c4); font-size: 13.5px; }
.bjm-import-fields { display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: rgba(99,102,241,.05); }
.bjm-imp-row { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: start; font-size: 12.5px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.bjm-imp-row:last-child { border-bottom: none; }
.bjm-imp-label { font-weight: 700; color: var(--brand-dark, #3b46c4); word-break: break-word; }
.bjm-imp-val { color: var(--text, #1c2430); white-space: pre-wrap; word-break: break-word; }
.imp-hist-row { cursor: pointer; }
.imp-hist-row:hover { background: rgba(99,102,241,.08); }
/* แถบเครื่องมือหน้างานของทีม */
.tasks-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.task-month-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
.task-month-pick input { border: none; font: inherit; color: var(--text, #1c2430); background: transparent; }
/* ป๊อปอัพตั้งวันหยุดทีม */
.toff-list { display: grid; gap: 8px; margin-top: 6px; }
.toff-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border: 1px solid #243154; background: #0e1426; border-radius: 8px; padding: 8px 12px; }
.toff-name { font-weight: 700; color: #e6eefc; font-size: 13.5px; }
.toff-days { display: flex; gap: 4px; flex-wrap: wrap; }
.toff-day { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: #9fb6dd; background: #16203a; border: 1px solid #2a3a5e; border-radius: 6px; padding: 3px 7px; cursor: pointer; user-select: none; }
.toff-day.on { background: #2d5a3a; border-color: #45e08a; color: #d6ffe6; }
.toff-day input { margin: 0; cursor: pointer; }
/* ป้ายวันหยุดในห้องออฟฟิศ */
.o3-offbadge { position: absolute; top: -6px; right: -4px; font-size: 14px; z-index: 5; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.o3-person.is-off { opacity: .62; }
.o3-person.is-off .o3-figwrap { filter: grayscale(.5); }
.o3-scard.off { opacity: .72; }
.o3-scard.off .o3-scard-status { color: #45e08a; font-weight: 600; }
.bjm-review-note { background: #fff4e0; border: 1.5px solid #f0a500; border-radius: 10px; padding: 10px 14px; color: #7a4400; font-size: 13.5px; line-height: 1.6; }
.bjm-review-note b { color: #b35a00; }
.bjm-review-note span { white-space: pre-wrap; }
.bj-sub-note { font-size: 12px; color: #b35a00; padding-left: 4px; }
.bjm-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; }
.bjm-item-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.bjm-item-brief { font-size: 12.5px; color: var(--muted); margin-top: 4px; white-space: pre-wrap; }
.bjm-full summary { cursor: pointer; font-weight: 700; color: var(--brand-dark, #3b46c4); }
.bjm-full-body { margin-top: 8px; }
.bjm-submit { display: grid; gap: 6px; }
.bjm-submit select, .bjm-submit input { border: 1.5px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 13px; }
.bjm-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.bjm-status select { border: 1.5px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: 13px; }
/* v582: bj-spec-actions — ปุ่มตาราง + เช็คลิสต์แถวเดียว */
.bj-spec-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
/* v581: checklist mode ในฟอร์มสร้างบรีฟงาน */
/* v200: flex-wrap:nowrap + checkbox override (ป้องกัน .bj-form input ทำ checkbox กว้างเกิน) */
.bjf-chk-row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 6px; background: var(--card-bg, #fff); }
.bjf-chk-row:focus-within { border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,.12); }
.bjf-chk-check { width: 16px !important; height: 16px; flex: 0 0 16px; margin: 0; padding: 0 !important; border: none !important; cursor: pointer; accent-color: #6366f1; }
.bjf-chk-input { flex: 1; min-width: 0; border: none !important; outline: none; background: transparent !important; font-size: 13.5px; color: var(--ink); padding: 2px 4px !important; }
.bjf-chk-input::placeholder { color: var(--muted); font-size: 13px; }
.bjf-chk-kind { flex: 0 0 80px; width: 80px !important; border: 1px solid var(--line); border-radius: 6px; padding: 3px 4px !important; font-size: 12px; background: var(--bg, #f8f9fa); color: var(--ink); }
.bjf-chk-del { flex: 0 0 auto; flex-shrink: 0; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 5px; border-radius: 4px; line-height: 1; }
.bjf-chk-del:hover { color: #e53e5a; background: rgba(229,62,90,.08); }
/* v580: checklist mode — bjm-items-header + bjm-chk-row */
.bjm-items-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.bjm-chk-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer; border: 1px solid var(--line); margin-bottom: 6px; transition: background .12s; -webkit-user-select: none; user-select: none; }
.bjm-chk-row:hover { background: rgba(99,102,241,.06); }
.bjm-chk-row input[type=checkbox] { width: 18px; height: 18px; margin: 0; flex: 0 0 18px; cursor: pointer; accent-color: #6366f1; }
.bjm-chk-icon { font-size: 16px; }
.bjm-chk-title { flex: 1; font-size: 14px; color: var(--ink); }
.bjm-chk-done .bjm-chk-title { text-decoration: line-through; color: var(--muted); }
.bjm-chk-done { background: rgba(16,185,129,.04); border-color: rgba(16,185,129,.2); }

/* ─── Office v3 (พื้นหลังภาพจริง office-bg.png + overlay สถานะ) ──── */
#officeView { background: #000; }
.o3-wrap { display: grid; gap: 10px; background: #000; padding: 10px; border-radius: 14px; }
.o3-scene {
  position: relative; width: 100%; aspect-ratio: 1484 / 1060; border-radius: 14px; overflow: hidden;
  background: #000 var(--office-bg, url("/office-bg.png?v=5")) center/cover no-repeat; /* --office-bg ตั้งจาก 37-office-small-features.js */
  border: 3px solid #0a1024; box-shadow: inset 0 0 40px rgba(0,0,0,.4);
}
html[data-office-bg] .o3-scene .o3-fx { display: none; }
.o3-overlay { position: absolute; inset: 0; }
/* ของตกแต่งห้อง (อยู่หลังตัวละคร) */
.o3-decor { position: absolute; inset: 0; z-index: 1; }
.o3-dec { position: absolute; transform: translate(-50%, -100%); }
.o3-dec img { width: 100%; height: auto; image-rendering: pixelated; display: block; filter: drop-shadow(0 4px 5px rgba(0,0,0,.4)); pointer-events: none; }
.o3-decor.editing { z-index: 40; }
.o3-decor.editing .o3-dec { cursor: grab; outline: 1.5px dashed rgba(93,184,255,.7); outline-offset: 2px; }
.o3-decor.editing .o3-dec.dragging { cursor: grabbing; }
.o3-dec-tools { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; }
.o3-dec-btn { width: 24px; height: 24px; border-radius: 50%; border: none; color: #fff; font-size: 13px; cursor: pointer; line-height: 1; box-shadow: 0 2px 5px rgba(0,0,0,.4); }
.o3-dec-small, .o3-dec-big { background: #2b69b0; }
.o3-dec-del { background: #e53e5a; }
.decor-palette { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 200; width: min(560px, 94vw); background: rgba(14,20,38,.97); border: 1.5px solid #2f3f63; border-radius: 14px; padding: 10px 12px; box-shadow: 0 16px 50px rgba(0,0,0,.55); backdrop-filter: blur(3px); }
.decor-pal-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #cfe0ff; margin-bottom: 8px; }
.decor-pal-x { background: none; border: none; color: #9fb6dd; font-size: 16px; cursor: pointer; }
.decor-pal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; max-height: 40vh; overflow-y: auto; }
.decor-pal-item { width: 100%; height: 64px; background: #16203a; border: 1.5px solid #243154; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 4px; }
.decor-pal-item:hover { border-color: #5db8ff; }
.decor-pal-item img { max-width: 100%; max-height: 100%; image-rendering: pixelated; }

/* ── เอฟเฟกต์ฉากเคลื่อนไหว (เมฆลอย + นีออนกระพริบ) ── */
.o3-fx { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; border-radius: 14px; }
/* เมฆ pixel ในหน้าต่าง — ไหลวนลูป */
.o3-clouds { position: absolute; left: 2.7%; top: 7.7%; width: 27.9%; height: 15.85%; overflow: hidden; }
.o3-cloudtrack { display: flex; width: 200%; height: 100%; animation: o3cloud 48s linear infinite; }
.o3-cloudtrack img { width: 50%; height: 100%; image-rendering: pixelated; display: block; }
@keyframes o3cloud { from { transform: translateX(0); } to { transform: translateX(-50%); } }
/* กรอบ/เสาหน้าต่าง ทับหน้าเมฆ (เมฆอยู่หลังกรอบ) */
.o3-winfront { position: absolute; left: 2.7%; top: 7.7%; width: 27.9%; height: 15.85%; image-rendering: pixelated; pointer-events: none; }
/* นีออน EAT SLEEP CODE REPEAT — กระพริบ + ไล่สี */
.o3-neon { position: absolute; left: 33%; top: 3%; width: 11.5%; height: 20%; mix-blend-mode: screen; border-radius: 5px;
  background: radial-gradient(ellipse at center, rgba(255,70,200,.5), rgba(80,160,255,.22) 58%, rgba(0,0,0,0) 74%);
  animation: o3neonhue 3.4s linear infinite, o3neonflick 5s steps(1, end) infinite; }
@keyframes o3neonhue { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }
@keyframes o3neonflick { 0%,92%,100% { opacity: .85; } 93% { opacity: .3; } 94% { opacity: .9; } 96% { opacity: .45; } 97% { opacity: .88; } }
.o3-board {
  position: absolute; right: 1.5%; top: 3%; width: 200px; z-index: 3;
  background: rgba(8,16,34,.82); border: 2px solid #2b69b0; border-radius: 8px; padding: 7px 9px;
  box-shadow: 0 0 14px rgba(43,105,176,.4); backdrop-filter: blur(2px);
}
.o3-board-title { font-size: 10px; font-weight: 800; letter-spacing: .15em; color: #6fb6ff; text-align: center; margin-bottom: 5px; }
.o3-board-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; }
.o3-board-grid > div { display: flex; justify-content: space-between; align-items: baseline; font-size: 10.5px; color: #9fb6dd; }
.o3-board-grid b { font-size: 14px; color: #fff; }
.o3-board-grid b.g { color: #45e08a; } .o3-board-grid b.o { color: #ffb15d; } .o3-board-grid b.b { color: #5db8ff; }
/* ตัวละคร + ป้ายสถานะเหนือหัว เดินวนในโซน */
.o3-person {
  position: absolute; transform: translate(-50%, -100%); z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 2px; will-change: transform;
  cursor: grab; touch-action: none; user-select: none;
}
.o3-person.dragging { cursor: grabbing; z-index: 50; }
.o3-person.dragging .o3-anim img { animation: none !important; }
.o3-person.dragging .o3-sprite { filter: drop-shadow(0 6px 6px rgba(0,0,0,.6)); }
.o3-figwrap { display: flex; align-items: flex-end; justify-content: center; }
/* accessory แต่งตัว */
.o3-charwrap { position: relative; display: flex; align-items: flex-end; justify-content: center; }
/* ทั้งตัว+ของแต่งตัว ขยับมีชีวิต: เด้งนุ่ม + โยก + หายใจ (เฉพาะออนไลน์) */
.o3-charwrap { transform-origin: 50% 100%; }   /* เท้าติดพื้นเสมอ */
.o3-person.on .o3-charwrap { animation: o3idle 1s ease-in-out infinite; animation-delay: var(--delay, 0s); }
@keyframes o3idle {
  0%   { transform: scaleY(1)     scaleX(1); }
  30%  { transform: scaleY(0.96)  scaleX(1.025); }  /* ย่อเบา ๆ */
  60%  { transform: scaleY(1.025) scaleX(0.985); }  /* ยืดเบา ๆ */
  100% { transform: scaleY(1)     scaleX(1); }
}
/* หัวพยักตามจังหวะ (ไม่ลอยจากพื้น — แค่หัวขยับ) */
.o3-person.on .o3-anim img { animation: o3headbob 1s ease-in-out infinite; animation-delay: var(--delay, 0s); transform-origin: 50% 100%; }
@keyframes o3headbob {
  0%, 100% { transform: translateY(0); }
  60% { transform: translateY(-2px); }
}
.o3-person.on .o3-accpos.head > img { animation: o3headbob 1s ease-in-out infinite; animation-delay: var(--delay, 0s); transform-origin: 50% 100%; }
/* พักอยู่ (Break Time) → ไม่หัน ไม่ขยับ นั่งนิ่ง */
.o3-person.is-break .o3-charwrap,
.o3-person.is-break .o3-acc,
.o3-person.is-break .o3-anim img { animation: none !important; }
.o3-charwrap > .o3-anim { position: relative; z-index: 1; }
/* wrapper accessory: ตำแหน่ง + ปรับขนาด/ขยับของผู้ใช้ (ล็อกศูนย์กลางตัวละคร) */
.o3-accpos { position: absolute; pointer-events: none; }
.o3-accpos > img { width: 100%; display: block; image-rendering: pixelated; }
.o3-acc { image-rendering: pixelated; pointer-events: none; }
.o3-accpos.wings { left: 50%; bottom: 24%; width: 122%; z-index: 0; transform-origin: bottom center;
  transform: translateX(-50%) translate(var(--acc-dx,0px), var(--acc-dy,0px)) scale(var(--acc-scale,1)); }
.o3-accpos.back { left: 50%; bottom: 16%; width: 54%; z-index: 0; transform-origin: bottom center;
  transform: translateX(-50%) translate(var(--acc-dx,0px), var(--acc-dy,0px)) scale(var(--acc-scale,1)); }
.o3-accpos.pet { right: -28%; top: -2%; width: 48%; z-index: 3; transform-origin: center;
  transform: translate(var(--acc-dx,0px), var(--acc-dy,0px)) scale(var(--acc-scale,1)); }
.o3-accpos.head { left: 50%; top: -5%; width: 80%; z-index: 3; transform-origin: 50% 80%;
  transform: translateX(-50%) translate(var(--acc-dx,0px), var(--acc-dy,0px)) scale(var(--acc-scale,1)); }
/* ปีกกระพือ + สัตว์เลี้ยงลอย (เฉพาะออนไลน์) — เด้งรวมตามตัว */
.o3-person.on .o3-accpos.wings > img { animation: o3flap .55s ease-in-out infinite; }
.o3-person.on .o3-accpos.pet > img { animation: o3accPet 1.3s ease-in-out infinite; }
@keyframes o3flap {
  0%, 100% { transform: scaleY(1) scaleX(1); }
  50% { transform: scaleY(.84) scaleX(1.04); }
}
@keyframes o3headtilt {
  0%, 100% { transform: translateX(-50%) rotate(-2.5deg); }
  50% { transform: translateX(-50%) rotate(2.5deg); }
}
@keyframes o3accPet {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(7deg); }
}
.acc-thumb { width: 56px; aspect-ratio: 1; background-size: contain; background-repeat: no-repeat; background-position: center; image-rendering: pixelated; }
/* ปรับขนาด/ตำแหน่ง accessory — เลย์เอาต์ 2 คอลัมน์ */
.acc-2col { display: grid; grid-template-columns: 1fr 270px; gap: 16px; align-items: start; }
.acc-col-right { position: sticky; top: 0; }
.acc-adjust-head { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
@media (max-width: 720px) { .acc-2col { grid-template-columns: 1fr; } .acc-col-right { position: static; } }
.acc-preview { display: flex; justify-content: center; align-items: flex-end; min-height: 200px; padding: 14px 10px 18px; margin-bottom: 12px; border: 1px solid #243154; border-radius: 12px; background: linear-gradient(#0e1426, #1a2540); position: relative; overflow: hidden; }
.acc-preview::after { content: ""; position: absolute; left: 14%; right: 14%; bottom: 16px; height: 2px; background: rgba(255,255,255,.18); border-radius: 2px; }
.acc-preview-inner { position: relative; z-index: 1; --o3-size: 130px; }   /* ใช้กลไกขนาดเดียวกับห้องจริง → accessory ตรงกัน */
.acc-preview .o3-person { position: static; transform: none; }
.acc-adjust-head { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.acc-adj-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; flex-wrap: wrap; }
.acc-adj-row input[type=range] { flex: 1; min-width: 120px; }
.acc-dpad { display: inline-grid; justify-items: center; gap: 2px; }
.acc-dpad-mid { display: flex; gap: 2px; }
.acc-dir { width: 30px; height: 28px; border: 1px solid var(--line); background: #f3f5fb; border-radius: 6px; cursor: pointer; font-size: 12px; color: #3b46c4; }
.acc-dir:hover { background: #e2e8ff; }
.acc-dir:active { transform: scale(.92); }
.acc-thumb.acc-none { display: flex; align-items: center; justify-content: center; font-size: 22px; color: #6a748f; border: 1px dashed #2f3f63; border-radius: 8px; }
/* sprite animation 3 เฟรม — เล่นวนเฉพาะคนออนไลน์ (ออฟไลน์หยุดเฟรมแรก) */
.o3-anim { width: var(--o3-size, 62px); aspect-ratio: 84 / 108; overflow: hidden; filter: drop-shadow(0 3px 3px rgba(0,0,0,.5)); }
/* รูปคัสตอม (เช่น ตัวละครกี้) — แสดงเต็มภาพ ไม่ crop ไม่เด้งหัว */
.o3-anim.o3-custom { width: calc(var(--o3-size, 62px) * 1.3); aspect-ratio: 84 / 108; overflow: hidden; }
.o3-anim.o3-custom img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; animation: none !important; }
.o3-anim img { height: 100%; width: auto; max-width: none; image-rendering: pixelated; display: block; }
/* Match newchar's visible height to the standard sprites, allowing for PNG padding. */
.o3-anim.o3-newchar, .avatar-thumb-newchar { position: relative; overflow: hidden; }
.o3-anim.o3-newchar img, .avatar-thumb-newchar img { position: absolute; left: 50%; bottom: -2.7%; width: auto; height: 105%; max-width: none; transform: translateX(-50%); image-rendering: pixelated; }
/* ไม่สลับเฟรมเดิน — แสดงเฟรมแรกนิ่ง ๆ (ใช้การโยกเอียงที่ตัวแทน) */
/* modal เลือกตัวละคร */
.avatar-modal, .avatar-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; }
.avatar-box { background: #121a30; border: 1.5px solid #2f3f63; border-radius: 16px; padding: 18px 20px; width: min(420px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.5); max-height: 88vh; overflow-y: auto; overscroll-behavior: contain; }
.avatar-head { display: flex; justify-content: space-between; align-items: center; font-size: 16px; font-weight: 800; color: #fff; }
.avatar-x { background: none; border: none; color: #9fb6dd; font-size: 18px; cursor: pointer; }
/* v895: แท็บสลับมุมมองปฏิทิน/ตาราง + ตารางรายการโพสต์ */
.cal-viewtabs { display: flex; gap: 6px; }
.cal-viewtab { border: 1px solid #d5d9e6; background: #fff; color: #475069; font-size: 13px; font-weight: 700; padding: 6px 16px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.cal-viewtab:hover { border-color: #8b93ff; color: #4338ca; }
.cal-viewtab.active { background: #6366f1; border-color: #6366f1; color: #fff; }
.cal-table-wrap { overflow-x: auto; margin-top: 8px; border: 1px solid #e2e6f0; border-radius: 12px; background: #fff; }
.cal-table { width: 100%; border-collapse: collapse; font-size: 13px; color: #1f2937; }
.cal-table th { position: sticky; top: 0; background: #eef2ff; color: #4338ca; text-align: left; font-weight: 700; padding: 9px 12px; white-space: nowrap; border-bottom: 2px solid #dfe4f5; }
.cal-table td { padding: 8px 12px; border-top: 1px solid #eef0f6; vertical-align: middle; }
.cal-trow { cursor: pointer; transition: background .12s; }
.cal-trow:hover { background: #f5f7ff; }
.cal-table .ct-date { white-space: nowrap; font-weight: 600; }
.cal-table .ct-time { white-space: nowrap; color: #667; }
.cal-table .ct-title { font-weight: 600; min-width: 220px; }
.cal-table .ct-type, .cal-table .ct-asgn { white-space: nowrap; }
.cal-table .ct-status { white-space: nowrap; font-weight: 700; }
.cal-table-empty { padding: 34px; text-align: center; color: #8891a8; font-size: 13px; }
/* v893: หัวโมดัล + ปุ่มปิด (เดิมไม่มี CSS → ปุ่ม ✕ เป็นกล่องขาว default + ไม่ชิดขวา) */
.avatar-box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; font-weight: 800; color: #fff; margin-bottom: 12px; }
.avatar-box-head > span { flex: 1 1 auto; min-width: 0; }
.avatar-close { flex: 0 0 auto; margin-left: auto; background: none; border: none; color: #9fb6dd; font-size: 20px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px; transition: background .15s, color .15s; }
.avatar-close:hover { background: rgba(255,255,255,.14); color: #fff; }
.avatar-close:active { background: rgba(255,255,255,.22); }
.avatar-sub { font-size: 12px; color: #9fb6dd; margin: 4px 0 14px; }
.avatar-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.avatar-opt { background: #0e1426; border: 2px solid #243154; border-radius: 12px; padding: 14px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; transition: border-color .15s, transform .1s; }
.avatar-opt:hover { transform: translateY(-2px); }
.avatar-opt.sel { border-color: #5db8ff; box-shadow: 0 0 0 2px rgba(93,184,255,.3) inset; }
.avatar-thumb { width: 70px; aspect-ratio: 84 / 108; background-size: 200% 100%; background-position: left center; background-repeat: no-repeat; image-rendering: pixelated; }
.avatar-thumb-custom img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; image-rendering: pixelated; }
.avatar-opt span { font-size: 14px; font-weight: 700; color: #fff; }
.avatar-box-wide { width: min(640px, 94vw); }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; max-height: 60vh; overflow-y: auto; padding: 2px; }
.avatar-grid .avatar-opt { padding: 8px 4px; }
.avatar-grid .avatar-thumb { width: 56px; }
.avatar-grid .avatar-opt span { font-size: 11.5px; }
.o3-person.off .o3-anim { filter: saturate(.65) brightness(.9) drop-shadow(0 3px 3px rgba(0,0,0,.5)); opacity: .92; }
/* บับเบิลข้อความ/อารมณ์ เหนือหัวตัวละคร */
.o3-bubble {
  max-width: 150px; margin-bottom: 2px; padding: 4px 9px; border-radius: 12px;
  font-size: 11.5px; font-weight: 600; line-height: 1.25; text-align: center; white-space: normal;
  background: #fff; color: #1a2238; box-shadow: 0 3px 8px rgba(0,0,0,.35); position: relative;
  word-break: break-word;
}
.o3-bubble::after { content: ""; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #fff; }
.o3-bubble.mood { background: #fff7dd; color: #6b4e00; }
.o3-bubble.mood::after { border-top-color: #fff7dd; }
.o3-bubble.chat { background: #e8f3ff; color: #103a66; }
.o3-bubble.chat::after { border-top-color: #e8f3ff; }
@keyframes o3pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* กล่องแชต */
.o3-chatbar { display: flex; gap: 8px; margin: 10px 0 2px; }
.o3-chatbar input { flex: 1; border: 1.5px solid #2f3f63; border-radius: 9px; padding: 8px 11px; font-size: 13px; background: #0e1426; color: #fff; }
.o3-chatbar input:focus { border-color: #5db8ff; outline: none; }

/* ป้ายชื่อเล็กใต้ตัวละครในห้อง */
.o3-tag {
  display: inline-flex; align-items: center; gap: 4px; margin-top: -3px;
  font-size: 11px; font-weight: 800; color: #fff; white-space: nowrap;
  background: rgba(8,16,34,.8); border-radius: 7px; padding: 1px 7px; text-shadow: 0 1px 2px #000;
}
.o3-person.is-me .o3-tag { outline: 1.5px solid #f5a623; }

/* ── KPI Dashboard ── */
.kpi-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 12px; }
.kpi-month { font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.kpi-month input { border: 1.5px solid var(--line, #2f3f63); border-radius: 8px; padding: 5px 8px; }
.kpi-config { margin: 0 0 14px; border: 1px solid var(--line, #2f3f63); border-radius: 10px; padding: 6px 12px; background: rgba(255,255,255,.02); }
.kpi-config summary { cursor: pointer; font-size: 13px; font-weight: 700; color: #cfe0ff; }
#myPlannerModal .kpi-config, #myPlannerModal .kpi-config * { color: #cfe0ff; }
#myPlannerModal .kpi-config .tasks-sub { color: #9fb6dd; }
#myPlannerModal .kpi-sheet-row input { color: #0e1426; background: #fff; }
.kpi-config-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.kpi-config-row input { flex: 1; min-width: 200px; border: 1.5px solid var(--line, #2f3f63); border-radius: 8px; padding: 7px 9px; }
.kpi-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi-card { background: #121a30; border: 1.5px solid #243154; border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.kpi-card span { font-size: 11.5px; color: #9fb6dd; }
.kpi-card b { font-size: 22px; color: #fff; }
.kpi-card b.g { color: #45e08a; } .kpi-card b.o { color: #ffb15d; } .kpi-card b.b { color: #5db8ff; } .kpi-card b.r { color: #ff7a8a; }
.kpi-tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.kpi-tbl th, .kpi-tbl td { text-align: left; padding: 9px 12px; border-bottom: 1px solid #1e3a5f; background: #0b1120; color: #e2e8f0; }
.kpi-tbl th { font-size: 11.5px; color: #9fb6dd; font-weight: 700; background: #0a1020; }
.kpi-tbl tbody tr:hover td { background: #0d1e38; }
.kpi-name { font-weight: 700; color: #e2e8f0; }
.kpi-pct.g { color: #45e08a; } .kpi-pct.o { color: #ffb15d; } .kpi-pct.r { color: #ff7a8a; }
.kpi-dim { color: #7f8aa6; }
.kpi-detail-btn { background: none; border: none; color: #93c5fd; font-weight: 700; font-size: 13.5px; cursor: pointer; padding: 2px 0; }
.kpi-detail-btn:hover { color: #60a5fa; text-decoration: underline; }
.kpi-pf-btn { background: none; border: none; color: #9fb6dd; font-size: 13px; cursor: pointer; margin-left: 4px; padding: 0 5px; border-radius: 4px; opacity: .75; font-family: inherit; }
.kpi-pf-btn:hover { color: #93c5fd; background: rgba(99,102,241,.15); opacity: 1; }
.kpi-hide-btn { background: none; border: none; color: #6b7a99; font-size: 12px; cursor: pointer; margin-left: 6px; padding: 0 4px; border-radius: 4px; opacity: .5; font-family: inherit; }
.kpi-hide-btn:hover { color: #ff7a8a; background: rgba(255,122,138,.12); opacity: 1; }
.kpi-hidden-bar { margin-top: 10px; font-size: 12px; color: #9fb6dd; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kpi-hidden-chip { display: inline-flex; align-items: center; gap: 4px; background: #16203a; border: 1px solid #2a3a5e; border-radius: 12px; padding: 2px 9px; cursor: pointer; color: #cfe0ff; }
.kpi-hidden-chip:hover { border-color: #45e08a; }
.kpi-hidden-chip b { color: #45e08a; font-size: 11px; }
.kpi-person-top { display: flex; gap: 16px; align-items: center; margin: 6px 0 10px; flex-wrap: wrap; }
.kpi-person-pct { font-size: 40px; font-weight: 800; line-height: 1; display: flex; flex-direction: column; }
.kpi-person-pct span { font-size: 11px; color: #9fb6dd; font-weight: 600; margin-top: 4px; }
.kpi-person-pct.g { color: #45e08a; } .kpi-person-pct.o { color: #ffb15d; } .kpi-person-pct.r { color: #ff7a8a; }
.kpi-person-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; flex: 1; min-width: 240px; }
.kpi-person-grid > div { background: #0e1426; border: 1px solid #243154; border-radius: 9px; padding: 7px 10px; display: flex; flex-direction: column; gap: 2px; }
.kpi-person-grid span { font-size: 10.5px; color: #9fb6dd; }
.kpi-person-grid b { font-size: 16px; color: #fff; }
.kpi-person-sec { font-size: 12px; font-weight: 800; color: #9fb6dd; margin: 12px 0 6px; }
.kpi-person-jobs { display: grid; gap: 5px; max-height: 150px; overflow-y: auto; }
.kpi-job-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #0e1426; border: 1px solid #243154; border-radius: 8px; padding: 6px 10px; font-size: 12.5px; color: #e6eefc; }
.kpi-job-row b { color: #e6eefc; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-job-row span { color: #9fb6dd; font-size: 11px; white-space: nowrap; flex: 0 0 auto; }
.kpi-sheet-row { display: flex; gap: 8px; margin-bottom: 8px; }
.kpi-sheet-row input { flex: 1; border: 1.5px solid #2f3f63; border-radius: 8px; padding: 7px 9px; font-size: 12.5px; background: #0e1426; color: #fff; }
.kpi-sheet-data { font-size: 12.5px; }
.kpi-sheet-analysis { background: #0e1426; border: 1px solid #243154; border-radius: 8px; padding: 8px 11px; margin-bottom: 8px; color: #cfe0ff; }
.kpi-sheet-scroll { max-height: 200px; overflow: auto; border: 1px solid #243154; border-radius: 8px; }
.kpi-sheet-scroll .kpi-tbl th, .kpi-sheet-scroll .kpi-tbl td { padding: 5px 8px; font-size: 12px; white-space: nowrap; color: #e6eefc; }
.kpi-sheet-scroll .kpi-tbl th { color: #9fb6dd; }
.kpi-src-hint { color: #ffd39a; font-size: 11px; white-space: normal !important; max-width: 260px; }
.kpi-src-ok { color: #45e08a; }
#kpiPersonModal .avatar-box { max-height: 90vh; overflow-y: auto; }

/* แดชบอร์ด task รายคน */
.task-head-right { display: flex; align-items: center; gap: 8px; }
.task-dash-btn { font-size: 11px; font-weight: 700; color: #5db8ff; background: rgba(93,184,255,.12); border: 1px solid rgba(93,184,255,.35); border-radius: 7px; padding: 3px 8px; cursor: pointer; }
.task-dash-btn:hover { background: rgba(93,184,255,.22); }
.td-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.td-card { background: #0e1426; border: 1px solid #243154; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.td-card span { font-size: 10.5px; color: #9fb6dd; }
.td-card b { font-size: 19px; color: #fff; }
.td-card b.g { color: #45e08a; } .td-card b.o { color: #ffb15d; } .td-card b.b { color: #5db8ff; } .td-card b.r { color: #ff7a8a; }
.td-risk { padding: 9px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 6px; }
.td-risk.g { background: rgba(69,224,138,.12); color: #9ff0c2; border: 1px solid rgba(69,224,138,.35); }
.td-risk.o { background: rgba(255,177,93,.12); color: #ffd39a; border: 1px solid rgba(255,177,93,.35); }
.td-risk.r { background: rgba(255,122,138,.13); color: #ffb3bd; border: 1px solid rgba(255,122,138,.4); }
.td-risk-note { font-size: 11px; opacity: .85; }
.td-bars { display: grid; gap: 6px; }
.td-bar-row { display: flex; align-items: center; gap: 8px; }
.td-bar-lbl { font-size: 12px; color: #cfe0ff; width: 76px; flex: 0 0 auto; }
.td-bar { flex: 1; height: 12px; background: #1b2640; border-radius: 6px; overflow: hidden; }
.td-bar i { display: block; height: 100%; border-radius: 6px; }
.td-bar-val { font-size: 12px; font-weight: 700; color: #fff; width: 30px; text-align: right; }

/* Planner ส่วนตัว */
.mp-row { display: flex; align-items: center; gap: 8px; background: #0e1426; border: 1px solid #243154; border-radius: 8px; padding: 6px 10px; margin-bottom: 5px; font-size: 12.5px; color: #e6eefc; }
.mp-row b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-row span:last-child { color: #9fb6dd; font-size: 11px; white-space: nowrap; }
.mp-st { width: 9px; height: 9px; border-radius: 50%; background: #8a93ad; flex: 0 0 auto; }
.mp-st.doing { background: #ffb15d; } .mp-st.review { background: #5db8ff; } .mp-st.done { background: #45e08a; } .mp-st.ready { background: #45e08a; } .mp-st.posted { background: #6a9; }
.mp-leave-add { display: flex; gap: 8px; margin: 6px 0; }
.mp-leave-add input { border: 1.5px solid #2f3f63; border-radius: 8px; padding: 6px 9px; background: #0e1426; color: #fff; }
.mp-leaves { display: flex; flex-wrap: wrap; gap: 6px; }
.mp-leave-chip { background: rgba(255,177,93,.15); border: 1px solid rgba(255,177,93,.4); color: #ffd39a; border-radius: 999px; padding: 4px 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.mp-leave-del { cursor: pointer; color: #ff9aa5; }
/* ป๊อปอัปงานรายคน (คลิกตัวละครในออฟฟิศ) */
.pt-body { max-height: 70vh; overflow-y: auto; }
.pt-sec-h { font-size: 12.5px; font-weight: 800; color: #9fb6dd; margin: 12px 0 6px; }
.pt-row { display: flex; align-items: center; gap: 8px; background: #0e1426; border: 1px solid #243154; border-radius: 8px; padding: 7px 11px; margin-bottom: 5px; font-size: 12.5px; color: #e6eefc; cursor: pointer; }
.pt-row:hover { background: #16203a; }
.pt-row b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-row span:last-child { color: #9fb6dd; font-size: 11px; white-space: nowrap; }
/* v369 week-view classes */
.pt-mon-nav { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; padding-bottom:8px; border-bottom:1px solid #1e2d4a; }
.pt-mon-label { font-size:14px; font-weight:700; color:#e2e8f0; }
.pt-week-hd { font-size:11.5px; font-weight:700; color:#5d7aad; margin:10px 0 5px; padding-top:6px; border-top:1px solid #1c2a45; }
.pt-day-grp { display:flex; gap:8px; margin-bottom:5px; align-items:flex-start; }
.pt-day-tag { min-width:34px; flex:0 0 34px; display:flex; flex-direction:column; align-items:center; padding:5px 2px; border-radius:7px; background:#0a1020; }
.pt-day-tag.today { background:#1a3a6a; outline:1.5px solid #3b82f6; }
.pt-day-num { font-size:13px; font-weight:700; color:#e2e8f0; line-height:1.2; }
.pt-day-abbr { font-size:9.5px; color:#4b6a8a; margin-top:1px; }
.pt-day-tasks { flex:1; display:flex; flex-direction:column; gap:4px; }
/* ตรวจโพสต์ */
.pr-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.pr-imgs img { max-width: 150px; max-height: 150px; border-radius: 10px; border: 1px solid var(--line); object-fit: cover; cursor: zoom-in; }
.pr-rejrow { margin: 10px 0; }
.pr-rejrow input { width: 100%; border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 11px; font-size: 13px; font-family: inherit; }
.pr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.task-post { cursor: pointer; transition: background .12s; }
.task-post:hover { background: rgba(99,102,241,.08); }
@keyframes postFlash { 0%,100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); } 30% { box-shadow: 0 0 0 4px rgba(99,102,241,.5); } }
.post-flash { animation: postFlash 1.6s ease; border-radius: 14px; }
.task-job.is-brief { border-left: 3px solid #9b8cff; background: rgba(155,140,255,.06); }
.task-job.is-collab { border-left: 3px solid #45e08a; background: rgba(69,224,138,.07); }
/* แบนเนอร์/ป๊อปอัพ คำขอช่วยงาน */
.collab-box { border-color: rgba(69,224,138,.45); background: rgba(69,224,138,.08); }
.ci-list { display: grid; gap: 8px; margin-top: 8px; }
.ci-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #0e1426; border: 1px solid #243154; border-radius: 8px; padding: 10px 12px; }
.ci-info b { display: block; color: #e6eefc; font-size: 13.5px; }
.ci-info span { color: #9fb6dd; font-size: 12px; }
.ci-btns { display: flex; gap: 6px; flex: 0 0 auto; }
/* Planner: scroll + ควบคุมรายตัว */
#myPlannerModal .avatar-box { max-height: 88vh; overflow-y: auto; }
.mp-modal { width: min(960px, 96vw) !important; max-width: 96vw !important; }
/* ป๊อปอัปเพิ่มงานด่วน (เด้งซ้อนทับ mp-modal) — แยกคลาสออกมา เว้นระยะจากขอบจอ */
.mp-quick { width: min(805px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); margin: 24px 16px; box-sizing: border-box; }
.mp-topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.mp-view-toggle { display: flex; gap: 4px; }
.mp-view-btn { background: #1a2540; border: 1.5px solid #2f3f63; border-radius: 8px; color: #9fb6dd; font-size: 12.5px; padding: 5px 14px; cursor: pointer; transition: all .15s; }
.mp-view-btn.active { background: #2563eb; border-color: #2563eb; color: #fff; }
/* ปฏิทิน */
.mpc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 12px; } /* v1646: minmax(0,1fr) — ชิปงานไม่ดัน/ขยายคอลัมน์ (มือถือ: คอลัมน์ไม่เท่ากัน วันพุธถูกตัด) */
.mpc-cell { min-width: 0; overflow: hidden; }
.mpc-job { min-width: 0; }
.mpc-header { text-align: center; font-size: 11px; font-weight: 700; color: #9fb6dd; padding: 4px 0; }
.mpc-cell { background: #0e1426; border: 1px solid #1b2640; border-radius: 8px; min-height: 72px; padding: 4px 5px; }
.mpc-cell.mpc-today { border-color: #2563eb; background: #0e1f40; }
.mpc-cell.mpc-leave { background: #1a2010; }
.mpc-cell.mpc-empty { background: transparent; border-color: transparent; }
.mpc-daynum { font-size: 11px; font-weight: 700; color: #9fb6dd; margin-bottom: 3px; display: flex; align-items: center; justify-content: space-between; }
.mpc-today .mpc-daynum { color: #60a5fa; }
.mpc-add-hint { opacity: 0; color: #818cf8; font-weight: 800; font-size: 14px; line-height: 1; transition: opacity .12s; }
.mpc-cell.mpc-clickable { cursor: pointer; transition: border-color .12s, background .12s; }
.mpc-cell.mpc-clickable:hover { border-color: #6366f1; background: #141c33; }
.mpc-cell.mpc-clickable:hover .mpc-add-hint { opacity: 1; }
.mpc-job { font-size: 10.5px; border-radius: 5px; padding: 2px 5px; margin-bottom: 2px; cursor: pointer; white-space: nowrap; overflow: hidden; background: #1a2540; color: #e6eefc; display: flex; align-items: center; gap: 4px; }
.mpc-job:hover { background: #2563eb; }
.mpc-job.mpc-proj { background: #123a33; color: #b7f5df; } .mpc-job.mpc-proj.done { opacity: .6; text-decoration: line-through; } .mpc-job.mpc-proj:hover { background: #0f766e; color: #fff; } /* v1645: งานจากโปรเจค */
.mpc-job.is-pending { background: #3a2f10; color: #fde68a; }
.mpc-job.is-pending:hover { background: #b45309; color: #fff; }
/* v1011: ชิปโพสต์ในปฏิทิน Planner (แยกจากงาน Brief ด้วยขอบซ้ายสีม่วง) */
.mpc-job.mpc-post { background: #16223f; border-left: 3px solid #8b5cf6; }
.mpc-job.mpc-post:hover { background: #7c3aed; }
/* v1012: ปุ่มย้ายหมวดงาน (Senior) + ตัวหนังสือชิปตัดพอดี */
.mpc-jtxt { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mpc-movecat { flex: 0 0 auto; margin-left: 3px; border: 1px solid #3a4a72; background: rgba(148,163,216,.12); color: #cbd5f5; border-radius: 4px; font-size: 10px; line-height: 1; padding: 1px 3px; cursor: pointer; }
.mpc-movecat:hover { background: #6366f1; color: #fff; border-color: #6366f1; }
.mp-apv-badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-left: 4px; vertical-align: middle; }
.mp-apv-badge.wait { background: #fef3c7; color: #b45309; }
.mp-apv-badge.rej { background: #fee2e2; color: #b91c1c; }
.mp-apv-badge.rev { background: #dbeafe; color: #1d4ed8; }
/* แถบเพิ่มงานใหม่ */
.mp-addbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; align-items: center; }
.mp-addbar input[type=text] { flex: 1; min-width: 160px; border: 1.5px solid #2f3f63; border-radius: 8px; padding: 7px 10px; background: #0e1426; color: #fff; font-size: 13px; }
.mp-addbar input[type=date], .mp-addbar select { border: 1.5px solid #2f3f63; border-radius: 8px; padding: 7px 9px; background: #0e1426; color: #fff; font-size: 12.5px; }
/* v1008: quick-add ปฏิทิน — กันเนื้อหาล้นแนวนอน + จัดสเปซให้อ่านง่าย */
#mpQuickAdd .avatar-box { overflow-x: hidden; padding: 16px 18px; }
#mpQuickAdd input, #mpQuickAdd select, #mpQuickAdd button, #mpQuickAdd .wc-picker { box-sizing: border-box; max-width: 100%; }
#mpQuickAdd #qaBrief, #mpQuickAdd #qaPost { gap: 10px; }
#mpQuickAdd #qaBrief > input, #mpQuickAdd #qaBrief > select, #mpQuickAdd #qaPost > input, #mpQuickAdd #qaPost > select,
#mpQuickAdd #qaBrief > .primary-button, #mpQuickAdd #qaPost > .primary-button { width: 100%; }
#mpQuickAdd #qaTitle, #mpQuickAdd #qaPTitle, #mpQuickAdd select { border: 1.5px solid #2f3f63; border-radius: 9px; padding: 10px 12px; background: #0e1426; color: #fff; font-size: 13px; font-family: inherit; }
#mpQuickAdd input[type=time] { border: 1.5px solid #2f3f63; border-radius: 8px; padding: 6px 8px; background: #0e1426; color: #fff; font-size: 12.5px; }
#mpQuickAdd .qa-due-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #9fb0d6; }
#mpQuickAdd .qa-due-row label { flex: 0 0 auto; white-space: nowrap; }
#mpQuickAdd #qaTime, #mpQuickAdd #qaPTime { flex: 1 1 0; min-width: 0; width: auto; border-radius: 9px; padding: 10px 12px; font-size: 13px; font-family: inherit; }
/* v1008: ตัวเลือกสินค้าแบบเต็ม (หมวด+ค้นหา+ชิป) ใช้ซ้ำได้ */
.wc-picker { display: flex; flex-direction: column; gap: 7px; width: 100%; }
.wc-pk-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: stretch; }
.wc-pk-cat { flex: 1 1 130px; min-width: 0; border: 1.5px solid #2f3f63; border-radius: 8px; padding: 8px 9px; background: #0e1426; color: #fff; font-size: 12.5px; font-family: inherit; }
.wc-pk-search { flex: 3 1 170px; min-width: 0; border: 1.5px solid #2f3f63; border-radius: 8px; padding: 8px 10px; background: #0e1426; color: #fff; font-size: 13px; font-family: inherit; }
.wc-pk-add { flex: 0 0 auto; padding: 0 14px; border: 1.5px solid #6366f1; background: #6366f1; color: #fff; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
.wc-pk-add:hover { background: #4f52e0; }
.wc-pk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wc-pk-chips:empty { display: none; }
.wc-chip { display: inline-flex; align-items: center; gap: 5px; background: #1c2748; color: #c7d2fe; border: 1px solid #3a4a72; border-radius: 999px; padding: 3px 9px; font-size: 12px; }
.wc-chip button { border: 0; background: transparent; color: #93a4d8; cursor: pointer; font-weight: 700; padding: 0 1px; font-size: 12px; }
.wc-chip button:hover { color: #fca5a5; }
/* ตารางงานของฉัน */
.mp-table-wrap { overflow-x: auto; margin-bottom: 4px; }
.mp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; color: #e6eefc; }
.mp-table thead th { text-align: left; font-size: 11px; color: #9fb6dd; font-weight: 700; padding: 4px 8px; border-bottom: 1px solid #243154; white-space: nowrap; }
.mp-table td { padding: 6px 8px; border-bottom: 1px solid #1b2640; vertical-align: middle; }
.mp-table tr.is-leave { opacity: .7; }
.mp-tname { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
/* v1009: วันที่/เวลาในคอลัมน์กำหนดส่ง — วางซ้อนบน-ล่าง กันตัวเลขซ้อนไอคอน/เบียดคอลัมน์อื่น */
.mp-tdue { white-space: nowrap; color: #cfe0ff; }
.mp-due-edit, .mp-duetime-edit { box-sizing: border-box; display: block; width: 132px; border: 1px solid #2f3f63; border-radius: 6px; padding: 4px 6px; background: #0e1426; color: #eef1ff; font-size: 11.5px; font-family: inherit; }
.mp-duetime-edit { width: 132px; margin: 4px 0 0 0; }
.mp-due-edit.no-due { border-color: #f0b04a; background: #2a2412; box-shadow: 0 0 0 1px #f0b04a55; }
.mp-table .mp-st { display: inline-block; }
.mp-job { flex-wrap: wrap; }
.mp-job > span:nth-of-type(1) { /* date */ }
.mp-status { border: 1px solid #2f3f63; border-radius: 6px; background: #16203a; color: #fff; font-size: 11px; padding: 3px 5px; flex: 0 0 auto; }
.mp-edit { background: none; border: 1px solid #2f3f63; border-radius: 6px; color: #cfe0ff; cursor: pointer; font-size: 12px; padding: 2px 7px; flex: 0 0 auto; }
.mp-edit:hover { background: #243154; }
/* v1013: ปุ่มย้ายหมวด (Senior) ในลิสต์ + แถวโพสต์คลิกได้ + ป้ายเจ้าของงาน */
.mp-tact { white-space: nowrap; display: flex; gap: 5px; align-items: center; }
.mp-movecat { background: rgba(148,163,216,.12); border: 1px solid #3a4a72; border-radius: 6px; color: #cbd5f5; cursor: pointer; font-size: 12px; padding: 2px 7px; flex: 0 0 auto; }
.mp-movecat:hover { background: #6366f1; color: #fff; border-color: #6366f1; }
.mp-prow { cursor: pointer; position: relative; }
.mp-prow:hover { background: #1a2540; }
.mp-prow .mp-movecat { margin-left: auto; }
.mp-owner { color: #93a4d8; font-weight: 500; font-size: 11px; }
/* v1015: รายการงานที่ยังไม่มีกำหนดส่ง (ใต้ปฏิทิน) */
.mpc-nodue-list { display: flex; flex-direction: column; gap: 6px; }
.mpc-nodue-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #141d33; border: 1px solid #243154; border-left: 3px solid #f0b04a; border-radius: 8px; font-size: 12.5px; color: #e6eefc; }
.mpc-nodue-row.mp-prow { border-left-color: #8b5cf6; }
.mpc-nodue-t { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mpc-nodue-row .mp-due-edit, .mpc-nodue-row .mp-pdate-edit { flex: 0 0 auto; display: inline-block; width: 138px; margin: 0; }
/* v1016: ลากงานที่ไม่มีวัน → วางบนช่องปฏิทิน */
.mpc-grip { flex: 0 0 auto; cursor: grab; color: #7c88b0; font-size: 15px; line-height: 1; user-select: none; padding: 0 2px; }
.mpc-grip:active { cursor: grabbing; }
.mpc-nodue-row[draggable] { cursor: grab; }
.mpc-nodue-row.dragging { opacity: .5; }
.mpc-cell.mpc-dragover { outline: 2px dashed #6366f1; outline-offset: -2px; background: #1e2a4d !important; }
/* v1018: ลากสลับลำดับขั้นตอนงานในโปรเจค (โหมดปลดล็อค) */
.proj-step-card[draggable="true"] { cursor: grab; }
.proj-step-card.proj-dragging { opacity: .5; }
.proj-step-card.proj-drop-over { outline: 2px dashed #6366f1; outline-offset: -2px; }
.proj-step-grip:active { cursor: grabbing; }

/* popup ตรวจงาน */
.rv-meta { font-size: 12.5px; color: #9fb6dd; margin: 2px 0; }
.rv-brief { white-space: pre-wrap; background: #0e1426; border: 1px solid #243154; border-radius: 8px; padding: 8px 11px; font-size: 13px; color: #e6eefc; }
.rv-links { margin: 8px 0; }
.rv-links a { color: #5db8ff; font-weight: 700; }
.rv-items { display: grid; gap: 8px; max-height: 280px; overflow-y: auto; }
.rv-item { background: #0e1426; border: 1px solid #243154; border-radius: 10px; padding: 8px 11px; }
.rv-item-h { font-size: 13px; color: #fff; margin-bottom: 3px; }
.rv-fix-row { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #fca5a5; font-weight: 600; cursor: pointer; margin: 2px 0 5px; }
.rv-fix-row input { width: auto; }
.rv-fix-note { width: 100%; padding: 5px 9px; border: 1px solid #2f3f63; border-radius: 7px; background: #0a1020; color: #fff; font-size: 12.5px; margin-bottom: 4px; }
.rv-item:has(.rv-fix-chk:checked) { border-color: #f0a500; background: #1a1407; }
.rv-link-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; flex-wrap: wrap; }
.rv-link-path { background: #0a1020; border: 1px solid #2f3f63; border-radius: 6px; padding: 4px 8px; color: #cfe0ff; font-size: 12.5px; word-break: break-all; flex: 1; min-width: 0; }
.rv-links a { color: #8ab4ff; word-break: break-all; }
.rv-link-copy { flex-shrink: 0; padding: 3px 10px; border: 1px solid #2f3f63; border-radius: 6px; background: #1a2440; color: #cfe0ff; font-size: 12px; cursor: pointer; }
.rv-link-copy:hover { background: #243154; }
.rv-sub-imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.rv-sub-imgs img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid #2f3f63; cursor: zoom-in; }
.bjm-sub-attach { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--brand, #6366f1); font-weight: 600; cursor: pointer; margin-top: 4px; }
.bjm-sub-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.bjm-sub-img { position: relative; }
.bjm-sub-img img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line, #2f3f63); }
.bjm-sub-img button { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; border: none; background: #ef4444; color: #fff; font-size: 11px; cursor: pointer; line-height: 1; }
.bjm-item-revise-hl { border-color: #f0a500 !important; background: #fff8ec; box-shadow: 0 0 0 2px #fbbf2433; }
.bjm-item-revise { font-size: 12.5px; color: #b35a00; background: #fff4e0; border: 1px solid #f0a500; border-radius: 7px; padding: 5px 9px; margin: 4px 0; line-height: 1.5; }
.bjm-item-send-row { margin-top: 6px; }
.bjm-item-send { color: var(--brand, #6366f1); }
.bjm-item-sent { margin-top: 6px; }
.bjm-sent-lbl { font-size: 11.5px; color: #16a34a; font-weight: 600; display: block; margin-bottom: 3px; }
.rv-item-brief { font-size: 12.5px; color: #cfe0ff; white-space: pre-wrap; }
.rv-item-img { margin-top: 6px; max-width: 100%; max-height: 220px; border-radius: 8px; display: block; }
.rv-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.rv-redo { margin-top: 12px; padding-top: 12px; border-top: 1px solid #243154; display: grid; gap: 8px; }
.rv-redo label { font-size: 13px; color: #cfe0ff; display: flex; align-items: center; gap: 8px; }
.rv-redo input { border: 1.5px solid #2f3f63; border-radius: 8px; padding: 7px 9px; font-size: 13px; background: #0e1426; color: #fff; }
.rv-redo input[type="text"] { width: 100%; }
.kpi-target-inp { width: 72px; border: 1.5px solid #2f3f63; border-radius: 7px; padding: 4px 7px; font-size: 13px; background: #0e1426; color: #fff; }
.kpi-target-inp:focus { border-color: #5db8ff; outline: none; }
.kpi-bar { width: 100%; min-width: 90px; height: 9px; background: #1b2640; border-radius: 6px; overflow: hidden; }
.kpi-bar i { display: block; height: 100%; border-radius: 6px; background: #5db8ff; }
.kpi-bar i.g { background: #45e08a; } .kpi-bar i.o { background: #ffb15d; } .kpi-bar i.r { background: #ff7a8a; }
.kpi-trend { display: flex; align-items: flex-end; gap: 16px; height: 150px; padding: 8px 4px; }
.kpi-trend-col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.kpi-trend-bar { width: 34px; height: 100px; background: #1b2640; border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.kpi-trend-bar i { width: 100%; border-radius: 6px 6px 0 0; background: #5db8ff; }
.kpi-trend-bar i.g { background: #45e08a; } .kpi-trend-bar i.o { background: #ffb15d; } .kpi-trend-bar i.r { background: #ff7a8a; }
.kpi-trend-val { font-size: 11px; color: #cfe0ff; font-weight: 700; }
.kpi-trend-m { font-size: 10px; color: #9fb6dd; }
/* v402: KPI Position Table */
.kpi-pos-group { margin-bottom: 22px; }
.kpi-pos-header { font-size: 13.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; padding: 7px 4px 7px 0; border-bottom: 2px solid currentColor; margin-bottom: 8px; }
.kpi-pos-count { font-size: 11px; background: rgba(255,255,255,.08); border-radius: 10px; padding: 1px 8px; color: #9fb6dd; font-weight: 600; margin-left: 4px; }
/* v402: Monthly Stack Chart */
.kpi-stack-chart { padding: 4px 0 8px; }
.kpi-stack-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.kpi-stack-leg-item { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #cfe0ff; }
.kpi-stack-leg-item i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.kpi-stack-bars { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding-bottom: 2px; }
.kpi-stack-col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; max-width: 90px; height: 100%; justify-content: flex-end; }
.kpi-stack-bar { width: 100%; height: 120px; background: #1b2640; border-radius: 7px; display: flex; flex-direction: column; align-items: stretch; overflow: hidden; justify-content: flex-end; }
.kpi-stack-inner { width: 100%; display: flex; flex-direction: column-reverse; border-radius: 7px 7px 0 0; overflow: hidden; transition: height .4s; }
.kpi-stack-seg { width: 100%; }
.kpi-stack-val { font-size: 11px; color: #cfe0ff; font-weight: 700; }
.kpi-stack-m { font-size: 10.5px; color: #7f8aa6; }

/* v403 — Profile Picture + KPI Person Header */
.prof-circle { border-radius: 50%; object-fit: cover; display: inline-block; flex: 0 0 auto; }
.prof-circle-init { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; flex: 0 0 auto; }
.kpi-mini-avatar { display: inline-flex; align-items: center; vertical-align: middle; margin-right: 6px; }
.kpi-mini-avatar .prof-circle,
.kpi-mini-avatar .prof-circle-init { width: 28px; height: 28px; font-size: 11px; }
.su-photo-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px 8px; }
.su-pic-btn { position: relative; background: none; border: none; padding: 0; cursor: pointer; border-radius: 50%; flex: 0 0 auto; }
.su-pic-btn .prof-circle,
.su-pic-btn .prof-circle-init { width: 52px; height: 52px; font-size: 20px; transition: filter .2s; }
.su-pic-btn:hover .prof-circle,
.su-pic-btn:hover .prof-circle-init { filter: brightness(.7); }
.su-pic-cam { position: absolute; bottom: 0; right: 0; font-size: 14px; background: #1b2640; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; pointer-events: none; border: 1.5px solid #2a3a5e; }
.su-info { flex: 1; min-width: 0; }
.su-name { font-size: 13.5px; font-weight: 700; color: #eef1ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-role { font-size: 11px; color: #7f8aa6; margin-top: 1px; }
.su-login-time { font-size: 10.5px; color: #4a5568; margin-top: 2px; }
.kpi-emp-header { display: flex; align-items: flex-start; gap: 16px; padding: 16px 0 18px; border-bottom: 1px solid #1e2d4a; margin-bottom: 16px; }
.kpi-emp-pic .prof-circle,
.kpi-emp-pic .prof-circle-init { width: 72px; height: 72px; font-size: 27px; flex: 0 0 auto; }
.kpi-emp-info { flex: 1; min-width: 0; }
.kpi-emp-fullname { font-size: 18px; font-weight: 800; color: #eef1ff; margin-bottom: 5px; }
.kpi-emp-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 5px; }
.kpi-emp-nick { font-size: 12px; background: #1b2640; color: #60a5fa; border-radius: 6px; padding: 2px 8px; font-weight: 600; }
.kpi-emp-id { font-size: 12px; color: #7f8aa6; }
.kpi-emp-pos { font-size: 12px; font-weight: 700; }
.kpi-emp-role { font-size: 12px; color: #9fb6dd; }
.ppic-preview { margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; }
.ppic-actions { display: flex; flex-direction: column; gap: 8px; }
.ppic-upload-label { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: #2563eb; color: #fff; border-radius: 8px; padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s; }
.ppic-upload-label:hover { background: #1d4ed8; }
.ppic-upload-label input[type=file] { display: none; }
.ppic-remove-btn { background: #7f1d1d; color: #fca5a5; border: none; border-radius: 8px; padding: 7px 16px; font-size: 12px; cursor: pointer; font-weight: 600; }
.ppic-remove-btn:hover { background: #991b1b; }
.ppic-status { font-size: 11.5px; color: #34d399; margin-top: 4px; min-height: 18px; }

/* v404 — Monthly Goals (เป้าหมายรายเดือน) */
/* Goal picker ในฟอร์ม */
.bj-goal-wrap { margin: 8px 0; padding: 10px 12px; background: rgba(74,222,128,.06); border: 1px solid rgba(74,222,128,.2); border-radius: 8px; }
.bj-goal-label { font-size: 12px; color: #34d399; font-weight: 600; margin-bottom: 6px; }
.bj-goal-select { width: 100%; background: #0a1020; color: #eef1ff; border: 1px solid #1e3a5f; border-radius: 6px; padding: 5px 8px; font-size: 12.5px; }
.bj-goal-select option { background: #0a1020; color: #eef1ff; }
/* Goal badge ใน job card */
.goal-badge { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 700; background: rgba(74,222,128,.15); color: #34d399; border: 1px solid rgba(74,222,128,.3); border-radius: 5px; padding: 1px 6px; margin-left: 5px; vertical-align: middle; }
/* Goal Manager Popup */
.gm-month-row { margin-bottom: 14px; }
.gm-month-sel { background: #0f1a2e; color: #eef1ff; border: 1px solid #1e3a5f; border-radius: 6px; padding: 5px 10px; font-size: 13px; cursor: pointer; }
.gm-item-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; min-height: 40px; }
.gm-item-row { background: #0f1a2e; border: 1px solid #1e3a5f; border-radius: 8px; padding: 10px 12px; }
.gm-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.gm-item-num { color: #60a5fa; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.gm-item-title { flex: 1; background: #0a1020; color: #eef1ff; border: 1px solid #1e3a5f; border-radius: 6px; padding: 5px 8px; font-size: 13px; }
.gm-item-remove { flex: 0 0 auto; font-size: 12px; padding: 2px 8px; }
.gm-item-sub { display: flex; flex-direction: column; gap: 6px; }
.gm-item-sub label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: #7f8aa6; }
.gm-item-sub input { background: #0a1020; color: #eef1ff; border: 1px solid #1e3a5f; border-radius: 6px; padding: 4px 8px; font-size: 12.5px; }
.gm-empty { color: #7f8aa6; font-size: 13px; text-align: center; padding: 14px; } /* v411 */
.gm-add-btn { width: 100%; margin-bottom: 14px; margin-top: 2px; }
/* v415: due date + move month row */
.gm-due-row { display:flex; align-items:center; gap:10px; margin:4px 0 8px; flex-wrap:wrap; }
.gm-due-label { display:flex; align-items:center; gap:6px; font-size:11.5px; color:#9fb6dd; flex:1; min-width:180px; }
.gm-item-due { background:#0a1020; color:#eef1ff; border:1px solid #1e3a5f; border-radius:6px; padding:4px 8px; font-size:12px; flex:1; min-width:120px; color-scheme:dark; }
.gm-item-move { font-size:11px; padding:3px 8px; white-space:nowrap; }
.gm-move-sel { width:100%; margin-top:6px; background:#0a1020; color:#eef1ff; border:1px solid #3a6fd6; border-radius:6px; padding:5px 10px; font-size:12px; cursor:pointer; }
.gm-move-sel option { background:#0a1020; color:#eef1ff; }
/* v416: goal commitment cards ในคอลัมน์ task board */
.goal-commit-list { display:flex; flex-direction:column; gap:7px; margin:0 0 10px; }
.goal-commit-card { border-radius:8px; padding:8px 12px; font-size:12px; }
.goal-commit-title { font-weight:700; font-size:13px; margin-bottom:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.goal-commit-meta { display:flex; gap:10px; flex-wrap:wrap; color:#b9c2e0; font-size:11.5px; margin-bottom:3px; }
.goal-commit-warn { color:#ff6b6b; font-size:11.5px; margin-top:4px; background:rgba(255,107,107,.12); border-radius:5px; padding:3px 7px; }
.goal-commit-warn b { color:#ff6b6b; }
.goal-commit-ok { color:#34d399; font-size:11.5px; margin-top:3px; }
.goal-commit-bonus { background:linear-gradient(90deg,#f59e0b22,#fbbf2422); border:1.5px solid #f59e0b; border-radius:8px; padding:7px 12px; color:#b45309; font-size:13px; font-weight:700; text-align:center; margin-top:4px; display:flex; align-items:center; justify-content:center; gap:8px; flex-wrap:wrap; }
.goal-commit-bonus b { background:#f59e0b; color:#fff; border-radius:999px; padding:2px 10px; font-size:12px; white-space:nowrap; }
/* v413: task counter badge ใน goal item row */
.gm-task-badge { display:flex; align-items:center; gap:8px; font-size:11.5px; background:rgba(96,165,250,.08); border:1px solid rgba(96,165,250,.2); border-radius:6px; padding:5px 10px; margin:4px 0 8px; flex-wrap:wrap; }
.gm-task-total { color:#60a5fa; font-weight:600; }
.gm-task-sep { color:#3a4a6a; }
.gm-task-done { color:#34d399; }
.gm-task-win { color:#fbbf24; font-weight:700; }
.gm-task-none { color:#4a5568; background:none; border-color:transparent; font-size:11px; padding:2px 10px; }
/* Goal Review Section (เจนตรวจงาน) */
.goal-review-box { background: rgba(74,222,128,.06); border: 1.5px solid rgba(74,222,128,.25); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.goal-review-head { font-size: 13px; font-weight: 800; color: #34d399; margin-bottom: 10px; }
.goal-review-card { display: flex; align-items: center; gap: 10px; background: #0f1a2e; border-radius: 7px; padding: 8px 10px; margin-bottom: 7px; }
.goal-review-info { flex: 1; min-width: 0; }
.goal-review-title { font-size: 13px; font-weight: 600; color: #eef1ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal-review-meta { font-size: 11px; color: #7f8aa6; margin-top: 2px; }
.goal-approve-btn { background: #065f46; color: #34d399; border: none; border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; font-weight: 600; flex: 0 0 auto; }
.goal-reject-btn { background: #7f1d1d; color: #fca5a5; border: none; border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; font-weight: 600; flex: 0 0 auto; }
/* Goal Sent (ทีมรออนุมัติ) */
.goal-sent-wrap { background: rgba(96,165,250,.06); border: 1px solid rgba(96,165,250,.2); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.goal-sent-head { font-size: 12px; font-weight: 700; color: #60a5fa; margin-bottom: 6px; }
.goal-sent-item { font-size: 12.5px; color: #9fb6dd; padding: 3px 0; }
.goal-sent-rejected { color: #fca5a5; }
.goal-sent-status { font-size: 11px; color: #7f8aa6; }
/* Goal Carryover Banner */
.goal-carryover-box { background: rgba(251,191,36,.06); border: 1.5px solid rgba(251,191,36,.25); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.goal-carryover-head { font-size: 13px; font-weight: 800; color: #fbbf24; margin-bottom: 12px; }
.goal-carryover-person { margin-bottom: 10px; }
.goal-carryover-who { font-size: 12px; font-weight: 700; color: #9fb6dd; display: block; margin-bottom: 5px; }
.goal-carryover-item { background: #0f1a2e; border-radius: 7px; padding: 8px 10px; margin-bottom: 6px; }
.goal-carryover-title { font-size: 13px; color: #eef1ff; margin-bottom: 5px; }
.goal-carryover-status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.goal-status-btn { background: #1b2640; color: #cfe0ff; border: 1px solid #2a3a5e; border-radius: 6px; padding: 4px 10px; font-size: 11.5px; cursor: pointer; }
.goal-status-btn:hover { background: #2a3a5e; }
.goal-status-chip { font-size: 11px; font-weight: 700; border-radius: 5px; padding: 2px 8px; }
.goal-status-continue { background: rgba(74,222,128,.12); color: #34d399; }
.goal-status-pause { background: rgba(251,191,36,.12); color: #fbbf24; }
.goal-status-postpone { background: rgba(96,165,250,.12); color: #60a5fa; }
.goal-status-note { font-size: 11px; color: #7f8aa6; }

/* v583: Goal item delivery condition panel */
.gm-cond-details { margin-top: 8px; border-radius: 7px; border: 1px solid #2a4a7f; background: rgba(14,22,44,.7); overflow: hidden; }
.gm-cond-summary { cursor: pointer; font-size: 12.5px; color: #bfdbfe; padding: 7px 10px; list-style: none; display: flex; align-items: center; gap: 6px; user-select: none; -webkit-user-select: none; font-weight: 600; background: rgba(30,58,95,.4); }
.gm-cond-summary:hover { background: rgba(96,165,250,.15); }
.gm-cond-summary::-webkit-details-marker { display: none; }
details[open] > .gm-cond-summary { border-bottom: 1px solid #2a4a7f; background: rgba(30,58,95,.6); }
.gm-cond-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.gm-cond-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.gm-cond-label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: #7f8aa6; flex: 1 1 140px; min-width: 0; }
.gm-cond-label select { background: #0a1020; color: #eef1ff; border: 1px solid #1e3a5f; border-radius: 6px; padding: 4px 8px; font-size: 12px; }
.gm-cond-label input[type=number] { background: #0a1020; color: #eef1ff; border: 1px solid #1e3a5f; border-radius: 6px; padding: 4px 8px; font-size: 12px; }
.gm-cond-target-wrap { display: flex; align-items: center; gap: 5px; color: #9fb6dd; font-size: 12px; }
.gm-cond-target-wrap input { width: 72px; flex: 0 0 72px; }
.gm-cond-odr-badge { margin-top: 4px; background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.3); border-radius: 6px; padding: 5px 10px; font-size: 11.5px; color: #fbbf24; }

/* v583: Goal overdue popup */
.gm-odr-title { font-size: 15px; font-weight: 700; color: #eef1ff; margin-bottom: 6px; padding: 0 2px; }
.gm-odr-progress { font-size: 12.5px; color: #9fb6dd; background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.2); border-radius: 6px; padding: 7px 12px; margin-bottom: 14px; }
.gm-odr-progress b { color: #f87171; }
.gm-odr-form { display: flex; flex-direction: column; gap: 10px; }
.gm-odr-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #7f8aa6; }
.gm-odr-textarea { background: #0a1020; color: #eef1ff; border: 1px solid #1e3a5f; border-radius: 7px; padding: 8px 10px; font-size: 13px; resize: vertical; min-height: 70px; font-family: inherit; width: 100%; box-sizing: border-box; }
.gm-odr-textarea:focus { outline: none; border-color: #60a5fa; box-shadow: 0 0 0 2px rgba(96,165,250,.15); }
.gm-odr-choices { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.gm-odr-choice { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #eef1ff; padding: 7px 10px; border-radius: 6px; cursor: pointer; border: 1px solid #1e3a5f; background: #0a1020; transition: background .1s; }
.gm-odr-choice:hover { background: rgba(96,165,250,.08); border-color: #60a5fa; }
.gm-odr-choice input[type=radio] { accent-color: #60a5fa; width: 14px; height: 14px; margin: 0; flex: 0 0 14px; }
.gm-odr-input { background: #0a1020; color: #eef1ff; border: 1px solid #1e3a5f; border-radius: 6px; padding: 5px 8px; font-size: 12.5px; width: 100%; box-sizing: border-box; }
.gm-odr-sel { background: #0a1020; color: #eef1ff; border: 1px solid #1e3a5f; border-radius: 6px; padding: 5px 8px; font-size: 12.5px; width: 100%; }

/* คำใบ้ลาก + ปุ่มรีเซ็ต */
.o3-hint { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: #9fb6dd; margin: 8px 2px 0; }
.o3-size { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.o3-size input[type="range"] { width: 110px; accent-color: #5db8ff; cursor: pointer; }
.o3-reset { font-size: 11px; font-weight: 700; color: #cfe0ff; background: #1b2640; border: 1px solid #2f3f63; border-radius: 7px; padding: 3px 9px; cursor: pointer; }
.o3-reset:hover { background: #243154; }
.o3-break { border-color: #b07a2f; color: #ffd9a3; }
.o3-break:hover { background: #3a2a14; }
.o3-break.on-break { border-color: #2fe36a; color: #b9ffd0; background: #15301f; }
.o3-reset:disabled { opacity: .45; cursor: not-allowed; }

/* แถบสถานะทีมใต้ห้อง */
.o3-statusbar { margin: 12px 0 4px; }
.o3-status-head { font-size: 12px; font-weight: 800; letter-spacing: .04em; color: #9fb6dd; margin: 0 0 6px 2px; }
.o3-status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 8px; }
.o3-scard {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  background: #121a30; border: 1.5px solid #243154; border-left-width: 4px; border-radius: 10px;
}
.o3-scard.working { border-left-color: #2fe36a; } .o3-scard.review { border-left-color: #5db8ff; }
.o3-scard.idle { border-left-color: #8a93ad; } .o3-scard.offline { border-left-color: #4a5270; opacity: .72; }
.o3-scard.is-me { box-shadow: 0 0 0 1.5px #f5a623 inset; }
.o3-scard-fig { width: 42px; height: 48px; display: flex; align-items: flex-end; justify-content: center; flex: 0 0 auto; overflow: hidden; }
.o3-scard-fig .o3-sprite, .o3-scard-fig .o3-svg { width: 42px; }
.o3-scard.offline .o3-sprite, .o3-scard.offline .o3-svg { filter: grayscale(1) brightness(.7); }
.o3-scard-body { min-width: 0; }
.o3-scard-top { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: #fff; }
.o3-scard-role { font-size: 9.5px; font-weight: 700; letter-spacing: .04em; color: #7fb0ff; text-transform: uppercase; }
.o3-scard-status { font-size: 11px; color: #cfe0ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o3-dot { width: 9px; height: 9px; border-radius: 50%; }
.o3-dot.on { background: #2fe36a; box-shadow: 0 0 6px #2fe36a; } .o3-dot.off { background: #6a748f; }
.o3-name { font-size: 11.5px; font-weight: 800; color: #fff; }
.o3-zone { font-size: 8.5px; font-weight: 700; letter-spacing: .06em; color: #7fb0ff; }
.o3-status { font-size: 10px; color: #cfe0ff; }
.o3-chip.idle .o3-status, .o3-chip.offline .o3-status { color: #9fb0d0; }
.o3-rooms { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 800px) { .o3-rooms { grid-template-columns: repeat(2, 1fr); } }

/* ─── Office v2 (เลย์เอาต์ตามภาพ World Chemical BIT) ─────────────────────── */
.office2 {
  position: relative; border-radius: 14px; overflow: hidden; padding: 0 0 14px;
  border: 3px solid #0a1024; color: #e7eeff; image-rendering: pixelated;
  background: linear-gradient(180deg, #1b2740 0%, #16203a 100%);
}
.o2-topwall {
  position: relative; height: 150px;
  background: repeating-linear-gradient(180deg, #2a1c12 0 24px, #251810 24px 26px), linear-gradient(180deg, #3a2618, #2a1b10);
  border-bottom: 4px solid #1a120b;
}
.o2-window { position: absolute; left: 16px; top: 16px; width: 200px; height: 110px; border: 5px solid #1b2440; border-radius: 4px; overflow: hidden; }
.o2-sky { position: absolute; inset: 0; background: linear-gradient(180deg, #2a4d86, #6fa6e0 70%, #9fc4ec); }
.o2-city { position: absolute; left: 0; right: 0; bottom: 0; height: 55%; background: repeating-linear-gradient(90deg, #16284a 0 16px, #1d3357 16px 20px, #11203c 20px 36px); }
.o2-neon { position: absolute; left: 244px; top: 14px; display: grid; gap: 1px; font-family: "Courier New", monospace; font-weight: 900; font-size: 15px; line-height: 1.12; }
.o2-brand { position: absolute; left: 360px; top: 18px; font-weight: 900; font-size: 26px; color: #fff; letter-spacing: .02em; }
.o2-brand b { color: #4db8ff; }
.o2-brand small { display: block; font-size: 9px; letter-spacing: .25em; color: #9ab3d8; font-weight: 700; }
.o2-board { position: absolute; right: 16px; top: 12px; width: 220px; background: #0b1730; border: 2px solid #2b69b0; border-radius: 8px; padding: 8px 10px; box-shadow: 0 0 14px rgba(43,105,176,.4); }
.o2-board-title { font-size: 10px; font-weight: 800; letter-spacing: .15em; color: #6fb6ff; text-align: center; margin-bottom: 6px; }
.o2-board-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.o2-board-grid > div { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; color: #9fb6dd; }
.o2-board-grid b { font-size: 15px; color: #fff; }
.o2-board-grid b.g { color: #45e08a; } .o2-board-grid b.o { color: #ffb15d; } .o2-board-grid b.b { color: #5db8ff; }
.o2-shelf { position: absolute; right: 250px; top: 10px; width: 130px; height: 120px; display: grid; gap: 6px; background: repeating-linear-gradient(180deg, transparent 0 32px, #1a130c 32px 36px); }
.o2-shelf i { align-self: end; height: 14px; margin: 0 3px; background: linear-gradient(180deg, #4db8ff, #244a78); box-shadow: 5px 0 0 #6a4a2a, 10px 0 0 #45e08a; }
.o2-floor {
  display: grid; gap: 14px; padding: 18px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  background: repeating-linear-gradient(90deg, #6b4a2a 0 42px, #5e4124 42px 44px), linear-gradient(180deg, #6b4a2a, #4a3018);
}
.o2-zone {
  background: rgba(12,18,40,.35); border: 1.5px solid rgba(91,110,245,.35); border-radius: 10px;
  padding: 8px; text-align: center; backdrop-filter: blur(1px);
}
.o2-zone.o2-ai { border-color: #2b69b0; } .o2-zone.o2-break { border-color: #8a6a2a; }
.o2-zone-label {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .08em; color: #fff;
  background: linear-gradient(180deg, #2b6fd0, #1b4a8e); border: 1px solid #4d8fd0; border-radius: 5px; padding: 2px 8px; margin-bottom: 6px;
}
.o2-zone-chars { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: flex-end; }
.o2-bot { font-size: 36px; }
.o2-rooms { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 0 18px; margin-top: -2px; }
@media (max-width: 800px) { .o2-rooms { grid-template-columns: repeat(2, 1fr); } }
.o2-room {
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font: inherit;
  background: #11203c; border: 2px solid #2b69b0; border-radius: 10px; color: #cfe0ff; padding: 12px 8px;
  font-size: 11px; font-weight: 800; letter-spacing: .05em; transition: background .12s, transform .12s;
}
.o2-room:hover { background: #1a3057; transform: translateY(-2px); }
.o2-room-ic { font-size: 26px; }

/* ─── Office (ฉากห้องพิกเซล) ─────────────────────────────────────── */
.office-room {
  position: relative; border-radius: 14px; overflow: hidden;
  min-height: 560px; color: #dce8ff; image-rendering: pixelated;
  border: 3px solid #0a1024; box-shadow: inset 0 0 80px rgba(0,0,0,.5);
  background: #0c1228;
}
/* ผนัง */
.office-wall {
  position: absolute; inset: 0 0 38% 0;
  background:
    repeating-linear-gradient(180deg, #2a1c12 0 26px, #251810 26px 28px),
    linear-gradient(180deg, #3a2618, #2a1b10);
}
/* หน้าต่างวิวเมืองกลางคืน */
.office-window {
  position: absolute; left: 3%; top: 8%; width: 30%; height: 60%;
  border: 6px solid #1b2440; border-radius: 4px; overflow: hidden;
  box-shadow: 0 0 0 3px #0c1228, inset 0 0 30px rgba(0,0,0,.4);
}
.office-sky { position: absolute; inset: 0; background: linear-gradient(180deg, #16244e 0%, #243b6b 50%, #4a6aa0 100%); }
.office-city {
  position: absolute; left: 0; right: 0; bottom: 0; height: 55%;
  background:
    linear-gradient(90deg, #0d1830 0 8%, transparent 8%) 0 0/14% 100%,
    repeating-linear-gradient(90deg, #11203c 0 18px, #16284a 18px 22px, #0e1c36 22px 40px);
  box-shadow: inset 0 10px 20px rgba(255,200,120,.06);
}
.office-city::after { /* หน้าต่างตึกเรืองแสง */
  content: ""; position: absolute; inset: 10% 0 0 0;
  background-image: radial-gradient(2px 3px at 10% 30%, #ffd479 40%, transparent 42%),
    radial-gradient(2px 3px at 25% 60%, #ffd479 40%, transparent 42%),
    radial-gradient(2px 3px at 45% 25%, #9fd0ff 40%, transparent 42%),
    radial-gradient(2px 3px at 70% 50%, #ffd479 40%, transparent 42%),
    radial-gradient(2px 3px at 88% 35%, #9fd0ff 40%, transparent 42%);
  opacity: .8;
}
.office-window-grid { position: absolute; inset: 0; background:
  linear-gradient(90deg, transparent 49%, #1b2440 49% 51%, transparent 51%),
  linear-gradient(180deg, transparent 49%, #1b2440 49% 51%, transparent 51%); }
/* ป้ายนีออน */
.office-neon {
  position: absolute; left: 38%; top: 7%; display: grid; gap: 2px;
  font-weight: 900; font-size: 15px; letter-spacing: .12em; line-height: 1.15;
  font-family: "Courier New", monospace;
}
.neon-pink { color: #ff5db1; text-shadow: 0 0 6px #ff5db1, 0 0 12px #ff2e93; }
.neon-blue { color: #5db8ff; text-shadow: 0 0 6px #5db8ff, 0 0 12px #2e93ff; }
.neon-green { color: #5dff9b; text-shadow: 0 0 6px #5dff9b, 0 0 12px #2eff7a; }
.neon-orange { color: #ffb15d; text-shadow: 0 0 6px #ffb15d, 0 0 12px #ff8c2e; }
/* ป้ายแบรนด์ */
.office-sign {
  position: absolute; left: 60%; top: 6%; text-align: center; font-weight: 900;
  color: #fff; background: #14121f; border: 3px solid #3a3550; border-radius: 6px;
  padding: 8px 16px; font-size: 22px; letter-spacing: .04em; box-shadow: 0 0 14px rgba(245,159,0,.25);
}
.office-sign small { font-size: 10px; letter-spacing: .3em; color: #c9a24a; }
/* ชั้นวาง */
.office-shelf { position: absolute; right: 3%; top: 14%; width: 16%; height: 52%;
  background: repeating-linear-gradient(180deg, transparent 0 30px, #1a130c 30px 34px); border: 3px solid #1a130c; border-radius: 3px; display: grid; }
.office-shelf i { align-self: end; height: 16px; margin: 0 4px 4px; background: linear-gradient(180deg, #3a6ea5, #244a78); box-shadow: 4px 0 0 #6a4a2a, 8px 0 0 #5a3a8a; border-radius: 1px; }
.office-plant { position: absolute; left: 35%; bottom: 40%; font-size: 28px; }
.office-cooler { position: absolute; right: 22%; bottom: 40%; font-size: 26px; }
/* พื้นไม้ */
.office-floorwood {
  position: absolute; left: 0; right: 0; bottom: 0; height: 40%;
  background: repeating-linear-gradient(90deg, #6b4a2a 0 38px, #5e4124 38px 40px), linear-gradient(180deg, #6b4a2a, #4a3018);
  border-top: 3px solid #2a1b10;
  display: flex; align-items: flex-end; justify-content: center;
}
.office-floor { display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: center; align-items: flex-end; padding: 14px 16px 18px; width: 100%; }
/* ตัวละครพิกเซล + เดิน */
.office-char { position: relative; width: 84px; text-align: center; }
.office-sprite { position: relative; display: inline-block; }
.pixel-char { width: 46px; height: 68px; image-rendering: pixelated; filter: drop-shadow(0 3px 1px rgba(0,0,0,.55)); }
.office-char.offline .office-sprite { filter: grayscale(.85) opacity(.55); }
/* เดินไปมา (หันหน้าตามทาง) + เด้งขึ้นลงเหมือนก้าวขา */
.office-sprite.walking { animation: office-wander var(--walk, 9s) ease-in-out infinite; }
.office-sprite.walking .pixel-char { animation: office-step .42s steps(2) infinite; }
@keyframes office-wander {
  0%   { transform: translateX(0) scaleX(1); }
  46%  { transform: translateX(46px) scaleX(1); }
  50%  { transform: translateX(46px) scaleX(-1); }
  96%  { transform: translateX(0) scaleX(-1); }
  100% { transform: translateX(0) scaleX(1); }
}
@keyframes office-step { 0% { transform: translateY(0); } 50% { transform: translateY(-2px); } 100% { transform: translateY(0); } }
.pc-legs { animation: pc-legs .42s steps(2) infinite; transform-origin: 8px 15px; }
.office-sprite:not(.walking) .pc-legs { animation: none; }
@keyframes pc-legs { 0% { transform: translateX(-0.6px); } 50% { transform: translateX(0.6px); } 100% { transform: translateX(-0.6px); } }
.office-dot { position: absolute; right: 18%; bottom: 8px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #2a1b10; }
.office-dot.on { background: #2fe36a; box-shadow: 0 0 8px #2fe36a; }
.office-dot.off { background: #56607e; }
.office-nametag {
  margin-top: 4px; font-size: 11.5px; font-weight: 800; color: #fff;
  background: rgba(12,18,40,.7); border: 1px solid #34406e; border-radius: 6px; padding: 1px 6px; display: inline-block;
}
.office-char.is-me .office-nametag { background: #5b3a10; border-color: #f59f00; }
.office-bubble {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px;
  background: #fff; color: #1a1a2e; font-size: 10.5px; font-weight: 700; line-height: 1.3;
  border-radius: 8px; padding: 4px 8px; white-space: nowrap; box-shadow: 0 3px 8px rgba(0,0,0,.3); z-index: 2;
}
.office-bubble::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #fff; }
.office-char.working .office-bubble { background: #2f9e44; color: #fff; }
.office-char.working .office-bubble::after { border-top-color: #2f9e44; }
.office-char.review .office-bubble { background: #1565c0; color: #fff; }
.office-char.review .office-bubble::after { border-top-color: #1565c0; }
/* HUD ลอย */
.office-hud { position: absolute; left: 0; right: 0; bottom: 41%; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; padding: 0 14px; flex-wrap: wrap; pointer-events: none; }
.office-brand { font-weight: 800; letter-spacing: .06em; font-size: 14px; color: #fff; background: rgba(12,18,40,.6); padding: 4px 10px; border-radius: 8px; }
.office-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.office-stat { font-size: 11.5px; font-weight: 700; background: rgba(12,18,40,.72); border: 1px solid #34406e; border-radius: 8px; padding: 4px 9px; color: #cfe0ff; }
.office-legend { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-size: 10.5px; color: rgba(255,255,255,.6); }
@media (max-width: 700px) { .office-neon { font-size: 11px; } .office-sign { font-size: 16px; } .office-char { width: 70px; } }

/* ─── Team / access page ───────────────────────────────────────── */
.team-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.team-synced { font-size: 12px; color: var(--muted); }
.team-banner {
  background: #fff4e0; border: 1.5px solid #f59f00; color: #b25c00;
  border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 600; margin-bottom: 12px;
}
.team-row-new { background: #fffbe6; }
.team-new-tag {
  font-size: 10px; font-weight: 700; background: #f59f00; color: #fff;
  border-radius: 999px; padding: 1px 7px; margin-left: 4px;
}

/* ─── AI Studio ─────────────────────────────────────────────────── */
.ai-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .ai-grid { grid-template-columns: 1fr; } }
.ai-panel textarea {
  width: 100%; box-sizing: border-box; border: 1.5px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-size: 13.5px; font-family: inherit; resize: vertical;
}
.ai-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 10px 0; }
.ai-controls label { display: grid; gap: 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ai-controls select { padding: 7px 10px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 13px; }
.ai-btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; align-items: center; }
.ai-inline-label { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ai-inline-label select { padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 13px; }
.ai-ref-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.ai-ref-label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ai-ref-preview { display: flex; align-items: center; gap: 8px; }
.ai-ref-preview img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

.ai-mat-box { border: 1.5px dashed var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.ai-mat-head { font-size: 13px; margin-bottom: 8px; }
.ai-mat-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.ai-mat-item {
  position: relative; display: grid; gap: 3px; width: 88px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 8px; padding: 5px; background: var(--panel);
}
.ai-mat-item:has(.ai-mat-check:checked) { border-color: var(--brand, #5b6ef5); background: var(--brand-light, #eef2ff); }
.ai-mat-item img { width: 100%; height: 60px; object-fit: contain; border-radius: 5px; background: #fff; }
.ai-mat-item .ai-mat-check { position: absolute; top: 6px; left: 6px; width: 16px; height: 16px; }
.ai-mat-name { font-size: 10.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-mat-del { position: absolute; top: 4px; right: 4px; border: 0; background: rgba(0,0,0,.5); color: #fff; border-radius: 50%; width: 18px; height: 18px; cursor: pointer; font-size: 11px; line-height: 1; }
.ai-mat-upload { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ai-mat-upload input[type="text"] { flex: 1; min-width: 140px; padding: 7px 10px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 13px; }
.ai-mat-upload select { padding: 7px 8px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 13px; }
.ai-output {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: var(--panel-alt); min-height: 160px; max-height: 460px; overflow-y: auto;
  font-size: 13.5px; line-height: 1.7;
}
.brand-products { display: grid; gap: 10px; }
.brand-prod-row { position: relative; display: grid; gap: 6px; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 30px 10px 10px; }
.brand-prod-row input, .brand-prod-row textarea { width: 100%; box-sizing: border-box; border: 1.5px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: inherit; }
.brand-prod-row .brand-prod-name { font-weight: 700; }
.brand-prod-del { position: absolute; top: 8px; right: 8px; }
.ai-table-bar { margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.ai-brief-card { border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: var(--panel); }
.ai-brief-card-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; margin-bottom: 8px; }
.ai-brief-card-head strong { font-size: 15px; }
.ai-brief-tags { font-size: 11px; color: var(--muted); font-weight: 600; }
.ai-brief-sec { margin: 8px 0; font-size: 13px; line-height: 1.6; }
.ai-brief-sec > b { color: var(--brand-dark, #3b46c4); }
.ai-brief-copy { padding: 6px 0 0; display: grid; gap: 3px; }
.ai-brief-info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.ai-brief-ul { margin: 4px 0 0; padding-left: 18px; }
.ai-brief-ul li { font-size: 12.5px; }
.ai-brief-layout { margin-top: 6px; padding: 6px 8px; background: var(--panel-alt); border-radius: 8px; font-size: 12.5px; }
.ai-brief-cap { margin: 8px 0; font-size: 13px; }
.ai-brief-cap summary { cursor: pointer; font-weight: 600; color: var(--brand-dark, #3b46c4); }
.ai-brief-cap > div { margin-top: 6px; line-height: 1.65; }
.ai-brief-hash { color: var(--brand, #5b6ef5); }
.ai-brief-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ai-mat-fname { font-size: 12px; color: var(--brand-dark, #3b46c4); font-weight: 600; }
.ai-plan-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ai-plan-table th, .ai-plan-table td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
.ai-plan-table th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ai-plan-table td:last-child { white-space: nowrap; }
.ai-img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.ai-img-card { display: grid; gap: 6px; }
.ai-img-card img { width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.ai-img-card a { justify-content: center; }
.ai-settings { margin-bottom: 16px; padding: 14px 16px; }
.ai-settings summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.ai-settings-body { display: grid; gap: 10px; margin-top: 12px; }
.ai-settings-body label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ai-settings-body input {
  padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 13px; font-family: inherit;
}

/* ════ น้อง NevBot — ผู้ช่วยนำทาง ════ */
#nbBtn { position: fixed; right: 22px; bottom: 22px; z-index: 9000; display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg,#6366f1,#8b5cf6); color: #fff; border: none; border-radius: 999px; padding: 12px 18px;
  font: 700 14px/1 inherit; cursor: pointer; box-shadow: 0 8px 24px rgba(99,102,241,.45); transition: transform .15s, box-shadow .15s; }
#nbBtn:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(99,102,241,.55); }
#nbBtn.hide { display: none; }
#nbBtn .nb-btn-ic { font-size: 20px; animation: nbFloat 2.6s ease-in-out infinite; }
@keyframes nbFloat { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-3px) } }

#nbPanel { position: fixed; right: 22px; bottom: 22px; z-index: 9001; width: min(380px, 92vw); height: min(560px, 78vh);
  background: #0d1424; border: 1px solid #283655; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
  display: flex; flex-direction: column; overflow: hidden; opacity: 0; transform: translateY(20px) scale(.96); pointer-events: none; transition: opacity .18s, transform .18s; }
#nbPanel.open { opacity: 1; transform: none; pointer-events: auto; }
.nb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px;
  background: linear-gradient(135deg,#6366f1,#8b5cf6); color: #fff; font-weight: 800; font-size: 14px; }
.nb-head button { background: rgba(255,255,255,.18); border: none; color: #fff; width: 26px; height: 26px; border-radius: 7px; cursor: pointer; font-size: 13px; margin-left: 5px; }
.nb-head button:hover { background: rgba(255,255,255,.32); }
.nb-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #0d1424; }
.nb-msg { display: flex; gap: 8px; max-width: 92%; }
.nb-msg.me { align-self: flex-end; }
.nb-msg.bot { align-self: flex-start; }
.nb-ava { font-size: 18px; flex: 0 0 auto; }
.nb-txt { font-size: 13px; line-height: 1.5; padding: 9px 12px; border-radius: 14px; border-top-left-radius: 4px; background: #18233d; color: #e6eefc; word-break: break-word; }
.nb-msg.me .nb-txt { background: linear-gradient(135deg,#6366f1,#8b5cf6); color: #fff; border-top-right-radius: 4px; }
.nb-acts { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; max-width: 100%; }
.nb-chip { background: #18233d; border: 1px solid #2f4066; color: #cfe0ff; border-radius: 999px; padding: 6px 12px; font-size: 12px; cursor: pointer; font-weight: 600; }
.nb-chip:hover { background: #243154; border-color: #6366f1; color: #fff; }
.nb-chip.sm { padding: 3px 9px; font-size: 11px; margin-left: auto; flex: 0 0 auto; }
.nb-todo { display: grid; gap: 7px; background: #111a30; border: 1px solid #243154; border-radius: 12px; padding: 10px; }
.nb-todo-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #e6eefc; }
.nb-todo-ic { flex: 0 0 auto; }
.nb-todo-tx { flex: 1; min-width: 0; }
.nb-input { display: flex; gap: 7px; padding: 10px; border-top: 1px solid #243154; background: #0d1424; }
.nb-input input { flex: 1; background: #18233d; border: 1.5px solid #2f4066; border-radius: 9px; padding: 9px 11px; color: #fff; font: 13px inherit; }
.nb-input input::placeholder { color: #7a8aa8; }
.nb-input button { background: linear-gradient(135deg,#6366f1,#8b5cf6); border: none; color: #fff; border-radius: 9px; padding: 0 16px; font-weight: 700; cursor: pointer; font-size: 13px; }
@media (max-width: 480px) { #nbPanel { right: 8px; bottom: 8px; width: 94vw; } #nbBtn { right: 12px; bottom: 12px; } }

/* ════ AI Agent Dashboard ════ */
.agent-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 20px 24px 12px; border-bottom: 1px solid var(--line); }
.agent-header h2 { margin: 0; font-size: 20px; }
.agent-subtitle { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.agent-header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.agent-schedule-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.agent-schedule-row select { border: 1.5px solid var(--line); border-radius: 7px; padding: 5px 8px; font-size: 13px; background: var(--card-bg); }
.agent-auto-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; color: var(--muted); }

.agent-status-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px 24px; }
.agent-stat-card { display: flex; align-items: center; gap: 10px; background: var(--card-bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.asc-icon { font-size: 22px; flex: 0 0 auto; }
.asc-body { flex: 1; min-width: 0; }
.asc-name { font-weight: 700; font-size: 13px; }
.asc-last { font-size: 11px; color: var(--muted); margin-top: 2px; }
.asc-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.asc-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.asc-idle    { background: #f1f5f9; color: #64748b; }
.asc-running { background: #eff6ff; color: #2563eb; animation: pulse 1s infinite; }
.asc-ok      { background: #f0fdf4; color: #16a34a; }
.asc-error   { background: #fef2f2; color: #dc2626; }
.asc-skip    { background: #fffbeb; color: #d97706; }
@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:.5 } }

.agent-tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.agent-tab { background: none; border: none; border-bottom: 3px solid transparent; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted); transition: color .15s, border-color .15s; }
.agent-tab.active { color: var(--brand, #5b6ef5); border-bottom-color: var(--brand, #5b6ef5); }
.agent-tab:hover { color: var(--text); }

.agent-report-panels { flex: 1; overflow-y: auto; }
.agent-panel { display: none; padding: 20px 24px; }
.agent-panel.active { display: block; }
.agent-empty { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 14px; }
.agent-error { color: #dc2626; }

.agent-report { display: grid; gap: 16px; }
.agent-report-head { background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; justify-content: space-between; align-items: flex-start; }
.agent-rh-headline { font-size: 15px; font-weight: 700; }
.agent-rh-time { font-size: 11px; color: var(--muted); margin-top: 4px; }

.agent-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.agent-section { background: var(--card-bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.agent-section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.agent-prose { font-size: 13px; line-height: 1.6; color: var(--text); margin: 0; }
.agent-na { color: var(--muted); font-size: 12px; }
.agent-chip { display: inline-block; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #f1f5f9; color: #334155; margin: 2px; }
.agent-chip.chip-green  { background: #f0fdf4; color: #166534; }
.agent-chip.chip-blue   { background: #eff6ff; color: #1d4ed8; }
.agent-chip.chip-yellow { background: #fffbeb; color: #92400e; }
.agent-chip.chip-red    { background: #fef2f2; color: #991b1b; }

.agent-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.agent-table th { background: var(--line); padding: 6px 8px; text-align: left; font-weight: 600; white-space: nowrap; }
.agent-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.agent-table tr:last-child td { border-bottom: none; }
.agent-table tr:hover td { background: var(--hover-bg, #f8fafc); }
.agent-status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

.agent-sentiment-row { display: flex; align-items: center; gap: 16px; background: var(--card-bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.agent-sentiment-gauge { flex: 1; }
.asg-bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 6px; }
.asg-fill { height: 100%; border-radius: 999px; transition: width .5s; }
.asg-label { font-size: 13px; }
.agent-spike-alert { background: #fffbeb; border: 1.5px solid #f59e0b; border-radius: 8px; padding: 8px 12px; font-size: 13px; color: #92400e; font-weight: 600; }
.agent-spike-row { font-size: 13px; padding: 6px 0; }

.agent-best-time { background: linear-gradient(135deg,#f0fdf4,#dcfce7); border: 1.5px solid #86efac; border-radius: 10px; padding: 12px 16px; font-size: 14px; color: #166534; }

@media (max-width: 600px) { .agent-status-bar { grid-template-columns: 1fr; } .agent-grid-2 { grid-template-columns: 1fr; } .agent-header { flex-direction: column; } }


.agent-header {
  background: var(--card-bg, #fff);
  border-bottom: 1.5px solid var(--line);
  padding: 18px 28px 14px;
  gap: 16px;
}
.agent-header-left { flex: 1; min-width: 0; }
.agent-header-left h2 { margin: 0; font-size: 18px; font-weight: 700; }
.agent-header-left .agent-subtitle { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.agent-header-right {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.agent-schedule-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

/* ─── TOKEN STATUS BAR ───────────────────────────────────────── */
.agent-token-bar {
  display: flex;
  gap: 8px;
  padding: 8px 28px;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  color: #92400e;
}
.agent-token-bar.all-ok {
  background: #f0fdf4;
  border-bottom-color: #86efac;
  color: #166534;
}
.agent-token-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,.6);
}
.agent-token-chip.ok { color: #16a34a; }
.agent-token-chip.missing { color: #dc2626; }
.agent-token-bar a { color: inherit; text-decoration: underline; cursor: pointer; font-weight: 700; }

/* ─── STATUS CARDS ───────────────────────────────────────────── */
.agent-status-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px 28px 8px;
  background: transparent;
}
.agent-stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg, #fff);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.asc-icon { font-size: 26px; flex: 0 0 auto; }
.asc-body { flex: 1; min-width: 0; }
.asc-name { font-weight: 700; font-size: 13px; }
.asc-last { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asc-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }

/* ─── AGENT TABS ─────────────────────────────────────────────── */
.agent-tabs {
  display: flex;
  gap: 0;
  padding: 0 28px;
  border-bottom: 2px solid var(--line);
  background: var(--card-bg, #fff);
}
.agent-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.agent-tab.active { color: var(--brand, #5b6ef5); border-bottom-color: var(--brand, #5b6ef5); }
.agent-tab:hover { color: var(--text); }

/* ─── REPORT PANELS ──────────────────────────────────────────── */
.agent-report-panels {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px 40px;
  background: transparent;
}
.agent-panel { display: none; }
.agent-panel.active { display: grid; gap: 16px; }
.agent-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 14px;
  background: var(--card-bg, #fff);
  border-radius: 14px;
  border: 1.5px dashed var(--line);
}

/* ═══════════════════════════════════════════════════════════════
   AI AGENT DASHBOARD — CARD ZONE REDESIGN  (v85)
   ═══════════════════════════════════════════════════════════════ */



/* ── Zone 1: Header Card ──────────────────────────────────────── */
.adz-header {
  background: var(--card-bg, #fff);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.adz-title-block h2  { margin: 0; font-size: 18px; font-weight: 800; }
.adz-title-block p   { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

.adz-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

/* Token chips inside header */
.adz-token-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.adz-token-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid;
  white-space: nowrap;
}
.adz-token-chip.ok      { background:#f0fdf4; color:#16a34a; border-color:#86efac; }
.adz-token-chip.missing { background:#fef2f2; color:#dc2626; border-color:#fca5a5; }
.adz-token-chip a       { color:inherit; text-decoration:underline; cursor:pointer; }

/* Run row */
.adz-run-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}
.adz-auto-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.adz-auto-label select {
  border: 1.5px solid var(--line);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 13px;
  background: var(--card-bg, #fff);
  cursor: pointer;
}

/* ── Zone 2: Agent Cards ──────────────────────────────────────── */
.adz-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.adz-card {
  background: var(--card-bg, #fff);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow .18s, border-color .18s, transform .18s;
  cursor: default;
}
.adz-card:hover {
  box-shadow: 0 6px 20px rgba(91,110,245,.12);
  border-color: var(--brand, #5b6ef5);
  transform: translateY(-2px);
}
.adz-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.adz-card-icon { font-size: 30px; line-height: 1; flex: 0 0 auto; }
.adz-card-info { flex: 1; min-width: 0; }
.adz-card-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.adz-card-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.adz-card-top  .asc-badge { flex: 0 0 auto; margin-top: 2px; }
.adz-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  gap: 8px;
}
.adz-card-bottom .asc-last {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Zone 3: Report Zone ──────────────────────────────────────── */
.adz-report-zone {
  background: var(--card-bg, #fff);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.adz-report-tabs {
  display: flex;
  padding: 0 20px;
  border-bottom: 2px solid var(--line);
  background: var(--bg, #f4f6fb);
  gap: 0;
  flex-shrink: 0;
}
.adz-report-tabs .agent-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.adz-report-tabs .agent-tab.active { color: var(--brand,#5b6ef5); border-bottom-color: var(--brand,#5b6ef5); }
.adz-report-tabs .agent-tab:hover  { color: var(--text); }

.adz-report-body.agent-report-panels {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
}
.adz-report-body .agent-panel        { display: none; }
.adz-report-body .agent-panel.active { display: grid; gap: 16px; }
.adz-report-body .agent-empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--muted);
  font-size: 14px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
}

@media (max-width: 900px) {
  .adz-cards { grid-template-columns: 1fr; }
  .adz-header { flex-direction: column; }
  .adz-controls { align-items: flex-start; }
}

/* ── Meta Token Info Card ── */
.meta-token-info-card { background: var(--card-bg,#fff); border: 1.5px solid #86efac; border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.mtic-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mtic-ok { color: #16a34a; font-weight: 700; font-size: 14px; }
.mtic-user { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; border-radius: 20px; padding: 2px 10px; font-size: 13px; }
.mtic-act { background: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; border-radius: 20px; padding: 2px 10px; font-size: 12px; font-family: monospace; }
.mtic-section { display: flex; flex-direction: column; gap: 8px; }
.mtic-label { font-size: 12px; font-weight: 600; color: var(--muted,#888); text-transform: uppercase; letter-spacing: .04em; }
.mtic-pages { display: flex; flex-direction: column; gap: 6px; }
.meta-page-chip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--bg,#f9fafb); border: 1px solid var(--line,#e5e7eb); border-radius: 10px; padding: 8px 12px; }
.mpch-name { font-weight: 600; font-size: 14px; }
.mpch-cat { background: #f3f4f6; color: #6b7280; border-radius: 6px; padding: 1px 7px; font-size: 11px; }
.mpch-fans { font-size: 12px; color: var(--muted,#888); }
.mpch-id { background: #f3f4f6; color: #374151; border-radius: 6px; padding: 1px 7px; font-size: 11px; margin-left: auto; }
.mtic-perms { display: flex; flex-wrap: wrap; gap: 5px; }
.perm-pill { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; border-radius: 20px; padding: 2px 9px; font-size: 11px; font-family: monospace; }

/* ── Meta Token Summary Card ── */
.mtic-summary-card { background: var(--card-bg,#fff); border: 1.5px solid #86efac; border-radius: 14px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.mtic-summary-left { display: flex; align-items: center; gap: 12px; }
.mtic-ok-dot { width: 10px; height: 10px; border-radius: 50%; background: #16a34a; flex-shrink: 0; box-shadow: 0 0 0 3px #dcfce7; }
.mtic-summary-title { font-weight: 600; font-size: 14px; color: var(--text,#111); margin-bottom: 5px; }
.mtic-summary-sub { display: flex; gap: 6px; flex-wrap: wrap; }
.mtic-stat-chip { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; border-radius: 20px; padding: 2px 10px; font-size: 12px; font-weight: 500; }
.mtic-detail-btn { background: #6366f1; color: #fff; border: none; border-radius: 10px; padding: 8px 18px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s; }
.mtic-detail-btn:hover { background: #4f46e5; }

/* ── Meta Token Modal ── */
.mtm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000; display: none; align-items: center; justify-content: center; padding: 16px; }
.mtm-overlay.open { display: flex; }
.mtm-box { background: var(--card-bg,#fff); border-radius: 20px; width: 100%; max-width: 780px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 24px 80px rgba(0,0,0,.22); overflow: hidden; }
.mtm-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 0; }
.mtm-title { font-size: 18px; font-weight: 700; color: var(--text,#111); }
.mtm-sub { font-size: 13px; color: var(--muted,#888); margin-top: 3px; }
.mtm-close { background: var(--bg,#f3f4f6); border: none; border-radius: 50%; width: 34px; height: 34px; font-size: 16px; cursor: pointer; color: var(--text,#555); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mtm-close:hover { background: #e5e7eb; }
.mtm-tabs { display: flex; gap: 0; padding: 16px 24px 0; border-bottom: 1.5px solid var(--line,#e5e7eb); }
.mtm-tab { background: none; border: none; border-bottom: 2.5px solid transparent; padding: 8px 18px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted,#888); margin-bottom: -1.5px; transition: color .15s, border-color .15s; }
.mtm-tab.active { color: #6366f1; border-bottom-color: #6366f1; }
.mtm-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.mtm-pane { display: none; }
.mtm-pane.active { display: block; }
.mtm-empty { color: var(--muted,#888); font-size: 14px; text-align: center; padding: 40px 0; }
.mtm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mtm-table thead th { text-align: left; padding: 8px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted,#888); border-bottom: 1.5px solid var(--line,#e5e7eb); }
.mtm-table tbody tr { border-bottom: 1px solid var(--line,#f3f4f6); transition: background .1s; }
.mtm-table tbody tr:hover { background: var(--bg,#f9fafb); }
.mtm-table td { padding: 10px 10px; vertical-align: middle; }
.mtm-num { color: var(--muted,#aaa); font-size: 12px; width: 28px; }
.mtm-right { text-align: right; }
.mtm-page-name { font-weight: 600; color: var(--text,#111); }
.mtm-cat-badge { background: #f3f4f6; color: #6b7280; border-radius: 6px; padding: 2px 8px; font-size: 11px; }
.mtm-id { background: #f3f4f6; color: #374151; border-radius: 6px; padding: 2px 7px; font-size: 11px; }
.mtm-perm-code { background: #eff6ff; color: #1d4ed8; border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.mtm-perm-desc { font-size: 13px; color: var(--text,#374151); }
.mtm-perm-desc.muted { color: var(--muted,#aaa); }
.mtm-granted { color: #16a34a; font-size: 12px; font-weight: 600; }

/* ── Meta Token Modal Backdrop (pattern เดียวกับ bjm-backdrop) ── */
.mtm-backdrop { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }

/* ══════════════════════════════════════════════════════
   AI Agent Dashboard — New Layout
   ══════════════════════════════════════════════════════ */

/* Command Bar */
.agnt-command-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--card-bg, #fff);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 0;
}
.agnt-agents { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; min-width: 0; }
.agnt-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  border: 1.5px solid var(--line, #e5e7eb);
  border-radius: 10px;
  background: var(--bg, #f9fafb);
  flex: 1; min-width: 140px;
}
.agnt-pill-icon { font-size: 18px; flex-shrink: 0; }
.agnt-pill-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.agnt-pill-name { font-size: 12px; font-weight: 700; color: var(--text, #111); }
.agnt-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Tab Bar */
.agnt-tab-bar {
  display: flex; gap: 0;
  border-bottom: 1.5px solid var(--line, #e5e7eb);
  padding: 0 24px;
  background: var(--bg, #f9fafb);
}
.agent-tab-btn {
  padding: 13px 20px;
  border: none; background: none; cursor: pointer;
  font-size: 13px; font-weight: 600;
  color: var(--muted, #6b7280);
  border-bottom: 2.5px solid transparent;
  transition: all .15s;
}
.agent-tab-btn.active {
  color: #6366f1;
  border-bottom-color: #6366f1;
  background: var(--card-bg, #fff);
}
.agent-panel { display: none; }
.agent-panel.active { display: block; }

/* Mockup Dashboard */
.agnt-mockup { display: flex; flex-direction: column; gap: 20px; }

.agnt-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.agnt-kpi-card {
  background: var(--bg, #f9fafb);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.agnt-kpi-val { font-size: 26px; font-weight: 800; color: var(--text, #111); }
.agnt-kpi-lbl { font-size: 11px; color: var(--muted, #9ca3af); font-weight: 600; margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }

.agnt-chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .agnt-chart-row { grid-template-columns: 1fr; } }
.agnt-chart-box {
  background: var(--bg, #f9fafb);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  padding: 16px;
}
.agnt-chart-title { font-size: 12px; font-weight: 700; color: var(--muted, #6b7280); margin-bottom: 14px; }

/* Bar chart mockup */
.agnt-bar-chart {
  display: flex; align-items: flex-end; gap: 6px;
  height: 80px; padding: 0 4px;
}
.agnt-bar {
  flex: 1; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #818cf8 0%, #6366f1 100%);
  opacity: .35;
}

/* Table mockup */
.agnt-table-mock { display: flex; flex-direction: column; gap: 8px; }
.agnt-row-mock { display: flex; gap: 8px; align-items: center; }
.agnt-col-wide { flex: 2; height: 12px; border-radius: 6px; }
.agnt-col-sm { flex: 1; height: 12px; border-radius: 6px; }

/* Gauge mockup */
.agnt-gauge-mock { padding: 10px 0; }
.agnt-gauge-bar { height: 10px; background: #e5e7eb; border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.agnt-gauge-fill { height: 100%; background: linear-gradient(90deg,#10b981,#6366f1); border-radius: 10px; }
.agnt-gauge-label { font-size: 13px; font-weight: 700; color: var(--muted,#9ca3af); }

/* Chip mockup */
.agnt-chip-mock { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }

/* Shimmer */
@keyframes agnt-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.agnt-shimmer {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 800px 100%;
  animation: agnt-shimmer 1.6s infinite;
}

/* Blur overlay for empty state */
.agnt-blur { position: relative; }
.agnt-blur::after {
  content: '';
  position: absolute; inset: 0;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  background: rgba(249,250,251,.5);
  border-radius: inherit;
}

/* CTA */
.agnt-cta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(135deg, #eff0ff 0%, #f0f9ff 100%);
  border: 1.5px dashed #a5b4fc;
  border-radius: 12px;
  padding: 16px 20px;
}
.agnt-cta-icon { font-size: 26px; flex-shrink: 0; }
.agnt-cta-text { flex: 1; font-size: 13px; color: #374151; }

/* ════ Agent View — Dark Theme Override ════ */
.view.active#agentView {
  display: flex;
  flex-direction: column;
}
#agentView {
  background: #080e1c;
  min-height: 100vh;
  padding: 0;
  margin: 0;
}
#agentView .ads-dashboard { background: transparent; gap: 0; }

/* ════ Agent Button Bar ════ */
.agnt-top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px 16px; border-bottom: 1px solid #1e2d4a;
  gap: 10px; flex-wrap: wrap;
}
.agnt-btn-bar {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 16px; padding: 28px 28px;
}
@media(max-width:600px){ .agnt-btn-bar { grid-template-columns: 1fr; } }
.agnt-agent-btn {
  display: flex; align-items: center; gap: 12px;
  background: #0f1a2e; border: 1.5px solid #1e2d4a;
  border-radius: 14px; padding: 16px 18px;
  cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.agnt-agent-btn:hover {
  border-color: #6366f1; box-shadow: 0 4px 22px rgba(99,102,241,.25);
  background: #131f36;
}
.agnt-agent-btn.agnt-btn-active {
  border-color: #6366f1; background: #131f36;
  box-shadow: 0 0 0 3px rgba(99,102,241,.3), 0 4px 22px rgba(99,102,241,.25);
}
.agnt-agent-btn-icon { font-size: 28px; flex-shrink: 0; }
.agnt-agent-btn-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.agnt-agent-btn-name { font-size: 14px; font-weight: 700; color: #e6eefc; }
.agnt-agent-btn-desc { font-size: 11.5px; color: #7a8aa8; }
#agentView .ghost-button { border-color: #2f4066; color: #cfe0ff; background: transparent; }

/* ════ Agent Popup Modal ════ */
.agnt-popup-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 14px; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; background: #fff; z-index: 1;
}
.agnt-popup-title {
  font-size: 17px; font-weight: 700; color: #111827;
  display: flex; align-items: center; gap: 10px;
}
.agnt-popup-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.agnt-popup-run {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px; border-top: 1px solid #e5e7eb; gap: 10px; flex-wrap: wrap;
}
/* Connection requirements card */
.agnt-connect-card {
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
}
.agnt-connect-title { font-size: 12px; font-weight: 700; color: #374151; margin-bottom: 2px; }
.agnt-connect-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; background: #fff; border: 1px solid #f3f4f6;
  border-radius: 8px; font-size: 12px;
}
.agnt-connect-row.ok   { border-color: #d1fae5; background: #f0fdf4; }
.agnt-connect-row.warn { border-color: #fef3c7; background: #fffbeb; }
.agnt-connect-row.fail { border-color: #fee2e2; background: #fef2f2; }
.agnt-connect-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.agnt-connect-info { flex: 1; }
.agnt-connect-label { font-weight: 600; color: #111827; margin-bottom: 2px; }
.agnt-connect-hint  { color: #6b7280; font-size: 11px; line-height: 1.4; }
.agnt-connect-btn {
  flex-shrink: 0; font-size: 11px; padding: 4px 10px;
  background: #6366f1; color: #fff; border: none; border-radius: 6px; cursor: pointer;
  white-space: nowrap; align-self: center;
}
.agnt-connect-btn:hover { background: #4f46e5; }
/* Mockup section label */
.agnt-mockup-label { font-size: 11px; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: .06em; }

/* ══════════════════════════════════════════════════════════════
   Global Modal Scroll Fix — ทุก popup/modal มี scrollbar เสมอ
   ══════════════════════════════════════════════════════════════ */

/* Backdrop containers (position:fixed, display:flex) */
[style*="position:fixed"][style*="z-index"] > div,
[style*="position: fixed"][style*="z-index"] > div {
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Centered modals that use translate(-50%,-50%) pattern */
[style*="transform:translate(-50%,-50%)"],
[style*="transform: translate(-50%, -50%)"] {
  max-height: 92vh !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

/* Named modal divs that may be created via JS */
#agentDetailModal,
#agentSettingsBackdrop > div,
#adsAccessBackdrop > div,
#adsSettingsBackdrop > div {
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Scrollbar styling — thin and subtle */
[style*="position:fixed"] div::-webkit-scrollbar,
[style*="transform:translate"] ::-webkit-scrollbar,
#agentDetailModal::-webkit-scrollbar,
#agentSettingsBackdrop > div::-webkit-scrollbar,
#adsAccessBackdrop > div::-webkit-scrollbar {
  width: 5px;
}
[style*="position:fixed"] div::-webkit-scrollbar-track,
[style*="transform:translate"] ::-webkit-scrollbar-track,
#agentDetailModal::-webkit-scrollbar-track,
#agentSettingsBackdrop > div::-webkit-scrollbar-track,
#adsAccessBackdrop > div::-webkit-scrollbar-track {
  background: transparent;
}
[style*="position:fixed"] div::-webkit-scrollbar-thumb,
[style*="transform:translate"] ::-webkit-scrollbar-thumb,
#agentDetailModal::-webkit-scrollbar-thumb,
#agentSettingsBackdrop > div::-webkit-scrollbar-thumb,
#adsAccessBackdrop > div::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 99px;
}


/* ════════════════════════════════════════════════════
   AI Agent Page Redesign (aap-*)
════════════════════════════════════════════════════ */
.aap-page { background: #060e1c; min-height: 100%; display: flex; flex-direction: column; }

/* Top Bar */
.aap-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid #1a2d47;
  background: #080f20; gap: 12px; flex-wrap: wrap; flex-shrink: 0;
}
.aap-title-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.aap-title { margin: 0; font-size: 16px; font-weight: 700; color: #e2eaf8; letter-spacing: -.01em; }
.aap-ctrl-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.aap-ctrl-btn {
  background: #0d1e35; border: 1px solid #1e3a5f; border-radius: 8px;
  padding: 6px 13px; font-size: 12px; color: #7fa8d4; cursor: pointer;
  transition: background .15s, color .15s; white-space: nowrap;
}
.aap-ctrl-btn:hover { background: #1a3050; color: #cfe0ff; }
.aap-google-badge {
  font-size: 11px; padding: 4px 10px; background: rgba(16,185,129,.14);
  color: #34d399; border-radius: 20px; font-weight: 600;
  border: 1px solid rgba(16,185,129,.25);
}
.aap-lang-select {
  background: #0d1e35; border: 1px solid #1e3a5f; border-radius: 8px;
  padding: 5px 8px; font-size: 12px; color: #7fa8d4; cursor: pointer;
}

/* Cards Grid */
.aap-cards-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 16px; padding: 20px 24px;
}
@media (max-width: 760px) { .aap-cards-grid { grid-template-columns: 1fr; } }
@media (min-width: 761px) and (max-width: 1000px) { .aap-cards-grid { grid-template-columns: 1fr 1fr; } }

.aap-card {
  background: #0b1628; border: 1.5px solid #1e2d4a; border-radius: 16px;
  overflow: hidden; cursor: pointer; text-align: left;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  padding: 0; display: flex; flex-direction: column;
}
.aap-card:hover {
  border-color: #2d4a7a; transform: translateY(-3px);
  box-shadow: 0 10px 36px rgba(0,0,0,.45);
}
.aap-card.agnt-btn-active {
  border-color: #4b75be;
  box-shadow: 0 0 0 3px rgba(99,102,241,.2), 0 8px 28px rgba(0,0,0,.4);
}

.aap-card-accent { height: 3px; width: 100%; flex-shrink: 0; }

.aap-card-body {
  display: flex; align-items: center; gap: 12px; padding: 16px 16px 10px; flex: 1;
}
.aap-card-icon {
  font-size: 26px; flex-shrink: 0; width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
}
.aap-card-info { flex: 1; min-width: 0; }
.aap-card-name { font-size: 14px; font-weight: 700; color: #dde8fa; margin-bottom: 3px; }
.aap-card-desc { font-size: 11px; color: #4b6a8a; line-height: 1.4; }

.aap-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 14px; border-top: 1px solid #111e33; margin-top: 4px;
}
.aap-card-last { font-size: 11px; color: #2d4060; }
.aap-card-open { font-size: 11px; font-weight: 700; letter-spacing: .02em; transition: opacity .15s; }
.aap-card:hover .aap-card-open { opacity: .8; }

/* badge colours in dark theme */
.aap-page .asc-idle    { background: #1a2d47; color: #4b6a8a; }
.aap-page .asc-running { background: #0d2040; color: #60a5fa; animation: pulse 1s infinite; }
.aap-page .asc-ok      { background: #0d2918; color: #4ade80; }
.aap-page .asc-error   { background: #2a0a0a; color: #f87171; }
.aap-page .asc-skip    { background: #201500; color: #fbbf24; }

/* ===== Agent Settings Modal (ASM) — Premium Dark Design ===== */
.asm-modal {
  background: linear-gradient(160deg, #0d1829 0%, #0f172a 60%, #0a1020 100%);
  border: 1px solid rgba(99,102,241,.25);
  border-radius: 20px;
  padding: 28px 28px 24px;
  width: 520px;
  max-width: 95vw;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.04) inset;
  position: relative;
}
.asm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}
.asm-header-title {
  font-size: 17px;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: -.01em;
  margin-bottom: 3px;
}
.asm-header-sub {
  font-size: 12px;
  color: #475569;
  letter-spacing: .02em;
}
.asm-close-btn {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 5px 11px;
  cursor: pointer;
  color: #64748b;
  font-size: 13px;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.asm-close-btn:hover { background: rgba(255,255,255,.1); color: #94a3b8; }

.asm-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
}

.asm-agents-list { display: flex; flex-direction: column; gap: 10px; }

.asm-agent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.asm-agent-row:hover {
  background: rgba(255,255,255,.055);
  border-color: rgba(255,255,255,.13);
}
.asm-checkbox {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: #6366f1;
  cursor: pointer;
}
.asm-agent-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.asm-agent-body { flex: 1; min-width: 0; }
.asm-agent-name {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 3px;
}
.asm-agent-desc {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 8px;
  line-height: 1.4;
}
.asm-agent-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.asm-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: .01em;
}
.asm-tag-ai {
  background: rgba(99,102,241,.15);
  color: #a5b4fc;
  border: 1px solid rgba(99,102,241,.25);
}
.asm-tag-src {
  background: rgba(15,23,42,.6);
  color: #64748b;
  border: 1px solid rgba(255,255,255,.08);
}
.asm-tag-status {
  background: rgba(71,85,105,.2);
  color: #94a3b8;
  border: 1px solid rgba(71,85,105,.3);
}
.asm-tag-status.status-ok {
  background: rgba(16,185,129,.12);
  color: #34d399;
  border-color: rgba(16,185,129,.25);
}
.asm-tag-status.status-error {
  background: rgba(239,68,68,.12);
  color: #f87171;
  border-color: rgba(239,68,68,.25);
}
.asm-tag-status.status-running {
  background: rgba(250,204,21,.1);
  color: #fbbf24;
  border-color: rgba(250,204,21,.25);
}

.asm-schedule-box {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.asm-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.asm-toggle-label { font-size: 13px; color: #cbd5e1; }
.asm-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.asm-time-label { font-size: 13px; color: #64748b; }
.asm-time-input {
  width: 64px;
  padding: 5px 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 13px;
  text-align: center;
}
.asm-time-input:focus { outline: none; border-color: #6366f1; }

.asm-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.rv-history { max-height: 240px; overflow-y: auto; margin: 4px 0 10px; display: flex; flex-direction: column; gap: 6px; }
/* v163->165: ประวัติส่งงานบน modal ตรวจ (พื้นเข้ม) — ตัวอักษรต้องสว่าง ไม่งั้นฟอนต์กลืนพื้น */
.rv-history .bj-sub { color: #e6eefc; }
.rv-history .bj-sub b { color: #ffffff; }
.rv-history .bj-sub-note { color: #ffc98a; }
.rv-history .bj-sub a { color: #8ab4ff; }
.rv-history .bj-sub code { background: #0a1020; color: #cfe0ff; padding: 1px 5px; border-radius: 4px; }


/* ── Campaign Activity Tracker (v287) ────────────────────────────── */
.act-timeline {
  background: var(--panel, #f8fafc);
  border: 1px solid var(--line, #eef0f4);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.act-week-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.act-week {
  min-width: 40px;
  padding: 4px 6px;
  background: var(--panel, #f1f5f9);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  text-align: center;
  cursor: default;
}
.act-week-past {
  background: #e2e8f0;
  color: #94a3b8;
  opacity: .7;
}
.act-week-cur {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #2563eb;
  box-shadow: 0 0 0 2px #bfdbfe;
}
.act-prog-wrap {
  height: 6px;
  background: var(--line, #e2e8f0);
  border-radius: 99px;
  overflow: hidden;
}
.act-prog-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  border-radius: 99px;
  transition: width .4s ease;
}
.act-step-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.act-step-btn {
  padding: 8px 12px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  background: var(--panel, #f8fafc);
  cursor: pointer;
  text-align: left;
  min-width: 110px;
  transition: border-color .15s, box-shadow .15s;
  color: var(--ink, #1e293b);
}
.act-step-btn:hover { border-color: #3b82f6; background: #eff6ff; }
.act-step-btn.act-step-cur {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 0 0 2px #bfdbfe;
}
.act-step-btn.act-step-done {
  border-color: #16a34a;
  background: #f0fdf4;
  color: #15803d;
}
.act-step-btn.act-step-warn {
  border-color: #d97706;
  background: #fffbeb;
  color: #92400e;
}
.act-detail { display: none; }
.act-detail.act-detail-active { display: block; }
.act-group { margin-bottom: 10px; }
.act-group-head {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
}
.act-person-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line, #f1f5f9);
  flex-wrap: wrap;
}
.act-person-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #1e293b);
}
.act-person-sub {
  font-size: 11px;
  color: #64748b;
}
.act-late-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  background: #fef3c7;
  color: #d97706;
  border-radius: 99px;
  margin-left: auto;
}

/* ── v392–394: Session Gate ───────────────────────────────────── */
#sessionGateScreen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  font-family: 'Inter', sans-serif;
}
/* Layer 1: Video + tint คลุมทั้งจอ (position:absolute ออกจาก flow) */
.sg-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.sg-bg-vid {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.sg-bg-tint {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 20, 0.70);
  backdrop-filter: blur(2px);
}
/* Layer 2: Scroll container — เต็มจอ, scroll ข้างใน */
.sg-scroll {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  box-sizing: border-box;
}
/* Layer 3: Content wrapper */
.sg-wrap {
  width: 100%;
  max-width: 940px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: #eef1ff;
  animation: sgIn .4s ease both;
}
@keyframes sgIn {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}
.sg-logo {
  width: 70px;
  height: auto;
  filter: drop-shadow(0 0 18px rgba(99,102,241,.55));
}
.sg-accent {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .25em;
  color: #6366f1;
  text-transform: uppercase;
}
.sg-greet {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}
.sg-name { color: #818cf8; }
.sg-date { font-size: 12.5px; color: rgba(170,190,230,.55); }
.sg-sub  { font-size: 14px; color: rgba(190,210,240,.65); margin: 0; }
.sg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 14px;
  width: 100%;
  margin-top: 4px;
}
.sg-card {
  position: relative;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 20px;
  padding: 28px 14px 22px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  text-align: center;
  overflow: hidden;
  transition: transform .2s ease, border-color .2s, box-shadow .2s, background .2s;
  color: #eef1ff;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.sg-card-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--sg1,#6366f1), var(--sg2,#818cf8));
  border-radius: 20px 20px 0 0;
}
.sg-card:hover {
  transform: translateY(-5px) scale(1.025);
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.28);
  box-shadow: 0 14px 44px rgba(0,0,0,.5);
}
.sg-last {
  border-color: rgba(74,222,128,.5) !important;
  background: rgba(15,60,30,.45) !important;
}
.sg-icon  { font-size: 40px; line-height: 1; }
.sg-label { font-size: 13.5px; font-weight: 700; color: #fff; }
.sg-desc  { font-size: 11px; color: rgba(170,195,230,.6); line-height: 1.5; }
.sg-badge {
  background: rgba(20,80,40,.75);
  color: #4ade80;
  border: 1px solid rgba(74,222,128,.4);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 10px;
  font-weight: 700;
}
.sg-enter { font-size: 11.5px; color: rgba(140,165,210,.5); transition: color .15s; }
.sg-card:hover .sg-enter { color: var(--sg2,#818cf8); }
.sg-out {
  background: none;
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(170,195,230,.85);
}
/* v465: banner "ต้องแก้ไข (ตีกลับ)" ในหน้าดูบรีฟโพสต์ */
.bv-reject-banner { background: linear-gradient(135deg,#7c2d12,#9a3412); color:#fff; border:1px solid #c2410c; border-radius:10px; padding:10px 14px; margin-bottom:12px; font-size:13px; line-height:1.5; }
.bv-reject-banner b { color:#ffedd5; }
.bv-reject-note { color:#fed7aa; }

/* v467: banner ผลอนุมัติบรีฟ (อนุมัติ = เขียว) */
.bv-approve-banner { background: linear-gradient(135deg,#14532d,#166534); color:#fff; border:1px solid #22c55e; border-radius:10px; padding:10px 14px; margin-bottom:12px; font-size:13px; line-height:1.5; }
.bv-approve-banner b { color:#dcfce7; }

/* v469: 2 สเต็ป ในงานบรีฟ (อนุมัติแผน → ส่งตรวจงาน) — bjm-modal พื้นขาว */
.bjm-steps { display:flex; gap:8px; margin:12px 0 8px; flex-wrap:wrap; }
.bjm-step { flex:1; min-width:150px; display:flex; align-items:center; gap:6px; padding:8px 11px; border-radius:10px; font-size:12.5px; border:1px solid #e2e8f0; background:#f8fafc; color:#334155; }
.bjm-step b { color:#1e293b; }
.bjm-step-badge { font-size:15px; }
.bjm-step-note { color:#64748b; font-size:11.5px; }
.bjm-step.done { background:#f0fdf4; border-color:#86efac; }
.bjm-step.done b { color:#15803d; }
.bjm-step.wait { background:#fffbeb; border-color:#fcd34d; }
.bjm-step.rej { background:#fef2f2; border-color:#fca5a5; }
.bjm-step.rej b { color:#b91c1c; }
.bjm-step.lock { opacity:.5; }
.bjm-step.active b { color:#4338ca; }
.bjm-locked { background:#fff7ed; border:1px dashed #fdba74; color:#9a3412; border-radius:10px; padding:10px 12px; font-size:12.5px; margin:8px 0; }

/* v470: badge สถานะสี ที่หัว popup รายละเอียด (งานบรีฟ + โพสต์) — พิลสีทึบ ตัวขาว อ่านได้ทุกพื้น */
.jm-badges { display:flex; gap:6px; flex-wrap:wrap; margin-top:6px; }
.jm-badge { display:inline-block; padding:3px 10px; border-radius:20px; font-size:11.5px; font-weight:700; color:#fff; }
.jm-badge.green { background:#16a34a; }
.jm-badge.red { background:#dc2626; }
.jm-badge.amber { background:#d97706; }
.jm-badge.blue { background:#2563eb; }
.jm-badge.orange { background:#ea580c; }

/* v471: แบนเนอร์ "งานของคุณที่ถูกตีกลับ" ในหน้า Task (ธีมแดง) */
.team-review-box.reject-box { background:#fef2f2; border:1px solid #fca5a5; }
.team-review-box.reject-box .team-review-head { color:#b91c1c; }
.team-review-item.is-reject { border-left:3px solid #ef4444; }
.team-review-item.is-reject .rej-note { color:#b91c1c; font-size:12px; }

/* v475: ประวัติการตรวจ/แก้ไข ในหน้าดูบรีฟ */
.bv-history { display:flex; flex-direction:column; gap:6px; }
.bv-hist-item { font-size:12.5px; color:#334155; background:#f8fafc; border:1px solid #e2e8f0; border-left:3px solid #94a3b8; border-radius:8px; padding:6px 10px; }
.bv-hist-item b { color:#1e293b; }
.bv-hist-note { color:#b45309; font-size:12px; }

/* v477: ปุ่มพับ/กางประวัติในหน้าดูบรีฟ */
.bv-hist-toggle { display:inline-flex; align-items:center; gap:6px; background:#f1f5f9; border:1px solid #e2e8f0; border-radius:8px; padding:6px 12px; font-size:12.5px; font-weight:700; color:#334155; cursor:pointer; }
.bv-hist-toggle:hover { background:#e2e8f0; }
.bv-hist-caret { font-size:10px; color:#64748b; }
.bv-history { margin-top:8px; }

/* ════════════════════════════════════════
   v500: Meeting System (ระบบจัดประชุม)
   ════════════════════════════════════════ */

/* Page Layout */
.mtg-page { max-width:900px; margin:0 auto; padding:24px 16px; }
.mtg-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:24px; flex-wrap:wrap; }
.mtg-title { font-size:22px; font-weight:800; color:#1e293b; margin:0 0 4px; }
.mtg-subtitle { font-size:13px; color:#64748b; }

/* List & Section */
.mtg-list { display:flex; flex-direction:column; gap:14px; }
.mtg-section-label { font-size:11px; font-weight:700; color:#64748b; text-transform:uppercase; letter-spacing:.07em; margin:18px 0 8px; padding-left:2px; }

/* Card */
.mtg-card { background:#fff; border:1.5px solid #e2e8f0; border-radius:14px; padding:16px 18px; cursor:pointer; transition:box-shadow .15s,border-color .15s; }
.mtg-card:hover { box-shadow:0 4px 18px rgba(0,0,0,.08); border-color:#cbd5e1; }
.mtg-card.mtg-live { border-color:#16a34a; background:#f0fdf4; }
.mtg-card.mtg-past { opacity:.7; }
.mtg-card-top { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.mtg-card-title { font-size:15px; font-weight:700; color:#1e293b; margin-bottom:4px; }
.mtg-card-meta { font-size:12.5px; color:#64748b; display:flex; gap:10px; flex-wrap:wrap; }
.mtg-card-loc { font-size:12px; color:#475569; margin-top:4px; }

/* Live pill */
.mtg-live-pill { display:inline-flex; align-items:center; gap:5px; background:#dcfce7; color:#15803d; font-size:11px; font-weight:700; border-radius:20px; padding:3px 10px; white-space:nowrap; }
.mtg-live-pill::before { content:''; width:7px; height:7px; background:#16a34a; border-radius:50%; animation:mtg-pulse 1.2s infinite; }
@keyframes mtg-pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.3)} }

/* Floating live badge */
#mtgLiveBadge { position:fixed; bottom:22px; right:22px; z-index:9000; background:#16a34a; color:#fff; font-size:13px; font-weight:700; border-radius:28px; padding:9px 16px; box-shadow:0 4px 18px rgba(22,163,74,.4); display:flex; align-items:center; gap:8px; cursor:pointer; user-select:none; }
#mtgLiveBadge:hover { background:#15803d; }
#mtgLiveBadge .mtg-badge-dot { width:9px; height:9px; background:#86efac; border-radius:50%; animation:mtg-pulse 1.2s infinite; }

/* RSVP status bar on card */
.mtg-rsvp-bar { display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; align-items:center; }
.mtg-rsvp-chip { display:inline-flex; align-items:center; gap:4px; font-size:11.5px; border-radius:12px; padding:2px 9px; font-weight:600; }
.mtg-rsvp-chip.accept { background:#dcfce7; color:#15803d; }
.mtg-rsvp-chip.decline { background:#fee2e2; color:#b91c1c; }
.mtg-rsvp-chip.maybe { background:#fef9c3; color:#a16207; }
.mtg-rsvp-chip.pending { background:#f1f5f9; color:#64748b; }

/* Detail popup */
.mtg-detail-section { margin-top:14px; }
.mtg-detail-label { font-size:11px; font-weight:700; color:#64748b; text-transform:uppercase; letter-spacing:.06em; margin-bottom:6px; }
.mtg-detail-body { font-size:13.5px; color:#334155; line-height:1.6; }

/* RSVP buttons */
.mtg-rsvp-row { display:flex; gap:8px; margin-top:12px; flex-wrap:wrap; }
.mtg-rsvp-btn { display:inline-flex; align-items:center; gap:6px; padding:8px 18px; border-radius:10px; font-size:13px; font-weight:700; cursor:pointer; border:2px solid transparent; transition:all .15s; }
.mtg-rsvp-btn.accept  { background:#dcfce7; color:#15803d; border-color:#86efac; }
.mtg-rsvp-btn.decline { background:#fee2e2; color:#b91c1c; border-color:#fca5a5; }
.mtg-rsvp-btn.maybe   { background:#fef9c3; color:#a16207; border-color:#fde047; }
.mtg-rsvp-btn.active  { box-shadow:0 0 0 3px rgba(0,0,0,.12); transform:scale(1.04); }
.mtg-rsvp-btn:hover   { filter:brightness(.94); }

/* RSVP list */
.mtg-rsvp-list { display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.mtg-rsvp-item { display:flex; align-items:center; justify-content:space-between; padding:7px 12px; background:#f8fafc; border-radius:9px; border:1px solid #e2e8f0; }
.mtg-rsvp-name { font-size:13px; font-weight:600; color:#1e293b; }
.mtg-rsvp-status { font-size:12px; font-weight:700; padding:2px 10px; border-radius:10px; }
.mtg-rsvp-status.accept  { background:#dcfce7; color:#15803d; }
.mtg-rsvp-status.decline { background:#fee2e2; color:#b91c1c; }
.mtg-rsvp-status.maybe   { background:#fef9c3; color:#a16207; }
.mtg-rsvp-status.pending { background:#f1f5f9; color:#94a3b8; }

/* Summary section */
.mtg-summary-section { background:#f0fdf4; border:1.5px solid #86efac; border-radius:12px; padding:14px 16px; margin-top:14px; }
.mtg-summary-title { font-size:13px; font-weight:700; color:#15803d; margin-bottom:8px; }
.mtg-summary-body { font-size:13px; color:#334155; white-space:pre-wrap; line-height:1.6; }
.mtg-summary-list { margin:0; padding-left:18px; font-size:13px; color:#334155; line-height:1.8; }

/* Form inputs */
.mtg-form-group { display:flex; flex-direction:column; gap:5px; }
.mtg-form-label { font-size:12px; font-weight:700; color:#64748b; }
.mtg-input { width:100%; box-sizing:border-box; background:#0b1628; border:1.5px solid #1e3a5f; border-radius:9px; padding:9px 12px; font-size:13.5px; color:#e2e8f0; outline:none; }
.mtg-input:focus { border-color:#3b82f6; }
.mtg-input option { background:#0b1628; color:#e2e8f0; }
.mtg-textarea { resize:vertical; min-height:72px; font-family:inherit; }
.mtg-invitee-grid { display:flex; flex-wrap:wrap; gap:8px; margin-top:4px; }
.mtg-invitee-chip { display:inline-flex; align-items:center; gap:6px; background:#0f1a2e; border:1.5px solid #1e3a5f; border-radius:20px; padding:5px 12px; font-size:12.5px; color:#94a3b8; cursor:pointer; user-select:none; }
.mtg-invitee-chip.selected { background:#1e3a5f; border-color:#3b82f6; color:#93c5fd; font-weight:700; }

/* Elapsed timer in detail */
.mtg-elapsed { font-size:22px; font-weight:800; color:#15803d; font-variant-numeric:tabular-nums; letter-spacing:.03em; }

/* ════════════════════════════════════════
   v501: Office Announcement Board (บอร์ดแจ้งข่าวสาร)
   ════════════════════════════════════════ */

/* Board position — floats in the office room */
.o3-mtg-board {
  position: absolute;
  bottom: 12%;
  right: 3%;
  width: 158px;
  z-index: 12;
  cursor: pointer;
}
/* v530: label + position handled by JS inline style */

/* Empty state */
.o3mb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(10,18,38,.92);
  border: 1.5px dashed #334e7a;
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  box-shadow: 0 4px 18px rgba(0,0,0,.6), 0 0 0 1px rgba(99,102,241,.15);
  transition: border-color .15s;
}
.o3mb-empty:hover { border-color: #3b82f6; }
.o3mb-icon  { font-size: 18px; }
.o3mb-txt   { font-size: 10px; font-weight: 700; color: #94a3b8; letter-spacing: .03em; }
.o3mb-hint  { font-size: 9px; color: #64748b; }

/* Card with meeting */
.o3mb-card {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(10,18,38,.95);
  border: 1.5px solid #2d4a72;
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,.65), 0 0 0 1px rgba(99,102,241,.2);
  transition: border-color .15s, box-shadow .15s;
}
.o3mb-card:hover { border-color: #3b82f6; box-shadow: 0 4px 20px rgba(59,130,246,.3), 0 0 0 1px rgba(59,130,246,.3); }
.o3mb-card.o3mb-live { border-color: #22c55e; background: rgba(5,40,20,.95); box-shadow: 0 4px 18px rgba(0,0,0,.65), 0 0 0 1px rgba(34,197,94,.3); }

.o3mb-cal  { font-size: 16px; flex-shrink: 0; }
.o3mb-info { flex: 1; min-width: 0; }
.o3mb-title { font-size: 11px; font-weight: 700; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o3mb-time  { font-size: 10px; color: #94a3b8; margin-top: 1px; }
.o3mb-rsvp  { font-size: 13px; flex-shrink: 0; }

/* Live dot */
.o3mb-dot { display: inline-block; width: 9px; height: 9px; background: #16a34a; border-radius: 50%; flex-shrink: 0; animation: mtg-pulse 1.2s infinite; }
.o3mb-dot.sm { width: 7px; height: 7px; margin-right: 4px; vertical-align: middle; }

/* Popup */
.o3mb-popup {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 9100;
  width: 340px;
  max-height: 70vh;
  overflow-y: auto;
  background: #0d1929;
  border: 1.5px solid #1e3a5f;
  border-radius: 14px;
  padding: 18px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.55);
}

/* Popup rows — v532: card column layout + pill RSVP */
.o3mb-popup-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: rgba(15,26,46,.65);
  border: 1px solid #1a2e4a;
  transition: background .14s;
}
.o3mb-popup-row:last-child { margin-bottom: 0; }
.o3mb-popup-row:hover { background: rgba(30,52,90,.5); }
.o3mb-popup-row.live { background: rgba(5,46,22,.5); border-color: rgba(34,197,94,.3); }

.o3mb-popup-info { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.o3mb-popup-title { font-size: 13px; font-weight: 700; color: #e2e8f0; line-height: 1.35; }
.o3mb-popup-meta  { font-size: 11px; color: #7eb3d4; margin-top: 3px; line-height: 1.4; }

/* RSVP buttons — v533: แยกสีต่อปุ่ม + hover/active */
.o3mb-popup-rsvp { display: flex; gap: 7px; }
.o3mb-rbtn {
  flex: 1;
  height: 34px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 12px; font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: background .16s, border-color .16s, box-shadow .16s, transform .1s;
  padding: 0 10px;
  white-space: nowrap;
  letter-spacing: .01em;
  border-width: 1.5px; border-style: solid;
}
.o3mb-rbtn:active { transform: scale(.96); }

/* ✓ ยืนยัน — emerald */
.o3mb-rbtn.rsvp-accept               { background: rgba(5,46,22,.55);  border-color: rgba(34,197,94,.35); color: #4ade80; }
.o3mb-rbtn.rsvp-accept:hover         { background: rgba(22,163,74,.28); border-color: #22c55e;             color: #86efac; box-shadow: 0 0 0 3px rgba(34,197,94,.12); }
.o3mb-rbtn.rsvp-accept.active        { background: rgba(22,163,74,.38); border-color: #22c55e;             color: #bbf7d0; box-shadow: 0 0 0 3px rgba(34,197,94,.2), inset 0 1px 2px rgba(0,0,0,.2); }

/* ? ไม่แน่ — amber */
.o3mb-rbtn.rsvp-maybe                { background: rgba(44,26,4,.55);   border-color: rgba(245,158,11,.35); color: #fbbf24; }
.o3mb-rbtn.rsvp-maybe:hover          { background: rgba(217,119,6,.28);  border-color: #f59e0b;              color: #fde68a; box-shadow: 0 0 0 3px rgba(245,158,11,.12); }
.o3mb-rbtn.rsvp-maybe.active         { background: rgba(217,119,6,.38);  border-color: #f59e0b;              color: #fef3c7; box-shadow: 0 0 0 3px rgba(245,158,11,.2), inset 0 1px 2px rgba(0,0,0,.2); }

/* ✕ ไม่ได้ — rose */
.o3mb-rbtn.rsvp-decline              { background: rgba(46,5,5,.55);    border-color: rgba(239,68,68,.35);  color: #f87171; }
.o3mb-rbtn.rsvp-decline:hover        { background: rgba(220,38,38,.28); border-color: #ef4444;              color: #fca5a5; box-shadow: 0 0 0 3px rgba(239,68,68,.12); }
.o3mb-rbtn.rsvp-decline.active       { background: rgba(220,38,38,.38); border-color: #ef4444;              color: #fee2e2; box-shadow: 0 0 0 3px rgba(239,68,68,.2), inset 0 1px 2px rgba(0,0,0,.2); }

/* ── v502 Meeting Dashboard ─────────────────────────── */
/* Stats row */
.mtg-stats-row { display:flex; gap:12px; flex-wrap:wrap; margin-bottom:18px; }
.mtg-stat-card { background:#0f1e38; border:1px solid #1e3a5f; border-radius:10px; padding:14px 20px; min-width:100px; flex:1; text-align:center; }
.mtg-stat-card.mtg-stat-alert { border-color:#f59e0b; background:rgba(245,158,11,.08); }
.mtg-stat-card.mtg-stat-action { display:flex; align-items:center; justify-content:center; background:transparent; border:none; flex:0 0 auto; padding:8px; }
.mtg-stat-num { font-size:28px; font-weight:700; color:#818cf8; line-height:1.1; }
.mtg-stat-alert .mtg-stat-num { color:#f59e0b; }
.mtg-stat-label { font-size:11px; color:#94a3b8; margin-top:4px; }
.mtg-new-btn { background:linear-gradient(135deg,#6366f1,#3b82f6); color:#fff; border:none; border-radius:8px; padding:10px 18px; font-size:13px; font-weight:600; cursor:pointer; white-space:nowrap; transition:opacity .15s; }
.mtg-new-btn:hover { opacity:.85; }

/* Section headers */
.mtg-section-wrap { margin-bottom:20px; }
.mtg-section-head2 { font-size:12px; font-weight:600; color:#64748b; letter-spacing:.06em; text-transform:uppercase; margin-bottom:10px; padding-bottom:6px; border-bottom:1px solid #1e3a5f; }
.mtg-past-head { color:#475569; }

/* Week calendar */
.mtg-week-cal { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; background:#080f1e; border:1px solid #1e3a5f; border-radius:12px; padding:12px; }
.mtg-cal-col { display:flex; flex-direction:column; gap:4px; min-height:90px; }
.mtg-cal-head { text-align:center; padding-bottom:6px; border-bottom:1px solid #1e3a5f; margin-bottom:4px; }
.mtg-cal-dayname { font-size:10px; color:#64748b; font-weight:600; }
.mtg-cal-date { font-size:18px; font-weight:700; color:#94a3b8; line-height:1.1; }
.mtg-cal-today .mtg-cal-date,
.mtg-cal-today-num { color:#818cf8 !important; }
.mtg-cal-today { background:rgba(99,102,241,.06); border-radius:8px; }
.mtg-cal-body { display:flex; flex-direction:column; gap:3px; }
.mtg-cal-empty { text-align:center; color:#334155; font-size:18px; line-height:1; }
.mtg-cal-block { background:#1e3a5f; border-radius:5px; padding:3px 5px; cursor:pointer; transition:background .12s; display:flex; align-items:center; gap:3px; overflow:hidden; }
.mtg-cal-block:hover { background:#2d4f7f; }
.mtg-cal-block.mtg-cal-live { background:rgba(239,68,68,.18); border:1px solid rgba(239,68,68,.4); }
.mtg-cal-btime { font-size:9px; color:#94a3b8; white-space:nowrap; flex-shrink:0; }
.mtg-cal-btitle { font-size:9px; color:#e2e8f0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.mtg-cal-dot { width:5px; height:5px; border-radius:50%; flex-shrink:0; }
.mtg-cal-dot.dot-accept  { background:#22c55e; }
.mtg-cal-dot.dot-decline { background:#ef4444; }
.mtg-cal-dot.dot-maybe   { background:#f59e0b; }
.mtg-cal-dot.dot-pending { background:#6b7280; }

/* Dashboard cards */
.mtg-list-section { display:flex; flex-direction:column; gap:8px; }
.mtg-dash-card { background:#0f1e38; border:1px solid #1e3a5f; border-radius:10px; padding:12px 16px; cursor:pointer; transition:border-color .15s, background .15s; }
.mtg-dash-card:hover { border-color:#3b82f6; background:#101e36; }
.mtg-dash-card.mtg-card-past { opacity:.65; }
.mtg-dash-card-top { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:6px; }
.mtg-dash-card-left { flex:1; min-width:0; }
.mtg-dash-title { font-size:14px; font-weight:600; color:#e2e8f0; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.mtg-card-goal { font-size:12px; color:#818cf8; margin-top:3px; }
.mtg-dash-meta { display:flex; flex-wrap:wrap; gap:8px; font-size:11px; color:#94a3b8; }
.mtg-sumtag { color:#22c55e; font-size:11px; }

/* RSVP chips (compact) */
.mtg-chip { font-size:11px; border-radius:20px; padding:2px 9px; white-space:nowrap; font-weight:500; }
.mtg-chip.accept  { background:rgba(34,197,94,.15); color:#22c55e; }
.mtg-chip.decline { background:rgba(239,68,68,.12); color:#f87171; }
.mtg-chip.maybe   { background:rgba(245,158,11,.12); color:#f59e0b; }
.mtg-chip.pending { background:rgba(107,114,128,.15); color:#9ca3af; }

/* Goal banner in detail popup */
.mtg-goal-banner { background:rgba(99,102,241,.1); border:1px solid rgba(99,102,241,.3); border-radius:8px; padding:8px 12px; font-size:13px; color:#a5b4fc; }
.mtg-goal-banner strong { color:#c7d2fe; }

/* -- v504 Meeting Hub — Glass Jelly Cards (v2: self-contained dark) -- */

/* Force dark background on meetings view — overrides .view white */
#meetingsView {
  background: #080f1e !important;
}
.mtg-page {
  min-height: 100%;
  padding: 24px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}
/* Atmospheric orbs behind cards */
.mtg-page::before {
  content: "";
  position: absolute;
  width: 600px; height: 600px;
  top: -180px; left: -100px;
  background: radial-gradient(circle, rgba(99,102,241,.22) 0%, transparent 65%);
  pointer-events: none;
}
.mtg-page::after {
  content: "";
  position: absolute;
  width: 500px; height: 500px;
  bottom: -150px; right: -80px;
  background: radial-gradient(circle, rgba(56,189,248,.15) 0%, transparent 65%);
  pointer-events: none;
}
.mhr-wrap { display:flex; flex-direction:column; gap:24px; position:relative; z-index:1; }

/* Room grid */
.mhr-rooms {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media(max-width:700px){ .mhr-rooms{ grid-template-columns:repeat(2,1fr); } }

/* Glass jelly card */
.mhr-room {
  position: relative;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 20px;
  padding: 30px 18px 24px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  overflow: hidden;
  transition: transform .2s ease, border-color .2s, box-shadow .2s, background .2s;
  color: #eef1ff;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow:
    0 4px 32px rgba(0,0,0,.45),
    inset 0 1px 0 rgba(255,255,255,.18),
    inset 0 -1px 0 rgba(0,0,0,.12);
}
/* top gradient color bar */
.mhr-room::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rc,#6366f1), rgba(255,255,255,.55));
  border-radius: 20px 20px 0 0;
}
/* top inner glow tint */
.mhr-room::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 70px;
  background: linear-gradient(180deg, var(--rg, rgba(99,102,241,.15)) 0%, transparent 100%);
  pointer-events: none;
}
.mhr-room:hover {
  transform: translateY(-6px) scale(1.03);
  background: rgba(255,255,255,.13);
  border-color: rgba(255,255,255,.32);
  box-shadow:
    0 18px 50px rgba(0,0,0,.55),
    0 0 40px var(--rg, rgba(99,102,241,.3)),
    inset 0 1px 0 rgba(255,255,255,.25);
}
.mhr-icon {
  font-size: 40px;
  line-height: 1;
  filter: drop-shadow(0 2px 10px var(--rg, rgba(99,102,241,.6)));
  position: relative; z-index: 1;
}
.mhr-badge {
  position: absolute;
  top: 14px; right: 14px;
  font-size: 10px; font-weight: 800;
  border-radius: 20px;
  padding: 3px 10px;
  min-width: 22px;
  text-align: center;
  z-index: 2;
  letter-spacing: .02em;
}
.mhr-name {
  font-size: 14px; font-weight: 700;
  color: #fff; line-height: 1.2;
  position: relative; z-index: 1;
}
.mhr-sub {
  font-size: 12px;
  color: var(--rc, #818cf8);
  font-weight: 600;
  position: relative; z-index: 1;
}
.mhr-detail {
  font-size: 10.5px;
  color: rgba(170,200,240,.5);
  line-height: 1.5;
  position: relative; z-index: 1;
}


/* Upcoming strip */
.mhr-strip-section { display:flex; flex-direction:column; gap:6px; }
.mhr-strip-head { font-size:12px; font-weight:600; color:#64748b; letter-spacing:.06em; text-transform:uppercase; margin-bottom:4px; padding-bottom:8px; border-bottom:1px solid #1e3a5f; }
.mhr-strip-card {
  display:flex; align-items:center; gap:12px;
  background:#0c1832; border:1px solid #1e3a5f; border-radius:10px;
  padding:10px 14px; cursor:pointer;
  transition:border-color .13s, background .13s;
}
.mhr-strip-card:hover { border-color:#3b82f6; background:#0f1f40; }
.mhr-strip-card.mhr-strip-live { border-color:rgba(239,68,68,.4); background:rgba(239,68,68,.05); }
.mhr-strip-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.mhr-strip-body { flex:1; min-width:0; }
.mhr-strip-title { font-size:13px; font-weight:600; color:#e2e8f0; display:flex; align-items:center; gap:6px; }
.mhr-strip-goal { font-size:11px; color:#818cf8; margin-top:1px; }
.mhr-strip-meta { font-size:11px; color:#64748b; margin-top:3px; }
.mhr-strip-arrow { color:#4a5f80; font-size:18px; flex-shrink:0; }
.mhr-more-btn { background:transparent; border:1px dashed #1e3a5f; border-radius:8px; color:#64748b; font-size:12px; padding:8px; cursor:pointer; transition:border-color .13s, color .13s; }
.mhr-more-btn:hover { border-color:#3b82f6; color:#818cf8; }
.mhr-empty { text-align:center; color:#475569; font-size:13px; padding:32px 0; }

/* Sub-view popup cards */
.mhr-popup-card {
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  background:#0c1832; border:1px solid #1e3a5f; border-radius:10px;
  padding:12px 14px; cursor:pointer;
  transition:border-color .13s;
}
.mhr-popup-card:hover { border-color:#3b82f6; }
.mhr-pc-live { border-color:rgba(239,68,68,.35) !important; }
.mhr-pc-left { flex:1; min-width:0; }
.mhr-pc-title { font-size:13px; font-weight:600; color:#e2e8f0; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.mhr-pc-goal { font-size:11px; color:#818cf8; margin-top:2px; }
.mhr-pc-meta { font-size:11px; color:#64748b; margin-top:4px; }
.mhr-pc-sumtag { font-size:11px; color:#22c55e; margin-top:3px; }


/* -- v506 Meeting Form Redesign -- */
.mtgf-wrap {
  max-width: 500px;
  width: 100%;
  background: #0d1528;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.08);
}
.mtgf-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  background: linear-gradient(135deg, #1a2240 0%, #0f1a30 100%);
  border-bottom: 1px solid rgba(255,255,255,.07);
  position: relative;
}
.mtgf-hd::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #6366f1, #818cf8, #38bdf8);
}
.mtgf-hd-left { display: flex; align-items: center; gap: 13px; }
.mtgf-hd-icon { font-size: 30px; line-height: 1; }
.mtgf-hd-title { font-size: 16px; font-weight: 700; color: #eef1ff; }
.mtgf-hd-sub { font-size: 12px; color: #5a7299; margin-top: 3px; }
.mtgf-close {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  color: #7a8fb5;
  font-size: 14px;
  width: 32px; height: 32px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.mtgf-close:hover { background: rgba(255,255,255,.13); color: #eef1ff; }
.mtgf-body {
  padding: 20px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 68vh;
  overflow-y: auto;
}
.mtgf-field { display: flex; flex-direction: column; gap: 6px; }
.mtgf-label {
  font-size: 11px;
  font-weight: 700;
  color: #5a7299;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.mtgf-req { color: #f87171; margin-left: 2px; }
.mtgf-input {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px;
  padding: 10px 14px;
  color: #eef1ff;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s, background .15s;
  font-family: inherit;
}
.mtgf-input:focus {
  outline: none;
  border-color: rgba(99,102,241,.65);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
  background: rgba(255,255,255,.08);
}
.mtgf-input::placeholder { color: #2d3f5e; }
input[type="date"].mtgf-input,
input[type="time"].mtgf-input { color-scheme: dark; }
.mtgf-textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.mtgf-row3 {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 10px;
}
.mtgf-divider {
  height: 1px;
  background: rgba(255,255,255,.06);
  margin: 2px 0;
}
.mtgf-inv-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 120px;
  overflow-y: auto;
  padding: 2px 0 4px;
}
.mtgf-inv-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 5px 13px 5px 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  font-size: 13px;
  color: #8aa5cc;
  user-select: none;
}
.mtgf-inv-chip:has(input:checked) {
  background: rgba(99,102,241,.22);
  border-color: rgba(99,102,241,.55);
  color: #c7d0f8;
}
.mtgf-inv-chip input { margin: 0; accent-color: #818cf8; width: 13px; height: 13px; }
.mtgf-inv-empty { font-size: 13px; color: #2d3f5e; }
.mtgf-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 6px;
}
.mtgf-btn-cancel {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  color: #7a8fb5;
  padding: 10px 22px;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.mtgf-btn-cancel:hover { background: rgba(255,255,255,.11); color: #eef1ff; }
.mtgf-btn-save {
  background: linear-gradient(135deg, #5b5ef4, #818cf8);
  border: none;
  border-radius: 10px;
  color: #fff;
  padding: 10px 26px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(99,102,241,.45);
  transition: transform .15s, box-shadow .15s;
  letter-spacing: .02em;
}
.mtgf-btn-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 24px rgba(99,102,241,.55);
}


/* -- v510 Meeting Hub — Light Theme Cards -- */
.mhr-lt-wrap { display:flex; flex-direction:column; gap:20px; padding:4px 0; }

.mhr-lt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media(max-width:720px){ .mhr-lt-grid{ grid-template-columns:repeat(2,1fr); } }
@media(max-width:480px){ .mhr-lt-grid{ grid-template-columns:1fr; } }

.mhr-room-lt {
  position: relative;
  background: var(--panel, #fff);
  border: 1.5px solid var(--line, #e2e8f0);
  border-radius: 14px;
  padding: 22px 18px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  text-align: left;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  font-family: inherit;
  color: var(--ink, #1e293b);
}
.mhr-room-lt:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  border-color: var(--rc, #6366f1);
}

/* Top accent bar */
.mhr-lt-accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--rc, #6366f1);
  border-radius: 14px 14px 0 0;
}

/* Icon circle */
.mhr-lt-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

/* ══════════════════════════════════════════════
   Project Management v543
══════════════════════════════════════════════ */
.proj-page { padding: 16px 20px; }
.proj-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.proj-title-h {
  color: #e2e8f0;
  margin: 0;
  font-size: 20px;
}
.proj-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .proj-board { grid-template-columns: 1fr; }
}
.proj-col {
  background: #0d1628;
  border-radius: 12px;
  border: 1px solid #1e3a5f;
  overflow: hidden;
}
.proj-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
}
.proj-col-cnt {
  margin-left: auto;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 12px;
}
.proj-st-plan  { background: #1e3a5f; }
.proj-st-wip   { background: #1a2f4a; border-bottom: 2px solid #f59e0b; }
.proj-st-done  { background: #0f2a1a; border-bottom: 2px solid #4ade80; }
.proj-col-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.proj-empty { color: #475569; font-size: 13px; padding: 12px 4px; text-align: center; }

/* Project Card */
.proj-card {
  background: #0f1e36;
  border: 1px solid #1e3a5f;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.proj-card:hover {
  border-color: #4f46e5;
  transform: translateY(-1px);
}
.proj-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.proj-card-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s; }
.proj-card:hover .proj-card-actions { opacity: 1; }
.proj-type-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
}
.proj-tp-int { background: #1e3a5f; color: #7eb3d4; }
.proj-tp-cli { background: #2d1b5a; color: #a78bfa; }
.proj-st-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  color: #94a3b8;
}
.proj-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.4;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.proj-card-client {
  font-size: 12px;
  color: #a78bfa;
  margin-bottom: 6px;
}
.proj-card-meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.proj-progress-wrap {
  background: #1e3a5f;
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 6px;
}
.proj-progress-bar {
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.proj-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #64748b;
}
.proj-task-cnt { color: #94a3b8; }
.proj-pct { color: #4ade80; font-weight: 600; }

/* Sub-task row */
.proj-task-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #0f1e36;
  border-radius: 6px;
  margin-bottom: 4px;
  border: 1px solid #1e3a5f;
  transition: background 0.15s;
}
.proj-task-row:hover { background: #0d2040; }

/* ══════════════════════════════════════════════
   WorkBot v544 — Floating Chat Widget
══════════════════════════════════════════════ */
.wb-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(79,70,229,0.5);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.wb-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(79,70,229,0.7); }
.wb-fab.wb-fab-active { background: linear-gradient(135deg,#dc2626,#9f1239); }

.wb-panel {
  position: fixed;
  bottom: 90px;
  right: 28px;
  width: 360px;
  max-height: 520px;
  background: #0a1020;
  border: 1px solid #1e3a5f;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  z-index: 8999;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  overflow: hidden;
}
.wb-panel.wb-panel-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
@media (max-width: 600px) {
  .wb-panel { right: 8px; left: 8px; width: auto; bottom: 80px; }
  .wb-fab   { bottom: 18px; right: 16px; }
}

.wb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #1e1b4b, #2d1d5a);
  border-bottom: 1px solid #2d2a60;
  flex-shrink: 0;
}
.wb-header-title { color: #e2e8f0; font-weight: 700; font-size: 14px; }
.wb-icon-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}
.wb-icon-btn:hover { background: rgba(255,255,255,0.1); color: #e2e8f0; }

.wb-msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wb-msg {
  max-width: 90%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.wb-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg,#4f46e5,#7c3aed);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.wb-msg-bot {
  align-self: flex-start;
  background: #0f1e36;
  color: #e2e8f0;
  border: 1px solid #1e3a5f;
  border-bottom-left-radius: 4px;
}
.wb-msg-alert {
  align-self: stretch;
  background: #1a0f00;
  color: #fbbf24;
  border: 1px solid #92400e;
  border-radius: 10px;
  font-size: 12px;
  white-space: pre-line;
}

.wb-input-row {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid #1e3a5f;
  flex-shrink: 0;
}
.wb-input {
  flex: 1;
  background: #0d1628;
  border: 1px solid #1e3a5f;
  border-radius: 8px;
  color: #e2e8f0;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
}
.wb-input:focus { border-color: #4f46e5; }
.wb-send-btn {
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
  flex-shrink: 0;
  transition: background 0.15s;
}
.wb-send-btn:hover { background: #4338ca; }
.wb-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.wb-quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 10px 10px;
  flex-shrink: 0;
}
.wb-quick {
  background: #0d2040;
  border: 1px solid #1e3a5f;
  color: #7eb3d4;
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.wb-quick:hover { background: #1e3a5f; border-color: #4f46e5; color: #e2e8f0; }

/* v557: แท็บสเต็ปหน้าแผนโพสต์ — ปุ่ม pill ขอบมน มี hover แยกสีแต่ละแท็บ */
.plan-tabbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 18px; }
.plan-tab {
  flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center;
  gap: 9px; padding: 12px 22px; border: 2px solid; border-radius: 999px;
  font: inherit; cursor: pointer; line-height: 1.2;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s, transform 0.12s;
}
.plan-tab .plan-tab-t { font-size: 0.95rem; font-weight: 800; white-space: nowrap; }
.plan-tab .plan-tab-s { font-size: 0.75rem; font-weight: 600; opacity: 0.8; white-space: nowrap; }
.plan-tab:hover { transform: translateY(-2px); }
.plan-tab:active { transform: translateY(0); }

/* แท็บ Task บรีฟ — โทน indigo/ม่วง (แยกสีตั้งแต่ยังไม่เลือก) */
.plan-tab-brief { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
.plan-tab-brief:hover { background: #e0e7ff; border-color: #a5b4fc; }
.plan-tab-brief.active {
  background: linear-gradient(135deg, #6366f1, #4f46e5); border-color: #4f46e5;
  color: #fff; box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}
/* แท็บ ตั้งโพสต์เลย — โทน teal/เขียว */
.plan-tab-post { background: #effcf9; border-color: #99f6e4; color: #0f766e; }
.plan-tab-post:hover { background: #d9f7ef; border-color: #5eead4; }
.plan-tab-post.active {
  background: linear-gradient(135deg, #14b8a6, #0d9488); border-color: #0d9488;
  color: #fff; box-shadow: 0 8px 20px rgba(13, 148, 136, 0.35);
}
.plan-tab.active .plan-tab-s { opacity: 0.95; }

.plan-panel { animation: planFade 0.18s ease; }
@keyframes planFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) { .plan-tab { padding: 9px 14px; } .plan-tab .plan-tab-s { display: none; } }

/* ══════════════════════════════════════════════════════════════
   v619 · Sticker Mode
══════════════════════════════════════════════════════════════ */
/* ปุ่มในแถบบน */
.sticker-topbar-btn.sticker-mode-on {
  background: rgba(245,158,11,.18) !important;
  border-color: #f59e0b !important;
  color: #f59e0b !important;
  animation: stickerPulse 1.6s ease infinite;
}
@keyframes stickerPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,.0); }
  50% { box-shadow: 0 0 0 6px rgba(245,158,11,.25); }
}
/* hint แสดงตอนเปิดโหมด */
.sticker-hint {
  position: fixed;
  bottom: 68px;
  right: 20px;
  z-index: 9001;
  background: rgba(14,26,47,.92);
  color: #a5b4fc;
  font-size: 12px;
  border-radius: 10px;
  padding: 8px 14px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s;
}
.sticker-hint.visible { opacity: 1; }
/* layer รับคลิก */
.sticker-layer {
  position: absolute; /* v921: เดิม fixed (ยึดจอ → ไหลไปกับจอตอนเลื่อน) → absolute ยึดหน้า เลื่อนไปกับเนื้อหา */
  inset: 0;
  z-index: 8900;
  pointer-events: none;
}
.sticker-layer.editing { cursor: crosshair; pointer-events: all; }
/* sticker items */
.sticker-item {
  position: absolute;
  user-select: none;
}
.sticker-item .sticker-del-btn {
  display: none;
  position: absolute;
  top: -8px; right: -8px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 13px;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 1;
}
.sticker-item.can-edit .sticker-del-btn { display: flex; }
.sticker-item .sticker-resize-h {
  display: none;
  position: absolute;
  bottom: -6px; right: -6px;
  width: 14px; height: 14px;
  border-radius: 3px;
  background: #3b82f6;
  cursor: se-resize;
  z-index: 1;
}
.sticker-item.can-edit .sticker-resize-h { display: block; }
/* v628: sticker picker — centered modal popup */
.sticker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9050;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: spBdIn .18s ease;
}
@keyframes spBdIn { from { opacity:0; } to { opacity:1; } }
.sticker-picker {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 9100;
  background: #0e1a2f;
  border: 1px solid rgba(120,130,200,.25);
  border-radius: 18px;
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  box-shadow: 0 24px 60px rgba(0,0,0,.7), 0 0 0 1px rgba(99,102,241,.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: spIn .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes spIn {
  from { transform: translate(-50%, -46%) scale(.92); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}
.sp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  font-size: 14px;
  color: #c7d2fe;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sp-close {
  background: rgba(255,255,255,.06);
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.sp-close:hover { background: rgba(239,68,68,.25); color: #fca5a5; }
.sp-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 12px 14px 16px;
  overflow-y: auto;
  flex: 1;
}
.sp-item {
  cursor: pointer;
  border-radius: 10px;
  padding: 6px;
  transition: background .12s, transform .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
}
.sp-item:hover { background: #1e2d4a; transform: scale(1.2); }
.sp-item:active { transform: scale(.95); }

/* ══════════════════════════════════════════════════════════════
   Sticky Notes v639
══════════════════════════════════════════════════════════════ */
.sticky-note-topbar-btn { margin-left: 4px; }
.sticky-layer {
  position: fixed;
  inset: 0;
  z-index: 8800;
  pointer-events: none;
}
/* note card — ใช้ background-image จากรูป PNG */
.sticky-note {
  position: absolute;
  pointer-events: all;
  display: block;
  min-width: 120px;
  min-height: 80px;
  user-select: none;
  cursor: grab;
  filter: drop-shadow(3px 5px 10px rgba(0,0,0,.28));
}
.sticky-note:active { cursor: grabbing; }
/* ปุ่มลบ — มุมขวาบน */
.sn-del {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,.18);
  border: none;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s, background .12s;
  z-index: 2;
  line-height: 1;
  padding: 0;
}
.sticky-note:hover .sn-del { opacity: 1; }
.sn-del:hover { background: rgba(220,38,38,.85); }
/* textarea พิมพ์ข้อความ */
.sn-ta {
  position: absolute;
  inset: 0;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  /* padding: เว้นขอบรูป sticky note (top มีมุมพับ ~15%) */
  padding: 30px 18px 22px 18px;
  font-size: 13px;
  line-height: 1.55;
  color: #333;
  font-family: "Sarabun", "Noto Sans Thai", sans-serif;
  pointer-events: all;
  cursor: text;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}
.sn-ta::placeholder { color: rgba(80,60,0,.4); }
/* resize handle มุมขวาล่าง */
.sn-resize {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  cursor: se-resize;
  z-index: 2;
  opacity: 0;
  transition: opacity .15s;
  background: rgba(0,0,0,.25);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  border-radius: 0 0 4px 0;
}
.sticky-note:hover .sn-resize { opacity: 1; }
/* ── Sticky Note Picker (v639) */
.sn-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9050;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: spBdIn .18s ease;
}
.sn-picker {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 9100;
  background: #0e1a2f;
  border: 1px solid rgba(120,130,200,.25);
  border-radius: 18px;
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  box-shadow: 0 24px 60px rgba(0,0,0,.7), 0 0 0 1px rgba(99,102,241,.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: spIn .2s cubic-bezier(.34,1.56,.64,1);
}
.sn-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sn-picker-close {
  background: rgba(255,255,255,.06);
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.sn-picker-close:hover { background: rgba(239,68,68,.25); color: #fca5a5; }
.sn-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px 16px 18px;
  overflow-y: auto;
  flex: 1;
}
.sn-picker-item {
  cursor: pointer;
  border-radius: 10px;
  padding: 8px;
  transition: background .12s, transform .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 409 / 516;
  background: rgba(255,255,255,.04);
}
.sn-picker-item:hover { background: #1e2d4a; transform: scale(1.06); }
.sn-picker-item:active { transform: scale(.96); }
.sn-picker-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* v809: ปุ่มสลับมุมมอง การ์ด/ตาราง หน้าแผนโพสต์ */
/* v904: ปุ่มการ์ด/ตาราง = segmented toggle (รางเดียว ปุ่มติดกัน · active = ชิปขาวยกลอย) */
#postViewToggle { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; background: #ECEEF4; border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.pvm-btn { display: inline-flex; align-items: center; gap: 5px; background: transparent; border: none; border-radius: 8px; padding: 5px 14px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit; white-space: nowrap; transition: background .15s, color .15s; }
.pvm-btn:hover { color: var(--ink); }
.pvm-btn.pvm-active { background: #1a3a6b; color: #eef1ff; box-shadow: 0 1px 3px rgba(17,24,39,.22); }
/* v860: มุมมองตารางแผนโพสต์ — ให้กินเต็มความกว้าง (แทน grid การ์ด) */
/* v898: มุมมองตารางโพสต์ = เต็มความกว้าง (กันตกค้าง grid การ์ด → กรอบเหลือครึ่งเดียว) */
.post-list.pv-table { display: block !important; grid-template-columns: none !important; width: 100%; }
.post-list.pv-table > div { width: 100%; box-sizing: border-box; }
.post-list.pv-table table { width: 100%; }
.pvt-row:hover > td { background: #f8faff; }
/* v952: dropdown เมนูปุ่มในการ์ด Portfolio/KPI (ซ่อน marker เริ่มต้น + หมุน caret เมื่อเปิด) */
.pf-menu > summary { list-style: none; }
.pf-menu > summary::-webkit-details-marker { display: none; }
.pf-menu > summary::marker { content: ""; }
.pf-menu > summary:hover { filter: brightness(1.08); }
.pf-menu[open] > summary .pf-menu-caret { display: inline-block; transform: rotate(180deg); }

/* ============================================================================
   v1043: การ์ด "ตรวจงาน / อนุมัติ" ใช้ธีมสว่างเหมือนการ์ด "รายละเอียดงาน" (brief-drawer)
   ขอบเขต: ตรวจงาน Brief (#reviewModal) · คิวอนุมัติ Brief (#bjApprovalSessionBackdrop) · อนุมัติโพสต์ (#postApprovalPopup)
   ============================================================================ */
#reviewModal .avatar-box,
#postApprovalPopup .avatar-box {
  background: var(--panel, #fff); color: var(--ink, #111827);
  border: 1px solid var(--line, #E5E7EB); border-radius: 16px; box-shadow: var(--s3, 0 20px 60px rgba(0,0,0,.25));
  padding: 0; overflow-y: auto;
}
/* หัวการ์ดสีแบรนด์ (เหมือนหัว brief-drawer) */
#reviewModal .avatar-head,
#postApprovalPopup .avatar-head {
  background: var(--brand, #6366F1); color: #fff !important; padding: 16px 20px; margin: 0 0 4px;
  border-radius: 16px 16px 0 0; position: sticky; top: 0; z-index: 2;
}
#reviewModal .avatar-x, #postApprovalPopup .avatar-x { color: #fff; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); border-radius: 8px; }
#reviewModal .avatar-box > :not(.avatar-head),
#postApprovalPopup .avatar-box > :not(.avatar-head) { margin-left: 20px !important; margin-right: 20px !important; }
#reviewModal .avatar-box > :last-child,
#postApprovalPopup .avatar-box > :last-child { margin-bottom: 18px; }
#reviewModal .avatar-box > .avatar-head + *,
#postApprovalPopup .avatar-box > .avatar-head + * { margin-top: 12px; }

/* --- ตรวจงาน Brief (#reviewModal) --- */
#reviewModal .rv-meta { color: var(--muted, #6B7280); }
#reviewModal .rv-brief { background: #F8F9FF; border: 1px solid var(--line, #E5E7EB); color: var(--ink-2, #374151); }
#reviewModal .rv-links a, #reviewModal .rv-history .bj-sub a { color: var(--brand-dark, #4338CA) !important; }
#reviewModal .rv-link-path { background: #F8F9FF; border-color: var(--line, #E5E7EB); color: var(--ink-2, #374151); }
#reviewModal .rv-link-copy { background: #fff; border-color: var(--line-2, #D1D5DB); color: var(--ink-2, #374151); }
#reviewModal .rv-link-copy:hover { background: var(--brand-light, #EEF2FF); }
#reviewModal .rv-sub-imgs img { border-color: var(--line, #E5E7EB); }
#reviewModal .rv-item { background: #fff; border-color: var(--line, #E5E7EB); }
#reviewModal .rv-item:has(.rv-fix-chk:checked) { border-color: #f59e0b; background: #FFFBEB; }
#reviewModal .rv-item-h { color: var(--ink, #111827); }
#reviewModal .rv-item-brief { color: var(--ink-2, #374151); }
#reviewModal .rv-fix-row { color: #dc2626; }
#reviewModal .rv-fix-note { background: #fff; border-color: var(--line-2, #D1D5DB); color: var(--ink, #111827); }
#reviewModal .rv-redo { border-top-color: var(--line, #E5E7EB); }
#reviewModal .rv-redo label { color: var(--ink-2, #374151); }
#reviewModal .rv-redo input { background: #fff; border-color: var(--line-2, #D1D5DB); color: var(--ink, #111827); }
#reviewModal .kpi-person-sec { color: var(--muted, #6B7280); }
/* ส่วนที่ใส่สีด้วย inline style — ต้อง !important */
#reviewModal .rv-import-fields > div { background: #F8F9FF !important; border-color: var(--line, #E5E7EB) !important; color: var(--ink-2, #374151) !important; }
#reviewModal .rv-import-fields > div > span:first-child { color: var(--muted, #6B7280) !important; }
#reviewModal .rv-history .bj-sub { background: #F8F9FF !important; border: 1px solid var(--line, #E5E7EB) !important; color: var(--ink-2, #374151) !important; }
#reviewModal .rv-history .bj-sub b { color: var(--ink, #111827) !important; }
#reviewModal .rv-history .bj-sub span { color: var(--muted, #6B7280) !important; }
#reviewModal .rv-history .bj-sub .bj-sub-note { color: #b45309 !important; }
#reviewModal .rv-history .bj-sub code { background: #EEF2FF !important; color: var(--brand-dark, #4338CA) !important; }

/* --- คิวอนุมัติ Brief (#bjApprovalSessionBackdrop) + อนุมัติโพสต์ (#postApprovalPopup) --- */
#bjApprovalSessionBackdrop .avatar-box { border: 1px solid var(--line, #E5E7EB); box-shadow: var(--s3, 0 20px 60px rgba(0,0,0,.25)); }
#bjApprovalSessionBackdrop .bj-asession-box { background: var(--panel, #fff); color: var(--ink, #111827); scrollbar-color: rgba(99,102,241,.5) transparent; }
#bjApprovalSessionBackdrop .bj-asession-box::-webkit-scrollbar-track { background: transparent; }
#bjApprovalSessionBackdrop .bj-asession-box::-webkit-scrollbar-thumb { background: rgba(99,102,241,.45); }
#bjApprovalSessionBackdrop .bj-asession-head { background: var(--brand, #6366F1); color: #fff; margin: -22px -24px 14px; padding: 16px 24px; border-radius: 16px 16px 0 0; }
#bjApprovalSessionBackdrop .bj-asession-head h3 { color: #fff !important; }
#bjApprovalSessionBackdrop .bj-asession-section-hd { color: var(--muted, #6B7280); }
#bjApprovalSessionBackdrop .bj-asession-card, #postApprovalPopup .bj-asession-card { background: #fff; border-color: var(--line, #E5E7EB); }
#bjApprovalSessionBackdrop .bj-asession-title { color: var(--ink, #111827); }
#bjApprovalSessionBackdrop .bj-asession-meta, #bjApprovalSessionBackdrop .bj-asession-info, #postApprovalPopup .bj-asession-info { color: var(--muted, #6B7280); }
#bjApprovalSessionBackdrop .bj-asession-brief, #postApprovalPopup .bj-asession-brief { background: #F8F9FF; color: var(--ink-2, #374151); border-left-color: var(--brand, #6366F1); }
#bjApprovalSessionBackdrop .bj-asession-link, #postApprovalPopup .bj-asession-link { color: var(--brand-dark, #4338CA); }
#bjApprovalSessionBackdrop .bj-asn-link-row, #postApprovalPopup .bj-asn-link-row { background: var(--brand-light, #EEF2FF); border-color: #C7D2FE; color: var(--ink-2, #374151); }
#bjApprovalSessionBackdrop .bj-asn-items-wrap { border-color: var(--line, #E5E7EB); }
#bjApprovalSessionBackdrop .bj-asn-item { background: #fff; border-bottom-color: var(--line, #E5E7EB); }
#bjApprovalSessionBackdrop .bj-asn-item-head b { color: var(--ink, #111827) !important; }
#bjApprovalSessionBackdrop .bj-asn-item-kind { background: var(--brand-light, #EEF2FF); color: var(--brand-dark, #4338CA); }
#bjApprovalSessionBackdrop .bj-asn-item-brief { background: #F8F9FF; color: var(--ink-2, #374151); }
#bjApprovalSessionBackdrop .bj-asn-spec { background: #fff; color: var(--ink-2, #374151); border-color: var(--line, #E5E7EB); }
#bjApprovalSessionBackdrop .bj-asession-img { border-color: var(--line, #E5E7EB); }
/* อนุมัติโพสต์: ข้อความ inline-style สีสว่าง → สีเข้ม */
#postApprovalPopup [style*="color:#eef1ff"] { color: var(--ink, #111827) !important; }
#postApprovalPopup [style*="color:#b9c2e0"], #postApprovalPopup [style*="color:#94a3b8"] { color: var(--muted, #6B7280) !important; }
#postApprovalPopup [style*="color:#7dd3fc"] { color: var(--brand-dark, #4338CA) !important; }
#postApprovalPopup [style*="background:#0d2040"] { background: var(--brand-light, #EEF2FF) !important; border-color: #C7D2FE !important; }
#postApprovalPopup [style*="background:#3a2a0d"] { background: #FFFBEB !important; border-color: #FDE68A !important; color: #b45309 !important; }
#postApprovalPopup #paRejNote { background: #fff !important; color: var(--ink, #111827) !important; border-color: var(--line-2, #D1D5DB) !important; }
#reviewModal .rv-import-fields { margin-left: 20px !important; margin-right: 20px !important; }
#bjApprovalSessionBackdrop .bj-asession-box { overflow-y: auto; }
/* หัวการ์ด: กันกฎสีข้อความ inline (color:#eef1ff → สีเข้ม) ไปทับตัวอักษรขาวบนหัวสีแบรนด์ */
#reviewModal .avatar-box > .avatar-head,
#postApprovalPopup .avatar-box > .avatar-head { color: #fff !important; }

/* v1130: ช่องโน้ตตรวจงานเป็นหลายบรรทัด (ข้อความยาวเห็นครบ) */
.rv-redo textarea { width: 100%; box-sizing: border-box; border: 1.5px solid #2f3f63; border-radius: 8px; padding: 7px 9px; font: inherit; font-size: 13px; line-height: 1.5; min-height: 64px; resize: vertical; background: #0e1426; color: #fff; }
#reviewModal .rv-redo textarea { background: #fff; border-color: var(--line-2, #D1D5DB); color: var(--ink, #111827); }

/* v1140: หมายเหตุตีกลับ/ผู้ตรวจที่พิมพ์ขึ้นบรรทัดใหม่ไว้ ต้องแสดงตัดบรรทัดตามที่พิมพ์ (เดิมยุบเป็นบรรทัดเดียวอ่านยาก) */
.bv-reject-note, .bjm-review-note span, .bj-sub-note, .bj-row-reject-note, .bv-hist-item { white-space: pre-wrap; overflow-wrap: anywhere; }
.bv-reject-note { display: block; margin-top: 2px; }

/* v1143: จุดสถานะของงานที่ถูกตีกลับให้แก้ = สีแดง (ทั้งหน้างานของทีม/งานของฉัน) + การ์ด Kanban ขอบแดง */
.task-item-status.rej { background: #ef4444 !important; box-shadow: 0 0 0 3px rgba(239,68,68,.22); }
.kb-card:has(.task-item-status.rej) { border-left: 3px solid #ef4444; background: #fff5f5; }

/* ════ v1380: หน้า KPI — โทนสว่าง + จัดสัดส่วนตาราง (กำหนดเฉพาะใน #kpiView ไม่กระทบป๊อปอัปมืดที่ใช้คลาสเดียวกัน) ════ */
#kpiView .kpi-toolbar { gap: 10px; }
#kpiView .kpi-month { color: #334155; font-weight: 600; }
#kpiView .kpi-month input { background: #fff; color: #0f172a; border: 1px solid #cbd5e1; }
#kpiView .kpi-summary { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
#kpiView .kpi-card { background: #fff; border: 1px solid #e2e8f0; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
#kpiView .kpi-card span { color: #64748b; font-weight: 600; }
#kpiView .kpi-card b { color: #0f172a; }
#kpiView .kpi-card b.g { color: #15803d; } #kpiView .kpi-card b.o { color: #b45309; } #kpiView .kpi-card b.b { color: #1d4ed8; } #kpiView .kpi-card b.r { color: #b91c1c; }
#kpiView .kpi-tbl { border-collapse: separate; border-spacing: 0; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; font-size: 13.5px; }
#kpiView .kpi-tbl th, #kpiView .kpi-tbl td { background: #fff; color: #1e293b; border-bottom: 1px solid #eef1f6; padding: 10px 10px; vertical-align: middle; }
#kpiView .kpi-tbl th { background: #f1f5f9; color: #475569; font-size: 11.5px; font-weight: 700; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
#kpiView .kpi-tbl tbody tr:hover td { background: #f8fafc; }
#kpiView .kpi-tbl tbody tr:last-child td { border-bottom: none; }
#kpiView .kpi-name { color: #0f172a; }
#kpiView .kpi-dim { color: #94a3b8; }
#kpiView .kpi-pct.g { color: #15803d; } #kpiView .kpi-pct.o { color: #b45309; } #kpiView .kpi-pct.r { color: #b91c1c; }
#kpiView .kpi-detail-btn { color: #3730a3; } #kpiView .kpi-detail-btn:hover { color: #4f46e5; }
#kpiView .kpi-pf-btn { color: #64748b; } #kpiView .kpi-pf-btn:hover { color: #4338ca; background: #eef2ff; }
#kpiView .kpi-hide-btn { color: #94a3b8; } #kpiView .kpi-hide-btn:hover { color: #dc2626; background: #fef2f2; }
#kpiView .kpi-hidden-bar { color: #64748b; }
#kpiView .kpi-hidden-chip { background: #f1f5f9; border-color: #cbd5e1; color: #334155; }
#kpiView .kpi-hidden-chip b { color: #15803d; }
#kpiView .kpi-bar { background: #e2e8f0; height: 10px; }
#kpiView .kpi-bar i { background: #3b82f6; } #kpiView .kpi-bar i.g { background: #22c55e; } #kpiView .kpi-bar i.o { background: #f59e0b; } #kpiView .kpi-bar i.r { background: #ef4444; }
#kpiView .kpi-trend-bar, #kpiView .kpi-stack-bar { background: #e2e8f0; }
#kpiView .kpi-trend-val, #kpiView .kpi-stack-val { color: #334155; }
#kpiView .kpi-trend-m, #kpiView .kpi-stack-m, #kpiView .kpi-stack-leg-item { color: #64748b; }
#kpiView .kpi-pos-count { background: #eef2ff; color: #4338ca; }
/* ตารางรายคน: คอลัมน์ตัวเลขชิดกึ่งกลาง ความกว้างตาม <colgroup> (ชื่อกว้างสุด · แถบความคืบหน้ากว้างพอ) */
#kpiView .kpi-person-tbl { table-layout: fixed; width: 100%; display: table; white-space: normal; }
#kpiView .kpi-person-tbl th:nth-child(n+2):nth-child(-n+11), #kpiView .kpi-person-tbl td:nth-child(n+2):nth-child(-n+11) { text-align: center; }
#kpiView .kpi-person-tbl th:first-child, #kpiView .kpi-person-tbl td:first-child { padding-left: 14px; }
#kpiView .kpi-person-tbl td:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#kpiView .kpi-person-tbl td:nth-child(10) { white-space: nowrap; }
#kpiView #kpiTable { overflow-x: auto; }
@media (max-width: 900px) { #kpiView .kpi-person-tbl { table-layout: auto; display: block; overflow-x: auto; white-space: nowrap; min-width: 720px; } }

/* v1413: ป๊อปอัป KPI รายคน — ไม่ซ้อนสกรอลบาร์ (รายการในส่วนต่างๆ ยาวตามเนื้อหา เลื่อนด้วยสกรอลของป๊อปอัปอันเดียว) · ชื่องานยาวตัดด้วย … ไม่เกิดสกรอลแนวนอน */
#kpiPersonModal .kpi-person-jobs { max-height: none; overflow: visible; min-width: 0; }
#kpiPersonModal .avatar-box { overflow-x: hidden; }
#kpiPersonModal .kpi-job-row { min-width: 0; }
#kpiPersonModal .kpi-job-row b { flex: 1 1 auto; min-width: 0; }

/* ═══ v1432: ป๊อปอัปรายละเอียดงาน (Brief) — ดีไซน์เดียวกับป๊อปอัปรายละเอียดโพสต์ (หัวสีแบรนด์ · แถบผู้รับผิดชอบ · การ์ดเวลา · ส่วนเป็นการ์ด) ═══ */
.bjm-modal { max-width: 620px; border-radius: 16px; background: #f4f6fb; border: 1px solid var(--line, #e5e7eb); box-shadow: 0 24px 60px rgba(15,23,42,.35); }
.bjm-head { align-items: flex-start; gap: 14px; padding: 20px 22px 16px; border-bottom: none; background: linear-gradient(135deg, #6366f1 0%, #7c6df0 100%); color: #fff; flex-shrink: 0; }
.bjm-head-main { flex: 1; min-width: 0; }
.bjm-kicker { margin: 0 0 4px; font-size: 11px; font-weight: 700; color: rgba(255,255,255,.72); text-transform: uppercase; letter-spacing: .05em; }
.bjm-head h3 { margin: 0 0 8px; font-size: 18px; line-height: 1.4; color: #fff; overflow-wrap: anywhere; }
.bjm-head .jm-badges { margin-top: 0; }
/* v1434: ป้ายในหัวม่วงต้องอ่านออก — ป้ายความยากใช้สีโปร่งแสง+ตัวอักษรสี กลืนพื้น → ใส่พื้นขาวทึบ */
.bjm-head .pr-badge[style] { background: #fff !important; border-color: rgba(255,255,255,.9) !important; box-shadow: 0 1px 3px rgba(15,23,42,.18); }
.bjm-head .jm-links { margin-top: 4px; }
.bjm-head .ghost-button { flex-shrink: 0; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); color: #fff; margin-top: 2px; }
.bjm-head .ghost-button:hover { background: rgba(255,255,255,.28); }
.bjm-body { padding: 14px 16px 18px; gap: 12px; background: #f4f6fb; align-content: start; }
.bjm-people { display: flex; align-items: stretch; background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: 12px; overflow: hidden; }
.bjm-person { flex: 1; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; min-width: 0; }
.bjm-pl { font-size: 10px; font-weight: 700; color: #6b7280; letter-spacing: .04em; white-space: nowrap; }
.bjm-person b { font-size: 13px; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bjm-sep { width: 1px; background: var(--line, #e5e7eb); margin: 8px 0; flex-shrink: 0; }
.bjm-stchip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: #f1f5f9; color: #475569; }
.bjm-stchip.st-doing { background: #dbeafe; color: #1d4ed8; }
.bjm-stchip.st-review { background: #fef3c7; color: #b45309; }
.bjm-stchip.st-done { background: #dcfce7; color: #15803d; }
.bjm-timecard { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: 12px; border-left: 4px solid #cbd5e1; }
.bjm-timecard.is-run { background: #f0fdf4; border-color: #bbf7d0; border-left-color: #22c55e; }
.bjm-timecard.is-break { background: #fffbeb; border-color: #fde68a; border-left-color: #f59e0b; }
.bjm-tc-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bjm-tc-lbl { font-size: 11px; font-weight: 700; color: #475569; }
.bjm-tc-val { font-size: 17px; color: #0f172a; font-weight: 800; }
.bjm-tc-act { display: flex; align-items: center; gap: 10px; flex-shrink: 0; font-size: 11.5px; color: #15803d; font-weight: 600; }
.bjm-timecard.is-break .bjm-tc-act { color: #b45309; }
.bjm-tc-btn { border: 1px solid #cbd5e1; background: #fff; color: #334155; border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.bjm-tc-btn:hover { background: #eef2ff; border-color: #a5b4fc; color: #3730a3; }
.bjm-section { background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: 12px; padding: 12px 14px; }
.bjm-section > b, .bjm-items-header > b { display: block; margin-bottom: 8px; color: #4338ca; font-size: 12.5px; letter-spacing: .01em; }
.bjm-items-header { margin-bottom: 4px; }
.bjm-items-header > b { margin-bottom: 0; }
.bjm-section .bjm-item { background: #f8fafc; border-radius: 10px; }
.bjm-review-note { border-radius: 12px; }
.bjm-steps { margin: 0; gap: 8px; }
.bjm-step { border-radius: 12px; background: #fff; padding: 9px 12px; }
.bjm-locked { border-radius: 12px; margin: 0; }
.bjm-submit { background: linear-gradient(180deg, #eef2ff 0%, #fff 70%); border-color: #c7d2fe; }
.bjm-submit input, .bjm-submit select { background: #fff; border: 1.5px solid #cbd5e1; border-radius: 10px; padding: 9px 11px; width: 100%; box-sizing: border-box; font-family: inherit; }
.bjm-submit input:focus, .bjm-submit select:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.bjm-submit .primary-button { border-radius: 10px; padding: 10px 14px; font-weight: 800; }
.bjm-sub-attach { background: #fff; border: 1.5px dashed #a5b4fc; border-radius: 10px; padding: 8px 12px; color: #4338ca; }
.bjm-full { background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: 12px; padding: 10px 14px; }
.bjm-foot { background: #fff; border-top: 1px solid var(--line, #e5e7eb); padding: 11px 16px; flex-wrap: wrap; gap: 8px; }
.bjm-status { font-size: 12.5px; font-weight: 700; color: #475569; display: inline-flex; align-items: center; gap: 6px; }
.bjm-status select { background: #f8fafc; border-radius: 10px; font-weight: 700; }
.bjm-foot .ghost-button, .bjm-foot .danger-button { border-radius: 10px; }
@media (max-width: 560px) { .bjm-people { flex-wrap: wrap; } .bjm-person { flex: 1 1 45%; } .bjm-sep { display: none; } .bjm-timecard { flex-wrap: wrap; } }
/* v1432: ให้การ์ดในตัวป๊อปอัปไม่ถูกบีบความสูง (เดิมเป็น grid → ส่วนที่ overflow:hidden ยุบเหลือเส้นบางเมื่อเนื้อหายาว) */
.bjm-body { display: flex; flex-direction: column; }
.bjm-body > * { flex-shrink: 0; }

/* v1441: หัวคอลัมน์งานของทีมสูงเท่ากันทุกคอลัมน์ — ชื่อบรรทัดเดียว (ยาวเกินใช้ …) ซ้าย · ปุ่มแดชบอร์ด + จำนวนงาน เรียงซ้อนขวา ไม่ตัดบรรทัดเอง */
.task-col-head { min-height: 62px; box-sizing: border-box; gap: 8px; }
.task-col-head .task-owner { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.3; }
.task-col-head .task-head-right { flex: 0 0 auto; flex-direction: column; align-items: flex-end; gap: 3px; }
.task-col-head .task-head-right .task-dash-btn { white-space: nowrap; }
.task-col-head .task-total { white-space: nowrap; line-height: 1.2; }

/* v1470: ตัวกรองหัวตาราง (สถานะงานย่อย / ฝ่ายโปรเจค / เดือน) — ป้ายไม่ตัดบรรทัด · ถ้าที่ไม่พอให้ทั้งกล่องขึ้นบรรทัดใหม่แทน */
.task-month-pick { white-space: nowrap; flex: 0 0 auto; }
.task-month-pick select { min-width: 120px; }

/* v1472: แถบเครื่องมือตาราง KPI รายคน — แยกเป็น 2 แถว (เดือน/สาขา · คำสั่ง) ปุ่มไม่ตัดบรรทัด */
.kpi-tb button { white-space: nowrap; flex: 0 0 auto; }

/* v1476: ฟอร์มแผนโพสต์ — แบ่งเป็นการ์ดเซคชัน (ข้อมูลหลัก / ผู้รับผิดชอบ / เนื้อหา / แพลตฟอร์ม) + สวิตช์ Repost */
#postForm .pf-sec { border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px 16px 16px; margin: 0 0 14px; background: #fff; }
#postForm .pf-sec-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px dashed #e2e8f0; }
#postForm .pf-sec-h span { font-size: 14px; font-weight: 800; color: #1e293b; white-space: nowrap; }
#postForm .pf-sec-h small { font-size: 11.5px; color: #94a3b8; font-weight: 500; }
#postForm .pf-sec .form-grid { align-items: start; gap: 12px 16px; }
#postForm .pf-sec > * + * { margin-top: 12px; }
#postForm .pf-sec > .pf-sec-h + * { margin-top: 0; }
#postForm .pf-sec .content-category-row, #postForm .pf-sec .post-type-row { margin-top: 12px; }
#postForm .pf-repost { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc; cursor: pointer; grid-template-columns: none; }
#postForm .pf-repost input { position: absolute; opacity: 0; width: 0; height: 0; }
#postForm .pf-repost .pf-sw { position: relative; flex: 0 0 auto; width: 38px; height: 21px; border-radius: 999px; background: #cbd5e1; transition: background .15s; }
#postForm .pf-repost .pf-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
#postForm .pf-repost input:checked + .pf-sw { background: #0ea5e9; }
#postForm .pf-repost input:checked + .pf-sw::after { left: 19px; }
#postForm .pf-repost:has(input:checked) { border-color: #7dd3fc; background: #f0f9ff; }
#postForm .pf-repost .pf-repost-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#postForm .pf-repost .pf-repost-t b { font-size: 13px; color: #1e293b; }
#postForm .pf-repost .pf-repost-t small { font-size: 11.5px; color: #64748b; font-weight: 400; line-height: 1.4; }

/* v1477: การ์ดฟอร์มแผนโพสต์ — กระชับขึ้น + พับ/กางเซคชันได้ (กดที่หัวการ์ด) */
#postForm .pf-sec { padding: 10px 14px 12px; margin: 0 0 10px; }
#postForm .pf-sec-h { margin: 0 0 10px; padding-bottom: 6px; }
#postForm .pf-sec .form-grid { gap: 10px 14px; }
#postForm .pf-repost { margin-top: 10px; padding: 6px 10px; gap: 10px; }
#postForm .pf-repost .pf-repost-t small { font-size: 11px; }
#postForm .pf-sec-h.pf-tg { cursor: pointer; user-select: none; }
#postForm .pf-sec-h.pf-tg::after { content: "▾"; margin-left: auto; font-size: 13px; color: #64748b; transition: transform .15s; order: 9; }
#postForm .pf-sec-h.pf-tg:hover span { color: #4338ca; }
#postForm .pf-sec.pf-closed > :not(.pf-sec-h) { display: none !important; }
#postForm .pf-sec.pf-closed .pf-sec-h { margin: 0; padding-bottom: 0; border-bottom: none; }
#postForm .pf-sec.pf-closed .pf-sec-h.pf-tg::after { transform: rotate(-90deg); }
#postForm .pf-sec-h .pf-sum { display: none; font-style: normal; font-size: 12px; color: #475569; background: #f1f5f9; border-radius: 999px; padding: 2px 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#postForm .pf-sec.pf-closed .pf-sum { display: inline-block; }
#postForm .pf-sec.pf-closed .pf-sec-h small { display: none; }

/* v1494: สวิตช์ For Ads (สีม่วง) + แถวเลือกสินค้าแบบดรอปดาวน์ */
#postForm .pf-forads { margin-top: 12px; }
#postForm .pf-forads input:checked + .pf-sw { background: #a855f7; }
#postForm .pf-forads:has(input:checked) { border-color: #d8b4fe; background: #faf5ff; }

/* v1499: เตือนคิวงานเสี่ยง จัดกลุ่มสาขา → คน */
.bj-alert-br { margin-top: 10px; }
.bj-alert-brh { font-weight: 800; font-size: 13.5px; color: #92400e; background: rgba(245,159,0,.18); border-radius: 8px; padding: 5px 10px; display: flex; align-items: center; gap: 8px; }
.bj-alert-brh span, .bj-alert-psh span { margin-left: auto; font-size: 11px; font-weight: 600; color: #b25c00; }
.bj-alert-ps { margin: 6px 0 0 10px; padding-left: 10px; border-left: 3px solid #f0d9a0; }
.bj-alert-psh { font-weight: 700; font-size: 13px; padding-top: 4px; display: flex; gap: 8px; }
.bj-alert-psh span { background: #fff; border: 1px solid #f0d9a0; border-radius: 999px; padding: 0 8px; margin-left: 0; }

/* v1500: ส่วนงานสำเร็จในใบงาน */
.bjm-done-sec { background: #f0fdf4 !important; border: 1.5px solid #86efac !important; }
.bjm-done-sec > b { color: #15803d; }
.bjm-done-by { font-size: 12px; color: #166534; margin-left: 6px; }
.bjm-done-link { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 999px; background: #16a34a; color: #fff !important; font-size: 12px; font-weight: 700; text-decoration: none; }

/* v1520: การ์ดโพสต์ — ตัดบรรทัดข้อความให้เป็นระเบียบ: ข้อความยาวย่อเหลือ 3-4 บรรทัด (กดที่ข้อความเพื่อขยาย/ย่อ) · ลิงก์ยาวตัดคำได้ไม่ดันการ์ดกว้าง · ไม่ยืดช่องว่างระหว่างส่วนเมื่อการ์ดข้างเคียงสูงกว่า */
.post-card { align-content: start; min-width: 0; }
.post-card .caption-preview, .post-card .caption-direction-preview, .post-card .notes-value, .post-card .asset-value, .post-card .hashtag-value {
  overflow-wrap: anywhere; word-break: break-word; min-width: 0;
}
.post-card .caption-preview, .post-card .caption-direction-preview, .post-card .notes-value, .post-card .asset-value {
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; position: relative;
}
.post-card .caption-preview { -webkit-line-clamp: 4; line-clamp: 4; white-space: pre-line; }
.post-card .caption-direction-preview { -webkit-line-clamp: 3; line-clamp: 3; white-space: pre-line; }
.post-card .notes-value { -webkit-line-clamp: 4; line-clamp: 4; white-space: pre-line; font-size: 12.5px; }
.post-card .asset-value { -webkit-line-clamp: 2; line-clamp: 2; font-size: 12.5px; }
.post-card .hashtag-value { font-size: 12.5px; }
.post-card .tx-expanded { -webkit-line-clamp: unset !important; line-clamp: unset !important; display: block !important; overflow: visible !important; }
.post-card .tx-clamped::after { content: "… ดูเพิ่ม"; position: absolute; right: 0; bottom: 0; padding-left: 28px; background: linear-gradient(90deg, rgba(255,255,255,0), var(--panel, #fff) 45%); color: #4f46e5; font-size: 11.5px; font-weight: 700; font-style: normal; }
.post-card .post-meta { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }

/* v1540: สกอร์บาร์ในป็อปอัพ — เส้นบาง โค้งมน ไม่มีลูกศร ไม่ติดขอบ/พื้นหลังขาว (ใช้ได้ทั้งพื้นสว่างและมืด) */
.avatar-modal ::-webkit-scrollbar, .avatar-modal::-webkit-scrollbar { width: 14px; height: 14px; }
.avatar-modal ::-webkit-scrollbar-track { background: transparent; }
.avatar-modal ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.avatar-modal ::-webkit-scrollbar-corner { background: transparent; }
.avatar-modal ::-webkit-scrollbar-thumb { background: rgba(99,102,241,.45); border-radius: 999px; border: 4px solid transparent; background-clip: padding-box; min-height: 40px; }
.avatar-modal ::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,.75); background-clip: padding-box; }
@supports not selector(::-webkit-scrollbar) { .avatar-modal * { scrollbar-width: thin; scrollbar-color: rgba(99,102,241,.5) transparent; } }
.rv-items { padding-right: 2px; }

/* ───────── v1791: จัดหน้ามือถือให้เป็นระเบียบ — ไม่เบียด ไม่ซ้อนทับ ───────── */
@media (max-width: 760px) {
  html, body { overflow-x: clip; max-width: 100%; }                       /* กันหน้าเลื่อนซ้าย-ขวา/สั่น */
  .workspace { min-width: 0; }
  /* แถบหัว: ชื่อหน้าเต็มแถว (เว้นที่ให้ปุ่มเมนู ☰) · ปุ่ม วิธีใช้งาน/สติ๊กเกอร์/โน้ต/ออก เป็นแถวเดียวขนาดเล็ก (เดิมเรียงลงมาเต็มจอทีละปุ่ม) */
  .topbar { flex-direction: row !important; flex-wrap: wrap !important; align-items: center !important; gap: 6px !important; }
  .topbar > div:first-child { flex: 1 1 100% !important; min-width: 0; padding-left: 52px; min-height: 44px; display: flex; flex-direction: column; justify-content: center; }
  .topbar > div:first-child .eyebrow { margin: 0 !important; }
  .topbar > div:first-child h2 { margin: 0 !important; font-size: 19px !important; line-height: 1.3; word-break: break-word; }
  #helpBtn, #stickerModeBtn, #stickyNoteBtn, #logoutBtn { width: auto !important; flex: 0 0 auto !important; margin: 0 !important; padding: 6px 11px !important; min-height: 34px; font-size: 12.5px !important; border-radius: 999px !important; justify-content: center; }
  #logoutBtn { margin-left: auto !important; }
  .topbar-actions { flex: 1 1 100% !important; width: 100%; flex-wrap: nowrap !important; overflow-x: auto; gap: 6px !important; padding-bottom: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions > * { flex: 0 0 auto !important; width: auto !important; white-space: nowrap; }
  /* ปุ่มเมนู ☰ ลอยมุมซ้ายบน: พื้นทึบ + เงา ไม่จมกับเนื้อหาตอนเลื่อน */
  #mobileNavToggle { background: rgba(255,255,255,.96) !important; box-shadow: 0 4px 14px rgba(15,23,42,.14) !important; }
  /* ปุ่ม NevBot: เล็กลง ชิดมุม ไม่ทับปุ่ม/ข้อความ */
  #nbBtn { right: 12px !important; bottom: calc(12px + env(safe-area-inset-bottom)) !important; padding: 8px !important; min-width: 0 !important; width: 46px; height: 46px; justify-content: center; opacity: .92; }
  #nbBtn img, #nbBtn svg { width: 26px !important; height: 26px !important; }
  .workspace { padding-bottom: 76px !important; }                        /* เว้นที่ด้านล่างให้ปุ่มลอย ไม่ทับเนื้อหาท้ายหน้า */
  /* ฟอร์ม/ตารางทั่วไป: ไม่ล้นจอ */
  .view .form-grid { grid-template-columns: 1fr !important; }
  .view input, .view select, .view textarea { max-width: 100%; }
  .view img { max-width: 100%; }
  .view .o3-scene img, .view .o3-wrap img, .view [class^="o3-"] img { max-width: none; }   /* v1793: ตัวละคร/ของตกแต่งในออฟฟิศ ห้ามบีบ (เดิมทำให้ตัวละครยืดเพี้ยน) */
}
@media (max-width: 380px) {
  #helpBtn, #stickerModeBtn, #stickyNoteBtn, #logoutBtn { padding: 5px 9px !important; font-size: 12px !important; }
}

/* v1791: ป้าย 🤖 อัตโนมัติ ในฟอร์มบรีฟ — ชิดซ้ายขนาดพอดีข้อความ (ไม่ยืดเต็มแถว) */
.bj-auto:not(:empty) { align-self: flex-start; display: inline-block; width: auto; }

/* v1791: ช่องเลือกเดือน/วันที่บนมือถือ ไม่ล้นการ์ด */
@media (max-width: 760px) {
  .view input[type="month"], .view input[type="date"] { min-width: 0; max-width: 100%; box-sizing: border-box; }
  .view label:has(> input[type="month"]), .view label:has(> input[type="date"]) { min-width: 0; max-width: 100%; flex-wrap: wrap; }
}

/* v1792: มือถือ — ปุ่ม วิธีใช้งาน/สติ๊กเกอร์/โน้ต/ออก เหลือเป็นไอคอนกลมเล็ก อยู่แถวเดียวกับชื่อหน้า (ไม่กินพื้นที่เพิ่ม) */
@media (max-width: 760px) {
  .topbar { flex-wrap: nowrap !important; align-items: center !important; }
  .topbar > div:first-child { flex: 1 1 auto !important; padding-left: 0 !important; min-height: 0; }
  .topbar-actions { display: none; }
  .topbar:has(.topbar-actions[style*="flex"]) { flex-wrap: wrap !important; }
  .topbar:has(.topbar-actions[style*="flex"]) .topbar-actions { display: flex; order: 9; }
  #helpBtn, #stickerModeBtn, #stickyNoteBtn, #logoutBtn { font-size: 0 !important; width: 36px !important; height: 36px; min-height: 36px; padding: 0 !important; border-radius: 50% !important; flex: 0 0 36px !important; display: inline-flex !important; align-items: center; justify-content: center; margin-left: 0 !important; }
  #helpBtn > *, #stickerModeBtn > *, #stickyNoteBtn > *, #logoutBtn > * { display: none !important; }
  #helpBtn::before { content: "❓"; font-size: 16px; }
  #stickerModeBtn::before { content: "❤️"; font-size: 16px; }
  #stickyNoteBtn::before { content: "📝"; font-size: 16px; }
  #logoutBtn::before { content: "🔒"; font-size: 16px; }
  #helpBtn::before, #stickerModeBtn::before, #stickyNoteBtn::before, #logoutBtn::before { position: static !important; inset: auto !important; width: auto !important; height: auto !important; background: none !important; opacity: 1 !important; line-height: 1 !important; transform: none !important; filter: none !important; -webkit-mask: none !important; mask: none !important; padding: 0 !important; border: 0 !important; }
}

/* v1794: มือถือ — ฟอร์มกรอกข้อมูล คลีน ใช้ง่าย (ระยะห่างเท่ากัน · ช่องสูง 44px · ตัวอักษร 16px กัน iPhone ซูมเอง) */
@media (max-width: 760px) {
  .view form { padding: 16px 14px !important; border-radius: 16px; box-sizing: border-box; min-width: 0; max-width: 100%; }
  .planner-layout, .bj-layout { grid-template-columns: minmax(0, 1fr) !important; }
  .planner-layout > *, .bj-layout > * { min-width: 0; max-width: 100%; }
  .view form[style*="grid"], #postForm, #briefJobForm { grid-template-columns: minmax(0, 1fr) !important; }
  #postForm > *, #briefJobForm > * { min-width: 0; max-width: 100%; box-sizing: border-box; }
  .view form .section-head { margin-bottom: 12px; }
  .view form .section-head h3 { font-size: 17px; }
  .view form .form-grid { gap: 12px !important; margin: 0 0 12px !important; }
  .view form .form-grid > label, .view form .form-grid > div { margin: 0 !important; }
  .view form > label { margin: 0 0 12px !important; }
  .view form label { gap: 6px !important; font-size: 13px !important; font-weight: 700; color: #334155; }
  .view form input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  .view form select, .view form textarea {
    font-size: 16px !important; min-height: 44px; padding: 10px 12px !important; border-radius: 12px !important;
    border: 1px solid #dbe1ea !important; background-color: #fff; box-sizing: border-box; width: 100%;
    transition: border-color .15s, box-shadow .15s;
  }
  .view form textarea { min-height: 96px; line-height: 1.5; }
  .view form input:focus, .view form select:focus, .view form textarea:focus { outline: none; border-color: #6366f1 !important; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
  .view form input::placeholder, .view form textarea::placeholder { color: #a3adbd; font-weight: 400; }
  /* ป้าย 🤖 อัตโนมัติ — เม็ดเล็กพอดีข้อความ ไม่ยืดเต็มแถว */
  .view form label:has(> .bj-auto) { position: relative; }
  .view form .bj-auto { position: absolute; top: 0; right: 0; width: max-content; display: inline-block !important; margin: 0 !important; line-height: 1.6; }
  .view form .bj-auto:empty { display: none !important; }
  /* ติ๊ก ออนไลน์ / หน้าร้าน — ชิปสีอ่อน กดง่าย ติ๊กแล้วเป็นสี */
  .view form .bj-scope-field > span:first-child small { display: block; font-weight: 400; margin-top: 2px; }
  .view form .qa-scope > small { display: none; }
  .view form .qa-scope { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; width: 100%; }
  .view form .qa-scope label { justify-content: center; min-height: 44px; border: 1.5px solid #dbe1ea !important; background: #fff !important; color: #334155 !important; border-radius: 12px !important; font-size: 14px !important; font-weight: 700; }
  .view form .qa-scope label:has(input:checked) { border-color: #6366f1 !important; background: #eef2ff !important; color: #4338ca !important; }
  /* กล่อง ชิ้นงานในบรีฟ — หัวข้ออยู่บน ปุ่มเรียงแถวล่าง ไม่บีบ */
  .view form .bj-items-head { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 8px; }
  .view form .bj-items-head > span:first-child { font-size: 13px; font-weight: 700; color: #334155; }
  .view form .bj-items-actions { display: grid !important; grid-template-columns: 1fr 96px 1fr; gap: 8px; align-items: stretch; width: 100%; }
  .view form .bj-items-actions > button { min-height: 44px; border-radius: 12px; white-space: nowrap; margin: 0; }
  .view form .bj-items-count { display: flex !important; align-items: center; gap: 4px !important; margin: 0 !important; font-size: 12px !important; white-space: nowrap; }
  .view form .bj-items-count input { min-width: 0; padding: 8px !important; text-align: center; }
  .view form #bjItems input, .view form #bjItems select { min-height: 40px; }
  /* หัวฟอร์มแผนโพสต์ — ไอคอน+ชื่อแถวบน คำอธิบายเต็มแถว ปุ่มตั้งค่าไม่โดนตัด */
  .view form .form-section-head { display: flex !important; flex-wrap: wrap; align-items: center; gap: 4px 8px !important; }
  .view form .form-section-head .form-section-sub { flex: 1 1 100%; order: 3; font-size: 12px; line-height: 1.45; white-space: normal !important; }
  .view form .form-section-head > button { margin-left: auto; flex: none; white-space: nowrap; }
  /* ชื่อแคมเปญ + ปุ่มเลือกจากแผน — ช่องกรอกได้พื้นที่หลัก ปุ่มเป็นไอคอนกะทัดรัด */
  .view form .campaign-input-row { display: flex !important; gap: 8px; }
  .view form .campaign-input-row > input { flex: 1 1 auto; min-width: 0; }
  .view form .campaign-input-row > .cb-pick-btn { flex: none; min-height: 44px; border-radius: 12px; padding: 0 12px; white-space: nowrap; font-size: 13px; }
  /* v1795: หัวหมวดในฟอร์มโพสต์ — บรรทัดเดียว ซ่อนคำอธิบายเล็ก ลูกศร ▾ ชิดขวา */
  #postForm .pf-sec-h { flex-wrap: nowrap !important; align-items: center; gap: 8px; }
  #postForm .pf-sec-h > span:first-child { font-size: 15px; font-weight: 800; white-space: nowrap; }
  #postForm .pf-sec-h > small { display: none !important; }
  #postForm .pf-sec-h.pf-tg::after { margin-left: auto; }
  #postForm .pf-sec-h .pf-sum { min-width: 0; flex: 0 1 auto; }
  /* ปุ่ม 📋 เลือกจากแผน เหลือแค่ไอคอน → ช่องชื่อแคมเปญกว้างขึ้น */
  .view form .campaign-input-row > .cb-pick-btn { font-size: 0 !important; width: 48px; padding: 0 !important; justify-content: center; }
  .view form .campaign-input-row > .cb-pick-btn::before { content: "📋"; font-size: 19px; }
  /* แถบหัว แผนโพสต์ — คำอธิบายสั้นลง อ่านง่าย */
  #postForm > .form-section-head .form-section-sub { display: none; }
  #postForm > .form-section-head #pqSettingsBtn { font-size: 12.5px; padding: 6px 10px; }
  /* ปุ่มบันทึก/ยกเลิกท้ายฟอร์ม — เต็มแถว กดง่าย */
  .view form .form-actions, .view form .bj-actions { display: flex !important; flex-direction: row !important; flex-wrap: wrap; gap: 8px; }
  .view form .form-actions > button, .view form .bj-actions > button { flex: 1 1 120px; height: auto; min-height: 46px; padding: 10px 14px; border-radius: 12px; font-size: 15px; justify-content: center; text-align: center; }
  .view form .form-actions > button[type="submit"] { flex-grow: 2; }
  /* แถวชิ้นงาน — ชื่อชิ้นงานเต็มแถว ประเภท/For Ads/ลบ อยู่แถวล่าง */
  .view form .bj-item-top { display: flex !important; flex-wrap: wrap; gap: 8px; align-items: center; }
  .view form .bj-item-top > .bj-item-title { flex: 1 1 100% !important; order: 0; }
  .view form .bj-item-top > .bj-item-kind { flex: 1 1 auto !important; width: auto !important; }
}

/* v1796: มุมมอง ตารางรายวัน (Excel) — วัน × แพลตฟอร์ม/คน */
.csh-wrap { margin-top: 8px; }
.csh-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 8px; }
.csh-seg { display: inline-flex; background: #eef2ff; border-radius: 12px; padding: 3px; gap: 2px; }
.csh-seg button { border: none; background: transparent; color: #475569; font: inherit; font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.csh-seg button.on { background: #4f46e5; color: #fff; box-shadow: 0 2px 8px rgba(79,70,229,.3); }
.csh-tg { display: inline-flex !important; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: #475569; cursor: pointer; }
.csh-tg input { width: auto !important; min-height: 0 !important; margin: 0; }
.csh-info { font-size: 12px; color: #94a3b8; margin-left: auto; }
.csh-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.csh-lg-h { font-size: 12px; font-weight: 700; color: #64748b; }
.csh-pp { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #e2e8f0; background: #fff; color: #334155; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.csh-pp i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.csh-pp span { color: #94a3b8; font-weight: 700; }
.csh-pp.on { border-color: var(--pc, #4f46e5); background: #eef2ff; color: #1e1b4b; box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc, #4f46e5) 25%, transparent); }
.csh-scroll { overflow: auto; max-height: 72vh; border: 1px solid #dfe3ec; border-radius: 12px; background: #fff; }
.csh-table { border-collapse: separate; border-spacing: 0; font-size: 12.5px; color: #1f2937; min-width: 100%; }
.csh-table th, .csh-table td { border-right: 1px solid #edf0f5; border-bottom: 1px solid #edf0f5; padding: 5px 6px; vertical-align: top; }
.csh-table thead th { position: sticky; top: 0; z-index: 2; background: #f1f4fb; color: #334155; font-weight: 800; text-align: left; white-space: nowrap; padding: 8px 10px; border-bottom: 2px solid #d9def0; min-width: 170px; }
.csh-table .csh-day { position: sticky; left: 0; z-index: 1; background: #fafbfe; min-width: 64px !important; width: 64px; white-space: nowrap; font-size: 12px; color: #475569; }
.csh-table thead .csh-day { z-index: 3; background: #e8ecf8; }
.csh-table .csh-day b { font-size: 14px; color: #1e293b; }
.csh-table .csh-sum { text-align: center; min-width: 52px !important; width: 52px; color: #4338ca; background: #fafbff; }
.csh-table .csh-sum span { color: #cbd5e1; }
.csh-table tbody tr:nth-child(even) td { background-color: #fcfcfe; }
.csh-table tbody tr.csh-we td { background-color: #f7f8fc; }
.csh-table tbody tr.csh-we .csh-day span { color: #e11d48; font-weight: 700; }
.csh-table tbody tr.csh-today td { background-color: #fffbeb; }
.csh-table tbody tr.csh-today .csh-day { box-shadow: inset 3px 0 0 #f59e0b; }
.csh-table tbody tr:hover td { background-color: #f5f7ff; }
.csh-n { display: inline-block; background: #e0e7ff; color: #4338ca; border-radius: 999px; padding: 0 7px; font-size: 11px; margin-left: 4px; }
.csh-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.csh-chip { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; border: 1px solid #e6e9f2; border-left: 4px solid var(--pc, #94a3b8); background: #fff; border-radius: 8px; padding: 4px 7px; margin: 0 0 4px; font: inherit; cursor: pointer; transition: box-shadow .12s, opacity .12s; }
.csh-chip:last-child { margin-bottom: 0; }
.csh-chip:hover { box-shadow: 0 3px 10px rgba(30,41,59,.12); }
.csh-chip.dim { opacity: .28; }
.csh-t { font-weight: 700; color: #1e293b; font-size: 12.5px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.csh-multi { display: inline-block; background: #fef3c7; color: #b45309; border-radius: 5px; padding: 0 5px; font-size: 10.5px; font-weight: 800; }
.csh-s { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.csh-s i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
@media (max-width: 760px) {
  .csh-info { margin-left: 0; flex: 1 1 100%; }
  .csh-scroll { max-height: 70vh; }
  .csh-table thead th { min-width: 140px; }
  .csh-table .csh-day { min-width: 48px !important; width: 48px; }
}

/* v1798: มือถือ — หน้าปฏิทิน จัดโซนให้เป็นระเบียบ: เลือกเดือน → ตัวกรอง → มุมมอง → รายงาน */
@media (max-width: 760px) {
  /* โซน 1: เดือน/ปี — ‹ [เดือน][ปี][วันนี้] › แถวเดียวไม่โดนตัด */
  #calendarView .calendar-nav { display: grid !important; grid-template-columns: 40px minmax(0, 1fr) 40px; gap: 6px; align-items: center; margin-bottom: 8px; }
  #calendarView .calendar-nav-center { display: grid !important; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) auto; gap: 6px; min-width: 0; }
  #calendarView .calendar-nav-center select { min-width: 0 !important; width: 100% !important; min-height: 40px; padding: 6px 8px !important; font-size: 14px; }
  #calPrev, #calNext { font-size: 0 !important; width: 40px; height: 40px; min-height: 40px; padding: 0 !important; border-radius: 12px !important; display: inline-flex !important; align-items: center; justify-content: center; }
  #calPrev::after { content: "‹"; font-size: 24px; line-height: 1; }
  #calNext::after { content: "›"; font-size: 24px; line-height: 1; }
  #calPrev::after, #calNext::after { position: static !important; inset: auto !important; width: auto !important; height: auto !important; background: none !important; border: 0 !important; opacity: 1 !important; transform: none !important; color: #334155 !important; font-weight: 700; }
  #calFilterBar > label:last-child:nth-child(odd) { grid-column: 1 / -1; }
  #calToday { min-height: 40px; padding: 0 10px !important; white-space: nowrap; border-radius: 12px !important; font-size: 13px; }
  /* โซน 2: คำอธิบายสี Funnel/Pillar — บรรทัดเดียว เลื่อนข้างได้ ตัวเล็ก */
  #calendarView .cal-legend-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
  #calendarView .funnel-legend, #calendarView .pillar-legend { display: flex !important; flex-wrap: nowrap !important; overflow-x: auto; gap: 4px !important; scrollbar-width: none; padding-bottom: 2px; }
  #calendarView .funnel-legend::-webkit-scrollbar, #calendarView .pillar-legend::-webkit-scrollbar { display: none; }
  #calendarView .funnel-legend > *, #calendarView .pillar-legend > * { flex: none; font-size: 11px !important; padding: 2px 8px !important; white-space: nowrap; }
  #calendarView .legend-label { font-size: 11px !important; min-width: 44px; }
  /* โซน 3–5: ตัวกรอง (2 คอลัมน์) → มุมมอง (3 ปุ่มเต็มแถว) → รายงาน/Export */
  #calendarView .cal-controls-row { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; grid-template-areas: "f f f" "v v v" "r w c"; gap: 8px !important; margin: 4px 0 10px !important; }
  #calFilterBar { grid-area: f; display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px !important; background: #f8fafc; border: 1px solid #e8ecf3; border-radius: 14px; padding: 10px; }
  #calFilterBar > label { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 3px !important; font-size: 11.5px !important; font-weight: 700; white-space: normal !important; min-width: 0; }
  #calFilterBar select, #calFilterBar .cal-select, #calFilterBar .cal-msel { width: 100% !important; min-width: 0 !important; min-height: 40px; box-sizing: border-box; font-size: 14px; }
  #calFilterBar .cal-msel-pop { max-width: calc(100vw - 40px); }
  #calViewTabs { grid-area: v; display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px !important; background: #eef2ff; border-radius: 14px; padding: 3px; }
  #calViewTabs .cal-viewtab { border: none !important; background: transparent; padding: 9px 4px !important; border-radius: 11px !important; font-size: 12.5px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #calViewTabs .cal-viewtab.active { background: #4f46e5; color: #fff; box-shadow: 0 3px 10px rgba(79,70,229,.3); }
  #calReportBtn { grid-area: r; margin: 0 !important; }
  #calWeekBtn { grid-area: w; }
  #calExportCsv { grid-area: c; }
  #calReportBtn, #calWeekBtn, #calExportCsv { min-height: 40px; padding: 6px 8px !important; font-size: 12px !important; border-radius: 12px !important; white-space: normal; line-height: 1.25; text-align: center; justify-content: center; }
  #calExportCsv { white-space: nowrap; }
  /* สถิติ + กล่องสินค้าเน้นขาย — ระยะกระชับ */
  #calTypeStats { margin-bottom: 10px; }
  #calTypeStats > * { margin-top: 0; }
}

/* v1799: มือถือ — หน้าปฏิทิน โซนบนกระชับ 3 แถว: [เดือน] · [🔍 ตัวกรอง 📊 🗓️ ⬇️] · [มุมมอง] — ตัวกรอง+คำอธิบายสี พับไว้ */
#calFiltToggle { display: none; }
@media (max-width: 760px) {
  #calendarView .calendar-nav { margin-bottom: 6px !important; }
  #calendarView .cal-controls-row { grid-template-columns: minmax(0, 1fr) 42px 42px 42px !important; grid-template-areas: "t r w c" "f f f f" "v v v v" !important; gap: 6px !important; margin: 0 0 8px !important; }
  #calFiltToggle { grid-area: t; display: inline-flex !important; align-items: center; justify-content: flex-start; gap: 6px; min-height: 42px; padding: 0 12px !important; border-radius: 12px !important; font-size: 13.5px !important; font-weight: 700; }
  #calFiltToggle.on { border-color: #a5b4fc !important; background: #eef2ff !important; color: #4338ca !important; }
  #calFiltToggle .cmf-n { background: #4f46e5; color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11.5px; line-height: 18px; }
  #calFiltToggle .cmf-ar { margin-left: auto; color: #94a3b8; }
  #calendarView:not(.cal-f-open) #calFilterBar { display: none !important; }
  #calendarView:not(.cal-f-open) .cal-legend-group { display: none !important; }
  #calendarView.cal-f-open .cal-legend-group { order: 0; margin: 0 0 6px !important; }
  /* ปุ่มรายงาน → ไอคอนสี่เหลี่ยม 42px */
  #calReportBtn, #calWeekBtn, #calExportCsv { font-size: 0 !important; width: 42px; height: 42px; min-height: 42px; padding: 0 !important; display: inline-flex !important; align-items: center; justify-content: center; }
  #calReportBtn::after, #calWeekBtn::after, #calExportCsv::after { font-size: 18px; position: static !important; inset: auto !important; width: auto !important; height: auto !important; background: none !important; border: 0 !important; opacity: 1 !important; transform: none !important; line-height: 1; }
  #calReportBtn::after { content: "📊"; }
  #calWeekBtn::after { content: "🗓️"; }
  #calExportCsv::after { content: "⬇️"; }
  #calViewTabs .cal-viewtab { padding: 8px 4px !important; }
  /* สถิติ + สินค้าเน้นขาย — แถวเดียวเล็ก */
  #calTypeStats { padding: 8px 10px !important; margin-bottom: 8px !important; }
  #calTypeStats .cal-stats-empty { font-size: 12px; }
  #calTypeStats .cal-feat { margin-top: 6px !important; padding: 6px 8px !important; font-size: 12px !important; flex-wrap: nowrap !important; }
  #calTypeStats .cal-feat > button { flex: none; font-size: 11.5px !important; padding: 4px 8px !important; min-height: 30px; white-space: nowrap; }
}
/* v1799b: มือถือ — ปฏิทินแบบรายการ: ซ่อนหัว อา–ส · วันที่ไม่มีงานเหลือแถบบาง */
@media (max-width: 760px) {
  #calendarView .calendar-weekdays { display: none !important; }
  #calendarGrid .calendar-day:not(:has(> :not(strong))) { min-height: 0 !important; height: auto !important; padding: 6px 12px !important; opacity: .75; }
}

/* v1801: กล่อง เทียบหัวข้อรายวันกับทีม ในฟอร์มแผนโพสต์ */
.pf-sheet { margin: 10px 0 14px; border: 1px solid #c7d2fe; border-radius: 14px; background: #f8f9ff; overflow: hidden; }
.pf-sheet > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; font-size: 13.5px; }
.pf-sheet > summary::-webkit-details-marker { display: none; }
.pf-sheet > summary::after { content: "▾"; margin-left: auto; color: #6366f1; transition: transform .15s; }
.pf-sheet[open] > summary::after { transform: rotate(180deg); }
.pf-sheet .pfs-t { font-weight: 800; color: #3730a3; }
.pf-sheet .pfs-sum { font-size: 12px; color: #64748b; }
.pf-sheet .pfs-sum b { color: #4338ca; }
.pf-sheet > .csh-wrap { margin: 0; padding: 0 10px 10px; }
.pf-sheet .csh-scroll { max-height: 380px; }
.csh-table tbody tr.csh-pick td { background-color: #eef2ff !important; }
.csh-table tbody tr.csh-pick .csh-day { box-shadow: inset 4px 0 0 #4f46e5; }
.csh-table tbody tr.csh-pick .csh-day b { color: #4338ca; }
@media (max-width: 760px) {
  .pf-sheet > summary { padding: 10px 12px; }
  .pf-sheet .pfs-sum { flex: 1 1 100%; order: 3; }
  .pf-sheet .csh-scroll { max-height: 60vh; }
}

/* v1804: กรอกหัวข้อลงตาราง (＋ ในช่อง) */
.csh-table td[data-col] { position: relative; }
.csh-add { display: block; width: 100%; margin-top: 3px; border: 1px dashed transparent; background: transparent; color: transparent; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 800; line-height: 1; padding: 4px 0; cursor: pointer; transition: all .12s; }
.csh-table td[data-col]:hover .csh-add, .csh-add:focus { border-color: #c7d2fe; color: #6366f1; background: #f5f7ff; }
@media (hover: none) { .csh-add { border-color: #e0e7ff; color: #a5b4fc; } }
.csh-qa { margin-top: 4px; background: #fff; border: 1.5px solid #6366f1; border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 5px; box-shadow: 0 6px 18px rgba(79,70,229,.18); min-width: 150px; }
.csh-qa input, .csh-qa select { width: 100% !important; min-width: 0; box-sizing: border-box; border: 1px solid #dbe1ea !important; border-radius: 8px !important; padding: 6px 8px !important; font: inherit; font-size: 13px !important; min-height: 34px !important; background: #fff; }
.csh-qa input.err { border-color: #ef4444 !important; box-shadow: 0 0 0 3px rgba(239,68,68,.15); }
.csh-qa-row { display: flex; gap: 5px; }
.csh-qa-row > * { flex: 1 1 0; min-width: 0; }
.csh-qa-who { font-size: 11px; color: #64748b; }
.csh-qa-ok, .csh-qa-x { border: none; border-radius: 8px; padding: 7px 6px; font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; }
.csh-qa-ok { background: #4f46e5; color: #fff; flex: 2 1 0; }
.csh-qa-x { background: #f1f5f9; color: #475569; }
@media (max-width: 760px) { .csh-qa input, .csh-qa select { font-size: 16px !important; } }
.csh-empty-note { font-size: 12.5px; color: #64748b; background: #fff; border: 1px dashed #c7d2fe; border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }

/* v1812: แท็บ 🧮 เทียบหัวข้อทีม (บนสุดของหน้าแผนโพสต์) — เต็มความกว้าง ซ่อนพรีวิวโพสต์ */
.planner-layout.plan-sheet-mode { grid-template-columns: minmax(0,1fr); }
.planner-layout.plan-sheet-mode > .post-preview-panel { display: none; }
#pfSheetBox.plan-panel { margin: 0 0 14px; background: #fffdf9; border-color: #fed7aa; }
#pfSheetBox .pfs-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; }
#pfSheetBox .pfs-t { color: #9a3412; }
#pfSheetBox .pfs-nav { display: inline-flex; align-items: center; gap: 6px; }
#pfSheetBox .pfs-nav button { border: 1px solid #fed7aa; background: #fff; color: #c2410c; border-radius: 8px; min-width: 30px; height: 30px; font: inherit; font-weight: 800; cursor: pointer; }
#pfSheetBox .pfs-nav button:hover { background: #fff7ed; }
#pfSheetBox .pfs-nav .pfs-today { font-size: 12px; padding: 0 10px; }
#pfSheetBox .pfs-nav b { min-width: 120px; text-align: center; font-size: 14px; color: #1e293b; }
#pfSheetBox .pfs-sum { margin-left: auto; }
#pfSheetBox .csh-scroll { max-height: 70vh; }
#pfSheetBox .csh-info { display: none; }
@media (max-width: 640px) {
  #pfSheetBox .pfs-head { padding: 10px; gap: 8px; }
  #pfSheetBox .pfs-nav { flex: 1 1 100%; justify-content: space-between; }
  #pfSheetBox .pfs-nav b { flex: 1; min-width: 0; }
  #pfSheetBox .pfs-sum { flex: 1 1 100%; margin-left: 0; }
  #planTabbar.plan-tabbar { gap: 6px; flex-wrap: nowrap; }
  #planTabbar.plan-tabbar .plan-tab { flex: 1 1 0; min-width: 0; padding: 9px 4px; gap: 4px; }
  #planTabbar.plan-tabbar .plan-tab .plan-tab-t { white-space: normal; text-align: center; }
  #planTabbar .plan-tab .plan-tab-t { font-size: .82rem; }
}

/* v1814: มือถือ — ตารางเทียบหัวข้อเป็นรายการรายวันกะทัดรัด + หัวแท็บบางลง */
.csm-bar { margin-bottom: 6px; gap: 8px; }
.csm-info { margin-left: auto; font-size: 12px; color: #64748b; font-weight: 700; }
.csm-legend { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-bottom: 6px; scrollbar-width: none; }
.csm-legend::-webkit-scrollbar { display: none; }
.csm-legend .csh-pp { flex: none; padding: 3px 9px; }
.csm-days { border: 1px solid #e5e7ef; border-radius: 12px; background: #fff; overflow: auto; max-height: 68vh; }
.csm-row { display: flex; gap: 8px; padding: 7px 8px; border-bottom: 1px solid #f0f2f7; }
.csm-row:last-child { border-bottom: none; }
.csm-row.csm-we { background: #fafbfd; }
.csm-row.csm-today { background: #fffbeb; box-shadow: inset 3px 0 0 #f59e0b; }
.csm-row.csm-pick { background: #eef2ff; box-shadow: inset 3px 0 0 #4f46e5; }
.csm-d { flex: none; width: 34px; display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding-top: 2px; }
.csm-d b { font-size: 16px; color: #1e293b; }
.csm-d span { font-size: 11px; color: #64748b; }
.csm-we .csm-d span { color: #e11d48; font-weight: 700; }
.csm-list { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.csm-it { display: block; width: 100%; text-align: left; border: 1px solid #eceef4; border-left: 3px solid var(--pc, #94a3b8); background: #fff; border-radius: 8px; padding: 5px 8px; font: inherit; cursor: pointer; }
.csm-it.dim { opacity: .3; }
.csm-t { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #1e293b; line-height: 1.3; overflow: hidden; }
.csm-t i { flex: none; width: 7px; height: 7px; border-radius: 50%; }
.csm-m { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 11px; color: #64748b; overflow: hidden; white-space: nowrap; }
.csm-m em { font-style: normal; font-weight: 800; font-size: 10px; background: #eef2ff; color: #4338ca; border-radius: 4px; padding: 0 4px; }
.csm-m u { text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.csm-add { align-self: flex-start; border: 1px dashed #c7d2fe; background: transparent; color: #6366f1; border-radius: 7px; padding: 2px 9px; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.csm-list .csh-qa { min-width: 0; }
@media (max-width: 640px) {
  #pfSheetBox.plan-panel { padding: 0 !important; border-radius: 12px; }
  #pfSheetBox .pfs-head { padding: 8px 8px 4px; gap: 6px; }
  #pfSheetBox .pfs-t, #pfSheetBox .pfs-sum { display: none; }
  #pfSheetBox .pfs-nav { gap: 4px; }
  #pfSheetBox .pfs-nav button { height: 30px; }
  #pfSheetBox .pfs-nav b { font-size: 13.5px; }
  #pfSheetBox > .csh-wrap { padding: 0 8px 8px; margin: 0; }
  #planTabbar.plan-tabbar { margin: 2px 0 10px; }
  #planTabbar.plan-tabbar .plan-tab { padding: 7px 4px; border-width: 1.5px; }
  #planTabbar.plan-tabbar .plan-tab .plan-tab-t { font-size: .78rem; }
  #postForm .form-section-head .form-section-sub { display: none; }
}
