/* ==========================================================
   刘森工作导航台 — 前台样式
   ========================================================== */

:root {
  --bg: #f4f6fb;
  --bg-soft: #eef2f9;
  --panel: #ffffff;
  --panel-hover: #ffffff;
  --text: #1b2438;
  --text-soft: #43506b;
  --muted: #7d8ba3;
  --line: #e5eaf3;
  --line-strong: #d5ddea;
  --brand: #2563eb;
  --brand-2: #12b3a8;
  --shadow-sm: 0 1px 2px rgba(20, 35, 70, .04);
  --shadow-md: 0 8px 26px rgba(20, 35, 70, .08);
  --shadow-lg: 0 18px 44px rgba(20, 35, 70, .14);
  --radius: 14px;
  --radius-sm: 10px;
}

html[data-theme="dark"] {
  --bg: #0e131d;
  --bg-soft: #141a26;
  --panel: #171e2b;
  --panel-hover: #1b2434;
  --text: #e8edf7;
  --text-soft: #c2cbdb;
  --muted: #8f9cb2;
  --line: #232c3c;
  --line-strong: #2d384b;
  --brand: #5b8cff;
  --brand-2: #2dd4bf;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 8px 26px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 19px;
  background: linear-gradient(135deg, #2563eb, #12b3a8);
  box-shadow: 0 6px 18px rgba(37, 99, 235, .28);
  letter-spacing: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 17px; letter-spacing: .2px; }
.brand-text small { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.search-wrap {
  flex: 1 1 auto;
  max-width: 620px;
  display: flex;
  align-items: stretch;
  position: relative;
  border-radius: 11px;
  transition: box-shadow .18s;
}
.search-wrap:focus-within {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

.engine-select {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 26px 0 13px;
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: 11px 0 0 11px;
  background-color: var(--bg-soft);
  color: var(--text-soft);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%), linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  transition: .18s;
}
.engine-select:hover { color: var(--text); }
.engine-select:focus { border-color: var(--brand); color: var(--text); }

.search-input {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
  font-size: 17px;
  pointer-events: none;
  z-index: 1;
}

#search {
  width: 100%;
  height: 40px;
  padding: 0 38px 0 34px;
  border-radius: 0 11px 11px 0;
  border: 1px solid var(--line-strong);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .18s, background .18s;
  -webkit-appearance: none;
  appearance: none;
}

#search::placeholder { color: var(--muted); opacity: .85; }

#search:focus {
  border-color: var(--brand);
  background: var(--panel);
}

.search-clear {
  position: absolute;
  right: 8px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: none;
  font-size: 13px;
}
.search-clear:hover { background: var(--bg-soft); color: var(--text); }

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
  transition: .18s;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--text); transform: translateY(-1px); }

.admin-link {
  height: 38px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-soft);
  font-size: 13.5px;
  display: grid;
  place-items: center;
  transition: .18s;
}
.admin-link:hover { border-color: var(--brand); color: var(--brand); }

/* ---------------- 公告 ---------------- */
.notice-bar {
  max-width: 1240px;
  margin: 14px auto 0;
  padding: 10px 18px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 8%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
  color: var(--text-soft);
  font-size: 13.5px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.notice-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand);
  margin-top: 7px;
  flex: 0 0 auto;
}

/* ---------------- 主体 ---------------- */
.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 24px 40px;
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 84px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: var(--shadow-sm);
}

.sidebar-title {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .4px;
  padding: 0 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.count-pill {
  font-style: normal;
  background: var(--bg-soft);
  color: var(--text-soft);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11.5px;
}

.cat-nav { display: flex; flex-direction: column; gap: 2px; }

.cat-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--text-soft);
  font-size: 13.5px;
  transition: .16s;
  border-left: 3px solid transparent;
}
.cat-nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-nav-item em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--bg-soft);
  border-radius: 20px;
  padding: 0 7px;
  flex: 0 0 auto;
}
.cat-nav-item:hover { background: var(--bg-soft); color: var(--text); }
.cat-nav-item.is-active {
  background: color-mix(in srgb, var(--brand) 9%, var(--panel));
  color: var(--brand);
  border-left-color: var(--brand);
  font-weight: 600;
}
.cat-nav-item.is-active em { background: color-mix(in srgb, var(--brand) 14%, var(--panel)); color: var(--brand); }

.sidebar-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.sf-row { display: flex; justify-content: space-between; gap: 8px; }
.sf-row b { color: var(--text-soft); font-weight: 500; text-align: right; word-break: break-all; }

/* ---------------- 分组 ---------------- */
.content { min-width: 0; display: flex; flex-direction: column; gap: 30px; }

.group { scroll-margin-top: 92px; }

.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
}

.group-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 9px;
  letter-spacing: .2px;
  white-space: nowrap;
}

.group-icon {
  width: 28px; height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}
.group-icon-img { width: 20px; height: 20px; border-radius: 5px; object-fit: cover; }

.group-line { flex: 1 1 auto; height: 1px; background: var(--line); }

.group-count {
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 9px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
  position: relative;
  overflow: hidden;
  min-height: 66px;
}

.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--brand) 30%, var(--line));
  box-shadow: var(--shadow-md);
  background: var(--panel-hover);
}

.card:active { transform: translateY(-1px); }

.card-icon {
  width: 38px; height: 38px;
  flex: 0 0 auto;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 650;
  overflow: hidden;
  background: var(--bg-soft);
  color: var(--text-soft);
  line-height: 1;
}
.card-icon img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }

.card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-name .go {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  opacity: 0;
  transform: translate(-3px, 2px);
  transition: .18s;
}
.card:hover .card-name .go { opacity: 1; transform: translate(0, 0); color: var(--brand); }

.card-desc {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- 空状态 ---------------- */
.empty-state {
  display: none;
  text-align: center;
  padding: 70px 20px;
  background: var(--panel);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.empty-state.show { display: block; }
.empty-emoji { font-size: 34px; margin-bottom: 8px; }
.empty-state p { margin: 0 0 4px; font-weight: 600; }
.empty-state span { color: var(--muted); font-size: 13px; }

/* ---------------- 页脚 ---------------- */
.footer {
  border-top: 1px solid var(--line);
  background: var(--panel);
  margin-top: 10px;
}
.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 24px 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
}
.footer-right { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.footer-right a { color: var(--text-soft); }
.footer-right a:hover { color: var(--brand); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; gap: 22px; }
  .sidebar {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
  }
  .sidebar-title { width: 100%; padding: 2px 6px 6px; }
  .cat-nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .cat-nav-item { border-left: 0; border: 1px solid var(--line); border-radius: 20px; padding: 6px 12px; }
  .cat-nav-item.is-active { border-color: var(--brand); }
  .sidebar-foot { display: none; }
  .brand-text small { display: none; }
}

@media (max-width: 720px) {
  .topbar-inner { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .brand-text { display: none; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .search-wrap #search { height: 38px; }
  .engine-select { height: 38px; padding: 0 22px 0 10px; font-size: 12px; }
  .layout { padding: 16px 14px 30px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
  .card { min-height: 62px; padding: 11px 12px; gap: 9px; }
  .card-icon { width: 34px; height: 34px; font-size: 14px; }
  .footer-inner { padding: 16px 14px 22px; flex-direction: column; align-items: flex-start; }
  .group-head h2 { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
