:root {
  --bg: #f3efe6;
  --ink: #1c1916;
  --muted: #6b645c;
  --line: #d4cdc3;
  --card: #fffcf7;
  --accent: #1f4d3a;
  --accent-soft: #dceee4;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", "Noto Sans Thai", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse 70% 40% at 0% 0%, #dde8df 0%, transparent 55%),
    var(--bg);
}
a { color: inherit; text-decoration: none; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255,252,247,.9);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.brand {
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--accent);
  font-size: 1.15rem;
}
nav { display: flex; gap: .55rem .7rem; align-items: center; flex-wrap: wrap; }
nav a:not(.btn) {
  color: var(--muted);
  font-weight: 500;
  font-size: .84rem;
  padding: .38rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  line-height: 1.2;
  white-space: nowrap;
}
nav a:not(.btn):hover {
  color: var(--ink);
  border-color: #b8b0a4;
  background: var(--card);
}
main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.1rem 3rem; }
main.main-wide { max-width: min(1680px, calc(100% - 1.5rem)); padding-left: 1rem; padding-right: 1rem; }
h1 { margin: 0 0 .35rem; font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -.02em; }
h2 { margin: 0 0 .75rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
h2 .btn,
h2 .us-size-picker > summary.btn {
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink);
}
h2 .btn.primary { color: #fff; }
h2 .btn.danger { color: #fff; }
h2 form { display: inline; margin: 0; }
h2 .us-size-picker { text-transform: none; letter-spacing: normal; }
.toolbar-title h1 { word-break: break-word; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.eyebrow { margin: 0; font-size: .75rem; color: var(--accent); font-weight: 600; letter-spacing: .04em; }
.btn {
  display: inline-flex;
  align-items: center;
  padding: .45rem .85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-weight: 600;
  font-size: .88rem;
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: #8b2e2e; border-color: #8b2e2e; color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }
.hero-panel {
  background: linear-gradient(135deg, #2f5d34, #3d7a45);
  color: #f5fff2;
  border-radius: 14px;
  padding: 1.4rem 1.35rem;
  margin-bottom: 1.25rem;
}
.hero-panel .muted { color: rgba(245,255,242,.8); }
.stats { display: flex; gap: 1.25rem; margin: 1rem 0; }
.stat { display: flex; flex-direction: column; }
.stat strong { font-size: 1.6rem; }
.stat span { font-size: .8rem; opacity: .85; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-2 > .card-block { min-width: 0; }
.fiche-layout { gap: 1rem; }
.fiche-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
.fiche-col > .card-block { margin: 0; }
.card-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  min-width: 0;
}
.card-block select,
.card-block textarea,
.card-block .table { max-width: 100%; }
.card-block label:not(.scrape-gallery-item):not(.us-size-panel-item):not(.etsy-attr-chip) {
  min-width: 0;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.toolbar-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}
.toolbar-title h1 { margin: 0; }
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
}
.toolbar .badge-etsy {
  position: static;
  margin-top: 0;
}
.toolbar .badge-ebay {
  position: static;
  margin-top: 0;
  background: #0654ba;
}
.search { display: flex; gap: .4rem; }
input, textarea, select {
  font: inherit;
  width: 100%;
  padding: .45rem .55rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.form { display: grid; gap: .7rem; }
.form label { display: grid; gap: .25rem; font-size: .88rem; }
.form.compact { margin-top: .75rem; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .85rem;
}
.product-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.product-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(47, 122, 74, 0.18);
}
.product-card-check {
  position: absolute;
  top: .4rem;
  left: .4rem;
  z-index: 2;
  margin: 0;
  background: rgba(255, 252, 247, .92);
  border-radius: 6px;
  padding: .15rem;
  line-height: 0;
}
.product-card-check input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--accent);
}
.product-card-link {
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  flex: 1;
}
.products-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem .75rem;
  align-items: end;
  margin: 0 0 .85rem;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf7f1;
}
.products-filter-bar label {
  display: grid;
  gap: .2rem;
  font-size: .82rem;
  min-width: 12rem;
  flex: 1 1 12rem;
}
.products-filter-bar input,
.products-filter-bar select {
  width: 100%;
}
.products-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 1.35rem;
}
.badge-etsy {
  position: absolute;
  top: .45rem;
  right: .45rem;
  z-index: 1;
  margin-top: 0;
  background: #1f8a4c;
  color: #fff;
  font-weight: 700;
  font-size: .68rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: .12rem .4rem;
  border-radius: 4px;
}
.badge-ebay {
  position: absolute;
  top: 2.05rem;
  right: .45rem;
  z-index: 1;
  margin-top: 0;
  background: #0654ba;
  color: #fff;
  font-weight: 700;
  font-size: .68rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .12rem .4rem;
  border-radius: 4px;
}
.badge-presta {
  position: absolute;
  top: 3.65rem;
  right: .45rem;
  z-index: 1;
  margin-top: 0;
  background: #df0067;
  color: #fff;
  font-weight: 700;
  font-size: .68rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: .12rem .4rem;
  border-radius: 4px;
}
.toolbar .badge-presta {
  position: static;
  margin-top: 0;
}
.product-card img, .ph.big {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #ebe6dc;
}
.product-card div { padding: .65rem .7rem; display: grid; gap: .15rem; }
.product-card em, .list em { font-style: normal; color: var(--muted); font-size: .85rem; }
.badge {
  display: inline-block;
  width: fit-content;
  font-size: .7rem;
  padding: .15rem .4rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-top: .25rem;
}
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.list li a { display: flex; gap: .65rem; align-items: center; }
.list img, .ph {
  width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: #ebe6dc; flex-shrink: 0;
}
.list.plain li { padding: .35rem 0; border-bottom: 1px solid var(--line); display: grid; gap: .1rem; }
.thumbs { display: flex; flex-wrap: wrap; gap: .5rem; }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
.table th, .table td { text-align: left; padding: .55rem .65rem; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: top; }
.table th { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #ebe6dc; }
.month-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.tab {
  padding: .35rem .75rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.stats-row {
  display: flex; flex-wrap: wrap; gap: 1.1rem; align-items: flex-end;
}
.stats-row .stat { display: flex; flex-direction: column; gap: .1rem; }
.stats-row .stat strong { font-size: 1.15rem; }
.stats-row .stat span { font-size: .75rem; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.sales-table { margin: 0; width: max-content; min-width: 100%; table-layout: fixed; border-collapse: collapse; }
.sales-table th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .02em;
  white-space: nowrap;
  padding: .55rem .4rem;
}
.sales-table td { vertical-align: middle; padding: .3rem .35rem; }
.sales-table td input {
  font-size: .85rem;
  padding: .35rem .4rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.sales-table td input.edit { background: #f7fff9; border-color: #b7d4c4; }
.sales-table td input.tracking {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .78rem;
  letter-spacing: -.01em;
}
.sales-table td.tracking-cell {
  vertical-align: top;
}
.sales-table .suivi-btn {
  display: block;
  margin-top: .2rem;
  padding: .1rem .35rem;
  font-size: .68rem;
  line-height: 1.2;
  width: 100%;
  box-sizing: border-box;
}
.sales-table td.computed {
  font-size: .85rem;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  padding-right: .55rem;
}
.sales-table td.computed.neg { color: #a33; font-weight: 600; }
.sales-table input.field-saved {
  outline: 2px solid #2a8a4a;
  background: #eef8ef;
}
.sales-table td.center { text-align: center; }
.sales-table td.center input[type="checkbox"] { width: auto; }
.sales-table tr.sale-canceled td {
  background: #e8e6e2 !important;
  color: #8a8580;
}
.sales-table tr.sale-canceled td input {
  background: #efece8;
  color: #8a8580;
  border-color: #d0cbc4;
}
.sales-table tr.sale-canceled td.computed { color: #9a9590; }
.sales-table tr.sale-shipped td {
  background: #e6ebe4 !important;
}
.sales-table tr.sale-shipped td input {
  background: #eef2ea;
}
.dpost-svc {
  display: block;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: #7a756e;
  margin-top: .12rem;
}
.dpost-svc.ddp { color: #1f7a3a; }
.etsy-done {
  font-size: .62rem;
  font-weight: 700;
  color: #1f7a3a;
  white-space: nowrap;
}
/* largeurs colonnes (14) */
.dpost-export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem 1rem;
  margin: 0 0 1rem;
  padding: .75rem 1rem;
}
.dpost-export-bar label { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; }
.dpost-export-bar input { padding: .25rem .4rem; }
.sales-table .col-check { width: 2.4rem; }
.sales-table .col-date { width: 6.5rem; }
.sales-table .col-item { width: 13rem; }
.sale-item-cell {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 0;
}
.sale-item-cell input { width: 100%; }
.sale-product-link {
  align-self: flex-start;
  padding: .12rem .45rem;
  font-size: .72rem;
  line-height: 1.2;
  white-space: nowrap;
}
.sales-table .col-client { width: 9rem; }
.sales-table .col-shopee { width: 7.5rem; }
.sales-table .col-num { width: 4.6rem; }
.sales-table .col-marge-thb { width: 5.5rem; }
.sales-table .col-tracking { width: 6.75rem; }
.sales-table .col-cancel { width: 3.2rem; }
.sales-table .col-email { width: 5.5rem; }
.sales-table .col-ok { width: 3rem; }
.email-send-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
}
.email-send-form .email-etsy,
.email-send-form .email-force {
  font-size: .65rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: .15rem;
  white-space: nowrap;
}
.email-btn.email-sent,
.email-btn.email-sent:disabled {
  background: #c8c4be !important;
  border-color: #b0aaa3 !important;
  color: #6a6560 !important;
  opacity: 1;
}
.flash {
  background: var(--accent-soft);
  color: var(--accent);
  padding: .55rem .8rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
}
.compact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .65rem;
  align-items: end;
}
.formula { font-size: .85rem; line-height: 1.5; }
.scrape-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .5rem;
}
.review-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  align-items: center;
  margin: 0 0 1rem;
  padding: .65rem .75rem;
  background: var(--card, #fffdf8);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.review-toolbar.sticky {
  position: sticky;
  top: 0;
  z-index: 20;
}
.review-section { margin-bottom: 1.5rem; }
.review-section h2 { margin: 0 0 .65rem; font-size: 1.05rem; }
.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 150px);
  gap: .55rem;
  justify-content: start;
}
.review-cell {
  position: relative;
  display: block;
  width: 150px;
  cursor: pointer;
  margin: 0;
}
.review-cell input {
  position: absolute;
  top: .3rem;
  right: .3rem;
  z-index: 2;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--accent);
}
.review-cell img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eee;
  display: block;
  pointer-events: none;
}
.review-cell video {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #111;
  display: block;
  pointer-events: auto;
}
.review-cell.is-video {
  cursor: default;
}
.review-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(0,0,0,.18);
  border-radius: 8px;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,.45);
  transition: opacity .15s;
}
.review-cell.is-playing .review-play { opacity: 0; }
.review-cell.is-selected img,
.review-cell.is-selected video {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.review-kind {
  position: absolute;
  left: .3rem;
  top: .3rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: .1rem .35rem;
  border-radius: 4px;
  color: #fff;
  background: rgba(28, 25, 22, .72);
}
.review-cell.is-video .review-kind { background: #2c5f4a; }
.review-cell.is-img .review-kind { background: #8b3d2f; }
.review-name {
  display: block;
  margin-top: .2rem;
  font-size: .68rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}
.scrape-gallery-item {
  position: relative;
  display: block;
  cursor: pointer;
  border-radius: 8px;
}
.scrape-gallery-item.is-selected img,
.scrape-gallery-item.is-selected video {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.scrape-gallery-check {
  position: absolute;
  top: .3rem;
  right: .3rem;
  z-index: 2;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--accent);
}
.scrape-gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eee;
  display: block;
  pointer-events: none;
}
.scrape-gallery-item.is-chart img {
  object-fit: contain;
  background: #fff;
  border-color: var(--accent);
}
.scrape-gallery-n {
  position: absolute;
  top: .3rem;
  left: .3rem;
  z-index: 1;
  background: rgba(28, 25, 22, .75);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  min-width: 1.2rem;
  text-align: center;
  padding: .1rem .28rem;
  border-radius: 999px;
  pointer-events: none;
}
.scrape-gallery-open {
  position: absolute;
  bottom: .3rem;
  right: .3rem;
  z-index: 2;
  width: 1.35rem;
  height: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(28, 25, 22, .7);
  color: #fff;
  font-size: .75rem;
  text-decoration: none;
  line-height: 1;
}
.scrape-gallery-open:hover { background: rgba(28, 25, 22, .9); color: #fff; }
.scrape-gallery-tag {
  position: absolute;
  bottom: .35rem;
  left: .35rem;
  right: 1.8rem;
  text-align: center;
  font-size: .68rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255, 252, 247, .92);
  border-radius: 6px;
  padding: .1rem .25rem;
  pointer-events: none;
}
.desc-block {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: .88rem;
  line-height: 1.45;
  max-height: 280px;
  overflow: auto;
  background: #f7f3ec;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .65rem .75rem;
  margin: 0;
}
.desc-edit {
  min-height: 220px;
  font-family: inherit;
  font-size: .88rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.product-card em {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* eRank analyzer */
.erank-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-bottom: .75rem;
}
.erank-toolbar .erank-inline {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: var(--muted);
  width: auto;
}
.erank-toolbar .erank-inline input { width: min(100%, 14rem); }
.erank-logic {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.erank-logic .btn { border: none; border-radius: 0; }
.erank-logic .btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.erank-word-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem 1rem;
  margin: .5rem 0 .75rem;
}
@media (max-width: 720px) {
  .erank-word-filters { grid-template-columns: 1fr; }
}
.erank-exclude { margin: 0; }
.erank-exclude textarea { width: 100%; min-height: 4.5rem; }
.erank-filters { display: flex; flex-direction: column; gap: .45rem; margin-bottom: .75rem; }
.erank-filters .filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  padding: .4rem .5rem;
  background: #f7f4ef;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.erank-filters .filter-row select,
.erank-filters .filter-row input { width: auto; min-width: 6rem; }
.erank-filters .idx {
  font-size: .75rem;
  color: var(--muted);
  min-width: 1.2rem;
  font-variant-numeric: tabular-nums;
}
.erank-presets { display: flex; flex-wrap: wrap; gap: .4rem; }
.erank-presets .btn {
  font-size: .78rem;
  background: var(--accent-soft);
  border-color: #b7d4c4;
  color: var(--accent);
}
.erank-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  font-size: .9rem;
  margin: .85rem 0;
}
.erank-stats strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.erank-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #ebe6dc;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.erank-table th.sorted { color: var(--accent); }
.erank-table th:first-child,
.erank-table td:first-child,
.erank-table th.pick-col,
.erank-table td.pick-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--card);
}
.erank-table th.pick-col,
.erank-table th:first-child { z-index: 3; background: #ebe6dc; }
.erank-table td.kw {
  font-weight: 500;
  max-width: 26rem;
  overflow: visible;
  cursor: default;
  text-align: left;
}
.erank-kw-wrap {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  max-width: 100%;
}
.erank-kw-text {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 21rem;
  cursor: pointer;
}
.erank-gimg {
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: #57534e;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.erank-gimg:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.erank-fav {
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: #a8a29e;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  line-height: 1;
}
.erank-fav:hover {
  color: #b45309;
  border-color: #f59e0b;
  background: #fffbeb;
}
.erank-fav.is-on {
  color: #b45309;
  background: #fef3c7;
  border-color: #f59e0b;
}
.erank-fav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.erank-fav-list li {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .35rem .2rem .55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #faf7f1;
  font-size: .82rem;
}
.erank-fav-list button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  padding: .1rem .25rem;
}
.erank-fav-list button:hover { color: #9a3412; }
.erank-table td, .erank-table th { text-align: right; white-space: nowrap; }
.erank-table tr.selected td { background: #e5f2ea; }
.erank-table .pick-col { text-align: center !important; width: 2.2rem; }

.tag-count-badge {
  display: inline-flex;
  align-items: center;
  gap: .1rem;
  font-size: .85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  letter-spacing: 0;
  text-transform: none;
}
.tag-count-badge.warn {
  background: #fef3c7;
  color: #92400e;
}
.tag-count-badge.full {
  background: var(--accent);
  color: #fff;
}
.tag-count-badge.over {
  background: #fee2e2;
  color: #991b1b;
}
.tag-pattern-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin-top: .25rem;
}
.tag-pattern-add-row select {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 100%;
}
.tag-pattern-add-row .btn {
  flex-shrink: 0;
  padding: .35rem .65rem;
  font-size: .82rem;
}
.tag-pattern-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  min-height: 0;
  margin: .4rem 0 .15rem;
}
.tag-pattern-chips:empty { display: none; }
.tag-pattern-chip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .12rem .35rem .12rem .45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5f5f4;
  font-size: .78rem;
  line-height: 1.3;
}
.tag-pattern-chip-count { font-size: .72rem; }
.tag-pattern-chip-remove {
  border: 0;
  background: transparent;
  color: #888;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 .15rem;
}
.tag-pattern-chip-remove:hover { color: #b91c1c; }
.tag-pattern-merge {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: .35rem 0 .55rem;
  font-size: .88rem;
}
.tag-pattern-merge input { width: auto; }
textarea.input-error {
  border-color: #b91c1c !important;
  box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.15);
}
.etsy-attr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .75rem;
}
.etsy-attr-field {
  margin: 0;
  padding: .55rem .65rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf7f1;
  min-width: 0;
}
.etsy-attr-field-wide {
  grid-column: span 2;
}
@media (max-width: 720px) {
  .etsy-attr-field-wide { grid-column: auto; }
}
.etsy-attr-field legend {
  font-size: .78rem;
  font-weight: 700;
  padding: 0 .25rem;
}
.etsy-attr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  min-height: 0;
  margin-bottom: .4rem;
}
.etsy-attr-chips:empty { display: none; }
.etsy-attr-chip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: .12rem .3rem .12rem .55rem;
  font-size: .78rem;
  font-weight: 600;
  max-width: 100%;
}
.etsy-attr-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.etsy-attr-chip-x {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0 .2rem;
  opacity: .7;
}
.etsy-attr-chip-x:hover { opacity: 1; }
.etsy-attr-chip.is-in-desc {
  background: #e5f2ea;
  color: #1b6b3a;
}
.etsy-attr-chip.is-not-in-desc {
  background: #fef3c7;
  color: #92400e;
}
.etsy-attr-chip.is-not-in-desc::after {
  content: "?";
  font-size: .68rem;
  font-weight: 700;
  opacity: .75;
  margin-right: .15rem;
}
.etsy-mat-from-desc {
  margin: 0 0 .55rem;
  padding: .45rem .55rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}
.etsy-mat-from-desc-label {
  font-size: .78rem;
  margin: 0 0 .35rem;
}
.etsy-mat-from-desc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}
.etsy-mat-from-desc-chips button {
  border: 1px solid #86b89a;
  background: #eef8f1;
  color: #1b6b3a;
  border-radius: 999px;
  padding: .18rem .55rem;
  font-size: .76rem;
  font-weight: 600;
  cursor: pointer;
}
.etsy-mat-from-desc-chips button:hover {
  background: #d9f0e1;
}
.etsy-mat-match-status {
  font-size: .75rem;
  margin: .4rem 0 0;
}
.etsy-attr-combo-row {
  display: flex;
  align-items: flex-start;
  gap: .35rem;
  min-width: 0;
}
.etsy-attr-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  flex: 1 1 52%;
  min-width: 0;
  align-content: flex-start;
}
.etsy-attr-shortcut {
  display: inline-flex;
  align-items: center;
  gap: .12rem;
  max-width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 4px;
  padding: .18rem .22rem .18rem .4rem;
  font: inherit;
  font-size: .72rem;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
}
.etsy-attr-shortcut:hover,
.etsy-attr-shortcut.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.materials-combo-row { margin-top: .35rem; }
.materials-combo-row .etsy-attr-shortcuts { flex: 1 1 48%; }
.materials-combo-row textarea { flex: 1 1 48%; min-width: 12rem; }
.etsy-attr-shortcut-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.etsy-attr-shortcut-x {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: .95rem;
  line-height: 1;
  padding: 0 .15rem;
  opacity: .45;
}
.etsy-attr-shortcut-x:hover { opacity: 1; color: #a33; }
.etsy-attr-shortcut-add {
  border-style: dashed;
  font-weight: 700;
  opacity: .75;
  padding: .18rem .4rem;
}
.etsy-attr-shortcut-add:hover { opacity: 1; }
.etsy-attr-combo { position: relative; flex: 1 1 42%; min-width: 7.5rem; }
.etsy-attr-search {
  width: 100%;
  font-size: .85rem !important;
  padding: .4rem .55rem !important;
}
.etsy-attr-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 3px);
  z-index: 30;
  margin: 0;
  padding: .25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 240px;
  overflow: auto;
  box-shadow: 0 10px 28px rgba(28, 25, 22, .12);
}
.etsy-attr-suggest button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: .42rem .7rem;
  font: inherit;
  font-size: .84rem;
  cursor: pointer;
  color: var(--ink);
}
.etsy-attr-suggest button:hover,
.etsy-attr-suggest button.active { background: var(--accent-soft); }
.etsy-attr-suggest .etsy-attr-custom-add { color: var(--muted); font-style: italic; }

.taxonomy-search-results {
  margin: -.35rem 0 .65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  max-height: 240px;
  overflow: auto;
}
.taxonomy-search-list {
  list-style: none;
  margin: 0;
  padding: .25rem 0;
}
.taxonomy-search-item {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: .4rem .65rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.taxonomy-search-item:hover {
  background: var(--accent-soft);
}
.taxonomy-search-item span {
  font-size: .85rem;
}
.taxonomy-search-item em {
  font-size: .75rem;
  white-space: nowrap;
}
.us-size-picker {
  display: inline-block;
  margin-left: .35rem;
  vertical-align: middle;
  position: relative;
}
.us-size-picker > summary {
  list-style: none;
}
.us-size-picker > summary::-webkit-details-marker,
.us-size-picker > summary::marker {
  display: none;
  content: "";
}
.us-size-picker[open] > summary {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.us-size-panel {
  position: absolute;
  z-index: 30;
  left: 0;
  top: calc(100% + 6px);
  width: min(22rem, 86vw);
  padding: .75rem .8rem .7rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(28, 25, 22, .14);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--ink);
}
.us-size-panel-hint {
  margin: 0 0 .5rem;
  font-size: .78rem;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.us-size-panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .22rem .5rem;
  max-height: 16rem;
  overflow: auto;
  margin: 0 0 .55rem;
}
.us-size-panel-item {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  cursor: pointer;
}
.us-size-panel-item input {
  width: auto;
  margin: 0;
}
.us-size-panel-item.is-already {
  opacity: .55;
  cursor: default;
}
.us-size-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  justify-content: flex-end;
}

/* Bilingual EN + TH */
.i18n { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.15; gap: 0.12em; vertical-align: middle; }
.i18n-en { display: block; }
.i18n-th { display: block; font-family: "Noto Sans Thai", "DM Sans", system-ui, sans-serif; font-size: 0.78em; font-weight: 500; opacity: 0.88; letter-spacing: 0; text-transform: none; }
nav a .i18n, .btn .i18n, .actions .i18n { align-items: center; text-align: center; }
h1 .i18n, h2 .i18n { align-items: flex-start; }
h2 .i18n-th { text-transform: none; letter-spacing: 0; color: inherit; opacity: 0.9; }
.btn { line-height: 1.2; }
body { font-family: "DM Sans", "Noto Sans Thai", system-ui, sans-serif; }
