﻿:root {
  --ctv-gold: #c9a227;
  --ctv-gold-deep: #b8921f;
  --ctv-gold-soft: #f3e6b0;
  --ctv-bg: #f2f3f5;
  --ctv-card: #ffffff;
  --ctv-text: #1a1a1a;
  --ctv-muted: #6b7280;
  --ctv-link: #2563eb;
  --ctv-danger: #e11d48;
  --ctv-sale-bg: #dcfce7;
  --ctv-sale-fg: #15803d;
  --ctv-rent-bg: #dbeafe;
  --ctv-rent-fg: #1d4ed8;
  --ctv-nav-h: 64px;
  --ctv-radius: 12px;
  --ctv-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  --font-display: "Be Vietnam Pro", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--ctv-bg);
  color: var(--ctv-text);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
img { max-width: 100%; display: block; }

.ctv-app {
  min-height: 100vh;
  padding-bottom: calc(var(--ctv-nav-h) + 16px);
}

/* ===== Hero / Header ===== */
.ctv-hero {
  position: relative;
  background: linear-gradient(145deg, #d4af37 0%, #c9a227 45%, #b08d1a 100%);
  color: #fff;
  padding: 14px 16px 16px;
  overflow: hidden;
}
.ctv-hero::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 4px;
  width: 110px;
  height: 72px;
  opacity: .22;
  background:
    linear-gradient(#fff 0 0) 12px 44px / 18px 26px no-repeat,
    linear-gradient(#fff 0 0) 36px 30px / 22px 40px no-repeat,
    linear-gradient(#fff 0 0) 64px 36px / 16px 34px no-repeat,
    linear-gradient(#fff 0 0) 84px 24px / 20px 46px no-repeat;
  pointer-events: none;
}
.ctv-hero-brand {
  position: relative;
  z-index: 1;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 0;
  line-height: 1.2;
}
.ctv-hero-sub {
  position: relative;
  z-index: 1;
  margin: 3px 0 0;
  font-size: .8rem;
  opacity: .95;
  font-weight: 400;
  line-height: 1.25;
}

/* ===== Section ===== */
.ctv-section {
  padding: 16px 14px 8px;
}
.ctv-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}
.ctv-section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.ctv-section-link {
  color: var(--ctv-link);
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ===== Product card ===== */
.ctv-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ctv-card-list[data-view="grid"] {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ctv-card-list[data-view="grid"] .ctv-card {
  display: block;
  position: relative;
}
.ctv-card-list[data-view="grid"] .ctv-card-main {
  display: block;
}
.ctv-card-list[data-view="grid"] .ctv-card-thumb {
  width: 100%;
  height: 120px;
  margin-bottom: 8px;
}
.ctv-card-list[data-view="grid"] .ctv-card-chevron,
.ctv-card-list[data-view="grid"] .ctv-meta { display: none; }
.ctv-card {
  position: relative;
  background: var(--ctv-card);
  border-radius: var(--ctv-radius);
  padding: 10px;
  box-shadow: var(--ctv-shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.ctv-card-main {
  display: grid;
  grid-template-columns: 96px 1fr 16px;
  gap: 10px;
  align-items: stretch;
  color: inherit;
}
.ctv-card:active { transform: scale(.985); }
.ctv-card-actions {
  position: absolute;
  right: 6px;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 2;
}
.ctv-fav-btn {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: #d1d5db;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ctv-fav-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
.ctv-fav-btn.is-on { color: #ef4444; }
.ctv-fav-btn.is-on svg { fill: currentColor; }
.ctv-card-thumb {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 10px;
  overflow: hidden;
  background: #e5e7eb;
  flex-shrink: 0;
}
.ctv-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ctv-card-thumb-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #9ca3af;
  font-size: .75rem;
}
.ctv-badge-new {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--ctv-danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .02em;
}
.ctv-photo-count {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: .68rem;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.ctv-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ctv-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.ctv-card-name {
  margin: 0;
  font-size: .92rem;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
  color: #1e3a8a;
}
.ctv-card-sub {
  margin: 0;
  color: var(--ctv-muted);
  font-size: .8rem;
}
.ctv-status {
  flex-shrink: 0;
  font-size: .68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  white-space: nowrap;
}
.ctv-status.is-sale { background: var(--ctv-sale-bg); color: var(--ctv-sale-fg); }
.ctv-status.is-rent { background: var(--ctv-rent-bg); color: var(--ctv-rent-fg); }
.ctv-status.is-sold { background: #fee2e2; color: #b91c1c; }
.ctv-price {
  margin: 2px 0 4px;
  color: var(--ctv-gold-deep);
  font-size: 1.05rem;
  font-weight: 800;
}
.ctv-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}
.ctv-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #4b5563;
  font-size: .75rem;
  min-width: 0;
}
.ctv-meta-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ctv-meta-item svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  stroke: #6b7280;
  fill: none;
  stroke-width: 1.8;
}
.ctv-card-chevron {
  align-self: center;
  color: #c4c4c4;
  font-size: 1.1rem;
  font-weight: 300;
}

.ctv-empty {
  text-align: center;
  color: var(--ctv-muted);
  padding: 28px 12px;
  background: var(--ctv-card);
  border-radius: var(--ctv-radius);
}

/* ===== Bottom nav ===== */
.ctv-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--ctv-nav-h);
  background: #fff;
  border-top: 1px solid #e5e7eb;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.ctv-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #9ca3af;
  font-size: .68rem;
  font-weight: 600;
}
.ctv-nav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
.ctv-nav-item.is-active { color: var(--ctv-gold); }

/* ===== Login ===== */
.ctv-login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ctv-bg);
}
.ctv-login-hero {
  background: linear-gradient(145deg, #d4af37 0%, #c9a227 45%, #b08d1a 100%);
  color: #fff;
  padding: 48px 24px 56px;
  position: relative;
  overflow: hidden;
}
.ctv-login-hero::after {
  content: "";
  position: absolute;
  inset: auto -20px 0 auto;
  width: 180px;
  height: 120px;
  opacity: .18;
  background:
    linear-gradient(#fff 0 0) 20px 60px / 30px 50px no-repeat,
    linear-gradient(#fff 0 0) 60px 40px / 36px 70px no-repeat,
    linear-gradient(#fff 0 0) 105px 50px / 28px 60px no-repeat;
}
.ctv-login-hero h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: .04em;
}
.ctv-login-hero p {
  margin: 8px 0 0;
  opacity: .95;
}
.ctv-login-card {
  margin: -28px 16px 24px;
  background: #fff;
  border-radius: 16px;
  padding: 22px 18px 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
  position: relative;
  z-index: 1;
}
.ctv-login-card h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
}
.ctv-field { margin-bottom: 14px; }
.ctv-field label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
.ctv-field input {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  background: #fafafa;
}
.ctv-field input:focus {
  border-color: var(--ctv-gold);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(201, 162, 39, .18);
}
.ctv-alert {
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .88rem;
  margin-bottom: 14px;
}
.ctv-btn-primary {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  background: linear-gradient(145deg, #d4af37, #b8921f);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(184, 146, 31, .28);
}
.ctv-btn-primary:active { transform: translateY(1px); }
.ctv-login-note {
  text-align: center;
  color: var(--ctv-muted);
  font-size: .8rem;
  margin-top: 14px;
}

/* ===== Page shell ===== */
.ctv-page-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 20;
}
.ctv-page-bar h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.ctv-back {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f3f4f6;
  color: #374151;
  font-size: 1.1rem;
}
.ctv-app--no-nav { padding-bottom: 0; }

/* ===== Chi tiết sản phẩm ===== */
.ctv-detail-page {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  background: #fff;
}
.ctv-dgal { background: #fff; }
.ctv-dgal-main {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #e5e7eb;
  overflow: hidden;
  cursor: zoom-in;
}
.ctv-dgal-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
}
.ctv-dgal-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #9ca3af;
  font-weight: 600;
}
.ctv-dgal-status {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  background: var(--ctv-sale-bg);
  color: var(--ctv-sale-fg);
}
.ctv-dgal-count {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .55);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
}
.ctv-dgal-count svg { stroke: #fff; fill: none; stroke-width: 1.6; }
.ctv-dgal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, .45);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.ctv-dgal-nav.is-prev { left: 8px; }
.ctv-dgal-nav.is-next { right: 8px; }
.ctv-dgal-thumbs {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ctv-dgal-thumbs::-webkit-scrollbar { display: none; }
.ctv-dgal-thumb {
  position: relative;
  flex: 0 0 64px;
  width: 64px;
  height: 52px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: visible;
  background: #e5e7eb;
  cursor: pointer;
}
.ctv-dgal-thumb.is-active { border-color: var(--ctv-gold); }
.ctv-dgal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 6px;
}
.ctv-dgal-del {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 2;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.ctv-dgal-del:active { transform: scale(.95); }
.ctv-dgal-add {
  display: grid;
  place-items: center;
  border: 2px dashed var(--ctv-gold);
  background: #fffbeb;
  color: var(--ctv-gold-deep);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.ctv-dgal-add.is-busy {
  opacity: .6;
  pointer-events: none;
}
.ctv-dgal-add span { pointer-events: none; }

.ctv-dhead { padding: 10px 12px 6px; }
.ctv-dhead-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #1e3a8a;
  letter-spacing: .02em;
}
.ctv-dhead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ctv-dhead-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.ctv-price-pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: #b45309;
  font-size: .75rem;
  font-weight: 800;
}
.ctv-id-copy {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: #60a5fa;
  font-size: .78rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
}
.ctv-id-copy svg { stroke: currentColor; fill: none; stroke-width: 1.8; }
.ctv-id-copy.is-ok { color: #16a34a; }

.ctv-dstats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 4px 10px 8px;
  padding: 8px 2px;
  background: #faf6eb;
  border-radius: 10px;
}
.ctv-dstat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  padding: 0 2px;
  border-right: 1px solid #e8dfc8;
}
.ctv-dstat:last-child { border-right: 0; }
.ctv-dstat svg {
  width: 16px;
  height: 16px;
  stroke: var(--ctv-gold);
  fill: none;
  stroke-width: 1.7;
}
.ctv-dstat-label {
  font-size: .62rem;
  color: #9a8b6a;
  line-height: 1.2;
}
.ctv-dstat strong {
  font-size: .78rem;
  color: #1e3a8a;
  font-weight: 800;
  line-height: 1.2;
}

.ctv-dspec { padding: 0 12px; }
.ctv-dspec-row {
  display: grid;
  grid-template-columns: 22px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: .8rem;
  line-height: 1.3;
}
.ctv-dspec-ico {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #eff6ff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ctv-dspec-ico svg {
  width: 12px;
  height: 12px;
  stroke: #2563eb;
  fill: none;
  stroke-width: 1.7;
}
.ctv-dspec-label {
  color: var(--ctv-muted);
  font-size: .78rem;
  white-space: nowrap;
}
.ctv-dspec-val {
  font-weight: 700;
  color: #1e293b;
  text-align: right;
  font-size: .8rem;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctv-ddesc { padding: 10px 12px 14px; }
.ctv-ddesc h3 {
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .9rem;
  font-weight: 800;
  color: #1e3a8a;
}
.ctv-ddesc h3 svg {
  width: 15px;
  height: 15px;
  stroke: #1e3a8a;
  fill: none;
  stroke-width: 1.8;
}
.ctv-ddesc-box {
  background: #f3f4f6;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .8rem;
  line-height: 1.45;
  color: #374151;
  white-space: pre-wrap;
}

.ctv-detail-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #eee;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
}
.ctv-dact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: #fff;
  color: #374151;
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
}
.ctv-dact svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
.ctv-dact.is-on {
  color: var(--ctv-danger);
  border-color: #fecdd3;
  background: #fff1f2;
}
.ctv-dact.is-on svg { fill: currentColor; }
.ctv-dact.is-share {
  border-color: #93c5fd;
  color: #2563eb;
}

/* Lightbox zoom */
.ctv-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: flex;
  flex-direction: column;
}
.ctv-lightbox[hidden] { display: none !important; }
.ctv-lb-close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}
.ctv-lb-stage {
  flex: 1;
  overflow: hidden;
  touch-action: none;
  display: grid;
  place-items: center;
}
.ctv-lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}
.ctv-lb-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  color: #fff;
  font-weight: 600;
}
.ctv-lb-nav {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}
body.ctv-lb-open { overflow: hidden; }

.ctv-search-box {
  padding: 12px 14px;
}
.ctv-search-box input,
.ctv-search-box select {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  margin-bottom: 8px;
}
.ctv-search-actions {
  display: flex;
  gap: 8px;
}
.ctv-btn-ghost {
  flex: 1;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 10px;
  padding: 11px;
  font-weight: 600;
  cursor: pointer;
}
.ctv-btn-gold {
  flex: 1;
  border: 0;
  background: var(--ctv-gold);
  color: #fff;
  border-radius: 10px;
  padding: 11px;
  font-weight: 700;
  cursor: pointer;
}

@media (min-width: 480px) {
  .ctv-card-main { grid-template-columns: 110px 1fr 16px; }
  .ctv-card-thumb { width: 110px; height: 110px; }
}

/* ===== Tra cứu page ===== */
.ctv-hidden-form { display: none !important; }
.ctv-tracuu { min-height: 100%; }
.ctv-tracuu-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(145deg, #d4af37 0%, #c9a227 55%, #b8921f 100%);
  color: #fff;
}
.ctv-tracuu-bar--actions {
  grid-template-columns: 40px 1fr auto;
}
.ctv-tracuu-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ctv-edit-btn {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--ctv-gold-deep);
  padding: 0;
  display: grid;
  place-items: center;
  padding: 0;
  z-index: 2;
  display: grid;
  place-items: center;
}
.ctv-edit-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
.ctv-tracuu-bar h1 {
  margin: 0;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 800;
}
.ctv-tracuu-iconbtn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.18);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  position: relative;
  text-decoration: none;
}
.ctv-filter-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.ctv-tracuu-toolbar {
  background: #fff;
  padding: 10px 14px 8px;
  border-bottom: 1px solid #eee;
}
.ctv-sort-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.ctv-sort-row label {
  font-size: .88rem;
  font-weight: 600;
  color: #374151;
}
.ctv-sort-select {
  min-width: 140px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 7px 10px;
  background: #fafafa;
  font-weight: 600;
}
.ctv-chip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.ctv-chip {
  border: 0;
  background: #f59e0b;
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.ctv-chip-x {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0,0,0,.15);
  display: grid;
  place-items: center;
  font-size: .85rem;
  line-height: 1;
}
.ctv-chip-clear {
  border: 0;
  background: transparent;
  color: var(--ctv-link);
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  padding: 0;
}
.ctv-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ctv-result-count {
  font-size: .9rem;
  font-weight: 700;
  color: #111827;
}
.ctv-view-toggle {
  display: inline-flex;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}
.ctv-view-toggle button {
  width: 34px;
  height: 30px;
  border: 0;
  background: #fff;
  color: #9ca3af;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ctv-view-toggle button.is-active {
  background: var(--ctv-gold);
  color: #fff;
}
.ctv-view-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.ctv-tracuu-list-wrap { padding-top: 10px; }
.ctv-scroll-sentinel {
  text-align: center;
  color: var(--ctv-muted);
  font-size: .82rem;
  padding: 12px 8px 8px;
  min-height: 28px;
}

/* ===== Modal filter ===== */
body.ctv-modal-open { overflow: hidden; }
.ctv-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ctv-modal[hidden] { display: none !important; }
.ctv-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .45);
}
.ctv-modal-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  max-height: min(92vh, 720px);
  background: #fff;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0,0,0,.18);
  animation: ctvSheetIn .22s ease;
}
@keyframes ctvSheetIn {
  from { transform: translateY(24px); opacity: .6; }
  to { transform: translateY(0); opacity: 1; }
}
.ctv-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #f0f0f0;
}
.ctv-modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}
.ctv-modal-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f3f4f6;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}
.ctv-modal-body {
  overflow: auto;
  padding: 12px 16px 8px;
  -webkit-overflow-scrolling: touch;
}
.ctv-modal-foot {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0));
  border-top: 1px solid #f0f0f0;
  background: #fff;
}
.ctv-mfield {
  display: block;
  margin-bottom: 12px;
}
.ctv-mfield > span {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: 5px;
}
.ctv-mfield input,
.ctv-mfield select {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fafafa;
  font-size: .92rem;
}
.ctv-mfield-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ctv-mfield-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}
.ctv-modal-foot .ctv-btn-ghost { flex: 0 0 110px; }
.ctv-modal-foot .ctv-btn-gold { flex: 1; }

/* ===== Form thêm/sửa ===== */
.ctv-form-page {
  padding: 12px 14px calc(var(--ctv-nav-h) + 20px);
}
.ctv-form-section {
  background: #fff;
  border-radius: 12px;
  padding: 14px 12px 4px;
  margin-bottom: 12px;
  box-shadow: var(--ctv-shadow);
}
.ctv-form-section h3 {
  margin: 0 0 12px;
  font-size: .95rem;
  font-weight: 800;
}
.ctv-form textarea {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fafafa;
  font: inherit;
  resize: vertical;
}
.ctv-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.ctv-form-actions .ctv-btn-ghost { flex: 0 0 100px; text-align: center; text-decoration: none; display: grid; place-items: center; }
.ctv-form-actions .ctv-btn-gold { flex: 1; }
.ctv-form-msg {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 600;
}
.ctv-form-msg.is-ok { background: #dcfce7; color: #166534; }
.ctv-form-msg.is-err { background: #fef2f2; color: #b91c1c; }
.ctv-field-err {
  display: block;
  color: #b91c1c;
  font-size: .75rem;
  margin-top: 4px;
}

/* ===== Cá nhân ===== */
.ctv-canhan-bar {
  grid-template-columns: 1fr auto;
  justify-items: start;
}
.ctv-canhan-bar h1 {
  text-align: left;
  padding-left: 4px;
}
.ctv-canhan {
  padding: 14px 14px calc(var(--ctv-nav-h) + 20px);
}
.ctv-profile-card {
  display: flex;
  gap: 14px;
  align-items: center;
  background: #faf6eb;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--ctv-shadow);
}
.ctv-profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, #d4af37, #b8921f);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ctv-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ctv-profile-info { min-width: 0; flex: 1; }
.ctv-profile-info h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 800;
  color: #1e293b;
}
.ctv-profile-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fde68a;
  color: #92400e;
  font-size: .72rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.ctv-profile-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ctv-profile-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: #4b5563;
  word-break: break-all;
}
.ctv-profile-meta svg {
  width: 14px;
  height: 14px;
  stroke: #2563eb;
  fill: none;
  stroke-width: 1.7;
  flex-shrink: 0;
}
.ctv-menu-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--ctv-shadow);
  margin-bottom: 12px;
  overflow: hidden;
}
.ctv-menu-item {
  display: grid;
  grid-template-columns: 42px 1fr 18px;
  gap: 10px;
  align-items: center;
  padding: 14px 14px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid #f3f4f6;
}
.ctv-menu-item:last-child { border-bottom: 0; }
.ctv-menu-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}
.ctv-menu-ico svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
.ctv-menu-ico.is-blue { background: #dbeafe; color: #1d4ed8; }
.ctv-menu-ico.is-gold { background: #fef3c7; color: #b45309; }
.ctv-menu-ico.is-red { background: #fee2e2; color: #dc2626; }
.ctv-menu-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ctv-menu-text strong {
  font-size: .92rem;
  font-weight: 700;
  color: #111827;
}
.ctv-menu-text small {
  font-size: .75rem;
  color: #9ca3af;
}
.ctv-menu-chevron {
  color: #d1d5db;
  font-size: 1.3rem;
  text-align: right;
}
.ctv-menu-item.is-danger .ctv-menu-text strong { color: #dc2626; }

/* ===== Kiểm tra thiết bị ===== */
.ctv-device-page {
  padding: 20px 16px 28px;
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.ctv-device-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 20px 16px;
  box-shadow: var(--ctv-shadow);
  text-align: center;
}
.ctv-device-status {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.4;
  padding: 12px 14px;
  border-radius: 12px;
}
.ctv-device-status.is-warn { background: #fff7ed; color: #c2410c; }
.ctv-device-status.is-wait { background: #eff6ff; color: #1d4ed8; }
.ctv-device-status.is-err { background: #fef2f2; color: #b91c1c; }
.ctv-device-status.is-ok { background: #dcfce7; color: #166534; }
.ctv-device-code {
  margin: 16px 0;
  padding: 12px;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px dashed #e5e7eb;
}
.ctv-device-code span {
  display: block;
  font-size: .78rem;
  color: var(--ctv-muted);
  margin-bottom: 6px;
}
.ctv-device-code strong {
  display: block;
  font-size: .85rem;
  word-break: break-all;
  color: #111827;
}
.ctv-device-btn {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  margin-top: 8px;
  border: 0;
  min-height: 46px;
}
.ctv-device-note {
  margin: 12px 0 0;
  font-size: .8rem;
  color: var(--ctv-muted);
  line-height: 1.45;
}
.ctv-device-logout {
  display: inline-block;
  margin-top: 18px;
  color: #dc2626;
  font-weight: 700;
  font-size: .9rem;
  text-decoration: none;
}

/* Share image picker (ShareKhach) */
.ctv-share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 20050;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ctv-share-panel {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 700px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.ctv-share-head {
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.ctv-share-head h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.ctv-share-x {
  border: 0;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #999;
  padding: 0 4px;
}
.ctv-share-tools {
  padding: 10px 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.ctv-share-count {
  margin-left: auto;
  color: #888;
  font-size: .8rem;
}
.ctv-share-tool {
  border: 1px solid #ddd;
  background: #f8fafc;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
}
.ctv-share-primary {
  border: 0;
  background: #1d4ed8;
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
}
.ctv-share-grid {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-content: flex-start;
}
.ctv-share-item {
  position: relative;
  cursor: pointer;
  width: 110px;
  height: 84px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #337ab7;
  flex-shrink: 0;
  margin: 0;
}
.ctv-share-item.is-off {
  border-color: #ddd;
  opacity: .5;
}
.ctv-share-item input {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.ctv-share-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ctv-share-empty {
  width: 100%;
  text-align: center;
  color: #999;
  padding: 30px 0;
  font-size: .9rem;
}
.ctv-share-empty.is-err { color: #d9534f; }
.ctv-share-foot {
  padding: 12px 16px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}