:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --card: #ffffff;
  --ink: #111827;
  --muted: #657083;
  --line: #dbe3ef;
  --blue: #245ee8;
  --blue-soft: #eaf1ff;
  --green: #0b8f5a;
  --green-soft: #e7f8ef;
  --amber: #a46706;
  --amber-soft: #fff5dc;
  --red: #b50d35;
  --shadow: 0 18px 48px rgba(31, 45, 74, 0.12);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(36, 94, 232, 0.12), transparent 28rem),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 48%, #edf2f8 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 18px 28px;
}


.site-return-nav {
  position: sticky;
  top: max(10px, env(safe-area-inset-top));
  z-index: 32;
  display: flex;
  justify-content: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 10px;
  padding: 7px;
  overflow-x: auto;
  border: 1px solid rgba(219, 227, 239, 0.92);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 16px 36px rgba(31, 45, 74, 0.12);
  backdrop-filter: blur(18px);
}

.site-return-nav a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  color: #334155;
  text-decoration: none;
  font-size: 12px;
  font-weight: 950;
}

.site-return-nav a:hover,
.site-return-nav a:focus-visible {
  color: #fff;
  background: #111827;
  outline: none;
}
.topbar {
  position: sticky;
  top: 58px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0 14px;
  background: rgba(246, 249, 253, 0.86);
  backdrop-filter: blur(18px);
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.guide-button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #bfd2ff;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 950;
  box-shadow: 0 8px 20px rgba(36, 94, 232, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0;
}

.brand img {
  width: 54px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(17, 24, 39, 0.13));
}

.connection-pill,
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 8px 20px rgba(31, 45, 74, 0.07);
}

.connection-pill.online {
  color: var(--green);
  background: var(--green-soft);
  border-color: #bdebd3;
}

.connection-pill.offline {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #ffe0a3;
}

.tabbar {
  position: sticky;
  top: 118px;
  z-index: 18;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 4px 0 18px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 34px rgba(31, 45, 74, 0.08);
}

.tab-button {
  min-height: 48px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: #445066;
  font-weight: 900;
}

.tab-button.active {
  background: #111827;
  color: #fff;
  box-shadow: 0 14px 26px rgba(17, 24, 39, 0.18);
}

.view-panel {
  display: none;
  animation: panelIn 260ms ease both;
}

.view-panel.active {
  display: block;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0;
}

.section-heading p,
.sync-kicker {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-heading h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 76px);
  line-height: 0.92;
  letter-spacing: 0;
}

.filters {
  display: grid;
  grid-template-columns: auto repeat(6, minmax(118px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 360;
  overflow: visible;
  isolation: isolate;
}

.filters label {
  display: grid;
  gap: 6px;
  color: #657083;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  z-index: 365;
  overflow: visible;
}

.filters select,
.filters input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 0 13px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 14px;
  font-weight: 780;
  outline: none;
}

.filters select:focus,
.filters input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(36, 94, 232, 0.12);
}

.gallery-native-filter {
  display: none;
}

.gallery-check-filter {
  position: relative;
  z-index: 370;
}

.gallery-check-filter:focus-within,
.gallery-check-filter.is-open {
  z-index: 520;
}

.gallery-check-filter-button {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 0 36px 0 13px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-check-filter-button::after {
  content: "⌄";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-53%);
  color: #64748b;
  font-size: 16px;
}

.gallery-check-filter-button[aria-expanded="true"] {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(36, 94, 232, 0.12);
}

.gallery-check-filter-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 620;
  width: min(280px, 86vw);
  max-height: 310px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 44px rgba(31, 45, 74, 0.18);
}

.gallery-check-filter-panel label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 7px 9px;
  border-radius: 12px;
  color: #111827;
  font-size: 12px;
  font-weight: 900;
  text-transform: none;
  letter-spacing: 0;
}

.gallery-check-filter-panel label:hover {
  background: var(--blue-soft);
}

.gallery-check-filter-panel input {
  width: 16px;
  min-height: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--blue);
}

.gallery-check-all {
  color: var(--blue) !important;
  background: #f6f9ff;
}

.gallery-import-unlock {
  display: flex;
  align-items: end;
}

.gallery-import-unlock button {
  min-height: 48px;
  white-space: nowrap;
  border: 0;
  border-radius: 999px;
  padding: 0 20px;
  background: #111827;
  color: #fff;
  font-weight: 950;
  box-shadow: 0 12px 26px rgba(17, 24, 39, 0.18);
}

.gallery-import-unlock button:active {
  transform: translateY(1px);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.model-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-align: left;
}

.model-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--blue), #22c55e, #f59e0b);
  opacity: 0.78;
}

.model-card button {
  appearance: none;
}

.model-photo {
  width: 100%;
  aspect-ratio: 1.2;
  border: 0;
  border-radius: 18px;
  background: #f7f9fc;
  overflow: hidden;
}

.model-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.model-copy {
  display: grid;
  gap: 8px;
}

.model-copy h2 {
  margin: 0;
  font-size: 22px;
  line-height: 0.98;
  letter-spacing: 0;
}

.model-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.model-copy .brand-label {
  display: inline-flex;
  width: fit-content;
  min-height: 25px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  background: #f8fafc;
  color: #263244;
  font-size: 12px;
  font-weight: 950;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid #d9e2f2;
  background: #f5f8ff;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.chip.green {
  background: var(--green-soft);
  border-color: #bdebd3;
  color: var(--green);
}

.chip.amber {
  background: var(--amber-soft);
  border-color: #ffe0a3;
  color: var(--amber);
}

.open-card {
  align-self: end;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-weight: 950;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed #cbd5e1;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
  font-weight: 850;
}

.device-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.metric-group {
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.metric-group.update-group {
  grid-column: 1 / -1;
}

.metric-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.metric-heading > span {
  width: 44px;
  height: 44px;
  border-radius: 16px;
}

.online-group .metric-heading > span {
  background: linear-gradient(135deg, #dff8ec, #9de7c0);
}

.local-group .metric-heading > span {
  background: linear-gradient(135deg, #e7f0ff, #a9c7ff);
}

.update-group .metric-heading > span {
  background: linear-gradient(135deg, #fff4d6, #ffd98a);
}

.metric-heading small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-heading h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.metrics-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-card,
.sync-card,
.install-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px;
}

.metric-card.online {
  background: linear-gradient(180deg, #f4fff9, #ffffff);
  border-color: #bdebd3;
}

.metric-card.local {
  background: linear-gradient(180deg, #f5f9ff, #ffffff);
  border-color: #bfd2ff;
}

.metric-card.pending {
  background: linear-gradient(180deg, #fff9e9, #ffffff);
  border-color: #ffe0a3;
}

.metric-card small {
  display: block;
  color: var(--muted);
  font-weight: 900;
}

.metric-card strong {
  display: block;
  margin-top: 4px;
  font-size: 42px;
  line-height: 0.95;
}

.metric-card.online strong {
  color: var(--green);
}

.metric-card.local strong {
  color: var(--blue);
}

.metric-card.pending strong {
  color: var(--amber);
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.sync-card,
.install-card {
  margin-top: 16px;
  padding: 22px;
}

.sync-card h2,
.install-card h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.sync-card p,
.install-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 720;
}

.progress-track {
  height: 13px;
  margin: 18px 0 12px;
  border-radius: 999px;
  background: #e8eef7;
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #16a34a);
  transition: width 220ms ease;
}

.sync-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sync-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 15px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 850;
}

.primary-button,
.ghost-button {
  min-height: 52px;
  border-radius: 999px;
  padding: 0 24px;
  font-weight: 950;
}

.primary-button {
  border: 0;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 14px 30px rgba(36, 94, 232, 0.25);
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.guide-dialog {
  width: min(760px, calc(100% - 22px));
  max-height: calc(100dvh - 22px);
  border: 0;
  border-radius: 30px;
  padding: 0;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.34);
  overflow: hidden;
}

.guide-dialog::backdrop {
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(10px);
}

.business-gate-dialog {
  width: min(430px, calc(100% - 22px));
  border: 0;
  border-radius: 30px;
  padding: 0;
  background: #fff;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.34);
  overflow: hidden;
}

.business-gate-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(10px);
}

.business-gate-card {
  display: grid;
  gap: 14px;
  padding: 26px;
  background:
    radial-gradient(circle at top left, rgba(36, 94, 232, 0.12), transparent 14rem),
    #fff;
}

.business-gate-card p {
  margin: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.business-gate-card h2 {
  margin: 0;
  font-size: 30px;
  line-height: 0.95;
  letter-spacing: 0;
}

.business-gate-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.business-gate-actions button,
.business-pin button,
.business-gate-close {
  min-height: 50px;
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 950;
}

.business-gate-actions button {
  border: 1px solid #cfe0ff;
  background: var(--blue-soft);
  color: var(--blue);
}

.business-gate-actions button:last-child {
  border: 0;
  background: #111827;
  color: #fff;
  box-shadow: 0 12px 26px rgba(17, 24, 39, 0.18);
}

.business-pin {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cfe0ff;
  border-radius: 22px;
  background: #f8fbff;
}

.business-pin label {
  display: grid;
  gap: 6px;
  color: #657083;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.business-pin input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
  letter-spacing: 0.18em;
}

.business-pin button {
  border: 0;
  background: var(--green);
  color: #fff;
}

.business-gate-close {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.guide-close {
  background: #111827;
  color: #fff;
}

.guide-hero {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 34px 28px 24px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(36, 94, 232, 0.16), transparent 16rem),
    linear-gradient(180deg, #f8fbff, #ffffff);
  border-bottom: 1px solid var(--line);
}

.guide-hero img {
  width: 86px;
  height: 62px;
  object-fit: contain;
}

.guide-hero p {
  margin: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.guide-hero h2 {
  max-width: 560px;
  margin: 0;
  font-size: clamp(32px, 6vw, 58px);
  line-height: 0.94;
  letter-spacing: 0;
}

.guide-hero span {
  max-width: 560px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 760;
}

.guide-steps {
  display: grid;
  gap: 10px;
  padding: 20px;
}

.guide-steps article {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f8fafc;
}

.guide-steps strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: var(--blue);
  color: #fff;
  font-size: 18px;
  font-weight: 950;
}

.guide-steps h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.guide-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 730;
  line-height: 1.36;
}

.guide-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 20px 20px;
}

.detail-dialog {
  width: min(1120px, calc(100% - 20px));
  max-height: calc(100dvh - 24px);
  border: 0;
  border-radius: 28px;
  padding: 0;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.35);
}

.detail-dialog.gallery-mode {
  width: calc(100% - 18px);
  height: calc(100dvh - 18px);
  max-height: calc(100dvh - 18px);
  border-radius: 30px;
  background: rgba(8, 13, 24, 0.96);
  color: #fff;
}

.image-zoom-dialog {
  width: calc(100% - 18px);
  height: calc(100dvh - 18px);
  max-height: calc(100dvh - 18px);
  border: 0;
  border-radius: 28px;
  padding: 16px;
  background: rgba(8, 13, 24, 0.96);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.42);
}

.image-zoom-dialog::backdrop {
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
}

.share-dialog {
  width: min(440px, calc(100% - 22px));
  border: 0;
  border-radius: 26px;
  padding: 0;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.35);
}

.share-dialog::backdrop {
  background: rgba(15, 23, 42, 0.66);
  backdrop-filter: blur(8px);
}

.share-form {
  display: grid;
  gap: 12px;
  padding: 24px;
}

.share-form p {
  margin: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.share-form h2 {
  margin: -6px 0 4px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.share-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.share-form input,
.share-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: #f8fafc;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.share-form textarea {
  resize: vertical;
}

.share-form span,
.share-form small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
}

.share-form .primary-button {
  width: 100%;
  margin-top: 4px;
}

.share-form .primary-button:disabled {
  opacity: 0.62;
}

#imageZoom {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 22px;
  background: #fff;
}

.detail-dialog::backdrop {
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-weight: 950;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 22px;
  padding: 22px;
}

.gallery-mode .detail-layout {
  height: 100%;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 16px;
}

.detail-media {
  position: relative;
  display: grid;
  gap: 12px;
  align-content: start;
}

.gallery-mode .detail-media {
  min-height: 0;
  align-content: stretch;
}

#detailImage {
  width: 100%;
  max-height: min(62dvh, 620px);
  object-fit: contain;
  border-radius: 22px;
  background: #f8fafc;
}

.gallery-mode #detailImage {
  height: min(69dvh, 780px);
  max-height: none;
  border-radius: 24px;
  background: #fff;
}

.gallery-arrow {
  position: absolute;
  top: 42%;
  z-index: 3;
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #111827;
  font-size: 40px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}

.gallery-arrow.prev {
  left: 14px;
}

.gallery-arrow.next {
  right: 14px;
}

.gallery-arrow[hidden] {
  display: none;
}

.fullscreen-button {
  display: none;
}

.gallery-mode .fullscreen-button {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.86);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px);
}

.gallery-mode .fullscreen-button::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 4px;
  box-shadow: inset 0 0 0 4px rgba(17, 24, 39, 0.86);
}

.gallery-mode .fullscreen-button::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  right: 12px;
  top: 12px;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
}

.gallery-mode.stock-mode .fullscreen-button {
  display: none;
}

.slide-info {
  position: absolute;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  max-width: min(720px, calc(100% - 36px));
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.82);
  color: #fff;
  text-align: center;
  font-size: 14px;
  font-weight: 900;
  backdrop-filter: blur(14px);
}

.slide-info:empty {
  display: none;
}

.gallery-mode .slide-info {
  display: none;
}

.thumb-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.thumb-row button {
  flex: 0 0 82px;
  height: 66px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: #f1f5f9;
  overflow: hidden;
}

.thumb-row button.active {
  border-color: var(--blue);
}

.gallery-mode .thumb-row {
  justify-content: center;
  padding: 0 8px 6px;
}

.gallery-mode .thumb-row button {
  flex-basis: 86px;
  height: 62px;
  background: rgba(255, 255, 255, 0.14);
}

.thumb-row img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-copy {
  padding: 28px 8px 8px;
}

.gallery-mode .detail-copy {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  text-align: left;
  backdrop-filter: blur(14px);
}

.detail-copy > p {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.gallery-mode .detail-copy > p {
  grid-column: 1;
  grid-row: 1;
  margin: 0 0 2px;
  color: #f9c2cf;
  font-size: 10px;
}

.detail-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 0.9;
}

.gallery-mode .detail-copy h2 {
  grid-column: 1;
  grid-row: 2;
  margin: 0;
  color: #fff;
  font-size: clamp(22px, 2.7vw, 38px);
  line-height: 0.94;
}

.share-photo-button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: #16a34a;
  color: #fff;
  font-size: 13px;
  font-weight: 950;
  box-shadow: 0 14px 30px rgba(22, 163, 74, 0.24);
}

.gallery-mode .share-photo-button {
  grid-column: 2;
  grid-row: 1 / 3;
  width: 100%;
  min-height: 30px;
  padding: 7px 12px;
  font-size: 11px;
}

.gallery-mode .detail-copy .chip-row {
  grid-column: 1 / -1;
  grid-row: 3;
  display: grid;
  grid-template-columns: minmax(130px, 0.9fr) minmax(180px, 1.25fr) minmax(280px, 2fr) minmax(90px, 0.65fr);
  gap: 7px;
}

.detail-data-chip {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.1);
}

.detail-data-chip small {
  color: rgba(255, 255, 255, 0.66);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.detail-data-chip strong {
  color: #fff;
  font-size: 14px;
  font-weight: 950;
  line-height: 1.12;
  white-space: normal;
}

.run-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  overflow: visible;
  white-space: normal;
}

.run-chip-list b {
  padding: 3px 7px;
  border: 1px solid rgba(96, 165, 250, 0.38);
  border-radius: 999px;
  background: rgba(219, 234, 254, 0.95);
  color: #1d4ed8;
  font-size: 11px;
  line-height: 1.1;
}

.run-chip-list b:nth-child(2n) {
  border-color: rgba(167, 139, 250, 0.38);
  background: rgba(237, 233, 254, 0.95);
  color: #6d28d9;
}

.run-chip-list b:nth-child(3n) {
  border-color: rgba(52, 211, 153, 0.38);
  background: rgba(209, 250, 229, 0.95);
  color: #047857;
}

@media (min-width: 900px) and (orientation: landscape) {
  .gallery-mode:not(.stock-mode) .detail-layout {
    gap: 6px;
    padding: 12px;
  }

  .gallery-mode:not(.stock-mode) #detailImage {
    height: min(58dvh, 620px);
    border-radius: 22px;
  }

  .gallery-mode:not(.stock-mode) .thumb-row {
    padding: 0 8px 2px;
  }

  .gallery-mode:not(.stock-mode) .thumb-row button {
    flex-basis: 76px;
    height: 50px;
  }

  .gallery-mode:not(.stock-mode) .detail-copy {
    grid-template-columns: 1fr auto;
    gap: 5px 10px;
    padding: 6px 10px;
    border-radius: 16px;
  }

  .gallery-mode:not(.stock-mode) .detail-copy > p {
    font-size: 9px;
  }

  .gallery-mode:not(.stock-mode) .detail-copy h2 {
    font-size: clamp(20px, 2.15vw, 30px);
    line-height: 0.92;
  }

  .gallery-mode:not(.stock-mode) .share-photo-button {
    min-height: 28px;
    padding: 6px 11px;
    font-size: 10px;
  }

  .gallery-mode:not(.stock-mode) .detail-copy .chip-row {
    grid-template-columns: minmax(150px, 0.9fr) minmax(210px, 1.2fr) minmax(360px, 2.15fr) minmax(100px, 0.65fr);
    gap: 6px;
  }

  .gallery-mode:not(.stock-mode) .detail-data-chip {
    padding: 5px 8px;
    border-radius: 12px;
  }

  .gallery-mode:not(.stock-mode) .detail-data-chip strong {
    font-size: 12.5px;
    white-space: normal;
  }

  .gallery-mode:not(.stock-mode) .detail-data-chip small {
    color: rgba(255, 255, 255, 0.78);
    font-size: 8.5px;
  }

  .gallery-mode:not(.stock-mode) .run-chip-list {
    gap: 3px;
  }

  .gallery-mode:not(.stock-mode) .run-chip-list b {
    padding: 2px 6px;
    font-size: 10px;
  }
}

.gallery-mode .detail-block {
  display: none;
}

.gallery-mode.stock-mode .detail-copy {
  grid-template-columns: minmax(180px, 0.32fr) 1fr;
}

.gallery-mode.stock-mode .detail-block {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  margin: 2px 0 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.gallery-mode.stock-mode .stock-row {
  flex: 0 0 min(340px, 82vw);
  grid-template-columns: 1fr auto;
  gap: 8px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.gallery-mode.stock-mode .stock-row span {
  color: rgba(255, 255, 255, 0.76);
}

.detail-dialog.gallery-mode.stock-mode {
  width: min(1280px, calc(100% - 18px));
  height: auto;
  max-height: calc(100dvh - 18px);
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
}

.gallery-mode.stock-mode .detail-layout {
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  grid-template-rows: auto;
  gap: 22px;
  padding: 22px;
}

.gallery-mode.stock-mode .detail-media {
  align-content: stretch;
}

.gallery-mode.stock-mode #detailImage {
  height: min(72dvh, 720px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.12);
  cursor: zoom-in;
}

.gallery-mode.stock-mode .thumb-row {
  display: none;
}

.gallery-mode.stock-mode .detail-copy {
  align-content: start;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.12);
}

.gallery-mode.stock-mode .detail-copy > p {
  color: var(--blue);
  font-size: 12px;
}

.gallery-mode.stock-mode .detail-copy h2 {
  color: var(--ink);
  font-size: clamp(36px, 4.3vw, 60px);
  line-height: 0.96;
}

.gallery-mode.stock-mode .share-photo-button {
  grid-column: 1;
  grid-row: auto;
  justify-self: start;
  width: max-content;
  min-height: 42px;
  padding: 11px 18px;
  font-size: 14px;
}

.gallery-mode.stock-mode .detail-copy .chip-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gallery-mode.stock-mode .detail-data-chip {
  border-color: #dbeafe;
  background: #eff6ff;
  padding: 10px 12px;
}

.gallery-mode.stock-mode .detail-data-chip small {
  color: #475569;
}

.gallery-mode.stock-mode .detail-data-chip strong {
  color: #0f172a;
  font-size: 16px;
  white-space: normal;
}

.gallery-mode.stock-mode .detail-block {
  display: grid;
  gap: 10px;
  margin: 0;
  overflow: auto;
  max-height: min(32dvh, 290px);
}

.gallery-mode.stock-mode .stock-row {
  flex: initial;
  grid-template-columns: 1fr auto auto;
  border-color: var(--line);
  background: #f8fafc;
  color: var(--ink);
}

.gallery-mode.stock-mode .stock-row span {
  color: var(--muted);
}

.gallery-mode.stock-mode .run-chip-list b {
  background: #fff;
}

@media (min-width: 1180px) and (orientation: landscape) {
  .gallery-mode.stock-mode .detail-layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(390px, 0.75fr);
  }

  .gallery-mode.stock-mode #detailImage {
    height: min(76dvh, 760px);
  }
}

.detail-block {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.variant-row,
.stock-row {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}

.variant-row img {
  width: 76px;
  height: 58px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
}

.variant-row strong,
.stock-row strong {
  display: block;
  font-size: 15px;
}

.variant-row span,
.stock-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stock-row {
  grid-template-columns: 1fr auto auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 50;
  max-width: min(520px, calc(100% - 28px));
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  padding: 14px 18px;
  border-radius: 18px;
  background: #111827;
  color: #fff;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.28);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .app-shell {
    padding-inline: 12px;
  }

  
.topbar {
    align-items: flex-start;
  }

  .brand span {
    display: none;
  }

  .top-actions {
    gap: 6px;
  }

  .guide-button,
  .connection-pill {
    min-height: 36px;
    padding-inline: 12px;
    font-size: 12px;
  }

  .tabbar {
    top: 58px;
    grid-template-columns: 1fr;
    border-radius: 20px;
  }

  .tab-button {
    min-height: 44px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
    border-radius: 20px;
  }

  .search-field {
    grid-column: 1 / -1;
  }

  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .model-card {
    min-height: 252px;
    border-radius: 20px;
  }

  .model-copy h2 {
    font-size: 19px;
  }

  .device-dashboard,
  .metrics-grid,
  .metrics-grid.two {
    grid-template-columns: 1fr 1fr;
  }

  .detail-layout {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .detail-copy {
    padding: 0;
  }

  .gallery-mode .detail-layout {
    padding: 10px;
  }

  .guide-actions {
    grid-template-columns: 1fr;
  }

  .gallery-mode #detailImage {
    height: 58dvh;
  }

  .gallery-mode .detail-copy,
  .gallery-mode.stock-mode .detail-copy {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .gallery-mode .detail-copy .chip-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 899px) and (orientation: landscape) {
  .gallery-mode:not(.stock-mode) .detail-layout {
    gap: 6px;
    padding: 8px;
  }

  .gallery-mode:not(.stock-mode) #detailImage {
    height: 50dvh;
  }

  .gallery-mode:not(.stock-mode) .thumb-row button {
    flex-basis: 64px;
    height: 42px;
  }

  .gallery-mode:not(.stock-mode) .detail-copy {
    gap: 5px;
    padding: 6px 8px;
  }

  .gallery-mode:not(.stock-mode) .detail-copy h2 {
    font-size: clamp(18px, 3vw, 26px);
  }

  .gallery-mode:not(.stock-mode) .detail-copy .chip-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .gallery-mode:not(.stock-mode) .detail-data-chip {
    padding: 5px 7px;
  }

  .gallery-mode:not(.stock-mode) .detail-data-chip small {
    font-size: 8px;
  }

  .gallery-mode:not(.stock-mode) .detail-data-chip strong {
    font-size: 11px;
  }
}

@media (max-width: 520px) {
  .filters {
    grid-template-columns: 1fr;
  }

  .library-grid {
    grid-template-columns: 1fr;
  }

  .device-dashboard,
  .metrics-grid,
  .metrics-grid.two {
    grid-template-columns: 1fr;
  }

  .section-heading h1 {
    font-size: 42px;
  }

  .gallery-arrow {
    width: 46px;
    height: 46px;
    font-size: 34px;
  }

  .gallery-mode .thumb-row button {
    flex-basis: 76px;
    height: 58px;
  }

  .slide-info {
    display: none;
  }

  .gallery-mode .detail-copy {
    padding: 10px;
    border-radius: 18px;
  }

  .gallery-mode .detail-copy h2 {
    font-size: 28px;
  }

  .gallery-mode .detail-copy .chip-row {
    grid-template-columns: 1fr 1fr;
  }

  .detail-data-chip {
    padding: 8px;
  }
}

/* App gallery v2: simple, phone-first visual style. */
.tabbar {
  grid-template-columns: repeat(4, 1fr);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.app-gallery-card {
  min-height: 270px;
  grid-template-rows: 1fr auto;
  padding: 10px;
  border-radius: 28px;
}

.app-gallery-card::before {
  display: none;
}

.app-gallery-card .model-photo {
  aspect-ratio: 1;
  border-radius: 24px;
  background: #fff;
}

.app-gallery-card .model-copy {
  gap: 7px;
  padding: 2px 3px 4px;
}

.app-gallery-card .model-copy h2 {
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.03;
}

.compact-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compact-card-meta span,
.gallery-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 0 9px;
  border: 1px solid #dde6f3;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
}

.gallery-badge {
  background: #eaf7ef;
  border-color: #bfe8cc;
  color: #067647;
}

.gallery-badge.stock-total {
  background: #eef4ff;
  border-color: #bfd2ff;
  color: #245ee8;
}

.app-gallery-card .open-card {
  display: none;
}

.detail-dialog.gallery-mode {
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  background: #050609;
  color: #fff;
}

.detail-dialog.gallery-mode::backdrop {
  background: #050609;
  backdrop-filter: none;
}

.gallery-mode .detail-layout,
.gallery-mode.stock-mode .detail-layout {
  position: relative;
  display: grid;
  height: 100%;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 0;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.gallery-mode .detail-media,
.gallery-mode.stock-mode .detail-media {
  min-height: 0;
  display: grid;
  align-content: center;
}

.gallery-mode #detailImage,
.gallery-mode.stock-mode #detailImage {
  width: 100%;
  height: min(68dvh, 780px);
  max-height: none;
  object-fit: contain;
  border: 0;
  border-radius: 24px;
  background: #fff;
  box-shadow: none;
}

.gallery-mode .dialog-close {
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px);
}

.gallery-mode .fullscreen-button {
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.92);
}

.gallery-mode .fullscreen-button::before {
  border-color: #111827;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.92);
}

.gallery-mode .fullscreen-button::after {
  border-color: #111827;
}

.gallery-mode.stock-mode .fullscreen-button {
  display: grid;
}

.gallery-mode .detail-copy,
.gallery-mode.stock-mode .detail-copy {
  position: absolute;
  left: 50%;
  top: max(14px, env(safe-area-inset-top));
  z-index: 5;
  width: min(330px, calc(100% - 140px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  padding: 11px 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  text-align: center;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(18px);
}

.gallery-mode .detail-copy > p,
.gallery-mode.stock-mode .detail-copy > p {
  grid-row: 2;
  margin: 0;
  color: #4b5563;
  font-size: 12px;
  font-weight: 850;
  text-transform: none;
  letter-spacing: 0;
}

.gallery-mode .detail-copy h2,
.gallery-mode.stock-mode .detail-copy h2 {
  grid-row: 1;
  margin: 0;
  color: #111827;
  font-size: clamp(16px, 2.4vw, 22px);
  line-height: 1.05;
}

.gallery-mode .detail-copy .chip-row,
.gallery-mode.stock-mode .detail-copy .chip-row {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: min(390px, calc(100vw - 36px));
  gap: 7px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.gallery-mode .detail-data-chip,
.gallery-mode.stock-mode .detail-data-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #111827;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(16px);
}

.gallery-mode .detail-data-chip small,
.gallery-mode.stock-mode .detail-data-chip small {
  color: #475569;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gallery-mode .detail-data-chip strong,
.gallery-mode.stock-mode .detail-data-chip strong {
  color: #111827;
  font-size: 15px;
  line-height: 1;
}

.gallery-mode .run-chip-list,
.gallery-mode.stock-mode .run-chip-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}

.gallery-mode .run-chip-list b,
.gallery-mode.stock-mode .run-chip-list b {
  padding: 4px 8px;
  font-size: 12px;
}

.gallery-mode .share-photo-button,
.gallery-mode.stock-mode .share-photo-button {
  position: fixed;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 7;
  width: 68px;
  min-height: 58px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  font-size: 0;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(18px);
}

.gallery-mode .share-photo-button::before,
.gallery-mode.stock-mode .share-photo-button::before {
  content: "⇧";
  font-size: 28px;
  line-height: 1;
}

.gallery-mode .detail-block {
  display: none;
}

.gallery-mode.stock-mode .detail-block {
  grid-row: 3;
  display: flex;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0 8px 4px;
  max-height: none;
  overflow-x: auto;
}

.gallery-mode.stock-mode .stock-row {
  flex: 0 0 min(300px, 82vw);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.gallery-mode.stock-mode .stock-row span {
  color: rgba(255, 255, 255, 0.76);
}

.gallery-mode .thumb-row {
  grid-row: 2;
  justify-content: center;
  padding: 10px 70px 10px;
}

.gallery-mode .thumb-row button {
  flex: 0 0 52px;
  height: 60px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
}

.gallery-mode.stock-mode .thumb-row {
  display: none;
}

.gallery-mode .gallery-arrow {
  top: 50%;
  width: 50px;
  height: 50px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  font-size: 34px;
}

.gallery-mode .gallery-arrow.prev {
  left: max(14px, env(safe-area-inset-left));
}

.gallery-mode .gallery-arrow.next {
  right: max(14px, env(safe-area-inset-right));
}

@media (orientation: landscape) {
  .gallery-mode #detailImage,
  .gallery-mode.stock-mode #detailImage {
    height: min(70dvh, 680px);
  }

  .gallery-mode .thumb-row {
    padding-bottom: 4px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: max(8px, env(safe-area-inset-top)) 10px max(82px, env(safe-area-inset-bottom));
  }

  
.topbar {
    position: static;
    padding: 6px 0 8px;
  }

  .brand img {
    width: 42px;
    height: 32px;
  }

  .tabbar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    top: auto;
    z-index: 22;
    grid-template-columns: repeat(4, 1fr);
    margin: 0;
    border-radius: 24px;
  }

  .tab-button {
    min-height: 54px;
    border-radius: 18px;
    font-size: 11px;
  }

  .section-heading {
    margin: 12px 0;
  }

  .section-heading h1 {
    font-size: 34px;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
    padding: 10px;
    box-shadow: 0 8px 22px rgba(31, 45, 74, 0.08);
  }

  .filters label {
    font-size: 9px;
  }

  .filters .search-field {
    grid-column: 1 / -1;
  }

  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .app-gallery-card {
    min-height: 212px;
    border-radius: 22px;
  }

  .app-gallery-card .model-photo {
    border-radius: 18px;
  }

  .app-gallery-card .model-copy h2 {
    font-size: 15px;
  }

  .compact-card-meta {
    display: none;
  }

  .gallery-mode .detail-layout,
  .gallery-mode.stock-mode .detail-layout {
    padding-inline: 8px;
  }

  .gallery-mode #detailImage,
  .gallery-mode.stock-mode #detailImage {
    height: 63dvh;
    border-radius: 18px;
  }

  .gallery-mode .detail-copy,
  .gallery-mode.stock-mode .detail-copy {
    width: min(250px, calc(100% - 126px));
    padding: 9px 12px;
  }

  .gallery-mode .detail-copy h2,
  .gallery-mode.stock-mode .detail-copy h2 {
    font-size: 16px;
  }

  .gallery-mode .detail-copy > p,
  .gallery-mode.stock-mode .detail-copy > p {
    font-size: 11px;
  }

  .gallery-mode .detail-copy .chip-row,
  .gallery-mode.stock-mode .detail-copy .chip-row {
    top: auto;
    bottom: max(92px, calc(env(safe-area-inset-bottom) + 86px));
    transform: translateX(-50%);
    width: min(360px, calc(100vw - 28px));
  }

  .gallery-mode .detail-data-chip,
  .gallery-mode.stock-mode .detail-data-chip {
    padding: 7px 10px;
  }

  .gallery-mode .thumb-row {
    padding-inline: 82px;
  }

  .gallery-mode .thumb-row button {
    flex-basis: 44px;
    height: 52px;
  }

  .gallery-mode.stock-mode .detail-block {
    padding-inline: 76px 8px;
  }
}

/* App gallery v3: match approved mobile mockup more closely. */
body {
  background: #f4f7fb;
}

.app-shell {
  padding-bottom: max(96px, env(safe-area-inset-bottom));
}


.topbar {
  justify-content: center;
  padding: 16px 0 10px;
  background: transparent;
}

.brand {
  justify-self: center;
}

.brand img {
  width: 104px;
  height: 74px;
}

.top-actions {
  position: absolute;
  right: 18px;
}

.app-viewbar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 8px;
  border: 1px solid rgba(217, 226, 239, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 16px 34px rgba(16, 24, 40, 0.08);
  backdrop-filter: blur(18px);
}

.app-viewbar strong {
  text-align: center;
  font-size: 18px;
  font-weight: 950;
}

.icon-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: #111827;
  font-size: 20px;
  font-weight: 950;
  box-shadow: 0 10px 22px rgba(16, 24, 40, 0.07);
}

#catalogView .section-heading,
#stockView .section-heading {
  display: none;
}

#catalogView .filters,
#stockView .filters {
  position: relative;
  z-index: 360;
  display: none;
  margin-top: -4px;
  overflow: visible;
  isolation: isolate;
}

#catalogView .filters.open,
#stockView .filters.open {
  display: grid;
  animation: panelIn 180ms ease both;
}

.library-grid {
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 14px;
}

.model-card.app-gallery-card {
  min-height: 236px;
  border-radius: 26px;
  padding: 9px;
  box-shadow: 0 16px 32px rgba(16, 24, 40, 0.08);
}

.model-card.app-gallery-card .model-photo {
  aspect-ratio: 1.12;
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 22%, #fff, transparent 26%),
    linear-gradient(145deg, #eef3fa, #fff 48%, #d7e0ee);
}

.model-card.app-gallery-card .model-photo img {
  padding: 4px;
}

.model-card.app-gallery-card .model-copy {
  padding: 3px 5px 5px;
}

.model-card.app-gallery-card .model-copy h2 {
  font-size: 16px;
  text-align: center;
}

.compact-card-meta {
  justify-content: center;
}

.tabbar {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: max(14px, env(safe-area-inset-bottom));
  top: auto;
  z-index: 35;
  width: min(520px, calc(100% - 22px));
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 8px;
  transform: translateX(-50%);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.93);
}

.tab-button {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 58px;
  border-radius: 19px;
  color: #5b6678;
  font-size: 11px;
  line-height: 1;
}

.tab-button span {
  display: block;
  font-size: 19px;
  line-height: 1;
}

.tab-button.active {
  background: #111827;
  color: #fff;
}

.detail-dialog.gallery-mode {
  background: #000;
}

.gallery-mode .detail-layout,
.gallery-mode.stock-mode .detail-layout {
  padding: 0;
  background: #000;
}

.gallery-mode .detail-media,
.gallery-mode.stock-mode .detail-media {
  padding: max(86px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
}

.gallery-mode #detailImage,
.gallery-mode.stock-mode #detailImage {
  height: min(62dvh, 720px);
  border-radius: 0;
  background: #fff;
}

.gallery-mode .detail-copy,
.gallery-mode.stock-mode .detail-copy {
  top: max(18px, env(safe-area-inset-top));
  width: min(290px, calc(100% - 140px));
  min-height: 60px;
  padding: 10px 16px;
}

.gallery-mode .detail-copy .chip-row,
.gallery-mode.stock-mode .detail-copy .chip-row {
  top: auto;
  bottom: max(98px, calc(env(safe-area-inset-bottom) + 86px));
  width: min(440px, calc(100vw - 34px));
  transform: translateX(-50%);
}

.gallery-mode .detail-data-chip,
.gallery-mode.stock-mode .detail-data-chip {
  background: rgba(255, 255, 255, 0.92);
}

.gallery-mode .thumb-row {
  align-items: center;
  justify-content: flex-start;
  grid-row: 2;
  width: 100%;
  padding: 12px 96px 10px;
  background: rgba(248, 250, 253, 0.96);
}

.gallery-mode .thumb-row button {
  flex-basis: 46px;
  height: 54px;
  border-radius: 10px;
  background: #fff;
}

.gallery-mode .share-photo-button,
.gallery-mode.stock-mode .share-photo-button {
  left: max(18px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 66px;
  min-height: 58px;
}

.gallery-mode .share-photo-button::before,
.gallery-mode.stock-mode .share-photo-button::before {
  content: "↥";
}

.gallery-mode::after {
  content: "♡   i   ☷";
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 6;
  display: grid;
  place-items: center;
  width: 180px;
  min-height: 58px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  font-size: 24px;
  font-weight: 850;
  letter-spacing: 0.55em;
  text-indent: 0.55em;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(18px);
}

.gallery-mode .dialog-close {
  right: max(18px, env(safe-area-inset-right));
  top: max(18px, env(safe-area-inset-top));
}

.gallery-mode .fullscreen-button {
  left: max(18px, env(safe-area-inset-left));
  top: max(18px, env(safe-area-inset-top));
}

@media (min-width: 760px) {
  .app-shell {
    width: min(1180px, 100%);
  }

  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }
}

@media (orientation: landscape) {
  .gallery-mode .detail-media,
  .gallery-mode.stock-mode .detail-media {
    padding-top: max(78px, env(safe-area-inset-top));
  }

  .gallery-mode #detailImage,
  .gallery-mode.stock-mode #detailImage {
    height: 58dvh;
  }

  .gallery-mode .detail-copy .chip-row,
  .gallery-mode.stock-mode .detail-copy .chip-row {
    bottom: max(78px, calc(env(safe-area-inset-bottom) + 66px));
  }
}

@media (max-width: 720px) {
  .top-actions {
    right: 10px;
    top: max(14px, env(safe-area-inset-top));
  }

  .guide-button {
    display: none;
  }

  .connection-pill {
    min-height: 32px;
    padding-inline: 10px;
    font-size: 10px;
  }

  .brand img {
    width: 78px;
    height: 56px;
  }

  .app-viewbar {
    margin-top: 4px;
  }

  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .model-card.app-gallery-card {
    min-height: 190px;
  }

  .gallery-mode .detail-media,
  .gallery-mode.stock-mode .detail-media {
    padding-inline: 0;
  }

  .gallery-mode #detailImage,
  .gallery-mode.stock-mode #detailImage {
    height: 56dvh;
  }
}

/* App gallery v4: clean photo-browser controls and playlist-style favorites. */
.catalog-gallery-card .compact-card-meta {
  display: none !important;
}

.stock-gallery-card .stock-card-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.stock-gallery-card .stock-card-meta span {
  border: 1px solid #dbe4f0;
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff;
  color: #111827;
  font-size: 11px;
  font-weight: 850;
}

.fullscreen-button,
.gallery-mode .fullscreen-button,
.gallery-mode.stock-mode .fullscreen-button {
  display: none !important;
}

.gallery-mode::after {
  display: none !important;
  content: none !important;
}

.gallery-mode .detail-layout,
.gallery-mode.stock-mode .detail-layout {
  grid-template-columns: 1fr !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  gap: 0 !important;
  overflow: hidden;
}

.gallery-mode .detail-media,
.gallery-mode.stock-mode .detail-media {
  min-height: 0;
  padding: max(78px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)) !important;
}

.gallery-mode #detailImage,
.gallery-mode.stock-mode #detailImage {
  height: min(60dvh, 690px) !important;
  width: 100%;
  object-fit: contain;
  border-radius: 0 !important;
  box-shadow: none !important;
  cursor: default !important;
}

.gallery-mode .detail-copy,
.gallery-mode.stock-mode .detail-copy {
  position: fixed !important;
  left: 50% !important;
  top: max(16px, env(safe-area-inset-top)) !important;
  bottom: auto !important;
  transform: translateX(-50%) !important;
  z-index: 8;
  display: grid !important;
  width: min(300px, calc(100vw - 150px)) !important;
  min-height: 56px;
  padding: 9px 14px !important;
  border: 0 !important;
  border-radius: 24px !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: #111827 !important;
  text-align: center !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(18px);
}

.gallery-mode .detail-copy > p,
.gallery-mode.stock-mode .detail-copy > p {
  color: #5b6474 !important;
  font-size: 10px !important;
  line-height: 1;
  margin: 2px 0 0 !important;
  order: 2;
}

.gallery-mode .detail-copy h2,
.gallery-mode.stock-mode .detail-copy h2 {
  color: #111827 !important;
  font-size: clamp(20px, 4.2vw, 34px) !important;
  line-height: 0.95 !important;
  margin: 0 !important;
  order: 1;
}

.gallery-mode .detail-copy .chip-row,
.gallery-mode.stock-mode .detail-copy .chip-row {
  position: fixed !important;
  left: 50%;
  top: auto !important;
  bottom: max(18px, env(safe-area-inset-bottom)) !important;
  transform: translateX(-50%) !important;
  z-index: 9;
  display: flex !important;
  width: min(420px, calc(100vw - 176px)) !important;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 8px !important;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(18px);
  overflow-x: auto;
}

.gallery-mode .detail-data-chip,
.gallery-mode.stock-mode .detail-data-chip {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 180px;
  padding: 4px 8px !important;
  border-radius: 999px !important;
  background: rgba(244, 247, 251, 0.95) !important;
  color: #111827 !important;
  box-shadow: none !important;
}

.gallery-mode .detail-data-chip small,
.gallery-mode.stock-mode .detail-data-chip small {
  font-size: 8px !important;
  color: #64748b !important;
}

.gallery-mode .detail-data-chip strong,
.gallery-mode.stock-mode .detail-data-chip strong {
  font-size: 13px !important;
  color: #111827 !important;
  white-space: nowrap;
}

.gallery-mode .run-chip-list {
  display: flex;
  gap: 4px;
}

.gallery-mode .run-chip-list b {
  padding: 3px 7px;
  border-radius: 999px;
  background: #e8f0ff;
  color: #2563eb;
  font-size: 12px;
}

.gallery-mode .thumb-row,
.gallery-mode.stock-mode .thumb-row {
  display: flex !important;
  grid-row: 2;
  width: 100%;
  justify-content: flex-start;
  padding: 10px 96px 10px !important;
  background: rgba(248, 250, 253, 0.96);
}

.gallery-mode .thumb-row button,
.gallery-mode.stock-mode .thumb-row button {
  flex: 0 0 48px !important;
  height: 54px !important;
  border-radius: 10px;
}

.favorite-photo-button,
.gallery-mode .share-photo-button,
.gallery-mode.stock-mode .share-photo-button {
  position: fixed !important;
  bottom: max(18px, env(safe-area-inset-bottom)) !important;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 66px !important;
  min-height: 58px !important;
  padding: 0 !important;
  border: 0;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: #111827 !important;
  font-size: 0 !important;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(18px);
}

.favorite-photo-button {
  left: max(18px, env(safe-area-inset-left)) !important;
  font-size: 30px !important;
  font-weight: 900;
}

.gallery-mode .share-photo-button,
.gallery-mode.stock-mode .share-photo-button {
  left: auto !important;
  right: max(18px, env(safe-area-inset-right)) !important;
}

.gallery-mode .share-photo-button::before,
.gallery-mode.stock-mode .share-photo-button::before {
  content: "⇧" !important;
  font-size: 30px;
  line-height: 1;
}

.gallery-mode .detail-block,
.gallery-mode.stock-mode .detail-block {
  display: none !important;
}

.favorite-dialog {
  width: min(430px, calc(100% - 24px));
  border: 0;
  border-radius: 26px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.favorite-form {
  display: grid;
  gap: 14px;
  padding: 26px;
}

.favorite-form p {
  margin: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.favorite-form h2 {
  margin: 0;
  font-size: 30px;
}

.favorite-form label {
  display: grid;
  gap: 7px;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.favorite-form input,
.favorite-form select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d8e1ee;
  border-radius: 16px;
  padding: 0 14px;
  background: #f8fafc;
  color: #111827;
  font-size: 15px;
  font-weight: 850;
  text-transform: none;
}

.favorite-lists-card {
  grid-column: 1 / -1;
}

.favorite-lists-panel {
  display: grid;
  gap: 10px;
}

.favorite-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #dbe4f0;
  border-radius: 18px;
  padding: 12px;
  background: #f8fafc;
}

.favorite-list-item strong,
.favorite-list-item span {
  display: block;
}

.favorite-list-item span {
  margin-top: 2px;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.favorite-list-thumbs {
  display: flex;
  gap: 4px;
}

.favorite-list-thumbs img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  background: #fff;
}

.empty-state.compact {
  margin: 0;
  padding: 12px;
  font-size: 13px;
}

@media (orientation: landscape) {
  .gallery-mode #detailImage,
  .gallery-mode.stock-mode #detailImage {
    height: 57dvh !important;
  }

  .gallery-mode .detail-copy,
  .gallery-mode.stock-mode .detail-copy {
    min-height: 52px;
    padding-block: 8px !important;
  }

  .gallery-mode .thumb-row,
  .gallery-mode.stock-mode .thumb-row {
    padding-top: 7px !important;
    padding-bottom: 7px !important;
  }
}

@media (max-width: 720px) {
  .gallery-mode .detail-copy,
  .gallery-mode.stock-mode .detail-copy {
    width: min(250px, calc(100vw - 132px)) !important;
  }

  .gallery-mode .detail-copy .chip-row,
  .gallery-mode.stock-mode .detail-copy .chip-row {
    width: min(300px, calc(100vw - 164px)) !important;
  }
}

/* Final gallery viewer layout: title/SKU top, product facts and actions bottom. */
.gallery-mode .fullscreen-button,
.gallery-mode.stock-mode .fullscreen-button {
  display: none !important;
}

.gallery-mode .detail-copy,
.gallery-mode.stock-mode .detail-copy {
  position: fixed !important;
  left: 50% !important;
  top: max(14px, env(safe-area-inset-top)) !important;
  bottom: auto !important;
  transform: translateX(-50%) !important;
  z-index: 8 !important;
  width: min(340px, calc(100vw - 154px)) !important;
  min-height: 58px !important;
  display: grid !important;
  justify-items: center !important;
  gap: 1px !important;
  padding: 9px 16px !important;
  border: 0 !important;
  border-radius: 24px !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: #111827 !important;
  text-align: center !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16) !important;
  backdrop-filter: blur(18px) !important;
}

.gallery-mode .detail-copy h2,
.gallery-mode.stock-mode .detail-copy h2 {
  order: 1 !important;
  max-width: 100% !important;
  margin: 0 !important;
  color: #111827 !important;
  font-size: clamp(20px, 3.2vw, 34px) !important;
  line-height: 0.95 !important;
  white-space: normal !important;
}

.gallery-mode .detail-copy > p,
.gallery-mode.stock-mode .detail-copy > p {
  order: 2 !important;
  margin: 2px 0 0 !important;
  color: #5b6474 !important;
  font-size: 11px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.gallery-mode .detail-copy .chip-row,
.gallery-mode.stock-mode .detail-copy .chip-row {
  position: fixed !important;
  left: 50% !important;
  top: auto !important;
  bottom: max(18px, env(safe-area-inset-bottom)) !important;
  transform: translateX(-50%) !important;
  z-index: 9 !important;
  width: min(520px, calc(100vw - 184px)) !important;
  min-height: 58px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  padding: 7px 12px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.92) !important;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16) !important;
  backdrop-filter: blur(18px) !important;
  overflow-x: auto !important;
  pointer-events: auto !important;
}

.gallery-mode .detail-data-chip,
.gallery-mode.stock-mode .detail-data-chip {
  flex: 0 0 auto !important;
  max-width: 220px !important;
  min-height: 40px !important;
  padding: 5px 10px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(244, 247, 251, 0.96) !important;
  color: #111827 !important;
  box-shadow: none !important;
}

.gallery-mode .detail-data-chip small,
.gallery-mode.stock-mode .detail-data-chip small {
  color: #64748b !important;
  font-size: 8px !important;
  font-weight: 950 !important;
  line-height: 1 !important;
}

.gallery-mode .detail-data-chip strong,
.gallery-mode.stock-mode .detail-data-chip strong {
  color: #111827 !important;
  font-size: 14px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.gallery-mode .run-chip-list,
.gallery-mode.stock-mode .run-chip-list {
  display: inline-flex !important;
  flex-wrap: nowrap !important;
  gap: 4px !important;
}

.gallery-mode .run-chip-list b,
.gallery-mode.stock-mode .run-chip-list b {
  padding: 3px 7px !important;
  border-radius: 999px !important;
  background: #e8f0ff !important;
  color: #2563eb !important;
  font-size: 12px !important;
  line-height: 1 !important;
}

.favorite-photo-button,
.gallery-mode .share-photo-button,
.gallery-mode.stock-mode .share-photo-button {
  position: fixed !important;
  top: auto !important;
  bottom: max(18px, env(safe-area-inset-bottom)) !important;
  z-index: 10 !important;
  display: grid !important;
  place-items: center !important;
  width: 66px !important;
  min-height: 58px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: #111827 !important;
  font-size: 0 !important;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16) !important;
  backdrop-filter: blur(18px) !important;
}

.favorite-photo-button {
  left: max(18px, env(safe-area-inset-left)) !important;
  font-size: 30px !important;
  font-weight: 900 !important;
}

.gallery-mode .share-photo-button,
.gallery-mode.stock-mode .share-photo-button {
  left: auto !important;
  right: max(18px, env(safe-area-inset-right)) !important;
}

.gallery-mode .share-photo-button::before,
.gallery-mode.stock-mode .share-photo-button::before {
  content: "\21E7" !important;
  font-size: 30px !important;
  line-height: 1 !important;
}

@media (orientation: landscape) {
  .gallery-mode .detail-media,
  .gallery-mode.stock-mode .detail-media {
    padding-top: max(82px, env(safe-area-inset-top)) !important;
  }

  .gallery-mode #detailImage,
  .gallery-mode.stock-mode #detailImage {
    height: min(61dvh, 700px) !important;
  }

  .gallery-mode .thumb-row,
  .gallery-mode.stock-mode .thumb-row {
    padding-bottom: max(82px, env(safe-area-inset-bottom)) !important;
  }
}

@media (max-width: 720px) {
  .gallery-mode .detail-copy,
  .gallery-mode.stock-mode .detail-copy {
    width: min(260px, calc(100vw - 132px)) !important;
  }

  .gallery-mode .detail-copy .chip-row,
  .gallery-mode.stock-mode .detail-copy .chip-row {
    width: min(360px, calc(100vw - 170px)) !important;
  }
}

/* Viewer hard split: title capsule stays top; color/runs/actions live in the bottom bar. */
.gallery-mode .detail-bottom-bar,
.gallery-mode.stock-mode .detail-bottom-bar {
  position: fixed !important;
  left: max(18px, env(safe-area-inset-left)) !important;
  right: max(18px, env(safe-area-inset-right)) !important;
  bottom: max(18px, env(safe-area-inset-bottom)) !important;
  z-index: 12 !important;
  display: grid !important;
  grid-template-columns: 66px minmax(0, 1fr) 66px !important;
  align-items: center !important;
  gap: 12px !important;
  pointer-events: none !important;
}

.gallery-mode .detail-bottom-bar .chip-row,
.gallery-mode.stock-mode .detail-bottom-bar .chip-row {
  position: static !important;
  left: auto !important;
  top: auto !important;
  bottom: auto !important;
  transform: none !important;
  z-index: auto !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 58px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  padding: 7px 12px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.92) !important;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16) !important;
  backdrop-filter: blur(18px) !important;
  overflow-x: auto !important;
  pointer-events: auto !important;
}

.gallery-mode .detail-bottom-bar .favorite-photo-button,
.gallery-mode .detail-bottom-bar .share-photo-button,
.gallery-mode.stock-mode .detail-bottom-bar .favorite-photo-button,
.gallery-mode.stock-mode .detail-bottom-bar .share-photo-button {
  position: static !important;
  inset: auto !important;
  display: grid !important;
  place-items: center !important;
  width: 66px !important;
  height: 58px !important;
  min-height: 58px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: #111827 !important;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16) !important;
  backdrop-filter: blur(18px) !important;
  pointer-events: auto !important;
}

.gallery-mode .detail-bottom-bar .favorite-photo-button,
.gallery-mode.stock-mode .detail-bottom-bar .favorite-photo-button {
  font-size: 30px !important;
  font-weight: 900 !important;
}

.gallery-mode .detail-bottom-bar .share-photo-button,
.gallery-mode.stock-mode .detail-bottom-bar .share-photo-button {
  font-size: 0 !important;
}

.gallery-mode .detail-bottom-bar .share-photo-button::before,
.gallery-mode.stock-mode .detail-bottom-bar .share-photo-button::before {
  content: "\21E7" !important;
  font-size: 30px !important;
  line-height: 1 !important;
}

.gallery-mode .detail-bottom-bar .detail-block,
.gallery-mode.stock-mode .detail-bottom-bar .detail-block {
  display: none !important;
}

@media (orientation: landscape) {
  .gallery-mode .thumb-row,
  .gallery-mode.stock-mode .thumb-row {
    padding-bottom: max(90px, calc(env(safe-area-inset-bottom) + 84px)) !important;
  }
}

@media (max-width: 720px) {
  .gallery-mode .detail-bottom-bar,
  .gallery-mode.stock-mode .detail-bottom-bar {
    grid-template-columns: 58px minmax(0, 1fr) 58px !important;
    gap: 8px !important;
  }

  .gallery-mode .detail-bottom-bar .favorite-photo-button,
  .gallery-mode .detail-bottom-bar .share-photo-button,
  .gallery-mode.stock-mode .detail-bottom-bar .favorite-photo-button,
  .gallery-mode.stock-mode .detail-bottom-bar .share-photo-button {
    width: 58px !important;
    height: 54px !important;
    min-height: 54px !important;
  }

  .gallery-mode .detail-bottom-bar .chip-row,
  .gallery-mode.stock-mode .detail-bottom-bar .chip-row {
    min-height: 54px !important;
  }
}

/* Prevent accidental browser zoom while navigating photos in the viewer. */
.detail-dialog,
.detail-dialog .detail-card,
.detail-dialog .detail-media,
.detail-dialog #detailImage,
.detail-dialog .thumb-row,
.detail-dialog .thumb-row button,
.detail-dialog .gallery-arrow,
.detail-dialog .close-detail,
.detail-dialog .detail-bottom-bar,
.detail-dialog .detail-bottom-bar button {
  touch-action: manipulation !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* Final viewer placement: actions left, metadata centered, thumbnails compact. */
.gallery-mode .detail-bottom-bar,
.gallery-mode.stock-mode .detail-bottom-bar {
  left: 0 !important;
  right: 0 !important;
  bottom: max(22px, env(safe-area-inset-bottom)) !important;
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  padding: 0 18px !important;
}

.gallery-mode .detail-bottom-bar .favorite-photo-button,
.gallery-mode .detail-bottom-bar .share-photo-button,
.gallery-mode.stock-mode .detail-bottom-bar .favorite-photo-button,
.gallery-mode.stock-mode .detail-bottom-bar .share-photo-button {
  position: fixed !important;
  bottom: max(20px, env(safe-area-inset-bottom)) !important;
  width: 58px !important;
  height: 58px !important;
  min-height: 58px !important;
}

.gallery-mode .detail-bottom-bar .favorite-photo-button,
.gallery-mode.stock-mode .detail-bottom-bar .favorite-photo-button {
  left: max(16px, env(safe-area-inset-left)) !important;
}

.gallery-mode .detail-bottom-bar .share-photo-button,
.gallery-mode.stock-mode .detail-bottom-bar .share-photo-button {
  left: max(84px, calc(env(safe-area-inset-left) + 84px)) !important;
  right: auto !important;
}

.gallery-mode .detail-bottom-bar .chip-row,
.gallery-mode.stock-mode .detail-bottom-bar .chip-row {
  width: auto !important;
  max-width: min(720px, calc(100vw - 220px)) !important;
  min-height: 54px !important;
  margin: 0 auto !important;
  flex: 0 1 auto !important;
}

.gallery-mode .thumb-row,
.gallery-mode.stock-mode .thumb-row {
  min-height: 78px !important;
  max-height: 92px !important;
  padding: 8px max(112px, env(safe-area-inset-left)) 8px max(112px, env(safe-area-inset-right)) !important;
  align-items: center !important;
  justify-content: center !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

.gallery-mode .thumb-row button,
.gallery-mode.stock-mode .thumb-row button {
  flex: 0 0 54px !important;
  width: 54px !important;
  height: 54px !important;
}

@media (max-width: 760px) {
  .gallery-mode .detail-bottom-bar,
  .gallery-mode.stock-mode .detail-bottom-bar {
    bottom: max(18px, env(safe-area-inset-bottom)) !important;
  }

  .gallery-mode .detail-bottom-bar .chip-row,
  .gallery-mode.stock-mode .detail-bottom-bar .chip-row {
    max-width: min(520px, calc(100vw - 164px)) !important;
    padding: 6px 9px !important;
    gap: 6px !important;
  }

  .gallery-mode .detail-bottom-bar .favorite-photo-button,
  .gallery-mode .detail-bottom-bar .share-photo-button,
  .gallery-mode.stock-mode .detail-bottom-bar .favorite-photo-button,
  .gallery-mode.stock-mode .detail-bottom-bar .share-photo-button {
    width: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
  }

  .gallery-mode .detail-bottom-bar .share-photo-button,
  .gallery-mode.stock-mode .detail-bottom-bar .share-photo-button {
    left: max(76px, calc(env(safe-area-inset-left) + 76px)) !important;
  }
}

/* Mobile viewer: keep actions away from the centered metadata pill. */
@media (max-width: 820px) {
  .gallery-mode .detail-bottom-bar,
  .gallery-mode.stock-mode .detail-bottom-bar {
    bottom: max(14px, env(safe-area-inset-bottom)) !important;
    padding: 0 72px !important;
  }

  .gallery-mode .detail-bottom-bar .favorite-photo-button,
  .gallery-mode.stock-mode .detail-bottom-bar .favorite-photo-button {
    left: max(12px, env(safe-area-inset-left)) !important;
    right: auto !important;
    bottom: max(14px, env(safe-area-inset-bottom)) !important;
  }

  .gallery-mode .detail-bottom-bar .share-photo-button,
  .gallery-mode.stock-mode .detail-bottom-bar .share-photo-button {
    left: auto !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    bottom: max(14px, env(safe-area-inset-bottom)) !important;
  }

  .gallery-mode .detail-bottom-bar .chip-row,
  .gallery-mode.stock-mode .detail-bottom-bar .chip-row {
    max-width: calc(100vw - 156px) !important;
    min-height: 50px !important;
    padding: 6px 8px !important;
    gap: 5px !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
  }

  .gallery-mode .detail-bottom-bar .chip,
  .gallery-mode.stock-mode .detail-bottom-bar .chip {
    max-width: 96px !important;
    min-width: 0 !important;
    padding: 5px 7px !important;
    font-size: 11px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .gallery-mode .detail-bottom-bar .chip small,
  .gallery-mode.stock-mode .detail-bottom-bar .chip small {
    display: none !important;
  }

  .gallery-mode .detail-bottom-bar .chip.run-chip,
  .gallery-mode.stock-mode .detail-bottom-bar .chip.run-chip {
    max-width: 112px !important;
  }
}

/* Mobile viewer metadata, real chip classes. Keeps total visible without horizontal scrolling. */
@media (max-width: 820px) {
  .gallery-mode .detail-bottom-bar .chip-row,
  .gallery-mode.stock-mode .detail-bottom-bar .chip-row {
    width: min(252px, calc(100vw - 148px)) !important;
    max-width: min(252px, calc(100vw - 148px)) !important;
    min-height: 0 !important;
    max-height: none !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 7px 9px !important;
    border-radius: 24px !important;
    overflow: visible !important;
  }

  .gallery-mode .detail-bottom-bar .detail-data-chip,
  .gallery-mode.stock-mode .detail-bottom-bar .detail-data-chip {
    flex: 0 1 auto !important;
    max-width: 112px !important;
    min-width: 0 !important;
    padding: 4px 7px !important;
    border-radius: 999px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .gallery-mode .detail-bottom-bar .detail-data-chip small,
  .gallery-mode.stock-mode .detail-bottom-bar .detail-data-chip small {
    display: none !important;
  }

  .gallery-mode .detail-bottom-bar .detail-data-chip strong,
  .gallery-mode.stock-mode .detail-bottom-bar .detail-data-chip strong {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 11px !important;
    line-height: 1.05 !important;
  }

  .gallery-mode.stock-mode .detail-bottom-bar .detail-data-chip:nth-child(3) {
    order: -1 !important;
    flex-basis: 100% !important;
    max-width: 100% !important;
    background: rgba(255, 255, 255, 0.96) !important;
  }

  .gallery-mode.stock-mode .detail-bottom-bar .detail-data-chip:nth-child(3) strong {
    font-size: 13px !important;
  }

  .gallery-mode .detail-bottom-bar .run-chip-list,
  .gallery-mode.stock-mode .detail-bottom-bar .run-chip-list {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 3px !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .gallery-mode .detail-bottom-bar .run-chip-list b,
  .gallery-mode.stock-mode .detail-bottom-bar .run-chip-list b {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    padding: 2px 5px !important;
    font-size: 10px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}



@media (max-width: 720px) {
  .site-return-nav {
    justify-content: flex-start;
    width: 100%;
    margin-bottom: 8px;
  }

  .topbar {
    top: 62px;
  }

  .tabbar {
    top: 122px;
  }
}

/* Mobile app navigation: final guard so the lower bar never jumps or stretches. */
@media (max-width: 820px) {
  .app-shell {
    padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important;
  }

  .tabbar {
    position: fixed !important;
    left: max(10px, env(safe-area-inset-left)) !important;
    right: max(10px, env(safe-area-inset-right)) !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
    top: auto !important;
    width: auto !important;
    max-width: none !important;
    min-height: 68px !important;
    margin: 0 !important;
    padding: 7px !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
    transform: none !important;
    overflow: visible !important;
    border-radius: 24px !important;
    z-index: 90 !important;
  }

  .tab-button {
    min-width: 0 !important;
    width: 100% !important;
    height: 54px !important;
    min-height: 54px !important;
    padding: 4px 2px !important;
    display: grid !important;
    grid-template-rows: 22px 1fr !important;
    place-items: center !important;
    gap: 1px !important;
    border-radius: 18px !important;
    font-size: 10px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .tab-button span {
    display: block !important;
    font-size: 18px !important;
    line-height: 1 !important;
  }
}

@media (max-width: 380px) {
  .tabbar {
    gap: 4px !important;
    padding: 6px !important;
  }

  .tab-button {
    font-size: 9px !important;
  }

  .tab-button span {
    font-size: 17px !important;
  }
}

/* Rescue patch 2026-07-18 disabled: this block was too aggressive for the
   existing gallery viewer. The stable viewer rules above are allowed to win.
.business-gate-dialog[open] {
  z-index: 8000 !important;
}

.business-gate-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42) !important;
  backdrop-filter: blur(16px) !important;
}

/* ACTIVE FINAL: galeria stable viewer. Must remain at EOF. */
.detail-dialog.gallery-mode[open],
.detail-dialog.gallery-mode.stock-mode[open] {
  inset: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  background: #030712 !important;
  touch-action: manipulation !important;
}

.detail-dialog.gallery-mode[open] .detail-layout,
.detail-dialog.gallery-mode.stock-mode[open] .detail-layout {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  overflow: hidden !important;
}

.detail-dialog.gallery-mode[open] .detail-copy,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
  position: fixed !important;
  left: 50% !important;
  top: max(12px, env(safe-area-inset-top)) !important;
  bottom: auto !important;
  z-index: 40 !important;
  width: min(360px, calc(100vw - 116px)) !important;
  min-height: 58px !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  place-items: center !important;
  gap: 2px !important;
  padding: 10px 18px !important;
  border: 0 !important;
  border-radius: 28px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: #111827 !important;
  text-align: center !important;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.22) !important;
  backdrop-filter: blur(18px) !important;
}

.detail-dialog.gallery-mode[open] .detail-copy h2,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy h2 {
  margin: 0 !important;
  color: #111827 !important;
  font-size: clamp(22px, 3.5vw, 34px) !important;
  line-height: 0.98 !important;
  letter-spacing: 0 !important;
}

.detail-dialog.gallery-mode[open] .detail-copy > p,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy > p {
  margin: 2px 0 0 !important;
  color: #64748b !important;
  font-size: 11px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.detail-dialog.gallery-mode[open] .detail-copy .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy .chip-row {
  display: none !important;
}

.detail-dialog.gallery-mode[open] .dialog-close,
.detail-dialog.gallery-mode.stock-mode[open] .dialog-close {
  position: fixed !important;
  top: max(14px, env(safe-area-inset-top)) !important;
  right: max(14px, env(safe-area-inset-right)) !important;
  z-index: 45 !important;
}

.detail-dialog.gallery-mode[open] .detail-media,
.detail-dialog.gallery-mode.stock-mode[open] .detail-media {
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  place-items: center !important;
  padding: max(92px, calc(env(safe-area-inset-top) + 78px)) 24px max(170px, calc(env(safe-area-inset-bottom) + 158px)) !important;
  overflow: hidden !important;
}

.detail-dialog.gallery-mode[open] #detailImage,
.detail-dialog.gallery-mode.stock-mode[open] #detailImage {
  width: auto !important;
  max-width: min(100%, 1380px) !important;
  height: auto !important;
  max-height: 100% !important;
  object-fit: contain !important;
  border-radius: 0 !important;
  background: #fff !important;
  box-shadow: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow {
  position: fixed !important;
  top: 50% !important;
  z-index: 35 !important;
  transform: translateY(-50%) !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow.prev,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow.prev {
  left: max(16px, env(safe-area-inset-left)) !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow.next,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow.next {
  right: max(16px, env(safe-area-inset-right)) !important;
}

.detail-dialog.gallery-mode[open] .thumb-row,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 84px)) !important;
  z-index: 34 !important;
  width: min(980px, calc(100vw - 48px)) !important;
  min-height: 64px !important;
  max-height: 72px !important;
  transform: translateX(-50%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 7px 12px !important;
  border-radius: 0 !important;
  background: rgba(241, 245, 249, 0.94) !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  box-shadow: none !important;
}

.detail-dialog.gallery-mode[open] .thumb-row button,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
  flex: 0 0 52px !important;
  width: 52px !important;
  height: 52px !important;
  border-radius: 10px !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: max(16px, env(safe-area-inset-bottom)) !important;
  z-index: 42 !important;
  width: min(720px, calc(100vw - 32px)) !important;
  min-height: 58px !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  grid-template-columns: 58px minmax(0, 1fr) 58px !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
  position: static !important;
  inset: auto !important;
  width: 58px !important;
  height: 58px !important;
  min-height: 58px !important;
  display: grid !important;
  place-items: center !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  color: #111827 !important;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.18) !important;
  backdrop-filter: blur(18px) !important;
  pointer-events: auto !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button {
  font-size: 30px !important;
  font-weight: 900 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
  font-size: 0 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button::before,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button::before {
  content: "\21E7" !important;
  font-size: 30px !important;
  line-height: 1 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
  position: static !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 54px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 7px 10px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.18) !important;
  backdrop-filter: blur(18px) !important;
  overflow: visible !important;
  pointer-events: auto !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
  flex: 0 1 auto !important;
  max-width: 160px !important;
  min-width: 0 !important;
  min-height: 34px !important;
  padding: 5px 9px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: #f4f7fb !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip small,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip small {
  display: none !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip strong,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
  color: #111827 !important;
  font-size: 13px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list {
  display: inline-flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 4px !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
  padding: 3px 7px !important;
  border-radius: 999px !important;
  background: #e8f0ff !important;
  color: #2563eb !important;
  font-size: 12px !important;
  line-height: 1 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .detail-block,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .detail-block {
  display: none !important;
}

@media (max-width: 720px) {
  .detail-dialog.gallery-mode[open] .detail-copy,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
    width: min(270px, calc(100vw - 104px)) !important;
    min-height: 56px !important;
    padding: 9px 14px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-copy h2,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy h2 {
    font-size: clamp(22px, 7vw, 32px) !important;
  }

  .detail-dialog.gallery-mode[open] .detail-media,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-media {
    padding: max(92px, calc(env(safe-area-inset-top) + 78px)) 12px max(164px, calc(env(safe-area-inset-bottom) + 150px)) !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
    width: calc(100vw - 24px) !important;
    min-height: 62px !important;
    max-height: 68px !important;
    justify-content: flex-start !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row button,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
    flex-basis: 50px !important;
    width: 50px !important;
    height: 50px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
    width: calc(100vw - 18px) !important;
    grid-template-columns: 52px minmax(0, 1fr) 52px !important;
    gap: 7px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
    width: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
    min-height: 50px !important;
    padding: 6px 7px !important;
    gap: 5px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
    max-width: 108px !important;
    min-height: 30px !important;
    padding: 4px 7px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip strong,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
    font-size: 11px !important;
  }

  .detail-dialog.gallery-mode[open] .run-chip-list b,
  .detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
    padding: 2px 5px !important;
    font-size: 10px !important;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .detail-dialog.gallery-mode[open] .detail-media,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-media {
    padding-top: max(72px, env(safe-area-inset-top)) !important;
    padding-bottom: max(144px, calc(env(safe-area-inset-bottom) + 132px)) !important;
  }

  .detail-dialog.gallery-mode[open] .detail-copy,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
    min-height: 50px !important;
    padding-block: 7px !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
    bottom: max(78px, calc(env(safe-area-inset-bottom) + 72px)) !important;
    min-height: 58px !important;
    max-height: 64px !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row button,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
    flex-basis: 46px !important;
    width: 46px !important;
    height: 46px !important;
  }
}

/* Final override: gallery viewer buttons and corrida colors. */
.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button {
  grid-column: 1 !important;
  grid-row: 1 !important;
  justify-self: start !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
  grid-column: 3 !important;
  grid-row: 1 !important;
  justify-self: end !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button::before,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button::before {
  content: none !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button svg,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button svg,
.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button svg,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button svg {
  display: block !important;
  width: 28px !important;
  height: 28px !important;
  fill: currentColor !important;
  color: #111827 !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
  color: #111827 !important;
  font-weight: 950 !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-blue,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-blue {
  background: #dbeafe !important;
  border: 1px solid #93c5fd !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-violet,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-violet {
  background: #ede9fe !important;
  border: 1px solid #c4b5fd !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-green,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-green {
  background: #dcfce7 !important;
  border: 1px solid #86efac !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-amber,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-amber {
  background: #fef3c7 !important;
  border: 1px solid #fbbf24 !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-pink,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-pink {
  background: #fce7f3 !important;
  border: 1px solid #f9a8d4 !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-cyan,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-cyan {
  background: #cffafe !important;
  border: 1px solid #67e8f9 !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-neutral,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-neutral {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
}

/* Gallery viewer hard lock: keep the requested Apple-like layout stable. */
.detail-dialog.gallery-mode[open] .detail-bottom-bar,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
  grid-template-columns: 60px minmax(220px, 1fr) 60px !important;
  align-items: center !important;
  justify-items: stretch !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
  grid-column: 1 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
  grid-column: 2 !important;
  max-width: 100% !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button {
  grid-column: 3 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button::before,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button::before,
.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button::before,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button::before {
  content: none !important;
  display: none !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button svg,
.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button svg,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button svg,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button svg {
  width: 29px !important;
  height: 29px !important;
}

@media (max-width: 520px) {
  .detail-dialog.gallery-mode[open] .detail-bottom-bar,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
    width: calc(100vw - 12px) !important;
    grid-template-columns: 48px minmax(0, 1fr) 48px !important;
    gap: 5px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
    width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
    min-height: 48px !important;
    padding: 5px 6px !important;
    gap: 4px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
    max-width: 92px !important;
  }
}

/* Final gallery repair: stable icons, fixed nav, and Apple-like viewer layout. */
.tab-button svg,
.icon-button svg,
.share-photo-button svg,
.favorite-photo-button svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
}

.tab-button span {
  display: grid;
  place-items: center;
}

.icon-button {
  display: grid !important;
  place-items: center !important;
  font-size: 0 !important;
  color: #111827 !important;
}

.site-return-nav {
  position: relative !important;
  z-index: 80 !important;
  margin: 0 auto 26px !important;
  transform: none !important;
}

.fullscreen-button,
#openImageFullscreen {
  display: none !important;
}

.detail-dialog.gallery-mode[open],
.detail-dialog.gallery-mode.stock-mode[open] {
  inset: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #030712 !important;
  overflow: hidden !important;
  touch-action: manipulation !important;
}

.detail-dialog.gallery-mode[open] .detail-layout,
.detail-dialog.gallery-mode.stock-mode[open] .detail-layout {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.detail-dialog.gallery-mode[open] .detail-copy,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
  position: fixed !important;
  left: 50% !important;
  top: max(12px, env(safe-area-inset-top)) !important;
  bottom: auto !important;
  width: min(360px, calc(100vw - 104px)) !important;
  min-height: 58px !important;
  transform: translateX(-50%) !important;
  z-index: 50 !important;
  display: grid !important;
  place-items: center !important;
  gap: 2px !important;
  padding: 10px 18px !important;
  border: 0 !important;
  border-radius: 28px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: #111827 !important;
  text-align: center !important;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.22) !important;
  backdrop-filter: blur(18px) !important;
}

.detail-dialog.gallery-mode[open] .detail-copy h2,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy h2 {
  margin: 0 !important;
  color: #111827 !important;
  font-size: clamp(24px, 3.4vw, 36px) !important;
  line-height: 0.98 !important;
  letter-spacing: 0 !important;
}

.detail-dialog.gallery-mode[open] .detail-copy > p,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy > p {
  margin: 2px 0 0 !important;
  color: #64748b !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.detail-dialog.gallery-mode[open] .detail-copy .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy .chip-row {
  display: none !important;
}

.detail-dialog.gallery-mode[open] .dialog-close,
.detail-dialog.gallery-mode.stock-mode[open] .dialog-close {
  position: fixed !important;
  top: max(14px, env(safe-area-inset-top)) !important;
  right: max(14px, env(safe-area-inset-right)) !important;
  z-index: 60 !important;
}

.detail-dialog.gallery-mode[open] .detail-media,
.detail-dialog.gallery-mode.stock-mode[open] .detail-media {
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  align-items: center !important;
  justify-items: center !important;
  gap: 12px !important;
  padding: max(94px, calc(env(safe-area-inset-top) + 78px)) 24px max(132px, calc(env(safe-area-inset-bottom) + 120px)) !important;
  overflow: hidden !important;
}

.detail-dialog.gallery-mode[open] #detailImage,
.detail-dialog.gallery-mode.stock-mode[open] #detailImage {
  width: auto !important;
  max-width: min(100%, 1280px) !important;
  height: auto !important;
  max-height: min(66dvh, 680px) !important;
  object-fit: contain !important;
  border-radius: 0 !important;
  background: #fff !important;
  box-shadow: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  touch-action: manipulation !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow {
  position: fixed !important;
  top: 50% !important;
  z-index: 45 !important;
  transform: translateY(-50%) !important;
  width: 54px !important;
  height: 54px !important;
  border-radius: 999px !important;
  border: 0 !important;
  background: rgba(255, 255, 255, 0.96) !important;
  color: #111827 !important;
  font-size: 44px !important;
  line-height: 1 !important;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18) !important;
  touch-action: manipulation !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow.prev,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow.prev {
  left: max(16px, env(safe-area-inset-left)) !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow.next,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow.next {
  right: max(16px, env(safe-area-inset-right)) !important;
}

.detail-dialog.gallery-mode[open] .thumb-row,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
  position: fixed !important;
  left: 50% !important;
  bottom: max(86px, calc(env(safe-area-inset-bottom) + 78px)) !important;
  z-index: 43 !important;
  width: max-content !important;
  max-width: min(900px, calc(100vw - 36px)) !important;
  min-height: 58px !important;
  max-height: 66px !important;
  transform: translateX(-50%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  padding: 6px 10px !important;
  border-radius: 0 !important;
  background: rgba(241, 245, 249, 0.92) !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  box-shadow: none !important;
}

.detail-dialog.gallery-mode[open] .thumb-row button,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
  flex: 0 0 50px !important;
  width: 50px !important;
  height: 50px !important;
  border-radius: 10px !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
  position: fixed !important;
  left: 50% !important;
  bottom: max(14px, env(safe-area-inset-bottom)) !important;
  z-index: 55 !important;
  width: min(640px, calc(100vw - 30px)) !important;
  min-height: 56px !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  grid-template-columns: 56px minmax(0, 1fr) 56px !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button {
  position: static !important;
  inset: auto !important;
  width: 56px !important;
  min-width: 56px !important;
  height: 56px !important;
  min-height: 56px !important;
  display: grid !important;
  place-items: center !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  color: #111827 !important;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.18) !important;
  backdrop-filter: blur(18px) !important;
  pointer-events: auto !important;
  font-size: 0 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button::before,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button::before {
  content: none !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button svg,
.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button svg,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button svg,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button svg {
  width: 28px !important;
  height: 28px !important;
  fill: currentColor !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 50px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 7px 10px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.18) !important;
  backdrop-filter: blur(18px) !important;
  overflow: hidden !important;
  pointer-events: auto !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
  flex: 0 1 auto !important;
  max-width: 150px !important;
  min-width: 0 !important;
  min-height: 30px !important;
  padding: 4px 9px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: #f4f7fb !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip small,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip small {
  display: none !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip strong,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
  color: #111827 !important;
  font-size: 13px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list {
  display: inline-flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 4px !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
  padding: 3px 7px !important;
  border-radius: 999px !important;
  background: #e8f0ff !important;
  color: #2563eb !important;
  font-size: 12px !important;
  line-height: 1 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .detail-block,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .detail-block,
.detail-dialog.gallery-mode[open] .slide-info,
.detail-dialog.gallery-mode.stock-mode[open] .slide-info {
  display: none !important;
}

@media (max-width: 720px) {
  .detail-dialog.gallery-mode[open] .detail-copy,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
    width: min(272px, calc(100vw - 104px)) !important;
    min-height: 54px !important;
    padding: 8px 14px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-copy h2,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy h2 {
    font-size: clamp(22px, 7vw, 30px) !important;
  }

  .detail-dialog.gallery-mode[open] .detail-media,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-media {
    padding: max(90px, calc(env(safe-area-inset-top) + 74px)) 10px max(146px, calc(env(safe-area-inset-bottom) + 132px)) !important;
  }

  .detail-dialog.gallery-mode[open] #detailImage,
  .detail-dialog.gallery-mode.stock-mode[open] #detailImage {
    max-height: min(60dvh, 590px) !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 70px)) !important;
    max-width: calc(100vw - 22px) !important;
    min-height: 56px !important;
    max-height: 62px !important;
    padding: 6px 9px !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row button,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
    flex-basis: 48px !important;
    width: 48px !important;
    height: 48px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
    width: calc(100vw - 18px) !important;
    grid-template-columns: 52px minmax(0, 1fr) 52px !important;
    gap: 6px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
  .detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button {
    width: 52px !important;
    min-width: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
    min-height: 48px !important;
    padding: 6px 7px !important;
    gap: 5px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
    max-width: 112px !important;
    min-height: 28px !important;
    padding: 4px 7px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip strong,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
    font-size: 11px !important;
  }

  .detail-dialog.gallery-mode[open] .run-chip-list b,
  .detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
    padding: 2px 5px !important;
    font-size: 10px !important;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .detail-dialog.gallery-mode[open] .detail-media,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-media {
    padding-top: max(72px, env(safe-area-inset-top)) !important;
    padding-bottom: max(124px, calc(env(safe-area-inset-bottom) + 112px)) !important;
  }

  .detail-dialog.gallery-mode[open] #detailImage,
  .detail-dialog.gallery-mode.stock-mode[open] #detailImage {
    max-height: min(58dvh, 540px) !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
    bottom: max(72px, calc(env(safe-area-inset-bottom) + 66px)) !important;
    min-height: 54px !important;
    max-height: 60px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
    min-height: 52px !important;
  }
}

/* REAL EOF FIX 2026-07-18: Galeria lower nav and viewer controls.
   Keep this as the last block; older duplicated rules above were overriding
   the menu position and painting the selected tab black. */
.app-shell {
  padding-bottom: max(112px, calc(env(safe-area-inset-bottom) + 104px)) !important;
}

.tabbar {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: max(14px, calc(env(safe-area-inset-bottom) + 10px)) !important;
  z-index: 1200 !important;
  width: min(520px, calc(100vw - 24px)) !important;
  max-width: calc(100vw - 24px) !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 6px !important;
  margin: 0 !important;
  padding: 8px !important;
  border: 1px solid rgba(196, 208, 225, 0.86) !important;
  border-radius: 28px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14) !important;
  backdrop-filter: blur(20px) !important;
}

.tab-button {
  min-width: 0 !important;
  min-height: 58px !important;
  border: 0 !important;
  border-radius: 20px !important;
  background: transparent !important;
  color: #536174 !important;
  font-size: 11px !important;
  line-height: 1 !important;
}

.tab-button.active {
  background: linear-gradient(180deg, #eef5ff, #dfeaff) !important;
  color: #1747b8 !important;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2), 0 10px 24px rgba(37, 99, 235, 0.12) !important;
}

.tab-button.active span {
  color: #1747b8 !important;
}

#catalogView .filters,
#stockView .filters {
  z-index: 900 !important;
}

.gallery-check-filter-panel {
  z-index: 1300 !important;
}

.business-gate-dialog[open] {
  z-index: 9000 !important;
}

.detail-dialog.gallery-mode[open],
.detail-dialog.gallery-mode.stock-mode[open] {
  overscroll-behavior: contain !important;
  touch-action: manipulation !important;
}

.detail-dialog.gallery-mode[open] .detail-media,
.detail-dialog.gallery-mode.stock-mode[open] .detail-media {
  padding-bottom: max(152px, calc(env(safe-area-inset-bottom) + 140px)) !important;
}

.detail-dialog.gallery-mode[open] .thumb-row,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
  left: 50% !important;
  right: auto !important;
  bottom: max(80px, calc(env(safe-area-inset-bottom) + 74px)) !important;
  width: min(860px, calc(100vw - 28px)) !important;
  min-height: 58px !important;
  max-height: 66px !important;
  transform: translateX(-50%) !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 7px 10px !important;
  border-radius: 0 !important;
  background: rgba(241, 245, 249, 0.92) !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

.detail-dialog.gallery-mode[open] .thumb-row button,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
  flex: 0 0 48px !important;
  width: 48px !important;
  height: 48px !important;
  border-radius: 10px !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
  left: 50% !important;
  right: auto !important;
  bottom: max(14px, calc(env(safe-area-inset-bottom) + 8px)) !important;
  width: min(680px, calc(100vw - 28px)) !important;
  min-height: 58px !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  grid-template-columns: 56px minmax(0, 1fr) 56px !important;
  align-items: center !important;
  gap: 9px !important;
  pointer-events: none !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
  width: 56px !important;
  height: 56px !important;
  min-height: 56px !important;
  pointer-events: auto !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 52px !important;
  max-height: 62px !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 7px 10px !important;
  border-radius: 999px !important;
  overflow: hidden !important;
  pointer-events: auto !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
  flex: 0 1 auto !important;
  max-width: 190px !important;
  min-width: 0 !important;
  padding: 5px 8px !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip strong,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
  display: block !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-size: 12px !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list {
  flex-wrap: nowrap !important;
  overflow: hidden !important;
}

@media (max-width: 640px) {
  .tabbar {
    width: min(430px, calc(100vw - 20px)) !important;
    padding: 7px !important;
    border-radius: 25px !important;
  }

  .tab-button {
    min-height: 54px !important;
    font-size: 10px !important;
  }

  .tab-button span {
    font-size: 17px !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 68px)) !important;
    width: calc(100vw - 18px) !important;
    min-height: 56px !important;
    max-height: 60px !important;
    justify-content: flex-start !important;
    padding-inline: 8px !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row button,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
    flex-basis: 46px !important;
    width: 46px !important;
    height: 46px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
    width: calc(100vw - 16px) !important;
    grid-template-columns: 50px minmax(0, 1fr) 50px !important;
    gap: 6px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
    width: 50px !important;
    height: 50px !important;
    min-height: 50px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
    min-height: 48px !important;
    max-height: 54px !important;
    gap: 4px !important;
    padding: 5px 6px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
    max-width: 94px !important;
    padding: 4px 6px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip strong,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
    font-size: 10px !important;
  }

  .detail-dialog.gallery-mode[open] .run-chip-list b,
  .detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
    padding: 2px 5px !important;
    font-size: 10px !important;
  }
}

/* FINAL FIX 2026-07-18: galeria navigation and viewer controls.
   This block intentionally lives at EOF so older duplicated rules cannot
   push the mobile menu to the middle or paint the active selector black. */
.app-shell {
  padding-bottom: max(112px, calc(env(safe-area-inset-bottom) + 104px)) !important;
}

.tabbar {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: max(14px, calc(env(safe-area-inset-bottom) + 10px)) !important;
  z-index: 1200 !important;
  width: min(520px, calc(100vw - 24px)) !important;
  max-width: calc(100vw - 24px) !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 6px !important;
  margin: 0 !important;
  padding: 8px !important;
  border: 1px solid rgba(196, 208, 225, 0.86) !important;
  border-radius: 28px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14) !important;
  backdrop-filter: blur(20px) !important;
}

.tab-button {
  min-width: 0 !important;
  min-height: 58px !important;
  border: 0 !important;
  border-radius: 20px !important;
  background: transparent !important;
  color: #536174 !important;
  font-size: 11px !important;
  line-height: 1 !important;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease !important;
}

.tab-button.active {
  background: linear-gradient(180deg, #eef5ff, #dfeaff) !important;
  color: #1747b8 !important;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2), 0 10px 24px rgba(37, 99, 235, 0.12) !important;
}

.tab-button.active span {
  color: #1747b8 !important;
}

#catalogView .filters,
#stockView .filters {
  z-index: 900 !important;
}

.gallery-check-filter-panel {
  z-index: 1300 !important;
}

.business-gate-dialog[open] {
  z-index: 9000 !important;
}

.detail-dialog.gallery-mode[open],
.detail-dialog.gallery-mode.stock-mode[open] {
  overscroll-behavior: contain !important;
  touch-action: manipulation !important;
}

.detail-dialog.gallery-mode[open] .detail-media,
.detail-dialog.gallery-mode.stock-mode[open] .detail-media {
  padding-bottom: max(152px, calc(env(safe-area-inset-bottom) + 140px)) !important;
}

.detail-dialog.gallery-mode[open] .thumb-row,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
  left: 50% !important;
  right: auto !important;
  bottom: max(80px, calc(env(safe-area-inset-bottom) + 74px)) !important;
  width: min(860px, calc(100vw - 28px)) !important;
  min-height: 58px !important;
  max-height: 66px !important;
  transform: translateX(-50%) !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 7px 10px !important;
  border-radius: 0 !important;
  background: rgba(241, 245, 249, 0.92) !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

.detail-dialog.gallery-mode[open] .thumb-row button,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
  flex: 0 0 48px !important;
  width: 48px !important;
  height: 48px !important;
  border-radius: 10px !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
  left: 50% !important;
  right: auto !important;
  bottom: max(14px, calc(env(safe-area-inset-bottom) + 8px)) !important;
  width: min(680px, calc(100vw - 28px)) !important;
  min-height: 58px !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  grid-template-columns: 56px minmax(0, 1fr) 56px !important;
  align-items: center !important;
  gap: 9px !important;
  pointer-events: none !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
  width: 56px !important;
  height: 56px !important;
  min-height: 56px !important;
  pointer-events: auto !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 52px !important;
  max-height: 62px !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 7px 10px !important;
  border-radius: 999px !important;
  overflow: hidden !important;
  pointer-events: auto !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
  flex: 0 1 auto !important;
  max-width: 190px !important;
  min-width: 0 !important;
  padding: 5px 8px !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip strong,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
  display: block !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-size: 12px !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list {
  flex-wrap: nowrap !important;
  overflow: hidden !important;
}

@media (max-width: 640px) {
  .tabbar {
    width: min(430px, calc(100vw - 20px)) !important;
    padding: 7px !important;
    border-radius: 25px !important;
  }

  .tab-button {
    min-height: 54px !important;
    font-size: 10px !important;
  }

  .tab-button span {
    font-size: 17px !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 68px)) !important;
    width: calc(100vw - 18px) !important;
    min-height: 56px !important;
    max-height: 60px !important;
    justify-content: flex-start !important;
    padding-inline: 8px !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row button,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
    flex-basis: 46px !important;
    width: 46px !important;
    height: 46px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
    width: calc(100vw - 16px) !important;
    grid-template-columns: 50px minmax(0, 1fr) 50px !important;
    gap: 6px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
    width: 50px !important;
    height: 50px !important;
    min-height: 50px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
    min-height: 48px !important;
    max-height: 54px !important;
    gap: 4px !important;
    padding: 5px 6px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
    max-width: 94px !important;
    padding: 4px 6px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip strong,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
    font-size: 10px !important;
  }

  .detail-dialog.gallery-mode[open] .run-chip-list b,
  .detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
    padding: 2px 5px !important;
    font-size: 10px !important;
  }
}

/* Active gallery viewer repair 2026-07-18. Keep this as the last viewer layer. */
.detail-dialog.gallery-mode[open],
.detail-dialog.gallery-mode.stock-mode[open] {
  inset: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  background: #030712 !important;
  touch-action: manipulation !important;
}

.detail-dialog.gallery-mode[open] .detail-layout,
.detail-dialog.gallery-mode.stock-mode[open] .detail-layout {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  overflow: hidden !important;
}

.detail-dialog.gallery-mode[open] .detail-copy,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
  position: fixed !important;
  left: 50% !important;
  top: max(12px, env(safe-area-inset-top)) !important;
  bottom: auto !important;
  z-index: 40 !important;
  width: min(360px, calc(100vw - 116px)) !important;
  min-height: 58px !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  place-items: center !important;
  gap: 2px !important;
  padding: 10px 18px !important;
  border: 0 !important;
  border-radius: 28px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: #111827 !important;
  text-align: center !important;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.22) !important;
  backdrop-filter: blur(18px) !important;
}

.detail-dialog.gallery-mode[open] .detail-copy h2,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy h2 {
  margin: 0 !important;
  color: #111827 !important;
  font-size: clamp(22px, 3.5vw, 34px) !important;
  line-height: 0.98 !important;
  letter-spacing: 0 !important;
}

.detail-dialog.gallery-mode[open] .detail-copy > p,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy > p {
  margin: 2px 0 0 !important;
  color: #64748b !important;
  font-size: 11px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.detail-dialog.gallery-mode[open] .detail-copy .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy .chip-row {
  display: none !important;
}

.detail-dialog.gallery-mode[open] .dialog-close,
.detail-dialog.gallery-mode.stock-mode[open] .dialog-close {
  position: fixed !important;
  top: max(14px, env(safe-area-inset-top)) !important;
  right: max(14px, env(safe-area-inset-right)) !important;
  z-index: 45 !important;
}

.detail-dialog.gallery-mode[open] .detail-media,
.detail-dialog.gallery-mode.stock-mode[open] .detail-media {
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  place-items: center !important;
  padding: max(92px, calc(env(safe-area-inset-top) + 78px)) 24px max(170px, calc(env(safe-area-inset-bottom) + 158px)) !important;
  overflow: hidden !important;
}

.detail-dialog.gallery-mode[open] #detailImage,
.detail-dialog.gallery-mode.stock-mode[open] #detailImage {
  width: auto !important;
  max-width: min(100%, 1380px) !important;
  height: auto !important;
  max-height: 100% !important;
  object-fit: contain !important;
  border-radius: 0 !important;
  background: #fff !important;
  box-shadow: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow {
  position: fixed !important;
  top: 50% !important;
  z-index: 35 !important;
  transform: translateY(-50%) !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow.prev,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow.prev {
  left: max(16px, env(safe-area-inset-left)) !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow.next,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow.next {
  right: max(16px, env(safe-area-inset-right)) !important;
}

.detail-dialog.gallery-mode[open] .thumb-row,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 84px)) !important;
  z-index: 34 !important;
  width: min(980px, calc(100vw - 48px)) !important;
  min-height: 64px !important;
  max-height: 72px !important;
  transform: translateX(-50%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 7px 12px !important;
  border-radius: 0 !important;
  background: rgba(241, 245, 249, 0.94) !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  box-shadow: none !important;
}

.detail-dialog.gallery-mode[open] .thumb-row button,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
  flex: 0 0 52px !important;
  width: 52px !important;
  height: 52px !important;
  border-radius: 10px !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: max(16px, env(safe-area-inset-bottom)) !important;
  z-index: 42 !important;
  width: min(720px, calc(100vw - 32px)) !important;
  min-height: 58px !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  grid-template-columns: 58px minmax(0, 1fr) 58px !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
  position: static !important;
  inset: auto !important;
  width: 58px !important;
  height: 58px !important;
  min-height: 58px !important;
  display: grid !important;
  place-items: center !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  color: #111827 !important;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.18) !important;
  backdrop-filter: blur(18px) !important;
  pointer-events: auto !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button {
  font-size: 30px !important;
  font-weight: 900 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
  font-size: 0 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button::before,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button::before {
  content: "\21E7" !important;
  font-size: 30px !important;
  line-height: 1 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
  position: static !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 54px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 7px 10px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.18) !important;
  backdrop-filter: blur(18px) !important;
  overflow: visible !important;
  pointer-events: auto !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
  flex: 0 1 auto !important;
  max-width: 160px !important;
  min-width: 0 !important;
  min-height: 34px !important;
  padding: 5px 9px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: #f4f7fb !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip small,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip small {
  display: none !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip strong,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
  color: #111827 !important;
  font-size: 13px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list {
  display: inline-flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 4px !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
  padding: 3px 7px !important;
  border-radius: 999px !important;
  background: #e8f0ff !important;
  color: #2563eb !important;
  font-size: 12px !important;
  line-height: 1 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .detail-block,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .detail-block {
  display: none !important;
}

@media (max-width: 720px) {
  .detail-dialog.gallery-mode[open] .detail-copy,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
    width: min(270px, calc(100vw - 104px)) !important;
    min-height: 56px !important;
    padding: 9px 14px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-copy h2,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy h2 {
    font-size: clamp(22px, 7vw, 32px) !important;
  }

  .detail-dialog.gallery-mode[open] .detail-media,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-media {
    padding: max(92px, calc(env(safe-area-inset-top) + 78px)) 12px max(164px, calc(env(safe-area-inset-bottom) + 150px)) !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
    width: calc(100vw - 24px) !important;
    min-height: 62px !important;
    max-height: 68px !important;
    justify-content: flex-start !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row button,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
    flex-basis: 50px !important;
    width: 50px !important;
    height: 50px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
    width: calc(100vw - 18px) !important;
    grid-template-columns: 52px minmax(0, 1fr) 52px !important;
    gap: 7px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
    width: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
    min-height: 50px !important;
    padding: 6px 7px !important;
    gap: 5px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
    max-width: 108px !important;
    min-height: 30px !important;
    padding: 4px 7px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip strong,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
    font-size: 11px !important;
  }

  .detail-dialog.gallery-mode[open] .run-chip-list b,
  .detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
    padding: 2px 5px !important;
    font-size: 10px !important;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .detail-dialog.gallery-mode[open] .detail-media,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-media {
    padding-top: max(72px, env(safe-area-inset-top)) !important;
    padding-bottom: max(144px, calc(env(safe-area-inset-bottom) + 132px)) !important;
  }

  .detail-dialog.gallery-mode[open] .detail-copy,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
    min-height: 50px !important;
    padding-block: 7px !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
    bottom: max(78px, calc(env(safe-area-inset-bottom) + 72px)) !important;
    min-height: 58px !important;
    max-height: 64px !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row button,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
    flex-basis: 46px !important;
    width: 46px !important;
    height: 46px !important;
  }
}

/* Gallery viewer repair 2026-07-18: one stable layer for the photo viewer. */
.detail-dialog.gallery-mode[open],
.detail-dialog.gallery-mode.stock-mode[open] {
  inset: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  background: #030712 !important;
  touch-action: manipulation !important;
}

.detail-dialog.gallery-mode[open] .detail-layout,
.detail-dialog.gallery-mode.stock-mode[open] .detail-layout {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  overflow: hidden !important;
}

.detail-dialog.gallery-mode[open] .detail-copy,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
  position: fixed !important;
  left: 50% !important;
  top: max(12px, env(safe-area-inset-top)) !important;
  bottom: auto !important;
  z-index: 40 !important;
  width: min(360px, calc(100vw - 116px)) !important;
  min-height: 58px !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  place-items: center !important;
  gap: 2px !important;
  padding: 10px 18px !important;
  border: 0 !important;
  border-radius: 28px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: #111827 !important;
  text-align: center !important;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.22) !important;
  backdrop-filter: blur(18px) !important;
}

.detail-dialog.gallery-mode[open] .detail-copy h2,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy h2 {
  margin: 0 !important;
  color: #111827 !important;
  font-size: clamp(22px, 3.5vw, 34px) !important;
  line-height: 0.98 !important;
  letter-spacing: 0 !important;
}

.detail-dialog.gallery-mode[open] .detail-copy > p,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy > p {
  margin: 2px 0 0 !important;
  color: #64748b !important;
  font-size: 11px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.detail-dialog.gallery-mode[open] .detail-copy .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy .chip-row {
  display: none !important;
}

.detail-dialog.gallery-mode[open] .dialog-close,
.detail-dialog.gallery-mode.stock-mode[open] .dialog-close {
  position: fixed !important;
  top: max(14px, env(safe-area-inset-top)) !important;
  right: max(14px, env(safe-area-inset-right)) !important;
  z-index: 45 !important;
}

.detail-dialog.gallery-mode[open] .detail-media,
.detail-dialog.gallery-mode.stock-mode[open] .detail-media {
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  place-items: center !important;
  padding: max(92px, calc(env(safe-area-inset-top) + 78px)) 24px max(170px, calc(env(safe-area-inset-bottom) + 158px)) !important;
  overflow: hidden !important;
}

.detail-dialog.gallery-mode[open] #detailImage,
.detail-dialog.gallery-mode.stock-mode[open] #detailImage {
  width: auto !important;
  max-width: min(100%, 1380px) !important;
  height: auto !important;
  max-height: 100% !important;
  object-fit: contain !important;
  border-radius: 0 !important;
  background: #fff !important;
  box-shadow: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow {
  position: fixed !important;
  top: 50% !important;
  z-index: 35 !important;
  transform: translateY(-50%) !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow.prev,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow.prev {
  left: max(16px, env(safe-area-inset-left)) !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow.next,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow.next {
  right: max(16px, env(safe-area-inset-right)) !important;
}

.detail-dialog.gallery-mode[open] .thumb-row,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 84px)) !important;
  z-index: 34 !important;
  width: min(980px, calc(100vw - 48px)) !important;
  min-height: 64px !important;
  max-height: 72px !important;
  transform: translateX(-50%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 7px 12px !important;
  border-radius: 0 !important;
  background: rgba(241, 245, 249, 0.94) !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  box-shadow: none !important;
}

.detail-dialog.gallery-mode[open] .thumb-row button,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
  flex: 0 0 52px !important;
  width: 52px !important;
  height: 52px !important;
  border-radius: 10px !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: max(16px, env(safe-area-inset-bottom)) !important;
  z-index: 42 !important;
  width: min(720px, calc(100vw - 32px)) !important;
  min-height: 58px !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  grid-template-columns: 58px minmax(0, 1fr) 58px !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
  position: static !important;
  inset: auto !important;
  width: 58px !important;
  height: 58px !important;
  min-height: 58px !important;
  display: grid !important;
  place-items: center !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  color: #111827 !important;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.18) !important;
  backdrop-filter: blur(18px) !important;
  pointer-events: auto !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button {
  font-size: 30px !important;
  font-weight: 900 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
  font-size: 0 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button::before,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button::before {
  content: "\21E7" !important;
  font-size: 30px !important;
  line-height: 1 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
  position: static !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 54px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 7px 10px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.18) !important;
  backdrop-filter: blur(18px) !important;
  overflow: visible !important;
  pointer-events: auto !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
  flex: 0 1 auto !important;
  max-width: 160px !important;
  min-width: 0 !important;
  min-height: 34px !important;
  padding: 5px 9px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: #f4f7fb !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip small,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip small {
  display: none !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip strong,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
  color: #111827 !important;
  font-size: 13px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list {
  display: inline-flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 4px !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
  padding: 3px 7px !important;
  border-radius: 999px !important;
  background: #e8f0ff !important;
  color: #2563eb !important;
  font-size: 12px !important;
  line-height: 1 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .detail-block,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .detail-block {
  display: none !important;
}

@media (max-width: 720px) {
  .detail-dialog.gallery-mode[open] .detail-copy,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
    width: min(270px, calc(100vw - 104px)) !important;
    min-height: 56px !important;
    padding: 9px 14px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-copy h2,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy h2 {
    font-size: clamp(22px, 7vw, 32px) !important;
  }

  .detail-dialog.gallery-mode[open] .detail-media,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-media {
    padding: max(92px, calc(env(safe-area-inset-top) + 78px)) 12px max(164px, calc(env(safe-area-inset-bottom) + 150px)) !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
    width: calc(100vw - 24px) !important;
    min-height: 62px !important;
    max-height: 68px !important;
    justify-content: flex-start !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row button,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
    flex-basis: 50px !important;
    width: 50px !important;
    height: 50px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
    width: calc(100vw - 18px) !important;
    grid-template-columns: 52px minmax(0, 1fr) 52px !important;
    gap: 7px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
    width: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
    min-height: 50px !important;
    padding: 6px 7px !important;
    gap: 5px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
    max-width: 108px !important;
    min-height: 30px !important;
    padding: 4px 7px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip strong,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
    font-size: 11px !important;
  }

  .detail-dialog.gallery-mode[open] .run-chip-list b,
  .detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
    padding: 2px 5px !important;
    font-size: 10px !important;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .detail-dialog.gallery-mode[open] .detail-media,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-media {
    padding-top: max(72px, env(safe-area-inset-top)) !important;
    padding-bottom: max(144px, calc(env(safe-area-inset-bottom) + 132px)) !important;
  }

  .detail-dialog.gallery-mode[open] .detail-copy,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
    min-height: 50px !important;
    padding-block: 7px !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
    bottom: max(78px, calc(env(safe-area-inset-bottom) + 72px)) !important;
    min-height: 58px !important;
    max-height: 64px !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row button,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
    flex-basis: 46px !important;
    width: 46px !important;
    height: 46px !important;
  }
}

.gallery-mode .detail-dialog[open],
.gallery-mode.stock-mode .detail-dialog[open] {
  max-width: 100vw !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
  touch-action: manipulation !important;
}

.gallery-mode .detail-dialog[open] .detail-card,
.gallery-mode.stock-mode .detail-dialog[open] .detail-card {
  min-height: 100dvh !important;
  height: 100dvh !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto auto !important;
  gap: 10px !important;
  padding: max(86px, env(safe-area-inset-top)) 28px max(112px, env(safe-area-inset-bottom)) !important;
  overflow: hidden !important;
}

.gallery-mode .detail-dialog[open] .detail-copy,
.gallery-mode.stock-mode .detail-dialog[open] .detail-copy {
  position: fixed !important;
  left: 50% !important;
  top: max(12px, env(safe-area-inset-top)) !important;
  width: min(420px, calc(100vw - 118px)) !important;
  min-height: 62px !important;
  transform: translateX(-50%) !important;
  z-index: 24 !important;
  display: grid !important;
  place-items: center !important;
  padding: 10px 22px !important;
  border-radius: 26px !important;
  background: rgba(255, 255, 255, 0.92) !important;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16) !important;
  text-align: center !important;
}

.gallery-mode .detail-dialog[open] .detail-copy h2,
.gallery-mode.stock-mode .detail-dialog[open] .detail-copy h2 {
  margin: 0 !important;
  font-size: clamp(1.45rem, 3.2vw, 2.2rem) !important;
  line-height: 0.98 !important;
  letter-spacing: 0 !important;
}

.gallery-mode .detail-dialog[open] .detail-copy p,
.gallery-mode.stock-mode .detail-dialog[open] .detail-copy p {
  margin: 4px 0 0 !important;
  font-size: 0.76rem !important;
  font-weight: 900 !important;
}

.gallery-mode .detail-dialog[open] .detail-copy > .chip-row,
.gallery-mode.stock-mode .detail-dialog[open] .detail-copy > .chip-row {
  display: none !important;
}

.gallery-mode .detail-dialog[open] .detail-media,
.gallery-mode.stock-mode .detail-dialog[open] .detail-media {
  min-height: 0 !important;
  display: grid !important;
  place-items: center !important;
  overflow: hidden !important;
}

.gallery-mode .detail-dialog[open] #detailImage,
.gallery-mode.stock-mode .detail-dialog[open] #detailImage {
  width: 100% !important;
  height: min(64dvh, 720px) !important;
  max-height: calc(100dvh - 242px) !important;
  object-fit: contain !important;
  border-radius: 18px !important;
  background: #fff !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.gallery-mode .detail-dialog[open] .thumb-row,
.gallery-mode.stock-mode .detail-dialog[open] .thumb-row {
  position: relative !important;
  inset: auto !important;
  width: min(100%, 980px) !important;
  height: 74px !important;
  min-height: 74px !important;
  max-height: 78px !important;
  margin: 0 auto !important;
  padding: 8px 86px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 8px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  border-radius: 0 !important;
  background: rgba(241, 245, 249, 0.92) !important;
  box-shadow: none !important;
  transform: none !important;
  z-index: 12 !important;
}

.gallery-mode .detail-dialog[open] .thumb-row button,
.gallery-mode.stock-mode .detail-dialog[open] .thumb-row button {
  flex: 0 0 56px !important;
  width: 56px !important;
  height: 56px !important;
  border-radius: 10px !important;
}

.gallery-mode .detail-dialog[open] .detail-bottom-bar,
.gallery-mode.stock-mode .detail-dialog[open] .detail-bottom-bar {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: max(18px, env(safe-area-inset-bottom)) !important;
  width: min(720px, calc(100vw - 34px)) !important;
  height: auto !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  grid-template-columns: 58px minmax(0, 1fr) 58px !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  pointer-events: none !important;
  z-index: 28 !important;
}

.gallery-mode .detail-dialog[open] .favorite-photo-button,
.gallery-mode .detail-dialog[open] .share-photo-button,
.gallery-mode.stock-mode .detail-dialog[open] .favorite-photo-button,
.gallery-mode.stock-mode .detail-dialog[open] .share-photo-button {
  position: static !important;
  inset: auto !important;
  width: 58px !important;
  height: 58px !important;
  min-width: 58px !important;
  border-radius: 50% !important;
  display: grid !important;
  place-items: center !important;
  transform: none !important;
  pointer-events: auto !important;
  z-index: 1 !important;
}

.gallery-mode .detail-dialog[open] .detail-bottom-bar .chip-row,
.gallery-mode.stock-mode .detail-dialog[open] .detail-bottom-bar .chip-row {
  position: static !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 58px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 7px 10px !important;
  overflow: hidden !important;
  flex-wrap: nowrap !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.16) !important;
  pointer-events: auto !important;
}

.gallery-mode .detail-dialog[open] .detail-data-chip,
.gallery-mode.stock-mode .detail-dialog[open] .detail-data-chip {
  flex: 0 1 auto !important;
  min-width: 0 !important;
  max-width: 190px !important;
  padding: 5px 9px !important;
  border-radius: 999px !important;
  overflow: hidden !important;
}

.gallery-mode .detail-dialog[open] .detail-data-chip small,
.gallery-mode.stock-mode .detail-dialog[open] .detail-data-chip small {
  display: inline !important;
  font-size: 0.58rem !important;
  line-height: 1 !important;
}

.gallery-mode .detail-dialog[open] .detail-data-chip strong,
.gallery-mode.stock-mode .detail-dialog[open] .detail-data-chip strong {
  display: inline !important;
  max-width: 100% !important;
  font-size: 0.78rem !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  vertical-align: middle !important;
}

.gallery-mode .detail-dialog[open] .run-chip-list,
.gallery-mode.stock-mode .detail-dialog[open] .run-chip-list {
  display: inline-flex !important;
  flex-wrap: nowrap !important;
  gap: 4px !important;
  max-width: 100% !important;
  overflow: hidden !important;
  vertical-align: middle !important;
}

.gallery-mode .detail-dialog[open] .run-chip-list b,
.gallery-mode.stock-mode .detail-dialog[open] .run-chip-list b {
  padding: 2px 6px !important;
  font-size: 0.72rem !important;
  white-space: nowrap !important;
}

@media (max-width: 720px) {
  .gallery-mode .detail-dialog[open] .detail-card,
  .gallery-mode.stock-mode .detail-dialog[open] .detail-card {
    padding: max(90px, env(safe-area-inset-top)) 14px max(102px, env(safe-area-inset-bottom)) !important;
    gap: 8px !important;
  }

  .gallery-mode .detail-dialog[open] .detail-copy,
  .gallery-mode.stock-mode .detail-dialog[open] .detail-copy {
    width: min(300px, calc(100vw - 86px)) !important;
    min-height: 58px !important;
    padding: 9px 14px !important;
    border-radius: 25px !important;
  }

  .gallery-mode .detail-dialog[open] .detail-copy h2,
  .gallery-mode.stock-mode .detail-dialog[open] .detail-copy h2 {
    font-size: clamp(1.32rem, 7vw, 1.9rem) !important;
  }

  .gallery-mode .detail-dialog[open] #detailImage,
  .gallery-mode.stock-mode .detail-dialog[open] #detailImage {
    height: min(55dvh, calc(100dvh - 248px)) !important;
    max-height: calc(100dvh - 248px) !important;
  }

  .gallery-mode .detail-dialog[open] .thumb-row,
  .gallery-mode.stock-mode .detail-dialog[open] .thumb-row {
    height: 64px !important;
    min-height: 64px !important;
    max-height: 68px !important;
    padding: 7px 72px !important;
    justify-content: flex-start !important;
  }

  .gallery-mode .detail-dialog[open] .thumb-row button,
  .gallery-mode.stock-mode .detail-dialog[open] .thumb-row button {
    flex-basis: 50px !important;
    width: 50px !important;
    height: 50px !important;
  }

  .gallery-mode .detail-dialog[open] .detail-bottom-bar,
  .gallery-mode.stock-mode .detail-dialog[open] .detail-bottom-bar {
    width: calc(100vw - 18px) !important;
    grid-template-columns: 52px minmax(0, 1fr) 52px !important;
    gap: 7px !important;
  }

  .gallery-mode .detail-dialog[open] .favorite-photo-button,
  .gallery-mode .detail-dialog[open] .share-photo-button,
  .gallery-mode.stock-mode .detail-dialog[open] .favorite-photo-button,
  .gallery-mode.stock-mode .detail-dialog[open] .share-photo-button {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
  }

  .gallery-mode .detail-dialog[open] .detail-bottom-bar .chip-row,
  .gallery-mode.stock-mode .detail-dialog[open] .detail-bottom-bar .chip-row {
    min-height: 50px !important;
    gap: 5px !important;
    padding: 6px !important;
  }

  .gallery-mode .detail-dialog[open] .detail-data-chip,
  .gallery-mode.stock-mode .detail-dialog[open] .detail-data-chip {
    max-width: 92px !important;
    padding: 4px 6px !important;
  }

  .gallery-mode .detail-dialog[open] .detail-data-chip small,
  .gallery-mode.stock-mode .detail-dialog[open] .detail-data-chip small {
    display: none !important;
  }

  .gallery-mode .detail-dialog[open] .detail-data-chip strong,
  .gallery-mode.stock-mode .detail-dialog[open] .detail-data-chip strong {
    font-size: 0.72rem !important;
  }

  .gallery-mode .detail-dialog[open] .run-chip-list b,
  .gallery-mode.stock-mode .detail-dialog[open] .run-chip-list b {
    padding: 2px 5px !important;
    font-size: 0.68rem !important;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .gallery-mode .detail-dialog[open] .detail-card,
  .gallery-mode.stock-mode .detail-dialog[open] .detail-card {
    padding-top: max(72px, env(safe-area-inset-top)) !important;
    padding-bottom: max(88px, env(safe-area-inset-bottom)) !important;
  }

  .gallery-mode .detail-dialog[open] #detailImage,
  .gallery-mode.stock-mode .detail-dialog[open] #detailImage {
    height: min(58dvh, calc(100dvh - 200px)) !important;
  }

  .gallery-mode .detail-dialog[open] .thumb-row,
  .gallery-mode.stock-mode .detail-dialog[open] .thumb-row {
    height: 60px !important;
    min-height: 60px !important;
    max-height: 64px !important;
  }
}
*/

/* Commercial-line selector must stay above gallery filters and cards. */
.business-gate-dialog[open] {
  z-index: 8000 !important;
}

.business-gate-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42) !important;
  backdrop-filter: blur(16px) !important;
}

/* ACTIVE EOF: galeria viewer layout. Do not move above older viewer rules. */
.detail-dialog.gallery-mode[open],
.detail-dialog.gallery-mode.stock-mode[open] {
  inset: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  background: #030712 !important;
  touch-action: manipulation !important;
}

.detail-dialog.gallery-mode[open] .detail-layout,
.detail-dialog.gallery-mode.stock-mode[open] .detail-layout {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  overflow: hidden !important;
}

.detail-dialog.gallery-mode[open] .detail-copy,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
  position: fixed !important;
  left: 50% !important;
  top: max(12px, env(safe-area-inset-top)) !important;
  bottom: auto !important;
  z-index: 40 !important;
  width: min(360px, calc(100vw - 116px)) !important;
  min-height: 58px !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  place-items: center !important;
  gap: 2px !important;
  padding: 10px 18px !important;
  border: 0 !important;
  border-radius: 28px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: #111827 !important;
  text-align: center !important;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.22) !important;
  backdrop-filter: blur(18px) !important;
}

.detail-dialog.gallery-mode[open] .detail-copy h2,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy h2 {
  margin: 0 !important;
  color: #111827 !important;
  font-size: clamp(22px, 3.5vw, 34px) !important;
  line-height: 0.98 !important;
  letter-spacing: 0 !important;
}

.detail-dialog.gallery-mode[open] .detail-copy > p,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy > p {
  margin: 2px 0 0 !important;
  color: #64748b !important;
  font-size: 11px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.detail-dialog.gallery-mode[open] .detail-copy .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-copy .chip-row {
  display: none !important;
}

.detail-dialog.gallery-mode[open] .dialog-close,
.detail-dialog.gallery-mode.stock-mode[open] .dialog-close {
  position: fixed !important;
  top: max(14px, env(safe-area-inset-top)) !important;
  right: max(14px, env(safe-area-inset-right)) !important;
  z-index: 45 !important;
}

.detail-dialog.gallery-mode[open] .detail-media,
.detail-dialog.gallery-mode.stock-mode[open] .detail-media {
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  place-items: center !important;
  padding: max(92px, calc(env(safe-area-inset-top) + 78px)) 24px max(170px, calc(env(safe-area-inset-bottom) + 158px)) !important;
  overflow: hidden !important;
}

.detail-dialog.gallery-mode[open] #detailImage,
.detail-dialog.gallery-mode.stock-mode[open] #detailImage {
  width: auto !important;
  max-width: min(100%, 1380px) !important;
  height: auto !important;
  max-height: 100% !important;
  object-fit: contain !important;
  border-radius: 0 !important;
  background: #fff !important;
  box-shadow: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow {
  position: fixed !important;
  top: 50% !important;
  z-index: 35 !important;
  transform: translateY(-50%) !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow.prev,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow.prev {
  left: max(16px, env(safe-area-inset-left)) !important;
}

.detail-dialog.gallery-mode[open] .gallery-arrow.next,
.detail-dialog.gallery-mode.stock-mode[open] .gallery-arrow.next {
  right: max(16px, env(safe-area-inset-right)) !important;
}

.detail-dialog.gallery-mode[open] .thumb-row,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
  position: fixed !important;
  left: 50% !important;
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 84px)) !important;
  z-index: 34 !important;
  width: min(980px, calc(100vw - 48px)) !important;
  min-height: 64px !important;
  max-height: 72px !important;
  transform: translateX(-50%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 7px 12px !important;
  border-radius: 0 !important;
  background: rgba(241, 245, 249, 0.94) !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  box-shadow: none !important;
}

.detail-dialog.gallery-mode[open] .thumb-row button,
.detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
  flex: 0 0 52px !important;
  width: 52px !important;
  height: 52px !important;
  border-radius: 10px !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
  position: fixed !important;
  left: 50% !important;
  bottom: max(16px, env(safe-area-inset-bottom)) !important;
  z-index: 42 !important;
  width: min(720px, calc(100vw - 32px)) !important;
  min-height: 58px !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  grid-template-columns: 58px minmax(0, 1fr) 58px !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
  position: static !important;
  inset: auto !important;
  width: 58px !important;
  height: 58px !important;
  min-height: 58px !important;
  display: grid !important;
  place-items: center !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  color: #111827 !important;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.18) !important;
  backdrop-filter: blur(18px) !important;
  pointer-events: auto !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button {
  font-size: 30px !important;
  font-weight: 900 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
  font-size: 0 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button::before,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button::before {
  content: "\21E7" !important;
  font-size: 30px !important;
  line-height: 1 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
  position: static !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 54px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 7px 10px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.18) !important;
  backdrop-filter: blur(18px) !important;
  overflow: visible !important;
  pointer-events: auto !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
  flex: 0 1 auto !important;
  max-width: 160px !important;
  min-width: 0 !important;
  min-height: 34px !important;
  padding: 5px 9px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: #f4f7fb !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip small,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip small {
  display: none !important;
}

.detail-dialog.gallery-mode[open] .detail-data-chip strong,
.detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
  color: #111827 !important;
  font-size: 13px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list {
  display: inline-flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 4px !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
  padding: 3px 7px !important;
  border-radius: 999px !important;
  background: #e8f0ff !important;
  color: #2563eb !important;
  font-size: 12px !important;
  line-height: 1 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .detail-block,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .detail-block {
  display: none !important;
}

@media (max-width: 720px) {
  .detail-dialog.gallery-mode[open] .detail-copy,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
    width: min(270px, calc(100vw - 104px)) !important;
    min-height: 56px !important;
    padding: 9px 14px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-copy h2,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy h2 {
    font-size: clamp(22px, 7vw, 32px) !important;
  }

  .detail-dialog.gallery-mode[open] .detail-media,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-media {
    padding: max(92px, calc(env(safe-area-inset-top) + 78px)) 12px max(164px, calc(env(safe-area-inset-bottom) + 150px)) !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
    width: calc(100vw - 24px) !important;
    min-height: 62px !important;
    max-height: 68px !important;
    justify-content: flex-start !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row button,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
    flex-basis: 50px !important;
    width: 50px !important;
    height: 50px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar {
    width: calc(100vw - 18px) !important;
    grid-template-columns: 52px minmax(0, 1fr) 52px !important;
    gap: 7px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
    width: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
    min-height: 50px !important;
    padding: 6px 7px !important;
    gap: 5px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip {
    max-width: 108px !important;
    min-height: 30px !important;
    padding: 4px 7px !important;
  }

  .detail-dialog.gallery-mode[open] .detail-data-chip strong,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-data-chip strong {
    font-size: 11px !important;
  }

  .detail-dialog.gallery-mode[open] .run-chip-list b,
  .detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
    padding: 2px 5px !important;
    font-size: 10px !important;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .detail-dialog.gallery-mode[open] .detail-media,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-media {
    padding-top: max(72px, env(safe-area-inset-top)) !important;
    padding-bottom: max(144px, calc(env(safe-area-inset-bottom) + 132px)) !important;
  }

  .detail-dialog.gallery-mode[open] .detail-copy,
  .detail-dialog.gallery-mode.stock-mode[open] .detail-copy {
    min-height: 50px !important;
    padding-block: 7px !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row {
    bottom: max(78px, calc(env(safe-area-inset-bottom) + 72px)) !important;
    min-height: 58px !important;
    max-height: 64px !important;
  }

  .detail-dialog.gallery-mode[open] .thumb-row button,
  .detail-dialog.gallery-mode.stock-mode[open] .thumb-row button {
    flex-basis: 46px !important;
    width: 46px !important;
    height: 46px !important;
  }
}

/* Final override: gallery viewer buttons and corrida colors. */
.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button {
  grid-column: 1 !important;
  grid-row: 1 !important;
  justify-self: start !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button {
  grid-column: 3 !important;
  grid-row: 1 !important;
  justify-self: end !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .chip-row,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .chip-row {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button::before,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button::before {
  content: none !important;
}

.detail-dialog.gallery-mode[open] .detail-bottom-bar .share-photo-button svg,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .share-photo-button svg,
.detail-dialog.gallery-mode[open] .detail-bottom-bar .favorite-photo-button svg,
.detail-dialog.gallery-mode.stock-mode[open] .detail-bottom-bar .favorite-photo-button svg {
  display: block !important;
  width: 28px !important;
  height: 28px !important;
  fill: currentColor !important;
  color: #111827 !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b {
  color: #111827 !important;
  font-weight: 950 !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-blue,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-blue {
  background: #dbeafe !important;
  border: 1px solid #93c5fd !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-violet,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-violet {
  background: #ede9fe !important;
  border: 1px solid #c4b5fd !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-green,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-green {
  background: #dcfce7 !important;
  border: 1px solid #86efac !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-amber,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-amber {
  background: #fef3c7 !important;
  border: 1px solid #fbbf24 !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-pink,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-pink {
  background: #fce7f3 !important;
  border: 1px solid #f9a8d4 !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-cyan,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-cyan {
  background: #cffafe !important;
  border: 1px solid #67e8f9 !important;
}

.detail-dialog.gallery-mode[open] .run-chip-list b.run-tone-neutral,
.detail-dialog.gallery-mode.stock-mode[open] .run-chip-list b.run-tone-neutral {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
}
