:root {
  /* ivory / cream base */
  --cream: #f4f1e9;
  --paper: #ffffff;

  /* brand — black + gold (Chanel-inspired) */
  --ink: #17140f;
  --ink-soft: #3a352d;
  --gold: #ad8a53;
  --gold-soft: #ece1c8;

  /* legacy aliases kept so existing rules still resolve */
  --pink: #ece1c8;
  --rose: #423b32;

  /* status: priority-high */
  --red: #be0c0c;

  /* status: priority-complete */
  --green: #52603f;
  --green-light: #e7e4d4;

  /* status: informational accent */
  --blue: #5c6560;
  --blue-light: #e9e6de;

  /* status: priority-medium */
  --orange: #a97c33;
  --orange-light: #f1e6cd;

  --yellow: #d9c79a;

  --text: #201c17;
  --muted: #8a8073;
  --muted-light: #b7ad9c;

  --border: #e3ddd0;

  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --shadow: 0 10px 28px rgba(20, 15, 10, 0.12);
  --shadow-sm: 0 4px 14px rgba(20, 15, 10, 0.08);
}

/* =========================================================
   RESET
========================================================= */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--text);
  font-family: "Bai Jamjuree", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

button,
input,
select,
textarea {
  font-family: "Bai Jamjuree", sans-serif;
}
button {
  cursor: pointer;
  -webkit-appearance: none;
}

/* =========================================================
   LAYOUT
========================================================= */

.main {
  width: calc(100% - 28px); /* มือถือ: เว้นขอบซ้ายขวาข้างละ 14px */
  max-width: 800px; /* กันไม่ให้กว้างเกินบนแท็บเล็ต */
  margin: 0 auto;
  padding: 16px 0 28px;
}

.tab-page {
  display: none;
}
.tab-page.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* =========================================================
   TOP BAR
========================================================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(23, 20, 15, 0.94);
  border-bottom: 1px solid rgba(173, 138, 83, 0.35);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  width: calc(100% - 28px);
  max-width: 800px;
  height: 58px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid rgba(173, 138, 83, 0.55);
  background: var(--ink);
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
}

.brand-copy {
  text-align: left;
}

.brand-copy strong {
  display: block;
  max-width: 175px;
  overflow: hidden;
  color: #f4f1e9;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy span {
  display: block;
  margin-top: 1px;
  color: var(--gold);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 1.4px;
}

.live-pill {
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(173, 138, 83, 0.4);
  border-radius: 999px;
  background: transparent;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.live-pill i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(173, 138, 83, 0.22);
}

/* =========================================================
   TRACKER HEADER (mascot / title / help)
========================================================= */

.tracker-header {
  padding: 6px 2px 4px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tracker-mascot {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  border: 1px solid rgba(173, 138, 83, 0.5);
  background: var(--ink);
  color: var(--gold);
  font-size: 19px;
}

.tracker-header-copy {
  flex: 1;
  min-width: 0;
}

.tracker-header-copy h1 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tracker-header-sub {
  display: block;
  margin-top: 2px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
}

.tracker-help {
  flex: 0 0 auto;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--gold-soft);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.tracker-help span {
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(173, 138, 83, 0.3);
  color: var(--gold);
  font-size: 10px;
}

/* SYNC ROW */

.sync-row {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.sync-box {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  text-align: center;
}

.sync-box span {
  display: block;
  color: var(--muted);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.8px;
}
.sync-box strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}
.hero-nav-updated {
  display: none;
}

/* CAMPAIGN FILTER */

.campaign-filter-row {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.campaign-select-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
}

.campaign-select-wrap select {
  width: 100%;
  height: 42px;
  padding: 0 30px 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: 0;
  appearance: none;
  background: var(--paper);
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
}

.select-chevron {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--gold);
  font-size: 11px;
}

.priority-dots {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
}

.dot-count {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
}

.dot-count i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.dot-red i {
  background: var(--red);
}
.dot-orange i {
  background: var(--orange);
}
.dot-green i {
  background: var(--green);
}

/* SUMMARY LINE */

.tracker-summary {
  margin-top: 12px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.tracker-summary strong {
  color: var(--ink);
  font-weight: 700;
}
.tracker-summary i {
  margin: 0 5px;
  font-style: normal;
  color: var(--muted-light);
}

/* SHOW ALL BUTTON */

.show-all-button {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--gold-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.priority-section .priority-grid {
  margin-bottom: 12px;
}

/* =========================================================
   HERO (legacy, unused on Home but kept for reference)
========================================================= */

.campaign-hero {
  padding: 22px;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, #f7bcc1 0%, #f6d3c4 55%, #f4e6c4 100%);
  box-shadow: var(--shadow);
}

.campaign-hero::after {
  content: "";
  width: 160px;
  height: 160px;
  position: absolute;
  right: -60px;
  top: -70px;
  border-radius: 50%;
  border: 24px solid rgba(255, 255, 255, 0.22);
}

.hero-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.75);
  color: var(--red);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.9px;
}

.hero-sync {
  text-align: right;
}

.hero-sync span {
  display: block;
  color: rgba(75, 50, 40, 0.55);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.hero-sync strong {
  display: block;
  margin-top: 2px;
  color: #4b3228;
  font-size: 10px;
}

.campaign-hero h1 {
  margin: 16px 0 8px;
  position: relative;
  z-index: 2;
  color: var(--red);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1.6px;
}

.hero-description {
  max-width: 320px;
  margin: 0;
  position: relative;
  z-index: 2;
  color: #5b4034;
  font-size: 11px;
  line-height: 1.6;
}

.hero-bottom {
  margin-top: 20px;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-ring {
  width: 74px;
  height: 74px;
  flex: 0 0 74px;
  padding: 6px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(
    var(--green) 0%,
    var(--green) 0%,
    rgba(255, 255, 255, 0.6) 0%
  );
}

.hero-ring-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--paper);
}

.hero-ring strong {
  color: var(--green);
  font-size: 15px;
  font-weight: 700;
}
.hero-ring span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 5px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hero-refresh span {
  display: block;
  color: rgba(75, 50, 40, 0.55);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.7px;
}

.hero-refresh strong {
  display: block;
  margin-top: 3px;
  color: #4b3228;
  font-size: 12px;
}

.hero-nav-updated {
  display: none;
}

/* =========================================================
   COMMON SECTION
========================================================= */

.section {
  margin-top: 30px;
}

.section-head {
  margin-bottom: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  display: block;
  color: var(--red);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1.1px;
}
.eyebrow.green {
  color: var(--green);
}
.eyebrow.blue {
  color: var(--blue);
}
.eyebrow.orange {
  color: var(--orange);
}
.eyebrow.pink {
  color: var(--rose);
}

.section-head h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.text-link {
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
}

/* =========================================================
   KPI
========================================================= */

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.metric-card {
  padding: 15px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.metric-comments {
  background: linear-gradient(150deg, #fff8ed, #f8d6d2);
}
.metric-likes {
  background: linear-gradient(150deg, #fff8ed, #f7d5df);
}
.metric-views {
  background: linear-gradient(150deg, #fffaf0, #dce9cf);
}
.metric-shares {
  background: linear-gradient(150deg, #fffaf0, #dbe6f3);
}

.metric-header {
  display: flex;
  align-items: center;
  gap: 7px;
}
.metric-header > span {
  color: var(--muted);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.metric-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.metric-comments .metric-icon {
  color: var(--red);
}
.metric-likes .metric-icon {
  color: var(--rose);
}
.metric-views .metric-icon {
  color: var(--green);
}
.metric-shares .metric-icon {
  color: var(--blue);
}

.metric-value {
  display: block;
  margin-top: 12px;
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.6px;
}

.metric-meta {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.metric-meta span {
  color: var(--muted);
  font-size: 10px;
}
.metric-meta strong {
  color: var(--text);
  font-size: 10px;
}

.progress-track {
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(90, 60, 45, 0.1);
}

.progress-track div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.35s ease;
}

.metric-comments .progress-track div {
  background: var(--red);
}
.metric-likes .progress-track div {
  background: var(--rose);
}
.metric-views .progress-track div {
  background: var(--green);
}
.metric-shares .progress-track div {
  background: var(--blue);
}

/* SAVES */

.save-card {
  margin-top: 9px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.save-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.save-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(221, 100, 116, 0.13);
  color: var(--rose);
  font-size: 14px;
}

.save-left span {
  display: block;
  color: var(--muted);
  font-size: 6px;
  font-weight: 700;
}
.save-left strong {
  display: block;
  margin-top: 1px;
  font-size: 14px;
}

.save-progress {
  flex: 1;
  min-width: 0;
}
.save-progress .progress-track div {
  background: var(--rose);
}

/* =========================================================
   HEALTH
========================================================= */

.health-main {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(140deg, var(--blue-light), #f8f1dd);
  box-shadow: var(--shadow-sm);
}

.health-label {
  color: var(--muted);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.health-value {
  display: block;
  margin-top: 6px;
  color: var(--blue);
  font-size: 30px;
  font-weight: 700;
}

.health-ring {
  width: 74px;
  height: 74px;
  flex: 0 0 74px;
  padding: 6px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(
    var(--blue) 0%,
    var(--blue) 0%,
    rgba(255, 255, 255, 0.7) 0%
  );
}

.health-ring > div {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--paper);
}

.health-ring strong {
  color: var(--blue);
  font-size: 13px;
}
.health-ring span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 5px;
  font-weight: 700;
}

.health-mini-row {
  margin-top: 9px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.health-mini {
  padding: 15px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.health-mini > span {
  color: var(--muted);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.health-mini-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 12px;
}

.health-mini > strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.health-orange {
  background: linear-gradient(150deg, var(--paper), var(--orange-light));
}
.health-orange .health-mini-icon {
  background: rgba(229, 148, 84, 0.16);
  color: var(--orange);
}

.health-green {
  background: linear-gradient(150deg, var(--paper), var(--green-light));
}
.health-green .health-mini-icon {
  background: rgba(78, 142, 81, 0.13);
  color: var(--green);
}

/* =========================================================
   PAGE TITLE
========================================================= */

.page-title {
  margin: 4px 0 20px;
}

.page-title h1 {
  margin: 4px 0 5px;
  color: var(--text);
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: -1px;
}

.page-title p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

/* =========================================================
   FILTER
========================================================= */

.filter-panel {
  margin-bottom: 12px;
}

.filter-chips {
  margin-bottom: 9px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.filter-chip.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--gold-soft);
}

.select-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.select-row select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: 0;
  background: var(--paper);
  color: var(--text);
  font-size: 10px;
}

.post-summary {
  margin-bottom: 14px;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.post-summary div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.post-summary strong {
  color: var(--text);
  font-size: 13px;
}
.post-summary span {
  color: var(--muted);
  font-size: 6px;
  font-weight: 700;
}
.post-summary i {
  width: 1px;
  height: 18px;
  background: var(--border);
}

/* =========================================================
   PRIORITY / POSTS GRID
========================================================= */

.priority-grid,
.posts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

/* =========================================================
   TRACKER CARD (compact, bordered)
========================================================= */

.tracker-card {
  min-width: 0;
  padding: 12px;
  border: 4px solid var(--muted-light);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.tracker-card:active {
  transform: scale(0.98);
}

.tracker-card.priority-high {
  border-color: var(--red);
}
.tracker-card.priority-medium {
  border-color: var(--orange);
}
.tracker-card.priority-complete {
  border-color: var(--green);
}
.tracker-card.priority-unavailable {
  border-color: var(--muted-light);
}

.tracker-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tracker-thumb {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--cream);
}

.tracker-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.tracker-thumb.tracker-thumb-fallback {
  border: 1px solid rgba(173, 138, 83, 0.4);
}

.tracker-thumb span {
  color: var(--gold);
  font-size: 14px;
}

.tracker-card-head {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.tracker-title-line {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tracker-title-line span {
  color: var(--muted);
  font-weight: 500;
}

.tracker-likes {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.tracker-numbers {
  margin-top: 9px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 7px;
}

.tracker-fraction {
  display: flex;
  align-items: baseline;
  gap: 3px;
}
.tracker-fraction strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.tracker-fraction span {
  color: var(--muted-light);
  font-size: 10px;
}

.tracker-left {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 3px;
}
.tracker-left strong {
  color: var(--red);
  font-size: 10px;
  font-weight: 700;
}
.tracker-left span {
  color: var(--muted-light);
  font-size: 6px;
  font-weight: 700;
}

.tracker-percent {
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
}

.tracker-progress {
  height: 5px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(90, 60, 45, 0.09);
}

.tracker-progress div {
  height: 100%;
  border-radius: inherit;
}
.priority-high .tracker-progress div {
  background: var(--red);
}
.priority-medium .tracker-progress div {
  background: var(--orange);
}
.priority-complete .tracker-progress div {
  background: var(--green);
}
.priority-unavailable .tracker-progress div {
  background: var(--muted-light);
}

.tracker-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tracker-open,
.tracker-comment {
  min-height: 34px;
  border-radius: 10px;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.tracker-open {
  border: 1px solid var(--border);
  background: var(--cream);
  color: var(--ink);
}
.tracker-open:disabled {
  opacity: 0.4;
}
.tracker-comment {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--gold-soft);
}

/* =========================================================
   CHART
========================================================= */

.chart-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chart-header > div:first-child span {
  display: block;
  color: var(--green);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.7px;
}
.chart-header > div:first-child strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 13px;
}

.chart-legend {
  display: flex;
  gap: 12px;
}
.chart-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 7px;
}
.chart-legend i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.dot-like {
  background: var(--rose);
}
.dot-comment {
  background: var(--red);
}
.dot-view {
  background: var(--green);
}

.chart-wrapper {
  height: 240px;
  margin-top: 16px;
}

/* =========================================================
   INSIGHT LIST
========================================================= */

.insight-list {
  display: grid;
  gap: 8px;
}

.insight-row {
  padding: 13px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.insight-title {
  grid-column: 1 / -1;
}
.insight-title strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.insight-title span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.insight-value span {
  display: block;
  color: var(--muted-light);
  font-size: 8px;
}
.insight-value strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 10px;
}

.data-guide {
  margin-top: 22px;
  padding: 15px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  border-radius: var(--radius-sm);
  background: var(--blue-light);
}

.data-guide-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-weight: 700;
  font-size: 11px;
}
.data-guide strong {
  color: var(--text);
  font-size: 10px;
}
.data-guide p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}
.data-guide-values {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.data-guide-values span {
  color: var(--muted);
  font-size: 10px;
}
.data-guide-values b {
  margin-right: 3px;
  color: var(--text);
}

/* =========================================================
   LEARN
========================================================= */

.learn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.learn-card {
  min-height: 145px;
  padding: 15px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.learn-red,
.learn-blue,
.learn-green,
.learn-orange {
  background: linear-gradient(155deg, #fffaf2, #ece1cc);
}

.learn-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.learn-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  font-weight: 700;
}
.learn-red .learn-icon {
  color: var(--red);
}
.learn-blue .learn-icon {
  color: var(--blue);
}
.learn-green .learn-icon {
  color: var(--green);
}
.learn-orange .learn-icon {
  color: var(--orange);
}

.learn-top > span {
  color: var(--muted);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.7px;
}

.learn-card h2 {
  margin: 12px 0 0;
  color: var(--text);
  font-size: 20px;
}
.learn-card > strong {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
}
.learn-more {
  margin-top: 12px;
  color: var(--red);
  font-size: 10px;
  font-weight: 700;
}
.learn-blue .learn-more {
  color: var(--blue);
}
.learn-green .learn-more {
  color: var(--green);
}
.learn-orange .learn-more {
  color: var(--orange);
}

/* GLOSSARY */

.glossary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.glossary-card {
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.glossary-symbol {
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  display: grid;
  place-items: center;
  border-radius: 9px;
}
.glossary-symbol.pink {
  background: #fde8e5;
  color: var(--rose);
}
.glossary-symbol.blue {
  background: var(--blue-light);
  color: var(--blue);
}
.glossary-symbol.green {
  background: var(--green-light);
  color: var(--green);
}
.glossary-symbol.orange {
  background: var(--orange-light);
  color: var(--orange);
}

.glossary-card strong {
  color: var(--text);
  font-size: 10px;
}
.glossary-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

/* =========================================================
   MODAL (bottom sheet)
========================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  padding: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(60, 45, 40, 0.45);
  backdrop-filter: blur(5px);
}

.modal-overlay.active {
  display: flex;
}

.comment-modal,
.knowledge-modal {
  width: 100%;
  max-height: calc(90vh - env(safe-area-inset-bottom));
  overflow-y: auto;
  position: relative;
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  box-shadow: 0 -12px 40px rgba(60, 45, 40, 0.2);
}

.comment-modal {
  padding: 12px 18px calc(20px + env(safe-area-inset-bottom));
}
.knowledge-modal {
  padding: 12px 18px calc(20px + env(safe-area-inset-bottom));
}

.modal-handle {
  width: 36px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: var(--muted-light);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-eyebrow {
  color: var(--gold);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.8px;
}
.modal-header h2 {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 19px;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff9ee;
  color: var(--text);
  font-size: 16px;
}

.modal-post-info {
  margin-top: 15px;
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--blue-light);
}
.modal-post-info span {
  color: var(--blue);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.6px;
}
.modal-post-info strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-post-info small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 7px;
}

.comment-field {
  margin-top: 17px;
}
.comment-field label {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.comment-field label > span {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fde8e5;
  color: var(--red);
  font-size: 7px;
  font-weight: 700;
}
.comment-field label strong {
  display: block;
  color: var(--text);
  font-size: 10px;
}
.comment-field label small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 7px;
}

.comment-category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.comment-category {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fffaf0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}
.comment-category.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--gold-soft);
}

.comment-field select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--paper);
  color: var(--text);
  font-size: 10px;
}

.comment-result {
  width: 80%;
  margin-top: 17px;
  padding: 15px;
  border-radius: 16px;
  background: linear-gradient(150deg, var(--orange-light), #fff8ec);
}
.comment-result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.comment-result-top span {
  color: var(--red);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.6px;
}
.comment-result-top strong {
  color: var(--muted);
  font-size: 7px;
}

.comment-result-text {
  min-height: 100px;
  margin-top: 10px;
  padding: 15px;
  display: flex;
  align-items: center;
  border: 1px dashed rgba(201, 77, 82, 0.28);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.comment-modal-actions {
  margin-top: 11px;
  display: flex;
  gap: 8px;
  width: 20%;
  flex-direction: column;
}
.random-button,
.copy-button {
  min-height: 64px;
  width: 100%;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
}
.random-button {
  border: 1px solid var(--border);
  background: #fffaf0;
  color: var(--text);
}
.copy-button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--gold-soft);
}

/* KNOWLEDGE MODAL */

.knowledge-close {
  position: absolute;
  top: 16px;
  right: 18px;
}
.knowledge-badge {
  width: max-content;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.7px;
}
.knowledge-modal h2 {
  margin: 15px 0 2px;
  color: var(--ink);
  font-size: 26px;
}
.knowledge-subtitle {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 10px;
}
.knowledge-body {
  color: var(--text);
  font-size: 10px;
  line-height: 1.65;
}

.knowledge-block {
  margin-top: 10px;
  padding: 13px;
  border-radius: 12px;
  background: #fff8eb;
}
.knowledge-block strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
}

.formula {
  margin-top: 10px;
  padding: 14px;
  border-radius: 12px;
  background: var(--blue-light);
  color: #557eb8;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.knowledge-warning {
  margin-top: 10px;
  padding: 12px;
  border-radius: 11px;
  background: #fbefcf;
  color: #88672b;
  font-size: 10px;
}

.knowledge-done {
  width: 100%;
  height: 44px;
  margin-top: 16px;
  border: 1px solid var(--ink);
  border-radius: 12px;
  background: var(--ink);
  color: var(--gold-soft);
  font-size: 10px;
  font-weight: 700;
}

/* =========================================================
   MOBILE NAV
========================================================= */

.mobile-nav {
  height: calc(64px + env(safe-area-inset-bottom));
  padding: 7px 8px env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  border-top: 1px solid rgba(173, 138, 83, 0.3);
  background: rgba(23, 20, 15, 0.97);
  backdrop-filter: blur(16px);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(244, 241, 233, 0.55);
}

.mobile-nav-item > span {
  font-size: 16px;
  line-height: 1;
}
.mobile-nav-item small {
  font-size: 6px;
  font-weight: 700;
}
.mobile-nav-item.active {
  background: rgba(173, 138, 83, 0.18);
  color: var(--gold);
}

/* =========================================================
   LOADING
========================================================= */

.loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--cream);
}

.loading.active {
  display: flex;
}

.loader {
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  border: 3px solid var(--gold-soft);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.loading strong {
  color: var(--text);
  font-size: 10px;
}
.loading span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================
   TOAST
========================================================= */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 7000;
  padding: 10px 16px;
  transform: translate(-50%, 10px);
  border-radius: 12px;
  background: #3c322e;
  color: #fff8ed;
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  box-shadow: 0 12px 32px rgba(60, 45, 38, 0.2);
}

.toast.active {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* =========================================================
   SMALL PHONES
========================================================= */

@media (max-width: 340px) {
  .campaign-hero h1 {
    font-size: 28px;
  }
  .learn-grid {
    grid-template-columns: 1fr;
  }
  .health-mini-row {
    grid-template-columns: 1fr;
  }
}
