/* ============================================================
   Collapsar 数据采集平台 — 全局样式（深色宇宙主题，自包含）
   ============================================================ */
:root {
    --bg: #050810;
    --bg-soft: #0a0f1e;
    --panel: rgba(255, 255, 255, 0.035);
    --panel-strong: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #eef1fb;
    --muted: #98a0bd;
    --muted-2: #6b7390;
    --violet: #7c5cff;
    --cyan: #00d4ff;
    --green: #2dd4a7;
    --red: #ff5c7a;
    --amber: #ffb454;
    --grad: linear-gradient(135deg, var(--violet), var(--cyan));
    --radius: 16px;
    --shadow-glow: 0 8px 40px rgba(124, 92, 255, 0.22);
    --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
        -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

::selection { background: rgba(124, 92, 255, 0.45); }

/* ---------- 星空背景 ---------- */
#starfield {
    position: fixed;
    inset: 0;
    z-index: -2;
    display: block;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 55% 40% at 18% 8%, rgba(124, 92, 255, 0.14), transparent 62%),
        radial-gradient(ellipse 45% 38% at 85% 22%, rgba(0, 212, 255, 0.10), transparent 60%),
        radial-gradient(ellipse 60% 45% at 50% 108%, rgba(124, 92, 255, 0.10), transparent 65%);
}

/* ---------- 导航栏 ---------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px clamp(20px, 5vw, 56px);
    background: rgba(5, 8, 16, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.brand .star {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--grad);
    box-shadow: 0 0 18px rgba(124, 92, 255, 0.8), inset -4px -5px 10px rgba(0, 0, 0, 0.45);
    position: relative;
    flex: none;
}

.brand .star::after {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 1px dashed rgba(0, 212, 255, 0.5);
    animation: spin 14s linear infinite;
}

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

.brand .name {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 26px;
    color: var(--muted);
    font-size: 14px;
}

.nav-links a { transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 14px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.18s, background 0.18s, border-color 0.18s;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--grad);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 46px rgba(124, 92, 255, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-ghost:hover {
    border-color: var(--cyan);
    color: var(--cyan);
    transform: translateY(-2px);
}

.btn-sm { padding: 7px 16px; font-size: 13px; border-radius: 10px; }

.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------- 首页 Hero ---------- */
.hero {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: clamp(72px, 12vh, 130px) 24px 64px;
    max-width: 960px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 18px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.06em;
    margin-bottom: 30px;
}

.hero-badge .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 10px var(--green);
    animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: 0.35; } }

.hero h1 {
    font-size: clamp(38px, 6.4vw, 66px);
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: 0.01em;
}

.hero h1 .grad {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p.sub {
    margin-top: 22px;
    max-width: 640px;
    color: var(--muted);
    font-size: clamp(15px, 2vw, 17px);
}

.hero-actions {
    display: flex;
    gap: 16px;
    margin-top: 40px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ---------- 区块通用 ---------- */
.section {
    max-width: 1160px;
    margin: 0 auto;
    padding: 56px clamp(20px, 5vw, 40px);
}

.section-head { text-align: center; margin-bottom: 42px; }

.section-head h2 {
    font-size: clamp(26px, 3.4vw, 34px);
    font-weight: 800;
}

.section-head p { color: var(--muted); margin-top: 10px; font-size: 15px; }

.section-head .kicker {
    display: block;
    font-size: 13px;
    letter-spacing: 0.28em;
    color: var(--cyan);
    margin-bottom: 12px;
    text-transform: uppercase;
}

/* ---------- 卡片网格 ---------- */
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 24px;
    transition: transform 0.22s, border-color 0.22s, background 0.22s, box-shadow 0.22s;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(124, 92, 255, 0.55);
    background: var(--panel-strong);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35), 0 0 30px rgba(124, 92, 255, 0.12);
}

.card .icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.22), rgba(0, 212, 255, 0.16));
    border: 1px solid rgba(124, 92, 255, 0.35);
    margin-bottom: 18px;
}

.card .icon svg { width: 23px; height: 23px; stroke: var(--cyan); }

.card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }

.card p { color: var(--muted); font-size: 13.5px; }

.card .tag {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 11px;
    color: var(--muted-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 10px;
    letter-spacing: 0.05em;
}

/* ---------- 技术栈 chips ---------- */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.chip {
    padding: 9px 20px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--muted);
    font-size: 13.5px;
    transition: border-color 0.2s, color 0.2s, transform 0.2s;
}

.chip:hover { border-color: var(--cyan); color: var(--text); transform: translateY(-2px); }

/* ---------- CTA 条 ---------- */
.cta-band {
    margin: 20px auto 64px;
    max-width: 1160px;
    padding: 44px clamp(24px, 5vw, 48px);
    border-radius: 22px;
    border: 1px solid rgba(124, 92, 255, 0.4);
    background:
        radial-gradient(ellipse 60% 120% at 20% 0%, rgba(124, 92, 255, 0.2), transparent 60%),
        radial-gradient(ellipse 50% 120% at 90% 100%, rgba(0, 212, 255, 0.14), transparent 60%),
        var(--bg-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.cta-band h3 { font-size: 22px; font-weight: 800; }
.cta-band p { color: var(--muted); margin-top: 6px; font-size: 14px; }

/* ---------- 页脚 ---------- */
.footer {
    border-top: 1px solid var(--border);
    padding: 26px clamp(20px, 5vw, 56px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted-2);
    font-size: 13px;
}

/* ---------- 登录页 ---------- */
.auth-wrap {
    min-height: calc(100vh - 62px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: rgba(10, 15, 30, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 42px 38px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(124, 92, 255, 0.08);
}

.auth-card .brand { justify-content: center; margin-bottom: 8px; }

.auth-card h2 {
    text-align: center;
    font-size: 21px;
    font-weight: 800;
    margin-bottom: 6px;
}

.auth-card .sub {
    text-align: center;
    color: var(--muted);
    font-size: 13.5px;
    margin-bottom: 30px;
}

.field { margin-bottom: 18px; }

.field label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
}

.field input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 14.5px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field input::placeholder { color: var(--muted-2); }

.field input:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}

.auth-card .btn-primary { width: 100%; padding: 13px; font-size: 15px; margin-top: 8px; }

.auth-error {
    display: none;
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 92, 122, 0.4);
    background: rgba(255, 92, 122, 0.1);
    color: var(--red);
    font-size: 13px;
    text-align: center;
}

.auth-error.show { display: block; }

.auth-back {
    display: block;
    text-align: center;
    margin-top: 22px;
    color: var(--muted-2);
    font-size: 13px;
    transition: color 0.2s;
}

.auth-back:hover { color: var(--cyan); }

/* ---------- 控制台 ---------- */
.dash-main {
    max-width: 1160px;
    margin: 0 auto;
    padding: 36px clamp(20px, 5vw, 40px) 64px;
}

.dash-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}

.dash-head h1 { font-size: 24px; font-weight: 800; }
.dash-head .hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

.stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
}

.stat-card .label { color: var(--muted); font-size: 13px; }

.stat-card .value {
    font-size: 30px;
    font-weight: 800;
    margin-top: 6px;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stat-card .value.plain { background: none; color: var(--text); -webkit-text-fill-color: var(--text); }

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

.panel-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
}

.panel-bar h2 { font-size: 16px; font-weight: 700; }

.panel-bar .meta { color: var(--muted-2); font-size: 12.5px; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

thead th {
    text-align: left;
    padding: 13px 22px;
    color: var(--muted-2);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 14px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

td .mono, .mono {
    font-family: "SF Mono", "JetBrains Mono", Consolas, monospace;
    font-size: 12.5px;
    color: var(--muted);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid var(--border);
}

.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.pill.ok { color: var(--green); border-color: rgba(45, 212, 167, 0.35); background: rgba(45, 212, 167, 0.08); }
.pill.ok .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.pill.bad { color: var(--red); border-color: rgba(255, 92, 122, 0.35); background: rgba(255, 92, 122, 0.08); }
.pill.bad .dot { background: var(--red); }
.pill.idle { color: var(--amber); border-color: rgba(255, 180, 84, 0.35); background: rgba(255, 180, 84, 0.08); }
.pill.idle .dot { background: var(--amber); }

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13.5px;
}

.user-chip .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--grad);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--muted-2);
    font-size: 14px;
}

/* ---------- 任务操作按钮 ---------- */
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tbl-btn {
    padding: 5px 13px;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text);
    font-size: 12.5px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.18s, color 0.18s, transform 0.18s;
}

.tbl-btn:hover { border-color: var(--cyan); color: var(--cyan); transform: translateY(-1px); }
.tbl-btn:active { transform: scale(0.96); }

/* ---------- 编辑弹窗 ---------- */
[hidden] { display: none !important; }

.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(3, 5, 12, 0.66);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    background: rgba(10, 15, 30, 0.94);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 26px 28px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), 0 0 60px rgba(124, 92, 255, 0.1);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-head h3 { font-size: 17px; font-weight: 800; }

.modal-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.18s, border-color 0.18s;
}

.modal-close:hover { color: var(--red); border-color: var(--red); }

.modal .field { margin-bottom: 14px; }

.modal .field input,
.modal .field select {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modal .field input:focus,
.modal .field select:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}

.modal .field input:disabled { color: var(--muted); }

.modal .field select option { background: var(--bg-soft); color: var(--text); }

.cron-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 16px;
}

.modal-hint { color: var(--muted-2); font-size: 12.5px; margin: 2px 0 10px; }

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

/* ---------- 轻提示 ---------- */
.toast {
    position: fixed;
    bottom: 34px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 120;
    padding: 11px 22px;
    border-radius: 12px;
    border: 1px solid rgba(45, 212, 167, 0.4);
    background: rgba(10, 24, 20, 0.92);
    color: var(--green);
    font-size: 13.5px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
}

.toast.err {
    border-color: rgba(255, 92, 122, 0.4);
    background: rgba(30, 12, 16, 0.92);
    color: var(--red);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1020px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .stat-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .nav-links .hide-sm { display: none; }
    .grid-4, .grid-3 { grid-template-columns: 1fr; }
    .stat-row { grid-template-columns: 1fr; }
    .auth-card { padding: 34px 26px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
