/* ==========================================================================
   TDC ANALYTICS — SWISS DESIGN / INTERNATIONAL TYPOGRAPHIC STYLE
   Strict modular grid · Typography-first · #ffffff / #111111 / #eb0029
   ========================================================================== */

:root {
  /* Swiss palette */
  --white: #ffffff;
  --obsidian: #111111;
  --black: #000000;
  --swiss-red: #eb0029;
  --swiss-red-hover: #c40022;
  --swiss-red-light: rgba(235, 0, 41, 0.06);
  --gray: #525252;

  /* Semantic (light context) */
  --text-main: #000000;
  --text-muted: #525252;
  --bg: #ffffff;
  --line-strong: #111111;   /* major rules */
  --line: #d4d4d4;          /* hairlines */
  --hover-wash: rgba(17, 17, 17, 0.045);

  /* Type */
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-heading: "Archivo Narrow", "Arial Narrow", Arial, sans-serif;
  --font-body: "Arimo", Arial, Helvetica, sans-serif;
  --font-mono: "SF Mono", "IBM Plex Mono", Menlo, Consolas, monospace;

  /* Grid */
  --container: 1320px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--white);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--swiss-red);
  color: #ffffff;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
}

.container {
  width: min(var(--container), 100% - (var(--gutter) * 2));
  margin-inline: auto;
}

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

/* --------------------------------------------------------------------------
   Navbar — white, red top rule, black hairline
   -------------------------------------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-top: 4px solid var(--swiss-red);
  border-bottom: 1px solid var(--obsidian);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1rem var(--gutter);
  flex-wrap: wrap;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  background: var(--swiss-red);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  color: var(--black);
  line-height: 1.1;
}

.brand-sub {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--gray);
  margin-top: 0.15rem;
}

.nav-tabs {
  display: flex;
  gap: 1.75rem;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.6rem 0 0.5rem;
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}

/* Tab dạng liên kết: chuyển sang ứng dụng Báo cáo Ads. */
.tab-link {
  text-decoration: none;
  align-items: center;
}
.tab-link:hover {
  color: var(--swiss-red);
}

.tab-label-short { display: none; }

.app-report-link {
  border-left: 1px solid var(--line);
  padding-left: 1.4rem;
  padding-right: 0.35rem;
  background: var(--hover-wash);
  color: var(--black);
}

.app-link-arrow {
  margin-left: -0.2rem;
  color: var(--swiss-red);
  font-size: 0.9rem;
}

.tab-btn:focus-visible {
  outline: 2px solid var(--swiss-red);
  outline-offset: 3px;
}

.tab-btn .tab-index {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--swiss-red);
}

.tab-btn:hover {
  color: var(--black);
}

.tab-btn.active {
  color: var(--black);
  border-bottom-color: var(--swiss-red);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--obsidian);
  padding: 0.5rem 0.9rem;
  font-family: var(--font-heading);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--black);
  white-space: nowrap;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--swiss-red);
  animation: swiss-blink 1.6s steps(2, start) infinite;
}

@keyframes swiss-blink {
  50% { opacity: 0.25; }
}

/* --------------------------------------------------------------------------
   Sections / tabs
   -------------------------------------------------------------------------- */
.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  flex: 1;
  padding: clamp(3rem, 6vw, 4.5rem) 0 clamp(4rem, 8vw, 6rem);
}

/* Section head — extreme typographic contrast */
.section-head {
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--swiss-red);
  margin-bottom: 1rem;
}

.kicker::after {
  content: "";
  width: 56px;
  height: 1px;
  background: currentColor;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  line-height: 0.95;
  color: var(--text-main);
}

.section-note {
  max-width: 62ch;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Stats — strict 4-column modular grid, hairline separations
   -------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 2px solid var(--line-strong);
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.stat-cell {
  padding: 1.9rem 1.5rem 2.2rem;
  border-left: 1px solid var(--line);
}

.stat-cell:first-child {
  border-left: none;
  padding-left: 0;
}

.stat-index {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--swiss-red);
  margin-bottom: 0.9rem;
}

.stat-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: clamp(1.85rem, 2.8vw, 2.9rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat-cell--red .stat-value {
  color: var(--swiss-red);
}

.stat-meta {
  display: block;
  margin-top: 0.8rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-meta.text-danger {
  color: var(--swiss-red);
}

/* --------------------------------------------------------------------------
   Action bar — underline fields, no chrome
   -------------------------------------------------------------------------- */
.action-bar {
  display: flex;
  align-items: flex-end;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.search-box {
  flex: 1;
  min-width: 240px;
  border-bottom: 1px solid var(--line-strong);
  padding: 0.55rem 0;
}

.search-box--narrow {
  flex: 0 1 220px;
  min-width: 180px;
}

.search-box:focus-within {
  border-bottom-color: var(--swiss-red);
  box-shadow: 0 1px 0 0 var(--swiss-red);
}

.search-box input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
}

.search-box input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.filter-group {
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.field-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.custom-select {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.65rem 0.75rem;
  outline: none;
  cursor: pointer;
  max-width: 260px;
}

.custom-select:focus {
  border-color: var(--swiss-red);
}

/* --------------------------------------------------------------------------
   Buttons — flat rectangles, uppercase
   -------------------------------------------------------------------------- */
.btn {
  border: none;
  border-radius: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--swiss-red);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--swiss-red-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn-secondary {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--line-strong);
}

.btn-secondary:hover {
  color: var(--swiss-red);
  border-color: var(--swiss-red);
}

.btn-success {
  background: var(--obsidian);
  color: #ffffff;
}

.btn-success:hover {
  background: var(--swiss-red);
}

.btn-sm {
  padding: 0.45rem 0.7rem;
}

/* --------------------------------------------------------------------------
   Table block
   -------------------------------------------------------------------------- */
.table-block {
  border-top: 2px solid var(--line-strong);
}

.table-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.25rem 0;
}

.table-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-main);
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 0.8rem 1rem;
  font-family: var(--font-heading);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 0;
}

.data-table td {
  padding: 1.05rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--text-main);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.data-table tbody tr:hover {
  background: var(--hover-wash);
}

.data-table code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--swiss-red);
}

/* Post thumbnail — square, no radius */
.post-thumb-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.post-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 0;
  background: var(--line);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Badges — flat rectangles, palette-only colors
   -------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border-radius: 0;
  font-family: var(--font-heading);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.badge-info {
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  background: transparent;
}

.badge-success {
  border: 1px solid var(--line-strong);
  color: var(--text-main);
  background: transparent;
}

.badge-warning {
  border: 1px solid var(--swiss-red);
  color: var(--swiss-red);
  background: transparent;
}

.tag-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 180px;
}

.tag-breakdown .badge {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
  letter-spacing: 0.02em;
}

.tag-more {
  align-self: center;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
}

.attribution-meta {
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.35;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Generator (tab 02) — two-column modular grid
   -------------------------------------------------------------------------- */
.generator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

.panel {
  border-top: 2px solid var(--line-strong);
  padding-top: 1.5rem;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-main);
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 2rem;
}

.form-group > label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.form-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  outline: none;
  padding: 0.6rem 0;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
}

.form-input:focus {
  border-bottom-color: var(--swiss-red);
  box-shadow: 0 1px 0 0 var(--swiss-red);
}

select.form-input {
  cursor: pointer;
  background: var(--white);
}

select.form-input option:disabled {
  color: #999999;
}

.field-help {
  margin-top: 0.55rem;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.code-output {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--swiss-red);
}

.generated-code-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
}

.generated-code-wrapper .form-input {
  flex: 1;
  min-width: 0;
}

.generated-code-wrapper .btn {
  flex-shrink: 0;
}

.card-footer-action {
  margin-top: 2.5rem;
}

.tracking-status-box {
  display: grid;
  gap: 0.3rem;
  border: 1px solid var(--swiss-red);
  padding: 0.9rem 1rem;
  color: var(--swiss-red);
  font-size: 0.78rem;
}

.tracking-status-box strong {
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tracking-status-box--ready {
  border-color: var(--line-strong);
  color: var(--text-main);
}

.lead-health-card,
.tracking-coverage-card {
  border-top: 3px solid var(--obsidian);
}

.lead-health-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.health-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.health-cell {
  min-width: 0;
  padding: 1rem;
  border-right: 1px solid var(--line);
}

.health-cell:last-child {
  border-right: 0;
}

.health-cell span {
  display: block;
  min-height: 2.2em;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
}

.health-cell strong {
  display: block;
  margin-top: 0.45rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
}

.health-cell--alert strong {
  color: var(--swiss-red);
}

.lead-health-note {
  border-top: 1px solid var(--line);
  padding: 0.8rem 1rem;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.source-hierarchy {
  display: grid;
  gap: 0.15rem;
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--line);
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.35;
}

.source-hierarchy strong {
  color: var(--text-main);
}

/* Ref list */
.ref-list {
  list-style: none;
}

.ref-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}

.ref-item strong {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.ref-item-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--swiss-red);
  margin-top: 0.3rem;
}

/* Ảnh + trích đoạn bài viết: nhận ra bài bằng mắt thay vì đọc Post ID trần. */
.ref-item-main {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.ref-item-thumb {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  background: #f2f2f2;
  display: block;
}

.ref-item-thumb-link { flex: 0 0 auto; line-height: 0; }

.ref-item-post {
  font-size: 0.78rem;
  color: #525252;
  margin-top: 0.3rem;
  max-width: 46ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ref-item-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .ref-item { flex-direction: column; align-items: stretch; }
  .ref-item-actions { justify-content: flex-start; }
  .ref-item-post { max-width: none; }
}

/* --------------------------------------------------------------------------
   Audit (tab 03)
   -------------------------------------------------------------------------- */
.audit-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.audit-val {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 2.4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Utilities (used by app.js dynamic rendering)
   -------------------------------------------------------------------------- */
.text-success { color: var(--text-main); font-weight: 700; }
.text-danger  { color: var(--swiss-red); }
.text-warning { color: var(--swiss-red); }
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--swiss-red); }

.mb-4 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1.5rem; }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--obsidian);
  border-left: 4px solid var(--swiss-red);
  color: #ffffff;
  padding: 1rem 1.5rem;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 380px;
  transition: opacity 0.3s ease;
}

/* --------------------------------------------------------------------------
   Runtime notice + Access Key modal (không phụ thuộc hộp thoại hệ thống)
   -------------------------------------------------------------------------- */
.runtime-notice {
  margin: 1rem auto 0;
  width: min(1180px, calc(100% - 2rem));
  border: 1px solid var(--swiss-red);
  background: #fff5f6;
  color: var(--obsidian);
  padding: 0.9rem 1rem;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.45;
}

.access-key-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(17, 17, 17, 0.72);
}

.access-key-modal[hidden],
.runtime-notice[hidden] {
  display: none !important;
}

/* Bản mở trực tiếp chỉ xem giao diện; chặn cả mã JavaScript cũ làm hiện modal. */
.file-preview .access-key-modal {
  display: none !important;
}

.access-key-card {
  width: min(460px, 100%);
  border: 2px solid var(--obsidian);
  background: var(--white);
  padding: 1.5rem;
  box-shadow: 12px 12px 0 var(--swiss-red);
}

.access-key-card h2 {
  margin: 0.5rem 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  text-transform: uppercase;
}

.access-key-card p {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.access-key-card label {
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.access-key-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

@media (max-width: 520px) {
  .access-key-actions {
    flex-direction: column-reverse;
  }

  .access-key-actions .btn {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Footer colophon
   -------------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--obsidian);
  padding: 1.25rem 0;
  background: var(--white);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gray);
}

.footer-mark {
  width: 10px;
  height: 10px;
  background: var(--swiss-red);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Responsive grid collapse
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat-cell:nth-child(odd) {
    border-left: none;
    padding-left: 0;
  }
  .stat-cell:nth-child(n+3) {
    border-top: 1px solid var(--line);
  }
  .generator-grid {
    grid-template-columns: 1fr;
  }
  .health-grid,
  .health-grid--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .health-cell:nth-child(2n) {
    border-right: 0;
  }
}

@media (max-width: 720px) {
  .navbar {
    justify-content: flex-start;
  }
  .nav-tabs {
    order: 3;
    width: 100%;
  }
  body:not(.admin-mode) .nav-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    overflow: visible;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  body.admin-mode .nav-tabs {
    gap: 1.25rem;
    overflow-x: auto;
  }
  .tab-btn {
    white-space: nowrap;
  }
  body:not(.admin-mode) .nav-tabs .tab-btn:not(.admin-only) {
    min-width: 0;
    min-height: 48px;
    justify-content: center;
    align-items: center;
    gap: 0.32rem;
    padding: 0.7rem 0.2rem 0.6rem;
    border-right: 1px solid var(--line);
    white-space: nowrap;
    text-align: center;
    font-size: 0.68rem;
    line-height: 1.15;
    letter-spacing: 0.04em;
  }
  body:not(.admin-mode) .nav-tabs .tab-btn:nth-child(3) {
    border-right: 0;
  }
  body:not(.admin-mode) .nav-tabs .app-report-link {
    border-left: 0;
    background: transparent;
  }
  body:not(.admin-mode) .tab-label-full { display: none; }
  body:not(.admin-mode) .tab-label-short { display: inline; }
  .status-badge {
    margin-left: auto;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stat-cell {
    border-left: none;
    padding-left: 0;
    padding-right: 0;
  }
  .stat-cell:nth-child(n+2) {
    border-top: 1px solid var(--line);
  }
  .action-bar {
    gap: 1.25rem;
  }
  .generated-code-wrapper {
    flex-wrap: wrap;
  }
  .health-grid,
  .health-grid--four {
    grid-template-columns: 1fr;
  }
  .health-cell {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

/* ============================================================
   THẺ BÀI VIẾT DÙNG CHUNG CHO TAB CHỌN BÀI
   ============================================================ */

/* Tab kỹ thuật: ẩn khỏi luồng thường, chỉ hiện khi mở link ?admin=1 */
.admin-only { display: none; }
body.admin-mode .admin-only { display: inline-flex; }

.simple-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.1rem;
}

.simple-card {
  background: #fff;
  border: 1px solid #e2e2e2;
  border-top: 3px solid var(--swiss-red);
  border-radius: 8px;
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.simple-card:hover {
  box-shadow: 0 6px 22px rgba(0,0,0,0.09);
  transform: translateY(-2px);
}

.simple-card-top { display: flex; gap: 0.8rem; align-items: flex-start; }
.simple-card-thumb {
  width: 60px; height: 60px; flex: 0 0 60px;
  object-fit: cover; border-radius: 6px; background: #eee;
  border: 1px solid #e2e2e2;
}
.simple-card-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-main);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.simple-card-metrics {
  display: flex;
  flex-wrap: wrap;              /* 4 ô từ 25/08 — màn hẹp thì xuống dòng */
  gap: 0.5rem 1.2rem;
  align-items: baseline;
  padding: 0.4rem 0 0.2rem;
  border-top: 1px solid #f0f0f0;
}
.simple-metric-num {
  font-family: var(--font-heading, inherit);
  /* 2rem cũ quá to từ khi ô hiển thị số tiền dài kiểu "15.061.337" (24/08) */
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--swiss-red);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.simple-metric-num.is-lead { color: var(--text-main); }
.simple-metric-label {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 3px;
}

.simple-card-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.simple-card-tags .badge { font-size: 0.74rem; padding: 3px 8px; }

.simple-card-note {
  font-size: 0.74rem;
  color: #8a6d00;
  font-weight: 600;
}

.simple-card-actions { margin-top: auto; }
.simple-card-actions .btn { width: 100%; justify-content: center; }

.simple-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  border: 1px dashed #d5d5d5;
  border-radius: 8px;
}

/* Khối "Tùy chọn nâng cao" trong tab Ref — gấp lại mặc định để bớt rối */
.advanced-block {
  margin: 1rem 0;
  border: 1px dashed #d5d5d5;
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  background: #fafafa;
}
.advanced-block summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
}
.advanced-block[open] summary { margin-bottom: 0.8rem; color: var(--text-main); }

/* ============================================================
   TAB CHỌN BÀI CHẠY ADS
   ============================================================ */
.quick-campaign {
  border-top: 2px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
  padding: 1.4rem 0;
  margin-bottom: 1.8rem;
}
.quick-campaign-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.quick-step {
  display: block;
  color: var(--swiss-red);
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.quick-campaign-title {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.05;
  text-wrap: balance;
}
.quick-safety {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  padding: 0.55rem 0.7rem;
  background: var(--obsidian);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}
.quick-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}
.quick-choice-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.quick-choice-group legend {
  margin-bottom: 0.65rem;
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}
.quick-choice-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.quick-choice {
  min-height: 42px;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text-main);
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 800;
}
.quick-choice:hover,
.quick-choice:focus-visible {
  border-color: var(--swiss-red);
  color: var(--swiss-red);
  outline: none;
}
.quick-choice.is-selected {
  border-color: var(--obsidian);
  background: var(--obsidian);
  color: #fff;
}
.quick-auto-summary {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  background: #fafafa;
  border-left: 3px solid var(--swiss-red);
}
.quick-auto-summary span,
.quick-auto-summary small {
  color: var(--text-muted);
  font-size: 0.76rem;
  text-wrap: pretty;
}
.quick-auto-summary strong {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.quick-load-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.3rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
.quick-load-row > div {
  display: grid;
  gap: 0.25rem;
}
.quick-load-row span {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-wrap: pretty;
}

.picker-card { position: relative; }
.picker-card.is-selected { border-color: var(--swiss-red); box-shadow: 0 0 0 2px var(--swiss-red-light); }
.picker-check {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; padding-bottom: 0.4rem; border-bottom: 1px solid #f0f0f0;
}
.picker-check input { width: 17px; height: 17px; accent-color: var(--swiss-red); cursor: pointer; }
.picker-date { font-size: 0.76rem; color: var(--text-muted); margin-top: 3px; }
.picker-reason { font-size: 0.76rem; color: var(--text-muted); margin-top: 4px; font-style: italic; }
.badge-purple { border: 1px solid #6f42c1; color: #6f42c1; }
.picker-package {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.55rem;
  align-items: baseline;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--swiss-red);
  background: #fafafa;
}
.picker-package-kicker {
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.picker-package strong {
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 0.88rem;
  text-transform: uppercase;
}
.picker-package > span:last-child {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.35;
}
.picker-package[data-package="TDC"] {
  border-left-color: var(--line-strong);
}
.picker-lead-stickers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}
.picker-lead-sticker {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--line);
  background: #fff;
}
.picker-lead-sticker strong {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  line-height: 1;
}
.picker-lead-sticker span {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.2;
}
.picker-lead-sticker.is-kdt {
  border-color: var(--swiss-red);
  background: var(--swiss-red-light);
}
.picker-lead-sticker.is-kdt strong {
  color: var(--swiss-red);
}
.picker-lead-sticker.is-customer {
  border-color: var(--line-strong);
}
.picker-lead-sticker.is-lead {
  background: #f4f4f4;
}

.picker-actionbar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: #fff; border: 2px solid var(--swiss-red); border-radius: 8px;
  padding: 0.8rem 1.1rem max(0.8rem, env(safe-area-inset-bottom)); margin-top: 1.4rem;
  box-shadow: 0 -4px 18px rgba(0,0,0,0.08);
}
.picker-actionbar[hidden] { display: none; }
.quick-confirm-summary {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.quick-confirm-summary span {
  color: var(--swiss-red);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}
.quick-confirm-summary strong {
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.quick-confirm-summary small {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-wrap: pretty;
}
.quick-confirm-action {
  display: grid;
  gap: 0.15rem;
  justify-items: end;
}
.quick-confirm-action .field-help {
  max-width: 42ch;
  margin-top: 0;
  text-align: right;
  text-wrap: pretty;
}

.picker-results { margin-top: 1.2rem; }
.picker-results-title { font-size: 0.95rem; margin-bottom: 0.5rem; }
.picker-result-line {
  font-size: 0.84rem; padding: 6px 0; border-bottom: 1px dashed #e6e6e6;
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}

/* Dòng tổng kết sau khi tạo xong, kèm nút mở thẳng Ads Manager. */
.picker-result-done {
  margin-top: 0.6rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--swiss-red);
  background: #ffffff;
  font-size: 0.9rem;
}

.picker-open-link { margin-top: 0.5rem; }

.btn-ads-manager {
  border-color: var(--swiss-red);
  color: var(--swiss-red);
  font-weight: 600;
}

.btn-ads-manager:hover {
  background: var(--swiss-red);
  color: #ffffff;
}

@media (max-width: 640px) {
  .quick-campaign-head,
  .quick-load-row {
    align-items: stretch;
    flex-direction: column;
  }
  .quick-choice-grid { grid-template-columns: 1fr; }
  .quick-auto-summary { grid-column: auto; }
  .quick-load-row .btn { width: 100%; }
  .picker-actionbar { flex-direction: column; align-items: stretch; }
  .quick-confirm-action { justify-items: stretch; }
  .quick-confirm-action .field-help { max-width: none; text-align: left; }
}

/* Bài album — Meta không cho chạy quảng cáo trực tiếp */
.picker-card.is-blocked { opacity: 0.75; border-top-color: #b3b3b3; }
.picker-card.is-blocked .picker-check { color: #8a6d00; }
.picker-card.needs-message-cta { border-top-color: #1877f2; }
.picker-card.needs-message-cta .picker-check { color: #1877f2; }
.picker-repair-note {
  font-size: 0.78rem; color: #0f4f98; background: #eef6ff;
  border: 1px solid #b8d8ff; border-radius: 5px; padding: 6px 8px;
}
.picker-blocked-note {
  font-size: 0.78rem; color: #8a6d00; background: #fff8e1;
  border: 1px solid #f0e0a0; border-radius: 5px; padding: 6px 8px;
}

/* Khung nhúng báo cáo tổng hợp (trang riêng đã mã hoá) */
.khung-bao-cao { display: flex; flex-direction: column; gap: 0; }
.bao-cao-thanh {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0.9rem; border: 1px solid var(--line, #e4e4e4);
  border-bottom: none; border-radius: 10px 10px 0 0; background: #fafafa;
  font-size: 0.8rem; color: var(--gray, #525252); flex-wrap: wrap;
}
.bao-cao-mo { color: var(--red, #eb0029); font-weight: 700; text-decoration: none; white-space: nowrap; }
.bao-cao-mo:hover { text-decoration: underline; }
#khung-bao-cao {
  width: 100%; height: calc(100vh - 170px); min-height: 560px;
  border: 1px solid var(--line, #e4e4e4); border-radius: 10px; background: #fff;
}

/* ---------- Dùng lại / nhân bản nhóm quảng cáo ---------- */
.quick-reuse {
  margin: 1.1rem 0 0.4rem;
  padding: 0 0 1rem;
  border-bottom: 1px solid var(--line);
}
.reuse-body {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.9rem;
}
.reuse-search,
.reuse-select {
  width: 100%;
  padding: 0.62rem 0.7rem;
  font: inherit;
  font-size: 0.86rem;
  color: var(--text-main);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.reuse-search:focus,
.reuse-select:focus {
  outline: none;
  border-color: var(--swiss-red);
  box-shadow: 0 0 0 3px var(--swiss-red-light);
}
.reuse-select { font-variant-numeric: tabular-nums; }
.reuse-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.15rem;
}
@media (max-width: 640px) {
  .reuse-actions .btn { flex: 1 1 100%; justify-content: center; }
}

/* Nút phụ: viền đen, nền trắng — nhấn mạnh thấp hơn nút đỏ tạo camp. */
.btn-ghost {
  background: var(--white);
  color: var(--text-main);
  border: 1px solid var(--obsidian);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--obsidian);
  color: var(--white);
}
.btn-ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: var(--line);
  color: var(--text-muted);
}

/* ============================================================
   Phân tích bài — tab "Bài nên chạy Ads" (nền sáng Swiss)
   ============================================================ */
.badge-danger {
  border: 1px solid var(--swiss-red);
  color: #fff;
  background: var(--swiss-red);
}

.analyze-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.analyze-status { font-size: 0.85rem; color: var(--text-muted); }

.analyze-group { margin-bottom: 1.8rem; }

.analyze-group-head { margin-bottom: 0.8rem; border-bottom: 1px solid var(--line-strong); padding-bottom: 0.4rem; }
.analyze-group-head h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-main);
}
.analyze-group-head p { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.analyze-group-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 0.4rem;
}

/* Màu mép trên phân biệt nhóm — vẫn trong tông sáng, chữ đen nền trắng. */
.analyze-card--tang { border-top-color: #0f7b3b; }
.analyze-card--giam { border-top-color: var(--swiss-red); }
.analyze-card--thu { border-top-color: #6f42c1; }
.analyze-card--theo-doi { border-top-color: var(--gray); }

.analyze-week { font-size: 0.8rem; color: var(--text-muted); }
.analyze-trend.is-up { color: #0f7b3b; font-weight: 700; }
.analyze-trend.is-down { color: var(--swiss-red); font-weight: 700; }

.analyze-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.analyze-notes {
  margin-top: 1.2rem;
  padding: 0.8rem 1rem;
  border: 1px dashed var(--line);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Gộp phân tích vào màn Chọn bài (24/08): đầu nhóm chiếm trọn hàng lưới. */
.picker-group-head {
  grid-column: 1 / -1;
  margin: 0.6rem 0 0;
}
.picker-group--tang h3 { color: #0f7b3b; }
.picker-group--giam h3 { color: var(--swiss-red); }
.picker-group--thu h3 { color: #6f42c1; }

.picker-old-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px dashed var(--line);
  padding: 4px 8px;
}

/* Mã Post ID trên thẻ — bấm để copy ID đầy đủ. */
.post-id-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--line);
  padding: 1px 5px;
  cursor: pointer;
}
.post-id-chip:hover { color: var(--text-main); border-color: var(--line-strong); }

/* Cân lại cỡ chữ khối phân tích (24/08: số dài làm thẻ bị to). */
.analyze-group-head h3 { font-size: 0.95rem; }
.analyze-week { font-size: 0.76rem; }

/* Nhãn bài đang có ad ACTIVE trên Meta (24/08). */
.badge-active {
  border: 1px solid #0f7b3b;
  color: #0f7b3b;
  background: rgba(15, 123, 59, 0.07);
}

/* Cảnh báo bài hút khách rác (≥3 rác và ≥20% số tin). */
.rac-warning {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--swiss-red);
  border: 1px solid var(--swiss-red);
  background: var(--swiss-red-light);
  padding: 5px 8px;
}

/* Ghi chú của Thái trên từng bài. */
.post-note {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
.post-note-text {
  font-size: 0.82rem;
  color: var(--text-main);
  background: rgba(17, 17, 17, 0.04);
  border-left: 3px solid var(--line-strong);
  padding: 5px 8px;
  white-space: pre-wrap;
  width: 100%;
}
.post-note-input {
  width: 100%;
  font: inherit;
  font-size: 0.85rem;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  resize: vertical;
}
.post-note-actions { display: flex; gap: 0.5rem; }

/* Chế độ "Sửa chữ giao diện": chỗ gõ được viền đứt đỏ cho dễ thấy. */
.sua-text [data-suatext][contenteditable="true"] {
  outline: 2px dashed var(--swiss-red);
  outline-offset: 2px;
  cursor: text;
  min-width: 2ch;
}
.sua-text [data-suatext][contenteditable="true"]:focus {
  outline-style: solid;
  background: var(--swiss-red-light);
}

/* Nhãn định dạng bài trên thẻ Chọn bài (25/08): Video / Hình ảnh / Album…
   Chip nhỏ, tương phản cao, đứng ngay trước dòng "Đăng ngày". */
.post-format {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.5;
  padding: 1px 6px;
  margin-right: 4px;
  border: 1px solid var(--line-strong);
  color: var(--text-main);
  background: #fff;
  white-space: nowrap;
}
.post-format--video { border-color: #6f42c1; color: #6f42c1; background: rgba(111, 66, 193, 0.07); }
.post-format--photo,
.post-format--album { border-color: #0f6fb8; color: #0f6fb8; background: rgba(15, 111, 184, 0.07); }
.post-format--link { border-color: #0f7b3b; color: #0f7b3b; background: rgba(15, 123, 59, 0.07); }
.post-format--text,
.post-format--khac { border-color: var(--line-strong); color: var(--text-muted); }

/* ---------- Chọn bài: thanh chuyển Thẻ/Bảng + bảng bài viết (26/08/2026) ----------
   Nền trắng, chữ phụ #525252, nhấn đỏ #eb0029 — giữ đúng tông sáng của dashboard. */
.picker-viewbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.9rem;
}
.picker-viewbar-left { display: flex; gap: 0; }
.picker-view-btn {
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--text-main);
  font: 600 0.8rem/1 inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.95rem;
  cursor: pointer;
}
.picker-view-btn + .picker-view-btn { border-left: 0; }
.picker-view-btn.is-on { background: var(--line-strong); color: var(--white); }
.picker-sort { display: flex; align-items: center; gap: 0.4rem; }
.picker-sort > span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.picker-sort select {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--text-main);
  font: 0.82rem/1.2 inherit;
  padding: 0.42rem 0.5rem;
}
.picker-viewbar-note { font-size: 0.74rem; color: var(--text-muted); }

.picker-table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.picker-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.picker-table th,
.picker-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.6rem;
  text-align: left;
  vertical-align: top;
}
.picker-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--white);
  border-bottom: 1px solid var(--line-strong);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}
.picker-table td.so,
.picker-table th.so { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.picker-table tbody tr:hover td { background: var(--hover-wash); }
.picker-table tbody tr.is-selected td { background: var(--swiss-red-light); }
.picker-table tbody tr.is-readonly td { color: var(--text-muted); }
.picker-td-check { width: 2.2rem; text-align: center; }
.picker-td-post { display: flex; gap: 0.55rem; align-items: flex-start; min-width: 15rem; }
.picker-td-thumb { width: 40px; height: 40px; object-fit: cover; flex: none; border: 1px solid var(--line); }
.picker-td-text { min-width: 0; }
.picker-td-title {
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 26rem;
}
.picker-cell-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }
/* Rác là con số phải đập vào mắt trước tiên — cùng tông đỏ với cột Rác bên Báo cáo. */
.picker-rac-num { color: var(--swiss-red); font-size: 1.05rem; font-weight: 800; }
.picker-td-rac { background: var(--swiss-red-light); }
.picker-th-sort {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}
.picker-th-sort:hover { color: var(--text-main); text-decoration: underline; }
.picker-th-sort.is-on { color: var(--swiss-red); }
.picker-th-sort.is-on::after { content: ' ▼'; font-size: 0.65em; }
@media (max-width: 720px) {
  .picker-td-title { max-width: 12rem; }
  .picker-table { font-size: 0.8rem; }
}
.picker-mong { color: var(--text-muted); font-style: italic; }
