/* ── Reset & base ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-size: 14px; color: #1e293b; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* ── Mobile nav ── */
.mobile-nav {
	display: none;
	position: fixed; top: 0; left: 0; right: 0;
	height: 56px;
	background: #0f172a;
	padding: 0 12px;
	align-items: center;
	justify-content: space-between;
	z-index: 50;
	box-shadow: 0 2px 12px rgba(0,0,0,.3);
	gap: 10px;
}
.mobile-logo { flex-shrink: 0; }
.mobile-logo img { height: 32px; width: auto; display: block; }
.mobile-search { flex: 1; min-width: 0; position: relative; }
.mobile-search input {
	width: 100%; height: 36px;
	border: none; border-radius: 18px;
	padding: 0 40px 0 14px;
	font-size: 13px;
	background: rgba(255,255,255,.1);
	color: #fff; outline: none;
}
.mobile-search input::placeholder { color: rgba(255,255,255,.4); }
.mobile-search i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.5); }
.mobile-login,
.mobile-user {
	width: 38px; height: 38px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	color: #fff; font-size: 18px; cursor: pointer;
	flex-shrink: 0;
	transition: background .2s;
	position: relative;
}
.mobile-login {
	background: rgba(255,255,255,.1);
	border: 1px solid rgba(255,255,255,.15);
}
.mobile-login:active { background: rgba(255,255,255,.2); }
.mobile-user img {
	width: 100%; height: 100%;
	border-radius: 50%;
	border: 2px solid rgba(255,255,255,.25);
	object-fit: cover;
}
.mobile-user .profile-dropdown { top: calc(100% + 8px); right: 0; }
.mobile-user.open .profile-dropdown { display: block; }

/* ── Desktop header ── */
.desktop-header { display: none; }

/* ── Responsive show/hide ── */
@media (min-width: 769px) {
	.desktop-header { display: block; }
	.mobile-nav { display: none !important; }
}
@media (max-width: 768px) {
	.mobile-nav { display: flex; }
	.main-content {
		flex-direction: column;
		padding-top: 72px !important;
		padding-left: 12px !important;
		padding-right: 12px !important;
		gap: 12px !important;
	}
	.sidebar {
		width: 100% !important;
		position: static !important;
		order: 2;
	}
	.content-area { order: 1; }
	.content-area > .bg-white.mb-5 {
		padding: 12px !important;
		gap: 10px !important;
		flex-wrap: wrap;
	}
	.category-tabs { width: 100%; order: 2; }
	.header-actions { margin-left: auto; order: 1; }
	.header-actions .action-btn { padding: 7px 12px !important; font-size: 13px; }
	.header-actions .action-btn span { display: none; }
	.header-actions .action-btn i { font-size: 14px; }
	.category-item { padding: 6px 12px; font-size: 12px; }
	.recommend-item { padding: 10px; }
	.recommend-item .sub-links a { padding: 4px 10px; font-size: 12px; }
}

/* ── Sidebar internals ── */
.sidebar-header { position: relative; overflow: hidden; }
.sidebar-header::after {
	content: ''; position: absolute;
	top: -40px; right: -40px;
	width: 100px; height: 100px;
	background: rgba(255,255,255,.08);
	border-radius: 50%;
	pointer-events: none;
}

/* ── Category list (JS-generated) ── */
.category-list { display: flex; flex-direction: column; gap: 2px; }
.category-list a {
	display: block;
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 13px;
	color: #475569;
	transition: all .2s;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.category-list a:hover { background: #eff6ff; color: #2563eb; padding-left: 16px; }

/* ── Recommend list (JS-generated) ── */
.recommend-list { display: flex; flex-direction: column; gap: 8px; }
.recommend-item { padding: 14px 16px; border-radius: 10px; background: #f8fafc; transition: all .2s; }
.recommend-item:hover { background: #f1f5f9; transform: translateX(3px); }
.recommend-item > p { font-size: 17px; font-weight: 600; color: #1e293b; margin-bottom: 10px; }
.recommend-item > p a { color: #2563eb; }
.recommend-item > p a:hover { color: #1d4ed8; }
.recommend-item .sub-links { display: flex; flex-wrap: wrap; gap: 6px; }
.recommend-item .sub-links a {
	font-size: 15px; color: #64748b;
	padding: 5px 12px;
	background: #fff; border-radius: 5px;
	border: 1px solid #e2e8f0;
	transition: all .2s;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.recommend-item .sub-links .sub-logo {
	width: 18px;
	height: 18px;
	object-fit: contain;
	border-radius: 3px;
	flex-shrink: 0;
}
.recommend-item .sub-links a:hover { background: #3b82f6; color: #fff; border-color: transparent; }

/* ── Category tabs (JS-generated) ── */
.category-scroll {
	display: flex; gap: 8px; overflow-x: auto;
	padding-bottom: 6px; scroll-behavior: smooth;
}
.category-scroll::-webkit-scrollbar { height: 4px; }
.category-scroll::-webkit-scrollbar-track { background: transparent; }
.category-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
.category-scroll::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.category-item {
	display: inline-flex; align-items: center;
	padding: 7px 16px;
	border-radius: 20px;
	font-size: 13px; font-weight: 500;
	color: #64748b;
	background: #f1f5f9;
	cursor: pointer;
	white-space: nowrap;
	transition: all .2s;
	user-select: none;
	flex-shrink: 0;
}
.category-item:hover { background: #e2e8f0; color: #334155; }
.category-item.active {
	background: #3b82f6;
	color: #fff;
	box-shadow: 0 3px 10px rgba(59,130,246,.35);
}
.category-item .type-edit {
	margin-left: 8px;
	font-size: 12px;
	opacity: 0;
	color: inherit;
	transition: opacity .15s, color .15s;
	cursor: pointer;
}
.category-item:hover .type-edit { opacity: .6; }
.category-item .type-edit:hover { opacity: 1; color: #3b82f6; }
.category-item.active .type-edit { opacity: .75; }
.category-item.active .type-edit:hover { color: #bfdbfe; opacity: 1; }

/* ── Link cards (JS-generated) ── */
.links-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 14px;
}
.link-card {
	background: #fff;
	border-radius: 14px;
	border: 1px solid #e8edf2;
	box-shadow: 0 1px 4px rgba(0,0,0,.05);
	overflow: hidden;
	position: relative;
	transition: all .25s;
}
.link-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 24px rgba(0,0,0,.1);
	border-color: #cbd5e1;
}
.link-card a { display: block; padding: 18px 16px; }
.link-card .link-name {
	font-size: 14px; font-weight: 600;
	color: #1e293b;
	margin-bottom: 5px;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
	transition: color .2s;
	display: flex; align-items: center; gap: 6px;
}
.link-card .link-name .link-logo {
	width: 18px; height: 18px; flex-shrink: 0;
	object-fit: contain; border-radius: 3px;
}
.link-card .link-name span {
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-card:hover .link-name { color: #3b82f6; }
.link-card .link-url {
	font-size: 11px; color: #94a3b8;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-card .edit-icon {
	position: absolute; top: 8px; right: 8px;
	width: 26px; height: 26px;
	background: rgba(15,23,42,.6);
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	color: #fff; font-size: 11px;
	cursor: pointer;
	opacity: 0;
	transition: all .2s;
}
.link-card:hover .edit-icon { opacity: 1; }
.link-card .edit-icon:hover { background: #3b82f6; transform: scale(1.1); }

.search-highlight {
	color: #ef4444;
	font-weight: 700;
	background: rgba(239, 68, 68, .08);
	border-radius: 2px;
	padding: 0 2px;
}

/* ── Empty state (JS-generated) ── */
.empty-state { text-align: center; padding: 60px 20px; color: #94a3b8; }
.empty-state i { font-size: 44px; margin-bottom: 14px; color: #cbd5e1; display: block; }
.empty-state p { font-size: 14px; }

/* ── Pagination ── */
#pageNav {
	margin-top: 24px;
	padding: 14px 18px;
	background: #fff;
	border-radius: 14px;
	border: 1px solid #e8edf2;
	box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.pager {
	margin: 0;
	display: flex;
	justify-content: flex-end;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
}
.pager > * {
	margin: 0;
}
.pager .pager-item {
	min-width: 34px; height: 34px; padding: 0 12px;
	line-height: 34px;
	border-radius: 8px;
	font-size: 13px; font-weight: 500;
	color: #64748b;
	background: #f8fafc;
	border: 1px solid #e8edf2;
	transition: all .2s;
	cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
	box-sizing: border-box;
	user-select: none;
}
.pager .pager-item:hover {
	background: #eff6ff;
	color: #3b82f6;
	border-color: #bfdbfe;
}
.pager .pager-item.disabled {
	opacity: .5;
	cursor: not-allowed;
}
.pager .pager-item.disabled:hover {
	background: #f8fafc;
	color: #64748b;
	border-color: #e8edf2;
}
.pager .pager-item.curr {
	background: #3b82f6;
	color: #fff;
	border-color: #3b82f6;
	font-weight: 600;
	box-shadow: 0 3px 10px rgba(59,130,246,.3);
}
.pager .pager-count {
	color: #94a3b8;
	font-size: 12px;
	margin-right: auto;
	padding: 0;
	background: transparent;
	border: none;
	height: 34px; line-height: 34px;
}
.pager .pager-limits {
	height: 34px;
}
.pager .pager-limits select {
	height: 34px;
	padding: 0 28px 0 10px;
	border-radius: 8px;
	border: 1px solid #e8edf2;
	background: #f8fafc;
	color: #475569;
	font-size: 13px;
	cursor: pointer;
	outline: none;
	transition: all .2s;
}
.pager .pager-limits select:hover,
.pager .pager-limits select:focus {
	border-color: #bfdbfe;
	background: #eff6ff;
}
.pager .pager-skip {
	color: #64748b;
	font-size: 13px;
	height: 34px; line-height: 34px;
	padding: 0;
	background: transparent;
	border: none;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
.pager .pager-skip input {
	width: 52px; height: 34px;
	padding: 0 8px;
	border-radius: 8px;
	border: 1px solid #e8edf2;
	background: #f8fafc;
	color: #475569;
	font-size: 13px;
	text-align: center;
	outline: none;
	transition: all .2s;
	margin: 0 2px;
}
.pager .pager-skip input:focus {
	border-color: #bfdbfe;
	background: #fff;
}
.pager .pager-skip button {
	height: 34px;
	padding: 0 14px;
	border-radius: 8px;
	border: 1px solid #3b82f6;
	background: #3b82f6;
	color: #fff;
	font-size: 13px;
	cursor: pointer;
	transition: all .2s;
	margin-left: 4px;
}
.pager .pager-skip button:hover {
	background: #2563eb;
	border-color: #2563eb;
}
@media (max-width: 640px) {
	.pager { justify-content: center; }
	.pager .pager-count { margin-right: 0; width: 100%; text-align: center; margin-bottom: 4px; }
}

/* ── Toast ── */
.toast-wrap {
	position: fixed;
	top: 80px; left: 50%;
	transform: translateX(-50%);
	z-index: 9999;
	display: flex;
	flex-direction: column;
	gap: 8px;
	pointer-events: none;
}
.toast-item {
	min-width: 180px;
	max-width: 80vw;
	padding: 10px 18px;
	border-radius: 10px;
	background: rgba(15,23,42,.92);
	color: #fff;
	font-size: 14px;
	box-shadow: 0 8px 28px rgba(0,0,0,.25);
	display: flex;
	align-items: center;
	gap: 8px;
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity .2s, transform .2s;
	pointer-events: auto;
}
.toast-item.show { opacity: 1; transform: translateY(0); }
.toast-item.toast-success { background: rgba(34,197,94,.95); }
.toast-item.toast-error { background: rgba(239,68,68,.95); }
.toast-item.toast-warning { background: rgba(234,179,8,.95); }
.toast-item i { font-size: 14px; }

/* ── Confirm dialog ── */
.confirm-dialog {
	position: fixed; left: 50%; top: 50%;
	transform: translate(-50%, -50%);
	width: 92%; max-width: 360px;
	background: #fff;
	border-radius: 16px;
	padding: 24px 22px 18px;
	box-shadow: 0 18px 50px rgba(15,23,42,.25);
	z-index: 9999;
	display: none;
}
.confirm-dialog.show { display: block; }
.confirm-dialog .confirm-msg {
	font-size: 15px;
	color: #0f172a;
	line-height: 1.6;
	margin-bottom: 18px;
	word-break: break-word;
}
.confirm-dialog .confirm-actions {
	display: flex; gap: 10px;
	justify-content: flex-end;
}
.confirm-dialog .confirm-actions button {
	min-width: 76px;
	height: 34px;
	border-radius: 8px;
	font-size: 13px;
	border: 1px solid transparent;
	cursor: pointer;
}
.confirm-dialog .confirm-cancel {
	background: #f1f5f9;
	color: #475569;
	border-color: #e2e8f0;
}
.confirm-dialog .confirm-ok {
	background: #3b82f6;
	color: #fff;
	border-color: #3b82f6;
}
.confirm-mask {
	position: fixed; inset: 0;
	background: rgba(15,23,42,.5);
	z-index: 9998;
	display: none;
}
.confirm-mask.show { display: block; }

/* ── Modal overlay ── */
.modal-overlay {
	position: fixed; inset: 0;
	background: rgba(15,23,42,.6);
	z-index: 200;
	display: none;
	backdrop-filter: blur(4px);
}

/* ── Modal ── */
.modal {
	position: fixed; top: 50%; left: 50%;
	transform: translate(-50%, -48%) scale(.96);
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 24px 64px rgba(0,0,0,.2);
	z-index: 201;
	width: 92%; max-width: 440px;
	display: none;
	overflow: hidden;
	animation: modalIn .25s ease forwards;
}
@keyframes modalIn {
	to { transform: translate(-50%, -50%) scale(1); }
}
.modal-header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 18px 22px;
	border-bottom: 1px solid #f1f5f9;
	background: #fafbfc;
}
.modal-title { font-size: 16px; font-weight: 700; color: #0f172a; }
.modal-close {
	width: 32px; height: 32px;
	border: none; background: transparent;
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	color: #94a3b8; cursor: pointer; font-size: 15px;
	transition: all .2s;
}
.modal-close:hover { background: #f1f5f9; color: #475569; }
.modal-body { padding: 22px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 7px; }
.form-group input,
.form-group select {
	width: 100%; height: 44px;
	border: 1.5px solid #e2e8f0;
	border-radius: 10px;
	padding: 0 14px;
	font-size: 14px; outline: none;
	background: #f8fafc;
	transition: all .2s;
	color: #1e293b;
}
.form-group input:focus,
.form-group select:focus {
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59,130,246,.12);
	background: #fff;
}
.captcha-row { display: flex; gap: 10px; }
.captcha-row input { flex: 1; }
.captcha-btn {
	padding: 0 16px; height: 44px;
	border: none; border-radius: 10px;
	background: #3b82f6; color: #fff;
	font-size: 13px; font-weight: 500;
	cursor: pointer; white-space: nowrap;
	transition: all .2s;
	box-shadow: 0 2px 8px rgba(59,130,246,.3);
}
.captcha-btn:hover:not(.disabled) { background: #2563eb; transform: translateY(-1px); }
.captcha-btn.disabled { background: #cbd5e1; cursor: not-allowed; box-shadow: none; }
.modal-footer {
	display: flex; gap: 10px;
	padding: 16px 22px;
	border-top: 1px solid #f1f5f9;
	background: #fafbfc;
}
.btn {
	flex: 1; height: 44px;
	border: none; border-radius: 10px;
	font-size: 14px; font-weight: 600;
	cursor: pointer; transition: all .2s;
}
.btn-primary { background: #3b82f6; color: #fff; box-shadow: 0 3px 10px rgba(59,130,246,.3); }
.btn-primary:hover { background: #2563eb; transform: translateY(-1px); box-shadow: 0 5px 16px rgba(59,130,246,.4); }
.btn-secondary { background: #f1f5f9; color: #64748b; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: #ef4444; color: #fff; box-shadow: 0 3px 10px rgba(239,68,68,.25); }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }

/* ── Profile dropdown ── */
.user-profile { padding-bottom: 10px; margin-bottom: -10px; }
.mobile-user { padding-bottom: 8px; margin-bottom: -8px; }
.profile-dropdown {
	position: absolute; top: 100%; right: 0;
	width: 250px;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 8px 32px rgba(0,0,0,.15);
	overflow: hidden;
	display: none;
	z-index: 202;
	border: 1px solid #e8edf2;
	animation: fadeDown .2s ease;
}
@keyframes fadeDown {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}
.user-profile:hover .profile-dropdown,
.profile-dropdown:hover { display: block; }
.profile-header {
	display: flex; align-items: center; gap: 12px;
	padding: 16px;
	border-bottom: 1px solid #f1f5f9;
	background: #f8fafc;
}
.profile-header img { width: 44px; height: 44px; border-radius: 50%; border: 2px solid #e2e8f0; object-fit: cover; }
.profile-header .phone { font-size: 14px; font-weight: 600; color: #0f172a; }
.profile-pass {
	display: flex; align-items: center; gap: 8px;
	padding: 12px 16px;
	border-bottom: 1px solid #f1f5f9;
	font-size: 13px;
}
.profile-pass .pass-label { color: #64748b; flex-shrink: 0; }
.profile-pass .pass-value {
	flex: 1; min-width: 0;
	color: #0f172a; font-family: monospace;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile-pass .pass-edit-btn {
	padding: 4px 10px;
	font-size: 12px;
	border-radius: 6px;
	border: 1px solid #3b82f6;
	color: #3b82f6;
	background: #fff;
	cursor: pointer;
	transition: all .15s;
}
.profile-pass .pass-edit-btn:hover { background: #3b82f6; color: #fff; }
.pass-hint { font-weight: normal; color: #94a3b8; font-size: 12px; }

/* ── Login tabs ── */
.login-tabs {
	display: flex;
	border-bottom: 1px solid #f1f5f9;
	background: #fafbfc;
}
.login-tab {
	flex: 1;
	text-align: center;
	padding: 12px 0;
	font-size: 14px;
	color: #64748b;
	cursor: pointer;
	position: relative;
	transition: color .15s;
	user-select: none;
}
.login-tab:hover { color: #334155; }
.login-tab.active { color: #3b82f6; font-weight: 600; }
.login-tab.active::after {
	content: '';
	position: absolute;
	left: 50%; bottom: -1px;
	transform: translateX(-50%);
	width: 40px; height: 2px;
	background: #3b82f6;
	border-radius: 2px;
}

/* ── Login modal top ── */
#loginModal {
	max-width: 400px;
}
.login-modal-top {
	position: relative;
	background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
	padding: 32px 22px 28px;
	text-align: center;
}
.login-modal-top .modal-close {
	position: absolute;
	top: 12px; right: 12px;
	color: rgba(255,255,255,.7);
}
.login-modal-top .modal-close:hover {
	background: rgba(255,255,255,.15);
	color: #fff;
}
.login-modal-icon {
	width: 56px; height: 56px;
	margin: 0 auto 14px;
	background: rgba(255,255,255,.18);
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-size: 22px; color: #fff;
}
.login-modal-title {
	font-size: 20px; font-weight: 700; color: #fff;
	margin-bottom: 6px;
}
.login-modal-desc {
	font-size: 13px; color: rgba(255,255,255,.75);
}
.profile-content { padding: 14px 16px; }
.profile-sign { font-size: 11px; color: #64748b; word-break: break-all; margin-bottom: 10px; line-height: 1.6; }
.profile-sign .sign { color: #3b82f6; font-family: monospace; }
.profile-content .copy-btn {
	display: block; width: 100%; text-align: center;
	padding: 9px; background: #3b82f6; color: #fff;
	border-radius: 8px; font-size: 13px; font-weight: 500;
	cursor: pointer; transition: background .2s;
}
.profile-content .copy-btn:hover { background: #2563eb; }
.logout-btn {
	padding: 12px 16px; text-align: center;
	color: #64748b; font-size: 13px;
	cursor: pointer; transition: all .2s;
	border-top: 1px solid #f1f5f9;
}
.logout-btn:hover { background: #fef2f2; color: #dc2626; }

/* ── Responsive grid ── */
@media (min-width: 1024px) {
	.links-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
@media (max-width: 640px) {
	.links-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
	.link-card a { padding: 14px 12px; }
	.link-card .link-name { font-size: 13px; }
	.modal {
		width: calc(100% - 24px);
		max-width: calc(100% - 24px);
		border-radius: 14px;
	}
	.modal-header { padding: 14px 16px; }
	.modal-body { padding: 16px; }
	.modal-footer {
		flex-direction: column-reverse;
		padding: 14px 16px;
		gap: 8px;
	}
	.btn { width: 100%; height: 42px; }
	.form-group { margin-bottom: 14px; }
	.form-group input,
	.form-group select { height: 42px; }
	.captcha-row { flex-direction: column; gap: 8px; }
	.captcha-row input { width: 100%; }
	.captcha-btn { width: 100%; height: 42px; }
	#pageNav { padding: 10px 12px; }
	.pager .pager-skip { width: 100%; justify-content: center; margin-top: 6px; }
}
