/* AINAV — 导航站样式 */
:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #8a94a6;
  --line: #e5e9f0;
  --brand: #3b6ef6;
  --brand-dark: #2c56cf;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
.wrap { max-width: 1360px; margin: 0 auto; padding: 0 20px; }

/* 顶栏 */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 24px; padding: 12px 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-badge {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #7a4df8);
  color: #fff; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; }
.brand-text em { font-style: normal; color: var(--muted); font-size: 12px; }

.search { display: flex; gap: 8px; margin-left: auto; min-width: min(420px, 100%); }
.search select {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 8px;
  background: #fff; color: var(--text); font-size: 14px; cursor: pointer;
}
.search input {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px;
  font-size: 14px; outline: none; background: #fff; color: var(--text);
}
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,110,246,.15); }
.search button {
  border: 0; border-radius: 10px; padding: 9px 18px;
  background: var(--brand); color: #fff; font-size: 14px; cursor: pointer;
}
.search button:hover { background: var(--brand-dark); }

/* 布局 */
.layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; padding: 24px 20px 40px; align-items: start; }
.cat-list {
  position: sticky; top: 76px; display: flex; flex-direction: column; gap: 8px;
  font-size: 14px;
}
/* N 级分类树 */
.catnode { min-width: 0; }
.catnode-children { margin-left: 15px; border-left: 1px dashed var(--line); padding-left: 6px; }
.catnode-children .catnode-children { margin-left: 13px; }
.catrow { display: flex; align-items: center; gap: 2px; }
.catrow .chip { flex: 1; min-width: 0; padding: 6px 10px; }
.catrow .chip span { margin-left: auto; }
.caret {
  flex: none; width: 18px; height: 18px; margin: 0; padding: 0;
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; border-radius: 6px;
}
.caret::before { content: "\25B8"; font-size: 11px; transition: transform .15s ease; }
.catnode.collapsed > .catnode-children { display: none; }
.catnode:not(.collapsed) > .catrow .caret::before { transform: rotate(90deg); }
.caret.none { cursor: default; }
.caret.none::before { content: "\00B7"; }
.catrow.active .chip { background: var(--brand); color: #fff; }
.catrow.active .chip span { color: rgba(255,255,255,.8); }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 2px 0 14px; flex-wrap: wrap; }
.breadcrumb a { color: var(--brand); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .crumb-sep { color: #c3cad6; }
/* 多级内容标题层级 */
.subgroup { margin: 0 0 6px; }
.subgroup .sub-title { font-size: 15px; color: #374151; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.subgroup .sub-title::before { content: "\251C"; color: var(--muted); font-weight: 400; font-size: 13px; }
.subgroup.lvl2 .sub-title { font-size: 14px; margin-left: 10px; }
.subgroup.lvl3 .sub-title { font-size: 13.5px; margin-left: 20px; }
.subgroup.lvl4 .sub-title { font-size: 13px; margin-left: 30px; }
.chip {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid transparent; background: transparent; cursor: pointer;
  padding: 9px 14px; border-radius: 10px; font-size: 14px; color: var(--text); text-align: left;
}
.chip span { color: var(--muted); font-size: 12px; }
.chip:hover { background: #fff; border-color: var(--line); }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip.active span { color: rgba(255,255,255,.8); }

/* 内容分组 */
.group { margin-bottom: 30px; }
.group-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; margin: 8px 0 6px;
}
.group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sub-title { font-size: 15px; color: #374151; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.sub-title::before { content: "├"; color: var(--muted); font-weight: 400; font-size: 13px; }
.group-count {
  font-size: 12px; color: var(--muted); background: #eef1f6;
  border-radius: 999px; padding: 1px 9px;
}

/* 卡片 */
.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.card {
  display: flex; gap: 10px; padding: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: inherit;
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
  min-width: 0;
}
.card:hover { box-shadow: 0 8px 24px rgba(31,41,55,.08); border-color: #d7dde8; transform: translateY(-2px); }
.card-ico {
  position: relative; width: 36px; height: 36px; flex: none;
  border-radius: 9px; background: #f0f3f9; overflow: hidden;
}
.ico-img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.ico-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--brand); background: #e6ecfc; }
.card-body { min-width: 0; }
.card-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-desc {
  font-size: 12px; color: var(--muted); margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  height: 30px;
}
.card-host { font-size: 11px; color: #aab3c2; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.search-info { color: var(--muted); font-size: 14px; margin: 4px 0 14px; }
.search-info.empty { color: var(--muted); }
.empty-state { color: var(--muted); padding: 60px 0; text-align: center; }

/* 页脚 */
.site-footer { border-top: 1px solid var(--line); padding: 18px 0 26px; color: var(--muted); font-size: 13px; text-align: center; }

/* 管理后台 */
.admin-body { background: #eef1f6; }
.admin-wrap { max-width: 1240px; margin: 0 auto; padding: 26px 20px 60px; }
.admin-layout { display: grid; grid-template-columns: 270px 1fr; gap: 20px; align-items: start; margin-top: 4px; }
.admin-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
.side-block { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.side-title { font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.admin-tree .chip { font-size: 13px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a { font-size: 13px; color: var(--text); text-decoration: none; padding: 6px 8px; border-radius: 8px; }
.side-nav a:hover { background: #f0f3f9; color: var(--brand); }
.admin-main { min-width: 0; }
.admin-overview { font-size: 13px; margin: 2px 0 14px; }
.admin-section { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; scroll-margin-top: 16px; }
.admin-section h2 { margin: 0 0 14px; font-size: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.admin-section h3 { margin: 18px 0 8px; font-size: 14px; }
.admin-section code { background: #f4f6fa; border-radius: 6px; padding: 1px 5px; font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.key-form { display: flex; gap: 10px; margin: 12px 0 4px; }
.key-form input { flex: 1; max-width: 420px; margin-top: 0; }
.key-form .btn { width: auto; }
.api-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.api-table th, .api-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.api-table th { background: #f7f9fc; color: #4b5563; }
.keybox { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; background: #f4f6fa; padding: 2px 6px; border-radius: 6px; }
.btn-mini { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 3px 10px; cursor: pointer; font-size: 12px; }
.btn-mini:hover { background: #fdecec; border-color: #f6caca; color: #b3261e; }
.inline { display: inline; }
.muted { color: var(--muted); font-size: 13px; }
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { position: static; }
}
.admin-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.admin-header h1 { font-size: 20px; margin: 0; }
.admin-header nav { display: flex; gap: 16px; align-items: center; font-size: 14px; }
.admin-header nav a { color: var(--brand); text-decoration: none; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.admin-card h2 { margin: 0 0 14px; font-size: 16px; }
.admin-card label { display: block; font-size: 13px; color: #4b5563; margin-bottom: 12px; }
.admin-card input, .admin-card select, .admin-card textarea {
  width: 100%; margin-top: 5px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 9px; font-size: 14px;
  font-family: inherit; background: #fff; color: var(--text);
}
.admin-card input:focus, .admin-card select:focus, .admin-card textarea:focus { outline: none; border-color: var(--brand); }
.btn {
  border: 0; border-radius: 9px; padding: 10px 18px; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 14px; width: 100%;
}
.btn:hover { background: var(--brand-dark); }
.banner { max-width: 960px; margin: 0 auto 14px; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.banner.ok { background: #e6f7ee; color: #16794b; border: 1px solid #bfe8d2; }
.banner.error { background: #fdecec; color: #b3261e; border: 1px solid #f6caca; }
.banner.ok { max-width: 960px; }
.admin-note { color: var(--muted); font-size: 13px; margin-top: 18px; }

/* 登录页 */
.login-card {
  max-width: 360px; margin: 12vh auto 0; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 26px;
  box-shadow: 0 10px 40px rgba(31,41,55,.06);
}
.login-card h1 { font-size: 18px; margin: 0 0 18px; }
.login-card label { display: block; font-size: 13px; color: #4b5563; margin-bottom: 14px; }
.login-card input { width: 100%; margin-top: 5px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; }
.login-card input:focus { outline: none; border-color: var(--brand); }

/* 移动端 */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding-top: 16px; }
  .cat-list {
    position: static; flex-direction: row; overflow-x: auto; padding-bottom: 6px;
    gap: 8px; scrollbar-width: none;
  }
  .cat-list::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; background: #fff; border-color: var(--line); }
  .admin-grid { grid-template-columns: 1fr; }
  .search { width: 100%; margin-left: 0; }
}
