:root {
  color-scheme: light;
  --ink: #222831;
  --muted: #667085;
  --line: #ded7cb;
  --paper: #f7f4ee;
  --panel: #ffffff;
  --green: #1e7a52;
  --red: #b64242;
  --gold: #c7912f;
  --blue: #315f8c;
  --shadow: 0 12px 30px rgba(34, 40, 49, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(145deg, rgba(49, 95, 140, 0.12), transparent 40%),
    linear-gradient(35deg, rgba(199, 145, 47, 0.18), transparent 42%),
    var(--paper);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.phone-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  max-width: 720px;
  margin: 0 auto;
  background: rgba(247, 244, 238, 0.88);
}

.app-header {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: calc(18px + env(safe-area-inset-top)) 18px 12px;
}

.app-header h1 {
  justify-self: center;
  text-align: center;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.header-mode-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  box-shadow: var(--shadow);
}

.header-mode-button img {
  width: 25px;
  height: 25px;
}

.header-mode-button.active {
  border-color: rgba(30, 122, 82, 0.45);
  background: #eef3ec;
  color: var(--green);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.65rem;
  line-height: 1.1;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.icon-button span {
  display: block;
  width: 18px;
  height: 18px;
  margin: auto;
  border: 3px solid var(--blue);
  border-right-color: transparent;
  border-radius: 50%;
}

.screens {
  position: relative;
  min-height: 0;
  overflow: hidden;
  touch-action: pan-y;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow-y: auto;
  padding: 8px 18px 86px;
  scroll-padding-bottom: 86px;
}

.screen.active {
  display: block;
}

.profile-hero,
.panel,
.empty-state,
.scanner-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.avatar {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.muted,
small {
  color: var(--muted);
}

.google-button,
.soft-button,
.primary-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.google-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.google-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #f1f3f4;
  color: #4285f4;
  font-weight: 900;
}

.logout-link {
  display: block;
  margin-top: 10px;
  color: var(--red);
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.stat {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.stat strong {
  display: block;
  min-width: 0;
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 1.2rem;
}

.panel,
.empty-state,
.scanner-card {
  margin-top: 14px;
  padding: 16px;
}

.soft-button:disabled {
  color: var(--muted);
  background: #f3f0ea;
}

.search-box {
  position: sticky;
  top: 0;
  z-index: 6;
  padding-bottom: 10px;
  background: var(--paper);
}

.search-with-back {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
}

.library-section-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: -2px 0 12px 54px;
}

.library-section-tabs[hidden] {
  display: none;
}

.library-section-tab {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 800;
}

.library-section-tab.active {
  border-color: rgba(30, 122, 82, 0.35);
  background: #eef3ec;
  color: var(--green);
}

.back-button {
  width: 44px;
  height: 46px;
  border: 1px solid rgba(182, 66, 66, 0.34);
  border-radius: 8px;
  background: white;
  color: var(--red);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.back-button:disabled {
  border-color: var(--line);
  color: #a9a9a9;
  background: #f2f0eb;
}

.tcg-menu-wrap {
  position: relative;
  flex: 0 0 auto;
}

.selected-tcg-button {
  display: grid;
  width: 92px;
  height: 56px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.selected-tcg-button[aria-expanded="true"] {
  border-color: rgba(30, 122, 82, 0.45);
  background: #eef3ec;
}

.tcg-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  display: grid;
  width: 132px;
  max-height: min(72vh, 720px);
  gap: 6px;
  padding: 10px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.tcg-menu[hidden] {
  display: none;
}

.tcg-menu-item {
  display: grid;
  width: 100%;
  min-height: 46px;
  place-items: center;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
}

.tcg-menu-item.active {
  border-color: rgba(30, 122, 82, 0.35);
  background: #eef3ec;
}

.tcg-logo {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--tcg-color, var(--ink));
  color: white;
  font-size: 0.76rem;
  font-weight: 900;
}

.tcg-logo-img {
  display: block;
  width: 100%;
  max-width: 96px;
  max-height: 46px;
  object-fit: contain;
}

.selected-tcg-button .tcg-logo-img {
  max-width: 76px;
  max-height: 42px;
}

.fallback-logo {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.search-box input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: white;
}

.list {
  display: grid;
  gap: 10px;
}

.group-grid {
  display: grid;
  gap: 10px;
}

.product-strip {
  display: flex;
  gap: 10px;
  margin: 0 -18px 12px;
  overflow-x: auto;
  padding: 0 18px 4px;
  scrollbar-width: none;
}

.product-strip[hidden] {
  display: none;
}

.product-strip::-webkit-scrollbar {
  display: none;
}

.opened-set-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
}

.opened-set-section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.opened-set-section h2::before,
.opened-set-section h2::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.opened-set-section h2 span {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
}

.opened-product-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.opened-product-card {
  display: grid;
  padding: 0;
  grid-template-columns: 132px minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
}

.opened-product-info .opened-product-title {
  text-align: left;
  padding: 0;
  white-space: normal;
  overflow: visible;
  align-self: start;
  min-width: 0;
  overflow-wrap: anywhere;
}

.opened-product-media {
  display: grid;
  grid-template-rows: 116px auto auto;
  align-items: center;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #ebe6dd;
  text-align: center;
}

.opened-product-media img {
  width: 100%;
  height: 116px;
  object-fit: contain;
  padding: 8px;
}

.opened-product-media strong,
.opened-product-media b {
  display: block;
  padding: 5px 8px;
  background: #fff;
  font-size: 0.72rem;
}

.opened-product-media b {
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.opened-product-info {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px;
}

.opened-product-info strong,
.opened-product-info small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opened-product-info dl {
  display: grid;
  gap: 4px;
  margin: 2px 0 0;
}

.opened-product-info div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 4px 5px;
  background: #f1eee8;
  border-radius: 5px;
}

.opened-product-info dt,
.opened-product-info dd {
  margin: 0;
  font-size: 0.78rem;
}

.opened-product-info dt {
  color: var(--muted);
}

.opened-product-info dd {
  color: var(--ink);
  font-weight: 800;
}

.opened-product-info .price-split {
  display: flex;
  gap: 4px;
}

.opened-product-info .price-split span {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(213, 205, 192, 0.75);
  white-space: nowrap;
}

.opened-product-info .price-split .eur {
  background: #dcecf7;
  box-shadow: inset 0 0 0 1px rgba(142, 179, 205, 0.65);
}

.opened-product-info .price-split .usd {
  background: #dcefd8;
  box-shadow: inset 0 0 0 1px rgba(142, 189, 134, 0.65);
}

.sealed-product {
  display: grid;
  grid-template-rows: 62px minmax(34px, auto);
  align-items: stretch;
  width: 96px;
  min-height: 104px;
  flex: 0 0 auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  text-align: center;
  overflow: hidden;
}

.sealed-product img {
  width: 100%;
  height: 62px;
  border-radius: 6px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.12);
}

.sealed-product span {
  display: -webkit-box;
  align-self: center;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  padding: 5px 2px 1px;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.set-row,
.product-row,
.group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.set-parent {
  min-height: 62px;
}

.set-family-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(205, 195, 177, 0.9);
  border-radius: 8px;
  background: rgba(226, 218, 203, 0.56);
}

.set-family-card .set-row {
  box-shadow: none;
}

.set-child {
  width: calc(100% - 24px);
  min-height: 54px;
  margin-left: 24px;
  border-left: 4px solid rgba(30, 122, 82, 0.3);
  background: rgba(255, 255, 255, 0.76);
}

.set-child strong {
  font-size: 0.94rem;
}

.set-row strong,
.product-row strong,
.group-row strong {
  display: block;
  line-height: 1.25;
}

.set-row small,
.product-row small,
.group-row small {
  display: block;
  margin-top: 4px;
  line-height: 1.25;
}

.group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-move-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-color: rgba(94, 106, 124, 0.28);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: none;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 900;
}

.group-move-button:hover:not(:disabled) {
  border-color: rgba(30, 122, 82, 0.38);
  color: var(--green);
}

.group-move-button:disabled {
  opacity: 0.3;
  cursor: default;
}

.group-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.group-toolbar .card-view-toggle { margin-left: auto; width: 40px; height: 40px; flex: 0 0 40px; padding: 10px; display: grid; place-items: center; }
.group-toolbar .view-mode-icon { display: grid; width: 18px; height: 18px; gap: 3px; }
.view-mode-icon i { display: block; background: currentColor; border-radius: 1px; }
.view-mode-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.view-mode-list { grid-template-columns: 1fr; grid-template-rows: repeat(4, 1fr); }

.group-toolbar span {
  color: var(--muted);
  font-weight: 800;
}

.group-toolbar select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: white;
}

.compact-control {
  width: auto;
  min-height: 40px;
  margin-top: 0;
  padding: 0 14px;
}

.group-plus {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(30, 122, 82, 0.35);
  border-radius: 8px;
  color: var(--green);
  font-size: 1.35rem;
  font-style: normal;
  font-weight: 900;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.add-row {
  width: fit-content;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 900;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.library-card {
  position: relative;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  overflow: hidden;
  text-align: left;
}

.card-image-wrap {
  position: relative;
  align-self: start;
  min-width: 0;
}

.card-image-wrap img {
  display: block;
}
.image-list-item { position: relative; min-width: 0; }
.image-list-item > .library-card { width: 100%; height: 100%; }
.list-add-image { position: absolute; top: 8px; right: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: white; font-size: 11px; }
.image-staged > .library-card, .image-staged > .review-card-row { outline: 2px solid #278260; outline-offset: -2px; }
.review-card-list .image-list-item { display: flex; align-items: center; gap: 8px; }
.review-card-list .review-card-row { flex: 1; min-width: 0; }
.review-card-list .list-add-image { position: static; flex: 0 0 auto; }
.image-queue-status { font-size: 12px; }
#flipCardImage { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: white; color: var(--ink); font-size: 24px; z-index: 2; }
#flipCardImage[hidden] { display: none; }

.card-labels {
  position: absolute;
  bottom: 4%;
  left: 4%;
  right: 4%;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 3px;
  pointer-events: none;
}

.card-labels .card-label-badge {
  display: block;
  max-width: 100%;
  padding: 2px 10px;
  border-radius: 999px;
  background: #ed1616;
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 2px #0006;
}

.library-card.selected,
.review-card-row.selected {
  border-color: rgba(30, 122, 82, 0.65);
  background: #eef3ec;
}

.select-card-box {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.library-card .select-card-box {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  width: 22px;
  height: 22px;
}

.library-card img {
  display: block;
  width: 100%;
  aspect-ratio: 0.718;
  background: #ece7de;
  object-fit: contain;
}

.library-card span {
  display: block;
  padding: 9px;
}

.library-card strong {
  display: block;
  overflow: hidden;
  font-size: 0.82rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-card small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-card-list {
  display: grid;
  gap: 8px;
}

.review-card-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px;
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.review-card-row:not(:has(.select-card-box)) {
  grid-template-columns: 1fr;
}

.review-card-row strong {
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.review-card-row small {
  color: var(--muted);
  line-height: 1.25;
}

.card-dialog {
  width: min(92vw, 760px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.card-dialog::backdrop {
  background: rgba(12, 16, 24, 0.62);
}

.card-editor {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 0.72fr) minmax(240px, 1fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 1.35rem;
}

.card-editor img {
  width: 100%;
  border-radius: 8px;
  background: #ece7de;
}

.editor-fields {
  display: grid;
  gap: 9px;
  align-content: start;
}

.editor-card-name {
  text-align: center;
  font-size: 1rem;
  font-weight: 900;
}

.product-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: end; min-width: 0; }
.product-settings > label, #packSettings > label { min-width: 0; }
#productPanelButtons { display: contents; }
#productPanelButtons label { min-width: 0; }
#productPanelButtons button { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 12px; }
#productPanelButtons button[aria-pressed="true"] { border-color: #278260; background: #eef6f1; }
#packSettings { grid-column: 1 / -1; display: grid; gap: 8px; min-width: 0; }
#productPanelContent { min-width: 0; }
#cardDialog[aria-busy="true"] { cursor: wait; }
#packSettings[hidden] { display: none; }
.pack-rules-scroll { grid-column: 1 / -1; min-width: 0; max-height: 120px; overflow-x: hidden; overflow-y: auto; }
.pack-rules-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 10px; }
.pack-rules-table th { height: 18px; padding: 0 2px; box-sizing: border-box; text-align: left; position: sticky; top: 0; background: white; z-index: 1; }
.pack-rules-table th:last-child { width: 34px; }
.pack-rules-table td { height: 34px; padding: 2px; box-sizing: border-box; }
#packSettings .pack-rules-table input, #packSettings .pack-rules-table select,
#packSettings .pack-rules-table button { width: 100%; min-width: 0; min-height: 28px; height: 28px; padding: 2px; font-size: 10px; box-sizing: border-box; }
#packSettingsError { grid-column: 1 / -1; color: #a02020; font-size: 0.8rem; }

.editor-code-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.editor-product-row {
  display: grid;
  grid-template-columns: minmax(0, 0.65fr) minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 9px;
}

.single-price-detail .editor-marketplace {
  grid-template-columns: minmax(0, 1fr);
}

.single-price-detail .market-price-row:first-of-type > label,
.single-price-detail .market-price-row:first-of-type > span,
.single-price-detail .market-price-row:last-child {
  display: none;
}

.single-price-detail .market-price-row {
  grid-template-columns: minmax(0, 1fr);
}

.editor-fields [hidden],
.group-toolbar [hidden] {
  display: none;
}

.editor-set-group-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.editor-set-group-row > div,
.editor-product-row > div {
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
}

.editor-code-row label,
.editor-code-row input {
  min-width: 0;
}

.editor-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.editor-fields label[hidden] {
  display: none;
}

.editor-fields input,
.editor-fields select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: white;
}

.editor-marketplaces {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.editor-prices-divider {
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.editor-marketplace {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
}

.editor-marketplace > .market-logo {
  grid-column: 1 / -1;
}

.market-logo {
  display: grid;
  place-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.card-editor .market-logo img {
  width: 100%;
  max-width: 180px;
  height: 32px;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
}

.market-logo {
  padding: 5px 12px;
}

.card-editor .cardmarket-logo img {
  max-width: 145px;
}

.market-logo.is-disabled {
  cursor: default;
  pointer-events: none;
}

.market-price-placeholder {
  display: grid;
  place-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.market-price-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.market-price-row > label,
.market-price-row > span {
  white-space: nowrap;
}

.market-price-row input,
.market-price-row .market-price-placeholder {
  min-width: 0;
  text-align: center;
}


.tiny-icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(30, 122, 82, 0.35);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 900;
}


.csv-row-editor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.csv-row-scroll { overflow-x: auto; min-width: 0; }
#csvRecordTable { border-collapse: collapse; width: 100%; font-size: 9px; }
#csvRecordTable th, #csvRecordTable td { border: 1px solid var(--line); padding: 3px; text-align: left; vertical-align: top; }
#csvRecordTable th { white-space: nowrap; font-weight: 600; }
#csvRecordTable textarea { width: 100%; min-width: 85px; height: 28px; box-sizing: border-box; resize: none; font: inherit; line-height: 12px; color: var(--ink); background: transparent; border: 0; padding: 2px; }
#csvRecordTable textarea[readonly] { display: none; }
.csv-cell-preview { width: 85px; min-height: 24px; line-height: 12px; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
#csvRecordTable textarea:not([readonly]) + .csv-cell-preview { display: none; }
#csvRecordTable textarea:not([readonly]) { background: #edf8ff; outline: 1px solid #85b9da; }
#editCsvRowButton { width: 36px; height: 36px; padding: 0; align-self: center; font-size: 22px; border: 1px solid var(--line); border-radius: 4px; }
.csv-row-actions { display: flex; flex-direction: column; align-self: center; gap: 4px; }
#openCsvFileButton { width: 36px; height: 24px; padding: 0; font-size: 10px; border: 1px solid var(--line); border-radius: 4px; }
#csvRowError { grid-column: 1 / -1; font-size: 12px; color: #a32525; }

.chevron {
  width: 10px;
  height: 10px;
  border-top: 2px solid var(--muted);
  border-right: 2px solid var(--muted);
  transform: rotate(45deg);
}

.empty-state {
  min-height: 260px;
  display: grid;
  align-content: center;
}

.scanner-screen {
  padding: 0 14px 18px;
  overflow: auto;
}

.screen[data-screen="scanner"].active {
  display: block;
  height: 100%;
}

.scanner-view {
  position: relative;
  width: 100%;
  min-height: 100%;
  display: grid;
  align-content: start;
  gap: 12px;
  padding-bottom: 12px;
  overflow: visible;
  background: transparent;
}

.scanner-resume-row {
  display: flex;
  gap: 10px;
  min-height: 82px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 0 8px;
}

.scanner-resume-empty {
  display: grid;
  min-width: 100%;
  min-height: 74px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.scanner-resume-card {
  position: relative;
  flex: 0 0 68px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(34, 40, 49, 0.08);
}

.scanner-resume-card img {
  max-width: 58px;
  max-height: 64px;
  object-fit: contain;
}

.scanner-free-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 0.98rem;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.scanner-search-box {
  margin: 0;
}

.scanner-page-product-list {
  display: grid;
  gap: 14px;
  padding-bottom: 10px;
}

.scanner-count-badge {
  background: rgba(156, 226, 166, 0.96);
  color: #0f4f2f;
}

.scanner-pack-card.over .scanner-count-badge {
  background: rgba(241, 142, 134, 0.96);
  color: #5b1717;
}

.scanner-count-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  display: grid;
  min-width: 26px;
  min-height: 26px;
  place-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(12, 16, 24, 0.72);
  color: white;
  font-size: 0.76rem;
  font-weight: 900;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.scanner-product-dialog {
  width: min(92vw, 620px);
  max-height: min(76vh, 720px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.scanner-product-dialog::backdrop {
  background: rgba(12, 16, 24, 0.42);
}

.scanner-product-panel {
  position: relative;
  display: grid;
  max-height: min(76vh, 720px);
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(252, 250, 246, 0.96);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.scanner-product-panel h2 {
  margin: 0;
  padding: 16px 52px 12px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 1.1rem;
}

.scanner-review-list {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding: 14px 16px 18px;
}

.scanner-review-group {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f6f1;
}

.scanner-review-group h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
}

.scanner-review-group h3::before,
.scanner-review-group h3::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.scanner-review-cards {
  display: grid;
  gap: 1px;
}

.scanner-review-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 7px;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.scanner-review-card img {
  width: 38px;
  aspect-ratio: 63 / 88;
  border-radius: 6px;
  object-fit: contain;
  background: #e8e2d8;
}

.scanner-review-card-info {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.scanner-review-card-info strong,
.scanner-review-card-info small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scanner-review-card-info strong {
  color: var(--ink);
  font-size: 0.6rem;
  line-height: 1.12;
}

.scanner-review-card-info small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.scanner-product-group {
  display: grid;
  gap: 10px;
}

.scanner-product-group h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
}

.scanner-product-group h3::before,
.scanner-product-group h3::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.scanner-product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.scanner-product-tile {
  display: grid;
  grid-template-rows: minmax(34px, auto) 88px 20px;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: center;
}

.scanner-product-tile img {
  width: 100%;
  height: 88px;
  object-fit: contain;
}

.scanner-product-name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.scanner-product-price {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  z-index: 10;
}

.tab {
  display: grid;
  min-width: 0;
  min-height: 28px;
  place-items: center;
  gap: 1px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
}

.tab.active {
  background: #eef3ec;
  color: var(--green);
}

.tab-icon {
  position: relative;
  width: 16px;
  height: 16px;
}

.profile-icon {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.profile-icon::after,
.sets-icon::after,
.packs-icon::after,
.scanner-icon::after,
.packs-icon::before,
.scanner-icon::before {
  content: "";
  position: absolute;
  display: block;
}

.profile-icon::after {
  left: 3px;
  right: 3px;
  bottom: -6px;
  height: 8px;
  border: 2px solid currentColor;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.sets-icon {
  border: 2px solid currentColor;
  border-radius: 4px;
  transform: rotate(-7deg);
}

.sets-icon::after {
  inset: 4px;
  border: 2px solid currentColor;
  border-radius: 3px;
  transform: rotate(14deg);
}

.packs-icon {
  border: 2px solid currentColor;
  border-radius: 4px;
}

.packs-icon::before,
.packs-icon::after {
  left: 4px;
  right: 4px;
  height: 2px;
  background: currentColor;
}

.packs-icon::before {
  top: 6px;
}

.packs-icon::after {
  bottom: 6px;
}

.scanner-icon {
  border: 2px solid currentColor;
  border-radius: 4px;
}

.scanner-icon::before {
  top: 4px;
  left: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.scanner-icon::after {
  right: 4px;
  bottom: 5px;
  left: 4px;
  height: 2px;
  background: currentColor;
}

@media (min-width: 760px) {
  .phone-shell {
    height: calc(100vh - 28px);
    height: calc(100dvh - 28px);
    min-height: calc(100vh - 28px);
    max-width: 1180px;
    margin-top: 14px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
  }

  .app-header {
    padding: 22px 28px 14px;
  }

  .screen {
    padding: 10px 28px 96px;
    scroll-padding-bottom: 96px;
  }

  .screen[data-screen="profile"].active {
    display: grid;
    grid-template-columns: minmax(320px, 0.85fr) minmax(320px, 1fr);
    align-content: start;
    gap: 14px;
  }

  .profile-hero,
  .google-button,
  .logout-link,
  .stats-grid {
    grid-column: 1;
  }

  .panel {
    grid-column: 2;
    grid-row: 1 / span 4;
    margin-top: 0;
  }

  .screen[data-screen="sets"].active {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .product-strip {
    margin-right: -28px;
    margin-left: -28px;
    padding-right: 28px;
    padding-left: 28px;
  }

  .list {
    grid-template-columns: 1fr;
    align-content: start;
  }

  .group-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .screen[data-screen="sets"] .empty-state,
  .screen[data-screen="sets"] .set-row:first-child,
  .screen[data-screen="sets"] .group-row:first-child {
    grid-column: 1 / -1;
  }

  .card-grid {
    grid-column: 1 / -1;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .opened-product-grid {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: start;
  }

  .review-card-list {
    grid-column: 1 / -1;
  }

  .screen[data-screen="packs"].active {
    display: grid;
    place-items: start center;
  }

  .empty-state {
    width: min(100%, 760px);
  }

}

@media (min-width: 1080px) {
  .opened-product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .opened-product-card {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .opened-product-info {
    padding: 8px;
  }
  .screen[data-screen="sets"] .list {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

}

.tcg-controls { display: flex; align-items: center; gap: 8px; }
#updateCatalogueButton { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); padding: 8px 10px; cursor: pointer; }
#updateCatalogueButton:disabled { opacity: .6; cursor: wait; }
.catalogue-update-status { position: fixed; top: 90px; left: 50%; transform: translateX(-50%); z-index: 30; max-width: min(90vw, 660px); padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); font-size: 13px; }

/* Opened-box review: flat section dividers and image-only grid cards. */
#collectionOpeningsDialog { width: min(96vw, 760px); max-height: 88dvh; }
#collectionOpeningsDialog .scanner-product-panel { max-height: 88dvh; }
.opened-review-header { display: grid; grid-template-columns: 38px minmax(0,1fr) 38px; align-items: center; gap: 4px; padding: 8px 46px 8px 8px; border-bottom: 1px solid var(--line); min-height: 54px; }
#collectionOpeningsTitle { grid-column: 2; text-align: center; padding: 0; border: 0; font-size: 1rem; }
.opened-review-header button { border: 0; background: transparent; color: var(--ink); padding: 4px; font-size: 26px; min-height: 38px; cursor: pointer; }
#collectionOpeningsBack { grid-column: 1; grid-row: 1; }
#collectionOpeningsToggle { grid-column: 3; grid-row: 1; }
#collectionOpeningsList { padding: 8px; display: block; }
.opened-review-content { display: grid; gap: 10px; }
.opened-review-divider { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: .85rem; }
.opened-review-divider span { display: flex; align-items: center; flex: 1; gap: 7px; }
.opened-review-divider span::before, .opened-review-divider span::after { content: ''; height: 1px; background: var(--line); flex: 1; min-width: 10px; }
.opened-review-divider strong { font-size: .8rem; white-space: nowrap; text-align: right; }
.opened-review-items { display: grid; gap: 8px; }
.opened-review-content.grid .opened-review-items { grid-template-columns: repeat(3,minmax(0,1fr)); }
.opened-review-item { min-width: 0; }
.opened-review-image { position: relative; min-width: 0; }
.opened-review-image img { display: block; width: 100%; aspect-ratio: 63 / 88; object-fit: contain; border-radius: 6px; }
.opened-review-badges { position: absolute; top: 3px; left: 3px; display: flex; align-items: center; gap: 2px; }
.opened-review-number, .opened-review-price { background: rgba(20,25,30,.88); color: white; border-radius: 4px; padding: 2px 3px; font-size: clamp(9px,2.4vw,12px); font-weight: 750; line-height: 1.2; white-space: nowrap; }
.opened-review-price { position: absolute; top: 3px; right: 3px; }
.opened-review-foil { display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: #ee8d19; color: #fff; font-size: 11px; line-height: 1; flex-shrink: 0; }
.opened-review-content.list .opened-review-item { display: grid; grid-template-columns: 38px minmax(0,1fr); align-items: center; gap: 12px; }
.opened-review-content.list .opened-review-item > strong { font-size: .9rem; }

.opened-review-header { position: relative; display: block; padding: 16px 78px; }
#collectionOpeningsBack { position: absolute; left: 6px; top: 8px; }
#collectionOpeningsToggle { position: absolute; right: 42px; top: 8px; }
.opened-review-price { top: auto; bottom: 3px; }

#collectionOpeningsDialog .dialog-close { z-index: 2; }

.opened-review-content.list .opened-review-badges, .opened-review-content.list .opened-review-price { display: none; }
.opened-review-list-info { display: grid; gap: 4px; min-width: 0; }
.opened-review-list-info small { color: var(--muted); font-size: .8rem; }

/* Center the section label independently of its right-aligned total. */
.opened-review-divider { position: relative; display: block; min-height: 20px; line-height: 20px; }
.opened-review-divider span { display: flex; width: 100%; justify-content: center; gap: 7px; }
.opened-review-divider span::before, .opened-review-divider span::after { align-self: center; }
.opened-review-divider strong { position: absolute; right: 0; top: 0; padding-left: 8px; background: #fcfaf6; line-height: 20px; }
#collectionOpeningsDialog .scanner-product-panel { background: #fcfaf6; }

.scanner-set-button { width:100%; padding:12px 16px; border:1px solid var(--line); border-radius:10px; background:white; color:var(--ink); font:inherit; font-weight:800; cursor:pointer; }
.scanner-set-button:hover { background:var(--paper, #f1eee8); }
.opened-pack-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }
.opened-pack-tile { display:flex; flex-direction:column; align-items:center; gap:6px; min-width:0; padding:4px; border:0; background:transparent; color:var(--ink); cursor:pointer; font:inherit; font-weight:800; }
.opened-pack-tile img { width:100%; aspect-ratio:0.65; object-fit:contain; }
.opened-pack-tile span { font-size:clamp(10px,2.5vw,16px); white-space:nowrap; }

.scanner-resume-card { user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; }
.scanner-resume-card img { -webkit-user-drag:none; pointer-events:none; }

.set-code-divider { grid-column:1 / -1; display:flex; align-items:center; gap:14px; margin:18px 0 6px; font-size:18px; text-align:center; }
.set-code-divider::before,.set-code-divider::after {content:"";height:1px;background:var(--line,#ddd4c7);flex:1;}

/* Compact phone group navigation; source-set dividers remain full width. */
.group-grid .main-set-group { grid-column: 1 / -1; }
@media (max-width: 767px) {
  .singles-group-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .product-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .group-grid .group-row { min-width: 0; padding: 12px 8px; gap: 6px; }
  .group-grid .group-row > span:first-child { min-width: 0; }
  .group-grid .group-row strong { font-size: 13px; overflow-wrap: anywhere; }
  .group-grid .group-row small { font-size: 12px; }
  .singles-group-grid .group-row:not(.main-set-group) { justify-content: center; text-align: center; }
  .singles-group-grid .group-row:not(.main-set-group) .group-actions { display: none; }
  .product-group-grid .group-row { flex-direction: column; text-align: center; }
}

#editingModeButton { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); padding: 8px 10px; cursor: pointer; }
#editingModeButton[aria-pressed="true"] { background: var(--green); color: white; }
.tcg-controls { flex-wrap: wrap; }
.library-card .opened-review-number, .library-card .opened-review-price { padding: 2px 3px; }
.catalogue-review-list .review-card-row { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 12px; }
.catalogue-review-list .opened-review-list-info { text-align: left; }
.catalogue-review-list .opened-review-list-info strong { white-space: normal; }
.editing-mode .list-add-image { top: auto; bottom: 28px; z-index: 3; }

/* Group contents sit directly on the page, with no surrounding card panels. */
.card-grid .library-card,
.catalogue-review-list .review-card-row {
  background: transparent;
  border: 0;
  padding: 0;
  box-shadow: none;
}
.card-grid .library-card img { background: transparent; }
.card-grid .library-card.selected,
.catalogue-review-list .review-card-row.selected {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

/* Collector numbers and finish prices share the lower image corners. */
.opened-review-badges { top: auto; bottom: 3px; }
.opened-review-number, .opened-review-price { font-size: clamp(10.89px, 2.904vw, 14.52px); }
.opened-review-foil { font-size: 13.31px; }
.catalogue-price-stack { position: absolute; right: 3px; bottom: 3px; display: flex; flex-direction: column; align-items: flex-end; gap: 0; }
.catalogue-price-stack .opened-review-price { position: static; display: flex; align-items: center; gap: 3px; }
.catalogue-foil-star { color: #ee8d19; font-style: normal; }
.catalogue-review-list .review-card-row { grid-template-columns: 38px minmax(0, 1fr) auto; }
.catalogue-review-list .catalogue-price-stack { position: static; }

.search-with-back:has(.card-view-toggle) { grid-template-columns: 44px minmax(0, 1fr) 40px; align-items: center; }
.search-with-back .card-view-toggle { width: 40px; height: 40px; padding: 10px; display: grid; place-items: center; }
.search-with-back .view-mode-icon { display: grid; width: 18px; height: 18px; gap: 3px; }
.csv-row-editor[hidden], .product-settings[hidden] { display: none !important; }
body:not(.editing-mode) .csv-row-editor, body:not(.editing-mode) .product-settings { display: none !important; }
html[data-phone-build] .card-editor { grid-template-columns: minmax(0, 1fr); }
html[data-phone-build] .card-editor > .card-image-wrap { width: min(100%, 300px); justify-self: center; }
html[data-phone-build] .editor-fields { min-width: 0; }
html[data-phone-build] .editor-marketplaces { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html[data-phone-build] .editor-marketplace { gap: 4px; }
html[data-phone-build] .market-logo { padding: 5px; }
html[data-phone-build] .card-editor .market-logo img { height: 25px; max-width: 120px; }
html[data-phone-build] .market-price-row { gap: 4px; font-size: 10px; }
html[data-phone-build] .market-price-row input,
html[data-phone-build] .market-price-placeholder { padding: 6px 3px; font-size: 11px; }
html[data-phone-build] .dialog-close { z-index: 5; }

/* Readable detail prices; finish labels keep their compact size. */
.card-editor .market-price-row input,
.card-editor .market-price-placeholder { font-size: 22px; }
html[data-phone-build] .market-price-row input,
html[data-phone-build] .market-price-placeholder { font-size: 22px; }

/* Compact card details, with finish labels inside full-width price boxes. */
.card-editor .editor-fields { gap: 6px; font-size: 20px; }
.card-editor .editor-card-name { font-size: 20px; }
.card-editor .editor-code-row,
.card-editor .editor-set-group-row,
.card-editor .editor-product-row { display: none !important; }
.editor-metadata { text-align: center; line-height: 1.3; display: grid; gap: 2px; overflow-wrap: anywhere; }
.card-editor #editorPriceUpdated { font-size: 20px; text-align: center; overflow-wrap: anywhere; }
.card-editor .editor-marketplace { grid-template-columns: minmax(0, 1fr); }
.card-editor .market-price-row { position: relative; display: block; border: 1px solid var(--line); border-radius: 8px; background: white; }
.card-editor .market-price-row > label,
.card-editor .market-price-row > span { position: absolute; top: 3px; left: 6px; display: block; font-size: 20px; line-height: 1.15; font-weight: 400; }
.card-editor .market-price-row input,
.card-editor .market-price-placeholder,
html[data-phone-build] .market-price-row input,
html[data-phone-build] .market-price-placeholder { width: 100%; border: 0; background: transparent; min-height: 64px; padding: 29px 4px 7px; font-size: 20px; }
.card-editor.single-price-detail .market-price-row:first-of-type > label,
.card-editor.single-price-detail .market-price-row:first-of-type > span,
.card-editor.single-price-detail .market-price-row:last-child { display: none; }
.card-editor.single-price-detail .market-price-row input,
.card-editor.single-price-detail .market-price-placeholder { padding: 8px 4px; min-height: 44px; }

.editor-metadata { width: 100%; }
.editor-metadata-line { display: flex; width: 100%; align-items: center; gap: 5px; }
.editor-metadata-line .metadata-value { flex: 1 1 0; min-width: 0; text-align: center; }
.editor-metadata-line .metadata-dot { flex: 0 0 auto; }
.card-editor .market-price-row { overflow: visible; }
.card-editor .market-price-row > label,
.card-editor .market-price-row > span {
  top: 0; left: 5px; transform: translateY(-50%); z-index: 1;
  background: rgba(20,25,30,.88); color: white; border-radius: 4px;
  padding: 2px 3px; font-size: .86rem; line-height: 1.2; font-weight: 750;
  pointer-events: none;
}
.card-editor .market-price-row input,
.card-editor .market-price-placeholder,
html[data-phone-build] .market-price-row input,
html[data-phone-build] .market-price-placeholder { min-height: 44px; padding: 8px 4px; }
.card-editor .editor-marketplace { row-gap: 12px; }

/* Phone details scale with available height instead of a fixed image size. */
html[data-phone-build] .card-editor > .card-image-wrap { width: fit-content; max-width: 100%; }
html[data-phone-build] #editorImage { display: block; width: auto; max-width: 100%; height: auto; max-height: 33.333vh; max-height: 33.333dvh; object-fit: contain; }
.editor-metadata-line { gap: 8px; align-items: stretch; }
.editor-metadata-line .metadata-value { display: grid; place-items: center; padding: 6px 4px; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.card-editor .market-price-row > label,
.card-editor .market-price-row > span { top: 2px; left: 2px; transform: none; font-size: .645rem; }
.search-with-back:has(.card-view-toggle) { grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: start; }
.search-with-back .card-view-toggle { width: 44px; height: 46px; min-height: 0; margin: 0; padding: 0; }

/* Phone detail header and compact image/metadata row. */
html[data-phone-build] .card-editor {
  grid-template-columns: minmax(0, 1fr) minmax(90px, .65fr);
  gap: 12px;
}
html[data-phone-build] .card-editor .editor-fields { display: contents; }
html[data-phone-build] .editor-card-name {
  grid-column: 1 / -1; grid-row: 1;
  width: calc(100% - 46px); min-width: 0; min-height: 40px;
}
html[data-phone-build] .card-editor > .dialog-close {
  position: static; grid-column: 2; grid-row: 1;
  justify-self: end; align-self: center; width: 36px; height: 40px;
  background: #fbe0e0; color: #a63737; border: 1px solid #eabbbb;
}
html[data-phone-build] .card-editor > .card-image-wrap {
  grid-column: 1; grid-row: 2; justify-self: start; align-self: start;
}
html[data-phone-build] #editorMetadata {
  grid-column: 2; grid-row: 2; align-self: center;
}
html[data-phone-build] .editor-metadata-line { flex-direction: column; gap: 8px; }
html[data-phone-build] .editor-metadata-line .metadata-value { flex: none; width: 100%; }
html[data-phone-build] .editor-prices-divider,
html[data-phone-build] .editor-marketplaces,
html[data-phone-build] #editorPriceUpdated { grid-column: 1 / -1; }

/* Consistent detail price color and alignment across marketplaces/finishes. */
.card-editor .market-price-row input,
.card-editor .market-price-placeholder {
  color: var(--ink);
  text-align: right;
  padding-right: 8px;
}
.card-editor .market-price-placeholder { justify-items: end; }
html[data-phone-build] .market-price-row input,
html[data-phone-build] .market-price-placeholder { padding-right: 8px; }

.finish-label-star { color: #ee8d19; font-style: normal; }
/* Sticky navigation meets the header without a scrolling strip above it. */
.screen[data-screen="sets"] { padding-top: 0; }

.card-editor .price-diagnostic { display: block; padding: 2px 5px 6px; font-size: 11px; line-height: 1.25; color: var(--muted); text-align: right; }
body:not(.editing-mode) .price-diagnostic { display: none; }

/* Brand preview: lavender sampled from logo1.png (#abb4ef). */
:root { --paper: #abb4ef; }
body, .phone-shell { background: var(--paper); }
.app-header h1 { min-width: 0; line-height: 0; }
.app-brand-logo { display: block; width: 112px; max-width: 100%; height: 112px; object-fit: contain; margin: 0 auto; }
@media (max-width: 759px) {
 .app-brand-logo { width: 90px; height: 90px; }
}

/* Navigation uses the supplied hand-drawn artwork as transparent masks. */
.tabs .tab-icon { width: 28px; height: 28px; border: 0; border-radius: 0; transform: none; background: currentColor; -webkit-mask: var(--nav-icon) center / contain no-repeat; mask: var(--nav-icon) center / contain no-repeat; }
.tabs .tab-icon::before, .tabs .tab-icon::after { content: none; }
.tabs .profile-icon { --nav-icon: url('assets/ui/navigation/profile.svg'); }
.tabs .sets-icon { --nav-icon: url('assets/ui/navigation/library.svg'); }
.tabs .packs-icon { --nav-icon: url('assets/ui/navigation/packs.svg'); }
.tabs .scanner-icon { --nav-icon: url('assets/ui/navigation/scanner.svg'); }
.tabs .tab { min-height: 48px; gap: 3px; }

/* Non-single products retain individual panels in both catalogue views. */
.non-single-products .library-card,
.non-single-products .review-card-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px;
}
.non-single-products .review-card-row { padding: 10px 12px; }

#shownProductControl { display: flex; align-items: center; gap: 8px; }
#shownProductControl[hidden], body:not(.editing-mode) #shownProductControl { display: none; }
#shownProductControl input { width: 20px; min-height: 20px; height: 20px; accent-color: var(--green); }
.catalogue-price-stack:empty { display: none; }

#shownProductStatus { font-size: 12px; color: var(--muted); font-weight: 400; }

.sale-export-tools { display: none; }
body.editing-mode .sale-export-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 8px 0 16px; }
.sale-export-tools span { overflow-wrap: anywhere; font-size: .85rem; }
