/* ==========================================================================
   TSH Tử Vi Đẩu Số v2.0 — Oriental Editorial UI/UX
   ========================================================================== */

.tv {
  --tv-bg: #fcfaf5;
  --tv-surface: #ffffff;
  --tv-surface-warm: #f7f2e8;
  --tv-ink: #1a1f2e;
  --tv-ink-soft: #434b5f;
  --tv-mut: #6b7280;
  --tv-line: #e5dec9;
  --tv-line-strong: #cfc2a3;
  --tv-indigo: #1a213d;
  --tv-indigo-mid: #28335c;
  --tv-indigo-light: #eef1fa;
  --tv-gold: #b37d22;
  --tv-gold-bright: #d4a64a;
  --tv-gold-bg: #fdf7e9;
  --tv-red: #a82828;
  --tv-red-bg: #fdf0ef;
  --tv-green: #186a42;
  --tv-green-bg: #eaf6ef;
  --tv-amber: #a16207;
  --tv-amber-bg: #fef7e6;
  --tv-radius: 16px;
  --tv-radius-sm: 10px;
  --tv-shadow: 0 10px 30px rgba(26, 33, 61, 0.06);
  --tv-shadow-sm: 0 4px 14px rgba(26, 33, 61, 0.05);
  --tv-serif: "Noto Serif", "Playfair Display", Georgia, "Times New Roman", serif;
  --tv-sans: "Be Vietnam Pro", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  box-sizing: border-box;
  max-width: 1120px;
  margin: 0 auto 48px;
  color: var(--tv-ink);
  font-family: var(--tv-sans);
  font-size: 15.5px;
  line-height: 1.65;
  text-align: left;
  -webkit-font-smoothing: antialiased;
}
.tv *, .tv *::before, .tv *::after { box-sizing: border-box; }
.tv h2, .tv h3, .tv h4, .tv h5, .tv p, .tv ul, .tv dl { margin: 0; }
.tv a { color: var(--tv-indigo-mid); text-underline-offset: 3px; }
.tv-muted { color: var(--tv-mut); font-size: 0.875rem; font-weight: 400; }

/* Ngũ Hành màu sao chuẩn Tử Vi (WCAG ≥ 4.5:1) */
.tv-hanh-kim  { color: #475569; }
.tv-hanh-moc  { color: #166534; }
.tv-hanh-thuy { color: #1e4b85; }
.tv-hanh-hoa  { color: #a82828; }
.tv-hanh-tho  { color: #9a6008; }

/* ================== HERO & HEADER ================== */
.tv-hero, .tv-rh {
  position: relative;
  overflow: hidden;
  padding: 32px 34px;
  border-radius: 20px;
  background: radial-gradient(circle at 88% 18%, rgba(212, 166, 74, 0.22) 0%, transparent 45%),
              linear-gradient(135deg, #12172b 0%, #1d2647 55%, #2a3461 100%);
  color: #ffffff;
  border: 1px solid rgba(212, 166, 74, 0.35);
  box-shadow: 0 18px 40px rgba(18, 23, 43, 0.16);
}
.tv-hero::after, .tv-rh::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(212, 166, 74, 0.18);
  border-radius: 13px;
  pointer-events: none;
}
.tv-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 4px 13px;
  border-radius: 999px;
  background: rgba(212, 166, 74, 0.16);
  border: 1px solid rgba(212, 166, 74, 0.45);
  color: #f3d799 !important;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.tv-hero h2, .tv-rh h2 {
  font-family: var(--tv-serif);
  color: #ffffff;
  font-size: clamp(1.45rem, 3.8vw, 2.15rem);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.tv-hero p {
  margin-top: 10px;
  max-width: 680px;
  color: rgba(255, 255, 255, 0.88) !important;
  font-size: 0.98rem;
}
.tv-rh__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.tv-rh__badge {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(212, 166, 74, 0.3);
  backdrop-filter: blur(6px);
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.9);
}
.tv-rh__badge strong {
  color: #f3d799;
  font-family: var(--tv-serif);
  font-size: 1rem;
}
.tv-meta {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.92);
}
.tv-meta b {
  margin-right: 4px;
  color: #eccd86;
  font-weight: 600;
}

/* ================== FORM NHẬP LIỆU ================== */
.tv-box {
  margin-top: 20px;
  padding: 30px 32px;
  background: var(--tv-surface);
  border: 1px solid var(--tv-line);
  border-radius: 18px;
  box-shadow: var(--tv-shadow);
}
.tv-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 22px;
}
.tv-field--full { grid-column: 1 / -1; }
.tv-alert {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: var(--tv-radius-sm);
  background: var(--tv-red-bg);
  border: 1px solid #f5c2c0;
  color: var(--tv-red);
  font-weight: 600;
  font-size: 0.94rem;
}
.tv-field { margin: 0; padding: 0; border: 0; }
.tv-field > label, .tv-field > legend {
  display: block;
  margin: 0 0 7px;
  padding: 0;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--tv-indigo);
}
.tv-field input[type="text"],
.tv-field input[type="number"],
.tv-field select {
  display: block;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--tv-line-strong);
  border-radius: var(--tv-radius-sm);
  background: #fff;
  color: var(--tv-ink);
  font-family: inherit;
  font-size: 0.96rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.tv-field input:focus, .tv-field select:focus {
  border-color: var(--tv-gold);
  box-shadow: 0 0 0 3px rgba(179, 125, 34, 0.16);
  outline: none;
}
.tv-field small { display: block; margin-top: 6px; line-height: 1.5; }
.tv-row3 { display: grid; grid-template-columns: 1fr 1fr 1.35fr; gap: 10px; }
.tv-radios { display: flex; gap: 10px; }
.tv-radios label { flex: 1; position: relative; cursor: pointer; }
.tv-radios input { position: absolute; opacity: 0; pointer-events: none; }
.tv-radios span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 46px;
  border: 1px solid var(--tv-line-strong);
  border-radius: var(--tv-radius-sm);
  background: #fff;
  font-weight: 700;
  color: var(--tv-ink-soft);
  transition: all 0.18s ease;
}
.tv-radios input:checked + span {
  border-color: var(--tv-indigo);
  background: var(--tv-indigo);
  color: #f3d799;
  box-shadow: 0 4px 12px rgba(26, 33, 61, 0.18);
}
.tv-form-submit { margin-top: 22px; }

/* Nút bấm */
.tv-btn, .tv a.tv-btn, .tv button.tv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 48px;
  padding: 0 24px;
  border: 1.5px solid var(--tv-indigo);
  border-radius: var(--tv-radius-sm);
  background: linear-gradient(135deg, #1a213d 0%, #2a3561 100%);
  color: #f9e6ba;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.tv-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(26, 33, 61, 0.22);
  color: #fff;
}
.tv-btn--gold {
  border-color: var(--tv-gold);
  background: linear-gradient(135deg, #b37d22 0%, #c99432 100%);
  color: #fff;
}
.tv-btn--ghost, .tv a.tv-btn--ghost {
  background: #fff;
  color: var(--tv-indigo);
  border-color: var(--tv-line-strong);
}
.tv-btn--ghost:hover {
  background: var(--tv-surface-warm);
  border-color: var(--tv-gold);
  color: var(--tv-indigo);
  box-shadow: none;
}
.tv-btn--sm { min-height: 38px; padding: 0 14px; font-size: 0.86rem; border-radius: 8px; }
.tv-box .tv-btn { width: 100%; }

.tv-form-highlights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}
.tv-hl-item {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--tv-surface-warm);
  border: 1px solid var(--tv-line);
  font-size: 0.86rem;
}
.tv-hl-item strong {
  display: block;
  color: var(--tv-indigo);
  margin-bottom: 3px;
  font-size: 0.9rem;
}
.tv-foot {
  margin-top: 18px;
  color: var(--tv-mut);
  font-size: 0.84rem;
  text-align: center;
}

/* ================== STATUS, TOOLBAR & STICKY NAV ================== */
.tv-status {
  margin-top: 14px;
  padding: 10px 16px;
  border-radius: var(--tv-radius-sm);
  background: var(--tv-green-bg);
  border: 1px solid #bce3cc;
  color: var(--tv-green);
  font-size: 0.9rem;
  font-weight: 500;
}
.tv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0 12px;
}
.tv-toolbar__left, .tv-toolbar__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.tv-year-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: var(--tv-surface);
  border: 1px solid var(--tv-line-strong);
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--tv-ink-soft);
}
.tv-year-switch select {
  border: 0;
  background: transparent;
  font-weight: 700;
  color: var(--tv-indigo);
  font-size: 0.88rem;
  cursor: pointer;
  padding: 4px 2px;
}
.tv-toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--tv-line-strong);
  background: #fff;
  color: var(--tv-ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tv-toggle-chip.is-on {
  background: var(--tv-gold-bg);
  border-color: var(--tv-gold);
  color: var(--tv-amber);
}

/* Thanh điều hướng nhanh */
.tv-nav {
  position: sticky;
  top: 12px;
  z-index: 25;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 10px;
  margin: 0 0 18px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--tv-line);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(26, 33, 61, 0.07);
  scrollbar-width: none;
}
.tv-nav::-webkit-scrollbar { display: none; }
.tv-nav a {
  flex: none;
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--tv-ink-soft);
  text-decoration: none;
  transition: all 0.15s ease;
}
.tv-nav a:hover, .tv-nav a.is-current {
  background: var(--tv-indigo);
  color: #f3d799;
}

/* ================== LÁ SỐ 12 CUNG (THIÊN BÀN) ================== */
.tv-chart-wrap {
  position: relative;
  margin: 8px 0 14px;
}
.tv-chart {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, minmax(168px, auto));
  gap: 0;
  border: 2.5px solid var(--tv-indigo);
  outline: 4px solid var(--tv-surface-warm);
  outline-offset: -7px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--tv-bg);
  box-shadow: 0 14px 36px rgba(26, 33, 61, 0.1);
}
.tv-chart-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
}
.tv-chart.hide-lines .tv-chart-svg { opacity: 0; }
.tv-chart.hide-luu .tv-cell__luu { display: none; }

.tv-cell {
  position: relative;
  padding: 9px 10px;
  border: 1px solid #d9cfb8;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #ffffff;
  font-size: 0.78rem;
  line-height: 1.38;
  cursor: pointer;
  transition: background-color 0.18s ease, box-shadow 0.18s ease;
}
.tv-cell:hover { background: #fdfbf6; }
.tv-cell.is-menh {
  background: linear-gradient(180deg, #fffaf0 0%, #fffdf7 100%);
  box-shadow: inset 0 0 0 1.5px rgba(179, 125, 34, 0.45);
}
.tv-cell.is-active {
  background: #fdf6e4 !important;
  box-shadow: inset 0 0 0 2px var(--tv-gold) !important;
  z-index: 3;
}
.tv-cell.is-tamhop {
  background: #f3f6fd !important;
  box-shadow: inset 0 0 0 1.5px #4e67a8 !important;
  z-index: 2;
}
.tv-cell.is-xungchieu {
  background: #fef3f2 !important;
  box-shadow: inset 0 0 0 1.5px #c4544c !important;
  z-index: 2;
}

.tv-c5 { grid-area: 1 / 1; } .tv-c6 { grid-area: 1 / 2; } .tv-c7 { grid-area: 1 / 3; } .tv-c8 { grid-area: 1 / 4; }
.tv-c4 { grid-area: 2 / 1; } .tv-c9 { grid-area: 2 / 4; }
.tv-c3 { grid-area: 3 / 1; } .tv-c10 { grid-area: 3 / 4; }
.tv-c2 { grid-area: 4 / 1; } .tv-c1 { grid-area: 4 / 2; } .tv-c0 { grid-area: 4 / 3; } .tv-c11 { grid-area: 4 / 4; }

/* Thiên Bàn ở giữa */
.tv-center {
  grid-area: 2 / 2 / 4 / 4;
  position: relative;
  padding: 20px 22px;
  border: 1px solid #d9cfb8;
  background: radial-gradient(circle at center, #ffffff 0%, #faf5e9 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  font-size: 0.88rem;
}
.tv-seal {
  display: inline-block;
  margin-bottom: 4px;
  padding: 2px 10px;
  border: 1.5px solid var(--tv-red);
  border-radius: 4px;
  color: var(--tv-red);
  font-family: var(--tv-serif);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.tv-center h4 {
  font-family: var(--tv-serif);
  font-size: 1.24rem;
  font-weight: 700;
  color: var(--tv-indigo);
  margin-bottom: 4px;
}
.tv-center__grid {
  width: 100%;
  max-width: 360px;
  margin: 6px 0;
  padding: 10px 12px;
  border-top: 1px solid var(--tv-line);
  border-bottom: 1px solid var(--tv-line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
  text-align: left;
  font-size: 0.82rem;
}
.tv-center__grid span { color: var(--tv-mut); display: block; font-size: 0.72rem; }
.tv-center__grid b { color: var(--tv-ink); font-weight: 700; }
.tv-center__rel {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--tv-indigo);
  color: #f3d799 !important;
  font-size: 0.76rem;
  font-weight: 700;
}
.tv-legend {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--tv-mut);
  line-height: 1.6;
}

.tv-cell__h {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding-bottom: 4px;
  border-bottom: 1px dashed #e7dfc9;
}
.tv-cell__chi { color: var(--tv-mut); font-size: 0.7rem; font-weight: 600; }
.tv-cell__cung {
  font-family: var(--tv-serif);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--tv-indigo);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.tv-cell__dv {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--tv-gold-bg);
  color: var(--tv-amber);
  font-weight: 800;
  font-size: 0.72rem;
}
.tv-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tv-flag {
  font-size: 0.64rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}
.tv-flag--menh { background: var(--tv-red); color: #fff; }
.tv-flag--than { background: var(--tv-indigo); color: #f3d799 !important;  }
.tv-flag--han  { background: var(--tv-gold); color: #fff; }

.tv-cell__main { margin: 2px 0; }
.tv-main {
  font-weight: 800;
  font-size: 0.88rem;
  line-height: 1.35;
}
.tv-vcd { color: var(--tv-mut); font-style: italic; font-size: 0.74rem; }

.tv-cell__aux {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
}
.tv-cell__aux span { font-size: 0.72rem; line-height: 1.3; }
.aux-cat { color: #166534; font-weight: 500; }
.aux-hung { color: #b42318; font-weight: 500; }
.aux-trung { color: #64748b; }

.tv-cell__luu {
  font-size: 0.68rem;
  color: #8a5600;
  background: #fef6e4;
  border-left: 2px solid var(--tv-gold);
  border-radius: 3px;
  padding: 2px 5px;
  line-height: 1.3;
}
.tv-cell__f {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--tv-mut);
  font-size: 0.69rem;
  gap: 4px;
}
.tt {
  display: inline-block;
  margin-left: 3px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--tv-indigo);
  color: #f3d799;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.sg {
  display: inline-block;
  padding: 0 4px;
  border-radius: 3px;
  font-style: normal;
  font-weight: 700;
  font-size: 0.64rem;
  vertical-align: middle;
  color: #fff;
}
.sg-M { background: #166534; }
.sg-V { background: #2b8a3e; }
.sg-Đ { background: #b37d22; }
.sg-B { background: #7b8494; }
.sg-H { background: #b42318; }

.hoa {
  display: inline-block;
  padding: 0 5px;
  border-radius: 3px;
  font-style: normal;
  font-weight: 700;
  font-size: 0.64rem;
  vertical-align: middle;
}
.hoa-tot { background: #e3f4ea; color: #166534; }
.hoa-ky  { background: #fdecec; color: #b42318; }

/* Thanh thông tin nhanh khi bấm vào cung */
.tv-inspector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 24px;
  background: var(--tv-surface-warm);
  border: 1px solid var(--tv-line);
  border-radius: 12px;
  font-size: 0.88rem;
}
.tv-inspector__info strong { color: var(--tv-indigo); }
.tv-inspector__hint { color: var(--tv-mut); font-size: 0.84rem; }

/* ================== SECTIONS & CARDS ================== */
.tv-sec {
  margin-top: 34px;
  scroll-margin-top: 74px;
}
.tv-sec__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--tv-line);
}
.tv-h3 {
  font-family: var(--tv-serif);
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  font-weight: 700;
  color: var(--tv-indigo);
}
.tv-sec__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  border-radius: 8px;
  background: var(--tv-indigo);
  color: #f3d799 !important;
  font-family: var(--tv-sans);
  font-size: 0.82rem;
  font-weight: 800;
  vertical-align: 2px;
}

/* Bảng thông tin chung + Nạp Âm */
.tv-info-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
  align-items: start;
}
.tv-panel {
  padding: 20px 22px;
  background: var(--tv-surface);
  border: 1px solid var(--tv-line);
  border-radius: var(--tv-radius);
  box-shadow: var(--tv-shadow-sm);
}
.tv-dl > div {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 9px 0;
  border-top: 1px solid #f0eadc;
}
.tv-dl > div:first-child { border-top: 0; padding-top: 0; }
.tv-dl > div:last-child { padding-bottom: 0; }
.tv-dl dt { color: var(--tv-mut); font-size: 0.9rem; flex: none; }
.tv-dl dd { font-weight: 600; text-align: right; color: var(--tv-ink); font-size: 0.92rem; }

.tv-napam-card {
  background: linear-gradient(180deg, #fffdf8 0%, #faf3e3 100%);
  border: 1px solid #e2d2ad;
}
.tv-napam-card__tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--tv-indigo);
  color: #f3d799 !important;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.tv-napam-card h4 {
  font-family: var(--tv-serif);
  font-size: 1.18rem;
  color: var(--tv-indigo);
  margin-bottom: 8px;
}
.tv-napam-card p { font-size: 0.92rem; color: var(--tv-ink-soft); margin-bottom: 10px; }
.tv-napam-tip {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  border-left: 3px solid var(--tv-gold);
  font-size: 0.88rem;
  color: var(--tv-ink);
}

/* 6 Trụ cột cuộc đời */
.tv-pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.tv-pillar {
  padding: 15px 16px;
  background: var(--tv-surface);
  border: 1px solid var(--tv-line);
  border-radius: 14px;
  box-shadow: var(--tv-shadow-sm);
}
.tv-pillar__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.tv-pillar__title { font-weight: 700; font-size: 0.92rem; color: var(--tv-indigo); }
.tv-pillar__pct { font-weight: 800; font-size: 0.92rem; color: var(--tv-gold); }
.tv-pillar__bar {
  height: 7px;
  border-radius: 999px;
  background: #eee7d7;
  overflow: hidden;
  margin-bottom: 8px;
}
.tv-pillar__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #28335c, #c49235);
}
.tv-pillar__meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--tv-mut);
  gap: 6px;
}

/* Cách cục kinh điển */
.tv-cach-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.tv-cach {
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--tv-surface);
  border: 1px solid var(--tv-line);
  box-shadow: var(--tv-shadow-sm);
}
.tv-cach--cat   { border-top: 3px solid var(--tv-green); }
.tv-cach--trung { border-top: 3px solid var(--tv-gold); }
.tv-cach--luu_y { border-top: 3px solid var(--tv-red); }
.tv-cach__eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.tv-cach--cat .tv-cach__eyebrow   { background: var(--tv-green-bg); color: var(--tv-green); }
.tv-cach--trung .tv-cach__eyebrow { background: var(--tv-gold-bg); color: var(--tv-amber); }
.tv-cach--luu_y .tv-cach__eyebrow { background: var(--tv-red-bg); color: var(--tv-red); }
.tv-cach h4 {
  font-family: var(--tv-serif);
  font-size: 1.06rem;
  color: var(--tv-indigo);
  margin-bottom: 6px;
}
.tv-cach p { font-size: 0.91rem; color: var(--tv-ink-soft); }
.tv-cach__tip {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed var(--tv-line);
  font-size: 0.85rem;
  color: var(--tv-indigo-mid);
}

/* Thẻ luận giải cung */
.tv-card {
  padding: 20px 22px;
  margin: 0 0 14px;
  background: var(--tv-surface);
  border: 1px solid var(--tv-line);
  border-radius: var(--tv-radius);
  box-shadow: var(--tv-shadow-sm);
  scroll-margin-top: 78px;
}
.tv-card h4 {
  font-family: var(--tv-serif);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--tv-indigo);
  line-height: 1.35;
}
.tv-card__h {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f2ecde;
}
.tv-rating { text-align: right; flex: none; }
.tv-rating small { display: block; color: var(--tv-mut); font-size: 0.75rem; font-weight: 600; }
.tv-rate { color: #d4961a; letter-spacing: 1px; font-size: 0.95rem; }
.tv-tag {
  display: inline-block;
  margin: 2px 0 8px;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--tv-indigo-light);
  color: var(--tv-indigo);
  font-size: 0.8rem;
  font-weight: 700;
}
.tv-pair-note {
  margin: 8px 0 12px;
  padding: 11px 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, #fdf6e6, #fffdf9);
  border-left: 3.5px solid var(--tv-gold);
  font-size: 0.9rem;
  color: var(--tv-ink);
}
.tv-star { margin: 12px 0; }
.tv-star h5 { font-size: 1rem; font-weight: 800; margin-bottom: 2px; }
.tv-star p { margin-top: 4px; color: var(--tv-ink-soft); font-size: 0.94rem; }
.tv-sub {
  margin: 14px 0 6px;
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tv-indigo-mid);
}
.tv-aux {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 5px;
  font-size: 0.9rem;
}
.tv-aux li { padding-left: 14px; position: relative; }
.tv-aux li::before { content: "•"; position: absolute; left: 0; font-weight: 900; }
.tv-special {
  margin-top: 9px;
  padding: 9px 13px;
  border-radius: 8px;
  background: var(--tv-gold-bg);
  border-left: 3px solid var(--tv-gold);
  color: #6b4700;
  font-size: 0.88rem;
}
.tv-card__meta-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--tv-line);
  font-size: 0.82rem;
  color: var(--tv-mut);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.tv-note {
  margin: 12px 0;
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--tv-surface-warm);
  border: 1px solid var(--tv-line);
  font-size: 0.94rem;
}
.tv-list { padding-left: 18px; }
.tv-list li { margin: 6px 0; color: var(--tv-ink-soft); }
.tv-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.tv-card--good { border-left: 4px solid #2b8a3e; }
.tv-card--warn { border-left: 4px solid #d9480f; }

/* Bộ lọc 11 cung */
.tv-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.tv-tab {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--tv-line-strong);
  background: #fff;
  color: var(--tv-ink-soft);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tv-tab:hover { border-color: var(--tv-indigo); color: var(--tv-indigo); }
.tv-tab.is-active {
  background: var(--tv-indigo);
  border-color: var(--tv-indigo);
  color: #f3d799;
}
.tv-card.is-hidden { display: none; }

/* Bảng Đại Vận */
.tv-scroll { overflow-x: auto; border-radius: 14px; border: 1px solid var(--tv-line); background: #fff; }
.tv-table { width: 100%; border-collapse: collapse; font-size: 0.91rem; min-width: 540px; }
.tv-table th, .tv-table td { padding: 11px 14px; border-bottom: 1px solid #f0eadc; text-align: left; }
.tv-table th {
  background: var(--tv-surface-warm);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tv-indigo);
}
.tv-table tr:last-child td { border-bottom: 0; }
.tv-table tr.is-now td { background: #fdf6e2; font-weight: 700; }
.tv-now-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--tv-indigo);
  color: #f3d799 !important;
  font-size: 0.68rem;
  font-weight: 700;
}
.tv-lead { margin: 16px 0 8px; color: var(--tv-indigo); font-size: 0.98rem; }

/* Dự báo 12 tháng (Nguyệt hạn) */
.tv-months {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 14px 0 18px;
}
.tv-month {
  padding: 12px 13px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--tv-line);
  font-size: 0.84rem;
}
.tv-month__h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}
.tv-month__h strong { color: var(--tv-indigo); font-size: 0.9rem; }
.tv-month__badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}
.tv-month--good .tv-month__badge { background: var(--tv-green-bg); color: var(--tv-green); }
.tv-month--mid  .tv-month__badge { background: var(--tv-gold-bg); color: var(--tv-amber); }
.tv-month--warn .tv-month__badge { background: var(--tv-red-bg); color: var(--tv-red); }
.tv-month__cung { font-weight: 600; color: var(--tv-ink); font-size: 0.82rem; }
.tv-month__focus { color: var(--tv-mut); font-size: 0.78rem; margin-top: 2px; line-height: 1.4; }
.tv-month__luu { margin-top: 5px; font-size: 0.74rem; color: var(--tv-amber); font-weight: 600; }

/* Khung mở khóa (Paywall) */
.tv-unlock {
  position: relative;
  overflow: hidden;
  padding: 32px 28px;
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, #faf5e8 100%);
  border: 1.5px solid #dec99a;
  border-radius: 18px;
  box-shadow: var(--tv-shadow);
}
.tv-unlock h3 {
  font-family: var(--tv-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--tv-indigo);
  margin-bottom: 8px;
}
.tv-unlock > p { max-width: 640px; margin: 0 auto 16px; color: var(--tv-ink-soft); }
.tv-unlock__perks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
  max-width: 600px;
  margin: 0 auto 20px;
  text-align: left;
  list-style: none;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--tv-line);
  border-radius: 12px;
  font-size: 0.88rem;
}
.tv-unlock__perks li::before { content: "✦ "; color: var(--tv-gold); font-weight: 700; }
.tv-err {
  max-width: 480px;
  margin: 0 auto 14px !important;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--tv-red-bg);
  color: var(--tv-red) !important;
  font-weight: 600;
}
.tv-unlock__form { display: flex; gap: 10px; max-width: 460px; margin: 0 auto 14px; }
.tv-unlock__form input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--tv-line-strong);
  border-radius: var(--tv-radius-sm);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}
.tv-unlock__links { font-size: 0.9rem; color: var(--tv-ink-soft); }

/* Toast */
.tv-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--tv-indigo);
  color: #f3d799;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 26px rgba(18, 23, 43, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}
.tv-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

.tv a:focus-visible, .tv button:focus-visible, .tv input:focus-visible, .tv select:focus-visible {
  outline: 3px solid var(--tv-gold);
  outline-offset: 2px;
}

/* ================== RESPONSIVE ================== */
@media (max-width: 960px) {
  .tv-chart {
    display: flex;
    flex-direction: column;
    border: 0;
    outline: 0;
    border-radius: 0;
    overflow: visible;
    gap: 10px;
    background: none;
    box-shadow: none;
  }
  .tv-chart-svg { display: none; }
  .tv-center { order: -1; border: 1.5px solid var(--tv-line-strong); border-radius: 14px; }
  .tv-cell {
    order: var(--o);
    border: 1px solid var(--tv-line-strong);
    border-radius: 14px;
    font-size: 0.9rem;
    padding: 12px 14px;
  }
  .tv-cell__aux span { font-size: 0.84rem; }
  .tv-main { font-size: 1rem; }
  .tv-cell__cung { font-size: 0.96rem; }
  .tv-cell__luu { font-size: 0.8rem; }
  .tv-info-grid, .tv-grid2, .tv-cach-grid { grid-template-columns: 1fr; }
  .tv-pillars { grid-template-columns: repeat(2, 1fr); }
  .tv-months { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .tv { font-size: 15px; }
  .tv-hero, .tv-rh { padding: 22px 18px; border-radius: 16px; }
  .tv-box { padding: 20px 16px; }
  .tv-form-grid, .tv-form-highlights, .tv-unlock__perks { grid-template-columns: 1fr; }
  .tv-pillars, .tv-months { grid-template-columns: repeat(2, 1fr); }
  .tv-card, .tv-panel { padding: 16px 15px; }
  .tv-dl > div { flex-direction: column; gap: 2px; }
  .tv-dl dd { text-align: left; }
  .tv-unlock { padding: 22px 16px; }
  .tv-unlock__form { flex-direction: column; }
  .tv-toolbar__left, .tv-toolbar__right { width: 100%; }
  .tv-toolbar .tv-btn { flex: 1 1 auto; }
}

/* ================== IN ẤN / LƯU PDF ================== */
@media print {
  body * { visibility: hidden; }
  .tv, .tv * { visibility: visible; }
  .tv { position: absolute; left: 0; top: 0; width: 100%; max-width: none; margin: 0; }
  .tv-toolbar, .tv-status, .tv-unlock, .tv-nav, .tv-tabs, .tv-inspector, .tv-toast { display: none !important; }
  .tv-card.is-hidden { display: block !important; }
  .tv-chart {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    border: 2px solid #1a213d;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .tv-cell { order: 0 !important; border-radius: 0 !important; font-size: 0.68rem !important; }
  .tv-card, .tv-star, .tv-cach, .tv-month { break-inside: avoid; }
  .tv-hero, .tv-rh, .sg, .hoa, .tt, .tv-flag, .tv-pillar__fill {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
