:root {
  --accent: #d97706;
  --accent-dark: #b45309;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --green: #16a34a;
  --yellow: #ca8a04;
  --red: #dc2626;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, sans-serif;
  --page-pad-x: clamp(20px, 3vw, 48px);
  --content-max: 1680px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 150px; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.hidden { display: none !important; }
.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--accent);
}
.muted { color: var(--muted); font-size: 0.875rem; }
.error { color: var(--red); font-size: 0.875rem; }

#app {
  padding: 0 0 48px;
}
.topbar-brand,
.modal-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-logo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(74, 0, 0, 0.18);
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.brand-logo--sticky {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}
.brand-logo--modal {
  width: 56px;
  height: 56px;
  border-radius: 12px;
}
.modal-brand h2 {
  margin: 4px 0 0;
}
.topbar-sub { margin: 4px 0 0; }

/* Sticky menu full: logo + brand + actions */
.sticky-menu {
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 0 0 20px;
  padding: 10px var(--page-pad-x) 0;
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.07);
}
.sticky-menu-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 100%;
  width: min(100%, var(--content-max));
  margin: 0 auto;
}
.sticky-brand {
  text-decoration: none;
  color: inherit;
  min-width: 0;
  flex: 1 1 auto;
}
.sticky-brand:hover .eyebrow { color: var(--accent-dark); }
.sticky-brand h1 {
  margin: 2px 0 0;
  font-size: 1.2rem;
  line-height: 1.25;
  white-space: nowrap;
}
.sticky-brand .eyebrow {
  font-size: 0.7rem;
}
.sticky-sub {
  margin: 2px 0 0;
  font-size: 0.8rem;
}
.sticky-menu-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-left: auto;
}
.sticky-menu-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.sticky-menu-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sticky-updated {
  font-size: 0.8rem;
  white-space: nowrap;
}
.sticky-menu .btn-primary,
.sticky-menu .btn-ghost {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.sticky-menu .btn-primary:not(.hidden) {
  animation: none;
}
@keyframes sticky-save-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(217, 119, 6, 0); }
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 500;
  transform: translateY(-150%);
  padding: 8px 12px;
  background: var(--text);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

.section-nav {
  width: min(100%, var(--content-max));
  margin: 8px auto 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  border-top: 1px solid var(--border);
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav-link {
  position: relative;
  flex: 0 0 auto;
  padding: 9px 12px 10px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.section-nav-link::after {
  content: '';
  position: absolute;
  right: 10px;
  bottom: 0;
  left: 10px;
  height: 2px;
  background: transparent;
}
.section-nav-link:hover { color: var(--text); }
.section-nav-link.is-active { color: var(--accent-dark); }
.section-nav-link.is-active::after { background: var(--accent); }

/* Nội dung chính có padding ngang (menu full-bleed) */
main {
  padding: 0 var(--page-pad-x);
  width: 100%;
  max-width: calc(var(--content-max) + (var(--page-pad-x) * 2));
  margin: 0 auto;
}

.mode-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
}
.mode-badge.mode-edit {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}
.user-badge {
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.btn-primary, .btn-ghost {
  min-height: 38px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.875rem;
}
.btn-primary {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 14px;
}
.btn-small {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  min-height: 36px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  margin-top: 4px;
}
.btn-small:hover { color: var(--text); border-color: var(--accent); }
.media-link-cell { display: flex; align-items: center; gap: 6px; min-width: 120px; }
.media-actions { width: 36px; text-align: center; }
.media-remove {
  border: none;
  background: transparent;
  color: var(--red);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.media-remove:hover { background: #fef2f2; }

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(217, 119, 6, 0.28);
  outline-offset: 2px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}
.tab.active { background: var(--accent); color: #fff; }
.panel { display: none; }
.panel.active { display: block; }

.period-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}
.period-bar select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.period-label { font-weight: 600; }
.section-title {
  margin: 28px 0 14px;
  font-size: 1rem;
  font-weight: 700;
}

.month-hint { margin: -8px 0 16px; font-size: 0.85rem; }

.sales-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.sales-panel, .mkt-costs-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.sales-panel-gross { border-top: 3px solid #7c3aed; }
.sales-panel-revenue { border-top: 3px solid #0369a1; }
.mkt-costs-panel {
  grid-column: 1 / -1;
  border-top: 3px solid var(--accent);
  margin-bottom: 8px;
}
.sales-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.collapsible-panel-head { align-items: center; }
.collapsible-panel-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.panel-toggle { white-space: nowrap; }
.mkt-costs-panel.is-collapsed .collapsible-panel-head,
.media-schedule-panel.is-collapsed .media-schedule-head,
.booking-costs-panel.is-collapsed .media-schedule-head { margin-bottom: 0; }
.sales-title { margin: 0; font-size: 1.2rem; font-weight: 800; }
.sales-sub { margin: 4px 0 0; font-size: 0.82rem; }
.sales-panel-meta { display: flex; align-items: center; gap: 8px; }
.sales-progress {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.sales-forecast { margin: 10px 0 0; font-size: 0.82rem; }
.sales-empty {
  grid-column: 1 / -1;
  padding: 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.source-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}
.metrics-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 0.875rem;
}
.metrics-table thead th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  background: #f8fafc;
}
.metrics-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.metrics-table tbody tr:last-child td { border-bottom: none; }
.metrics-table tbody tr:hover td { background: #fafbfc; }
.col-stt { width: 48px; text-align: center; color: var(--muted); font-weight: 600; }
.col-metric { width: 42%; font-weight: 600; }
.col-value { text-align: right; font-variant-numeric: tabular-nums; }
.mkt-api-value { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.mkt-sync-note { margin-top: 4px; font-size: 0.78rem; text-align: right; }
.mkt-summary-row td { background: #fffbeb; border-top: 2px solid var(--border); }
.metric-ok { color: var(--green); font-weight: 700; }
.metric-warn { color: var(--yellow); font-weight: 700; }
.metric-bad { color: var(--red); font-weight: 700; }

.progress-track-wrap {
  width: 100%;
}
.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-bar--ticks {
  overflow: visible;
  height: 10px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f59e0b);
  border-radius: 999px;
  position: relative;
  z-index: 1;
  transition: width 0.25s ease, background 0.25s ease;
}
.progress-fill.red { background: var(--red); }
.progress-fill.yellow { background: var(--yellow); }
/* 70%+ xanh nhạt */
.progress-fill.green-light {
  background: linear-gradient(90deg, #86efac, #4ade80);
}
/* 80%+ xanh vừa */
.progress-fill.green {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}
/* 90%+ xanh đậm */
.progress-fill.green-dark {
  background: linear-gradient(90deg, #15803d, #14532d);
}
/* 100% về đích */
.progress-fill.green-done {
  background: linear-gradient(90deg, #15803d, #052e16, #166534);
  box-shadow: 0 0 12px rgba(22, 163, 74, 0.45);
}

/* Mốc 10% trên thanh hoàn thành mục tiêu */
.progress-ticks {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.progress-tick {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: rgba(15, 23, 42, 0.22);
  transform: translateX(-50%);
}
.progress-tick[style*="left:0%"],
.progress-tick[style*="left:100%"] {
  background: rgba(15, 23, 42, 0.35);
  width: 2px;
}
.progress-tick-labels {
  position: relative;
  height: 14px;
  margin-top: 4px;
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1;
}
.progress-tick-label {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
  user-select: none;
}
.progress-tick-label[style*="left:0%"] {
  transform: translateX(0);
}
.progress-tick-label[style*="left:100%"] {
  transform: translateX(-100%);
}

.progress-bar--done {
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.25);
}
.progress-flag {
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translate(40%, -50%);
  font-size: 1rem;
  z-index: 3;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}
.progress-done-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #14532d;
  background: linear-gradient(90deg, #dcfce7, #bbf7d0);
  border: 1px solid #86efac;
  animation: progress-done-pop 0.45s ease;
}
@keyframes progress-done-pop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.progress-track-wrap.is-done .progress-tick-labels {
  color: #166534;
}

.media-schedule-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-top: 3px solid #7c3aed;
  padding: 20px 22px;
  margin-bottom: 24px;
}
.media-schedule-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.media-section-title { margin: 0 0 4px; }
.media-section-sub { margin: 0; max-width: 52ch; }
.media-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.media-stat {
  font-size: 0.8125rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
}
.media-stat-active { background: #fffbeb; border-color: #fde68a; }
.media-stat-done { background: #f0fdf4; border-color: #bbf7d0; }
.media-stat-gmv { background: #eff6ff; border-color: #bfdbfe; }
.media-stat-cost { background: #faf5ff; border-color: #e9d5ff; }
.media-open-link { color: #7c3aed; text-decoration: none; font-weight: 700; }
.media-empty td { text-align: center; color: var(--muted); padding: 28px 16px; }
.media-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.media-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.media-table-edit { min-width: 1280px; }
.media-table th, .media-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.media-table th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8fafc;
}
.booking-costs-panel { border-top-color: #2563eb; }
.booking-table { min-width: 820px; }
.booking-table-edit { min-width: 1040px; }
.booking-table th:first-child,
.booking-table td:first-child {
  width: 54px;
  min-width: 54px;
  text-align: center;
}
.booking-table th:nth-child(2),
.booking-table td:nth-child(2) { min-width: 190px; }
.booking-table th:nth-child(3),
.booking-table td:nth-child(3) { min-width: 115px; }
.booking-table th:nth-child(4),
.booking-table td:nth-child(4) { min-width: 145px; }
.booking-table th:nth-child(5),
.booking-table td:nth-child(5) { min-width: 145px; }
.booking-table th:nth-child(6),
.booking-table td:nth-child(6) { min-width: 140px; }
.booking-table th:nth-child(7),
.booking-table td:nth-child(7) { min-width: 210px; }
.booking-stt { color: var(--muted); font-weight: 700; }
.booking-costs-panel .media-select.status-muted { background: #f8fafc; color: var(--muted); }
.booking-costs-panel .media-select.status-green { background: #f0fdf4; border-color: #86efac; color: #166534; font-weight: 700; }
.media-input, .media-select {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
}
.status-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
}
.status-pill.status-green { background: #f0fdf4; color: #166534; }
.status-pill.status-yellow { background: #fffbeb; color: #a16207; }
.status-pill.status-red { background: #fef2f2; color: #b91c1c; }
.status-pill.status-muted { background: #f1f5f9; color: var(--muted); }
.note-cell { max-width: 180px; font-size: 0.82rem; color: var(--muted); }
.model-live-panel { border-top-color: #0f766e; }
.model-live-table-wrap {
  max-height: min(70vh, 720px);
  overflow: auto;
}
.model-live-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.model-live-table th:first-child,
.model-live-table td:first-child {
  position: sticky;
  left: 0;
  width: 170px;
  min-width: 170px;
  max-width: 170px;
  background: var(--surface);
  z-index: 1;
}
.model-live-table th:nth-child(2),
.model-live-table td:nth-child(2) {
  position: sticky;
  left: 170px;
  width: 90px;
  min-width: 90px;
  max-width: 90px;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border);
  z-index: 1;
}
.model-live-table th:first-child,
.model-live-table th:nth-child(2) {
  background: #f8fafc;
  z-index: 3;
}
.model-live-actions { display: flex; gap: 8px; margin-top: 12px; }
.model-live-day-off { border: 1px solid #f59e0b; background: #fffbeb; color: #92400e; border-radius: 6px; font: inherit; font-size: 0.72rem; padding: 3px 5px; cursor: pointer; margin-right: 2px; }
.model-live-weekday { display: block; margin-top: 4px; color: var(--muted); font-size: 0.72rem; }
.model-live-model-selects { display: grid; gap: 6px; min-width: 145px; }
.model-live-session-badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.model-live-row--lunch .model-live-session-badge { background: #dbeafe; color: #0369a1; }
.model-live-row--evening .model-live-session-badge { background: #dcfce7; color: #15803d; }
.model-live-row--lunch .model-live-session-select { background: #dbeafe; border-color: #7dd3fc; color: #0369a1; font-weight: 700; }
.model-live-row--evening .model-live-session-select { background: #dcfce7; border-color: #86efac; color: #15803d; font-weight: 700; }
.model-live-ads-input { min-width: 120px; text-align: right; }
.model-live-cost-rate { min-width: 92px; white-space: nowrap; text-align: right; }
.model-live-panel .media-select.status-muted { background: #fce7f3; border-color: #f9a8d4; color: #111827; font-weight: 700; }
.model-live-panel .media-select.status-green { background: #dcfce7; border-color: #86efac; color: #15803d; font-weight: 700; }
.model-live-panel .media-select.status-yellow { background: #fef3c7; border-color: #fcd34d; color: #92400e; font-weight: 700; }
.model-live-panel .media-select.status-red { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; font-weight: 700; }
.model-live-summary-wrap { margin-top: 16px; overflow-x: auto; }
.model-live-summary { width: 100%; min-width: 1100px; border-collapse: collapse; font-size: 0.8125rem; }
.model-live-summary th, .model-live-summary td { padding: 8px; border-bottom: 1px solid var(--border); text-align: right; }
.model-live-summary th:first-child, .model-live-summary td:first-child { text-align: left; }
.model-live-summary th { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; background: #f0fdfa; }
.model-live-assistant-row td { background: #eff6ff; }
.model-live-total td { font-weight: 700; background: #f0fdfa; }
.model-live-evening-wrap { margin-top: 18px; }
.model-live-summary-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.model-live-summary-title h4 { margin: 0; font-size: 0.95rem; }
.model-live-summary-title span { color: var(--muted); font-size: 0.75rem; }
.model-live-summary-scroll { overflow-x: auto; }
.model-live-evening-summary { min-width: 800px; }

.goals-grid, #goals-company {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  align-items: start;
}
.goal-title { margin: 0; font-size: 1.05rem; font-weight: 700; }
.goal-read-val { font-weight: 600; }
.goal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.goal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.goal-head h4 { margin: 0; font-size: 1rem; }
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.red { background: var(--red); }
.status-dot.yellow { background: var(--yellow); }
.status-dot.green-light { background: #4ade80; }
.status-dot.green { background: #16a34a; }
.status-dot.green-dark { background: #14532d; }
.status-dot.green-done {
  background: #166534;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.35);
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.goal-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.goal-note-wrap { grid-column: 1 / -1; }
.goal-fields label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.goal-fields input, .goal-fields textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
}
.goal-note { margin: 0; font-size: 0.875rem; }

.tasks-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.tasks-header h2 { margin: 0; font-size: 1.25rem; }
.tasks-actions { display: flex; gap: 10px; }
.tasks-stats { display: flex; gap: 12px; margin-bottom: 20px; }
.tasks-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.875rem;
}
.tasks-stat.warn { color: var(--red); }
.tasks-kanban {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  align-items: flex-start;
}
.tasks-column {
  flex: 0 0 min(300px, 85vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.tasks-column-head {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 12px;
}
.tasks-column-count { color: var(--muted); font-size: 0.8rem; }
.task-card {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
}
.task-card:hover { border-color: rgba(217, 119, 6, 0.35); }
.task-card-title { font-weight: 600; margin-bottom: 6px; }
.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}
.task-label {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
}
.task-due.overdue { color: var(--red); font-weight: 700; }
.task-check {
  height: 4px;
  background: #e2e8f0;
  border-radius: 999px;
  margin-top: 8px;
  overflow: hidden;
}
.task-check span {
  display: block;
  height: 100%;
  background: var(--green);
}
.tasks-empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.modal-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}
.modal-card h2 { margin: 8px 0; font-size: 1.35rem; }
.modal-card label {
  display: block;
  margin: 16px 0 6px;
  font-size: 0.875rem;
  font-weight: 600;
}
.modal-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
}
.modal-card button[type="submit"] {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.modal-close {
  margin-top: 12px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.875rem;
  z-index: 300;
}

.loading-msg {
  padding: 48px 20px;
  text-align: center;
  font-size: 0.95rem;
}

/* Mục tiêu doanh thu theo tháng */
.rev-targets-panel {
  margin: 0 0 20px;
  padding: 16px 18px 12px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px;
}
.rev-targets-panel .sales-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.add-month-control { display: flex; align-items: center; gap: 8px; }
.rev-target-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.add-month-control input { min-height: 34px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.remove-month-btn { margin-left: 6px; border: 0; background: transparent; color: #b91c1c; font-size: 1.1rem; line-height: 1; cursor: pointer; vertical-align: middle; }
.remove-month-btn:hover { color: #7f1d1d; }
.rev-year-total td { background: #ecfdf5; border-top: 2px solid #86efac; font-weight: 700; }
.rev-year-total .muted { font-weight: 400; }
.rev-targets-table th:nth-child(2),
.rev-targets-table td:nth-child(2) { min-width: 160px; }
.rev-target-input { width: 100%; min-width: 140px; }
.rev-rate-input { width: 72px; display: inline-block; }
.rev-month-link {
  border: none;
  background: none;
  color: var(--accent, #0f766e);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.rev-active-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  background: #f1f5f9;
  border-radius: 999px;
  padding: 1px 8px;
  vertical-align: middle;
}
.rev-target-row.is-active td { background: #f0fdfa; }

/* Dashboard refresh: overview-first, compact details, consistent sections */
.period-toolbar {
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.period-control { display: flex; align-items: center; gap: 10px; }
.period-control label { font-weight: 650; white-space: nowrap; }
.period-context { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.period-context-separator { width: 1px; height: 18px; background: var(--border); }
.period-sync-note { color: var(--muted); font-size: 0.8125rem; }

#overview-section,
#sales-section,
#costs-section,
#media-section,
#booking-section,
#model-live-section { scroll-margin-top: 150px; }

.dashboard-overview { margin-bottom: 16px; }
.overview-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.overview-heading h2 { margin: 0; font-size: 1.15rem; }
.overview-eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.overview-date { color: var(--muted); font-size: 0.78rem; }
.overview-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.overview-kpi {
  min-width: 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}
.overview-kpi-gross { border-left-color: #7c3aed; }
.overview-kpi-revenue { border-left-color: #0369a1; }
.overview-kpi-forecast { border-left-color: #16a34a; }
.overview-kpi-cost { border-left-color: #d97706; }
.overview-kpi > span { display: block; color: var(--muted); font-size: 0.75rem; font-weight: 650; }
.overview-kpi > strong {
  display: block;
  margin-top: 4px;
  font-size: 1.3rem;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.overview-kpi > small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.75rem; }

.daily-alerts {
  margin-top: 10px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #fed7aa;
  border-radius: 8px;
}
.daily-alerts-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.daily-alerts-head h2 { margin: 0; font-size: 0.875rem; }
.daily-alerts-head > span { color: var(--muted); font-size: 0.75rem; }
.daily-alert-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.daily-alert {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 12px;
  color: inherit;
  text-decoration: none;
  border-left: 1px solid var(--border);
}
.daily-alert:first-child { border-left: 0; padding-left: 0; }
.daily-alert:last-child { padding-right: 0; }
.daily-alert-dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--yellow); }
.daily-alert-critical .daily-alert-dot { background: var(--red); }
.daily-alert strong { display: block; font-size: 0.8125rem; }
.daily-alert small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.75rem; line-height: 1.4; }
.daily-alert:hover strong { color: var(--accent-dark); }

.sales-overview-section { margin-bottom: 16px; }
.sales-dashboard { gap: 16px; margin-bottom: 0; }
.sales-panel, .mkt-costs-panel, .media-schedule-panel, .rev-targets-panel { border-radius: 10px; }
.sales-panel { padding: 18px 20px; }
.sales-panel-head { margin-bottom: 14px; }
.sales-panel-meta { flex-wrap: wrap; justify-content: flex-end; }
.forecast-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}
.forecast-status-good { background: #f0fdf4; color: #166534; }
.forecast-status-warn { background: #fffbeb; color: #a16207; }
.forecast-status-bad { background: #fef2f2; color: #b91c1c; }
.forecast-status-neutral { background: #f1f5f9; color: var(--muted); }
.sales-primary-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.sales-primary-label, .sales-target span { display: block; color: var(--muted); font-size: 0.72rem; font-weight: 650; }
.sales-primary-value { display: block; margin-top: 2px; font-size: 1.45rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.sales-target { text-align: right; }
.sales-target strong { display: block; margin-top: 2px; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.sales-progress { margin-bottom: 5px; }
.sales-progress strong { color: var(--text); }
.progress-bar { height: 8px; }
.sales-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.sales-quick-item { min-width: 0; padding: 9px 10px; }
.sales-quick-item:nth-child(even) { border-left: 1px solid var(--border); }
.sales-quick-item:nth-child(n+3) { border-top: 1px solid var(--border); }
.sales-quick-item span { display: block; color: var(--muted); font-size: 0.7rem; }
.sales-quick-item strong { display: block; margin-top: 2px; font-size: 0.85rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sales-details-toggle { width: 100%; margin-top: 12px; padding: 7px 12px; }
.sales-details .metrics-table { margin-top: 12px; }

.rev-targets-panel { margin-bottom: 16px; padding: 16px 18px; }
.mkt-costs-panel { margin-bottom: 16px; padding: 18px 20px; }
.media-schedule-panel { margin-bottom: 16px; padding: 18px 20px; }
.media-table-wrap { border-radius: 8px; }
.media-stat { padding: 5px 10px; }
.metrics-table thead th, .media-table th { letter-spacing: 0; }
.col-value, .media-table td { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media (max-width: 900px) {
  :root { --page-pad-x: 14px; }
  .sales-dashboard { grid-template-columns: 1fr; }
  .overview-kpi-grid { grid-template-columns: 1fr 1fr; }
  .daily-alert-list { grid-template-columns: 1fr; }
  .daily-alert { border-left: 0; border-top: 1px solid var(--border); padding: 9px 0; }
  .daily-alert:first-child { border-top: 0; }
  .period-toolbar { align-items: flex-start; }
  .period-context { justify-content: flex-start; flex: 1 1 100%; }
  .tabs { flex-direction: column; }
  .rev-targets-panel .sales-panel-head { flex-direction: column; }
  .collapsible-panel-head { flex-direction: column; align-items: stretch; }
  .collapsible-panel-controls { width: 100%; justify-content: space-between; }
  .collapsible-panel-controls .media-stats { flex: 1 1 100%; }

  /* Mobile: sticky TOP vẫn gồm logo + brand (không đưa brand xuống đáy) */
  .sticky-menu {
    position: sticky;
    top: 0;
    padding: 8px 14px 0;
  }
  .sticky-menu-inner {
    gap: 10px;
  }
  .brand-logo--sticky {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }
  .sticky-brand {
    gap: 10px;
  }
  .sticky-brand h1 {
    font-size: 1rem;
    white-space: normal;
  }
  .sticky-sub {
    display: none; /* gọn trên mobile */
  }
  .sticky-menu-right {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    gap: 8px;
  }
  .sticky-menu-meta {
    flex: 1;
    min-width: 0;
  }
  .sticky-updated {
    display: none;
  }
  .sticky-menu-actions {
    flex: 0 0 auto;
  }
  .sticky-menu-actions .btn-primary,
  .sticky-menu-actions .btn-ghost {
    padding: 8px 12px;
    font-size: 0.8125rem;
  }
  .section-nav { margin-top: 7px; }
  .section-nav-link { padding: 8px 10px 9px; }
  #overview-section,
  #sales-section,
  #costs-section,
  #media-section,
  #booking-section,
  #model-live-section { scroll-margin-top: 160px; }
  .sales-panel, .mkt-costs-panel, .media-schedule-panel, .rev-targets-panel { padding: 16px; }
  .overview-kpi > strong { font-size: 1.15rem; }
  .sales-primary-value { font-size: 1.25rem; }
  .toast { right: 14px; bottom: 14px; left: 14px; text-align: center; }
}

@media (max-width: 520px) {
  .overview-heading { align-items: flex-start; }
  .overview-date { display: none; }
  .overview-kpi-grid { gap: 8px; }
  .overview-kpi { padding: 12px; }
  .overview-kpi > strong { font-size: 1rem; }
  .overview-kpi > small { font-size: 0.7rem; }
  .period-control { width: 100%; justify-content: space-between; }
  .period-control select { min-width: 128px; }
  .period-context-separator, .period-label { display: none; }
  .period-sync-note { line-height: 1.35; }
  .sales-primary-row { align-items: flex-start; flex-direction: column; gap: 6px; }
  .sales-target { text-align: left; }
  .collapsible-panel-controls { align-items: stretch; }
  .panel-toggle { width: 100%; }
  .media-stats { gap: 6px; }
  .media-stat { font-size: 0.75rem; padding: 4px 8px; }
}
