* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f6fa;
    color: #1f2330;
    line-height: 1.5;
}
a { color: #2a64ff; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: #1f2330;
    color: #fff;
}
.topbar .brand { font-weight: 700; font-size: 18px; letter-spacing: 1px; }
.topbar nav { display: flex; gap: 16px; align-items: center; }
.topbar nav a { color: #cfd6e4; }
.topbar nav a:hover { color: #fff; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: #2a64ff;
    color: #fff;
    font-size: 12px;
}

.container { max-width: 960px; margin: 24px auto; padding: 0 16px; }

.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(20, 30, 60, 0.06);
    padding: 24px;
    margin-bottom: 16px;
}
.card h2 { margin-top: 0; }

.auth-card {
    max-width: 380px;
    margin: 80px auto;
}
.auth-card h1 { margin: 0 0 8px; font-size: 22px; }
.auth-card h2 { margin: 0 0 16px; font-size: 16px; color: #6b7280; font-weight: 500; }

.auth-card form { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
input[type=text], input[type=password], input[type=email] {
    border: 1px solid #d2d6e0;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 14px;
}
input:focus { outline: none; border-color: #2a64ff; box-shadow: 0 0 0 2px rgba(42,100,255,0.15); }

button {
    background: #2a64ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
}
button:hover { background: #1a4fde; }

.error {
    background: #ffeaea;
    color: #b3261e;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 0 0 12px;
    font-size: 14px;
}
.success {
    background: #dcfce7;
    color: #166534;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 0 0 12px;
    font-size: 14px;
}
.hint { color: #6b7280; font-size: 13px; margin: 0 0 12px; }

/* ===== top nav ===== */
.topbar .brand { color: #fff; text-decoration: none; }
.topbar .brand:hover { text-decoration: none; }
.topbar .topnav { flex: 1; margin-left: 24px; gap: 8px; }
.topbar .topnav a {
    padding: 6px 12px;
    border-radius: 6px;
    color: #cfd6e4;
}
.topbar .topnav a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.topbar .topnav a.active { background: rgba(255,255,255,0.15); color: #fff; }
.topbar .usernav { gap: 12px; }

/* ===== admin layout ===== */
.admin-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: calc(100vh - 56px);
}
.sidebar {
    background: #fff;
    border-right: 1px solid #e5e7eb;
    padding: 16px 0;
}
.sidebar-title {
    padding: 0 20px 8px;
    font-size: 12px;
    color: #9ca3af;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.sidebar nav { display: flex; flex-direction: column; }
.sidebar nav a {
    padding: 10px 20px;
    color: #374151;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: #f3f4f6; text-decoration: none; }
.sidebar nav a.active {
    background: #eef2ff;
    color: #2a64ff;
    border-left-color: #2a64ff;
    font-weight: 500;
}
.admin-main { padding: 24px; }

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.card-head h2 { margin: 0; }

/* ===== buttons ===== */
.btn, .btn-secondary, .btn-mini {
    display: inline-block;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    border: none;
    line-height: 1.4;
}
.btn { background: #2a64ff; color: #fff; }
.btn:hover { background: #1a4fde; text-decoration: none; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; text-decoration: none; }
.btn-mini {
    padding: 4px 10px;
    font-size: 12px;
    background: #f3f4f6;
    color: #374151;
}
.btn-mini:hover { background: #e5e7eb; text-decoration: none; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; }

/* ===== tables ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    vertical-align: middle;
}
.data-table th {
    background: #f9fafb;
    color: #6b7280;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.data-table tbody tr:hover { background: #fafbff; }
.data-table .empty { text-align: center; color: #9ca3af; padding: 24px; }
.actions-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.inline { display: inline; }
.inline > * { margin-right: 4px; }
.inline select, .inline input[type=text] {
    padding: 4px 8px;
    font-size: 12px;
}

/* ===== tags / badges ===== */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: #f3f4f6;
    color: #374151;
    font-size: 12px;
}
.tag-green { background: #dcfce7; color: #166534; }
.tag-blue { background: #dbeafe; color: #1e40af; }
.muted { color: #9ca3af; font-size: 12px; }

/* ===== forms ===== */
.form-card { max-width: 520px; }
.form-wide { max-width: 760px; }
.form-card form { display: flex; flex-direction: column; gap: 14px; }
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-grid label.span2 { grid-column: span 2; }
.form-grid label, .form-card label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.form-grid label.checkbox-row .checkbox-line { display: inline-flex; align-items: center; gap: 6px; }
.form-grid label.checkbox-row .checkbox-line input[type="checkbox"] {
    width: auto; margin: 0; padding: 0; border: 0; border-radius: 0;
}
.form-grid input, .form-grid select, .form-grid textarea,
.form-card input, .form-card select, .form-card textarea {
    border: 1px solid #d2d6e0;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
}
.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}
.download-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0 4px;
}

/* ===== detail / code ===== */
.kv { display: flex; gap: 16px; padding: 8px 0; border-bottom: 1px solid #f3f4f6; }
.kv-k { width: 160px; color: #6b7280; font-size: 13px; }
.kv-v { flex: 1; font-size: 14px; }
.token {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
    word-break: break-all;
}
.codeblock {
    background: #1f2330;
    color: #e5e7eb;
    padding: 14px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.55;
}
.warning {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    padding: 10px 12px;
    border-radius: 6px;
    margin: 0 0 16px;
    font-size: 13px;
}

.token-cell { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.token-short {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}
.btn-mini.copied { background: #dcfce7; color: #166534; }

.rpc-result {
    margin-top: 16px;
    border-radius: 6px;
    padding: 12px;
    font-size: 13px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}
.rpc-result.ok { background: #f0fdf4; border-color: #bbf7d0; }
.rpc-result.err { background: #fef2f2; border-color: #fecaca; }
.rpc-result .rpc-head { font-weight: 600; margin-bottom: 8px; }
.rpc-result pre {
    margin: 0;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    background: #1f2330;
    color: #e5e7eb;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    max-height: 320px;
}

/* ===== instance grid (homepage) ===== */
.instance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.instance-card {
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 16px;
    background: #fff;
    color: inherit;
    transition: transform 0.05s, box-shadow 0.15s;
}
.instance-card:hover {
    border-color: #2a64ff;
    box-shadow: 0 4px 12px rgba(42,100,255,0.1);
    text-decoration: none;
    transform: translateY(-1px);
}
.instance-card-name { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.instance-card-meta { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-top: 4px; }

/* ===== view toggle (card/list on homepage) ===== */
.card-head-actions { display: flex; gap: 12px; align-items: center; }
.view-toggle {
    display: inline-flex;
    border: 1px solid #d2d6e0;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    color: #6b7280;
    border: none;
    border-radius: 0;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid #d2d6e0; }
.view-toggle-btn:hover { background: #f5f6fa; color: #1f2330; }
.view-toggle-btn.active { background: #2a64ff; color: #fff; }
.view-toggle-btn.active:hover { background: #1a4fde; color: #fff; }

/* default: card visible, list hidden；JS 会根据偏好切换 */
[data-view-target="list"] { display: none; }
[data-instance-view="list"] [data-view-target="card"] { display: none; }
[data-instance-view="list"] [data-view-target="list"] { display: table; }

.instance-table th, .instance-table td { vertical-align: middle; }
.instance-table td a { color: inherit; font-weight: 500; }
.instance-table td a:hover { color: #2a64ff; }

/* ===== instance sidebar ===== */
.sidebar-instance {
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f3f4f6;
}
.sidebar-instance-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    word-break: break-word;
}
.sidebar-instance-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 12px;
}
.sidebar-foot {
    margin-top: 16px;
    padding: 0 20px;
    border-top: 1px solid #f3f4f6;
    padding-top: 12px;
}
.small { font-size: 12px; }

.placeholder-box {
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
}
.placeholder-box h3 { margin: 0 0 8px; color: #6b7280; font-weight: 500; }
.placeholder-box p { margin: 4px 0; }

/* ===== power page ===== */
.power-buttons {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.power-buttons button[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ===== console ===== */
.console-card { display: flex; flex-direction: column; }
.console-output {
    background: #0f1116;
    color: #e6edf3;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.55;
    padding: 12px 14px;
    border-radius: 6px;
    height: 520px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}
.console-line { padding: 1px 0; }
.console-line.stderr { color: #ff8a8a; }
.console-line.cmd { color: #7ee0a1; }
.console-line.meta { color: #6b7280; font-style: italic; }
.console-input {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
}
.console-input .prompt {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    color: #6b7280;
    font-size: 14px;
}
.console-input input {
    flex: 1;
    border: 1px solid #d2d6e0;
    border-radius: 6px;
    padding: 8px 10px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
}

.inline-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.inline-form label { flex-direction: column; min-width: 160px; }

/* ===== files ===== */
.files-breadcrumb { padding: 8px 0; font-size: 13px; }
.files-breadcrumb a { padding: 2px 4px; border-radius: 4px; }
.files-breadcrumb a:hover { background: #eef2ff; text-decoration: none; }
.files-table tbody tr:hover { background: #fafbff; }

.file-editor {
    margin-top: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}
.editor-head {
    background: #f9fafb;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}
.editor-head h3 {
    margin: 0;
    font-size: 14px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    color: #374151;
    word-break: break-all;
}
.editor-head > div { display: flex; gap: 8px; flex-shrink: 0; margin-left: 8px; }
#editorContent {
    display: block;
    width: 100%;
    border: none;
    padding: 12px 14px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.55;
    height: 440px;
    resize: vertical;
    box-sizing: border-box;
}
#editorContent:focus { outline: none; background: #fafbff; }

/* ===== modal dialog ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 22, 0.45);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding: 60px 16px 24px;
    overflow-y: auto;
}
.modal.open { display: flex; }
.modal-dialog {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(15, 17, 22, 0.25);
    width: 100%;
    max-width: 520px;
    animation: modal-pop 0.15s ease-out;
}
.modal-dialog.modal-wide { max-width: 760px; }
@keyframes modal-pop {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eef0f4;
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-close {
    background: transparent;
    color: #6b7280;
    font-size: 22px;
    line-height: 1;
    padding: 2px 8px;
    border-radius: 4px;
}
.modal-close:hover { background: #f3f4f6; color: #1f2330; }
.modal-body { padding: 20px; }
.modal-body form { display: flex; flex-direction: column; gap: 14px; }
.modal-body .form-grid { gap: 14px; }
.modal-body .actions { margin-top: 4px; }

/* ===== node metrics dashboard ===== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-top: 12px;
}
.metrics-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}
.metrics-card.offline { background: #fafafa; }
.metrics-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.metrics-card-name {
    font-size: 15px;
    font-weight: 600;
}
.metric-row {
    margin-top: 12px;
}
.metric-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    color: #374151;
    margin-bottom: 4px;
}
.metric-value {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    color: #6b7280;
}
.metric-bar {
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}
.metric-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2a64ff, #4f81ff);
    transition: width 0.3s;
}
.metrics-foot {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
}

/* ===== poll tick indicator ===== */
.poll-tick {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16a34a;
    margin-right: 6px;
    vertical-align: middle;
    opacity: 0.4;
}
.poll-tick.flash {
    animation: poll-tick-flash 0.6s ease-out;
}
.metrics-card.offline .poll-tick { background: #9ca3af; }
@keyframes poll-tick-flash {
    0%   { opacity: 1;   box-shadow: 0 0 0 0 rgba(22,163,74,0.55); }
    70%  { opacity: 1;   box-shadow: 0 0 0 6px rgba(22,163,74,0); }
    100% { opacity: 0.4; box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}

/* ===== node authorization pills (used in users.jsp for NODE_ADMIN) ===== */
.node-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    margin: 2px 4px 2px 0;
    background: #f3f4f6;
    border-radius: 10px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    flex-direction: row;
}
.node-pill input[type=checkbox] { margin: 0; }
.node-assign { max-width: 360px; }

.site-footer {
    margin-top: 32px;
    padding: 14px 16px;
    text-align: center;
    font-size: 12px;
    color: #6b7280;
    background: #f5f6fa;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.site-footer a { color: #6b7280; text-decoration: none; }
.site-footer a:hover { color: #2563eb; text-decoration: underline; }
.site-footer .sep { color: #d1d5db; margin: 0 2px; }
.site-footer .beian-badge { height: 14px; width: 14px; vertical-align: middle; }

/* ===== file manager ===== */
.fm-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0 12px;
    border-bottom: 1px dashed #e5e7eb;
    margin-bottom: 12px;
    min-width: 0;  /* 让内部 flex 项能收缩 */
}
.fm-nav-btn { flex: 0 0 auto; }
.fm-path-input {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #d2d6e0;
    border-radius: 6px;
    background: #fff;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.fm-path-input:focus {
    outline: none;
    border-color: #2a64ff;
    box-shadow: 0 0 0 3px rgba(42, 100, 255, 0.15);
}
.fm-searchbox {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}
.fm-search-input {
    width: 240px;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #d2d6e0;
    border-radius: 6px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.fm-search-input:focus {
    outline: none;
    border-color: #2a64ff;
    box-shadow: 0 0 0 3px rgba(42, 100, 255, 0.15);
}
@media (max-width: 720px) {
    .fm-topbar { flex-wrap: wrap; }
    .fm-search-input { width: 160px; }
}

/* 目录树(移动对话框用) — VS Code 风格 */
.fm-tree {
    max-height: 380px;
    min-height: 240px;
    overflow: auto;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 4px 0;
    background: #fbfbfc;
    font-family: -apple-system, "Segoe UI", "Segoe WPC", "Helvetica Neue", sans-serif;
}
.fm-tree::-webkit-scrollbar { width: 10px; height: 10px; }
.fm-tree::-webkit-scrollbar-thumb { background: #c5c9d1; border-radius: 5px; }
.fm-tree::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
.fm-tree::-webkit-scrollbar-track { background: transparent; }

.fm-tree-root { padding: 0; }

.fm-tree-node {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px 0 4px;
    height: 22px;
    cursor: pointer;
    font-size: 13px;
    color: #24292f;
    user-select: none;
    line-height: 22px;
    white-space: nowrap;
    position: relative;
}
.fm-tree-node:hover { background: #eef1f4; }
.fm-tree-node.selected {
    background: #dbeafe;
    color: #0b3d91;
}
.fm-tree-node.selected::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #2563eb;
}
.fm-tree-node.selected .fm-tree-icon { color: #0b6cff; }
.fm-tree-node.disabled { color: #b0b7c1; cursor: not-allowed; }
.fm-tree-node.disabled:hover { background: transparent; }
.fm-tree-node.disabled .fm-tree-icon { color: #cbd5e1; }

.fm-tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: transparent;
    color: #6b7280;
    padding: 0;
    border: none;
    cursor: pointer;
    flex: 0 0 auto;
    transition: transform 0.12s ease;
}
.fm-tree-toggle svg { display: block; }
.fm-tree-toggle.leaf { visibility: hidden; }
.fm-tree-toggle:hover { color: #111827; }
.fm-tree-toggle.expanded { transform: rotate(90deg); }
.fm-tree-node.selected .fm-tree-toggle { color: #0b3d91; }

.fm-tree-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    color: #4a86d6;
    width: 16px;
    height: 16px;
}
.fm-tree-icon svg { display: block; }
.fm-tree-node.root .fm-tree-icon { color: #2563eb; }

.fm-tree-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 2px;
}

/* 子节点缩进,并显示浅色引导线 */
.fm-tree-children {
    padding-left: 16px;
    position: relative;
}
.fm-tree-children::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #e5e7eb;
}

.fm-tree-loading, .fm-tree-empty {
    padding: 4px 12px 4px 24px;
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
    line-height: 20px;
}

.fm-move-hint {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.fm-move-target {
    color: #1d4ed8;
    font-weight: 600;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    word-break: break-all;
    flex: 1;
}

.fm-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 6px 0 12px;
}
.fm-toolbar-sep { flex: 1; }
.fm-selection-count { font-size: 12px; }

.fm-table { table-layout: fixed; width: 100%; }
.fm-table .fm-col-check { width: 36px; }
.fm-table .fm-col-name { width: auto; }
.fm-table .fm-col-size { width: 90px; }
.fm-table .fm-col-mtime { width: 150px; }
.fm-table .fm-col-ops { width: 260px; }
.fm-table .fm-col-path { width: 28%; }
.fm-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fm-table .fm-cell-path {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    color: #6b7280;
}
.fm-table .fm-cell-path a,
.fm-table .fm-cell-name a {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}
.fm-table tbody tr { height: 40px; }
.fm-table td, .fm-table th { vertical-align: middle; }
.fm-table .fm-row-check { transform: translateY(1px); }
.fm-table .actions-cell {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: flex-end;
}
.fm-table .actions-cell .btn-mini {
    padding: 3px 8px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    flex: 0 0 auto;
}

.fm-search-info {
    padding: 4px 0 8px;
    font-size: 12px;
}

.fm-upload-panel {
    margin: 6px 0 12px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #f9fafb;
}
.fm-upload-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
}
.fm-upload-head .muted { font-size: 12px; }
.fm-progress {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}
.fm-progress-bar {
    height: 100%;
    width: 0;
    background: #4f46e5;
    transition: width .2s;
}

/* editor panel */
.fm-editor-panel { margin-top: 20px; }
.fm-editor-meta {
    font-size: 12px;
    margin-right: 6px;
}
.fm-editor-body {
    display: flex;
    background: #fafbff;
    height: 520px;
}
.fm-editor-gutter {
    flex: 0 0 auto;
    min-width: 48px;
    padding: 12px 8px 12px 10px;
    text-align: right;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.55;
    color: #9ca3af;
    background: #f3f4f6;
    border-right: 1px solid #e5e7eb;
    white-space: pre;
    overflow: hidden;
    user-select: none;
    box-sizing: border-box;
}
/* 用 id+class 提升特异度,覆盖上面 #editorContent 的老尺寸/宽度设置 */
#editorContent.fm-editor-textarea {
    flex: 1;
    height: 100%;
    width: auto;
    border: none;
    padding: 12px 14px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.55;
    resize: none;
    background: transparent;
    box-sizing: border-box;
    white-space: pre;
    overflow: auto;
}
.fm-editor-textarea:focus { outline: none; background: #ffffff; }

@media (max-width: 780px) {
    .fm-table .fm-col-mtime,
    .fm-table .fm-col-path { display: none; }
}

/* ===== 文件类型图标着色 ===== */
.ft-icon {
    display: inline-block;
    width: 1.2em;
    text-align: center;
    margin-right: 4px;
}
.ft-java  { filter: hue-rotate(0deg); }
.ft-js    { filter: hue-rotate(40deg); }
.ft-py    { filter: hue-rotate(200deg); }
.ft-cfg   { filter: none; }
.ft-md    { filter: none; }
.ft-img   { filter: none; }
.ft-arch  { filter: none; }

/* ===== 文件查看页 (file-view.jsp) ===== */
.fv-card {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    min-height: 480px;
    padding: 0;
    overflow: hidden;
}
.fv-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex: 0 0 auto;
    min-width: 0;
}
.fv-back { flex: 0 0 auto; text-decoration: none; }
.fv-file-icon {
    flex: 0 0 auto;
    font-size: 18px;
    line-height: 1;
}
.fv-path {
    flex: 1 1 0;
    min-width: 0;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    color: #4b5563;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.fv-path a { color: #4b5563; text-decoration: none; }
.fv-path a:hover { color: #2563eb; text-decoration: underline; }
.fv-path .fv-sep { color: #9ca3af; margin: 0 2px; }
.fv-path .fv-name { color: #111827; font-weight: 500; }
.fv-meta { font-size: 12px; flex: 0 0 auto; margin: 0 4px 0 8px; }
.fv-toolbar-sep { flex: 0 0 6px; }

.fv-editor-wrap {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}
.fv-editor-wrap .CodeMirror {
    flex: 1 1 auto;
    height: 100%;
    font-size: 13px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    line-height: 1.55;
}
.fv-editor-wrap .CodeMirror-scroll { min-height: 0; }
.fv-editor-wrap .CodeMirror-gutters { background: #f3f4f6; border-right: 1px solid #e5e7eb; }
.fv-editor-wrap .CodeMirror-linenumber { color: #9ca3af; padding: 0 6px 0 8px; }
.fv-editor-wrap .CodeMirror-activeline-background { background: #eff6ff; }

/* CodeMirror 内置搜索对话框放到右上角,不遮挡内容 */
.fv-editor-wrap .CodeMirror-dialog {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 13px;
}
.fv-editor-wrap .CodeMirror-dialog input {
    border: 1px solid #d2d6e0;
    border-radius: 4px;
    padding: 4px 8px;
    font-family: inherit;
    outline: none;
}
.fv-editor-wrap .CodeMirror-dialog input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ===== 公告 / 维护 ===== */
.tag-orange { background: #ffedd5; color: #9a3412; }
.tag-red { background: #fee2e2; color: #b91c1c; }

/* 顶部置顶公告横幅 */
.ann-banner-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.ann-banner {
    background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
    border-bottom: 1px solid #fdba74;
    color: #7c2d12;
    padding: 8px 20px;
    font-size: 13px;
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.ann-banner-tag {
    background: #f97316;
    color: #fff;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    flex: 0 0 auto;
}
.ann-banner-title { font-weight: 600; flex: 0 0 auto; }
.ann-banner-body {
    color: #7c2d12;
    opacity: 0.85;
    white-space: pre-wrap;
    word-break: break-word;
    flex: 1 1 auto;
    min-width: 0;
}

/* 需确认公告弹窗 */
.ann-ack-modal .modal-dialog { max-width: 620px; }
.ann-ack-modal .modal-head h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ann-ack-body {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}
.ann-ack-form { margin: 0; }
.ann-ack-more { margin: 4px 0 0; }

/* 管理端公告列表 */
.ann-row {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fff;
}
.ann-row-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}
.ann-row-title {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 15px;
}
.ann-row-meta { flex: 0 0 auto; }
.ann-row-window {
    margin-top: 4px;
    font-size: 12px;
}
.ann-row-body {
    margin: 10px 0 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #eef0f4;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.55;
    max-height: 200px;
    overflow: auto;
}
.ann-row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.empty {
    padding: 24px;
    text-align: center;
    color: #9ca3af;
    background: #f9fafb;
    border-radius: 8px;
}

/* 维护页 (整页背景) */
.maintenance-body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #334155 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #e2e8f0;
    font-family: inherit;
}
.maintenance-wrap { width: 100%; max-width: 480px; }
.maintenance-card {
    background: #fff;
    color: #1f2330;
    border-radius: 12px;
    padding: 40px 32px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
}
.maintenance-icon { font-size: 44px; margin-bottom: 8px; }
.maintenance-card h1 { margin: 0 0 12px; font-size: 22px; }
.maintenance-msg {
    color: #4b5563;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0 0 20px;
}
.maintenance-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

/* 卡片外的 checkbox / hint (公告 & 维护表单在 .card 下不走 .form-grid) */
.card label.checkbox-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
}
.card label.checkbox-row .checkbox-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.card label.checkbox-row .checkbox-line input[type="checkbox"] {
    width: auto; margin: 0;
}
