/* ===== CSS Reset & Variables ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --indigo-50: #eef2ff;
    --indigo-100: #e0e7ff;
    --indigo-200: #c7d2fe;
    --indigo-400: #818cf8;
    --indigo-500: #6366f1;
    --indigo-600: #4f46e5;
    --indigo-700: #4338ca;
    --purple-600: #7c3aed;
    --emerald-50: #ecfdf5;
    --emerald-100: #d1fae5;
    --emerald-500: #10b981;
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --orange-50: #fff7ed;
    --orange-100: #ffedd5;
    --orange-500: #f97316;
    --red-50: #fef2f2;
    --red-500: #ef4444;
    --yellow-50: #fefce8;
    --yellow-400: #facc15;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-900: #0f172a;
    --white: #ffffff;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea {
    font: inherit;
    color: var(--gray-900);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 12px 16px;
    width: 100%;
    transition: var(--transition);
    background: var(--gray-50);
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--indigo-500);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
    background: var(--white);
}
textarea { resize: none; }
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* ===== Header ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 88px;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.5);
    box-shadow: 0 1px 6px 0 rgba(0,0,0,0.02);
    transition: var(--transition);
}
@media (min-width: 1024px) { .header { padding: 0 40px; } }

/* Logo */
.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 260px;
    flex-shrink: 0;
}
.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--indigo-500), var(--purple-600));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    box-shadow: 0 8px 24px -4px rgba(99,102,241,0.35);
    transform: rotate(3deg);
}
.logo-icon svg { width: 24px; height: 24px; transform: rotate(-3deg); }
.logo-text h1 {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(to right, var(--gray-900), var(--gray-700));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    letter-spacing: -0.02em;
}
.logo-text p {
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 500;
    margin-top: 2px;
    letter-spacing: 0.05em;
}

/* Search Bar */
.search-bar {
    flex: 1;
    max-width: 640px;
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    border-radius: 9999px;
    padding: 0 20px;
    height: 50px;
    transition: var(--transition);
    margin: 0 auto;
}
.search-bar:hover,
.search-bar:focus-within {
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    border-color: var(--indigo-200);
}
.search-icon {
    width: 20px;
    height: 20px;
    color: var(--gray-400);
    flex-shrink: 0;
    transition: color 0.3s;
}
.search-bar:focus-within .search-icon { color: var(--indigo-400); }
.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0 12px;
    font-size: 17px;
    font-weight: 500;
    color: var(--gray-700);
}
.search-bar input::placeholder { color: rgba(156,163,175,0.8); }
.search-bar input:focus { box-shadow: none; }
.search-engines {
    display: flex;
    align-items: center;
    gap: 8px;
    border-left: 1px solid var(--gray-100);
    padding-left: 16px;
    margin-left: 4px;
    height: 28px;
}
.engine-btn {
    padding: 6px 16px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}
.baidu-btn {
    background: rgba(59,130,246,0.08);
    color: var(--blue-600);
}
.baidu-btn:hover { background: rgba(59,130,246,0.15); }
.google-btn {
    background: rgba(99,102,241,0.08);
    color: var(--indigo-600);
}
.google-btn:hover { background: rgba(99,102,241,0.15); }

/* Header Right */
.header-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
    gap: 8px;
}
.login-manage-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 700;
    color: var(--indigo-600);
    background: rgba(99,102,241,0.08);
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.login-manage-btn:hover {
    background: rgba(99,102,241,0.15);
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(99,102,241,0.15);
}
.login-manage-btn svg { width: 16px; height: 16px; }
.user-pill {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--gray-100);
    border-radius: 9999px;
    padding: 6px 6px 6px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}
.user-pill-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    white-space: nowrap;
    min-width: max-content;
}
.shield-icon { width: 16px; height: 16px; color: var(--emerald-500); }
.user-pill-info span { font-size: 14px; font-weight: 700; color: var(--gray-700); }
.user-pill-divider { width: 1px; height: 16px; background: var(--gray-200); }
.logout-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    transition: var(--transition);
}
.logout-icon-btn:hover { color: var(--red-500); background: var(--red-50); }
.logout-icon-btn svg { width: 16px; height: 16px; }

/* ===== Main Layout ===== */
.main-layout {
    display: flex;
    width: 100%;
    padding: 24px 16px;
    gap: 32px;
    position: relative;
}
@media (min-width: 640px) { .main-layout { padding: 24px 24px; } }
@media (min-width: 1024px) { .main-layout { padding: 24px 32px; } }

/* ===== Sidebar ===== */
.sidebar {
    width: 256px;
    flex-shrink: 0;
    position: sticky;
    top: 104px;
    max-height: calc(100vh - 120px);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar { -ms-overflow-style: none; scrollbar-width: none; }
.sidebar-inner {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: 24px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.02);
    padding: 24px 16px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sidebar-inner::-webkit-scrollbar { display: none; }
.sidebar-inner { -ms-overflow-style: none; scrollbar-width: none; }

.sidebar-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 16px;
    padding: 0 12px;
    display: flex;
    align-items: center;
}
.sidebar-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--indigo-200);
    margin-right: 8px;
}

/* Sidebar Nav Items */
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    text-align: left;
    position: relative;
    flex-wrap: nowrap;
    overflow: hidden;
}
.nav-item:hover {
    background: rgba(255,255,255,0.8);
    color: var(--gray-900);
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}
.nav-item.active {
    background: var(--white);
    color: var(--indigo-600);
    font-weight: 700;
    box-shadow: 0 4px 20px -4px rgba(79,70,229,0.15);
    border: 1px solid rgba(99,102,241,0.06);
}
.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.3s, color 0.3s;
}
.nav-item.active svg { color: var(--indigo-600); transform: scale(1.1); }
.nav-item:not(.active) svg { color: var(--gray-400); }
.nav-item .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nav-item .cat-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    margin-left: auto;
}
.nav-item .cat-actions button {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.nav-item .cat-actions button:hover { background: rgba(0,0,0,0.06); }

.sidebar-add-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13px;
    color: var(--gray-400);
    transition: var(--transition);
    width: 100%;
    margin-top: 8px;
}
.sidebar-add-btn:hover { background: rgba(255,255,255,0.8); color: var(--indigo-600); }
.sidebar-add-btn svg { width: 16px; height: 16px; }

/* ===== Content Area ===== */
.content {
    flex: 1;
    min-width: 0;
    padding: 8px 0;
}

/* Section */
.category-section {
    margin-bottom: 56px;
    scroll-margin-top: 112px;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: nowrap;
    gap: 16px;
}
.section-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    letter-spacing: -0.02em;
    white-space: nowrap;
    min-width: 0;
}
.section-bar {
    width: 6px;
    height: 24px;
    border-radius: 9999px;
    background: linear-gradient(to bottom, var(--indigo-500), var(--indigo-600));
    margin-right: 12px;
    box-shadow: 0 1px 3px rgba(99,102,241,0.3);
}
.section-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}
.section-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    transition: var(--transition);
    flex-shrink: 0;
}
.section-action-btn svg { width: 16px; height: 16px; }
.section-action-btn:hover {
    color: var(--indigo-600);
    background: rgba(99,102,241,0.08);
}
.section-action-btn-danger:hover {
    color: var(--red-500);
    background: rgba(239,68,68,0.08);
}

.btn-add-site {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--indigo-600);
    background: rgba(99,102,241,0.06);
    transition: var(--transition);
}
.btn-add-site:hover {
    background: rgba(99,102,241,0.12);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.btn-add-site:active { transform: scale(0.95); }
.btn-add-site svg { width: 16px; height: 16px; }

/* Site Grid */
.site-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
@media (min-width: 768px) {
    .site-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
    .site-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1400px) {
    .site-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (min-width: 1700px) {
    .site-grid { grid-template-columns: repeat(6, 1fr); }
}

/* Site Card */
.site-card {
    position: relative;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 16px;
    padding: 16px;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}
.site-card:hover {
    transform: translateY(-4px);
    border-color: var(--indigo-100);
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
}
.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}
.card-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.site-logo {
    width: 48px;
    height: 48px;
    background: var(--gray-50);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--gray-100);
    padding: 8px;
    transition: var(--transition);
    flex-shrink: 0;
}
.site-card:hover .site-logo {
    background: var(--white);
    border-color: var(--indigo-50);
}
.site-logo img { width: 100%; height: 100%; object-fit: contain; }
.logo-fallback {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-400);
}
.site-info { min-width: 0; }
.site-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.3;
    transition: color 0.3s;
}
.site-card:hover .site-name { color: var(--indigo-600); }
.site-domain {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* Card hover actions */
.card-hover-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}
.site-card:hover .card-hover-actions { opacity: 1; }
.action-icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    transition: var(--transition);
}
.action-icon-btn svg { width: 16px; height: 16px; }
.action-icon-btn.edit:hover { color: var(--indigo-500); background: var(--indigo-50); }
.action-icon-btn.delete:hover { color: var(--red-500); background: var(--red-50); }
.action-icon-btn.fav:hover { color: var(--yellow-400); background: var(--yellow-50); }
.action-icon-btn.fav.active {
    color: var(--yellow-400);
    opacity: 1;
}

/* Description */
.site-desc {
    font-size: 14px;
    color: var(--gray-600);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 42px;
    margin-bottom: 20px;
}

/* Header Action Buttons */
.header-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
}
.header-action-btn svg { width: 14px; height: 14px; }
.header-action-btn:hover {
    color: var(--indigo-600);
    background: var(--indigo-50);
    border-color: var(--indigo-200);
}

/* Header Action Buttons */
.header-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
}
.header-action-btn svg { width: 14px; height: 14px; }
.header-action-btn:hover {
    color: var(--indigo-600);
    background: var(--indigo-50);
    border-color: var(--indigo-200);
}

/* Edit Mode Button */
.edit-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
}
.edit-mode-btn svg { width: 14px; height: 14px; }
.edit-mode-btn:hover {
    color: var(--indigo-600);
    background: var(--indigo-50);
    border-color: var(--indigo-200);
}
.edit-mode-btn.active {
    color: var(--white);
    background: var(--indigo-500);
    border-color: var(--indigo-500);
    box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}
.edit-mode-btn.active:hover {
    background: var(--indigo-600);
    border-color: var(--indigo-600);
}

/* Empty Section */
.empty-section {
    width: 100%;
    padding: 48px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    border: 2px dashed rgba(0,0,0,0.06);
    border-radius: 24px;
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(6px);
}
.empty-section p { font-size: 14px; font-weight: 500; }
.empty-full {
    padding: 96px 20px;
}
.empty-full .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-full p { font-size: 18px; font-weight: 500; }

/* ===== Tools Sidebar (Right) ===== */
.tools-sidebar {
    width: 320px;
    flex-shrink: 0;
    position: sticky;
    top: 104px;
    height: calc(100vh - 120px);
    overflow-y: auto;
    display: none;
}
.tools-sidebar::-webkit-scrollbar { display: none; }
.tools-sidebar { -ms-overflow-style: none; scrollbar-width: none; }
@media (min-width: 1280px) { .tools-sidebar { display: block; } }

.tools-card {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 8px 30px rgba(0,0,0,0.02);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.tools-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.tools-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--orange-100), var(--orange-50));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--orange-500);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid rgba(249,115,22,0.1);
}
.tools-icon-wrap svg { width: 20px; height: 20px; }
.tools-header h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}
.tools-header p {
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 500;
}
.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.tool-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    border-radius: 16px;
    background: rgba(255,255,255,0.8);
    border: 1px solid rgba(0,0,0,0.04);
    transition: var(--transition);
}
.tool-item:not(.tool-placeholder):hover {
    background: var(--white);
    box-shadow: 0 8px 20px -6px rgba(79,70,229,0.15);
    border-color: var(--indigo-100);
}
.tool-item:not(.tool-placeholder):hover .tool-icon { transform: scale(1.1); }
.tool-placeholder {
    background: rgba(0,0,0,0.01);
    border: 1px dashed rgba(0,0,0,0.08);
    cursor: default;
    color: var(--gray-400);
}
.tool-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    transition: transform 0.3s;
}
.tool-icon svg { width: 20px; height: 20px; }
.tool-icon-indigo { background: rgba(99,102,241,0.06); color: var(--indigo-500); }
.tool-icon-emerald { background: rgba(16,185,129,0.06); color: var(--emerald-500); }
.tool-icon-blue { background: rgba(59,130,246,0.06); color: var(--blue-500); }
.tool-icon-gray { background: rgba(0,0,0,0.03); color: var(--gray-400); }
.tool-item span {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-700);
    transition: color 0.3s;
}
.tool-item:not(.tool-placeholder):hover span { color: var(--indigo-600); }
.tools-footer {
    padding: 20px;
    background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(124,58,237,0.06));
    border-radius: 16px;
    border: 1px solid rgba(99,102,241,0.08);
}
.tools-footer p {
    font-size: 14px;
    font-weight: 500;
    color: rgba(49,46,129,0.7);
    line-height: 1.6;
}

/* ===== Modals ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.modal-dialog {
    position: relative;
    z-index: 10;
    background: var(--white);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 520px;
    padding: 32px;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}
.modal-overlay.show .modal-dialog { transform: translateY(0) scale(1); }
.modal-sm { max-width: 420px; }

/* Login Modal specific */
.modal-login {
    text-align: center;
    max-width: 440px;
    padding: 32px 40px 40px;
}
.login-icon-wrap {
    width: 64px;
    height: 64px;
    background: var(--indigo-50);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--indigo-600);
    margin: 0 auto 24px;
}
.login-icon-wrap svg { width: 32px; height: 32px; }
.modal-login h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}
.login-subtitle {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 32px;
}
.modal-login .form-group { text-align: left; }

.modal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}
.modal-top h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}
.modal-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    transition: var(--transition);
    position: absolute;
    top: 20px;
    right: 20px;
}
.modal-close-btn:hover { background: var(--gray-50); color: var(--gray-600); }
.modal-close-btn svg { width: 24px; height: 24px; }

.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}
.form-row { display: flex; gap: 20px; }
.form-row .form-group { flex: 1; }

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-100);
    margin-top: 8px;
}
.btn-cancel {
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    transition: var(--transition);
}
.btn-cancel:hover { background: var(--gray-100); }
.btn-submit {
    padding: 12px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
    background: var(--indigo-600);
    transition: var(--transition);
    width: auto;
    border: none;
    cursor: pointer;
}
.btn-submit:hover {
    background: var(--indigo-700);
    box-shadow: 0 8px 24px -4px rgba(99,102,241,0.35);
}
.btn-submit:active { transform: scale(0.98); }
.modal-login .btn-submit {
    width: 100%;
    padding: 14px;
    font-size: 18px;
    margin-top: 8px;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 100px;
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 14px 24px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 340px;
    backdrop-filter: blur(10px);
}
.toast.show { transform: translateX(0); }
.toast-success { background: var(--emerald-500); }
.toast-error { background: var(--red-500); }
.toast-info { background: var(--gray-700); }

/* Loading */
.loading-wrap {
    width: 100%;
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}
.spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--indigo-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Responsive ===== */
@media (max-width: 1023px) {
    .sidebar { width: 200px; }
    .header-logo { width: auto; }
    .header-right { width: auto; }
}
@media (max-width: 768px) {
    .header { padding: 0 12px; height: 72px; gap: 8px; }
    .header-logo { display: none; }
    .header-right { width: auto; }
    .login-manage-btn span { display: none; }
    .login-manage-btn { padding: 10px; border-radius: 12px; }
    .sidebar { display: none; }
    .main-layout { padding: 16px; }
    .search-engines { border: none; padding-left: 8px; }
    .engine-btn { padding: 4px 10px; font-size: 12px; }
    .form-row { flex-direction: column; gap: 0; }
    .modal-dialog { padding: 24px; }
}

@media (max-width: 480px) {
    .search-bar { height: 42px; padding: 0 12px; }
    .search-bar input { font-size: 14px; }
    .site-grid { grid-template-columns: 1fr; }
}


/* ================================================================
   TOOL PANEL — REDESIGNED UI
   ================================================================ */

/* Extra icon colors */
.tool-icon-violet { background: rgba(139,92,246,0.08); color: #8b5cf6; }
.tool-icon-amber  { background: rgba(245,158,11,0.08); color: #f59e0b; }
.tool-icon-pink   { background: rgba(236,72,153,0.08); color: #ec4899; }

.tool-item small {
    font-size: 10px; color: var(--gray-400); font-weight: 500; margin-top: 2px;
}

/* ===== Tool Panel Container ===== */
.tool-panel {
    animation: toolSlideIn .3s cubic-bezier(.22,1,.36,1);
}
@keyframes toolSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Panel Header */
.tool-panel-header {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-100);
}
.tool-panel-header h3 {
    font-size: 18px; font-weight: 800; color: var(--gray-900); letter-spacing: -0.02em;
}
.tool-panel-header p {
    font-size: 11px; color: var(--gray-400); font-weight: 500;
}
.tool-back-btn {
    width: 40px; height: 40px; border-radius: 14px;
    background: var(--gray-50); border: 1px solid var(--gray-100);
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-400); transition: all .2s ease; flex-shrink: 0; cursor: pointer;
}
.tool-back-btn:hover { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }
.tool-back-btn svg { width: 18px; height: 18px; }
.tool-panel-body { display: flex; flex-direction: column; gap: 18px; }

/* ===== Section Card ===== */
.t-section {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 16px;
    padding: 16px;
    transition: box-shadow .2s ease, border-color .2s ease;
}
.t-section:hover {
    border-color: var(--gray-200);
    box-shadow: 0 4px 16px rgba(0,0,0,.04);
}
.t-section-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.t-section-icon {
    width: 36px; height: 36px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.t-section-icon svg { width: 18px; height: 18px; }
.t-section-icon.t-icon-blue { background: rgba(59,130,246,.08); color: var(--blue-500); }
.t-section-icon.t-icon-indigo { background: rgba(99,102,241,.08); color: var(--indigo-500); }
.t-section-icon.t-icon-emerald { background: rgba(16,185,129,.08); color: var(--emerald-500); }
.t-section-icon.t-icon-amber { background: rgba(245,158,11,.08); color: #f59e0b; }
.t-section-icon.t-icon-violet { background: rgba(139,92,246,.08); color: #8b5cf6; }
.t-section-icon.t-icon-pink { background: rgba(236,72,153,.08); color: #ec4899; }
.t-section-icon.t-icon-red { background: rgba(239,68,68,.08); color: #ef4444; }
.t-section-icon.t-icon-teal { background: rgba(20,184,166,.08); color: #14b8a6; }
.t-section-title {
    font-size: 13px; font-weight: 700; color: var(--gray-800);
}
.t-section-subtitle {
    font-size: 11px; color: var(--gray-400); font-weight: 500;
}

/* ===== Common Widgets (Redesigned) ===== */
.tool-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: var(--gray-500);
    margin-bottom: 8px;
}
.tool-label svg { width: 14px; height: 14px; opacity: .6; }

.tool-input {
    width: 100%; font-size: 13px; padding: 10px 14px;
    border: 1px solid var(--gray-200); border-radius: 12px;
    background: var(--gray-50); outline: none;
    transition: all .2s ease;
}
.tool-input:focus {
    background: var(--white);
    border-color: var(--indigo-300);
    box-shadow: 0 0 0 3px rgba(99,102,241,.08);
}
.tool-input::placeholder { color: var(--gray-300); }

.tool-textarea {
    resize: none; font-size: 13px; padding: 12px 14px;
    border: 1px solid var(--gray-200); border-radius: 12px;
    background: var(--gray-50); width: 100%; outline: none;
    transition: all .2s ease; line-height: 1.7;
}
.tool-textarea:focus {
    background: var(--white);
    border-color: var(--indigo-300);
    box-shadow: 0 0 0 3px rgba(99,102,241,.08);
}

/* Buttons */
.tool-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 13px; font-weight: 700; padding: 10px 18px;
    border-radius: 12px; border: none; cursor: pointer;
    transition: all .2s ease; position: relative; overflow: hidden;
}
.tool-btn::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.15), transparent);
    opacity: 0; transition: opacity .2s;
}
.tool-btn:hover::after { opacity: 1; }
.tool-btn:active { transform: scale(.97); }
.tool-btn svg { width: 16px; height: 16px; }

.tool-btn-primary {
    background: linear-gradient(135deg, var(--indigo-500), #818cf8);
    color: var(--white); box-shadow: 0 2px 8px rgba(99,102,241,.25);
}
.tool-btn-primary:hover { box-shadow: 0 4px 16px rgba(99,102,241,.35); transform: translateY(-1px); }
.tool-btn-primary:active { transform: translateY(0) scale(.97); }
.tool-btn-primary:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

.tool-btn-blue {
    background: linear-gradient(135deg, var(--blue-500), #60a5fa);
    color: var(--white); box-shadow: 0 2px 8px rgba(59,130,246,.25);
}
.tool-btn-blue:hover { box-shadow: 0 4px 16px rgba(59,130,246,.35); transform: translateY(-1px); }
.tool-btn-blue:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.tool-btn-emerald {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: var(--white); box-shadow: 0 2px 8px rgba(16,185,129,.25);
}
.tool-btn-emerald:hover { box-shadow: 0 4px 16px rgba(16,185,129,.35); transform: translateY(-1px); }

.tool-btn-sm { padding: 8px 12px; font-size: 12px; border-radius: 10px; }

.tool-btn-outline {
    background: var(--white); color: var(--gray-600);
    border: 1px solid var(--gray-200); box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.tool-btn-outline:hover { background: var(--gray-50); border-color: var(--gray-300); }

.tool-btn-ghost {
    background: transparent; color: var(--gray-500); padding: 8px;
}
.tool-btn-ghost:hover { background: var(--gray-50); color: var(--gray-700); }

/* Row / Box */
.tool-row { display: flex; gap: 8px; align-items: center; }
.tool-row .tool-input { flex: 1; }

.tool-box {
    background: var(--gray-50); border: 1px solid var(--gray-100);
    border-radius: 14px; padding: 14px;
}

/* Result block */
.tool-result {
    position: relative;
    background: linear-gradient(135deg, var(--gray-50), rgba(99,102,241,.03));
    border: 1px solid var(--gray-100);
    border-radius: 14px; padding: 14px; padding-right: 48px;
    font-size: 13px;
    font-family: 'SF Mono','Consolas','Monaco',monospace;
    word-break: break-all; line-height: 1.7;
    color: var(--gray-800);
    animation: resultFadeIn .25s ease;
}
@keyframes resultFadeIn {
    from { opacity:0; transform: translateY(6px); }
    to   { opacity:1; transform: translateY(0); }
}

/* Copy button (absolute positioned in result) */
.tool-copy-btn {
    position: absolute; top: 10px; right: 10px;
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--white); border: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-400); cursor: pointer;
    transition: all .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.tool-copy-btn:hover {
    color: var(--indigo-500); border-color: var(--indigo-200);
    background: rgba(99,102,241,.04); transform: scale(1.05);
}
.tool-copy-btn svg { width: 15px; height: 15px; }

/* Inline copy tag (small) */
.tool-inline-copy {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: var(--blue-600);
    cursor: pointer;
    background: var(--white); border: 1px solid rgba(59,130,246,.15);
    padding: 6px 10px; border-radius: 10px;
    transition: all .2s ease; user-select: none;
}
.tool-inline-copy:hover { background: rgba(59,130,246,.06); border-color: rgba(59,130,246,.3); transform: translateY(-1px); }
.tool-inline-copy:active { transform: scale(.97); }
.tool-inline-copy svg { width: 12px; height: 12px; }

/* ================================================================
   TIMESTAMP TOOL
   ================================================================ */
.ts-live {
    background: linear-gradient(135deg, rgba(59,130,246,.05), rgba(99,102,241,.06));
    border-radius: 16px; padding: 16px;
    border: 1px solid rgba(59,130,246,.08);
    position: relative; overflow: hidden;
}
.ts-live::before {
    content: ''; position: absolute; top: -20px; right: -20px;
    width: 80px; height: 80px; border-radius: 50%;
    background: rgba(59,130,246,.05);
}
.ts-live-label { font-size: 11px; color: var(--blue-500); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.ts-live-time {
    font-size: 20px; font-weight: 800; color: var(--gray-900);
    font-family: 'SF Mono','Consolas',monospace; letter-spacing: -.02em;
}
.ts-live-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ===== Format list ===== */
.ts-format-list { display: flex; flex-direction: column; gap: 4px; }
.ts-format-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-radius: 10px;
    transition: background .15s ease;
}
.ts-format-item:hover { background: var(--gray-50); }
.ts-format-item .label { font-size: 12px; color: var(--gray-400); font-weight: 600; }
.ts-format-item .value {
    font-size: 12px; color: var(--blue-600); font-weight: 500;
    cursor: pointer; display: flex; align-items: center; gap: 5px;
    max-width: 180px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
    padding: 4px 8px; border-radius: 8px;
    transition: background .15s ease;
}
.ts-format-item .value:hover { background: rgba(59,130,246,.06); }
.ts-format-item .value svg { width: 12px; height: 12px; flex-shrink: 0; opacity: .5; }

/* ================================================================
   TRANSLATOR TOOL
   ================================================================ */
.translator-langs {
    display: flex; align-items: center; gap: 8px;
}
.translator-langs select {
    flex: 1; padding: 10px 12px; font-size: 13px;
    border-radius: 12px; cursor: pointer;
    background: var(--gray-50); border: 1px solid var(--gray-200);
    transition: all .2s ease;
}
.translator-langs select:focus {
    background: var(--white); border-color: var(--indigo-300);
    box-shadow: 0 0 0 3px rgba(99,102,241,.08);
}
.translator-swap {
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--white); border: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-400); cursor: pointer;
    transition: all .25s ease; flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.translator-swap:hover { color: var(--blue-500); border-color: var(--blue-200); transform: rotate(180deg); background: rgba(59,130,246,.04); }
.translator-swap svg { width: 16px; height: 16px; }

.translator-input-wrap { position: relative; }
.translator-hint {
    position: absolute; bottom: 8px; right: 12px;
    font-size: 10px; color: var(--gray-300); font-weight: 500;
    pointer-events: none;
}
.translator-result {
    position: relative;
    background: linear-gradient(135deg, rgba(59,130,246,.03), rgba(99,102,241,.04));
    border-radius: 14px; padding: 14px; padding-right: 48px;
    border: 1px solid rgba(59,130,246,.08);
    font-size: 14px; color: var(--gray-800);
    line-height: 1.7; min-height: 60px;
    white-space: pre-wrap;
    animation: resultFadeIn .25s ease;
}

/* ================================================================
   RANDOM STRING TOOL
   ================================================================ */
.random-checks {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.random-check-item {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; cursor: pointer; user-select: none;
    background: var(--white); border-radius: 14px;
    padding: 12px 14px; border: 1px solid var(--gray-100);
    transition: all .2s ease; position: relative;
}
.random-check-item:hover { border-color: var(--indigo-200); background: rgba(99,102,241,.02); }
.random-check-item:has(input:checked) {
    border-color: var(--indigo-300); background: rgba(99,102,241,.04);
    box-shadow: 0 0 0 3px rgba(99,102,241,.06);
}
.random-check-item input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--indigo-500); border-radius: 6px;
    padding: 0; cursor: pointer;
}
.random-check-item span { font-weight: 600; color: var(--gray-700); font-size: 12px; }

.random-length { display: flex; align-items: center; gap: 12px; }
.random-length input[type="range"] {
    flex: 1; height: 6px; accent-color: var(--indigo-500);
    padding: 0; border: none; cursor: pointer;
}
.random-length input[type="range"]:focus { box-shadow: none; }
.random-length input[type="number"] {
    width: 64px; text-align: center; padding: 8px 6px;
    font-size: 14px; font-weight: 700; border-radius: 10px;
}

/* ================================================================
   COLOR CONVERTER TOOL
   ================================================================ */
.color-preview-row {
    display: flex; align-items: stretch; gap: 14px;
}
.color-swatch {
    width: 64px; height: 64px; border-radius: 18px;
    border: 3px solid var(--white);
    box-shadow: 0 4px 16px rgba(0,0,0,.12), inset 0 2px 4px rgba(0,0,0,.05);
    position: relative; overflow: hidden; flex-shrink: 0; cursor: pointer;
    transition: box-shadow .2s ease, transform .2s ease;
}
.color-swatch:hover { transform: scale(1.05); box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.color-swatch input[type="color"] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer;
    width: 100%; height: 100%; padding: 0; border: none;
}
.color-inputs {
    display: flex; gap: 6px; align-items: flex-end;
}
.color-inputs .color-field { flex: 1; }
.color-field label {
    display: block; font-size: 10px; font-weight: 700;
    color: var(--gray-400); text-transform: uppercase;
    text-align: center; margin-bottom: 4px; letter-spacing: .05em;
}
.color-field input {
    width: 100%; text-align: center; padding: 9px 4px;
    font-size: 13px; font-weight: 600; border-radius: 10px;
}
.color-copy-row { display: flex; flex-direction: column; gap: 6px; }
.color-copy-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    background: var(--white); border: 1px solid var(--gray-100);
    border-radius: 12px; cursor: pointer;
    transition: all .2s ease;
}
.color-copy-item:hover { border-color: var(--indigo-200); background: rgba(99,102,241,.02); transform: translateX(2px); }
.color-copy-item .clabel {
    font-size: 11px; font-weight: 700; color: var(--gray-400);
    text-transform: uppercase; letter-spacing: .03em;
    width: 44px; flex-shrink: 0;
}
.color-copy-item .cvalue {
    font-size: 12px; font-weight: 600; color: var(--indigo-600);
    display: flex; align-items: center; gap: 6px;
    font-family: 'SF Mono','Consolas',monospace;
}
.color-copy-item .cvalue svg { width: 13px; height: 13px; opacity: .4; }

/* ================================================================
   CALCULATOR TOOL
   ================================================================ */
.calc-display {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    border-radius: 18px; padding: 20px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,.2), 0 4px 16px rgba(30,27,75,.2);
}
.calc-expr {
    font-size: 13px; color: rgba(255,255,255,.45);
    font-family: 'SF Mono','Consolas',monospace;
    min-height: 20px; text-align: right;
}
.calc-value {
    font-size: 32px; font-weight: 800; color: #fff;
    font-family: 'SF Mono','Consolas',monospace;
    text-align: right; letter-spacing: -.02em;
    text-shadow: 0 2px 8px rgba(0,0,0,.2);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.calc-buttons {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.calc-btn {
    display: flex; align-items: center; justify-content: center;
    padding: 16px 0; border-radius: 14px;
    font-size: 16px; font-weight: 700;
    border: none; cursor: pointer;
    background: var(--white); color: var(--gray-700);
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    transition: all .15s ease;
}
.calc-btn:active { transform: scale(.92); }
.calc-btn:hover { background: var(--gray-50); }

.calc-btn-clear {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #ef4444; font-weight: 800;
}
.calc-btn-clear:hover { background: #fecaca; }

.calc-btn-func {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #d97706;
}
.calc-btn-func:hover { background: #fde68a; }

.calc-btn-op {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: var(--indigo-600); font-weight: 800;
}
.calc-btn-op:hover { background: #c7d2fe; }

.calc-btn-eq {
    background: linear-gradient(135deg, var(--indigo-500), #818cf8);
    color: var(--white); font-weight: 800;
    box-shadow: 0 2px 8px rgba(99,102,241,.3);
}
.calc-btn-eq:hover { box-shadow: 0 4px 16px rgba(99,102,241,.4); }
.calc-btn-eq:active { transform: scale(.92); box-shadow: 0 2px 8px rgba(99,102,241,.3); }

.calc-btn-num { font-weight: 600; }

/* ================================================================
   MD/WORD CONVERTER TOOL
   ================================================================ */
.mdword-tabs {
    display: flex; background: var(--gray-100);
    border-radius: 14px; padding: 4px;
}
.mdword-tab {
    flex: 1; padding: 10px 8px;
    font-size: 12px; font-weight: 700;
    border-radius: 11px; text-align: center;
    transition: all .2s ease; cursor: pointer;
    color: var(--gray-400); background: transparent; border: none;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.mdword-tab svg { width: 14px; height: 14px; }
.mdword-tab.active {
    background: var(--white); color: var(--indigo-600);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.mdword-tab:not(.active):hover { color: var(--gray-600); }

.mdword-upload {
    width: 100%; padding: 28px 16px;
    border: 2px dashed var(--gray-200); border-radius: 18px;
    background: linear-gradient(135deg, rgba(255,255,255,.8), rgba(99,102,241,.02));
    display: flex; flex-direction: column; align-items: center;
    gap: 8px; cursor: pointer;
    transition: all .25s ease;
}
.mdword-upload:hover {
    background: var(--white); border-color: var(--indigo-300);
    box-shadow: 0 4px 16px rgba(99,102,241,.08);
    transform: translateY(-2px);
}
.mdword-upload svg { width: 36px; height: 36px; color: var(--gray-300); transition: all .25s ease; }
.mdword-upload:hover svg { color: var(--indigo-400); transform: translateY(-2px); }
.mdword-upload .upload-text { font-size: 13px; color: var(--gray-500); font-weight: 600; transition: color .2s; }
.mdword-upload:hover .upload-text { color: var(--indigo-500); }
.mdword-upload .upload-hint { font-size: 10px; color: var(--gray-300); }
.mdword-upload.has-file { border-style: solid; border-color: var(--emerald-300); background: rgba(16,185,129,.04); }
.mdword-upload.has-file svg { color: var(--emerald-500); }
.mdword-upload.has-file .upload-text { color: var(--emerald-600); }

.mdword-preview {
    max-height: 160px; overflow-y: auto;
    background: var(--gray-50); border: 1px solid var(--gray-100);
    border-radius: 14px; padding: 14px;
}
.mdword-preview pre {
    font-size: 12px; font-family: monospace;
    white-space: pre-wrap; color: var(--gray-600); margin: 0; line-height: 1.6;
}

/* ===== Loading spinner ===== */
@keyframes toolSpin { to { transform: rotate(360deg); } }
.tool-spinner {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff; border-radius: 50%;
    animation: toolSpin .6s linear infinite;
}

/* ===== Divider ===== */
.tool-divider {
    height: 1px; background: var(--gray-100); margin: 4px 0;
}

/* ===== Badge / Tag ===== */
.tool-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px; font-weight: 700; padding: 3px 8px;
    border-radius: 8px; text-transform: uppercase; letter-spacing: .03em;
}
.tool-badge-blue { background: rgba(59,130,246,.08); color: var(--blue-600); }
.tool-badge-emerald { background: rgba(16,185,129,.08); color: #059669; }
.tool-badge-indigo { background: rgba(99,102,241,.08); color: var(--indigo-600); }

/* ===== Pulse dot for live indicator ===== */
@keyframes pulseDot { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.pulse-dot {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; background: #22c55e;
    animation: pulseDot 1.5s ease infinite;
}

/* ===== Bookmark Import ===== */
.bookmark-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    border: 2px dashed var(--gray-200);
    border-radius: 16px;
    background: var(--gray-50);
    cursor: pointer;
    transition: var(--transition);
}
.bookmark-upload-area:hover {
    border-color: var(--indigo-300);
    background: rgba(99,102,241,0.03);
}
.bookmark-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    transition: background 0.15s;
}
.bookmark-item:hover { background: var(--gray-50); }
.bookmark-item img {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}
.bookmark-item-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-400);
    flex-shrink: 0;
}
.bookmark-item-info {
    flex: 1;
    min-width: 0;
}
.bookmark-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bookmark-item-url {
    font-size: 11px;
    color: var(--gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bookmark-item-cat {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--indigo-50);
    color: var(--indigo-600);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.bookmark-item-remove {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-300);
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}
.bookmark-item-remove:hover { color: var(--red-500); background: var(--red-50); }
.bookmark-item-remove svg { width: 14px; height: 14px; }

/* Smart Import loading */
.smart-loading { text-align: center; padding: 20px; color: var(--gray-400); }

/* ================================================================
   网页截图工具样式
   ================================================================ */
.tool-icon-rose { background: rgba(244,63,94,0.08); color: #f43f5e; }

.screenshot-format-row {
    display: flex;
    gap: 10px;
}

.screenshot-format-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    border: 2px solid var(--gray-100);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--white);
    text-align: center;
}

.screenshot-format-item i {
    width: 28px;
    height: 28px;
    color: var(--gray-400);
    transition: color 0.2s;
}

.screenshot-format-item span {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.screenshot-format-item small {
    font-size: 11px;
    color: var(--gray-400);
}

.screenshot-format-item:hover {
    border-color: var(--indigo-200);
    background: rgba(99,102,241,0.02);
}

.screenshot-format-item.active {
    border-color: var(--indigo-500);
    background: rgba(99,102,241,0.04);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.screenshot-format-item.active i {
    color: var(--indigo-500);
}

.screenshot-preview-wrap {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--gray-100);
    background: var(--gray-50);
    margin-bottom: 8px;
}

.screenshot-preview-img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    display: block;
}

.screenshot-preview-pdf {
    width: 100%;
    height: 400px;
    border: none;
}

.screenshot-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

/* ===== Screenshot localhost 本地模式 ===== */
.ss-local-methods {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.ss-method-card {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 10px;
    padding: 16px;
}
.ss-method-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-100);
    margin-bottom: 8px;
}
.ss-method-title svg { width: 16px; height: 16px; }
.ss-method-desc {
    font-size: 12px;
    color: var(--gray-400);
    margin: 0 0 12px;
    line-height: 1.6;
}
.ss-method-hint {
    font-size: 11px;
    color: var(--gray-500);
    margin: 8px 0 0;
    text-align: center;
}
.ss-bookmarklet-wrap {
    display: flex;
    justify-content: center;
}
.ss-bookmarklet-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    cursor: grab;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 2px 8px rgba(99, 102, 241, .3);
}
.ss-bookmarklet-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, .4);
    color: #fff;
}
.ss-bookmarklet-btn:active { cursor: grabbing; }

/* ================================================================
   任务管理 & 款项管理 - Manager Panel
   ================================================================ */

/* --- Manager Card --- */
.sidebar-manager {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: 24px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.02);
    padding: 16px 12px;
    flex: 1;
    min-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.sidebar-manager::-webkit-scrollbar { display: none; }
.sidebar-manager { -ms-overflow-style: none; scrollbar-width: none; }

/* --- Tabs --- */
.mgr-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: rgba(0,0,0,0.03);
    border-radius: 12px;
    padding: 3px;
    flex-shrink: 0;
}
.mgr-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 6px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    transition: all .2s;
    border: none;
    background: none;
    white-space: nowrap;
}
.mgr-tab:hover { color: var(--gray-700); }
.mgr-tab.active {
    background: var(--white);
    color: var(--indigo-600);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.mgr-tab svg { width: 14px; height: 14px; flex-shrink: 0; }

/* --- Body --- */
.mgr-body {
    flex: 1;
    overflow-y: auto;
}
.mgr-body::-webkit-scrollbar { display: none; }
.mgr-body { -ms-overflow-style: none; scrollbar-width: none; }

/* --- Section head --- */
.mgr-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.mgr-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.mgr-add-btn {
    font-size: 11px;
    font-weight: 600;
    color: var(--indigo-500);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 8px;
    transition: all .2s;
    background: none;
    border: none;
}
.mgr-add-btn:hover { background: rgba(99,102,241,0.08); }

.mgr-empty {
    text-align: center;
    padding: 20px 8px;
    font-size: 12px;
    color: var(--gray-400);
}

/* --- Task Item --- */
.mgr-task-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px;
    border-radius: 12px;
    margin-bottom: 4px;
    transition: background .15s;
    position: relative;
}
.mgr-task-item:hover { background: rgba(0,0,0,0.02); }
.mgr-task-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: transform .15s;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.8);
}
.mgr-task-dot:hover { transform: scale(1.3); }
.mgr-task-info {
    flex: 1;
    min-width: 0;
}
.mgr-task-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mgr-task-meta {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 2px;
}
.mgr-task-actions {
    display: none;
    gap: 2px;
    flex-shrink: 0;
}
.mgr-task-item:hover .mgr-task-actions { display: flex; }

.mgr-icon-btn {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    transition: all .15s;
    border: none;
    background: none;
    color: var(--gray-400);
}
.mgr-icon-btn:hover { background: rgba(0,0,0,0.06); color: var(--gray-700); }
.mgr-icon-btn-danger:hover { background: rgba(239,68,68,0.1); color: #ef4444; }

/* --- Payment Item --- */
.mgr-pay-item {
    border-radius: 12px;
    margin-bottom: 6px;
    border: 1px solid rgba(0,0,0,0.04);
    overflow: hidden;
    transition: border-color .2s;
}
.mgr-pay-item.expanded { border-color: rgba(99,102,241,0.15); }
.mgr-pay-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px;
    cursor: pointer;
    transition: background .15s;
}
.mgr-pay-header:hover { background: rgba(0,0,0,0.02); }
.mgr-pay-info { flex: 1; min-width: 0; }
.mgr-pay-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mgr-pay-done-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--green-50, #ecfdf5);
    color: #10b981;
    font-weight: 700;
    flex-shrink: 0;
}
.mgr-pay-amounts {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 2px;
}
.mgr-pay-status {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* --- Payment Detail --- */
.mgr-pay-detail {
    padding: 0 10px 10px;
}
.mgr-pay-bar-wrap {
    height: 4px;
    background: var(--gray-100);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}
.mgr-pay-bar {
    height: 100%;
    border-radius: 2px;
    transition: width .3s;
}
.mgr-pay-summary {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 8px;
}
.mgr-pay-summary b { font-weight: 700; }
.mgr-pay-actions-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.mgr-small-btn {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s;
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-600);
}
.mgr-small-btn:hover { border-color: var(--gray-300); background: var(--gray-50); }
.mgr-small-btn-primary { background: var(--indigo-500); color: #fff; border-color: var(--indigo-500); }
.mgr-small-btn-primary:hover { background: var(--indigo-600); border-color: var(--indigo-600); }
.mgr-small-btn-danger { color: #ef4444; border-color: #fecaca; }
.mgr-small-btn-danger:hover { background: #fef2f2; border-color: #ef4444; }

/* --- Records --- */
.mgr-records {
    border-top: 1px solid var(--gray-100);
    padding-top: 8px;
}
.mgr-record-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-50);
    position: relative;
}
.mgr-record-item:last-child { border-bottom: none; }
.mgr-record-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.mgr-record-amount {
    font-size: 13px;
    font-weight: 700;
    color: #10b981;
}
.mgr-record-date {
    font-size: 10px;
    color: var(--gray-400);
}
.mgr-record-note {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 4px;
    line-height: 1.5;
}
.mgr-record-img-wrap {
    margin-top: 6px;
}
.mgr-record-img {
    max-width: 100%;
    max-height: 120px;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity .15s;
    object-fit: cover;
}
.mgr-record-img:hover { opacity: 0.85; }
.mgr-record-actions {
    display: none;
    position: absolute;
    top: 8px;
    right: 0;
    gap: 2px;
}
.mgr-record-item:hover .mgr-record-actions { display: flex; }

/* --- Mobile hide manager --- */
@media (max-width: 768px) {
    .sidebar-manager { display: none; }
}

/* --- Task status badge --- */
.mgr-task-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(99,102,241,0.1);
    color: var(--indigo-600, #6366f1);
    font-weight: 500;
    vertical-align: middle;
    margin-left: 4px;
}
/* --- Records title --- */
.mgr-records-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500, #6b7280);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--gray-100, #f3f4f6);
}
.mgr-record-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--indigo-600, #6366f1);
    background: rgba(99,102,241,0.08);
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 6px;
}

/* --- Records in modal --- */
.mgr-modal-records { margin-bottom: 12px; }
.mgr-modal-rec-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 8px;
    background: var(--gray-50, #f9fafb);
    margin-bottom: 4px;
    font-size: 12px;
}
.mgr-modal-rec-info { display: flex; align-items: center; gap: 6px; }
.mgr-modal-rec-btns { display: flex; gap: 2px; }
.mgr-pending-recs { margin-bottom: 8px; }
.mgr-add-btn-sm { font-size: 11px; padding: 2px 8px; }
.mgr-records-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.mgr-records-header .mgr-records-title { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }
