/* ============ FreeCloud Web 样式（显式颜色，不受系统深色主题影响） ============ */
:root {
    --bg: #F3F4F8;
    --card: #FFFFFF;
    --border: #E5E7EB;
    --text: #1F2937;
    --text-2: #4B5563;
    --text-3: #9CA3AF;
    --blue: #2563EB;
    --blue-deep: #1D4ED8;
    --blue-soft: #DBEAFE;
    --green: #16A34A;
    --green-soft: #DCFCE7;
    --orange: #D97706;
    --orange-soft: #FEF3C7;
    --red: #DC2626;
    --red-deep: #991B1B;
    --red-soft: #FEE2E2;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(17, 24, 39, .08);
    --shadow-lg: 0 10px 32px rgba(17, 24, 39, .18);
    --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", -apple-system, sans-serif;
    font-size: 15px; color: var(--text); background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ---------- 顶部渐变头栏 ---------- */
.header {
    background: linear-gradient(90deg, #1D4ED8 0%, #2563EB 55%, #4F8DF9 100%);
    color: #FFFFFF; padding: 0 22px; height: 64px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: 0 2px 8px rgba(29, 78, 216, .25);
}
.header .title { font-size: 20px; font-weight: 600; color: #FFFFFF; white-space: nowrap; }
.header .sub { font-size: 13px; color: #DBEAFE; white-space: nowrap; }
.header .spacer { flex: 1; }
.header .badge {
    color: #FFFFFF; background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.30);
    border-radius: 12px; padding: 4px 14px; font-size: 13px; font-weight: 600;
    white-space: nowrap;
}

/* ---------- 工具栏 ---------- */
.toolbar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 12px 18px 6px;
}
.toolbar .count { color: var(--text-2); font-size: 13px; margin-left: 4px; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: #FFFFFF; color: #374151; border: 1px solid #D1D5DB;
    border-radius: 8px; padding: 8px 16px; font-size: 14px; font-weight: 500;
    cursor: pointer; user-select: none; transition: all .15s ease;
    white-space: nowrap;
}
.btn:hover { border-color: #93C5FD; background: #F8FAFF; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.accent {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    color: #FFFFFF; border: none; box-shadow: 0 2px 6px rgba(37,99,235,.35);
}
.btn.accent:hover { background: linear-gradient(135deg, #3B82F6, #2563EB); }
.btn.danger { color: var(--red); border-color: #FCA5A5; }
.btn.danger:hover { background: #FEF2F2; border-color: #EF4444; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: rgba(17,24,39,.05); color: var(--text); }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn.block { width: 100%; }

/* ---------- 卡片与主体 ---------- */
.main { display: flex; gap: 14px; padding: 8px 18px 16px; flex: 1; min-height: 0; }
body.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0;
}
.card .card-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px 10px;
}
.card .card-title { font-size: 16px; font-weight: 600; color: var(--text); }
.card .card-body { padding: 0 12px 12px; flex: 1; min-height: 0; display: flex; flex-direction: column; }

.panel-left { flex: 5; }
.panel-right { flex: 6; }

/* ---------- 徽章 ---------- */
.chip {
    display: inline-flex; align-items: center; gap: 4px;
    border-radius: 9px; padding: 3px 12px; font-size: 13px; font-weight: 600;
}
.chip.normal { color: var(--blue); background: var(--blue-soft); }
.chip.ok { color: var(--green); background: var(--green-soft); }
.chip.warn { color: var(--orange); background: var(--orange-soft); }
.chip.danger { color: var(--red); background: var(--red-soft); }
.chip.expired { color: #374151; background: #E5E7EB; }

/* ---------- 表格 ---------- */
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid thead th {
    text-align: left; padding: 8px 10px; color: var(--text-3); font-weight: 500;
    border-bottom: 1px solid var(--border); font-size: 13px; white-space: nowrap;
    position: sticky; top: 0; background: var(--card); z-index: 1;
}
table.grid tbody tr { cursor: pointer; border-bottom: 1px solid #F3F4F6; transition: background .1s; }
table.grid tbody tr:hover { background: #F8FAFF; }
table.grid tbody tr.selected { background: #EFF6FF; }
table.grid tbody tr.expired { background: #FEF2F2; }
table.grid tbody tr.urgent { background: #FEF3C7; }
table.grid tbody tr.warn { background: #FFFBEB; }
table.grid tbody tr.expired:hover, table.grid tbody tr.urgent:hover, table.grid tbody tr.warn:hover { filter: brightness(.98); }
table.grid td { padding: 9px 10px; color: var(--text); vertical-align: middle; white-space: nowrap; }
table.grid td .note { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.grid .center { text-align: center; }
table.grid .mono { font-family: var(--mono); font-size: 13px; }
table.grid .num { color: var(--text-3); }
table.grid td input.note-input {
    width: 100%; border: 1px solid #93C5FD; border-radius: 6px;
    padding: 3px 6px; font-size: 13px; font-family: inherit;
}
.empty {
    text-align: center; color: var(--text-3); padding: 42px 0; font-size: 14px;
}
.list-scroll { overflow: auto; flex: 1; border-radius: 8px; }

/* ---------- 详情 ---------- */
.detail-title { font-size: 16px; font-weight: 600; color: var(--text); }
.detail-name { font-family: var(--mono); }
.detail-chip { margin-left: auto; }
.detail-content {
    flex: 1; overflow: auto; background: #F8FAFC; border: 1px solid var(--border);
    border-radius: 8px; padding: 12px 14px; font-family: var(--mono); font-size: 13.5px;
    line-height: 1.7; color: var(--text); user-select: text;
}
.detail-content .sec {
    color: var(--blue); font-weight: 600; font-size: 13.5px;
    margin: 8px 0 2px; font-family: inherit;
}
.detail-content .row { display: flex; gap: 10px; padding: 1px 0; }
.detail-content .row .k { color: var(--text-2); min-width: 88px; white-space: nowrap; }
.detail-content .row .v { color: var(--text); word-break: break-all; flex: 1; }
.detail-content .warn { color: var(--orange); font-family: inherit; font-size: 12.5px; margin-top: 8px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 0 0; }

/* ---------- 运行中任务横幅 ---------- */
.task-banner {
    margin: 4px 18px 0; padding: 10px 16px; border-radius: 10px;
    background: linear-gradient(135deg, #EFF6FF, #F8FAFF);
    border: 1px solid #BFDBFE; display: none; align-items: center; gap: 10px;
    cursor: pointer; font-size: 14px; color: var(--text);
}
.task-banner.show { display: flex; }
.task-banner .dot {
    width: 9px; height: 9px; border-radius: 50%; background: var(--blue);
    animation: pulse 1.2s infinite;
}
.task-banner .queued .dot { background: var(--orange); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- 模态 ---------- */
.modal-mask {
    position: fixed; inset: 0; background: rgba(17,24,39,.45);
    display: none; align-items: center; justify-content: center; z-index: 100;
    backdrop-filter: blur(2px);
}
.modal-mask.show { display: flex; }
.modal {
    background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg);
    width: min(860px, 94vw); max-height: 90vh; display: flex; flex-direction: column;
    overflow: hidden; animation: pop .16s ease;
}
.modal.sm { width: min(520px, 94vw); }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
    background: linear-gradient(135deg, #1D4ED8, #2563EB); color: #FFFFFF;
    padding: 14px 20px; display: flex; align-items: center; gap: 10px;
}
.modal-head .m-title { font-size: 17px; font-weight: 600; color: #FFFFFF; }
.modal-head .m-sub { font-size: 12.5px; color: #DBEAFE; margin-top: 2px; }
.modal-head .spacer { flex: 1; }
.modal-close {
    background: rgba(255,255,255,.16); color: #FFFFFF; border: none; cursor: pointer;
    width: 30px; height: 30px; border-radius: 50%; font-size: 15px; line-height: 1;
}
.modal-close:hover { background: rgba(255,255,255,.3); }
.modal-body { padding: 16px 20px; overflow: auto; }

/* ---------- 表单 ---------- */
.field { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.field label { width: 80px; color: var(--text-2); font-weight: 600; flex-shrink: 0; font-size: 14px; }
.field input {
    flex: 1; border: 1px solid #D1D5DB; border-radius: 8px; padding: 8px 12px;
    font-size: 14px; color: var(--text); background: #FFFFFF; outline: none;
    font-family: inherit;
}
.field input:focus { border-color: #60A5FA; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.field input.mono { font-family: var(--mono); }
.tip { color: var(--text-2); font-size: 13px; margin: -4px 0 10px 90px; }
.check-row { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; }
.check-row input { accent-color: var(--blue); width: 16px; height: 16px; }

/* ---------- 任务日志 ---------- */
.log-box {
    background: #0F172A; color: #E2E8F0; border-radius: 10px;
    font-family: var(--mono); font-size: 13px; line-height: 1.75;
    padding: 12px 14px; height: 320px; overflow: auto; white-space: pre-wrap;
    word-break: break-all; margin-top: 12px;
}
.log-box .ln-err { color: #F87171; }
.log-box .ln-ok { color: #4ADE80; }
.log-box .ln-head { color: #93C5FD; font-weight: 600; }
.task-status { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.task-status .msg { color: var(--text-2); font-size: 13.5px; flex: 1; }
.task-actions { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }

/* ---------- 待办列表 ---------- */
.pending-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px;
    background: #FAFBFF;
}
.pending-item .p-info { flex: 1; min-width: 0; }
.pending-item .p-name { font-weight: 600; font-family: var(--mono); font-size: 14px; }
.pending-item .p-meta { color: var(--text-2); font-size: 12.5px; margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 登录页 ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 55%, #3B82F6 100%);
}
.login-card {
    background: #FFFFFF; border-radius: 16px; box-shadow: 0 20px 60px rgba(15,23,42,.35);
    width: min(400px, 92vw); padding: 34px 34px 30px;
}
.login-card .l-title { font-size: 22px; font-weight: 700; color: var(--text); text-align: center; }
.login-card .l-sub { color: var(--text-2); font-size: 14px; text-align: center; margin: 6px 0 22px; }
.login-card .field { margin-bottom: 16px; }
.login-card .field label { width: auto; margin-bottom: 6px; display: block; }
.login-card .field input { width: 100%; padding: 11px 14px; font-size: 15px; }
.login-err { color: var(--red); font-size: 13.5px; text-align: center; min-height: 20px; margin-bottom: 8px; }

/* ---------- Toast ---------- */
#toast {
    position: fixed; top: 74px; left: 50%; transform: translateX(-50%);
    z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
    pointer-events: none;
}
.toast-item {
    background: #111827; color: #F9FAFB; padding: 10px 20px; border-radius: 10px;
    font-size: 14px; box-shadow: var(--shadow-lg); animation: pop .18s ease;
    max-width: 80vw;
}
.toast-item.ok { background: #14532D; }
.toast-item.err { background: #7F1D1D; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .main { flex-direction: column; overflow: auto; }
    body.app { overflow: auto; height: auto; }
    .header .sub { display: none; }
}


/* ---------- 移动端适配（≤600px） ---------- */
@media (max-width: 600px) {
    /* 顶栏压缩，修复横向溢出 */
    .header { padding: 0 12px; height: 56px; gap: 8px; }
    .header .title { font-size: 16px; flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .header .badge { padding: 3px 9px; font-size: 12px; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; }
    .header .btn.ghost { padding: 6px 9px; font-size: 13px; }

    /* 工具栏改为横向滚动 */
    .toolbar { flex-wrap: nowrap; overflow-x: auto; padding: 10px 12px 6px; -webkit-overflow-scrolling: touch; }
    .toolbar .btn { flex-shrink: 0; }
    .toolbar .count { display: none; }

    .main { padding: 8px 12px 16px; gap: 12px; }
    .task-banner { margin: 4px 12px 0; }

    /* 服务器表格 -> 卡片列表 */
    table.grid thead { display: none; }
    table.grid, table.grid tbody { display: block; width: 100%; }
    table.grid tbody tr {
        display: block; border: 1px solid var(--border); border-radius: 12px;
        padding: 6px 2px; margin-bottom: 10px; background: var(--card);
        box-shadow: var(--shadow);
    }
    table.grid tbody tr.selected { border-color: #93C5FD; background: #EFF6FF; }
    table.grid tbody tr.expired { background: #FEF2F2; }
    table.grid tbody tr.urgent { background: #FEF3C7; }
    table.grid tbody tr.warn { background: #FFFBEB; }
    table.grid tbody tr:hover { filter: brightness(.98); }
    table.grid td {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        padding: 7px 12px; white-space: normal; border-bottom: 1px dashed #EEF2F7;
    }
    table.grid tbody tr td:last-child { border-bottom: none; }
    table.grid td:first-child { display: none; }
    table.grid td::before {
        content: attr(data-label); color: var(--text-3); font-size: 12.5px;
        font-weight: 600; flex-shrink: 0;
    }
    table.grid td .note { max-width: 52vw; }
    .list-scroll { overflow: visible; }

    /* 详情区 */
    .detail-title { font-size: 15px; overflow-wrap: anywhere; }
    .detail-actions .spacer { display: none; }
    .detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .detail-actions .btn { width: 100%; }
    .detail-actions .btn.danger { grid-column: span 2; }

    /* 弹窗与表单 */
    .modal-head { padding: 12px 14px; }
    .modal-body { padding: 12px 14px; }
    .field { flex-direction: row; flex-wrap: wrap; }
    .field label { width: 100%; }
    .field input { flex: 1 1 100%; }
    .field .btn.sm { margin-left: auto; }
    .tip { margin: -4px 0 10px; }
    .log-box { height: 280px; }

    /* 登录页 */
    .login-card { padding: 26px 22px 24px; }
    .login-card .l-title { font-size: 19px; }
}
