/* ============================================
   安全代码审核系统 - Site Builder v2.0
   Modern Professional UI Design
   ============================================ */

:root {
    /* Brand */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #818cf8;
    --primary-bg: rgba(99,102,241,0.08);
    --primary-bg-strong: rgba(99,102,241,0.14);

    /* Semantic */
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --info: #3b82f6;
    --info-bg: #eff6ff;

    /* Neutrals */
    --bg: #f5f7fb;
    --bg-alt: #eef1f8;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.12);
    --shadow-primary: 0 4px 16px rgba(99,102,241,0.25);

    /* Admin sidebar */
    --sidebar-bg: #0f172a;
    --sidebar-bg-light: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #e2e8f0;
    --sidebar-accent: #6366f1;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --tr-fast: 0.15s ease;
    --tr: 0.25s ease;
    --tr-slow: 0.4s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: color var(--tr-fast); }
a:hover { color: var(--primary-hover); }

.container { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

code {
    background: var(--bg-alt);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.88em;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
    color: var(--primary);
    font-weight: 500;
}

/* ========== Navbar ========== */
.navbar {
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-light);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.nav-brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text) !important;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}
.nav-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    font-weight: 800;
    box-shadow: var(--shadow-primary);
}
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-user {
    color: var(--text-secondary);
    font-size: 0.88rem;
    padding: 6px 14px;
    background: var(--bg);
    border-radius: var(--radius-full);
    font-weight: 500;
}
.nav-link {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary) !important;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all var(--tr-fast);
}
.nav-link:hover {
    color: var(--primary) !important;
    background: var(--primary-bg);
}
.nav-logout { color: var(--danger) !important; }
.nav-logout:hover { background: var(--danger-bg) !important; }

/* ========== Main ========== */
.main-content {
    min-height: calc(100vh - 160px);
    padding: 32px 0 48px;
}

/* ========== Footer ========== */
.footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 24px 0;
    border-top: 1px solid var(--border-light);
    background: var(--card-bg);
}

/* ========== Auth Pages ========== */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 72vh;
    padding: 24px;
}
.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 44px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #8b5cf6, #a78bfa);
}
.auth-card h1 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 28px;
}
.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.88rem;
}
.auth-divider { margin: 0 8px; color: var(--border); }
.text-link { color: var(--primary); font-weight: 500; }

/* ========== Admin Auth ========== */
.auth-card-admin::before {
    background: linear-gradient(90deg, var(--sidebar-bg), #334155, var(--sidebar-bg));
}
.auth-admin-header {
    text-align: center;
    margin-bottom: 24px;
}
.auth-admin-header h1 { font-size: 1.25rem; margin-bottom: 8px; }
.auth-badge {
    display: inline-block;
    background: var(--sidebar-bg);
    color: rgba(255,255,255,0.85);
    padding: 4px 16px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* ========== Forms ========== */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-secondary);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    color: var(--text);
    background: var(--card-bg);
    transition: all var(--tr-fast);
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
}
.form-group input::placeholder { color: var(--text-muted); font-weight: 400; }
.input-domain {
    font-size: 1.1rem !important;
    font-family: "SF Mono", "Fira Code", Consolas, monospace !important;
    letter-spacing: 0.5px;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all var(--tr);
    text-align: center;
    line-height: 1.4;
    white-space: nowrap;
    user-select: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-primary);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #4338ca 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(99,102,241,0.35);
    transform: translateY(-1px);
}
.btn-outline {
    border-color: var(--border);
    background: var(--card-bg);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}
.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239,68,68,0.25);
}
.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    transform: translateY(-1px);
}
.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245,158,11,0.25);
}
.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: white;
    transform: translateY(-1px);
}
.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16,185,129,0.25);
}
.btn-sm { padding: 6px 14px; font-size: 0.82rem; border-radius: 6px; }
.btn-lg { padding: 14px 36px; font-size: 1rem; border-radius: var(--radius-md); }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ========== Alerts ========== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-error {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}
.alert-success {
    background: var(--success-bg);
    color: #166534;
    border: 1px solid #bbf7d0;
}
.alert-info {
    background: var(--info-bg);
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
.alert-warning {
    background: var(--warning-bg);
    color: #92400e;
    border: 1px solid #fde68a;
}

/* ========== Dashboard ========== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}
.dashboard-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Quota Badge */
.quota-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary-bg);
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--primary-hover);
    font-weight: 600;
}

/* ========== Site Grid ========== */
.site-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.site-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-xs);
    transition: all var(--tr);
}
.site-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}
.site-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.site-card-header h3 {
    font-family: "SF Mono", "Fira Code", Consolas, monospace;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}
.site-info {
    display: flex;
    gap: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.site-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.site-card-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========== Status Badges ========== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.status-pending { background: var(--warning-bg); color: #92400e; }
.status-dns_verified { background: var(--info-bg); color: #1e40af; }
.status-published { background: var(--success-bg); color: #065f46; }
.status-offline { background: #f1f5f9; color: #475569; }
.status-active { background: var(--success-bg); color: #065f46; }
.status-removed { background: #f1f5f9; color: #475569; }
.status-failed { background: var(--danger-bg); color: #991b1b; }

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}
.empty-icon { font-size: 4rem; margin-bottom: 20px; }
.empty-state h2 { margin-bottom: 8px; font-size: 1.3rem; }
.empty-state p { color: var(--text-muted); margin-bottom: 24px; max-width: 400px; margin-left: auto; margin-right: auto; }

/* ========== Page Header ========== */
.page-header { margin-bottom: 28px; }
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 10px;
    letter-spacing: -0.02em;
}
.text-muted { color: var(--text-muted); font-size: 0.9rem; }

/* ========== Bind Domain ========== */
.bind-flow { display: flex; flex-direction: column; gap: 24px; }
.bind-step {
    display: flex;
    gap: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 28px;
    box-shadow: var(--shadow-xs);
    transition: all var(--tr);
}
.bind-step:hover { box-shadow: var(--shadow-sm); }
.step-number {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-primary);
}
.step-content { flex: 1; }
.step-content h2 { margin-bottom: 12px; font-size: 1.15rem; font-weight: 600; }

.dns-table-wrapper { margin: 16px 0; overflow-x: auto; }
.dns-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.dns-table th, .dns-table td {
    padding: 12px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}
.dns-table th { background: var(--bg); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.dns-type {
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    color: white;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.dns-value { color: var(--primary); font-weight: 600; }
.dns-steps { margin: 16px 0; }
.dns-steps ol { padding-left: 20px; }
.dns-steps li { margin-bottom: 8px; font-size: 0.9rem; }
.tutorial-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.tutorial-link {
    padding: 8px 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--tr-fast);
}
.tutorial-link:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary);
}
.security-notice {
    margin-top: 24px;
    padding: 14px 18px;
    background: var(--success-bg);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}
.dns-tip {
    margin-top: 12px;
    padding: 14px 18px;
    background: var(--warning-bg);
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* ========== Template Selection ========== */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.template-card {
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--tr);
}
.template-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.template-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.15), var(--shadow-lg);
}
.template-preview {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.template-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99,102,241,0.05), rgba(139,92,246,0.1));
}
.template-preview.style-1 { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.template-preview.style-2 { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.template-preview.style-3 { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.template-preview.style-4 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.template-preview.style-5 { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.template-preview.style-6 { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); }
.template-preview.style-7 { background: linear-gradient(135deg, #fccb90 0%, #d57eeb 100%); }

.template-placeholder { text-align: center; position: relative; z-index: 1; }
.tpl-icon { font-size: 3rem; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15)); }
.template-info { padding: 18px; }
.template-info h3 { margin-bottom: 6px; font-weight: 600; font-size: 0.95rem; }
.template-info p { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 10px; line-height: 1.5; }
.template-category {
    display: inline-block;
    background: var(--primary-bg);
    color: var(--primary);
    padding: 3px 12px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.publish-bar {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

/* ========== Success Page ========== */
.success-page { max-width: 600px; margin: 0 auto; text-align: center; }
.success-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
}
.success-icon { font-size: 4rem; margin-bottom: 20px; }
.success-card h1 { margin-bottom: 12px; font-size: 1.5rem; }
.success-card > p { color: var(--text-secondary); }
.success-url {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 24px 0;
    padding: 14px 20px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.domain-link {
    font-family: "SF Mono", "Fira Code", Consolas, monospace;
    font-size: 1.1rem;
    font-weight: 600;
}
.success-details { margin: 20px 0; color: var(--text-muted); font-size: 0.9rem; }
.success-actions { display: flex; gap: 12px; justify-content: center; margin-top: 28px; }

/* ========== Fill Form Page ========== */
.form-section {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-xs);
}
.form-section-title {
    font-size: 1.1rem;
    margin-bottom: 4px;
    font-weight: 600;
}
.form-section-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
}
.required-mark {
    color: var(--danger);
    font-weight: 700;
}

/* ========== Inline Forms ========== */
.inline-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
}

/* ============================================
   Admin Panel
   ============================================ */
.admin-body { background: var(--bg); }

.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
}
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-header h2 {
    font-size: 1rem;
    color: white;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.sidebar-badge {
    font-size: 0.7rem;
    color: var(--sidebar-text);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}
.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--sidebar-text) !important;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--tr-fast);
}
.sidebar-link:hover {
    background: rgba(255,255,255,0.06);
    color: var(--sidebar-text-active) !important;
}
.sidebar-link.active {
    background: var(--sidebar-accent);
    color: white !important;
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}
.sidebar-link-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}
.sidebar-external {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 12px;
    opacity: 0.7;
}
.sidebar-logout { color: #f87171 !important; }
.sidebar-logout:hover { background: rgba(239,68,68,0.1) !important; }

.admin-main {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
}
.admin-topbar {
    padding: 18px 32px;
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 50;
}
.admin-topbar .admin-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.82rem;
}
.admin-content { padding: 28px 32px; }

/* ========== Stats ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 36px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-xs);
    transition: all var(--tr);
    position: relative;
    overflow: hidden;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}
.stat-blue::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.stat-green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.stat-orange::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.stat-card .stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.stat-blue .stat-icon { background: rgba(59,130,246,0.1); }
.stat-green .stat-icon { background: rgba(16,185,129,0.1); }
.stat-purple .stat-icon { background: rgba(139,92,246,0.1); }
.stat-orange .stat-icon { background: rgba(245,158,11,0.1); }

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}
.stat-blue .stat-number { color: #3b82f6; }
.stat-green .stat-number { color: #10b981; }
.stat-purple .stat-number { color: #8b5cf6; }
.stat-orange .stat-number { color: #f59e0b; }

.stat-label {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 6px;
    font-weight: 500;
}

/* ========== Quick Actions ========== */
.admin-section h2 { margin-bottom: 18px; font-size: 1.1rem; font-weight: 600; }
.quick-actions { display: flex; gap: 16px; flex-wrap: wrap; }
.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 36px;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text) !important;
    transition: all var(--tr);
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: var(--shadow-xs);
}
.action-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.action-icon { font-size: 2rem; }

/* ========== Admin Table ========== */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.admin-header h1 { font-size: 1.3rem; font-weight: 700; }
.admin-count {
    color: var(--text-muted);
    font-size: 0.85rem;
    background: var(--bg);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-weight: 500;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
}
.admin-table th {
    background: var(--bg);
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.admin-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
    vertical-align: middle;
}
.admin-table tbody tr { transition: background var(--tr-fast); }
.admin-table tbody tr:hover { background: var(--bg); }
.admin-table tr:last-child td { border-bottom: none; }
.table-empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }

/* ========== Responsive ========== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
}
.table-responsive .admin-table { min-width: 700px; }

@media (max-width: 1024px) {
    .admin-sidebar { width: 220px; }
    .admin-main { margin-left: 220px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .admin-sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    .admin-main { margin-left: 0; }
    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        padding: 8px 12px;
    }
    .sidebar-link {
        padding: 6px 12px;
        font-size: 0.82rem;
    }
    .sidebar-external,
    .sidebar-logout {
        margin-top: 0;
        border-top: none;
        padding-top: 0;
    }
    .template-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { flex-wrap: wrap; }
    .site-info { flex-direction: column; gap: 4px; }
    .dashboard-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .admin-content { padding: 20px 16px; }
    .admin-topbar { padding: 14px 16px; }
    .form-section form[style*="flex"] {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .form-section form[style*="flex"] .form-group {
        flex: none !important;
        max-width: none !important;
        width: 100% !important;
    }
    .publish-bar { flex-direction: column; gap: 12px; text-align: center; }
    .success-actions { flex-direction: column; }
    .site-card-actions { flex-direction: column; }
}

/* ========== DNS Polling ========== */
.dns-polling {
    margin: 20px 0;
    padding: 24px;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    text-align: center;
}
.polling-indicator { font-size: 1.1rem; font-weight: 600; margin-bottom: 10px; }
.polling-indicator.success { color: var(--success); }
.pulse-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
    margin-right: 8px;
    vertical-align: middle;
}
@keyframes pulse {
    0%,100% { opacity:1; box-shadow: 0 0 0 0 rgba(99,102,241,0.4); }
    50% { opacity:.6; box-shadow: 0 0 0 6px rgba(99,102,241,0); }
}
.polling-timer { color: var(--text-muted); font-size: 0.85rem; }

/* ========== Loading Spinner ========== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Smooth Scroll ========== */
html { scroll-behavior: smooth; }

/* ========== Selection ========== */
::selection {
    background: rgba(99,102,241,0.15);
    color: var(--text);
}
