/* Owner: W2-BRANDS (the Brands page and its drawer).
   Root classes: .brands-page (the page), .brand-drawer (the drawer panel), .brand-delete-dialog (the delete confirm).
   The only colour literals are the logo backgrounds, white and black, set once below. */

.brands-page, .brand-drawer { --logo-white: #fff; --logo-black: #000; }

/* ---------- Page ---------- */
.brands-page .page-head { margin-bottom: 4px; }
.brands-page > details.explain { margin: 4px 0 0; }

.brands-page .brands-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0 4px; }
.brands-page .brands-search { position: relative; flex: 0 1 260px; min-width: 200px; }
.brands-page .brands-search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.brands-page .brands-search .input { padding-left: 32px; }
.brands-page .brand-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.brands-page .brand-chips .chip.is-zero:not(.active) { color: var(--muted); font-weight: 600; }

.brands-page .brands-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 28px; margin-bottom: 8px;
  font-size: 13px; color: var(--muted);
}
.brands-page .brands-filter-note { display: inline-flex; align-items: center; gap: 4px 12px; }
.brands-page .brands-filter-note[hidden] { display: none; }
.brands-page .brands-showing { color: var(--ink-2); font-weight: 600; }
/* The key to the W / B markers, at the right of the summary line. */
.brands-page .brands-legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-left: auto; font-size: 12px; color: var(--muted); }
.brands-page .brands-legend > span:not(.vmark) { margin-right: 6px; }
.brands-page .brands-legend > span:last-child { margin-right: 0; }

/* Compact tiles: the logo on its own background, the name, the W/B markers. */
.brands-page .brand-tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.brands-page .brand-card { width: 100%; min-width: 0; }
.brands-page .brand-logo-box {
  display: flex; align-items: center; justify-content: center; height: 120px; padding: 12px;
  background: var(--logo-white); border-bottom: 1px solid var(--line); overflow: hidden;
}
.brands-page .brand-logo-box.on-dark { background: var(--logo-black); border-bottom-color: var(--logo-black); }
.brands-page .brand-logo-box img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.brands-page .brand-logo-box.is-empty {
  flex-direction: column; gap: 6px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600;
  border-bottom: 1px dashed var(--line-strong);
}
.brands-page .brand-card.is-inactive .brand-logo-box img { opacity: .45; }
.brands-page .brand-card-meta { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 10px; min-width: 0; }
.brands-page .brand-card-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-width: 0; }
.brands-page .brand-card-name {
  font-weight: 700; line-height: 20px; color: var(--ink); min-width: 0; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.brands-page .brand-card.is-inactive .brand-card-name { color: var(--ink-2); }
.brands-page .vmarks { display: inline-flex; gap: 3px; flex: 0 0 auto; margin-top: 1px; }
.brands-page .vmark {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 18px; height: 18px; border-radius: 4px;
  font-size: 12px; font-weight: 700; line-height: 1;
}
.brands-page .vmark.is-light.has { background: var(--logo-white); color: var(--ink); border: 1px solid var(--line-strong); }
.brands-page .vmark.is-dark.has { background: var(--logo-black); color: var(--logo-white); border: 1px solid var(--logo-black); }
/* Not uploaded: a dashed outline and a diagonal strike in the readable muted ink, so the
   difference never rests on a pale tint alone. */
.brands-page .vmark.is-missing {
  color: var(--muted); border: 1px dashed var(--muted);
  background: linear-gradient(to top right, transparent calc(50% - 1px), var(--muted) calc(50% - 1px), var(--muted) calc(50% + 1px), transparent calc(50% + 1px));
}
.brands-page .brand-card-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.brands-page .brands-empty { margin-top: 4px; }

/* ---------- Drawer ---------- */
.brand-drawer .brand-back {
  display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px; font-size: 13px; font-weight: 600;
  color: var(--accent-ink); text-decoration: none; border-radius: 4px;
}
.brand-drawer .brand-back:hover { text-decoration: underline; }
.brand-drawer .brand-drawer-content > .callout { margin-bottom: 14px; }
.brand-drawer .brand-section { margin-bottom: 20px; }
.brand-drawer .brand-section:last-child { margin-bottom: 0; }
.brand-drawer .brand-section > h3 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; color: var(--ink); }
.brand-drawer .brand-section-count { font-size: 12px; font-weight: 400; color: var(--muted); }
.brand-drawer .brand-section > .hint { margin: -4px 0 8px; }

.brand-drawer .logo-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.brand-drawer .logo-slot {
  display: flex; flex-direction: column; min-width: 0; min-height: 264px; border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; background: var(--surface);
}
.brand-drawer .logo-slot-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 38px; padding: 0 10px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.brand-drawer .logo-view {
  display: flex; align-items: center; justify-content: center; height: 180px; padding: 14px;
  background: var(--logo-white); border-block: 1px solid var(--line);
}
.brand-drawer .logo-view.on-dark { background: var(--logo-black); border-color: var(--logo-black); }
.brand-drawer .logo-view img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.brand-drawer .logo-slot-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 6px 10px; }
.brand-drawer .logo-file { display: flex; flex-direction: column; min-width: 0; font-size: 12px; line-height: 16px; color: var(--muted); }
.brand-drawer .logo-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* An empty slot is itself the upload button. */
.brand-drawer .logo-empty {
  align-items: center; justify-content: center; gap: 6px; padding: 16px; text-align: center; cursor: pointer;
  font: inherit; color: var(--ink-2); background: var(--surface-2); border: 2px dashed var(--line-strong);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.brand-drawer .logo-empty:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent-line); }
.brand-drawer .logo-empty:disabled { cursor: progress; }
.brand-drawer .logo-empty .spinner { width: 22px; height: 22px; }
.brand-drawer .logo-empty-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.brand-drawer .logo-empty-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: var(--r-md);
  background: var(--logo-white); color: var(--ink-2); border: 1px solid var(--line-strong);
}
.brand-drawer .logo-empty.on-dark .logo-empty-icon { background: var(--logo-black); color: var(--logo-white); border-color: var(--logo-black); }
.brand-drawer .logo-empty-action { font-size: 14px; font-weight: 700; color: var(--accent-ink); }
.brand-drawer .brand-borrowed { margin: 8px 0 0; }

.brand-drawer .brand-default .field { margin-bottom: 0; }
.brand-drawer .brand-default select { max-width: 360px; }

.brand-drawer .spellings { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.brand-drawer .spelling-chip {
  display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 2px 0 10px; max-width: 100%;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface-2); font-size: 13px; font-weight: 600;
}
.brand-drawer .spelling-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.brand-drawer .spelling-remove {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
}
.brand-drawer .spelling-remove:hover { background: var(--bad-soft); color: var(--bad-ink); }

.brand-drawer .used-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.brand-drawer .used-list li {
  display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 7px 0; font-size: 13px; border-bottom: 1px solid var(--line);
}
.brand-drawer .used-when { color: var(--muted); font-weight: 600; }
.brand-drawer .used-links { min-width: 0; }

@media (max-width: 760px) { .brand-drawer .logo-slots { grid-template-columns: 1fr; } }

/* ---------- Delete confirm ---------- */
.brand-delete-dialog .brand-delete-alt { margin-top: 10px; }
.brand-delete-dialog .callout { margin-top: 10px; }
