/* 知识内容管理后台 — 浅色蓝紫主题 */
:root {
    --bg: #F7F8FE;
    --bg-2: #F1F3FD;
    --panel: #FFFFFF;
    --panel-2: #F1F3FD;
    --line: #E4E7F6;
    --line-strong: #C9D0F2;
    --text: #232A47;
    --text-2: #5E6685;
    --text-3: #8A90A8;
    --sky: #5F6FE8;
    --lav: #928BE9;
    --green: #2F9E6F;
    --orange: #C98A1B;
    --red: #D9534F;
    --radius: 16px;
    --shadow: 0 2px 6px rgba(124, 100, 224, .08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background:
        radial-gradient(900px 420px at 12% -8%, rgba(136, 173, 239, .14), transparent 62%),
        radial-gradient(820px 400px at 92% -10%, rgba(146, 139, 233, .12), transparent 62%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
}

a { color: var(--sky); }

/* ===== 顶栏 ===== */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, .9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar .back {
    color: var(--text-2);
    text-decoration: none;
    font-size: 13px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    white-space: nowrap;
}
.topbar .back:hover { color: var(--sky); border-color: var(--line-strong); }

.topbar h1 { font-size: 17px; font-weight: 700; letter-spacing: 0; color: var(--text); }

.topbar .spacer { flex: 1; }

.topbar .who { color: var(--text-3); font-size: 12px; }

/* ===== 布局 ===== */
.wrap { padding: 18px 24px 40px; max-width: 1600px; margin: 0 auto; }

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.status {
    flex: 1;
    min-width: 240px;
    color: var(--text-2);
    font-size: 12.5px;
    line-height: 1.5;
}
.status b { color: var(--text); font-weight: 600; }
.status .warn { color: var(--orange); }
.status .ok { color: var(--green); }

button, .filebtn {
    font-family: inherit;
    font-size: 13px;
    color: var(--text-2);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 8px 14px;
    cursor: pointer;
    transition: all .18s ease;
    white-space: nowrap;
    box-shadow: none;
}
button:hover, .filebtn:hover { color: var(--sky); border-color: var(--line-strong); background: var(--bg-2); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary {
    background: var(--sky);
    color: #fff;
    border: 1px solid var(--sky);
    font-weight: 600;
}
button.primary:hover { background: #4E5EDB; border-color: #4E5EDB; }
button.danger { color: var(--red); border-color: #F0C9C7; background: #FDF0F0; }
button.small { padding: 5px 10px; font-size: 12px; border-radius: 7px; }

.filebtn { position: relative; overflow: hidden; display: inline-block; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ===== 标签页 ===== */
.tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 16px;
}
.tabs button {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--text-3);
    padding: 10px 18px;
    font-size: 14px;
    box-shadow: none;
}
.tabs button:hover { background: rgba(95, 111, 232, .06); color: var(--text-2); }
.tabs button.active { color: var(--sky); border-bottom-color: var(--sky); }
.tabs .dirty-dot { color: var(--orange); margin-left: 4px; }

/* ===== 工作区 ===== */
.workspace {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 16px;
    align-items: start;
}

.pane {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.list-pane { position: sticky; top: 76px; }

.list-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}
.list-head input {
    flex: 1;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
    min-width: 0;
}
.list-head input::placeholder { color: var(--text-3); }
.list-head input:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(95, 111, 232, .12); }

.list-body { max-height: calc(100vh - 220px); overflow-y: auto; padding: 6px; }

.group-label {
    color: var(--text-3);
    font-size: 11px;
    letter-spacing: 1px;
    padding: 10px 10px 6px;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 9px;
    cursor: pointer;
    color: var(--text-2);
    font-size: 13px;
}
.list-item:hover { background: var(--bg-2); color: var(--text); }
.list-item.active { background: #EEF1FE; color: var(--text); box-shadow: inset 2px 0 0 var(--sky); }
.list-item .sub { color: var(--text-3); font-size: 11px; margin-left: auto; white-space: nowrap; }
.list-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== 编辑器 ===== */
.editor { padding: 20px 22px 28px; min-height: 300px; }

.editor-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.editor-head h2 { font-size: 16px; font-weight: 700; color: var(--text); }
.editor-head .spacer { flex: 1; }

.empty {
    color: var(--text-3);
    text-align: center;
    padding: 70px 20px;
    line-height: 1.9;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px 18px;
    margin-bottom: 18px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field.wide { grid-column: 1 / -1; }
.field label { color: var(--text-2); font-size: 12px; }
.field input, .field select, .field textarea {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    padding: 9px 11px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--sky);
    box-shadow: 0 0 0 3px rgba(95, 111, 232, .12);
}
.field textarea { resize: vertical; min-height: 64px; line-height: 1.6; }
.field .hint { color: var(--text-3); font-size: 11px; }

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 22px 0 12px;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.spec-table { width: 100%; border-collapse: collapse; }
.spec-table th {
    text-align: left;
    color: var(--text-3);
    font-weight: 500;
    font-size: 12px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-2);
}
.spec-table td { padding: 6px 8px; border-bottom: 1px solid #F0F2FA; vertical-align: top; }
.spec-table td.k { color: var(--text-2); width: 34%; font-size: 12.5px; }
.spec-table input, .spec-table textarea {
    width: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    padding: 7px 9px;
    font-size: 12.5px;
    font-family: inherit;
    outline: none;
}
.spec-table input:focus, .spec-table textarea:focus {
    border-color: var(--sky);
    box-shadow: 0 0 0 3px rgba(95, 111, 232, .10);
}

.actions-list { display: flex; flex-direction: column; gap: 10px; }
.action-row {
    display: grid;
    grid-template-columns: 1.1fr 2fr .8fr .9fr auto;
    gap: 8px;
    align-items: center;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px;
}
.action-row input {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    padding: 7px 9px;
    font-size: 12px;
    outline: none;
    width: 100%;
}
.action-row input:focus { border-color: var(--sky); }

/* ===== 弹窗 ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(35, 42, 71, .30);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal.show { display: flex; }
.modal-box {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    width: min(760px, 100%);
    max-height: 84vh;
    overflow: auto;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(35, 42, 71, .16);
}
.modal-box h3 { font-size: 16px; margin-bottom: 14px; color: var(--text); }
.modal-box .close { float: right; }

.hist-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 8px;
    color: var(--text-2);
    font-size: 12.5px;
}
.hist-row .v { color: var(--sky); font-weight: 600; }
.hist-row .spacer { flex: 1; }

/* ===== Toast ===== */
#toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
    padding: 11px 22px;
    border-radius: 11px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: all .25s ease;
    z-index: 200;
    max-width: 80vw;
    box-shadow: 0 8px 24px rgba(124, 100, 224, .12);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { border-color: #F0C9C7; color: var(--red); }
#toast.ok { border-color: #CBEBDD; color: var(--green); }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
    .wrap { padding: 12px 12px 30px; }
    .workspace { grid-template-columns: 1fr; }
    .list-pane { position: static; }
    .list-body { max-height: 240px; }
    .action-row { grid-template-columns: 1fr 1fr; }
    .topbar { padding: 10px 12px; gap: 10px; }
    .topbar h1 { font-size: 15px; }
    .topbar .who { display: none; }
    .status { min-width: 100%; order: -1; }
    .tabs { overflow-x: auto; }
    .tabs button { padding: 9px 14px; white-space: nowrap; }
}
