/* Generic modals, signal detail modal, gallery, memo, history, and comps. */
/* Modals */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
}

.modal-content {
  background: var(--surface-solid);
  padding: 40px;
  border-radius: 24px;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from {
    transform: translateY(40px) scale(0.95);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.close-modal {
  position: absolute;
  top: 24px;
  right: 24px;
  font-size: 32px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  color: var(--text-muted);
  transition: all 0.2s;
}

.close-modal:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

/* Signal Modal Detail — 2-column layout */
.sm-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.sm-left {
  padding: 20px 24px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.sm-right {
  padding: 20px 24px;
  overflow-y: auto;
}

.sm-slider {
  margin-bottom: 10px;
  border-radius: 12px;
}

.sm-slides-track {
  display: flex;
  width: 100%;
  height: 100%;
  transform: translate3d(0, 0, 0);
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  will-change: transform;
  backface-visibility: hidden;
}

.sm-slide {
  flex: 0 0 100%;
  width: 100%;
  max-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #0f172a;
  backface-visibility: hidden;
}

.sm-slide-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
  flex: 0 0 auto;
  background: #0f172a;
  cursor: zoom-in;
}

.sm-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.sm-dot.active {
  background: #fff;
  transform: scale(1.08);
}

.sm-thumbs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.sm-thumbs img {
  width: 80px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.sm-thumbs img.active {
  border-color: var(--primary);
}

.sm-thumbs img:hover {
  border-color: var(--primary);
}

.sm-signal-badge {
  margin-bottom: 10px;
}

.sm-signal-badge span {
  display: inline-block;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-weight: 900;
  font-size: 0.78rem;
  padding: 5px 14px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sm-detail-title {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.45;
  margin-bottom: 10px;
  color: var(--text);
  background: rgba(248, 250, 252, 0.82);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.sm-title-main,
.sm-title-sub {
  display: block;
}

.sm-title-main {
  color: #0f172a;
  font-size: 1.05rem;
}

.sm-title-sub {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.55;
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
}

.sm-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.sm-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 14px;
}

.sm-summary-item {
  min-width: 0;
  border: 1px solid rgba(99, 102, 241, 0.16);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.78);
  padding: 10px 11px;
}

.sm-summary-item span,
.sm-summary-item small {
  display: block;
  min-width: 0;
}

.sm-summary-item span {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sm-summary-item strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
}

.sm-summary-item small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sm-summary-price strong,
.sm-summary-mos strong {
  color: #047857;
}

.sm-mobile-tabs {
  display: none;
}

.sm-panel {
  display: block;
}

.sm-section {
  margin-bottom: 16px;
}

.sm-section-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.sm-desc-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.75;
  white-space: pre-wrap;
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.inline-contact-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid rgba(37, 99, 235, 0.38);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
  padding: 5px 10px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.inline-contact-cta:hover {
  background: rgba(37, 99, 235, 0.2);
}

.sm-ai-section {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.02));
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-left: 4px solid #10b981;
  border-radius: 10px;
  padding: 14px 16px;
}

.sm-ai-section[hidden] {
  display: none !important;
}

.sm-memo-section {
  margin-bottom: 16px;
}

.sm-ai-label {
  font-size: 0.75rem;
  font-weight: 900;
  color: #10b981;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.sm-ai-text {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.7;
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
}

.sm-ai-text b,
.sm-ai-text strong {
  color: var(--text);
  font-weight: 800;
}

.sm-memo-body {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.sm-memo-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.sm-memo-verdict {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #334155;
  background: rgba(100, 116, 139, 0.12);
  border: 1px solid rgba(100, 116, 139, 0.18);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.sm-memo-verdict.strong,
.sm-memo-verdict.good {
  color: #047857;
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.28);
}

.sm-memo-verdict.watch {
  color: #92400e;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
}

.sm-memo-verdict.danger {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.26);
}

.sm-memo-summary {
  margin: 0;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.62;
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
}

.sm-memo-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 11px;
}

.sm-memo-metric {
  min-width: 0;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(16, 185, 129, 0.14);
  border-radius: 8px;
  padding: 7px 8px;
}

.sm-memo-metric span {
  display: block;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 850;
}

.sm-memo-metric b {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 0.92rem;
}

.sm-memo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
}

.sm-memo-block-title {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.sm-memo-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.52;
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
}

.sm-memo-list li {
  margin-bottom: 4px;
}

.sm-memo-note {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.5;
  padding-top: 8px;
  border-top: 1px solid rgba(16, 185, 129, 0.16);
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
}

.sm-memo-locked {
  text-align: left;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.55;
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
}

.sm-price-history {
  margin-top: 10px;
}

.sm-price-history .ph-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  margin-bottom: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: rgba(248, 250, 252, 0.78);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.sm-history-label {
  margin: 12px 0 8px;
}

.sm-price-history .ph-main {
  min-width: 0;
}

.sm-price-history .ph-date,
.sm-price-history .ph-sub {
  display: block;
}

.sm-price-history .ph-date {
  color: var(--text);
  font-weight: 800;
}

.sm-price-history a.ph-date {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 700;
}

.sm-price-history a.ph-date:hover {
  text-decoration: underline;
}

.sm-price-history .ph-sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.sm-price-history .ph-price {
  font-weight: 800;
  color: var(--text);
  min-width: 64px;
  text-align: right;
}

.sm-price-history .ph-change {
  font-weight: 800;
  color: #047857;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.78rem;
}

.sm-price-history .ph-change.is-down {
  color: #047857;
}

.sm-price-history .ph-lot-link {
  font-size: 0.76rem;
  color: #64748b;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}

.sm-price-history .ph-lot-link:hover {
  color: #4338ca;
  border-color: #6366f1;
}

.sm-price-history .ph-row:last-child .ph-price {
  color: #10b981;
}

.sm-empty-state {
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.08);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 0.82rem;
  text-align: center;
}

.sm-comps-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sm-comp-card {
  display: block;
  min-height: 66px;
  background: rgba(248, 250, 252, 0.82);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
}

.sm-comp-card.is-current {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.03));
  border-color: rgba(16, 185, 129, 0.3);
}

.sm-comp-card.is-clickable {
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.sm-comp-card.is-clickable:hover {
  border-color: rgba(99, 102, 241, 0.28);
  background: rgba(248, 250, 252, 0.96);
  transform: translateY(-1px);
}

.sm-comps-list:not(.is-expanded) .sm-comp-extra {
  display: none;
}

.sm-comp-main {
  min-width: 0;
}

.sm-comp-title-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.sm-comp-kicker {
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.sm-comp-title {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sm-current-badge,
.sm-comp-source-badge {
  flex-shrink: 0;
  color: #0f766e;
  background: rgba(20, 184, 166, 0.1);
  border: 1px solid rgba(20, 184, 166, 0.25);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 850;
}

.sm-comp-source-badge {
  color: #4338ca;
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.22);
}

.sm-comp-metrics {
  display: flex;
  gap: 6px;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 7px;
}

.sm-comp-metrics > span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--text);
  white-space: nowrap;
}

.sm-comp-metrics > .sm-current-badge {
  color: #0f766e;
  background: rgba(20, 184, 166, 0.1);
  border-color: rgba(20, 184, 166, 0.25);
}

.sm-comp-metrics b {
  font-size: 0.78rem;
}

.sm-comp-metrics small {
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 750;
}

.sm-comps-toggle {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.06);
  color: #4f46e5;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.76rem;
  font-weight: 850;
}

.sm-comps-toggle:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.34);
}

@media (max-width: 720px) {
  .sm-comp-card {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .sm-comp-metrics,
  .sm-comp-links {
    justify-content: flex-start;
  }
}

[data-theme="dark"] .sm-detail-title,
[data-theme="dark"] .sm-price-history .ph-row,
[data-theme="dark"] .sm-comp-card,
[data-theme="dark"] .sm-memo-metric {
  background: rgba(15, 23, 42, 0.72);
}

[data-theme="dark"] .sm-title-main {
  color: var(--text);
}

[data-theme="dark"] .sm-comp-metrics > span {
  background: rgba(15, 23, 42, 0.88);
}

[data-theme="dark"] .sm-comp-metrics > .sm-current-badge {
  background: rgba(20, 184, 166, 0.12);
}

[data-theme="dark"] .sm-comp-card.is-clickable:hover {
  background: rgba(15, 23, 42, 0.9);
}

[data-theme="dark"] .sm-summary-item {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(99, 102, 241, 0.22);
}

.sm-comps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.sm-comps-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
}

.sm-comps-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.sm-comps-table tr:last-child {
  background: rgba(16, 185, 129, 0.06);
}

.sm-comps-table tr:last-child td {
  font-weight: 700;
  border-bottom: none;
}

.sm-comps-table tr:last-child td:nth-child(3) {
  color: #10b981;
}

.sm-comps-link {
  color: #4338ca;
  font-weight: 700;
  text-decoration: none;
}

.sm-comps-link:hover {
  text-decoration: underline;
}

.sm-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px;
}

.sm-tags-wrap span {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 650;
}

[data-theme="light"] .sm-tags-wrap span {
  background: #f1f5f9;
}

.sm-action-bar {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.sm-btn-zalo {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #eef2ff;
  border: 2px solid #2563eb;
  color: #2563eb;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.2s;
}

.sm-btn-zalo:hover {
  background: #2563eb;
  color: #fff;
}

.sm-btn-detail {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  transition: all 0.2s;
}

.sm-btn-detail:hover {
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  body.signal-modal-open {
    overflow: hidden;
  }

  body.signal-modal-open .mobile-bottom-nav,
  body.signal-modal-open .floating-actions {
    display: none !important;
  }

  #signalModal {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: var(--surface-solid);
    backdrop-filter: none;
  }

  #signalModal .signal-modal-content {
    width: 100vw !important;
    max-width: none !important;
    height: 100vh !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding-bottom: calc(86px + env(safe-area-inset-bottom)) !important;
    animation: none;
  }

  @supports (height: 100dvh) {
    #signalModal .signal-modal-content {
      height: 100dvh !important;
    }
  }

  #signalModal .close-modal {
    position: fixed !important;
    top: max(12px, env(safe-area-inset-top));
    right: 12px !important;
    z-index: 30 !important;
    width: 42px;
    height: 42px;
    color: #fff;
    background: rgba(15, 23, 42, 0.68);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.22);
  }

  .sm-content {
    display: block;
    min-height: 100%;
  }

  .sm-left,
  .sm-right {
    overflow: visible;
    border: 0;
    padding: 0 16px;
  }

  .sm-left {
    padding-bottom: 0;
  }

  .sm-right {
    padding-top: 0;
  }

  #signalModal .sm-slider {
    width: auto;
    height: auto !important;
    aspect-ratio: 4 / 3;
    max-height: 46vh;
    margin: 0 -16px 10px;
    border-radius: 0 0 18px 18px;
  }

  @supports (height: 100dvh) {
    #signalModal .sm-slider {
      max-height: 46dvh;
    }
  }

  #signalModal .sm-slider img {
    object-fit: contain !important;
  }

  #sm-dots {
    bottom: 54px !important;
  }

  .sm-thumbs {
    gap: 7px;
    margin: 0 -16px 12px;
    padding: 0 16px 7px;
    scroll-snap-type: x proximity;
  }

  .sm-thumbs img {
    width: 64px;
    height: 48px;
    border-radius: 9px;
    scroll-snap-align: start;
  }

  .sm-signal-badge {
    margin-bottom: 8px;
  }

  .sm-signal-badge span {
    font-size: 0.68rem;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 0.03em;
  }

  .sm-detail-title {
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 0.98rem;
    line-height: 1.4;
  }

  .sm-title-main {
    color: var(--text);
    font-size: 1.04rem;
    line-height: 1.38;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .sm-title-sub {
    margin-top: 4px;
    font-size: 0.82rem;
    line-height: 1.45;
    text-align: left;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .sm-meta-line {
    gap: 6px;
    margin-bottom: 9px;
    font-size: 0.75rem;
  }

  .sm-summary-grid {
    gap: 7px;
    margin: 9px 0 11px;
  }

  .sm-summary-item {
    border-radius: 11px;
    padding: 9px 8px;
  }

  .sm-summary-item span {
    font-size: 0.61rem;
    letter-spacing: 0.02em;
  }

  .sm-summary-item strong {
    font-size: 0.96rem;
  }

  .sm-summary-item small {
    font-size: 0.66rem;
  }

  .sm-tags-wrap {
    gap: 6px;
    margin: 8px 0 12px;
  }

  .sm-tags-wrap span {
    padding: 5px 8px;
    font-size: 0.69rem;
  }

  .sm-mobile-tabs {
    position: sticky;
    top: 0;
    z-index: 14;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 0 -16px 12px;
    padding: 8px 16px;
    background: rgba(248, 250, 252, 0.96);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
  }

  [data-theme="dark"] .sm-mobile-tabs {
    background: rgba(15, 23, 42, 0.94);
  }

  .sm-tab {
    min-width: 0;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.66);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 850;
    cursor: pointer;
    white-space: nowrap;
  }

  .sm-tab.active {
    border-color: rgba(37, 99, 235, 0.34);
    background: #eef2ff;
    color: #2563eb;
  }

  [data-theme="dark"] .sm-tab {
    background: rgba(15, 23, 42, 0.72);
  }

  [data-theme="dark"] .sm-tab.active {
    background: rgba(37, 99, 235, 0.18);
  }

  .sm-panel {
    display: none;
  }

  .sm-overview-panel,
  .sm-panel.active {
    display: block;
  }

  .sm-section {
    margin-bottom: 14px;
  }

  .sm-section-label {
    margin-bottom: 8px;
    padding-bottom: 6px;
    font-size: 0.66rem;
  }

  .sm-desc-text,
  .sm-ai-text,
  .sm-memo-summary,
  .sm-memo-list,
  .sm-memo-note,
  .sm-memo-locked {
    text-align: left;
    text-align-last: auto;
    text-justify: auto;
  }

  .sm-desc-text {
    border-radius: 14px;
    padding: 12px 13px;
    font-size: 0.88rem;
    line-height: 1.65;
  }

  .sm-comp-card {
    min-height: 62px;
    border-radius: 12px;
    padding: 10px 11px;
  }

  .sm-comp-title-line {
    grid-template-columns: minmax(0, 1fr);
  }

  .sm-comp-title {
    font-size: 0.8rem;
    text-align: left;
  }

  .sm-comp-metrics {
    gap: 5px;
  }

  .sm-current-badge,
  .sm-comp-source-badge {
    justify-self: start;
    width: max-content;
    font-size: 0.66rem;
  }

  #sm-history-section {
    margin-bottom: 0 !important;
  }

  #sm-history-section > div:first-child {
    height: 178px !important;
    margin-bottom: 10px;
  }

  .sm-price-history .ph-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 6px;
    border-radius: 12px;
    padding: 10px 11px;
  }

  .sm-price-history .ph-change,
  .sm-price-history .ph-lot-link {
    justify-self: end;
  }

  .sm-action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(248, 250, 252, 0.96);
    border-top: 1px solid var(--border);
    box-shadow: 0 -14px 30px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(18px);
  }

  [data-theme="dark"] .sm-action-bar {
    background: rgba(15, 23, 42, 0.96);
  }

  .sm-btn-zalo,
  .sm-btn-detail {
    min-height: 48px;
    padding: 12px 10px;
    border-radius: 14px;
    font-size: 0.84rem;
    white-space: nowrap;
  }
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  color: #fff;
  background: rgba(15, 23, 42, 0.58);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-nav:hover {
  background: rgba(30, 41, 59, 0.82);
}

.gallery-prev {
  left: 14px;
}

.gallery-next {
  right: 14px;
}
