/* NS托管 · 公共样式 */
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
*:focus { outline:none !important; }

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #0a0a0a;
    color: #e5e5e5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

/* ========== 品牌 ========== */
.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff, #b8b8b8);
    color: #000;
    font-weight: 900;
    font-size: 18px;
    letter-spacing: -0.02em;
}
.brand-logo.small { width: 32px; height: 32px; font-size: 14px; border-radius: 8px; }
.brand-logo.red { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; }

/* ========== 认证页 ========== */
.page-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 20% 20%, rgba(99,102,241,0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(255,255,255,0.04) 0%, transparent 40%),
        #0a0a0a;
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 32px 28px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.brand { text-align: center; margin-bottom: 24px; }
.brand h1 { font-size: 22px; font-weight: 700; margin: 12px 0 4px; color: #fff; letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; color: rgba(255,255,255,0.4); letter-spacing: 0.05em; }
.notice {
    background: rgba(251,191,36,0.08);
    border: 1px solid rgba(251,191,36,0.2);
    color: #fbbf24;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.5;
}
.tabs {
    display: flex;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 20px;
}
.tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-family: inherit;
}
.tab.active { color: #fff; border-bottom-color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.auth-card input[type=email],
.auth-card input[type=text],
.auth-card input[type=password],
.modal-box input[type=text],
.modal-box input[type=email],
.modal-box input[type=password],
.modal-box select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    margin-bottom: 12px;
    font-family: inherit;
    transition: all 0.2s;
}
.auth-card input:focus,
.modal-box input:focus,
.modal-box select:focus {
    border-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.06);
}
.auth-card input::placeholder { color: rgba(255,255,255,0.25); }
select option { background: #1a1a1a; color: #fff; }

.mode-toggle {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 13px;
    color: rgba(255,255,255,0.5);
}
.mode-toggle label { cursor: pointer; display: flex; align-items: center; gap: 6px; }
.mode-toggle input { margin: 0; }

.code-row { display: flex; gap: 8px; margin-bottom: 12px; }
.code-row input { margin-bottom: 0 !important; flex: 1; }
.code-row button {
    padding: 0 16px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.2s;
}
.code-row button:hover { background: rgba(255,255,255,0.15); }
.code-row button:disabled { opacity: 0.5; cursor: not-allowed; }

.hint { font-size: 12px; color: rgba(255,255,255,0.35); margin: -6px 0 12px; }
.hint .highlight { color: #7dd3fc; font-weight: 600; }

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.btn-primary:hover { background: #e5e5e5; }
.btn-primary:disabled { background: #666; cursor: not-allowed; }

.btn-ghost {
    padding: 10px 16px;
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.04); }
.btn-ghost.small { padding: 6px 12px; font-size: 12px; }

.msg { font-size: 13px; margin-top: 12px; text-align: center; color: #ef4444; min-height: 18px; }
.msg.ok { color: #10b981; }

.copyright { text-align: center; font-size: 11px; color: rgba(255,255,255,0.2); margin-top: 20px; }

/* ========== 弹窗 ========== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    z-index: 999;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal.show { display: flex; }
.modal-box {
    background: #111;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
}
.modal-box h3 { font-size: 17px; font-weight: 600; margin-bottom: 16px; color: #fff; }
.modal-desc { font-size: 13px; color: rgba(255,255,255,0.5); margin-bottom: 16px; line-height: 1.5; }
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.modal-actions button { flex: 1; }
.captcha-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}
.captcha-row input { margin-bottom: 0 !important; flex: 1; }
.captcha-row img {
    width: 110px;
    height: 44px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
    object-fit: cover;
}

/* ========== 后台通用 ========== */
.page-dashboard, .page-admin { padding-bottom: 40px; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(20px);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 15px; font-weight: 600; color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-tag { font-size: 12px; color: rgba(255,255,255,0.5); }
.link-logout { font-size: 13px; color: rgba(255,255,255,0.5); }
.link-logout:hover { color: #fff; }

.dash-main, .admin-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 22px;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}
.card-head h2 { font-size: 16px; font-weight: 600; color: #fff; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 空间卡片 */
.space-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 12px;
}
.space-label { font-size: 12px; color: rgba(255,255,255,0.4); margin-bottom: 6px; }
.space-numbers { font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -0.02em; }
.space-numbers .sep { color: rgba(255,255,255,0.3); margin: 0 4px; font-weight: 400; }
.space-numbers .total { color: rgba(255,255,255,0.5); font-size: 16px; font-weight: 500; }
.space-percent { font-size: 24px; font-weight: 700; color: #7dd3fc; }
.progress {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 14px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #7dd3fc);
    border-radius: 3px;
    transition: width 0.4s;
    width: 0;
}
.space-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* 信息卡片 */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.info-item { padding: 4px; }
.info-label { font-size: 11px; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.info-value { font-size: 16px; font-weight: 600; color: #fff; word-break: break-all; }
.info-value.link { color: #7dd3fc; cursor: pointer; }
.info-hint { font-size: 11px; color: rgba(255,255,255,0.3); margin-top: 6px; word-break: break-all; }

/* 文件列表 */
.file-list { display: flex; flex-direction: column; }
.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.file-item:last-child { border-bottom: none; }
.file-icon { font-size: 20px; width: 32px; text-align: center; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 14px; color: #fff; word-break: break-all; }
.file-name.folder { color: #7dd3fc; cursor: pointer; }
.file-meta { font-size: 11px; color: rgba(255,255,255,0.35); margin-top: 3px; }
.file-actions { display: flex; gap: 6px; flex-shrink: 0; }
.file-actions button {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.file-actions button:hover { border-color: rgba(255,255,255,0.4); color: #fff; }

.empty { text-align: center; padding: 30px; color: rgba(255,255,255,0.2); font-size: 13px; }

/* 表单 */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; color: rgba(255,255,255,0.5); margin-bottom: 6px; }
.form-row input, .form-row textarea, .form-row select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
}
.form-row textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.form-row.full { grid-column: 1 / -1; }

/* 管理导航 */
.admin-nav {
    display: flex;
    gap: 4px;
    padding: 8px 20px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    overflow-x: auto;
}
.anav {
    padding: 8px 14px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.2s;
}
.anav:hover { background: rgba(255,255,255,0.05); color: #fff; }
.anav.active { background: rgba(255,255,255,0.1); color: #fff; }

.admin-panel { display: none; flex-direction: column; gap: 20px; }
.admin-panel.active { display: flex; }

/* 表格 */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: left;
    padding: 10px 8px;
    font-weight: 500;
    color: rgba(255,255,255,0.4);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 8px;
    color: rgba(255,255,255,0.8);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    white-space: nowrap;
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.data-table .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}
.badge.ok { background: rgba(16,185,129,0.15); color: #10b981; }
.badge.off { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge.warn { background: rgba(251,191,36,0.15); color: #fbbf24; }
.tbtn {
    padding: 3px 8px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.7);
    border-radius: 5px;
    font-size: 11px;
    cursor: pointer;
    margin-right: 4px;
    font-family: inherit;
}
.tbtn:hover { border-color: rgba(255,255,255,0.4); color: #fff; }
.tbtn.danger { color: #ef4444; border-color: rgba(239,68,68,0.3); }
.tbtn.danger:hover { background: rgba(239,68,68,0.1); }

/* 统计 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
}
.stat-num { font-size: 28px; font-weight: 700; color: #fff; letter-spacing: -0.03em; margin-bottom: 6px; }
.stat-label { font-size: 12px; color: rgba(255,255,255,0.4); }

/* 邀请 */
.invite-box { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.invite-code {
    flex: 1;
    padding: 14px;
    background: rgba(125,211,252,0.08);
    border: 1px dashed rgba(125,211,252,0.3);
    border-radius: 10px;
    font-family: monospace;
    font-size: 18px;
    font-weight: 700;
    color: #7dd3fc;
    text-align: center;
    letter-spacing: 0.15em;
}
.invite-stats { font-size: 13px; color: rgba(255,255,255,0.5); margin-bottom: 14px; }
.invite-stats .num { color: #10b981; font-weight: 700; font-size: 18px; }
.invite-list { max-height: 200px; overflow-y: auto; margin-bottom: 16px; }
.invite-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.invite-item .plus { color: #10b981; }

.code-list { margin-top: 14px; }
.code-list .code-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    margin-bottom: 6px;
    font-family: monospace;
    font-size: 13px;
    color: #7dd3fc;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #fff;
    color: #000;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    z-index: 9999;
    max-width: 80vw;
    text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 响应式 */
@media (max-width: 640px) {
    .auth-card { padding: 24px 20px; }
    .topbar { padding: 12px 14px; }
    .dash-main, .admin-main { padding: 16px 14px; }
    .card { padding: 16px; }
    .space-numbers { font-size: 18px; }
    .space-percent { font-size: 18px; }
}