/* 网址导航 · 单一轻量样式表，无外部依赖 */
:root {
    --bg: #f5f6fa;
    --panel: #ffffff;
    --line: #e9ecf3;
    --text: #242730;
    --muted: #8b91a1;
    --purple: #7b2ff7;
    --pink: #e623a6;
    --radius: 10px;
    --shadow: 0 2px 10px rgba(24, 32, 56, .045);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

.app { display: flex; min-height: 100vh; }

/* ---------- 左侧分类栏 ---------- */
.sidebar {
    position: sticky;
    top: 0;
    flex: 0 0 148px;
    width: 148px;
    height: 100vh;
    background: var(--panel);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
}

.logo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 64px;
    margin: 16px 14px 8px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7b2ff7 0%, #b52ce0 52%, #f02a9a 100%);
    box-shadow: 0 6px 16px rgba(174, 45, 194, .22);
    color: #fff;
    font-size: 31px;
    font-weight: 800;
    letter-spacing: -2.5px;
    flex: none;
}
.logo i {
    position: absolute;
    right: 16px;
    top: 15px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
}

.side-nav { padding: 10px 8px; flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 8px 10px;
    margin-bottom: 2px;
    border-radius: 8px;
    color: #646b7c;
    font-size: 13px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: #f6f3fd; color: var(--purple); }
.nav-item.active { background: #f2ecfd; color: var(--purple); font-weight: 600; }
.nav-ico { width: 17px; text-align: center; font-size: 14px; }
.nav-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-foot { padding: 12px 8px 18px; border-top: 1px solid var(--line); }
.foot-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 8px;
    color: #858b9a;
    font-size: 12px;
}
.foot-link:hover { background: #f6f3fd; color: var(--purple); }

/* ---------- 主内容 ---------- */
.main { flex: 1; min-width: 0; padding: 18px 24px 44px; max-width: 1680px; }

.hero {
    position: relative;
    height: 150px;
    border-radius: 12px;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 82% 22%, rgba(255, 103, 158, .55), transparent 42%),
        radial-gradient(ellipse at 63% 78%, rgba(255, 150, 90, .35), transparent 42%),
        linear-gradient(110deg, #1a1130 0%, #36133e 40%, #821b58 100%);
}
.hero::after {
    content: "";
    position: absolute;
    right: -8%;
    top: -70%;
    width: 62%;
    height: 240%;
    background: repeating-linear-gradient(118deg, rgba(255, 255, 255, 0) 0 15px, rgba(255, 175, 205, .55) 15px 17px, rgba(255, 115, 165, 0) 17px 33px);
    transform: rotate(0deg);
    filter: blur(1.5px);
    opacity: .7;
    pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; padding: 26px 28px; color: #fff; }
.hero h1 { margin: 0 0 10px; font-size: 24px; font-weight: 700; letter-spacing: .5px; text-shadow: 0 1px 8px rgba(0, 0, 0, .2); }
.hero p { max-width: 620px; margin: 0; font-size: 12px; line-height: 1.75; color: rgba(255, 255, 255, .76); }

.search-wrap {
    position: relative;
    margin-top: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.search-wrap:focus-within { border-color: #c9a7f5; }
#searchInput {
    width: 100%;
    height: 42px;
    padding: 0 84px 0 16px;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 13px;
}
#searchInput::-webkit-search-cancel-button { display: none; }
.search-icon { position: absolute; right: 16px; top: 12px; color: #9aa0ae; line-height: 0; pointer-events: none; }
.search-clear {
    position: absolute;
    right: 42px;
    top: 9px;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: #f0f1f5;
    color: #98a0ae;
    cursor: pointer;
    line-height: 20px;
}
.search-clear:hover { background: #e8e2f8; color: var(--purple); }

.locked-tip {
    margin-top: 10px;
    padding: 9px 14px;
    border: 1px dashed #e4d3f7;
    border-radius: 8px;
    background: #fbf9ff;
    color: #7d6a99;
    font-size: 12px;
}
.locked-tip b { color: var(--purple); }
.locked-tip a { color: var(--purple); font-weight: 600; margin-left: 4px; }

.cat-section { margin-top: 22px; scroll-margin-top: 14px; }
.cat-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 11px;
    font-size: 14px;
    font-weight: 700;
}
.cat-ico { font-size: 15px; }

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

.link-card {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    min-height: 78px;
    padding: 12px 13px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: border-color .16s, box-shadow .16s, transform .16s;
}
.link-card:hover {
    border-color: #cfb2f3;
    box-shadow: 0 6px 18px rgba(103, 58, 160, .1);
    transform: translateY(-2px);
}

.site-icon {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    user-select: none;
}
.site-icon.icon-image { background: #fff; border: 1px solid #eef0f5; }
.site-icon.icon-image img { width: 100%; height: 100%; object-fit: contain; }
.card-body { min-width: 0; display: block; }
.card-title {
    display: block;
    margin-bottom: 4px;
    color: #262a33;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-desc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

.empty { padding: 60px 0; text-align: center; color: var(--muted); font-size: 14px; }
.page-foot { margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--line); color: #a2a8b5; font-size: 11px; text-align: center; line-height: 1.9; }
.page-foot .icp-line a { color: #a2a8b5; }
.page-foot .icp-line a:hover { color: var(--purple); }

/* ---------- 登录页 ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at 50% 0%, #f0e9fd, var(--bg) 60%); }
.login-card { width: 100%; max-width: 380px; padding: 32px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(60, 30, 100, .09); }
.login-logo { width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 14px; background: linear-gradient(135deg, #7b2ff7, #f02a9a); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; letter-spacing: -2px; }
.login-card h1 { margin: 0 0 6px; text-align: center; font-size: 19px; }
.login-desc { margin: 0 0 22px; text-align: center; color: var(--muted); font-size: 12px; }
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; color: #5c6272; font-size: 12px; font-weight: 600; }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dfe3ec;
    border-radius: 8px;
    outline: 0;
    background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #b78ff0; box-shadow: 0 0 0 3px rgba(123, 47, 247, .08); }
.alert { margin-bottom: 14px; padding: 10px 12px; border-radius: 8px; font-size: 12px; }
.alert.error { background: #fff0f2; color: #c62847; border: 1px solid #ffd9df; }
.alert.ok { background: #eefaf3; color: #1d8b55; border: 1px solid #cdeedc; }
.hint { margin-top: 16px; padding: 10px 12px; border-radius: 8px; background: #f8f5ff; color: #7957a8; font-size: 12px; line-height: 1.7; }
.tip-line { margin: -2px 0 14px; color: #9aa0ae; font-size: 11px; line-height: 1.6; }

/* ---------- 后台 ---------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-head h1 { margin: 0; font-size: 19px; }
.admin-head .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.admin-links { display: flex; gap: 8px; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    min-height: 34px; padding: 7px 14px;
    border: 1px solid #dfe3ec; border-radius: 8px;
    background: #fff; color: #4b5160; cursor: pointer; font-size: 12px;
}
.btn:hover { border-color: #c6a7ee; color: var(--purple); }
.btn.primary { background: linear-gradient(135deg, #7b2ff7, #a83bdd); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.05); color: #fff; }
.btn.danger { color: #d4455c; }
.btn.small { min-height: 27px; padding: 4px 9px; font-size: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 10px 16px; color: #777e8e; font-size: 13px; white-space: nowrap; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--purple); }
.tab.active { color: var(--purple); font-weight: 700; border-bottom-color: var(--purple); }

.panel { padding: 18px; margin-bottom: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 14px; font-size: 14px; }
.panel h3 { margin: 20px 0 10px; font-size: 13px; color: #5c6272; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.form-grid .field { margin-bottom: 0; }
.form-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.checkline { display: inline-flex; align-items: center; gap: 7px; color: #5c6272; font-size: 12px; cursor: pointer; }
.checkline input { width: 15px; height: 15px; accent-color: var(--purple); }

.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .field { margin-bottom: 0; min-width: 170px; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th, table.data td { padding: 10px 10px; text-align: left; border-bottom: 1px solid #eef0f5; vertical-align: middle; }
table.data th { background: #fafbfd; color: #7c8291; font-weight: 600; white-space: nowrap; }
table.data tr:hover td { background: #fcfbff; }
table.data td.actions { white-space: nowrap; }
table.data .url-cell { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #7b8191; }
.tag { display: inline-block; padding: 2px 7px; border-radius: 5px; background: #f1ecfb; color: #7b45bd; font-size: 11px; }
.tag.gray { background: #f0f1f5; color: #828899; }
.count-note { color: var(--muted); font-size: 12px; }

.import-textarea { width: 100%; min-height: 170px; resize: vertical; padding: 12px; border: 1px solid #dfe3ec; border-radius: 8px; outline: 0; font: 12px/1.7 ui-monospace, Consolas, monospace; }
.import-textarea:focus { border-color: #b78ff0; }
.format-note { margin: 10px 0 0; color: #8b91a1; font-size: 11px; line-height: 1.8; }
.format-note code { padding: 1px 5px; background: #f4f2f9; border-radius: 4px; color: #7048a8; }

@media (max-width: 900px) {
    .sidebar { flex-basis: 116px; width: 116px; }
    .logo { margin-left: 10px; margin-right: 10px; }
    .main { padding: 14px 16px 36px; }
    .cards { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

@media (max-width: 640px) {
    .sidebar { flex-basis: 58px; width: 58px; }
    .logo { height: 48px; margin: 10px 7px; font-size: 23px; }
    .logo i { right: 10px; top: 10px; width: 6px; height: 6px; }
    .nav-item { justify-content: center; padding: 9px 4px; }
    .nav-text, .foot-link span:last-child { display: none; }
    .foot-link { justify-content: center; }
    .main { padding: 10px 11px 28px; }
    .hero { height: 126px; }
    .hero-inner { padding: 20px 18px; }
    .hero h1 { font-size: 19px; }
    .hero p { font-size: 11px; }
    .cards { grid-template-columns: 1fr; }
}
