:root {
    --primary: #1f8abe;
    --primary-dark: #1870a0;
    --primary-light: #40a8d8;
    --bg: #f5f7fc;
    --card-bg: #ffffff;
    --text: #1e2a3e;
    --text-secondary: #6b7f8a;
    --border: #e8edf2;
    --danger: #e74c3c;
    --warning: #f39c12;
    --success: #27ae60;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
    --nav-height: 44px;
    --sidebar-width: 180px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
}

/* Login */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fc 0%, #e8edf2 100%);
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    width: 380px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    text-align: center;
}

.login-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    background: linear-gradient(145deg, var(--primary), var(--primary-light));
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    box-shadow: 0 8px 20px rgba(31,138,190,0.25);
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
    position: relative;
}

.form-group label {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    background: #fafbfc;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31,138,190,0.10);
    background: white;
}

.login-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-bottom: 12px;
    text-align: left;
    min-height: 20px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    background: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(31,138,190,0.25);
}

.login-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(31,138,190,0.30);
}

.login-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.login-back:hover {
    color: var(--primary);
}

/* Nav */
.server-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    z-index: 100;
    background: rgba(255,255,255,0.90);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
}

.server-nav-inner {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.server-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.server-nav-brand i {
    font-size: 1.2rem;
}

.server-nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.83rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.nav-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(31,138,190,0.05);
}

.nav-btn.nav-btn-danger {
    border-color: rgba(231,76,60,0.2);
    color: var(--danger);
}

.nav-btn.nav-btn-danger:hover {
    background: rgba(231,76,60,0.06);
    color: var(--danger);
    border-color: rgba(231,76,60,0.3);
}

/* Main Layout */
.main-content {
    padding-top: var(--nav-height);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.server-layout {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.sidebar-header {
    padding: 20px 16px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-header h3 i {
    font-size: 0.85rem;
    color: var(--primary);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sidebar-item:hover {
    background: rgba(31,138,190,0.05);
    color: var(--text);
}

.sidebar-item.active {
    background: rgba(31,138,190,0.08);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.sidebar-item i {
    width: 20px;
    text-align: center;
}

/* 桌面端：背景遮罩和边缘按钮隐藏 */
.sidebar-backdrop {
    display: none;
}

.mobile-sidebar-edge-toggle {
    display: none;
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

#panel-frp.active {
    max-width: 800px;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
    padding: 0 0 12px 0;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h2 i {
    color: var(--primary);
}

/* 隐藏系统信息和业务状态的标题栏 */
#panel-info .panel-header,
#panel-running .panel-header {
    display: none;
}

/* Info Panel */
.refresh-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(31,138,190,0.05);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.info-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(31,138,190,0.04);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--primary);
}

.info-card-body {
    padding: 8px 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row:has(#sys-cpu) {
    justify-content: flex-end;
    gap: 40px;
    margin-left: 25px;
}

.info-row span:first-child {
    color: var(--text-secondary);
}

.info-row span:last-child {
    font-weight: 500;
}

.cpu-hot {
    color: #e74c3c;
    font-weight: 600;
}

/* Running Panel */
.running-layout {
    display: grid;
    grid-template-columns: 5fr 2fr;
    gap: 16px;
}

.running-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.running-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(31,138,190,0.04);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary);
}

.running-section-header i {
    font-size: 0.85rem;
}

.running-list {
    max-height: calc(100vh - 240px);
    overflow-y: auto;
}

.running-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}

.running-table th, .running-table td {
    padding: 7px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.running-table th {
    padding: 8px 8px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    position: sticky;
    top: 0;
    z-index: 2;
}

.running-table th:nth-child(1),
.running-table td:nth-child(1) { width: 80px; }  /* PID */
.running-table th:nth-child(2),
.running-table td:nth-child(2) { width: 50px; }  /* 用户 */
.running-table th:nth-child(3),
.running-table td:nth-child(3) { width: 70px; font-variant-numeric: tabular-nums; }  /* CPU% */
.running-table th:nth-child(4),
.running-table td:nth-child(4) { width: 70px; }  /* MEM% */
.running-table th:nth-child(5),
.running-table td:nth-child(5) { width: 80px; }  /* RSS */
.running-table th:nth-child(6),
.running-table td:nth-child(6) { width: 50px; }  /* 状态 */
.running-table th:nth-child(7),
.running-table td:nth-child(7) { width: auto; text-align: left; }  /* 进程名 — 左对齐 */

.proc-name-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.running-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}
.running-table th.sortable:hover {
    color: var(--primary);
}

.running-table td.num.hot {
    color: #e74c3c;
    font-weight: 600;
}

.running-table .proc-row { cursor: pointer; }
.running-table .proc-row:hover { background: rgba(31,138,190,0.05); }
.running-table .proc-row.selected { background: rgba(31,138,190,0.12); }

.kill-btn {
    margin-left: 8px;
    padding: 2px 8px;
    border: 1px solid rgba(231,76,60,0.4);
    border-radius: 4px;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s;
    vertical-align: middle;
}
.kill-btn:hover {
    background: rgba(231,76,60,0.1);
    border-color: var(--danger);
}

.running-table tr:hover {
    background: rgba(31,138,190,0.03);
}

.qftek-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    transition: background 0.15s;
}

.qftek-item:last-child {
    border-bottom: none;
}

.qftek-item:hover {
    background: rgba(31,138,190,0.03);
}

.qftek-info {
    min-width: 0;
}

.qftek-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.qftek-alias {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
}

.qftek-svc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.qftek-status {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

.qftek-running {
    color: #27ae60;
    background: rgba(39,174,96,0.1);
}

.qftek-stopped {
    color: #e74c3c;
    background: rgba(231,76,60,0.1);
}

.qftek-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.qftek-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all 0.15s;
}

.qftek-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #aaa;
    border-color: #ddd;
}

.qftek-btn-start {
    color: #27ae60;
    border-color: rgba(39,174,96,0.3);
}

.qftek-btn-start:hover:not(:disabled) {
    background: rgba(39,174,96,0.1);
    border-color: #27ae60;
}

.qftek-btn-stop {
    color: #e74c3c;
    border-color: rgba(231,76,60,0.3);
}

.qftek-btn-stop:hover:not(:disabled) {
    background: rgba(231,76,60,0.1);
    border-color: #e74c3c;
}

.qftek-btn-restart {
    color: #f39c12;
    border-color: rgba(243,156,18,0.3);
}

.qftek-btn-restart:hover:not(:disabled) {
    background: rgba(243,156,18,0.1);
    border-color: #f39c12;
}

/* File Panel - flex layout 让列表独立滚动 */
#panel-files.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}
#panel-files.active .file-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* File Toolbar */
.file-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px 8px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 0;
    margin-bottom: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-basis: 100%;
    flex-wrap: nowrap;
    overflow: hidden;
    padding: 4px 0 0 0;
    font-size: 0.82rem;
    min-width: 0;
    order: 99;
}
.breadcrumb-item {
    padding: 2px 4px;
    border-radius: 4px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.breadcrumb-item[data-path] {
    cursor: pointer;
    color: var(--primary);
}
.breadcrumb-item[data-path]:hover {
    background: rgba(31,138,190,0.08);
    color: var(--primary-dark);
}
.breadcrumb-item.active {
    color: var(--text);
    font-weight: 500;
}
.breadcrumb-sep {
    color: var(--border);
    margin: 0 2px;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.toolbar-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(31,138,190,0.05);
}

.toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.toolbar-btn-danger:hover:not(:disabled) {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(231,76,60,0.05);
}

.toolbar-btn-cancel {
    border-color: rgba(231,76,60,0.3);
    color: var(--danger);
}

.toolbar-btn-cancel:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(231,76,60,0.05);
}

#btn-refresh-files.refreshing i {
    animation: spin 0.5s ease-in-out;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

.file-select-info {
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding-left: 8px;
}

/* File List */
.file-list {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.file-item {
    display: grid;
    grid-template-columns: 36px 36px 1fr 100px 140px;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: 0.85rem;
    transition: background 0.15s;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item.dir {
    cursor: pointer;
}

.file-item.dir:hover {
    background: rgba(31,138,190,0.04);
}

.file-item.selected {
    background: rgba(31,138,190,0.08);
}

.file-check {
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-checkbox {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--primary);
}

.file-icon {
    color: var(--text-secondary);
    text-align: center;
}

.file-item.dir .file-icon {
    color: var(--primary);
}

.file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    color: var(--text-secondary);
    text-align: right;
}

.file-loading, .file-empty, .file-error {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

.file-loading i, .file-empty i, .file-error i {
    font-size: 2rem;
    margin-bottom: 8px;
    display: block;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

.modal-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    width: 380px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fafbfc;
    outline: none;
    transition: border-color 0.2s;
}

.modal-input:focus {
    border-color: var(--primary);
}

.modal-error {
    color: var(--danger);
    font-size: 0.82rem;
    min-height: 20px;
    margin-top: 6px;
}

.modal-msg {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.modal-btn {
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.modal-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.modal-btn-icon {
    width: 38px;
    padding: 8px 0;
    background: transparent;
    color: var(--text-secondary);
}

.modal-btn-icon:hover:not(:disabled) {
    background: rgba(31,138,190,0.06);
    border-color: var(--primary);
    color: var(--primary);
}

.modal-btn-cancel {
    background: transparent;
    color: var(--text-secondary);
}

.modal-btn-cancel:hover {
    background: rgba(0,0,0,0.04);
}

.modal-btn-ok {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.modal-btn-ok:hover {
    background: var(--primary-dark);
}

.modal-btn-ok:disabled,
.modal-btn-ok:disabled:hover {
    background: #d8dee6;
    border-color: #d8dee6;
    color: #8a96a3;
}

.modal-btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.modal-btn-danger:hover {
    background: #c0392b;
}

/* File Editor */
.file-editor-overlay {
    align-items: stretch;
    justify-content: center;
    padding: 4vh 24px;
}

.file-editor-card {
    width: min(1100px, 96vw);
    height: 90vh;
    height: 90dvh;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--border);
}

.file-editor-title {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
}

.file-editor-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-editor-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.file-editor-close:hover {
    color: var(--danger);
    border-color: rgba(231,76,60,0.35);
    background: rgba(231,76,60,0.06);
}

.file-editor-meta {
    padding: 8px 18px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-editor-body {
    flex: 1;
    width: 100%;
    min-height: 0;
    display: flex;
    background: #fbfcfe;
}

.file-editor-lines {
    width: 56px;
    flex-shrink: 0;
    padding: 14px 10px 14px 0;
    border-right: 1px solid var(--border);
    background: #f2f5f9;
    color: #9aa7b5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.55;
    text-align: right;
    user-select: none;
    overflow: hidden;
    white-space: pre;
}

.file-editor-text {
    flex: 1;
    min-width: 0;
    resize: none;
    border: 0;
    outline: none;
    padding: 14px 18px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text);
    background: #fbfcfe;
    tab-size: 4;
}

.file-editor-statusbar {
    min-height: 24px;
    padding: 4px 18px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.file-editor-status {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-editor-stats {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.file-editor-statusbar.error .file-editor-status {
    color: var(--danger);
}

.file-editor-statusbar.success .file-editor-status {
    color: var(--success);
}

.file-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 18px 16px;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Compact System Info */
.info-grid.compact {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 12px;
    align-items: stretch;
}
.info-grid.compact > .info-card {
    display: flex;
    flex-direction: column;
}
.info-grid.compact .info-card-body {
    flex: 1;
    min-height: 0;
}

.cpu-cores-card { grid-column: 3 / 6; }
.cpu-chart-card { grid-column: span 5; align-self: start; }
.wifi-card { grid-column: 1 / 2; }
.net-speed-card { grid-column: 2 / 3; }

.chart-value {
    margin-left: auto;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}
.chart-value.cpu-hot {
    color: var(--danger);
}

.chart-body {
    padding: 4px 12px;
    position: relative;
}
.info-grid.compact .chart-body {
    flex: none;
    height: 300px;
}
#cpu-history-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.gauge-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
}
.gauge-pct {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.gauge-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.gauge-bar-wrap {
    width: 100%;
    margin-top: 2px;
}
.gauge-bar-bg {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.gauge-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.bat-extra {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 4px;
    white-space: nowrap;
}

.sys-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}
.sys-line {
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.35;
}
.sys-line:nth-child(3),
.sys-line:nth-child(4) {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.wifi-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
}
.wifi-row span:first-child {
    color: var(--text-secondary);
}
.wifi-row span:last-child {
    font-weight: 500;
}
.wifi-body {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

/* CPU Cores */
.cpu-cores-body {
    padding: 8px 14px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.core-card {
    background: rgba(31,138,190,0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.core-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.core-pct {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.core-temp {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.core-mid {
    font-size: 0.68rem;
    color: var(--text-secondary);
    text-align: center;
}
.core-bar-bg {
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.core-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.core-bar-fill.warn { background: var(--warning); }
.core-bar-fill.hot { background: var(--danger); }

/* IO */
.io-body {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}
.io-item {
    width: 100%;
}
.io-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
    font-size: 0.78rem;
    margin-bottom: 4px;
}
.io-label {
    color: var(--text-secondary);
    flex-shrink: 0;
    font-size: 0.76rem;
}
.io-bar-wrap {
    width: 100%;
}
.io-bar-bg {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.io-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}
.io-bar-fill.io-read { background: var(--success); }
.io-bar-fill.io-write { background: var(--danger); }
.io-val {
    font-weight: 500;
    font-size: 0.76rem;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ========== FRP 管理面板 ========== */
.frp-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.frp-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.frp-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(31,138,190,0.04);
    border-bottom: 1px solid var(--border);
}

.frp-card-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--primary);
}

.frp-card-title i {
    font-size: 0.9rem;
}

.frp-card-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.frp-status {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 10px;
}

.frp-status.frp-running {
    color: #27ae60;
    background: rgba(39,174,96,0.1);
}

.frp-status.frp-stopped {
    color: #e74c3c;
    background: rgba(231,76,60,0.1);
}

.frp-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: transparent;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    color: var(--text-secondary);
}

.frp-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.frp-btn-start { color: #27ae60; border-color: rgba(39,174,96,0.3); }
.frp-btn-start:hover:not(:disabled) { background: rgba(39,174,96,0.08); border-color: #27ae60; }

.frp-btn-stop { color: #e74c3c; border-color: rgba(231,76,60,0.3); }
.frp-btn-stop:hover:not(:disabled) { background: rgba(231,76,60,0.08); border-color: #e74c3c; }

.frp-card-body {
    padding: 14px 16px;
}

.frp-field {
    margin-bottom: 12px;
}

.frp-field:last-child {
    margin-bottom: 0;
}

.frp-field > label,
.frp-collapse-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
    cursor: default;
}

.frp-collapse-toggle {
    cursor: pointer;
    user-select: none;
}

.frp-collapse-toggle i {
    font-size: 0.65rem;
    transition: transform 0.2s;
    color: var(--text-secondary);
}

.frp-collapse-toggle.collapsed i {
    transform: rotate(-90deg);
}

.frp-hint {
    font-weight: 400;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.frp-inline-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid rgba(31,138,190,0.3);
    border-radius: 5px;
    background: transparent;
    color: var(--primary);
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
}

.frp-inline-btn:hover {
    background: rgba(31,138,190,0.08);
}

.frp-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    background: #fafbfc;
    outline: none;
    resize: vertical;
    line-height: 1.35;
    transition: border-color 0.2s;
}

.frp-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(31,138,190,0.10);
    background: white;
}

.frp-ini-editor {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.frp-ini-editor.collapsed {
    display: none;
}

.frp-ini-section {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.frp-ini-section:last-child {
    border-bottom: none;
}

.frp-ini-section-title {
    padding: 6px 12px;
    background: rgba(31,138,190,0.03);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.frp-section-delete {
    width: 24px;
    height: 24px;
    border: 1px solid rgba(231,76,60,0.25);
    border-radius: 5px;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.7rem;
}

.frp-section-delete:hover {
    background: rgba(231,76,60,0.08);
    border-color: var(--danger);
}

.frp-ini-rows {
    padding: 4px 12px 6px;
}

.frp-ini-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
}

.frp-ini-row label {
    width: 120px;
    min-width: 120px;
    max-width: 130px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.frp-ini-row input {
    flex: 1;
    min-width: 0;
    padding: 3px 7px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.78rem;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    background: #fafbfc;
    outline: none;
    transition: border-color 0.15s;
}

.frp-ini-row input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(31,138,190,0.08);
    background: white;
}

.frp-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 12px;
    background: rgba(243,156,18,0.06);
    border: 1px solid rgba(243,156,18,0.2);
    border-radius: 6px;
    font-size: 0.8rem;
    color: #8a6508;
    line-height: 1.45;
    margin-bottom: 12px;
}

.frp-notice i {
    color: var(--warning);
    font-size: 0.85rem;
    margin-top: 1px;
    flex-shrink: 0;
}

.frp-btn-save {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    padding: 6px 14px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    background: transparent;
    color: var(--primary);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.frp-btn-save:hover {
    background: rgba(31,138,190,0.08);
}

@media (max-width: 768px) {
    .frp-card-header {
        flex-wrap: wrap;
        gap: 6px;
    }
    .frp-card-actions {
        margin-left: 0;
    }
    .frp-ini-row {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 3px 0;
    }
    .frp-ini-row label {
        text-align: left;
        width: auto;
        max-width: none;
    }
    .frp-btn {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

/* ========== SSH 终端面板 ========== */
#panel-ssh.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ssh-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #1e1e1e;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.ssh-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #2d2d2d;
    border-bottom: 1px solid #3c3c3c;
    flex-shrink: 0;
}

.ssh-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ccc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ssh-title i {
    color: var(--primary);
}

.ssh-status {
    font-size: 0.78rem;
    color: #888;
    margin-left: auto;
}

.ssh-status.connected {
    color: var(--success);
}

.ssh-connect-btn,
.ssh-disconnect-btn {
    padding: 5px 14px;
    border: 1px solid var(--primary);
    border-radius: 5px;
    background: transparent;
    color: var(--primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.ssh-connect-btn:hover {
    background: rgba(31,138,190,0.15);
}

.ssh-disconnect-btn {
    border-color: var(--danger);
    color: var(--danger);
}

.ssh-disconnect-btn:hover {
    background: rgba(231,76,60,0.15);
}

/* Ctrl+C/V 快捷按钮 — 移动端可见 */
.ssh-shortcut-btn {
    display: none;
    padding: 4px 10px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #3c3c3c;
    color: #ccc;
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.ssh-shortcut-btn:hover {
    background: #555;
    color: #fff;
}

.ssh-shortcut-btn:active {
    background: var(--primary);
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .ssh-shortcut-btn {
        display: inline-block;
    }
}

#ssh-terminal {
    flex: 1;
    min-height: 0;
    padding: 4px;
}

#ssh-terminal .xterm {
    height: 100%;
}

#ssh-terminal .xterm-viewport {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

/* SSH 登录弹窗 */
.ssh-login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.ssh-login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px 28px;
    width: 340px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.ssh-login-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ssh-login-card h3 i {
    color: var(--primary);
}

.ssh-login-field {
    margin-bottom: 12px;
}

.ssh-login-field label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.ssh-login-field input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fafbfc;
    outline: none;
}

.ssh-login-field input:focus {
    border-color: var(--primary);
}

.ssh-login-pass-wrap .ssh-login-pass-row {
    display: flex;
    align-items: center;
    gap: 0;
}

.ssh-login-pass-wrap .ssh-login-pass-row input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.ssh-pass-toggle {
    width: 38px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 6px 6px 0;
    background: #fafbfc;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    flex-shrink: 0;
}

.ssh-pass-toggle:hover {
    background: #e8eaed;
    color: var(--text);
}

.ssh-login-error {
    color: var(--danger);
    font-size: 0.8rem;
    min-height: 18px;
    margin-bottom: 8px;
}

.ssh-login-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.ssh-login-actions button {
    padding: 7px 18px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.ssh-login-actions .ssh-login-ok {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.ssh-login-actions .ssh-login-ok:hover {
    background: var(--primary-dark);
}

@media (max-width: 768px) {
    .ssh-toolbar {
        padding: 8px 10px;
        gap: 8px;
    }
    .ssh-title {
        font-size: 0.78rem;
    }
    /* 移动端：取消容器裁剪，让 xterm 内部滚动条生效 */
    .ssh-container {
        overflow: visible;
    }
    #ssh-terminal {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 1100px) {
    .info-grid.compact {
        grid-template-columns: repeat(3, 1fr);
    }
    .cpu-cores-card { grid-column: span 3; }
    .cpu-chart-card { grid-column: span 3; }
    .wifi-card { grid-column: span 1; }
    .net-speed-card { grid-column: span 1; }
    .cpu-cores-body {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    .file-editor-overlay {
        padding: 0;
    }

    .file-editor-card {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }

    .file-editor-text {
        font-size: 0.84rem;
        padding: 12px;
    }

    .file-editor-actions {
        padding: 10px 12px;
        flex-wrap: wrap;
    }

    .info-grid.compact {
        grid-template-columns: 1fr;
    }
    .cpu-cores-card { grid-column: auto; }
    .cpu-chart-card { grid-column: auto; }
    .wifi-card { grid-column: auto; }
    .net-speed-card { grid-column: auto; }
    .cpu-cores-body {
        grid-template-columns: repeat(2, 1fr);
    }

    .server-nav-right .nav-btn span {
        display: none;
    }
    
    .nav-btn {
        padding: 7px 10px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .running-layout {
        grid-template-columns: 1fr;
    }
    
    .toolbar-btn span {
        display: none;
    }
    
    .toolbar-btn {
        padding: 6px 8px;
    }

    /* 文件工具栏：重命名~删除在第二行 */
    #btn-rename,
    #btn-copy,
    #btn-cut,
    #btn-paste,
    #btn-cancel,
    #btn-delete {
        order: 10;
    }
    .file-toolbar .toolbar-divider:nth-of-type(2),
    .file-toolbar .toolbar-divider:nth-of-type(3) {
        display: none;
    }
    /* 强制断行 */
    .file-toolbar::after {
        content: '';
        flex-basis: 100%;
        order: 5;
    }
    
    .file-item {
        grid-template-columns: 32px 32px 1fr 80px;
    }
    
    .file-meta:last-child {
        display: none;
    }

    .running-table {
        table-layout: auto;
    }
    .running-list {
        overflow-x: auto;
    }

    /* ========== 移动端侧边栏：滑出抽屉 ========== */
    .server-layout {
        position: relative;
    }

    .sidebar {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(260px, 75vw);
        z-index: 30;
        transform: translateX(calc(-100% - 12px));
        box-shadow: none;
        padding: 0;
    }

    body.mobile-sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    }

    .sidebar-header {
        padding: 16px 14px 10px;
    }

    .sidebar-item {
        padding: 12px 16px;
        gap: 10px;
        border-right: none;
    }

    .sidebar-item span {
        display: inline;
    }

    /* 边缘触发按钮 */
    .mobile-sidebar-edge-toggle {
        position: absolute;
        top: 50%;
        left: -3px;
        z-index: 40;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 44px;
        padding: 0;
        border: none;
        background: transparent;
        color: rgba(30,42,62,0.55);
        font-size: 1rem;
        cursor: pointer;
        transform: translateY(-50%);
        transition: left 0.25s ease, color 0.2s ease;
        text-shadow: 0 1px 6px rgba(255,255,255,0.9);
    }

    .mobile-sidebar-edge-toggle::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: radial-gradient(circle,
            rgba(246,180,40,0.8) 0%,
            rgba(246,180,40,0.38) 45%,
            rgba(246,180,40,0) 75%);
        box-shadow: 0 0 18px rgba(246,180,40,0.5);
        transform: translate(-50%, -50%) scale(0.6);
        opacity: 0;
        pointer-events: none;
    }

    body.mobile-sidebar-hint-active .mobile-sidebar-edge-toggle::before {
        animation: mobile-sidebar-halo 1.8s ease-out infinite;
    }

    body.mobile-sidebar-hint-active .mobile-sidebar-edge-toggle {
        animation: mobile-sidebar-arrow-pulse 1.8s ease-in-out infinite;
    }

    .mobile-sidebar-edge-toggle:hover {
        color: var(--primary);
    }

    body.mobile-sidebar-open .mobile-sidebar-edge-toggle {
        left: calc(min(260px, 75vw) - 3px);
        color: var(--primary);
    }

    body.mobile-sidebar-open .mobile-sidebar-edge-toggle i {
        transform: rotate(180deg);
    }

    /* 背景遮罩 */
    .sidebar-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        background: rgba(10,22,40,0.28);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
        z-index: 20;
    }

    body.mobile-sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

/* 移动端侧边栏：金色光晕脉冲提示动画 */
@keyframes mobile-sidebar-halo {
    0% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.7);
    }
    70% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2);
    }
}

@keyframes mobile-sidebar-arrow-pulse {
    0% {
        opacity: 0.55;
        text-shadow: 0 1px 6px rgba(255,255,255,0.55);
    }
    50% {
        opacity: 1;
        text-shadow: 0 1px 10px rgba(255,255,255,0.95);
    }
    100% {
        opacity: 0.55;
        text-shadow: 0 1px 6px rgba(255,255,255,0.55);
    }
}
