/* 工作台首页广告位（迁移 167）—— static/js/HomeAds.js
 *
 * 4 列网格、行高固定，规格 = 行 × 列：
 *   1x1 小方块 · 1x2 横条 · 1x3 通栏 · 2x2 大方块
 * grid-auto-flow: dense 让小块自动填进大块留下的空位 —— 运营不用算"这一行还剩几格"。
 * 无图卡片按 theme 画柔和渐变 + 一枚装饰圆，有图卡片图片铺满、文字压在底部渐变遮罩上。
 * 容器（不是视口）窄于 560px 时收成 2 列：首页右侧面板打开、手机端都会走到这里。
 */
.hads-wrap{width:100%;max-width:820px;flex-shrink:0;margin:0 0 22px;container-type:inline-size;
  animation:hadsRise .45s ease-out both}
.hads{--hads-row:92px;--hads-gap:12px;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
  grid-auto-rows:var(--hads-row);grid-auto-flow:row dense;gap:var(--hads-gap)}
@keyframes hadsRise{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}

.hads-card{position:relative;display:flex;align-items:flex-end;min-width:0;overflow:hidden;
  border-radius:14px;border:1px solid rgba(15,23,42,.06);text-decoration:none;color:#1D2129;
  isolation:isolate;transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease;
  -webkit-tap-highlight-color:transparent}
a.hads-card{cursor:pointer}
a.hads-card:hover{transform:translateY(-2px);box-shadow:0 10px 24px -12px rgba(22,93,255,.35);border-color:rgba(22,93,255,.22)}
a.hads-card:focus-visible{outline:2px solid #165DFF;outline-offset:2px}
.hads-1x1{grid-column:span 1;grid-row:span 1}
.hads-1x2{grid-column:span 2;grid-row:span 1}
.hads-1x3{grid-column:span 3;grid-row:span 1}
.hads-2x2{grid-column:span 2;grid-row:span 2}

/* 图片铺满；有文字时底部压一层渐变保证可读 */
.hads-img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:-2;transition:transform .35s ease}
a.hads-card:hover .hads-img{transform:scale(1.03)}
.hads-card.has-overlay::after{content:"";position:absolute;inset:0;z-index:-1;
  background:linear-gradient(180deg,rgba(0,0,0,0) 35%,rgba(0,0,0,.62) 100%)}
.hads-card.has-overlay{color:#fff}

/* 文字区 */
.hads-txt{position:relative;display:flex;flex-direction:column;gap:3px;min-width:0;width:100%;padding:12px 14px}
.hads-ttl{font-size:14px;font-weight:600;line-height:1.35;letter-spacing:.1px;
  display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
.hads-sub{font-size:12px;line-height:1.5;opacity:.78;
  display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
.hads-cta{align-self:flex-start;margin-top:4px;font-size:11.5px;font-weight:600;line-height:1;
  padding:6px 10px;border-radius:999px;background:rgba(255,255,255,.72);color:inherit;white-space:nowrap;
  backdrop-filter:blur(4px)}
.hads-card.has-overlay .hads-cta{background:rgba(255,255,255,.2);color:#fff;border:1px solid rgba(255,255,255,.35)}
/* 1x1 位置太小：副标题让位给标题，按钮缩成一行字 */
.hads-1x1 .hads-sub{display:none}
.hads-1x1 .hads-txt{padding:10px 12px}
.hads-1x1 .hads-ttl{-webkit-line-clamp:2;font-size:13.5px}
/* 大卡片：标题放大、副标题两行，文字区放到左下 */
.hads-2x2 .hads-txt{padding:18px 20px;gap:6px}
.hads-2x2 .hads-ttl{font-size:19px;-webkit-line-clamp:2;line-height:1.3}
.hads-2x2 .hads-sub{font-size:13px;-webkit-line-clamp:2}
.hads-2x2 .hads-cta{font-size:12.5px;padding:8px 14px;margin-top:8px}
.hads-1x3 .hads-txt,.hads-1x2 .hads-txt{justify-content:center;height:100%;padding:12px 18px}
.hads-1x3 .hads-ttl{font-size:16px}
.hads-1x3 .hads-cta,.hads-1x2 .hads-cta{position:absolute;right:16px;top:50%;transform:translateY(-50%);margin:0}
.hads-1x3 .hads-txt,.hads-1x2 .hads-txt{padding-right:110px}
.hads-1x2:not(:has(.hads-cta)) .hads-txt,.hads-1x3:not(:has(.hads-cta)) .hads-txt{padding-right:18px}

/* 无图主题：浅色渐变 + 右上一枚装饰圆，配色取自品牌色系，避免一排卡片抢眼 */
.hads-deco{position:absolute;z-index:-1;right:-26px;top:-30px;width:110px;height:110px;border-radius:50%;
  background:currentColor;opacity:.08}
.hads-deco::after{content:"";position:absolute;left:-22px;bottom:-34px;width:56px;height:56px;border-radius:50%;
  background:currentColor;opacity:.9}
.hads-2x2 .hads-deco{width:200px;height:200px;right:-50px;top:-60px}
.hads-t-blue  {background:linear-gradient(135deg,#EAF1FF 0%,#D6E4FF 100%);color:#0E42D2}
.hads-t-indigo{background:linear-gradient(135deg,#F1EDFF 0%,#E0D8FF 100%);color:#5B3CC4}
.hads-t-teal  {background:linear-gradient(135deg,#E6FAF5 0%,#CCF2E8 100%);color:#0B7A62}
.hads-t-amber {background:linear-gradient(135deg,#FFF6E6 0%,#FFE7C2 100%);color:#B25E00}
.hads-t-rose  {background:linear-gradient(135deg,#FFEEF0 0%,#FFD9DE 100%);color:#C02A47}
.hads-t-slate {background:linear-gradient(135deg,#F3F5F8 0%,#E3E7ED 100%);color:#2E3A4D}
.hads-card.has-img{background:#E5E6EB}
.hads-card:not(.has-img) .hads-ttl{color:#1D2129}
.hads-card:not(.has-img) .hads-sub{color:#4E5969;opacity:1}
.hads-card:not(.has-img) .hads-cta{color:inherit}

[data-theme="dark"] .hads-card{border-color:rgba(255,255,255,.06)}
[data-theme="dark"] .hads-t-blue  {background:linear-gradient(135deg,#16233F 0%,#1B2C52 100%);color:#7FA6FF}
[data-theme="dark"] .hads-t-indigo{background:linear-gradient(135deg,#221C3D 0%,#2B2350 100%);color:#B3A1FF}
[data-theme="dark"] .hads-t-teal  {background:linear-gradient(135deg,#112B27 0%,#143630 100%);color:#5FD6B7}
[data-theme="dark"] .hads-t-amber {background:linear-gradient(135deg,#2F2412 0%,#3A2C14 100%);color:#FFB95C}
[data-theme="dark"] .hads-t-rose  {background:linear-gradient(135deg,#33181E 0%,#3F1D25 100%);color:#FF8FA4}
[data-theme="dark"] .hads-t-slate {background:linear-gradient(135deg,#1E222A 0%,#262B35 100%);color:#AEB6C4}
[data-theme="dark"] .hads-card:not(.has-img) .hads-ttl{color:#E6E9F0}
[data-theme="dark"] .hads-card:not(.has-img) .hads-sub{color:#B4BAC6}
[data-theme="dark"] .hads-card:not(.has-img) .hads-cta{background:rgba(255,255,255,.08)}

/* 窄容器：2 列。1x2 / 1x3 都占满一行，2x2 仍是大方块 */
@container (max-width:560px){
  .hads{--hads-row:84px;--hads-gap:10px;grid-template-columns:repeat(2,minmax(0,1fr))}
  .hads-1x2,.hads-1x3{grid-column:span 2}
}
/* 不支持容器查询的老浏览器按视口兜底 */
@supports not (container-type:inline-size){
  .hads-wrap{container-type:normal}
  @media (max-width:640px){
    .hads{--hads-row:84px;--hads-gap:10px;grid-template-columns:repeat(2,minmax(0,1fr))}
    .hads-1x2,.hads-1x3{grid-column:span 2}
  }
}
@media (prefers-reduced-motion:reduce){
  .hads-wrap,.hads-card,.hads-img{animation:none;transition:none}
}
/* 移动端首页（.m-empty 内）：贴合两侧留白 */
.m-empty .hads-wrap{margin:4px 0 16px}

/* 后台预览里正在编辑的那一张 */
.hads-card.hads-hl{box-shadow:0 0 0 2px #165DFF,0 10px 24px -12px rgba(22,93,255,.45)}

/* ══ 后台「首页广告位」（static/js/HomeAdsTab.js）══════════════════════ */
.hat .adm-section+.adm-section{margin-top:16px}
.hat-count{font-size:12px;font-weight:400;color:var(--tx3)}
.hat-check{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;color:var(--tx2);cursor:pointer}
.hat-stage{padding:18px;border-radius:12px;background:var(--bg0);border:1px solid var(--brd);
  background-image:radial-gradient(var(--brd) 1px,transparent 1px);background-size:16px 16px}
.hat-stage .hads-wrap{margin:0 auto}
.hat-empty{font-size:13px;color:var(--tx3);text-align:center;padding:26px 0}
.hat-err{font-size:13px;color:#dc2626;background:rgba(220,38,38,.06);border:1px solid rgba(220,38,38,.18);border-radius:8px;padding:9px 12px;margin-bottom:12px}

.hat-editor{border-color:var(--acc-b)}
.hat-field{display:flex;flex-direction:column;gap:6px;margin-bottom:14px;min-width:0}
.hat-label{font-size:12.5px;color:var(--tx2);font-weight:500}
.hat-label em{font-style:normal;font-weight:400;color:var(--tx3);margin-left:4px}
.hat-field input[type=text],.hat-field input[type=datetime-local]{padding:9px 12px;border-radius:8px;border:1px solid var(--brd);
  background:var(--bg0);color:var(--tx1);font-size:13px;outline:none;font-family:var(--sans);transition:border-color .2s,box-shadow .2s}
.hat-field input:focus{border-color:var(--acc-b);box-shadow:0 0 0 3px rgba(22,93,255,.08)}
.hat-grid2{display:grid;grid-template-columns:1fr 1fr;gap:0 16px}
.hat-tip{font-size:11.5px;color:var(--tx3);line-height:1.6}

.hat-sizes{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.hat-size{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:10px;border:1px solid var(--brd);
  background:var(--bg0);cursor:pointer;text-align:left;font-family:inherit;color:var(--tx1);transition:.15s}
.hat-size:hover{border-color:var(--acc-b)}
.hat-size.on{border-color:var(--acc);background:var(--acc-m);box-shadow:0 0 0 3px rgba(22,93,255,.08)}
.hat-size-t{display:flex;flex-direction:column;gap:2px;min-width:0}
.hat-size-t b{font-size:13px;font-weight:600;white-space:nowrap}
.hat-size-t small{font-size:11.5px;color:var(--tx3)}
.hat-glyph{display:grid;grid-template-columns:repeat(4,7px);grid-auto-rows:7px;gap:2px;flex-shrink:0}
.hat-glyph i{display:block;border-radius:2px;background:var(--bg4,#E5E6EB)}
.hat-glyph i.on{background:var(--tx3)}
.hat-glyph.sel i.on,.hat-size:hover .hat-glyph i.on{background:var(--acc)}

.hat-themes{display:flex;flex-wrap:wrap;gap:8px}
.hat-theme{position:relative;width:64px;height:40px;border-radius:9px;border:1px solid rgba(15,23,42,.08);cursor:pointer;
  display:flex;align-items:flex-end;justify-content:flex-start;padding:4px 7px;font-family:inherit}
.hat-theme span{font-size:11px;font-weight:600;color:inherit}
.hat-theme.on{box-shadow:0 0 0 2px var(--bg1),0 0 0 4px var(--acc)}

.hat-img-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.hat-img-thumb{width:120px;height:56px;object-fit:cover;border-radius:8px;border:1px solid var(--brd)}
.hat-upload{padding:12px 18px;border-radius:10px;border:1px dashed var(--acc-b);background:var(--acc-m);color:var(--acc);
  font-size:13px;cursor:pointer;font-family:inherit}
.hat-upload:disabled{opacity:.6;cursor:default}
.hat-publish{margin-top:2px}

.hat-list{display:flex;flex-direction:column;gap:8px}
.hat-row{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:12px;border:1px solid var(--brd);background:var(--bg0)}
.hat-row.editing{border-color:var(--acc);box-shadow:0 0 0 3px rgba(22,93,255,.08)}
.hat-order{display:flex;flex-direction:column;gap:2px}
.hat-order button{width:24px;height:20px;border:1px solid var(--brd);border-radius:5px;background:var(--bg1);color:var(--tx2);
  font-size:11px;line-height:1;cursor:pointer;padding:0}
.hat-order button:disabled{opacity:.35;cursor:default}
.hat-thumb{width:72px;height:44px;border-radius:8px;overflow:hidden;flex-shrink:0;display:flex;align-items:center;justify-content:center;
  font-size:12px;font-weight:600}
.hat-thumb img{width:100%;height:100%;object-fit:cover}
.hat-main{flex:1;min-width:0}
.hat-title{font-size:13.5px;font-weight:600;color:var(--tx1);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hat-meta{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px;margin-top:4px;font-size:12px}
.hat-dim{color:var(--tx3)}
.hat-link{max-width:260px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hat-size-chip{display:inline-flex;align-items:center;gap:6px;color:var(--tx2)}
.hat-size-chip .hat-glyph{grid-template-columns:repeat(4,5px);grid-auto-rows:5px;gap:1.5px}
.hat-st{display:inline-block;padding:1px 8px;border-radius:999px;font-size:11.5px;font-weight:500;line-height:18px}
.hat-st-on{background:rgba(0,180,42,.1);color:#00973a}
.hat-st-off{background:var(--bg3);color:var(--tx3)}
.hat-st-wait{background:rgba(22,93,255,.1);color:#165DFF}
.hat-st-end{background:rgba(247,114,52,.1);color:#d35a1c}
.hat-ops{display:flex;align-items:center;gap:6px;flex-shrink:0}
@media (max-width:760px){
  .hat-sizes{grid-template-columns:repeat(2,minmax(0,1fr))}
  .hat-grid2{grid-template-columns:1fr}
  .hat-row{flex-wrap:wrap}
  .hat-ops{width:100%;justify-content:flex-end}
}
