/* ============================================================
   SKLP 工作台 · 样式
   色板与 BI 站点一致：深蓝底 + 青/金/绿强调
   ============================================================ */

:root {
  --bg: #0B1220;
  --panel: #111A2B;
  --card: #16233A;
  --text: #E6EDF7;
  --muted: #8FA3BF;
  --cyan: #22D3EE;
  --gold: #F5B84C;
  --green: #34D399;
  --line: rgba(143, 163, 191, 0.14);
  --radius: 14px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 480px at 12% -8%, rgba(34, 211, 238, 0.07), transparent 62%),
    radial-gradient(760px 420px at 92% 4%, rgba(245, 184, 76, 0.05), transparent 60%),
    linear-gradient(180deg, #0B1220 0%, #0A101C 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(34, 211, 238, 0.24); color: #fff; }

.page {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 顶部品牌 ---------- */

.hero { padding: 36px 0 0; }

.hero__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand__mark {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 11px;
  color: var(--cyan);
  background: linear-gradient(150deg, rgba(34, 211, 238, 0.14), rgba(34, 211, 238, 0.03));
  border: 1px solid rgba(34, 211, 238, 0.22);
}

.brand__text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand__name { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }
.brand__sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero__stamp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(17, 26, 43, 0.6);
  white-space: nowrap;
}

.stamp__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12);
}

.hero__main { padding: 32px 0 24px; }

.hero__eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(143, 163, 191, 0.85);
}

.hero__title {
  margin: 0;
  font-size: clamp(28px, 3.9vw, 44px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  background: linear-gradient(100deg, #F4F8FF 12%, #CBDDF2 70%, #9FB8D4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__tagline {
  margin: 14px 0 0;
  max-width: 640px;
  font-size: 14.5px;
  color: var(--muted);
}

/* ---------- 搜索 ---------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 320px;
  max-width: 520px;
  height: 46px;
  padding: 0 12px 0 14px;
  background: var(--panel);
  border: 1px solid rgba(143, 163, 191, 0.2);
  border-radius: 12px;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}

.search:focus-within {
  border-color: rgba(34, 211, 238, 0.55);
  background: #122033;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

.search__icon { color: rgba(143, 163, 191, 0.75); flex: none; display: grid; place-items: center; }

.search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  outline: none;
  appearance: none;
}
.search__input::placeholder { color: rgba(143, 163, 191, 0.62); }
.search__input::-webkit-search-cancel-button { display: none; }

.search__clear {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: rgba(143, 163, 191, 0.1);
  color: var(--muted);
  cursor: pointer;
}
.search__clear:hover { color: var(--text); background: rgba(143, 163, 191, 0.18); }

.search__kbd {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: rgba(143, 163, 191, 0.72);
  background: rgba(143, 163, 191, 0.08);
  border: 1px solid rgba(143, 163, 191, 0.16);
  border-radius: 6px;
}

.stats { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.stat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(17, 26, 43, 0.55);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}
.stat b {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat--muted b { color: var(--muted); }

/* ---------- 主区 ---------- */

.main { flex: 1 0 auto; padding: 28px 0 8px; }

.recent {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.recent__label {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: rgba(143, 163, 191, 0.7);
}
.recent__list { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: #C9D8EA;
  text-decoration: none;
  background: rgba(22, 35, 58, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.chip:hover { color: #fff; border-color: rgba(34, 211, 238, 0.4); transform: translateY(-1px); }
.chip__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }

/* 分组 */
.group { margin-bottom: 40px; }

.group__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.group__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.group__count {
  font-size: 11.5px;
  color: rgba(143, 163, 191, 0.75);
  font-variant-numeric: tabular-nums;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.group__rule {
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(143, 163, 191, 0.22), rgba(143, 163, 191, 0.02));
}

.group__desc {
  font-size: 12px;
  color: rgba(143, 163, 191, 0.6);
  white-space: nowrap;
  margin-left: 2px;
}

/* ---------- 卡片 ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* 分组里只有一张卡时：整行铺开、横向排布，避免首屏出现大片空洞 */
@media (min-width: 900px) {
  .cards > li:only-child { grid-column: 1 / -1; }

  .cards > li:only-child .card > a,
  .cards > li:only-child .card__body {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    grid-template-areas:
      "icon title pill"
      "icon desc  desc"
      "icon tags  tags"
      "foot foot  foot";
    column-gap: 18px;
    padding: 22px 24px 16px;
    align-items: start;
  }

  .cards > li:only-child .card__top { display: contents; }
  .cards > li:only-child .card__icon { grid-area: icon; width: 52px; height: 52px; }
  .cards > li:only-child .pill { grid-area: pill; justify-self: end; }
  .cards > li:only-child .card__title { grid-area: title; font-size: 17px; margin-bottom: 6px; }
  .cards > li:only-child .card__desc { grid-area: desc; max-width: 76ch; margin-bottom: 12px; }
  .cards > li:only-child .card__tags { grid-area: tags; margin-bottom: 14px; }
  .cards > li:only-child .card__foot { grid-area: foot; }
}

.card {
  --accent: var(--cyan);
  position: relative;
  border-radius: var(--radius);
  background:
    linear-gradient(158deg, rgba(34, 211, 238, 0.05), transparent 46%),
    var(--card);
  border: 1px solid rgba(143, 163, 191, 0.14);
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease),
    box-shadow 0.22s var(--ease), background-color 0.22s var(--ease);
  animation: rise 0.5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.card[data-accent="gold"] { --accent: var(--gold); }
.card[data-accent="green"] { --accent: var(--green); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.card > a, .card__body {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  padding: 18px 18px 15px;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius);
}

.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  box-shadow: 0 16px 36px -18px rgba(0, 0, 0, 0.75),
    0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent) inset;
}

.card > a:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.75);
  outline-offset: 2px;
}
.card:focus-within {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

/* 可选预览图：配置里给 image 时铺在卡片顶部 */
.card__media {
  margin: -18px -18px 14px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 13px 13px 0 0;
  background: #0F1A2B;
  border-bottom: 1px solid rgba(143, 163, 191, 0.12);
}
.card__media img { display: block; width: 100%; height: 100%; object-fit: cover; }

.card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card__icon {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  flex: none;
  border-radius: 10px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  transition: background-color 0.22s var(--ease), border-color 0.22s var(--ease);
}
.card:hover .card__icon {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.card__title {
  margin: 0 0 7px;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: 0.01em;
}

.card__desc {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tag {
  padding: 2px 8px;
  font-size: 11.5px;
  color: rgba(143, 163, 191, 0.9);
  background: rgba(143, 163, 191, 0.08);
  border: 1px solid rgba(143, 163, 191, 0.1);
  border-radius: 5px;
  white-space: nowrap;
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(143, 163, 191, 0.1);
  font-size: 11.5px;
  color: rgba(143, 163, 191, 0.72);
  font-variant-numeric: tabular-nums;
}

.card__marks { display: inline-flex; align-items: center; gap: 10px; }

.mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(245, 184, 76, 0.85);
}
.mark svg { opacity: 0.9; }

/* 悬停/键盘聚焦时出现「打开」提示，强化整块可点 */
.card__go {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--cyan);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.card:hover .card__go,
.card:focus-within .card__go { opacity: 1; transform: none; }

@media (hover: none) {
  .card__go { opacity: 0.72; transform: none; }
}

/* 状态 */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 3px 9px;
  font-size: 11.5px;
  line-height: 1.5;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill--online { color: var(--green); background: rgba(52, 211, 153, 0.08); border-color: rgba(52, 211, 153, 0.26); }
.pill--updating { color: var(--gold); background: rgba(245, 184, 76, 0.09); border-color: rgba(245, 184, 76, 0.28); }
.pill--soon { color: rgba(143, 163, 191, 0.85); background: rgba(143, 163, 191, 0.07); border-color: rgba(143, 163, 191, 0.18); }

.pill__dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill--updating .pill__dot { animation: breathe 2.6s ease-in-out infinite; }

@keyframes breathe {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(245, 184, 76, 0.36); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(245, 184, 76, 0); }
}

/* 即将上线 */
.card--soon {
  background: linear-gradient(158deg, rgba(143, 163, 191, 0.04), transparent 46%), #131E31;
  border-style: dashed;
  border-color: rgba(143, 163, 191, 0.18);
}
.card--soon:hover { transform: none; box-shadow: none; border-color: rgba(143, 163, 191, 0.26); }
.card--soon .card__icon { color: rgba(143, 163, 191, 0.62); background: rgba(143, 163, 191, 0.07); border-color: rgba(143, 163, 191, 0.16); }
.card--soon .card__title { color: #B9C9DC; }
.card--soon .card__desc { color: rgba(143, 163, 191, 0.78); }
.card--soon .card__foot { color: rgba(143, 163, 191, 0.6); }

.is-hidden { display: none !important; }

.empty {
  margin: 8px 0 48px;
  padding: 36px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  border: 1px dashed rgba(143, 163, 191, 0.2);
  border-radius: var(--radius);
}
.empty span { display: block; margin-top: 6px; font-size: 12.5px; color: rgba(143, 163, 191, 0.6); }

/* ---------- 页脚 ---------- */

.foot {
  margin-top: auto;
  padding: 22px 0 34px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: rgba(143, 163, 191, 0.78);
}

.foot__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.foot__meta { white-space: nowrap; }
.foot__sep { width: 1px; height: 12px; background: rgba(143, 163, 191, 0.24); }

.foot__sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  font-size: 11px;
  color: rgba(143, 163, 191, 0.42);
  flex-wrap: wrap;
}
.foot__hint { letter-spacing: 0.01em; }

.foot__right { display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.foot__lock {
  padding: 0;
  border: 0;
  background: none;
  color: rgba(143, 163, 191, 0.6);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  transition: color 0.2s var(--ease);
}
.foot__lock:hover { color: var(--text); }
.foot__lock:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.7);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---------- 访问密码门 ---------- */

.gate {
  display: none;
  min-height: 100vh;
  padding: 40px 20px;
  place-items: center;
}

html.auth-locked .page { display: none; }
html.auth-locked .gate { display: grid; }
html.auth-ok .gate { display: none; }

.gate__panel {
  width: 100%;
  max-width: 430px;
  padding: 30px 28px 24px;
  background:
    radial-gradient(420px 180px at 50% -10%, rgba(34, 211, 238, 0.1), transparent 70%),
    linear-gradient(180deg, rgba(22, 35, 58, 0.94), rgba(17, 26, 43, 0.94));
  border: 1px solid rgba(143, 163, 191, 0.18);
  border-radius: 18px;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.42);
}

.gate__brand { margin-bottom: 24px; }
.gate__mark { width: 44px; height: 44px; border-radius: 12px; }

.gate__title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.gate__desc { margin: 0 0 22px; font-size: 13px; color: var(--muted); }

.gate__form { display: flex; flex-wrap: wrap; gap: 10px; }

.gate__field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 208px;
  min-width: 0;
}

.gate__icon {
  position: absolute;
  left: 13px;
  display: grid;
  place-items: center;
  color: rgba(143, 163, 191, 0.68);
  pointer-events: none;
}

.gate__input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 41px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  background: rgba(11, 18, 32, 0.72);
  border: 1px solid rgba(143, 163, 191, 0.2);
  border-radius: 10px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.gate__input::placeholder { color: rgba(143, 163, 191, 0.55); }
.gate__input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.14);
}

.gate__btn {
  flex: 0 0 auto;
  height: 46px;
  padding: 0 24px;
  color: #DFF9FF;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.24), rgba(34, 211, 238, 0.1));
  border: 1px solid rgba(34, 211, 238, 0.45);
  border-radius: 10px;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.gate__btn:hover {
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.32), rgba(34, 211, 238, 0.14));
  border-color: rgba(34, 211, 238, 0.68);
  box-shadow: 0 8px 20px rgba(34, 211, 238, 0.16);
}
.gate__btn:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.75);
  outline-offset: 2px;
}
.gate__btn:active { transform: translateY(1px); }

.gate__error {
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--gold);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.gate__error.is-on { opacity: 1; }

.gate__foot {
  margin: 14px 0 0;
  padding-top: 14px;
  font-size: 11.5px;
  color: rgba(143, 163, 191, 0.5);
  border-top: 1px solid rgba(143, 163, 191, 0.1);
}

@keyframes gateShake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-5px); }
  46% { transform: translateX(4px); }
  70% { transform: translateX(-3px); }
  88% { transform: translateX(2px); }
}
.gate__panel.is-shake { animation: gateShake 0.32s var(--ease); }

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .page { padding: 0 24px; }
  .hero { padding-top: 32px; }
  .hero__main { padding: 36px 0 24px; }
  .toolbar { align-items: stretch; }
  .search { max-width: none; flex-basis: 100%; }
  .stats { justify-content: flex-start; }
  .group__desc { display: none; }
}

@media (max-width: 640px) {
  .page { padding: 0 18px; }
  .cards { grid-template-columns: 1fr; gap: 12px; }
  .hero__title { font-size: 30px; }
  .hero__tagline { font-size: 13.5px; }
  .brand__sub { font-size: 11.5px; }
  .hero__stamp { display: none; }
  .group { margin-bottom: 30px; }
  .search__kbd { display: none; }
  .card__title { font-size: 15px; }
  .foot__sub { gap: 6px; }
  .gate { padding: 24px 16px; }
  .gate__panel { padding: 26px 20px 20px; border-radius: 16px; }
  .gate__title { font-size: 18px; }
  .gate__btn { flex: 1 1 100%; }
}

/* 16:9 投屏 */
@media (min-width: 1440px) and (min-height: 800px) {
  .page { max-width: 1240px; padding: 0 44px; }
  .hero__main { padding: 52px 0 34px; }
}

/* 低高度横屏（如 1366×768 笔记本）节奏更紧凑 */
@media (max-height: 780px) and (min-width: 900px) {
  .hero__main { padding: 34px 0 24px; }
  .hero { padding-top: 30px; }
  .toolbar { padding-bottom: 20px; }
  .main { padding-top: 22px; }
}

/* ---------- 无障碍 ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (prefers-contrast: more) {
  :root { --muted: #AFC2D8; }
  .card { border-color: rgba(143, 163, 191, 0.32); }
}
