/* ==========================================================================
   marks.css — admin-only product tags (see marks.js).
   Every rule below hangs off an .mk-* class that marks.js only ever adds for
   the signed-in admin, and removes again on sign-out — so on a customer's page
   none of this matches anything. Loaded after admin.css.

   Colour families (all label colours are >= 6:1 on the dark panels they sit on, and no two are closer than
  dE 50 so a tagged card reads at a glance): change orange, check magenta, watch indigo (calmer than the
  image editor's blue), changed green, star soft gold. The two ACTION tags (change, check) also get a loud
  ring + thick bar on the card; watch / changed / star stay quiet.
   Colour is never the only signal: every pill/row also has an icon and a text label.
   ========================================================================== */

:root{
  --mk-ink:#16120a;                         /* text/icon on a filled tag colour */
}
.mk-t-change { --mk:#ff7a3d; --mk-soft:rgba(255,122,61,.16);  --mk-line:rgba(255,122,61,.6); }
.mk-t-check  { --mk:#ff5fd0; --mk-soft:rgba(255,95,208,.15);  --mk-line:rgba(255,95,208,.6); }
.mk-t-watch  { --mk:#7f93ff; --mk-soft:rgba(127,147,255,.16); --mk-line:rgba(127,147,255,.58); }
.mk-t-changed{ --mk:#4fd68f; --mk-soft:rgba(79,214,143,.15);  --mk-line:rgba(79,214,143,.55); }
.mk-t-star   { --mk:#f3d66b; --mk-soft:rgba(243,214,107,.15); --mk-line:rgba(243,214,107,.55); }
.mk-t-note   { --mk:#c7cbd4; --mk-soft:rgba(199,203,212,.14); --mk-line:rgba(199,203,212,.45); }
.mk-ic{ display:block; flex:none; }

/* ---------- card: flag button (sits first in .card-admin, before the edit pencil) ---------- */
.card-admin.mk-has-flag{ align-items:center; }
.card-admin.mk-has-flag button{ width:32px; height:32px; }
.card-admin .mk-flag{
  position:relative; background:rgba(255,255,255,.95); color:var(--header-black);
  transition:background-color .15s, color .15s, transform .15s;
}
.card-admin .mk-flag:hover{ background:#fff; transform:scale(1.06); }
.card-admin .mk-flag.is-set{ background:var(--mk); color:var(--mk-ink); }
.card-admin .mk-flag.is-set:hover{ background:var(--mk); filter:brightness(1.08); }
.card-admin.mk-has-flag button:focus-visible{ outline:2px solid #fff; outline-offset:0; box-shadow:0 0 0 4px #ffffff; }
.mk-flag-n{
  position:absolute; top:-5px; right:-5px; min-width:16px; height:16px; padding:0 4px; border-radius:8px;
  background:#15151a; color:#fff; border:1px solid var(--mk, #fff); font:700 10px/14px Inter, sans-serif; text-align:center;
  font-variant-numeric:tabular-nums; pointer-events:none;
}
.mk-flag-n:empty{ display:none; }

/* ---------- card: tag strip on the photo ----------
   Top-left, under the "Free 2-Day" badge (and under it again on a legendary card, whose ribbon pushes
   that badge down). The legendary ribbon, prime, "Multiple Sizes" and "Sponsored" badges and the
   top-right admin buttons all keep their own spots. */
.mk-strip{
  position:absolute; z-index:2; top:34px; left:8px; max-width:calc(100% - 16px);
  display:flex; flex-direction:column; align-items:flex-start; gap:4px;
  margin:0; padding:0; border:0; background:none; font:inherit; color:inherit; cursor:pointer; text-align:left;
}
.card-legendary .mk-strip{ top:70px; }
.mk-strip.is-compact{ flex-direction:row; flex-wrap:wrap; max-width:calc(100% - 112px); }
.mk-strip:focus-visible{ outline:2px solid #fff; outline-offset:3px; border-radius:12px; box-shadow:0 0 0 5px #ffffff; }
.mk-pill{
  display:inline-flex; align-items:center; gap:5px; height:22px; max-width:100%; padding:0 9px 0 6px; border-radius:999px;
  background:rgba(14,14,18,.9); border:1px solid var(--mk-line); color:#f4f5f7;
  font:700 11px/1 Inter, sans-serif; letter-spacing:.1px; white-space:nowrap;
  box-shadow:0 1px 5px rgba(0,0,0,.5); -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px);
  transition:transform .15s;
}
.mk-pill .mk-ic{ color:var(--mk); }
.mk-pill > span{ overflow:hidden; text-overflow:ellipsis; }
.mk-pill-ic{ width:24px; height:24px; padding:0; justify-content:center; }
.mk-strip:hover .mk-pill{ transform:translateX(1px); }

/* ---------- card: accent so tagged cards pop out of a grid of thirty ---------- */
.card.mk-tagged{ border-color:var(--mk-line); }
.card.card-legendary.mk-tagged{ border-color:#ffb238; }
.card.mk-tagged .card-img::after{
  content:''; position:absolute; left:0; right:0; bottom:0; height:2px; background:var(--mk); z-index:2; pointer-events:none;
}
.card.mk-action{ outline:2px solid var(--mk); outline-offset:-2px; }
.card.mk-action .card-img::after{ height:5px; }
.card.card-legendary.mk-action{ outline:none; }

@media (pointer:coarse){
  .card-admin.mk-has-flag button{ width:36px; height:36px; }
  .card-admin .mk-flag{ width:44px; height:44px; }
  .mk-pill-ic{ width:28px; height:28px; }
  .mk-pill{ height:26px; }
}
/* Narrow cards (phones, 2 per row): the three admin buttons stack in a column on the right so they never
   run into the "Free 2-Day" badge on the left, and the tag strip leaves that column free. */
@media (max-width:640px){
  .card-admin.mk-has-flag{ flex-direction:column; align-items:flex-end; }
  .mk-strip, .mk-strip.is-compact{ max-width:calc(100% - 56px); flex-direction:row; flex-wrap:wrap; }
  .mk-pill:not(.mk-pill-ic){ width:24px; height:24px; padding:0; justify-content:center; }
  .mk-pill:not(.mk-pill-ic) > span{ display:none; }
  /* a phone card's photo is only ~145px tall: show four icons at most (the flag's count and a tap on the strip
     open the full list), so a heavily tagged card never has its icons cut off at the photo's bottom edge */
  .mk-strip .mk-pill:nth-child(n+5){ display:none; }
  .card-admin.mk-has-flag button.card-edit, .card-admin.mk-has-flag button.card-del{ width:32px; height:32px; }
}
@media (max-width:640px) and (pointer:coarse){ .mk-strip, .mk-strip.is-compact{ max-width:calc(100% - 64px); } .mk-pill:not(.mk-pill-ic){ width:28px; height:28px; } }
@media (prefers-reduced-motion:reduce){
  .card-admin .mk-flag, .mk-pill{ transition:none; }
  .card-admin .mk-flag:hover{ transform:none; }
  .mk-strip:hover .mk-pill{ transform:none; }
}

/* ---------- popover (also a bottom sheet under 560px) ---------- */
.mk-scrim{ position:fixed; inset:0; z-index:149; background:rgba(0,0,0,.5); display:none; }
.mk-scrim.on{ display:block; animation:mk-fade .15s ease-out; }
.mk-pop{
  position:fixed; z-index:150; width:344px; max-width:calc(100vw - 16px); max-height:calc(100vh - 16px); overflow:auto; overscroll-behavior:contain;
  display:flex; flex-direction:column; gap:12px; padding:14px; border-radius:14px;
  background:var(--bg-alt); color:var(--ink); border:1px solid var(--line-strong); box-shadow:var(--shadow-lg), 0 0 0 1px rgba(0,0,0,.4);
  animation:mk-pop-in .14s ease-out; font-family:Inter, sans-serif;
}
.mk-pop [hidden]{ display:none !important; }
.mk-pop.is-sheet{
  left:0; right:0; bottom:0; top:auto; width:auto; max-width:none; max-height:88vh; border-radius:18px 18px 0 0; border-bottom:0;
  padding:8px 16px calc(16px + env(safe-area-inset-bottom, 0px)); animation:mk-sheet-in .2s ease-out;
}
.mk-pop.is-sheet::before{ content:''; display:block; flex:none; width:40px; height:4px; margin:0 auto 4px; border-radius:2px; background:var(--line-strong); }
@keyframes mk-pop-in{ from{ opacity:0; transform:translateY(-4px) scale(.98); } to{ opacity:1; transform:none; } }
@keyframes mk-sheet-in{ from{ transform:translateY(40px); opacity:.6; } to{ transform:none; opacity:1; } }
@keyframes mk-fade{ from{ opacity:0; } to{ opacity:1; } }
.mk-pop-head{ display:flex; align-items:flex-start; gap:10px; }
.mk-pop-titles{ min-width:0; flex:1; }
.mk-pop-head h4{ margin:0; font-size:13px; font-weight:800; letter-spacing:.05em; text-transform:uppercase; }
.mk-pop-sub{ margin:3px 0 0; font-size:13px; line-height:1.3; color:var(--muted); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.mk-x{
  flex:none; width:32px; height:32px; border-radius:50%; border:0; cursor:pointer; display:flex; align-items:center; justify-content:center;
  background:var(--line); color:var(--ink); transition:background-color .12s;
}
.mk-x:hover{ background:var(--line-strong); }
.mk-pop button:focus-visible, .mk-pop textarea:focus-visible{ outline:2px solid #ffffff; outline-offset:2px; }

.mk-rows{ display:flex; flex-direction:column; gap:6px; }
.mk-row{
  display:grid; grid-template-columns:34px minmax(0,1fr) auto; align-items:center; gap:10px; width:100%; min-height:52px; padding:8px 12px 8px 8px;
  border-radius:10px; border:1px solid var(--line); background:rgba(255,255,255,.025); color:var(--ink); text-align:left; cursor:pointer;
  font:inherit; transition:background-color .15s, border-color .15s;
}
.mk-row:hover{ border-color:var(--line-strong); background:rgba(255,255,255,.05); }
.mk-row[aria-pressed="true"]{ border-color:var(--mk-line); background:var(--mk-soft); }
.mk-row-ic{ width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:var(--mk-soft); color:var(--mk); }
.mk-row[aria-pressed="true"] .mk-row-ic{ background:var(--mk); color:var(--mk-ink); }
.mk-row-txt{ display:flex; flex-direction:column; gap:1px; min-width:0; }
.mk-row-txt b{ font-size:13.5px; font-weight:700; line-height:1.25; }
.mk-row-txt small{ font-size:12px; line-height:1.35; color:var(--muted); }
.mk-row-top{ display:flex; align-items:baseline; justify-content:space-between; gap:8px; min-width:0; }
.mk-row-txt .mk-row-when{ flex:none; color:var(--mk); font-weight:600; font-size:11.5px; white-space:nowrap; }
.mk-sw{ position:relative; flex:none; width:36px; height:20px; border-radius:999px; background:var(--line-strong); transition:background-color .15s; }
.mk-sw::after{ content:''; position:absolute; left:3px; top:3px; width:14px; height:14px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.4); transition:transform .15s, background-color .15s; }
.mk-row[aria-pressed="true"] .mk-sw{ background:var(--mk); }
.mk-row[aria-pressed="true"] .mk-sw::after{ transform:translateX(16px); background:var(--mk-ink); }

.mk-quick-btn{
  display:grid; grid-template-columns:auto 1fr; column-gap:10px; align-items:center; width:100%; min-height:48px; padding:8px 12px; border-radius:10px; cursor:pointer;
  background:rgba(95,220,154,.12); border:1px solid rgba(95,220,154,.5); color:#5fdc9a; text-align:left; font:700 13.5px/1.2 Inter, sans-serif;
  transition:background-color .15s;
}
.mk-quick-btn:hover{ background:rgba(95,220,154,.2); }
.mk-quick-btn small{ grid-column:2; margin-top:2px; font:500 12px/1.3 Inter, sans-serif; color:var(--muted); }
.mk-lab{ display:flex; align-items:baseline; justify-content:space-between; margin:0 0 6px; font-size:12.5px; font-weight:700; color:var(--ink); }
.mk-count{ font-size:11.5px; font-weight:600; color:var(--muted); font-variant-numeric:tabular-nums; }
.mk-note{
  display:block; width:100%; min-height:72px; max-height:200px; resize:vertical; padding:9px 11px; border-radius:8px; box-sizing:border-box;
  border:1px solid var(--line); background:var(--bg); color:var(--ink); font:400 14px/1.45 Inter, sans-serif;
}
.mk-note::placeholder{ color:#8b909a; }
.mk-note:hover{ border-color:var(--line-strong); }
.mk-note:focus-visible{ outline:none; border-color:#ffffff; box-shadow:0 0 0 3px rgba(255,255,255,0.224); }
.mk-pop-foot{ display:flex; align-items:center; gap:8px; }
.mk-status{ flex:1; min-width:0; font-size:12px; color:var(--muted); }
@media (pointer:coarse){
  .mk-row{ min-height:60px; } .mk-x{ width:44px; height:44px; }
  .mk-pop-foot .adm-btn{ height:44px; } .mk-quick-btn{ min-height:56px; }
}
@media (prefers-reduced-motion:reduce){
  .mk-pop, .mk-pop.is-sheet, .mk-scrim.on{ animation:none; }
  .mk-row, .mk-sw, .mk-sw::after, .mk-x, .mk-quick-btn{ transition:none; }
}

/* ---------- inline chips (edit form, manager) ---------- */
.mk-chip{
  display:inline-flex; align-items:center; gap:6px; max-width:100%; height:26px; padding:0 10px 0 8px; border-radius:999px;
  background:var(--mk-soft); border:1px solid var(--mk-line); color:var(--mk); font:700 12px/1 Inter, sans-serif; white-space:nowrap;
}
.mk-chip > span{ overflow:hidden; text-overflow:ellipsis; }
.mk-chip em{ font-style:normal; font-weight:600; color:var(--muted); }
.mk-chip em::before{ content:'· '; }
.mk-none{ font-size:13px; color:var(--muted); }

/* ---------- product edit form row ---------- */
.mk-formcard{ padding-bottom:14px; }
.mk-formrow{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:0 0 12px; }
.mk-formpills{ display:flex; flex-wrap:wrap; gap:6px; flex:1 1 200px; min-width:0; }
.mk-edittags{ flex:none; }
.mk-formcard .adm-check{ margin:0; min-height:32px; display:flex; align-items:center; }
@media (pointer:coarse){ .mk-formcard .adm-check{ min-height:44px; } }
.mk-formcard [hidden]{ display:none !important; }

/* ---------- variant picker button ---------- */
.mk-variantbtn{ display:inline-flex; align-items:center; gap:6px; min-height:32px; }
.mk-variantbtn.is-set{ color:var(--mk); }
@media (pointer:coarse){ .mk-variantbtn, .mk-edittags{ min-height:44px; } }

/* ---------- toolbar button ---------- */
.admin-toolbar:has(.mk-manage){ display:flex; flex-wrap:wrap; gap:8px; }
.mk-manage{ display:inline-flex; align-items:center; gap:7px; min-height:36px; }
.mk-manage .mk-ic{ color:#ffffff; }
@media (pointer:coarse){ .mk-manage{ min-height:44px; } }

/* ---------- manager modal ---------- */
.product-form-modal:has(.mk-man){ max-width:780px; }
.mk-sr{ position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }
.mk-man [hidden]{ display:none !important; }
.mk-man{ --mk-pad:28px; }
@media (max-width:859px){ .mk-man{ --mk-pad:16px; } }
.mk-tools{ position:sticky; top:0; z-index:4; display:flex; flex-direction:column; gap:10px; margin:-4px calc(-1 * var(--mk-pad)) 12px; padding:8px var(--mk-pad) 12px; background:var(--bg-alt); border-bottom:1px solid var(--line); }
.mk-filters{ display:flex; flex-wrap:wrap; gap:6px; }
.mk-fchip{
  display:inline-flex; align-items:center; gap:6px; min-height:32px; padding:0 11px; border-radius:999px; cursor:pointer;
  background:rgba(255,255,255,.03); border:1px solid var(--line-strong); color:var(--ink); font:600 12.5px/1 Inter, sans-serif;
  transition:background-color .12s, border-color .12s;
}
.mk-fchip .mk-ic{ color:var(--mk, var(--muted)); }
.mk-fchip b{ min-width:18px; padding:2px 5px; border-radius:9px; background:var(--line); color:var(--ink); font-size:11px; font-weight:700; text-align:center; font-variant-numeric:tabular-nums; }
.mk-fchip:hover{ background:rgba(255,255,255,.07); }
.mk-fchip[aria-pressed="true"]{ background:var(--mk-soft, rgba(255,255,255,.14)); border-color:var(--mk-line, #fff); color:var(--mk, #fff); }
.mk-fchip[aria-pressed="true"] b{ background:var(--mk, #fff); color:var(--mk-ink); }
.mk-fchip:focus-visible, .mk-item button:focus-visible{ outline:2px solid #ffffff; outline-offset:2px; }
.mk-search input{
  display:block; width:100%; height:40px; padding:0 18px; box-sizing:border-box; border-radius:20px; border:1px solid var(--line); background:var(--bg);
  color:var(--ink); font:400 14px/1 Inter, sans-serif;
}
.mk-search input::placeholder{ color:#8b909a; }
.mk-search input:hover{ border-color:var(--line-strong); }
.mk-search input:focus-visible{ outline:none; border-color:#ffffff; box-shadow:0 0 0 3px rgba(255,255,255,0.224); }
.mk-list{ display:flex; flex-direction:column; gap:10px; padding-bottom:4px; min-height:120px; }
.mk-item{
  display:flex; align-items:flex-start; gap:14px; padding:12px; border-radius:12px; background:rgba(255,255,255,.025); border:1px solid var(--line);
}
.mk-item-body{ display:flex; gap:14px; flex:1 1 auto; min-width:0; align-items:flex-start; }
.mk-thumb{ flex:none; width:60px; height:60px; border-radius:10px; overflow:hidden; background:var(--line); }
.mk-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.mk-item-main{ flex:1; min-width:0; display:flex; flex-direction:column; gap:7px; }
.mk-item-name{ display:flex; flex-wrap:wrap; align-items:baseline; gap:2px 8px; }
.mk-item-name b{ font-size:14px; font-weight:700; line-height:1.3; }
.mk-item-name span{ font-size:12px; color:var(--muted); }
.mk-item-chips{ display:flex; flex-wrap:wrap; gap:6px; }
.mk-item-note{ margin:0; display:flex; gap:7px; align-items:flex-start; font-size:13px; line-height:1.45; color:#d6d9df; }
.mk-item-note .mk-ic{ margin-top:2px; color:var(--muted); }
.mk-item-note span{ display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; white-space:pre-line; }
.mk-item-actions{ flex:none; display:flex; flex-direction:column; gap:6px; align-items:stretch; }
.mk-item-actions .adm-btn{ justify-content:center; }
.mk-empty{ display:flex; flex-direction:column; align-items:center; gap:6px; padding:44px 16px; text-align:center; color:var(--muted); }
.mk-empty .mk-ic{ color:var(--line-strong); margin-bottom:4px; }
.mk-empty b{ color:var(--ink); font-size:15px; }
.mk-empty span{ font-size:13px; }
@media (max-width:640px){
  .mk-tools{ position:static; }
  .mk-filters{ flex-wrap:nowrap; overflow-x:auto; padding-bottom:6px; scrollbar-width:thin; -webkit-overflow-scrolling:touch; }
  .mk-fchip{ flex:none; }
  .mk-item{ flex-direction:column; gap:10px; }
  .mk-item-actions{ flex-direction:row; width:100%; }
  .mk-item-actions .adm-btn{ flex:1 1 0; }
  .mk-thumb{ width:52px; height:52px; }
}
@media (pointer:coarse){ .mk-fchip{ min-height:44px; } .mk-item-actions .adm-btn{ height:44px; } }
@media (prefers-reduced-motion:reduce){ .mk-fchip{ transition:none; } }
