/* ============================================================
   MAGIC English — Team Hub · Redesigned Stylesheet v2
   Design: MAGIC Black/Yellow system · Linear.app aesthetic
   Font: Plus Jakarta Sans (già được nạp qua Google Fonts)
   Dark mode: thêm data-theme="dark" vào <html>
   ============================================================ */

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  /* Brand */
  --brand:        #FFD400;
  --brand-d:      #E6BF00;
  --brand-tint:   rgba(255,212,0,0.10);
  --brand-ink:    #0A0A0A;
  --plum:         #532654;
  --magic-black:  #0A0A0A;
  --magic-yellow: #FFD400;

  /* Semantic */
  --ok:    #1E9E5A;
  --warn:  #E8A400;
  --bad:   #E0382B;
  --info:  #1A73E8;
  --ok-soft:   rgba(30,158,90,0.12);
  --warn-soft: rgba(232,164,0,0.14);
  --bad-soft:  rgba(224,56,43,0.10);
  --info-soft: rgba(26,115,232,0.10);

  /* Semantic aliases used in design files */
  --success:      var(--ok);
  --success-soft: var(--ok-soft);
  --warning:      var(--warn);
  --warning-soft: var(--warn-soft);
  --danger:       var(--bad);
  --danger-soft:  var(--bad-soft);

  /* Surfaces (Light mode) */
  --bg:       #E8E7E4;
  --surface:  #FFFFFF;
  --surface-2:#F4F3F0;
  --line:     rgba(0,0,0,0.08);
  --line-2:   rgba(0,0,0,0.13);

  /* Surface aliases */
  --app-bg:        var(--bg);
  --card-bg:       var(--surface);
  --card-border:   rgba(0,0,0,0.09);
  --card-shadow:   0 1px 3px rgba(0,0,0,0.10), 0 4px 16px rgba(0,0,0,0.08);
  --card-shadow-hover: 0 4px 18px rgba(0,0,0,0.14), 0 12px 32px rgba(0,0,0,0.10);
  --bg-subtle:     var(--surface-2);
  --border:        var(--line);
  --border-strong: var(--line-2);

  /* Text (Light mode) */
  --text:   #0A0A0A;
  --muted:  #6B6B6B;
  --muted-2:#909090;

  /* Text aliases */
  --fg1: var(--text);
  --fg2: var(--muted);
  --fg3: var(--muted-2);
  --fg-on-yellow: var(--brand-ink);
  --fg-on-dark:   #FFFFFF;

  /* Accent aliases */
  --accent:       var(--brand);
  --accent-hover: #FFDC33;
  --accent-press: #E0BB00;
  --accent-soft:  var(--brand-tint);
  --link:         #806A00;
  --accent-text:  #806A00;
  --focus-ring:   #1A73E8;

  /* Typography */
  --font-brand: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body:  'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Kanban */
  --kanban-col-bg:       rgba(0,0,0,0.028);
  --kanban-card-bg:      #FFFFFF;
  --kanban-card-border:  rgba(0,0,0,0.07);

  /* Sidebar (always dark) */
  --sb-bg:            #0A0A0A;
  --sb-border:        rgba(255,255,255,0.07);
  --sb-w:             220px;
  --sidebar-w:        220px;
  --sidebar-bg:       #0A0A0A;
  --sidebar-border:   rgba(255,255,255,0.07);
  --nav-item-h:       36px;
  --nav-text:         rgba(255,255,255,0.52);
  --nav-text-hover:   rgba(255,255,255,0.90);
  --nav-hover-bg:     rgba(255,255,255,0.05);
  --nav-active-bg:    rgba(255,212,0,0.11);
  --nav-active-text:  #FFD400;
  --nav-active-left:  #FFD400;
  --nav-badge-bg:     #FFD400;
  --nav-badge-text:   #0A0A0A;
  --nav-section-label:rgba(255,255,255,0.24);

  /* Topbar */
  --topbar-bg:     rgba(232,231,228,0.90);
  --topbar-border: rgba(0,0,0,0.07);
  --topbar-h:      56px;

  /* Status palette */
  --s-backlog:    #9CA3AF;
  --s-todo:       #6B7280;
  --s-inprogress: #1A73E8;
  --s-review:     #E8A400;
  --s-done:       #1E9E5A;
  --s-blocked:    #E0382B;

  /* Priority */
  --p-low:    #9CA3AF;
  --p-medium: #E8A400;
  --p-high:   #E0382B;
  --p-urgent: #991B1B;

  /* Campaign accents */
  --c-ielts:   #1A73E8;
  --c-det:     #E8A400;
  --c-pte:     #7C3AED;
  --c-b2s:     #1E9E5A;
  --c-social:  #E0382B;
  --c-academy: #0891B2;

  /* Radii */
  --r-xs:   6px;
  --r-sm:   10px;
  --r-md:   14px;
  --r:      14px;
  --r-lg:   20px;
  --r-xl:   28px;
  --r-pill: 999px;

  /* Shadows */
  --shadow:       var(--card-shadow);
  --shadow-sm:    0 2px 6px rgba(0,0,0,0.07);
  --shadow-md:    0 8px 22px rgba(0,0,0,0.09);
  --shadow-lg:    0 18px 44px rgba(0,0,0,0.12);
  --shadow-y:     0 10px 28px rgba(255,212,0,0.42);
  --shadow-yellow:0 10px 28px rgba(255,212,0,0.42);
  --shadow-hover: var(--card-shadow-hover);

  /* Motion */
  --ease:     cubic-bezier(0.16,1,0.3,1);
  --ease-out: cubic-bezier(.22,.61,.36,1);
  --ease-in-out: cubic-bezier(.65,0,.35,1);
  --ease-bounce: cubic-bezier(.34,1.56,.64,1);
  --dur:      200ms;
  --dur-fast: 120ms;
  --dur-slow: 360ms;
}

/* ── Dark Mode ───────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:       #0E0E0E;
  --surface:  #1A1A1A;
  --surface-2:#212121;
  --line:     rgba(255,255,255,0.10);
  --line-2:   rgba(255,255,255,0.18);
  --text:     #F2F2F0;
  --muted:    rgba(242,242,240,0.62);
  --muted-2:  rgba(242,242,240,0.38);
  --topbar-bg:    rgba(14,14,14,0.92);
  --topbar-border:rgba(255,255,255,0.08);
  --card-shadow:       0 1px 2px rgba(0,0,0,0.50), 0 4px 14px rgba(0,0,0,0.35);
  --card-shadow-hover: 0 4px 18px rgba(0,0,0,0.65), 0 12px 32px rgba(0,0,0,0.50);
  --shadow:    0 1px 2px rgba(0,0,0,0.40), 0 4px 12px rgba(0,0,0,0.30);
  --shadow-lg: 0 16px 44px rgba(0,0,0,0.60);
  --shadow-hover: 0 6px 20px rgba(0,0,0,0.55), 0 12px 30px rgba(0,0,0,0.45);
  --ok-soft:   rgba(30,158,90,0.20);
  --warn-soft: rgba(232,164,0,0.20);
  --bad-soft:  rgba(224,56,43,0.18);
  --info-soft: rgba(26,115,232,0.18);
  --brand-tint:rgba(255,212,0,0.14);
  --accent-soft: rgba(255,212,0,0.16);
  --app-bg:            #0E0E0E;
  --card-bg:           #1A1A1A;
  --card-border:       rgba(255,255,255,0.09);
  --bg-subtle:         #212121;
  --link:              #FFD400;
  --accent-text:       #FFD400;
  --plum:              #D97706;
  --kanban-col-bg:     rgba(255,255,255,0.04);
  --kanban-card-bg:    #1F1F1F;
  --kanban-card-border:rgba(255,255,255,0.09);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur), color var(--dur);
}
button { font-family: inherit; }
h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: -0.015em; }
code {
  background: var(--brand-tint); padding: 2px 6px;
  border-radius: var(--r-xs); font-size: .85em;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
::selection { background: var(--brand-tint); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 8px 16px; font-weight: 600; font-size: 13.5px;
  cursor: pointer; font-family: inherit;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur), filter var(--dur);
  background: var(--surface-2); color: var(--text);
  border-color: var(--line-2);
}
.btn:hover { filter: brightness(0.96); }
.btn:active { transform: scale(0.96); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.btn.full { width: 100%; }

.btn.primary {
  background: var(--brand); color: var(--brand-ink);
  border-color: var(--brand); font-weight: 700;
  box-shadow: var(--shadow-y);
}
.btn.primary:hover { background: var(--brand-d); filter: none; box-shadow: 0 10px 28px rgba(255,212,0,0.40); transform: translateY(-1px); }
.btn.primary:active { transform: scale(0.96) translateY(0); }

.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); filter: none; }

.btn.danger, .btn.ghost.danger { color: var(--bad); border-color: rgba(220,38,38,0.25); }
.btn.danger:not(.ghost) { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost.danger:hover { background: var(--bad-soft); filter: none; }

.btn.google {
  background: var(--surface); border: 1px solid var(--line-2);
  color: var(--text); font-weight: 600;
}
.btn.google:hover { background: var(--surface-2); filter: none; }

.btn.brief-btn {
  background: var(--brand-tint); border-color: rgba(255,212,0,0.30);
  color: var(--plum); font-weight: 700;
}
.btn.brief-btn:hover { background: rgba(255,212,0,0.18); filter: none; }

.btn[disabled] { opacity: 0.42; cursor: not-allowed; pointer-events: none; }

@keyframes pulseGlow {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,212,0,0.5); }
  50%      { box-shadow: 0 0 0 7px rgba(255,212,0,0); }
}
.btn.pulse { animation: pulseGlow 1.5s infinite; }

/* ── Inputs ──────────────────────────────────────────────────── */
.input {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md); font-size: 13.5px;
  font-family: inherit; background: var(--bg-subtle);
  color: var(--fg1); transition: border-color var(--dur), box-shadow var(--dur);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.sm { padding: 5px 9px; font-size: 13px; }
.input.color { padding: 3px; height: 36px; cursor: pointer; }
select.input { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
textarea.input { resize: vertical; min-height: 72px; }
.input.readonly { background: var(--surface-2); color: var(--muted); cursor: not-allowed; font-family: ui-monospace, monospace; font-size: 12.5px; }

/* ── Avatar / Chip ───────────────────────────────────────────── */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-weight: 700;
  overflow: hidden; flex: none; object-fit: cover; font-family: inherit;
}
.avatar.none { background: var(--line-2); }
.chip {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: var(--r-pill); font-size: 11px; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 25%, transparent);
}

/* ── SHELL ───────────────────────────────────────────────────── */
.shell { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar — always dark */
.sidebar {
  width: var(--sb-w); flex: none;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex; flex-direction: column;
  padding: 0;
  position: relative; overflow: hidden;
}
/* Star-pattern texture */
.sidebar::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,212,0,0.22) 1px, transparent 1px),
                    radial-gradient(circle, rgba(255,212,0,0.10) 1px, transparent 1px);
  background-size: 28px 28px, 16px 16px;
  background-position: 0 0, 12px 14px;
  opacity: 0.28;
}

/* Brand / logo area */
.brand {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px 12px; position: relative; z-index: 1;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.brand-logo {
  width: 182px; height: 95px;
  background: url(../assets/logo-cropped.png) no-repeat;
  background-size: contain;
  background-position: 0 50%;
}
/* HUB badge */
.brand::after {
  content: 'HUB';
  font-size: 8px; font-weight: 800; letter-spacing: 0.12em;
  color: rgba(255,212,0,0.80);
  background: rgba(255,212,0,0.10);
  border: 1px solid rgba(255,212,0,0.20);
  padding: 2px 5px; border-radius: var(--r-pill);
  margin-left: auto; flex-shrink: 0;
}
/* Fallback: old brand inner children */
.brand .logo { color: var(--accent-text); font-size: 20px; }
.brand-svg { display: none; }
.wordmark { font-size: 0; }

/* Nav */
.nav {
  display: flex; flex-direction: column; gap: 1px;
  flex: 1; padding: 8px 8px; overflow-y: auto;
  scrollbar-width: none; position: relative; z-index: 1;
}
.nav::-webkit-scrollbar { display: none; }

/* Section labels */
.nav-section {
  font-size: 9px; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: rgba(255,255,255,0.24);
  padding: 12px 8px 5px; user-select: none;
}

.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; text-align: left;
  padding: 0 10px 0 12px; height: 36px;
  border: none; background: transparent;
  border-radius: var(--r-sm); border-left: 2px solid transparent;
  font-size: 13.5px; font-weight: 500; color: var(--nav-text);
  cursor: pointer; transition: background var(--dur), color var(--dur), border-color var(--dur);
  position: relative; margin-left: -2px; white-space: nowrap;
}
.nav-item:hover {
  background: var(--nav-hover-bg);
  color: var(--nav-text-hover);
}
.nav-item.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  border-left-color: var(--nav-active-left);
  font-weight: 600;
}
.ni-icon {
  font-size: 14px; flex-shrink: 0;
  width: 18px; text-align: center;
  opacity: 0.7;
}
.nav-item.active .ni-icon { opacity: 1; }

.nav-badge {
  margin-left: auto; background: var(--nav-badge-bg); color: var(--nav-badge-text);
  font-size: 10px; font-weight: 800;
  min-width: 18px; height: 18px;
  border-radius: var(--r-pill);
  display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
}
.nav-badge[hidden] { display: none; }

.side-foot {
  border-top: 1px solid var(--sb-border);
  padding: 10px 12px;
  display: flex; align-items: center; gap: 9px;
  position: relative; z-index: 1; flex-shrink: 0;
  cursor: pointer; transition: background var(--dur);
}
.side-foot:hover { background: rgba(255,255,255,0.04); }
.me { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.me-info { flex: 1; overflow: hidden; }
.me-name {
  font-weight: 600; font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: rgba(255,255,255,0.85);
}
.me-role {
  font-size: 11px; color: rgba(255,255,255,0.35);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Main area ───────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: var(--topbar-h); flex: none;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--topbar-border);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 {
  font-size: 17px; font-weight: 700; letter-spacing: -0.01em;
  margin: 0; line-height: 1.2;
}
.topbar-sub {
  font-size: 11.5px; color: var(--fg3);
  margin-top: 1px; font-weight: 400;
}
.topbar-right { display: flex; align-items: center; gap: 6px; }

.view {
  flex: 1; overflow-y: auto; padding: 22px 24px;
}
.view > * {
  animation: fadeUp 260ms var(--ease-out) both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Filterbar ───────────────────────────────────────────────── */
.filterbar {
  display: flex; gap: 8px; flex-wrap: wrap;
  align-items: center; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 10px 12px;
}
.filterbar .input { width: auto; min-width: 140px; background: var(--bg-subtle); border-color: var(--line); }
.filterbar .input:focus { background: var(--surface); }
.filterbar #f-search { min-width: 200px; flex: 1; max-width: 320px; background: var(--bg-subtle); }

/* ── Kanban Board ────────────────────────────────────────────── */
.board {
  display: flex; gap: 10px;
  align-items: flex-start;
  overflow-x: auto; padding-bottom: 12px;
}
.board.wide .col { flex: 0 0 210px; }

.col {
  flex: 0 0 220px;
  background: var(--kanban-col-bg);
  border-radius: var(--r-md);
  border-top: 3px solid transparent;
  padding: 10px 8px;
  min-height: 100px;
  transition: background var(--dur);
}
.col.drop { background: var(--brand-tint); border-top-color: var(--brand) !important; }

.col-head {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 12.5px; color: var(--fg1);
  padding: 0 4px 9px;
}
.col-head .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.col-head .count {
  margin-left: auto;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r-pill);
  padding: 1px 7px; font-size: 10.5px; font-weight: 700; color: var(--fg3);
}
.col-body { display: flex; flex-direction: column; gap: 5px; min-height: 24px; }

/* Kanban Card */
.card {
  background: var(--kanban-card-bg);
  border: 1px solid var(--kanban-card-border);
  border-left: 3px solid var(--line-2);
  border-radius: var(--r-sm); padding: 9px 10px 8px 9px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.05);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  position: relative;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.08);
}
.card.dragging { opacity: 0.45; transform: rotate(1.5deg) scale(0.97); }

.sortable-ghost {
  opacity: 0.35; background: var(--brand-tint) !important;
  border: 1.5px dashed var(--brand) !important;
  transform: scale(0.95);
}

.card-top {
  display: flex; align-items: center; gap: 5px;
  margin-bottom: 6px; flex-wrap: wrap;
}
.prio {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  padding: 2px 6px; border-radius: var(--r-xs);
}
.camp {
  font-size: 11px; font-weight: 600; color: var(--c);
  max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.camp::before { content: "●"; margin-right: 4px; font-size: 8px; }

.card-title {
  font-weight: 600; font-size: 13px; margin-bottom: 7px;
  line-height: 1.35; color: var(--text);
}
.card-chips { display: flex; gap: 3px; flex-wrap: wrap; margin-bottom: 8px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; }
.foot-right { display: flex; align-items: center; gap: 5px; }

.card-date { font-size: 11px; color: var(--muted); margin-bottom: 7px; font-weight: 500; }

.due {
  font-size: 10.5px; font-weight: 700; padding: 2px 7px;
  border-radius: var(--r-pill);
}
.due-ok   { background: var(--surface-2); color: var(--muted); }
.due-soon { background: #fef3c7; color: #a16207; }
.due-over { background: var(--bad-soft); color: var(--bad); }
.due-done { background: var(--ok-soft); color: var(--ok); }

.hrs  { font-size: 10.5px; color: var(--muted); background: var(--surface-2); padding: 2px 6px; border-radius: var(--r-xs); }
.code { font-size: 10px; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: var(--r-xs); font-family: ui-monospace,monospace; }
.needs { font-size: 13px; letter-spacing: 1px; }
.who-names { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.mini-progress { height: 4px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; margin-bottom: 8px; }
.mp-fill { height: 100%; background: var(--ok); border-radius: var(--r-pill); }

/* ── Dashboard ───────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 16px;
}
.stats.sub { margin-bottom: 0; }

.stat {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--r-lg); padding: 18px 20px;
  box-shadow: var(--card-shadow);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.stat.sm { padding: 13px 16px; }
.stat-n {
  font-size: 30px; font-weight: 800; line-height: 1;
  letter-spacing: -0.025em; color: var(--fg1);
  font-family: var(--font-brand);
}
.stat.sm .stat-n { font-size: 22px; }
.stat-l {
  color: var(--fg3); font-size: 10.5px; margin-top: 5px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.065em;
}
.stat.ok .stat-n { color: var(--ok); }
.stat.bad { background: var(--bad-soft); border-color: rgba(224,56,43,0.18); }
.stat.bad .stat-n { color: var(--bad); }

.panel {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--r-lg); padding: 16px 18px;
  margin-bottom: 14px; box-shadow: var(--card-shadow);
}
.panel h3 { font-size: 14.5px; margin-bottom: 12px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; }
.danger-panel { border-color: rgba(220,38,38,0.22); background: var(--bad-soft); }
.note-box { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; margin-bottom: 14px; line-height: 1.45; }
[data-theme="dark"] .note-box { background: rgba(251,191,36,0.10); border-color: rgba(251,191,36,0.25); color: #fbbf24; }

/* ── Bar Chart rows ──────────────────────────────────────────── */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 38px; align-items: center; gap: 10px; }
.bar-label { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--r-pill); transition: width 500ms var(--ease); }
.bar-val { font-size: 12.5px; font-weight: 700; text-align: right; }

/* ── Table / ptable ──────────────────────────────────────────── */
.ptable { display: flex; flex-direction: column; }
.ptable-head, .ptable-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.4fr .8fr;
  align-items: center; gap: 8px; padding: 9px 8px;
}
.ptable-head {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 700; border-bottom: 1px solid var(--line);
}
.ptable-row { border-bottom: 1px solid var(--line); font-size: 13px; }
.ptable-row.muted { color: var(--muted); }
.ptable-row.clickable { cursor: pointer; border-radius: var(--r-sm); }
.ptable-row.clickable:hover { background: var(--surface-2); }
.pcell-name { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.tag-mgr { background: var(--brand-tint); color: var(--plum); font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: var(--r-xs); }
.txt-bad { color: var(--bad); font-weight: 700; }
.txt-ok  { color: var(--ok);  font-weight: 700; }

/* ── Mini list ───────────────────────────────────────────────── */
.mini-list { display: flex; flex-direction: column; gap: 1px; }
.mini-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; gap: 10px;
}
.mini-item:hover { background: var(--bad-soft); }
.mini-title { font-weight: 600; font-size: 13px; }
.mini-meta { font-size: 12px; color: var(--bad); white-space: nowrap; font-weight: 600; }

/* ── Page head ───────────────────────────────────────────────── */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 10px; flex-wrap: wrap;
}
.page-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.page-head .hint { font-size: 12.5px; color: var(--fg3); margin-top: 2px; }
.head-actions { display: flex; gap: 8px; }

/* ── Campaign cards ──────────────────────────────────────────── */
.camp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

.camp-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-top: 3px solid var(--c, #9CA3AF);
  border-radius: var(--r-lg); padding: 16px 18px;
  box-shadow: var(--card-shadow);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.camp-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }

.camp-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.camp-name { font-weight: 700; font-size: 15px; cursor: pointer; }
.camp-name:hover { color: var(--accent-text); }
.camp-status { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: var(--r-pill); white-space: nowrap; flex: none; }
.s-active { background: var(--ok-soft); color: var(--ok); }
.s-done   { background: var(--surface-2); color: var(--muted); }
.s-paused { background: var(--warn-soft); color: var(--warn); }

.camp-desc  { color: var(--muted); font-size: 13px; margin: 0 0 10px; line-height: 1.45; }
.camp-dates { font-size: 12px; color: var(--muted-2); margin-bottom: 10px; }
.camp-progress { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.camp-progress .bar-track { flex: 1; }
.camp-progress span { font-size: 12px; color: var(--muted); white-space: nowrap; font-weight: 600; }
.camp-actions { display: flex; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }

/* ── Members ─────────────────────────────────────────────────── */
.member-list { display: flex; flex-direction: column; gap: 7px; }
.member-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--r-md); padding: 13px 18px;
  box-shadow: var(--card-shadow);
  transition: background var(--dur), box-shadow var(--dur);
}
.member-row:hover { background: var(--bg-subtle); box-shadow: var(--card-shadow-hover); }
.member-info { flex: 1; overflow: hidden; }
.member-name { font-weight: 600; font-size: 14px; }
.member-email { font-size: 12px; color: var(--muted); }
.member-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.member-role { width: 130px; display: flex; justify-content: flex-end; }
.role-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--r-pill); }
.role-badge.manager { background: var(--brand-tint); color: var(--plum); }
.role-badge.member  { background: var(--surface-2); color: var(--muted); }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.44); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 500px; max-height: 92vh;
  display: flex; flex-direction: column;
  animation: modalIn 200ms var(--ease-out) both;
}
.modal-lg { max-width: 640px; }
.modal-sm { max-width: 380px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 22px 18px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.x {
  border: none; background: transparent; cursor: pointer;
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 16px; transition: background var(--dur);
}
.x:hover { background: var(--surface-2); }

/* ── Form ────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 13px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.form .row { display: flex; gap: 10px; }
.form .row label { flex: 1; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 7px; }
.checks { display: flex; gap: 12px; flex-wrap: wrap; }
.check { flex-direction: row !important; align-items: center; gap: 6px !important; font-weight: 500 !important; color: var(--text) !important; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }
.check span { position: relative; padding-left: 13px; }
.check span::before { content: "●"; position: absolute; left: 0; color: var(--c); }
.req { font-size: 10px; font-weight: 700; color: var(--bad); background: var(--bad-soft); padding: 1px 5px; border-radius: var(--r-xs); margin-left: 4px; }
.hint-inline { font-size: 10px; color: var(--muted-2); font-weight: 500; margin-left: 4px; }
.auto-tag { font-size: 10px; font-weight: 700; color: var(--plum); background: var(--brand-tint); padding: 1px 6px; border-radius: var(--r-xs); margin-left: 5px; }
.prio-box { display: flex; align-items: center; min-height: 36px; }

/* ── Task Detail ─────────────────────────────────────────────── */
.detail-badges { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.status-pill {
  font-size: 12px; font-weight: 700;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent);
  padding: 3px 10px; border-radius: var(--r-pill);
}
.detail-title { font-size: 20px; margin-bottom: 10px; line-height: 1.3; }
.detail-desc { color: var(--text); margin: 0 0 16px; white-space: pre-wrap; font-size: 14px; line-height: 1.6; }
.detail-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  background: var(--bg-subtle); border-radius: var(--r-md);
  padding: 14px; margin-bottom: 14px; border: 1px solid var(--border);
}
.dm-label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-2); margin-bottom: 4px; font-weight: 700; }
.dm-who { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.detail-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.inline { display: flex !important; flex-direction: row !important; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); font-weight: 600; }
.inline .input { width: auto; }
.links-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.link-btn { font-size: 13px; font-weight: 600; color: #1565a8; background: var(--info-soft); padding: 6px 12px; border-radius: var(--r-sm); text-decoration: none; transition: background var(--dur); }
.link-btn:hover { background: rgba(29,110,181,0.18); }
.link-btn.disabled { opacity: .55; cursor: not-allowed; background: var(--surface-2); color: var(--muted); }

/* ── Comments ────────────────────────────────────────────────── */
.comments h4 { font-size: 14px; margin-bottom: 10px; }
.comment-list { display: flex; flex-direction: column; gap: 12px; max-height: 260px; overflow-y: auto; margin-bottom: 12px; }
.comment { display: flex; gap: 9px; }
.comment-body { flex: 1; }
.comment-head { display: flex; gap: 7px; align-items: baseline; margin-bottom: 2px; }
.comment-head b { font-size: 13px; }
.comment-head span { font-size: 11px; color: var(--muted-2); }
.comment-form { display: flex; gap: 7px; }
.comment-form .input { flex: 1; }

/* ── History ─────────────────────────────────────────────────── */
.history { margin-top: 12px; }
.history-box summary { cursor: pointer; font-weight: 600; color: var(--muted); font-size: 13px; padding: 5px 0; }
.history-box[open] summary { color: var(--text); }
.hist-list { display: flex; flex-direction: column; gap: 5px; padding: 5px 0 0; }
.hist-item { display: flex; gap: 7px; align-items: baseline; font-size: 12px; flex-wrap: wrap; }
.hist-when { color: var(--muted-2); white-space: nowrap; font-size: 11px; }
.hist-who { font-weight: 700; }
.hist-sum { color: var(--muted); }

/* ── Brief preview ───────────────────────────────────────────── */
.brief-preview { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px; margin: 12px 0; }
.video-brief-preview { border-color: color-mix(in srgb, #8b5cf6 35%, var(--line)); }
.bp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.bp-head h3 { margin: 0; font-size: 14.5px; }
.bp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 16px; font-size: 13px; }
.bp-grid > div { overflow-wrap: anywhere; }
.brief-status { font-size: 12px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); border: 1px solid color-mix(in srgb, var(--c) 25%, transparent); padding: 2px 9px; border-radius: var(--r-pill); white-space: nowrap; }
.bp-actions { display: flex; align-items: center; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.bp-hint { font-size: 12px; color: var(--muted-2); }
.brief-ok { background: var(--ok-soft); border: 1px solid rgba(22,163,74,0.25); color: var(--ok); padding: 10px 12px; border-radius: var(--r-sm); font-weight: 600; margin-top: 10px; }
.brief-ok a { color: var(--ok); font-weight: 700; }
.design-hint { background: #fdf2f8; border: 1px solid #fbcfe8; color: #9d174d; border-radius: var(--r-sm); padding: 9px 12px; font-size: 13px; margin-top: 10px; line-height: 1.45; }
[data-theme="dark"] .design-hint { background: rgba(236,72,153,0.10); border-color: rgba(236,72,153,0.25); color: #f9a8d4; }
.mode-seg { display: flex; gap: 7px; flex-wrap: wrap; }
.mode-opt { padding: 7px 16px; border: 1.5px solid var(--line-2); background: var(--surface); border-radius: var(--r-sm); font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; transition: all var(--dur); }
.mode-opt.on { border-color: var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 14%, transparent); color: var(--text); }
.brief-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.brief-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.brief-grid label.full { grid-column: 1 / -1; }

/* ── Login ───────────────────────────────────────────────────── */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.login-card {
  background: var(--card-bg); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 44px 40px;
  width: 100%; max-width: 400px; text-align: center;
  border: 1px solid var(--card-border);
}
.login-logo { display: flex; justify-content: center; margin-bottom: 10px; }
.login-logo img { width: 100%; max-width: 200px; height: auto; display: block; }
.login-tool { font-size: 17px; color: var(--muted); font-weight: 700; margin-top: 3px; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; letter-spacing: -0.02em; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.login-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.login-note { font-size: 13px; color: var(--bad); margin-top: 12px; min-height: 18px; text-align: center; font-weight: 600; }
.pwd-wrap { position: relative; display: flex; align-items: center; }
.pwd-wrap .input { flex: 1; padding-right: 38px; }
.pwd-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; cursor: pointer;
  font-size: 16px; padding: 4px 6px; border-radius: var(--r-xs);
  color: var(--muted); transition: background var(--dur);
}
.pwd-toggle:hover { background: var(--surface-2); }
.side-chpwd {
  border: none; background: transparent; cursor: pointer;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); transition: all var(--dur);
}
.side-chpwd:hover { background: var(--surface-2); color: var(--fg1); }


/* ── Toasts ──────────────────────────────────────────────────── */
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--text); color: var(--surface);
  padding: 11px 16px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateX(32px);
  transition: opacity .28s, transform .28s var(--ease);
  max-width: 320px; display: flex; align-items: center; gap: 9px;
}
.toast.show { opacity: 1; transform: none; }
.toast.ok  { background: #0f172a; }
.toast.err { background: var(--bad); }

/* ── Misc ────────────────────────────────────────────────────── */
.empty {
  text-align: center; color: var(--muted); padding: 44px 20px;
  background: var(--surface); border: 1px dashed var(--line-2);
  border-radius: var(--r); grid-column: 1 / -1;
}
.muted { color: var(--muted); }
.center-msg {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh; text-align: center;
  color: var(--muted); gap: 8px; padding: 20px;
}
.center-msg.setup { gap: 12px; }
.center-msg.setup h2 { color: var(--text); }

/* ── Capacity ────────────────────────────────────────────────── */
.cap-table { display: flex; flex-direction: column; }
.cap-head, .cap-row {
  display: grid;
  grid-template-columns: 1.6fr 1.6fr .8fr 1.4fr 1.4fr 1fr;
  align-items: center; gap: 10px; padding: 10px 8px;
}
.cap-head {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.cap-row { border-bottom: 1px solid var(--line); transition: background var(--dur); }
.cap-row:hover { background: var(--surface-2); }
.cap-bar { display: flex; align-items: center; gap: 8px; }
.cap-bar .bar-track { flex: 1; }
.sm { font-size: 12px; }

/* ── Roadmap ─────────────────────────────────────────────────── */
.rm-list { display: flex; flex-direction: column; gap: 9px; }
.rm-item { display: flex; gap: 12px; justify-content: space-between; background: var(--surface-2); border-left: 3px solid var(--c); border-radius: var(--r-sm); padding: 11px 13px; }
.rm-title { font-weight: 600; margin-bottom: 3px; }
.rm-meta { font-size: 12px; color: var(--muted); }
.rm-kr { font-size: 13px; color: var(--text); margin-top: 5px; }
.rm-side { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; white-space: nowrap; }
.rm-status { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); }
.rm-status.s-done         { background: var(--ok-soft);   color: var(--ok); }
.rm-status.s-in_progress  { background: var(--info-soft);  color: var(--info); }
.rm-status.s-blocked      { background: var(--bad-soft);  color: var(--bad); }

/* Roadmap board */
.rm-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: start; }
.rm-col { background: var(--kanban-col-bg); border-radius: var(--r-md); padding: 10px; }
.rm-col-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 13px; color: var(--fg1); padding: 4px 6px 10px; }
.rm-col-head .count { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--r-pill); font-size: 11px; font-weight: 700; color: var(--fg3); padding: 1px 8px; }
.rm-col-body { display: flex; flex-direction: column; gap: 9px; }
.rm-empty { color: var(--fg3); font-size: 12px; text-align: center; padding: 14px 0; }
.rm-card { background: var(--kanban-card-bg); border: 1px solid var(--kanban-card-border); border-left: 4px solid var(--c); border-radius: var(--r-sm); padding: 12px; box-shadow: var(--card-shadow); transition: transform var(--dur), box-shadow var(--dur); }
.rm-card:hover { transform: translateY(-1px); box-shadow: var(--card-shadow-hover); }
.rm-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; gap: 6px; }
.rm-stat { font-size: 11px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); padding: 2px 9px; border-radius: var(--r-pill); white-space: nowrap; }
.rm-card-title { font-weight: 700; font-size: 14px; margin-bottom: 7px; line-height: 1.35; }
.rm-card-kr { font-size: 12.5px; color: var(--text); background: var(--surface-2); border-radius: var(--r-sm); padding: 7px 9px; margin-top: 7px; }
.rm-card-foot { font-size: 12px; color: var(--muted); margin-top: 7px; }
.rm-edit { padding: 2px 7px; opacity: 0.6; }
.rm-edit:hover { opacity: 1; }

/* ── Video Brief Guide ───────────────────────────────────────── */
.video-brief-guide {
  border: 1px solid rgba(245,158,11,.35);
  border-left: 3px solid #f59e0b;
  border-radius: var(--r-md);
  background: rgba(245,158,11,.06);
  overflow: hidden;
  animation: fadeUp 180ms var(--ease);
}
.vbg-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-size: 13px; font-weight: 700; color: #f59e0b;
  border-bottom: 1px solid rgba(245,158,11,.2);
  background: rgba(245,158,11,.1);
}
.vbg-body {
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.vbg-section { display: flex; flex-direction: column; gap: 5px; }
.vbg-label { font-size: 12px; font-weight: 700; color: var(--fg2); }
.vbg-list {
  margin: 0; padding-left: 16px;
  display: flex; flex-direction: column; gap: 3px;
}
.vbg-list li { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.vbg-list li strong { color: var(--fg1); font-weight: 600; }

/* ── Blockers ────────────────────────────────────────────────── */
.bl-list { display: flex; flex-direction: column; gap: 8px; }
.bl-item { display: flex; justify-content: space-between; gap: 10px; background: var(--card-bg); border-radius: var(--r-md); padding: 13px 16px; border: 1px solid var(--card-border); box-shadow: var(--card-shadow); transition: box-shadow var(--dur); }
.bl-item:hover { box-shadow: var(--card-shadow-hover); }
.bl-issue { font-weight: 600; margin-bottom: 4px; }
.bl-meta { font-size: 12px; color: var(--muted); }
.bl-res { font-size: 13px; color: var(--ok); margin-top: 5px; }
.bl-side { display: flex; align-items: center; gap: 7px; white-space: nowrap; }

/* ── Reports / Metrics ───────────────────────────────────────── */
.ptable-head.met, .ptable-row.met { grid-template-columns: 1.4fr 1.2fr .8fr 1fr 1.2fr .8fr; }
.period-note { font-size: 13px; color: var(--muted); margin-bottom: 11px; }
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--card-shadow);
  transition: transform var(--dur), box-shadow var(--dur);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.kpi-val  { font-size: 24px; font-weight: 800; line-height: 1; letter-spacing: -0.025em; }
.kpi-label{ color: var(--muted); font-size: 12.5px; margin-top: 5px; font-weight: 500; }
.kpi-cmp  { margin-top: 10px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-sm); display: inline-block; }
.kpi-cmp.good { background: var(--ok-soft); color: var(--ok); }
.kpi-cmp.bad  { background: var(--bad-soft); color: var(--bad); }
.kpi-cmp.none { background: var(--surface-2); color: var(--muted-2); font-weight: 600; }

.met-grid { display: flex; flex-direction: column; gap: 7px; }
.met-row  { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.1fr 1fr 1.1fr; gap: 8px; align-items: center; }
.met-row.met-header { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.04em; padding-bottom: 3px; }
.met-ch { font-size: 13px; }
.trend  { display: flex; align-items: flex-end; gap: 5px; height: 130px; padding-top: 8px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.trend-bar { width: 100%; max-width: 22px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 3px; transition: height .2s; }
.trend-col:hover .trend-bar { background: var(--plum); }
.trend-x { font-size: 9px; color: var(--muted-2); transform: rotate(-45deg); white-space: nowrap; transform-origin: center; height: 14px; }

/* ── Theme toggle ────────────────────────────────────────────── */
.theme-btn {
  border: none; background: transparent; border-radius: var(--r-sm);
  width: 32px; height: 32px; font-size: 15px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur); color: var(--fg3);
}
.theme-btn:hover { background: var(--bg-subtle); color: var(--fg1); }

/* ── Notifications ───────────────────────────────────────────── */
.notif-wrap { position: relative; }
.notif-bell {
  position: relative; border: none;
  background: transparent; border-radius: var(--r-sm);
  width: 32px; height: 32px; font-size: 15px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur); color: var(--fg3);
}
.notif-bell:hover { background: var(--bg-subtle); color: var(--fg1); }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--bad); color: #fff; font-size: 9.5px; font-weight: 800;
  min-width: 16px; height: 16px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; justify-content: center; padding: 0 3px;
  border: 1.5px solid var(--topbar-bg);
}
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 7px);
  width: 330px; max-width: 92vw; max-height: 430px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); z-index: 120;
  animation: fadeUp 180ms var(--ease);
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); font-size: 14px; }
.notif-list { display: flex; flex-direction: column; }
.notif-item { padding: 10px 13px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background var(--dur); }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--brand-tint); }
.notif-item.unread:hover { background: rgba(255,212,0,0.18); }
.ni-title { font-weight: 700; font-size: 13px; }
.ni-body  { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ni-time  { font-size: 11px; color: var(--muted-2); margin-top: 4px; }

.theme-toggle { display: none; }

/* ── Work Management tabs ────────────────────────────────────── */
.view-switch { display: inline-flex; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; margin-bottom: 14px; }
.vs-opt { border: none; background: transparent; padding: 6px 14px; border-radius: var(--r-xs); font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; transition: all var(--dur); }
.vs-opt:hover { color: var(--text); }
.vs-opt.on { background: var(--brand); color: var(--brand-ink); }

.wm-tabs {
  display: flex; gap: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 5px; margin-bottom: 18px; box-shadow: var(--shadow);
  overflow: hidden; position: relative;
}
.wm-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 8px 10px; border: none; background: transparent;
  border-radius: var(--r-sm); cursor: pointer;
  transition: all var(--dur) var(--ease); position: relative; z-index: 1; color: var(--muted);
}
.wm-tab:hover { color: var(--text); background: var(--surface-2); }
.wm-tab.on { color: var(--accent-text); font-weight: 700; }
.wm-tab-icon  { font-size: 20px; line-height: 1; }
.wm-tab-label { font-size: 13.5px; font-weight: 700; }
.wm-tab-hint  { font-size: 11px; color: var(--muted-2); font-weight: 500; }
.wm-tab.on .wm-tab-hint { color: var(--accent-text); opacity: 0.70; }
.wm-tab-badge { position: absolute; top: 7px; right: 10px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 800; min-width: 17px; height: 17px; border-radius: var(--r-pill); display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
.wm-tab-indicator { position: absolute; bottom: 5px; left: 5px; height: calc(100% - 10px); background: var(--brand-tint); border: 1.5px solid rgba(255,212,0,0.35); border-radius: var(--r-sm); transition: left .3s var(--ease), width .3s var(--ease); z-index: 0; }

.bc-bar { display: flex; align-items: center; gap: 8px; background: var(--brand-tint); border: 1px solid rgba(255,212,0,0.25); border-radius: var(--r-sm); padding: 9px 14px; margin-bottom: 14px; flex-wrap: wrap; }
.bc-label { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.bc-path { display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap; }
.bc-seg { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 3px 11px; border-radius: var(--r-pill); }
.bc-campaign   { background: color-mix(in srgb,var(--plum) 10%,transparent); color: var(--plum); border: 1px solid color-mix(in srgb,var(--plum) 20%,transparent); }
.bc-initiative { background: var(--info-soft); color: var(--info); border: 1px solid rgba(29,110,181,0.20); }
.bc-arrow { font-size: 13px; color: var(--muted-2); font-weight: 700; }
.bc-clear { white-space: nowrap; flex-shrink: 0; }

.wm-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 11px; margin-bottom: 18px; }
.wm-stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 15px 17px; box-shadow: var(--shadow);
  transition: transform var(--dur), box-shadow var(--dur);
}
.wm-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.wm-stat-n { font-size: 26px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.wm-stat-l { color: var(--muted); font-size: 12px; margin-top: 4px; font-weight: 500; }
.wm-stat.ok   .wm-stat-n { color: var(--ok); }
.wm-stat.bad  .wm-stat-n { color: var(--bad); }
.wm-stat.warn .wm-stat-n { color: #d97706; }

.wm-camp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px,1fr)); gap: 14px; }
.wm-camp-card {
  background: var(--surface); border: 1px solid var(--line);
  border-top: 3px solid var(--camp-color, #9CA3AF);
  border-radius: var(--r); padding: 17px;
  box-shadow: var(--shadow); transition: all var(--dur) var(--ease);
  display: flex; flex-direction: column; gap: 11px;
}
.wm-camp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.wm-camp-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; }
.wm-camp-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.wm-code { font-size: 10px; font-weight: 800; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: 2px 7px; border-radius: var(--r-xs); font-family: ui-monospace,monospace; letter-spacing: 0.04em; }
.wm-camp-status { font-size: 11px; font-weight: 700; color: var(--c); background: color-mix(in srgb,var(--c) 12%,transparent); padding: 2px 9px; border-radius: var(--r-pill); white-space: nowrap; }
.wm-edit-btn { opacity: 0.5; transition: opacity var(--dur); }
.wm-camp-card:hover .wm-edit-btn { opacity: 1; }
.wm-camp-name { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.wm-camp-obj  { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wm-camp-pl { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--plc) 15%, transparent); color: var(--plc); margin-bottom: 2px; }
.wm-filter-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.wm-filter-btn { font-size: 12px; padding: 4px 12px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); cursor: pointer; transition: all .15s; }
.wm-filter-btn:hover { border-color: var(--fc, var(--accent)); }
.wm-filter-btn.active { background: color-mix(in srgb, var(--fc, var(--accent)) 18%, transparent); border-color: var(--fc, var(--accent)); color: var(--fc, var(--accent)); font-weight: 600; }

.wm-camp-progress { display: flex; align-items: center; gap: 9px; }
.wm-prog-track { flex: 1; height: 7px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; border: 1px solid var(--line); }
.wm-prog-track.sm { height: 5px; }
.wm-prog-fill  { height: 100%; border-radius: var(--r-pill); background: var(--plum); transition: width 600ms var(--ease); }
.wm-prog-pct   { font-size: 13px; font-weight: 800; color: var(--plum); white-space: nowrap; min-width: 34px; text-align: right; }

.wm-camp-badges { display: flex; gap: 7px; flex-wrap: wrap; }
.wm-badge-item { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: 3px 10px; border-radius: var(--r-pill); }
.wm-badge-item.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(22,163,74,0.25); }

.wm-init-strip { display: flex; gap: 5px; flex-wrap: wrap; margin-top: -3px; }
.wm-init-pill { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--c); background: color-mix(in srgb,var(--c) 11%,transparent); border: 1px solid color-mix(in srgb,var(--c) 22%,transparent); padding: 2px 8px; border-radius: var(--r-pill); white-space: nowrap; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.wm-init-pill-count { font-size: 10px; opacity: 0.75; margin-left: 1px; }
.wm-init-more { font-size: 11px; color: var(--muted-2); align-self: center; }

.wm-camp-actions { display: flex; gap: 7px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 11px; margin-top: 1px; }
.wm-camp-actions .btn { flex: 1; min-width: 76px; justify-content: center; font-size: 12px; }

.wm-init-group { margin-bottom: 18px; }
.wm-init-group-head { display: flex; align-items: center; gap: 9px; padding: 10px 13px; background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--camp-color, #9CA3AF); border-radius: var(--r-sm) var(--r-sm) 0 0; flex-wrap: wrap; }
.wm-init-camp-name { font-weight: 700; font-size: 14px; }
.wm-init-cards { display: grid; grid-template-columns: repeat(auto-fill,minmax(230px,1fr)); gap: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-top: none; border-radius: 0 0 var(--r-sm) var(--r-sm); }

.wm-init-card { background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--camp-color, #9CA3AF); border-radius: var(--r-sm); padding: 13px; box-shadow: var(--shadow); transition: all var(--dur) var(--ease); display: flex; flex-direction: column; gap: 9px; }
.wm-init-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); background: var(--surface); }
.wm-init-card-head { display: flex; align-items: center; gap: 7px; }
.wm-init-stat { font-size: 11px; font-weight: 700; color: var(--c); background: color-mix(in srgb,var(--c) 12%,transparent); padding: 2px 8px; border-radius: var(--r-pill); white-space: nowrap; }
.wm-init-name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.wm-init-owner { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.wm-init-prog { display: flex; align-items: center; gap: 7px; }
.wm-init-card-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.wm-init-card-actions { border-top: 1px solid var(--line); padding-top: 9px; }

/* Production cards inside initiatives */
.wm-prod-board { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 6px; }
.wm-prod-col { flex: 0 0 200px; background: var(--surface-2); border: 1px solid var(--line); border-top: 2px solid var(--c, #9CA3AF); border-radius: var(--r-sm); padding: 9px; }
.wm-col-head { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 2px 3px 7px; }
.wm-col-head .count { margin-left: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 6px; font-size: 10.5px; color: var(--muted-2); font-weight: 700; }
.wm-prod-cards { display: flex; flex-direction: column; gap: 5px; min-height: 20px; }
.wm-prod-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xs); padding: 8px 9px; font-size: 12.5px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); border-left: 2px solid var(--c, #9CA3AF); line-height: 1.3; transition: all var(--dur) var(--ease); }
.wm-prod-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.wm-prod-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 5px; }

/* Task list view inside initiative */
.wm-task-list { display: flex; flex-direction: column; gap: 2px; }
.wm-task-row { display: grid; grid-template-columns: 22px 1fr 100px 80px 80px 70px; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 11px; cursor: pointer; transition: all var(--dur); font-size: 13px; }
.wm-task-row:hover { border-color: var(--brand); background: var(--brand-tint); }
.wm-task-row.done-row { opacity: 0.55; }
.wm-task-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wm-task-meta  { font-size: 11.5px; color: var(--muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Campaign detail inside modal */
.cd-progress { display: flex; align-items: center; gap: 11px; margin: 14px 0; background: var(--surface-2); padding: 11px 13px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.cd-prog-label { font-size: 13px; font-weight: 600; white-space: nowrap; }
.cd-progress .bar-track { flex: 1; }
.cd-prog-pct { font-weight: 800; font-size: 15px; color: var(--plum); }
.cd-actions { display: flex; gap: 7px; margin-bottom: 14px; flex-wrap: wrap; }
.cd-groups { display: flex; flex-direction: column; gap: 12px; }
.cd-group { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.cd-group-head { display: flex; align-items: center; gap: 9px; padding: 9px 11px; background: var(--surface-2); font-size: 14px; flex-wrap: wrap; }
.cd-code { font-size: 10px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 1px 6px; border-radius: var(--r-xs); font-family: ui-monospace,monospace; }
.cd-istat { font-size: 11px; font-weight: 700; color: var(--c); background: color-mix(in srgb,var(--c) 12%,transparent); padding: 2px 8px; border-radius: var(--r-pill); }
.cd-gpct { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.cd-prod-list { display: flex; flex-direction: column; }
.cd-prod { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-top: 1px solid var(--line); cursor: pointer; transition: background var(--dur); }
.cd-prod:hover { background: var(--brand-tint); }
.cd-ptitle { flex: 1; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-stage { font-size: 11px; font-weight: 600; color: var(--c); background: color-mix(in srgb,var(--c) 12%,transparent); padding: 2px 8px; border-radius: var(--r-pill); white-space: nowrap; }

/* ── Calendar ────────────────────────────────────────────────── */
.cal-head { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.cal-head h3 { font-size: 16px; min-width: 130px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }   /* minmax(0,…): tên bài dài không kéo giãn cột */
.cal-wd { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); padding-bottom: 3px; }
.cal-cell { min-height: 90px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 5px; transition: background var(--dur); }
.cal-cell.cal-blank { background: transparent; border: none; }   /* không dùng class "empty" — trùng style ô trống toàn trang */
.cal-cell.today { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-tint); }
.cal-day { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.cal-cell.today .cal-day { color: var(--plum); }
.cal-items { display: flex; flex-direction: column; gap: 2px; }
.cal-ev { font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: var(--r-xs); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; background: var(--c); }
.cal-ev.done { opacity: .5; text-decoration: line-through; }
.cal-more { font-size: 10px; color: var(--muted); font-weight: 600; cursor: default; }

/* ── Timeline / Gantt ────────────────────────────────────────── */
.display-wrap { min-height: 60px; }
.timeline { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.tl-scroll { overflow-x: auto; }
.tl-inner { position: relative; }
.tl-header { display: flex; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.tl-tick { width: 26px; flex: none; text-align: center; padding: 3px 0; border-left: 1px solid transparent; }
.tl-tick.we { background: rgba(83,38,84,.03); }
.tl-tick.month { border-left: 1px solid var(--line-2); }
.tl-mon { display: block; font-size: 9px; font-weight: 800; color: var(--plum); }
.tl-d { font-size: 9px; color: var(--muted-2); }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); z-index: 2; opacity: .55; }
.tl-rows { position: relative; }
.tl-row { position: relative; height: 30px; border-bottom: 1px solid var(--line); }
.tl-bar { position: absolute; top: 4px; height: 22px; border-radius: var(--r-sm); color: #fff; font-size: 11px; line-height: 22px; cursor: pointer; overflow: hidden; box-shadow: var(--shadow); display: flex; align-items: center; transition: filter var(--dur); }
.tl-bar span { padding: 0 8px; white-space: nowrap; }
.tl-bar.done { opacity: .5; }
.tl-bar:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* ── List view ───────────────────────────────────────────────── */
.list-group { margin-bottom: 14px; }
.list-gh { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; margin-bottom: 7px; }
.list-gh .dot { width: 8px; height: 8px; border-radius: 50%; }
.list-gh .count { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.list-rows { display: flex; flex-direction: column; gap: 2px; }
.list-row { display: grid; grid-template-columns: 32px 1fr auto 125px 88px; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; cursor: pointer; transition: all var(--dur); }
.list-row:hover { border-color: var(--brand); background: var(--brand-tint); }
.list-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-badges { display: flex; gap: 4px; }
.list-meta { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.list-due { text-align: right; }

/* ── Date filter ─────────────────────────────────────────────── */
.date-filter { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.date-filter .input { width: auto; min-width: 0; }

/* ── ctrl-or ─────────────────────────────────────────────────── */
.ctrl-or { align-self: center; color: var(--muted-2); font-size: 13px; }

/* ── Overview Dashboard ──────────────────────────────────────── */
.ov-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 18px;
}
.ov-stat {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--r-lg); padding: 18px 20px;
  box-shadow: var(--card-shadow); cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden;
}
.ov-stat::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--line-2); transition: background var(--dur);
}
.ov-stat:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.ov-stat-icon { font-size: 22px; margin-bottom: 2px; line-height: 1; }
.ov-stat-n {
  font-size: 30px; font-weight: 800; letter-spacing: -0.03em;
  line-height: 1; color: var(--fg1); font-family: var(--font-brand);
}
.ov-stat-l {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--fg3); margin-top: 4px;
}
.ov-stat.bad { background: var(--bad-soft); border-color: rgba(224,56,43,0.20); }
.ov-stat.bad::before { background: var(--bad); }
.ov-stat.bad .ov-stat-n { color: var(--bad); }
.ov-stat.warn { background: var(--warn-soft); border-color: rgba(232,164,0,0.22); }
.ov-stat.warn::before { background: var(--warn); }
.ov-stat.warn .ov-stat-n { color: var(--warn); }

/* Overview campaign grid */
.ov-camp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.ov-camp-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-left: 3px solid var(--camp-color, #9CA3AF);
  border-radius: var(--r-md); padding: 12px 14px;
  cursor: pointer; box-shadow: var(--card-shadow);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  display: flex; flex-direction: column; gap: 7px;
}
.ov-camp-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.ov-camp-top { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; min-height: 20px; }
.ov-pl-chip {
  font-size: 10px; font-weight: 700; color: var(--c, var(--muted));
  background: color-mix(in srgb, var(--c, var(--muted)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--muted)) 22%, transparent);
  padding: 1px 7px; border-radius: var(--r-pill);
}
.ov-camp-name { font-weight: 700; font-size: 13.5px; line-height: 1.3; }
.ov-camp-prog { display: flex; align-items: center; gap: 8px; }
.ov-camp-prog .wm-prog-track { flex: 1; }
.ov-pct { font-size: 12px; font-weight: 800; color: var(--plum); white-space: nowrap; min-width: 30px; text-align: right; }
.ov-camp-meta { font-size: 11.5px; color: var(--muted-2); }
.ov-camp-more {
  font-size: 13px; color: var(--accent-text); font-weight: 700;
  text-align: center; padding: 10px; cursor: pointer;
  border: 1px dashed rgba(255,212,0,0.35); border-radius: var(--r-md);
  background: var(--brand-tint); transition: background var(--dur);
}
.ov-camp-more:hover { background: rgba(255,212,0,0.18); }

/* ── Status Manager Modal ────────────────────────────────────── */
.smgr-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-height: 30px; }
.smgr-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); transition: background var(--dur);
}
.smgr-row:hover { background: var(--bg-subtle); }
.smgr-drag { font-size: 15px; color: var(--muted-2); cursor: grab; user-select: none; padding: 0 2px; flex-shrink: 0; }
.smgr-drag:active { cursor: grabbing; }
.smgr-color { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; border: 1.5px solid rgba(0,0,0,0.12); }
.smgr-label { flex: 1; }
.smgr-color-sel { width: 100px; flex-shrink: 0; }
.smgr-add { display: flex; gap: 7px; align-items: center; }
.smgr-add .input { flex: 1; }
.smgr-add select.input { width: 110px; flex: none; }

/* ── Pipeline quota grid ─────────────────────────────────────── */
.pq-label { font-size: 12px; color: var(--fg2); margin-bottom: 6px; }
.pq-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pq-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--fg1); }
.pq-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pq-input { width: 100%; text-align: center; padding: 6px 4px; }

/* ── Sidebar Logout/Change Password Icons ────────────────────── */
.side-logout, .side-chpwd {
  flex-shrink: 0; border: none; border-radius: var(--r-sm);
  width: 30px; height: 30px; padding: 0;
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.32); transition: background var(--dur), color var(--dur);
}
.side-logout:hover, .side-chpwd:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.75); }
.side-logout svg, .side-chpwd svg { width: 15px; height: 15px; }

/* ── Nav SVG icons ───────────────────────────────────────────── */
.ni-icon { flex-shrink: 0; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; opacity: 0.65; }
.ni-icon svg { display: block; }
.nav-item.active .ni-icon { opacity: 1; }
.nav-item:hover .ni-icon { opacity: 0.90; }

/* ── Login page polish ───────────────────────────────────────── */
.login {
  background: radial-gradient(ellipse at 60% 0%, rgba(83,38,84,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 100%, rgba(255,212,0,0.06) 0%, transparent 50%),
              var(--bg);
}
.login-card {
  animation: fadeUp 340ms var(--ease-out) both;
}

/* ── Product Line Filter Bar (Tab Công Việc) ─────────────────── */
.pl-filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.pl-chip {
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--r-pill);
  padding: 6px 16px;
  font-size: 12.5px; font-weight: 700;
  cursor: pointer;
  transition: all var(--dur);
  outline: none;
}
.pl-chip:hover {
  border-color: var(--c, var(--brand));
  color: var(--c, var(--brand));
  background: color-mix(in srgb, var(--c, var(--brand)) 8%, var(--surface));
}
.pl-chip.on {
  border-color: var(--c, var(--brand));
  background: color-mix(in srgb, var(--c, var(--brand)) 14%, var(--surface));
  color: var(--c, var(--brand));
  box-shadow: 0 2px 8px color-mix(in srgb, var(--c, var(--brand)) 30%, transparent);
}

/* ── Dashboard Canva — 6 Metric Cards (2 × 3) ───────────────── */
.ov-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.ov-metric-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 20px 22px 18px;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  transition: transform var(--dur), box-shadow var(--dur);
}
.ov-metric-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
/* Hero (MQL) — yellow background */
.ov-metric-card.hero {
  background: var(--brand);
  border-color: var(--brand-d);
}
.ov-metric-card.hero .ovm-val   { color: rgba(0,0,0,0.88); }
.ov-metric-card.hero .ovm-label { color: rgba(0,0,0,0.55); }
.ov-metric-card.hero .ovm-sub   { color: rgba(0,0,0,0.50); }

.ovm-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.ovm-ic {
  width: 22px; height: 22px; flex-shrink: 0;
  color: var(--mc, var(--muted));
  opacity: 0.80;
}
.ov-metric-card.hero .ovm-ic { color: var(--brand-ink); opacity: 0.70; }
.ovm-spark {
  width: 60px; height: 26px; flex-shrink: 0;
  color: var(--mc, var(--muted));
  opacity: 0.45;
}
.ov-metric-card.hero .ovm-spark { color: var(--brand-ink); opacity: 0.35; }
.ovm-val { font-size: 32px; font-weight: 800; letter-spacing: -0.035em; line-height: 1; color: var(--mc, var(--text)); }
.ovm-label { font-size: 11px; color: var(--muted); margin-top: 7px; font-weight: 600; }
.ovm-sub { font-size: 11.5px; color: var(--muted-2); margin-top: 4px; }
.ovm-trend { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: var(--r-pill); margin-right: 3px; }
.ovm-trend.up { background: rgba(16,185,129,.12); color: #10b981; }
.ovm-trend.dn { background: rgba(239,68,68,.10); color: #ef4444; }
.ovm-hint { font-size: 12px; color: var(--muted); margin: 0 auto 0 10px; }

/* ── Dashboard — Main body 2 cols ───────────────────────────── */
.ov-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  align-items: start;
}
.ov-camp-panel { flex: 1; min-width: 0; }
.ov-camp-list { display: flex; flex-direction: column; }
.ov-camp-row {
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--dur);
}
.ov-camp-row:last-child { border-bottom: none; }
.ov-camp-row:hover { background: var(--surface-2); }
.ov-camp-row-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.ov-camp-row-left { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.ov-camp-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ov-camp-row-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.ov-camp-row-status {
  font-size: 11px; font-weight: 700; white-space: nowrap; flex-shrink: 0;
  color: var(--c, var(--muted)); background: color-mix(in srgb, var(--c, var(--muted)) 12%, transparent);
  padding: 2px 8px; border-radius: var(--r-pill);
}
.ov-camp-row-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; margin-left: 14px; }
.ov-camp-row-tasks { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ov-camp-row-due { font-size: 10.5px; color: var(--muted-2); text-align: right; line-height: 1.3; white-space: nowrap; }
.ov-camp-row-due b { color: var(--text); font-size: 12px; }
.ov-camp-row-pct { font-size: 13px; font-weight: 800; min-width: 36px; text-align: right; }
.ov-camp-row-bar { height: 5px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.ov-camp-row-fill { height: 100%; border-radius: 3px; transition: width .6s var(--ease); }

/* Right column */
.ov-right-col { display: flex; flex-direction: column; gap: 14px; }
.ov-right-card { }
.ov-act-list { display: flex; flex-direction: column; padding: 4px 0; }
.ov-act-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 20px; cursor: pointer;
  border-bottom: 1px solid var(--line); transition: background var(--dur);
}
.ov-act-item:last-child { border-bottom: none; }
.ov-act-item:hover { background: var(--surface-2); }
.ov-act-info { flex: 1; min-width: 0; }
.ov-act-text { font-size: 12.5px; line-height: 1.45; }
.ov-act-text em { font-style: normal; color: var(--muted); }
.ov-act-time { font-size: 11px; color: var(--muted-2); margin-top: 3px; }

.ov-dead-list { display: flex; flex-direction: column; padding: 4px 0; }
.ov-dead-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; cursor: pointer;
  border-bottom: 1px solid var(--line); transition: background var(--dur);
}
.ov-dead-item:last-child { border-bottom: none; }
.ov-dead-item:hover { background: var(--surface-2); }
.ov-dead-title { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color var(--dur); }
.ov-dead-item:hover .ov-dead-title { color: var(--accent-text); }
.ov-dead-right { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.due.sm { font-size: 11px; padding: 2px 7px; }

/* ── Capacity — 3 Summary Cards ─────────────────────────────── */
.cap-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.cap-sum-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--card-shadow);
}
.cap-sum-label { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 10px; }
.cap-sum-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap-sum-val { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.cap-sum-sub { font-size: 12px; color: var(--muted-2); margin-top: 6px; }

/* ── Blockers Split Layout (legacy) ──────────────────────────── */
.blockers-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bl-col { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--r-lg); box-shadow: var(--card-shadow); overflow: hidden; }
.bl-col-head { display: flex; align-items: center; gap: 8px; padding: 13px 16px; font-size: 14px; font-weight: 700; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.bl-col-head .count { background: var(--bad-soft); color: var(--bad); font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: var(--r-pill); }
.bl-col-body { padding: 8px 14px; }
.bl-col-resolved { font-size: 12px; font-weight: 700; color: var(--ok); padding: 10px 0 4px; border-top: 1px solid var(--line); margin-top: 8px; }

/* ── Blockers New Design ─────────────────────────────────────── */
.btn-report-blocker {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--r-md);
  background: var(--brand); color: #000;
  font-size: 13px; font-weight: 700;
  border: none; cursor: pointer;
  transition: opacity var(--dur);
}
.btn-report-blocker:hover { opacity: .85; }

.bl-tab-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin: 14px 0 10px;
}
.bl-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 16px; border-radius: var(--r-md);
  background: transparent; border: 1.5px solid transparent;
  font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: all var(--dur);
}
.bl-tab:hover { color: var(--fg1); border-color: var(--line); }
.bl-tab.active { color: var(--accent-text); border-color: var(--brand); }
.bl-tab-count {
  background: var(--surface-2); color: var(--muted);
  font-size: 11px; font-weight: 800;
  padding: 1px 7px; border-radius: var(--r-pill);
}
.bl-tab.active .bl-tab-count { background: rgba(255,212,0,.18); color: var(--accent-text); }

.bl-escalate-banner {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px; margin-bottom: 14px;
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--r-md); color: #f87171;
  font-size: 13px; font-weight: 600;
}

.bl-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.bl-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--bad);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--card-shadow);
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow var(--dur);
}
.bl-card:hover { box-shadow: var(--card-shadow-hover); }
.bl-card.escalated { border-left-color: #f97316; }

.bl-card-top {
  display: flex; align-items: flex-start; gap: 10px;
}
.bl-card-icon {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(239,68,68,.15); color: var(--bad);
}
.bl-card-icon.escalated { background: rgba(249,115,22,.15); color: #f97316; }
.bl-card-icon.urgent { background: rgba(234,179,8,.15); color: #ca8a04; }
.bl-card-title {
  flex: 1; font-size: 13.5px; font-weight: 700; line-height: 1.4;
  color: var(--fg1);
}
.bl-card-edit {
  flex-shrink: 0; background: transparent; border: none;
  color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 5px;
  border-radius: var(--r-sm); transition: background var(--dur), color var(--dur);
}
.bl-card-edit:hover { background: var(--surface-2); color: var(--fg1); }

.bl-card-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.bl-tag {
  font-size: 11px; font-weight: 700; padding: 2px 9px;
  border-radius: var(--r-pill); white-space: nowrap;
}
.bl-tag.open { background: rgba(59,130,246,.15); color: #60a5fa; border: 1px solid rgba(59,130,246,.25); }
.bl-tag.escalated { background: rgba(239,68,68,.15); color: #f87171; border: 1px solid rgba(239,68,68,.25); }
.bl-tag.urgent { background: rgba(234,179,8,.15); color: #ca8a04; border: 1px solid rgba(234,179,8,.3); }
.bl-tag.campaign { background: rgba(168,85,247,.15); color: #c084fc; border: 1px solid rgba(168,85,247,.25); }
.bl-tag.resolved { background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(34,197,94,.2); }

.bl-card-desc {
  font-size: 12.5px; color: var(--muted); line-height: 1.5;
}

.bl-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 4px;
}
.bl-card-person {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted);
}
.bl-card-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand); color: #000;
  font-size: 9px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; text-transform: uppercase;
}
.bl-card-date { font-size: 12px; color: var(--muted-2); }
.bl-escalated-badge {
  font-size: 10px; font-weight: 800; letter-spacing: .04em;
  padding: 2px 8px; border-radius: var(--r-sm);
  background: rgba(239,68,68,.2); color: #f87171;
}

.bl-empty {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 48px 24px;
  color: var(--muted); font-size: 14px; text-align: center;
}
.bl-empty-icon { font-size: 32px; }

.bl-section-divider {
  grid-column: 1 / -1;
  font-size: 12px; font-weight: 700; color: var(--ok);
  padding: 10px 0 2px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

/* ── Sidebar Campaigns Section ───────────────────────────────── */
.nav-camp-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; border: none; background: transparent;
  padding: 5px 12px; border-radius: var(--r-sm);
  cursor: pointer; transition: background var(--dur);
  color: var(--nav-text); font-size: 12.5px;
  text-align: left;
}
.nav-camp-item:hover { background: var(--nav-hover-bg); color: var(--nav-text-hover); }
.nav-camp-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.nav-camp-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-camp-pct { font-size: 11px; font-weight: 700; color: var(--muted); flex-shrink: 0; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .ov-body { grid-template-columns: 1fr 300px; }
}
@media (max-width: 1000px) {
  .stats, .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .rm-board { grid-template-columns: repeat(2,1fr); }
  .met-row  { grid-template-columns: 1.2fr 1fr 1fr; }
  .wm-stats { grid-template-columns: repeat(2,1fr); }
  .ov-stats { grid-template-columns: repeat(2,1fr); }
  .ov-metrics-row { grid-template-columns: repeat(3, 1fr); }
  .ov-body { grid-template-columns: 1fr; }
  .ov-right-col { flex-direction: row; }
  .ov-right-card { flex: 1; }
  .cap-summary { grid-template-columns: repeat(3,1fr); }
  .blockers-split { grid-template-columns: 1fr; }
  .bl-card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .shell { flex-direction: column; height: auto; min-height: 100vh; }

  /* Compact mobile sidebar */
  .sidebar {
    width: 100%; flex-direction: row; flex-wrap: wrap;
    align-items: center; padding: 8px 12px; height: auto;
  }
  .sidebar::before { display: none; }
  .brand { padding: 0; border: none; margin-right: auto; }
  .brand::after { display: none; }
  .brand-logo { width: 200px; height: 48px; background-size: auto 48px; }
  .nav { flex-direction: row; flex: none; gap: 2px; padding: 0; overflow: visible; }
  .nav-item { height: 36px; padding: 0 9px; }
  .nav-item span:not(.ni-icon):not(.nav-badge) { display: none; }
  .ni-icon { font-size: 15px; }
  .side-foot { border: none; padding: 0; flex-direction: row; align-items: center; gap: 7px; width: 100%; margin-top: 6px; justify-content: space-between; }
  .me-info { display: block; }
  .side-foot .btn { width: auto; }

  .main { overflow: visible; }
  .view { padding: 14px; }
  .topbar { padding: 12px 16px; }
  .stats, .ov-stats { grid-template-columns: repeat(2,1fr); }
  .ov-metrics-row { grid-template-columns: repeat(2, 1fr); }
  .ov-body { grid-template-columns: 1fr; }
  .ov-right-col { flex-direction: column; }
  .cap-summary { grid-template-columns: 1fr; }
  .detail-meta { grid-template-columns: 1fr; }
  .form .row { flex-direction: column; }
  .filterbar #f-search { max-width: none; }
  .brief-grid, .bp-grid { grid-template-columns: 1fr; }
  .cal-cell { min-height: 60px; }
  .cal-ev { font-size: 10px; }
  .cap-head > :nth-child(n+4), .cap-row > :nth-child(n+4) { display: none; }
  .cap-head, .cap-row { grid-template-columns: 1.4fr 1fr 1fr; font-size: 13px; }
  .ptable-head.met > :nth-child(n+5), .ptable-row.met > :nth-child(n+5) { display: none; }
  .ptable-head.met, .ptable-row.met { grid-template-columns: 1.2fr 1fr .8fr 1fr; }
  .list-row { grid-template-columns: 28px 1fr 80px; }
  .list-badges, .list-meta { display: none; }
  .rm-board { grid-template-columns: 1fr; }
  .wm-stats { grid-template-columns: repeat(2,1fr); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Brief Hub ---- */
.brief-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 4px;
}
.brief-hub-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  cursor: default;
  transition: box-shadow var(--dur);
}
.brief-hub-card:hover { box-shadow: var(--shadow-hover); }
.bhc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bhc-code { font-size: 11px; font-weight: 700; color: var(--muted); }
.bhc-status { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; margin-left: auto; }
.bhc-name { font-size: 13.5px; font-weight: 600; color: var(--text); cursor: pointer; margin-bottom: 6px; line-height: 1.4; }
.bhc-name:hover { color: var(--gold); }
.bhc-camp { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.bhc-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }
.bhc-actions { display: flex; gap: 8px; margin-top: 8px; }
.bhc-pending { border-left: 3px solid #6366f1; }
.bhc-brief-preview { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 10px; margin-bottom: 8px; font-size: 12px; line-height: 1.5; }
.bhc-field { display: flex; gap: 6px; padding: 2px 0; }
.bhc-field-label { font-weight: 600; color: var(--muted); min-width: 80px; flex-shrink: 0; }
.bhc-field-val { color: var(--text); }

/* ICE Score sliders */
.ice-calc { display: flex; flex-direction: column; gap: 10px; padding: 10px 0; }
.ice-slider-wrap { display: flex; flex-direction: column; gap: 2px; }
.ice-label-row { display: flex; align-items: baseline; gap: 8px; }
.ice-label { font-size: 12px; font-weight: 600; }
.ice-desc { font-size: 11px; color: var(--muted); font-style: italic; }
.ice-input-row { display: flex; align-items: center; gap: 8px; }
.ice-range { flex: 1; accent-color: var(--gold); cursor: pointer; height: 6px; }
.ice-val { font-size: 14px; font-weight: 700; min-width: 24px; text-align: center; color: var(--gold); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; }
.ice-result { font-size: 14px; padding: 8px 14px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--r-sm); display: flex; align-items: center; gap: 8px; }
.ice-result strong { font-size: 18px; color: #8b5cf6; }
.ice-prio-label { font-size: 14px; font-weight: 700; margin-left: 4px; }
.req { font-size: 11px; color: #ef4444; font-weight: 600; }
.brief-miss-list { display: flex; flex-direction: column; gap: 6px; }
.brief-miss-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 8px 12px;
  font-size: 13px;
}

/* SLA warnings */
.sla-warn { font-size: 11px; font-weight: 600; }
.sla-warn.sla-over { color: #ef4444; }
.sla-warn.sla-near { color: #f59e0b; }
.card-sla-warn { border-left: 3px solid #ef4444 !important; }
.pipeline-chip { font-size: 10px; padding: 1px 6px; border-radius: 8px; font-weight: 600; color: #fff; }
.size-chip { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--border); color: var(--text); font-weight: 600; }
.rev-count { font-size: 10px; color: #f59e0b; font-weight: 600; }

/* ══════ VIEW BAR ══════ */
.wm-view-bar { display:flex; align-items:center; gap:8px; padding:8px 0; margin-bottom:8px; }
.wm-view-btn { padding:6px 14px; border-radius:8px; border:1px solid var(--border); background:var(--card); color:var(--text); font-size:13px; cursor:pointer; }
.wm-view-btn.on { background:var(--accent); color:var(--fg-on-yellow); border-color:var(--accent); }

/* ══════ HIERARCHY / ACCORDION ══════ */
.wm-hierarchy { display:flex; flex-direction:column; gap:8px; }
.wm-acc { border:1px solid var(--border); border-radius:10px; background:var(--card); overflow:hidden; }
.wm-acc-head { display:flex; align-items:center; gap:10px; padding:12px 16px; cursor:pointer; user-select:none; }
.wm-acc-head:hover { background:color-mix(in srgb, var(--accent) 4%, transparent); }
.wm-acc-arrow { font-size:11px; color:var(--muted); width:16px; flex-shrink:0; }
.wm-acc-info { flex:1; min-width:0; }
.wm-acc-top { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.wm-acc-name { font-weight:700; font-size:15px; }
.wm-acc-pic { font-size:12px; color:var(--muted); }
.wm-acc-progress { display:flex; align-items:center; gap:8px; margin-top:4px; }
.wm-acc-actions { display:flex; gap:4px; }
.wm-acc-body { padding:0 16px 12px 42px; }
.wm-acc-camp { display:flex; align-items:center; gap:10px; padding:8px 12px; border-radius:8px; border:1px solid var(--border); margin-bottom:6px; }
.wm-acc-camp:hover { background:color-mix(in srgb, var(--accent) 4%, transparent); }
.wm-acc-camp-info { flex:1; display:flex; align-items:center; gap:8px; min-width:0; }
.wm-acc-camp-name { font-weight:600; font-size:14px; }
.wm-acc-camp-meta { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.wm-acc-add { padding:4px 0; }
.budget-warn { color:#ef4444 !important; font-weight:600; }
.budget-warn-box { padding:8px 12px; background:#fef2f2; border:1px solid #fecaca; border-radius:8px; color:#dc2626; font-size:13px; margin-top:8px; }

/* ══════ GANTT TIMELINE ══════ */
.gantt-container { border:1px solid var(--border); border-radius:10px; overflow-x:auto; background:var(--card); }
.gantt-header { position:relative; height:32px; border-bottom:1px solid var(--border); background:var(--bg); }
.gantt-month { position:absolute; top:0; height:100%; display:flex; align-items:center; padding-left:8px; font-size:11px; font-weight:600; color:var(--muted); border-left:1px solid var(--border); }
.gantt-body { position:relative; min-height:80px; padding:8px 0; }
.gantt-today { position:absolute; top:0; bottom:0; width:2px; background:#ef4444; z-index:2; }
.gantt-today::before { content:"Today"; position:absolute; top:-18px; left:-16px; font-size:9px; color:#ef4444; font-weight:700; }
.gantt-row { display:flex; align-items:center; height:32px; padding:0 8px; }
.gantt-row.L1 { font-weight:700; }
.gantt-row.L2 { padding-left:20px; font-size:13px; }
.gantt-label { width:220px; flex-shrink:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.gantt-track { flex:1; position:relative; height:18px; }
.gantt-bar { position:absolute; top:2px; height:14px; border-radius:7px; opacity:0.85; min-width:4px; }

/* ══════ CHANNEL CHECKS ══════ */
.channel-checks { display:flex; flex-wrap:wrap; gap:6px 14px; }
.check-label { display:flex; align-items:center; gap:4px; font-size:13px; cursor:pointer; }
.check-label input { accent-color:var(--accent); }

/* ══════ FUNNEL ══════ */
.funnel-visual { display:flex; flex-direction:column; align-items:center; gap:0; }
.funnel-tier { display:flex; gap:16px; width:100%; align-items:flex-start; padding:12px 0; }
.funnel-bar-wrap { flex:0 0 220px; display:flex; justify-content:center; padding-top:4px; }
.funnel-bar { height:48px; border-radius:8px; display:flex; align-items:center; justify-content:center; min-width:60px; transition:width .3s; }
.funnel-bar-count { color:#fff; font-weight:700; font-size:20px; text-shadow:0 1px 2px rgba(0,0,0,.2); }
.funnel-info { flex:1; min-width:0; }
.funnel-label { font-size:15px; margin-bottom:4px; }
.funnel-dot { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:6px; vertical-align:middle; }
.funnel-stats { display:flex; gap:16px; font-size:13px; color:var(--fg); margin-bottom:6px; }
.funnel-stat b { font-weight:600; }
.funnel-metrics-row { display:flex; flex-wrap:wrap; gap:4px; align-items:center; margin-bottom:4px; }
.funnel-metrics-title { font-size:12px; color:var(--muted); margin-right:4px; }
.funnel-metric-chip { font-size:11px; padding:2px 8px; border-radius:10px; background:var(--hover); color:var(--fg); }
.funnel-stage-row { display:flex; flex-wrap:wrap; gap:4px; margin-top:4px; }
.funnel-stage-chip { font-size:11px; padding:1px 8px; border-radius:10px; }
.funnel-arrow { color:var(--muted); font-size:18px; line-height:1; margin:-4px 0; }
.funnel-panel { overflow:visible; }
.mini-bar { display:inline-block; width:60px; height:8px; border-radius:4px; background:var(--hover); vertical-align:middle; margin-right:6px; overflow:hidden; }
.mini-bar-fill { height:100%; border-radius:4px; }
@media(max-width:700px){
  .funnel-tier { flex-direction:column; align-items:stretch; }
  .funnel-bar-wrap { flex:none; }
}

/* ══════ MISC L1/L2 ══════ */
.cd-parent-link { font-size:13px; color:var(--muted); margin-bottom:8px; }
.wm-camp-status.sm { font-size:11px; padding:1px 8px; }

/* ── MASTER PLAN (v18) ─────────────────────────────────────── */
.mp-planbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.mp-planbar select[data-plan] { min-width: 180px; font-weight: 600; }
.mp-dates { font-size: 12px; }
.mp-click { cursor: pointer; }
.mp-click:hover { text-decoration: underline; text-decoration-color: var(--line-2); }
.mp-health { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.mp-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 6px 0; }
.mp-bar-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.mp-remind { background: var(--warn-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; }
.mp-note { background: var(--surface); border-left: 4px solid var(--brand); border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; box-shadow: var(--card-shadow); }
.mp-note-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 13px; }
.mp-note-body { font-size: 14px; line-height: 1.55; }
.mp-kpis .kpi-card { display: flex; flex-direction: column; gap: 2px; }
.mp-kpis .kpi-card .mp-health { align-self: flex-start; }
.mp-section { background: var(--surface); border-radius: 12px; padding: 14px 16px; margin-top: 14px; box-shadow: var(--card-shadow); }
.mp-section h3 { margin: 0 0 10px; font-size: 14px; }
.mp-obj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mp-obj-card { border: 1px solid var(--line); border-left: 4px solid; border-radius: 10px; padding: 12px; cursor: pointer; background: var(--surface); }
.mp-obj-card:hover { box-shadow: var(--card-shadow-hover); }
.mp-obj-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.mp-obj-pct { font-size: 24px; font-weight: 700; margin-top: 6px; }
.mp-obj-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); align-items: center; }
.mp-obj-meta .bad, .bad { color: var(--bad); }
.warn { color: var(--warn); }
.mp-owner { margin-left: auto; }
.mp-two { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.mp-two .mp-section { margin-top: 14px; }
.mp-risk { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mp-risk:last-child { border-bottom: 0; }
.mp-risk-n { font-weight: 700; color: var(--muted); width: 16px; }
.mp-risk-main { flex: 1; min-width: 0; font-size: 13px; }
.mp-tag { font-size: 10px; font-weight: 700; letter-spacing: .03em; color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.mp-slow { margin-bottom: 10px; }
.mp-slow-h { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.mp-slow-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.mp-slow-row b { color: var(--bad); }
.mp-tlist { display: flex; flex-direction: column; }
.mp-trow { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.mp-trow-title { flex: 1; min-width: 0; }

/* Cây OKR */
.mp-tree { background: var(--surface); border-radius: 12px; padding: 6px 10px; box-shadow: var(--card-shadow); }
.mp-obj-block { border-bottom: 1px solid var(--line); padding: 4px 0; }
.mp-obj-block:last-child { border-bottom: 0; }
.mp-node { display: flex; align-items: center; gap: 8px; padding: 7px 6px 7px calc(6px + var(--d, 0) * 26px); font-size: 13px; border-radius: 6px; }
.mp-node:hover { background: var(--surface-2); }
.mp-obj { border-left: 4px solid transparent; font-size: 14px; }
.mp-drag { cursor: grab; color: var(--muted-2); user-select: none; }
.mp-caret { width: 14px; text-align: center; color: var(--muted); }
.mp-node-title { flex: 1; min-width: 0; }
.mp-node-meta { font-size: 12px; white-space: nowrap; }
.mp-node-bar { width: 110px; flex-shrink: 0; }
.mp-node-pct { width: 38px; text-align: right; font-weight: 600; flex-shrink: 0; }
.mp-sub { font-size: 11px; text-transform: uppercase; }
.mp-tpl { border: 1px solid var(--line); border-left: 4px solid; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.mp-tpl:hover { background: var(--surface-2); }
.mp-spark { width: 100%; height: 120px; margin: 8px 0; background: var(--surface-2); border-radius: 8px; }
.mp-ck-list .hist-item { display: grid; grid-template-columns: 130px 90px 110px 1fr; gap: 8px; }

/* Kanban Plan */
.mp-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.card.mp-blocked { box-shadow: 0 0 0 2px var(--bad) inset; }
.mp-flag { font-size: 11px; font-weight: 700; color: var(--bad); }
.mp-stuck { font-size: 11px; color: var(--muted); margin-top: 6px; }
.mp-stuck:hover { color: var(--bad); }
.mp-blocker-box { border-left: 3px solid var(--bad); }

/* @mention */
.comment-form { position: relative; }
.mention-sug { position: absolute; bottom: 100%; left: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--card-shadow); z-index: 20; min-width: 220px; }
.mention-opt { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.mention-opt:hover { background: var(--surface-2); }
.mention { color: var(--info); font-weight: 600; }

@media (max-width: 760px) {
  .mp-two { grid-template-columns: 1fr; }
  .mp-node { flex-wrap: wrap; padding-left: calc(4px + var(--d, 0) * 12px); }
  .mp-node-meta { white-space: normal; width: 100%; order: 5; padding-left: 22px; }
  .mp-node-bar { width: 70px; }
  .mp-ck-list .hist-item { grid-template-columns: 1fr 1fr; }
}
.mp-kpis { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .mp-kpis { grid-template-columns: repeat(2, 1fr); } }
.mp-planbar select[data-plan] { width: auto; max-width: 100%; }
.mp-remind a { color: inherit; font-weight: 600; text-decoration: underline; }
.mp-stuck.link-btn { background: transparent; padding: 2px 0; }
@media (max-width: 760px) {
  .mp-node-title { flex: 1 1 calc(100% - 40px); }
  .mp-node-bar { flex: 1; }
}

/* ── Master Plan Phase 2 ───────────────────────────────────── */
.mp-seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
/* Gantt */
.gt { display: flex; background: var(--surface); border-radius: 12px; box-shadow: var(--card-shadow); overflow: hidden; }
.gt-labels { width: 240px; flex-shrink: 0; border-right: 1px solid var(--line); }
.gt-scroll { flex: 1; overflow-x: auto; }
.gt-canvas { position: relative; }
.gt-head { height: 28px; line-height: 28px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line); padding: 0 8px; position: relative; }
.gt-ruler { padding: 0; }
.gt-tick { position: absolute; top: 0; height: 28px; font-size: 10px; padding-left: 3px; border-left: 1px solid transparent; white-space: nowrap; }
.gt-tick.major { border-left-color: var(--line-2); }
.gt-label { height: 30px; display: flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 12px; border-bottom: 1px solid var(--line); overflow: hidden; }
.gt-label > span:first-child, .gt-label b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gt-init { background: var(--surface-2); }
.gt-task { padding-left: 20px; }
.gt-dep-btn { padding: 0 6px; font-size: 11px; background: transparent; }
.gt-row { height: 30px; position: relative; border-bottom: 1px solid var(--line); }
.gt-row-init { background: var(--surface-2); }
.gt-bar { position: absolute; top: 7px; height: 16px; border-radius: 4px; background: color-mix(in srgb, var(--c) 30%, transparent); border: 1px solid var(--c); overflow: hidden; }
.gt-bar-init { top: 9px; height: 12px; }
.gt-fill { height: 100%; background: var(--c); opacity: .75; }
.gt-who { position: absolute; left: 4px; top: 0; font-size: 9px; line-height: 14px; font-weight: 700; color: var(--text); }
.gt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); opacity: .6; pointer-events: none; }
.gt-deps { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.gt-deps path { pointer-events: stroke; }
.mp-dep-list { max-height: 50vh; overflow: auto; flex-direction: column; align-items: flex-start; }
/* Workload */
.mp-wl-row { display: grid; grid-template-columns: 1.6fr 2fr .6fr .7fr .7fr .7fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.mp-wl-head { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.mp-wl-who { display: flex; align-items: center; gap: 8px; }
.mp-wl-bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.mp-wl-bar > div { height: 100%; }
/* Blocker */
.mp-bl { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 8px; margin-bottom: 8px; }
.mp-bl-old { border-left-color: var(--bad); }
.mp-bl-main { flex: 1; min-width: 0; font-size: 13px; }
.mp-bl-act { display: flex; gap: 6px; align-items: center; }
/* Custom fields */
.mp-cf-box { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 10px 0; }
.mp-cf-field { display: flex; flex-direction: column; gap: 3px; }
.mp-cf-row { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.mp-cf-row .muted { flex: 1; }
/* Share */
.mp-share-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.mp-share-row input { flex: 1; min-width: 200px; }
.share-page { background: var(--bg); min-height: 100vh; overflow: auto; }
.share-top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.share-top .brand-logo { width: 130px; height: 32px; }
.share-tabs { display: flex; gap: 6px; flex: 1; }
.share-main { max-width: 1200px; margin: 0 auto; padding: 16px; }
@media (max-width: 760px) {
  .gt-labels { width: 140px; }
  .mp-wl-row { grid-template-columns: 1fr 1fr; }
  .mp-wl-head { display: none; }
  .share-top { flex-wrap: wrap; padding: 10px 16px; }
}
.mp-planbar select.input { width: auto; max-width: 100%; }
.mp-bl a { color: var(--info); }

/* ── Master Plan Phase 3 ───────────────────────────────────── */
.mp-code { background: var(--surface-2); border-radius: 8px; padding: 10px; font-size: 11px; white-space: pre-wrap; word-break: break-all; max-height: 220px; overflow: auto; }
.mp-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.mp-map label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }

/* ── Việc của tôi ──────────────────────────────────────────── */
.mw-hello h2 { margin: 0 0 6px; font-size: 22px; }
.mw-sum { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.mw-sum b { font-size: 16px; color: var(--text); }
.mw-sum .bad b, .mw-sum .bad { color: var(--bad); }
.mw-sum .warn b, .mw-sum .warn { color: var(--warn); }
.mw-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }
.mw-sec summary { list-style: none; cursor: pointer; }
.mw-sec summary::-webkit-details-marker { display: none; }
.mw-sec h3 { display: inline; }
.mw-bad { border-left: 4px solid var(--bad); }
.mw-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mw-row:last-child { border-bottom: 0; }
.mw-main { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.mw-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.mw-status { width: auto; }
@media (max-width: 900px) { .mw-grid { grid-template-columns: 1fr; } .mw-row { flex-wrap: wrap; } }
.pf-more { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.pf-more[hidden] { display: none; }
.pf-hidden { background: var(--info-soft); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 10px; }

/* Viewer (sếp): chỉ xem — ẩn thao tác ghi */
body.is-viewer .comment-form,
body.is-viewer #modal-root [data-save],
body.is-viewer #modal-root [data-del],
body.is-viewer #modal-root [data-edit],
body.is-viewer #modal-root [data-stuck],
body.is-viewer #modal-root [data-resolve],
body.is-viewer #modal-root [data-brief-approve],
body.is-viewer #modal-root [data-brief-changes],
body.is-viewer .cd-actions,
body.is-viewer .btn-report-blocker { display: none !important; }
body.is-viewer #d-status, body.is-viewer .detail-actions select { pointer-events: none; opacity: .6; }

/* Toast có nút hành động (Hoàn tác) */
.toast .toast-act { margin-left: 10px; background: none; border: 0; color: #93c5fd; font-weight: 700; cursor: pointer; padding: 0; font: inherit; }
/* Việc của tôi: tick xong nhanh + dời hạn */
.mw-done { width: 18px; height: 18px; cursor: pointer; flex: none; accent-color: var(--primary); }
.mw-snooze { display: inline-flex; gap: 4px; }
.mw-snooze button { font-size: 11px; padding: 2px 7px; border: 1px solid var(--border, #e2e8f0); border-radius: 999px; background: transparent; color: inherit; cursor: pointer; white-space: nowrap; }
.mw-snooze button:hover { border-color: var(--primary); color: var(--primary); }
.view.no-anim > * { animation: none; }

/* Việc của tôi: thêm nhanh */
.mw-quick { display: flex; gap: 8px; margin: 0 0 16px; align-items: center; }
.mw-quick #mw-quick-title { flex: 1; min-width: 0; }
.mw-quick select { width: auto; }
@media (max-width: 600px) { .mw-quick { flex-wrap: wrap; } .mw-quick #mw-quick-title { flex-basis: 100%; } }

/* Tìm kiếm nhanh Ctrl/Cmd+K */
.qs-modal { width: min(620px, calc(100vw - 32px)); padding: 0; overflow: hidden; }
.qs-modal .qs-input { width: 100%; border: 0; border-bottom: 1px solid var(--border, #e2e8f0); border-radius: 0; padding: 16px 18px; font-size: 16px; background: transparent; color: inherit; outline: none; }
.qs-list { max-height: 60vh; overflow-y: auto; padding: 6px; }
.qs-item { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.qs-item.active, .qs-item:hover { background: var(--primary-soft, rgba(99,102,241,.12)); }
.qs-kind { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .6; width: 64px; flex: none; }
.qs-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-meta { font-size: 12px; opacity: .6; white-space: nowrap; }
.qs-hint { padding: 8px 14px; font-size: 11px; opacity: .55; border-top: 1px solid var(--border, #e2e8f0); }
.qs-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border, #e2e8f0); background: transparent; color: inherit; cursor: pointer; opacity: .8; }
.qs-btn kbd { font-family: inherit; font-size: 10px; opacity: .7; }
@media (max-width: 760px) { .qs-btn kbd { display: none; } }

/* Sidebar: nhóm thu gọn được */
.nav-section.nav-toggle { cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.nav-section.nav-toggle::after { content: "▾"; font-size: 10px; transition: transform .15s; }
.nav-section.nav-toggle.collapsed::after { transform: rotate(-90deg); }
.nav-group { display: contents; }
.nav-group.collapsed { display: none; }
@media (max-width: 760px) { .nav-group.collapsed { display: contents; } .nav-section.nav-toggle::after { display: none; } }

/* ===== Mobile: thanh tab dưới đáy + cửa sổ toàn màn hình ===== */
.tabbar { display: none; }
@media (max-width: 760px) {
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    background: var(--surface, #fff); border-top: 1px solid var(--border, #e2e8f0);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; color: var(--muted, #64748b); font: inherit; font-size: 10px; padding: 4px 0; cursor: pointer; }
  .tabbar button svg { width: 20px; height: 20px; }
  .tabbar button.active { color: var(--primary); font-weight: 700; }
  .tabbar .tab-new { flex: none; width: 48px; height: 48px; margin: -18px 6px 0; border-radius: 50%; background: var(--primary); color: #fff; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
  .tabbar .tab-new svg { width: 22px; height: 22px; }
  .shell { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }

  /* Sidebar: chỉ còn logo + tài khoản; Menu mở danh sách đầy đủ */
  .sidebar .nav { display: none; }
  .sidebar.nav-open .nav {
    display: flex; flex-direction: column; position: fixed; left: 0; right: 0; top: 0;
    bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 899; overflow-y: auto;
    background: var(--sb-bg); padding: 16px 12px; gap: 2px;
  }
  .sidebar.nav-open .nav-item { height: 44px; padding: 0 12px; }
  .sidebar.nav-open .nav-item span:not(.ni-icon):not(.nav-badge) { display: inline; }
  .sidebar.nav-open .nav-section.nav-toggle::after { display: inline; }
  .sidebar.nav-open .nav-group.collapsed { display: none; }
  .brand-logo { width: 140px; height: 34px; background-size: auto 34px; }
  .side-foot { width: auto; margin-top: 0; }
  .me-info { display: none; }

  /* Cửa sổ (modal) toàn màn hình, dễ bấm */
  .modal-overlay { padding: 0 !important; align-items: stretch !important; z-index: 950; }
  #toasts { z-index: 960; }
  .modal, .modal-lg { width: 100vw !important; max-width: 100vw !important; height: 100dvh; max-height: 100dvh !important; border-radius: 0 !important; display: flex; flex-direction: column; }
  .modal-sm { height: auto; margin: auto 16px; width: calc(100vw - 32px) !important; border-radius: 14px !important; }
  .modal-body { flex: 1; overflow-y: auto; }
  .modal-foot { position: sticky; bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .qs-modal { height: 100dvh; }
  .qs-list { max-height: none; flex: 1; }
  .input, select.input { font-size: 16px; }   /* tránh iOS tự zoom khi gõ */
  .mw-row { gap: 8px; }
  .toasts, #toasts { bottom: calc(80px + env(safe-area-inset-bottom)) !important; }
  #new-btn { display: none; }
}

/* Checklist & file đính kèm trong chi tiết */
.cl-box, .att-box { margin: 14px 0; }
.cl-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.cl-head h4 { margin: 0; }
.cl-bar { flex: 1; max-width: 160px; height: 6px; border-radius: 99px; background: var(--border, #e2e8f0); overflow: hidden; }
.cl-bar i { display: block; height: 100%; background: var(--good, #10b981); }
.cl-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.cl-item.done span { text-decoration: line-through; opacity: .55; }
.cl-item span { flex: 1; }
.cl-item .link-btn, .att-item .link-btn { opacity: .4; }
.cl-item:hover .link-btn, .att-item:hover .link-btn { opacity: 1; }
.cl-add { margin-top: 4px; }
.cl-add .input { width: 100%; }
.att-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.att-item a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--primary); }
.att-item .muted { font-size: 11px; white-space: nowrap; }
.att-drop { display: block; margin-top: 6px; padding: 12px; border: 1.5px dashed var(--border, #cbd5e1); border-radius: 10px; text-align: center; font-size: 12px; cursor: pointer; opacity: .8; }
.att-drop.over, .att-drop:hover { border-color: var(--primary); color: var(--primary); opacity: 1; }
.cmt-acts { margin-left: auto; display: inline-flex; gap: 8px; font-size: 11px; opacity: 0; }
.comment:hover .cmt-acts { opacity: 1; }
@media (hover: none) { .cmt-acts, .cl-item .link-btn, .att-item .link-btn { opacity: 1; } }

/* Thao tác hàng loạt (danh sách task) */
.bulk-cb { width: 16px; height: 16px; flex: none; cursor: pointer; accent-color: var(--primary); }
.list-row.selected { background: var(--primary-soft, rgba(99,102,241,.08)); }
.bulk-bar { position: sticky; bottom: 12px; z-index: 50; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface, #fff); border: 1px solid var(--primary); box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.bulk-bar select, .bulk-bar input { width: auto; }
.bulk-date { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
@media (max-width: 760px) { .bulk-bar { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* Chờ duyệt */
.apv-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border, #e2e8f0); }
.apv-row:last-child { border-bottom: 0; }
.apv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.apv-main small .bad { color: var(--bad); font-weight: 600; }
.apv-age { font-size: 12px; white-space: nowrap; }
.apv-acts { display: inline-flex; gap: 6px; }
.apv-fb { padding: 8px 0 12px; display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 760px) { .apv-row { flex-wrap: wrap; } .apv-main { flex-basis: 100%; } }

/* Lịch đăng */
.cc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cc-chans { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--c); background: transparent; color: inherit; cursor: pointer; opacity: .45; }
.cc-chip.on { background: var(--c); color: #fff; opacity: 1; }
.cc-hint { font-size: 12px; margin-left: auto; }
.cal-ev[draggable="true"] { cursor: grab; }
.cal-cell.drop-over { outline: 2px dashed var(--primary); outline-offset: -2px; background: var(--primary-soft, rgba(99,102,241,.08)); }

/* Xem trước file Final */
.fp-box { margin: 10px 0 4px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border, #e2e8f0); background: #000; max-width: 640px; }
.fp-box iframe { display: block; width: 100%; max-height: 70vh; border: 0; background: #fff; }
.fp-box img, .fp-box video { display: block; width: 100%; max-height: 70vh; object-fit: contain; }

/* Tổng kết tuần · Hiệu quả bài */
.mw-week { margin-left: auto; }
.ws-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.ws-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ws-kpis > div { padding: 12px; border-radius: 10px; border: 1px solid var(--border, #e2e8f0); display: flex; flex-direction: column; gap: 2px; }
.ws-kpis b { font-size: 22px; }
.ws-kpis b small { font-size: 13px; opacity: .6; }
.ws-kpis span { font-size: 12px; opacity: .65; }
.ws-kpis .bad b { color: var(--bad); }
.ws-text { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; }
.pm-box { margin: 14px 0; }
.pm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 8px; }
.pm-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.perf-scroll { overflow-x: auto; }
.perf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.perf-table th, .perf-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border, #e2e8f0); white-space: nowrap; }
.perf-table td:first-child { white-space: normal; min-width: 200px; }
.perf-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; opacity: .7; }
.perf-table th.sortable { cursor: pointer; }
.perf-table th.on { opacity: 1; color: var(--primary); }
.perf-table tbody tr:hover { background: var(--primary-soft, rgba(99,102,241,.06)); }
.perf-missing .link-btn { margin-right: 6px; }

/* Nút "Của tôi" trên bộ lọc */
.mine-toggle { border: 1px solid var(--border, #e2e8f0); background: transparent; color: inherit; font-weight: 600; }
.mine-toggle.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Chế độ tập trung */
body.focus-mode .sidebar, body.focus-mode .tabbar { display: none !important; }
body.focus-mode .view { max-width: 820px; margin: 0 auto; width: 100%; }
body.focus-mode .shell { padding-bottom: 0; }
.focus-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 14px; border-radius: 10px; background: var(--primary-soft, rgba(99,102,241,.1)); font-size: 13px; }
.focus-banner button { margin-left: auto; }

/* Kéo thả thứ tự trong Việc của tôi */
.mw-drag { cursor: grab; opacity: .35; padding: 0 2px; user-select: none; font-size: 14px; line-height: 1; }
.mw-row:hover .mw-drag { opacity: .8; }
.mw-row.sortable-ghost { opacity: .4; }
@media (hover: none) { .mw-drag { opacity: .6; } }

/* Trợ giúp */
#help-btn { font-weight: 800; font-size: 15px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.help-grid h4 { margin: 0 0 8px; }
.help-keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; font-size: 13px; }
.help-keys kbd, .tip-card kbd { font-family: inherit; font-size: 11px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border, #cbd5e1); background: var(--surface, #fff); white-space: nowrap; }
.help-tips { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; }
@media (max-width: 760px) { .help-grid { grid-template-columns: 1fr; } }
.tip-card { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 14px; border-radius: 10px; border: 1px dashed var(--primary); font-size: 13px; }
.tip-card .tip-acts { margin-left: auto; display: inline-flex; gap: 6px; white-space: nowrap; }
/* Thống kê sử dụng */
.usage-table td.zero { opacity: .4; }
.mp-tabs { margin-bottom: 14px; width: fit-content; max-width: 100%; overflow-x: auto; }

/* Quản lý tài khoản */
.member-row.member-off { opacity: .55; }
.tag-off { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--bad); color: #fff; vertical-align: middle; }
.acct-zone { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border, #e2e8f0); }
.acct-zone h4 { margin: 0 0 8px; }
.acct-acts { display: flex; flex-wrap: wrap; gap: 8px; }

/* Màn chào */
.welcome-modal { max-width: 440px; text-align: center; }
.welcome-modal .modal-body { padding: 28px 28px 8px; }
.wc-icon { font-size: 44px; line-height: 1; margin-bottom: 10px; }
.wc-title { margin: 0 0 8px; }
.wc-body { margin: 0; line-height: 1.6; min-height: 76px; }
.wc-dots { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.wc-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border, #cbd5e1); }
.wc-dots i.on { background: var(--primary); width: 18px; border-radius: 4px; }
.welcome-modal [data-skip] { margin-right: auto; }

/* Trang trống */
.empty-start { text-align: center; padding: 36px 20px; margin-bottom: 18px; border: 1.5px dashed var(--border, #cbd5e1); border-radius: 14px; }
.empty-start .es-icon { font-size: 40px; line-height: 1; }
.empty-start h3 { margin: 10px 0 6px; }
.empty-start p { max-width: 460px; margin: 0 auto 14px; }
.tag-pending { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: #f59e0b; color: #fff; vertical-align: middle; }

/* Slack */
.slack-chip { --c: #4A154B; font-size: 10px; }
.slack-box { border-left: 3px solid #4A154B; }
.slack-desc { margin: 8px 0 4px; padding: 8px 10px; border-radius: 8px; background: var(--surface, rgba(0,0,0,.04)); white-space: normal; }
