@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

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

:root {
    --primary: #3b6ef5;
    --primary-dark: #2a56d4;
    --bg-grad: linear-gradient(160deg, #eef3ff 0%, #e4edff 50%, #f0f4ff 100%);
    --glass-bg: rgba(255,255,255,0.55);
    --glass-border: rgba(255,255,255,0.7);
    --blue-stroke: rgba(77,120,255,0.1);
    --text: #1a1d2e;
    --text-secondary: #5a6278;
    --text-muted: #8b93a8;
    --input-border: rgba(77,120,255,0.06);
    --focus-border: rgba(59,110,245,0.35);
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #3b82f6;
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-pill: 16px;
    --font: 'DM Sans', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

html { font-size: 14px; }

body {
    font-family: var(--font);
    background: var(--bg-grad);
    color: var(--text);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    line-height: 1.6;
}

body::before {
    content: '';
    position: fixed; top: -25%; left: -18%;
    width: 60%; height: 60%;
    background: radial-gradient(circle, rgba(77,120,255,0.08), transparent 65%);
    pointer-events: none; z-index: 0;
}
body::after {
    content: '';
    position: fixed; bottom: -20%; right: -12%;
    width: 55%; height: 55%;
    background: radial-gradient(circle, rgba(90,140,255,0.06), transparent 60%);
    pointer-events: none; z-index: 0;
}

.orb-1 {
    position: fixed; top: -80px; right: -60px;
    width: 320px; height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(77,120,255,0.06), transparent 70%);
    pointer-events: none; z-index: 0;
}
.orb-2 {
    position: fixed; bottom: -60px; left: -40px;
    width: 240px; height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(100,150,255,0.06), transparent 70%);
    pointer-events: none; z-index: 0;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }

h1 { font-size: 22px; font-weight: 700; letter-spacing: .5px; }
h2 { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
h3 { font-size: 16px; font-weight: 600; }

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(40px) saturate(1.6);
    -webkit-backdrop-filter: blur(40px) saturate(1.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1px var(--blue-stroke),
        inset 0 1px 0 rgba(255,255,255,0.9),
        inset 0 -1px 0 rgba(0,0,0,0.02),
        inset 0 40px 60px -40px rgba(255,255,255,0.35),
        0 2px 8px rgba(77,120,255,0.04),
        0 8px 32px rgba(77,120,255,0.06),
        0 20px 60px rgba(77,120,255,0.05);
    animation: fadeUp .45s cubic-bezier(.16,1,.3,1) both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }
.container-sm { max-width: 640px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }

/* ====== NAVBAR ====== */
.navbar {
    padding: 20px 0 16px;
    margin-bottom: 28px;
    position: relative;
    z-index: 2;
}
.navbar .inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.navbar .logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.navbar .logo .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 12px rgba(59,110,245,0.4);
}

/* ---- pill nav bar ---- */
.navbar nav {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px;
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(30px) saturate(1.4);
    -webkit-backdrop-filter: blur(30px) saturate(1.4);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 14px;
    box-shadow:
        0 0 0 1px rgba(77,120,255,0.06),
        inset 0 1px 0 rgba(255,255,255,0.85),
        0 2px 8px rgba(77,120,255,0.04);
}
.navbar nav a {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all .2s ease;
    white-space: nowrap;
}
.navbar nav a:hover {
    color: var(--text);
    background: rgba(59,110,245,0.06);
}
.navbar nav a.active {
    background: rgba(59,110,245,0.1);
    color: var(--primary);
    font-weight: 600;
}

/* ====== SIDEBAR ====== */
.admin-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}
.sidebar {
    width: 240px;
    min-height: 100vh;
    padding: 24px 16px;
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(40px) saturate(1.6);
    border-right: 1px solid var(--glass-border);
    position: fixed;
    top: 0; left: 0;
    z-index: 10;
}
.sidebar .logo {
    font-size: 18px; font-weight: 700;
    margin-bottom: 32px;
    display: flex; align-items: center; gap: 8px;
    color: var(--text);
}
.sidebar .logo .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--primary);
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all .2s;
    display: flex; align-items: center; gap: 10px;
}
.sidebar nav a:hover { background: rgba(59,110,245,0.06); color: var(--text); }
.sidebar nav a.active {
    background: linear-gradient(135deg, rgba(59,110,245,0.1), rgba(59,110,245,0.05));
    color: var(--primary);
    font-weight: 600;
}
.sidebar nav a .icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar .logout-link {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(77,120,255,0.06);
}

.admin-main {
    margin-left: 240px;
    flex: 1;
    padding: 32px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.admin-header h1 { font-size: 20px; }

/* ====== CARDS ====== */
.card { padding: 24px; margin-bottom: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h2, .card-header h3 { margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { padding: 20px; text-align: center; animation: fadeUp .45s cubic-bezier(.16,1,.3,1) both; }
.stat-card:nth-child(2) { animation-delay: .08s; }
.stat-card:nth-child(3) { animation-delay: .16s; }
.stat-card:nth-child(4) { animation-delay: .24s; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ====== TABLE ====== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th {
    padding: 12px 14px; text-align: left; font-weight: 600;
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-muted); border-bottom: 1px solid rgba(77,120,255,0.06);
}
table td { padding: 12px 14px; border-bottom: 1px solid rgba(77,120,255,0.04); color: var(--text-secondary); }
table tr:hover td { background: rgba(59,110,245,0.02); }
table tr { animation: fadeIn .3s ease both; }

/* ====== BADGE ====== */
.badge {
    display: inline-block; padding: 3px 10px;
    border-radius: var(--radius-pill); font-size: 11px;
    font-weight: 600; line-height: 1.5;
}
.badge-success { background: rgba(5,150,105,0.1); color: var(--success); }
.badge-danger { background: rgba(220,38,38,0.1); color: var(--danger); }
.badge-warning { background: rgba(217,119,6,0.1); color: var(--warning); }
.badge-info { background: rgba(59,130,246,0.1); color: var(--info); }
.badge-muted { background: rgba(0,0,0,0.04); color: var(--text-muted); }
.badge-primary { background: rgba(59,110,245,0.1); color: var(--primary); }

/* ====== BUTTONS ====== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; padding: 9px 20px; border-radius: var(--radius-md);
    font-family: var(--font); font-size: 13px; font-weight: 600;
    cursor: pointer; border: none; transition: all .2s ease;
    line-height: 1.4; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59,110,245,0.2), inset 0 1px 0 rgba(255,255,255,0.12);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #4d7ef7 0%, var(--primary) 100%);
    box-shadow: 0 4px 16px rgba(59,110,245,0.3), inset 0 1px 0 rgba(255,255,255,0.12);
    transform: translateY(-1px);
}
.btn-ghost {
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(77,120,255,0.06);
    color: var(--text-secondary);
}
.btn-ghost:hover { background: rgba(255,255,255,0.5); color: var(--text); }
.btn-danger { background: rgba(220,38,38,0.1); color: var(--danger); }
.btn-danger:hover { background: rgba(220,38,38,0.18); }
.btn-success { background: rgba(5,150,105,0.1); color: var(--success); }
.btn-success:hover { background: rgba(5,150,105,0.18); }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 28px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.disabled {
    background: rgba(0,0,0,0.04); color: var(--text-muted);
    cursor: not-allowed; box-shadow: none;
}

/* ====== FORMS ====== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 12.5px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px;
}
input[type="text"], input[type="password"], input[type="number"],
input[type="date"], input[type="email"], input[type="url"],
input[type="search"], textarea, select {
    width: 100%; padding: 10px 14px;
    background: rgba(255,255,255,0.35);
    backdrop-filter: blur(8px);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    font-family: var(--font); font-size: 13px;
    color: var(--text); transition: all .2s ease; outline: none;
}
input:focus, textarea:focus, select:focus {
    background: rgba(255,255,255,0.65);
    border-color: var(--focus-border);
    box-shadow: 0 0 0 3px rgba(59,110,245,0.08);
}
textarea { resize: vertical; min-height: 100px; }
select { appearance: none; cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-inline { display: flex; gap: 8px; align-items: flex-end; }
.form-inline .form-group { flex: 1; margin-bottom: 0; }

/* ====== SWITCH ====== */
.switch-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.switch {
    position: relative; width: 44px; height: 24px;
    background: rgba(0,0,0,0.08); border-radius: 12px;
    cursor: pointer; transition: background .2s; flex-shrink: 0;
}
.switch::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 18px; height: 18px; background: #fff;
    border-radius: 50%; transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.switch.active { background: var(--primary); }
.switch.active::after { transform: translateX(20px); }

/* ====== PAGINATION ====== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px;
    border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
    background: rgba(255,255,255,0.3); border: 1px solid rgba(77,120,255,0.06);
    color: var(--text-secondary); transition: all .2s;
}
.pagination a:hover { background: rgba(59,110,245,0.08); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ====== MODAL ====== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.25); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
    z-index: 1000; animation: fadeIn .2s ease;
}
.modal-overlay.show { display: flex; }
.modal {
    width: 90%; max-width: 560px; max-height: 85vh;
    overflow-y: auto; padding: 28px;
    animation: fadeUp .3s cubic-bezier(.16,1,.3,1);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2, .modal-header h3 { margin: 0; }
.modal-close {
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: rgba(0,0,0,0.04); font-size: 18px; cursor: pointer;
    color: var(--text-muted); display: flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.modal-close:hover { background: rgba(0,0,0,0.08); color: var(--text); }

/* ====== TOAST ====== */
.toast-container {
    position: fixed; top: 24px; right: 24px; z-index: 2000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 12px 20px;
    background: var(--glass-bg); backdrop-filter: blur(40px) saturate(1.6);
    border: 1px solid var(--glass-border); border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0,0,0,0.08); font-size: 13px;
    font-weight: 500; animation: slideIn .3s ease; max-width: 360px;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }
@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ====== LOGIN ====== */
.login-wrap {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    position: relative; z-index: 1;
}
.login-card { width: 380px; padding: 36px; }
.login-card h1 { text-align: center; margin-bottom: 8px; }
.login-card .subtitle { text-align: center; color: var(--text-muted); font-size: 12.5px; margin-bottom: 28px; }

/* ====== HERO ====== */
.hero { text-align: center; padding: 48px 0 32px; }
.hero h1 { font-size: 28px; margin-bottom: 12px; }
.hero p { color: var(--text-secondary); font-size: 14px; max-width: 480px; margin: 0 auto; }

/* ====== SEARCH BOX ====== */
.search-box { display: flex; gap: 8px; max-width: 520px; margin: 0 auto 32px; }
.search-box input { flex: 1; padding: 12px 16px; font-size: 14px; }

/* ====== SERVICE CARD ====== */
.service-card { padding: 20px; margin-bottom: 12px; cursor: pointer; transition: all .2s ease; }
.service-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 0 1px var(--blue-stroke), 0 4px 16px rgba(77,120,255,0.08), 0 12px 40px rgba(77,120,255,0.06);
}
.service-card .svc-info { display: flex; justify-content: space-between; align-items: center; }
.service-card .svc-domain { font-weight: 600; font-size: 14px; }
.service-card .svc-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.service-card .svc-uid { font-size: 11px; color: var(--text-muted); font-family: monospace; }

/* ====== ANNOUNCEMENT ====== */
.announcement-item { padding: 20px; margin-bottom: 12px; }
.announcement-item .ann-title { font-weight: 600; font-size: 15px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.announcement-item .ann-body { font-size: 13px; color: var(--text-secondary); line-height: 1.8; }
.announcement-item .ann-date { font-size: 11.5px; color: var(--text-muted); margin-top: 8px; }
.pin-badge {
    background: var(--primary); color: #fff;
    font-size: 10px; padding: 2px 8px;
    border-radius: var(--radius-pill); font-weight: 600;
}

/* ====== TABS ====== */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.tab-btn {
    padding: 8px 18px; border-radius: var(--radius-sm); font-size: 13px;
    font-weight: 500; color: var(--text-muted); cursor: pointer;
    border: none; background: transparent; font-family: var(--font); transition: all .2s;
}
.tab-btn:hover { color: var(--text-secondary); background: rgba(59,110,245,0.04); }
.tab-btn.active { color: var(--primary); background: rgba(59,110,245,0.08); font-weight: 600; }

/* ====== BANNERS ====== */
.maintenance-banner {
    background: rgba(217,119,6,0.08); border: 1px solid rgba(217,119,6,0.15);
    border-radius: var(--radius-md); padding: 16px 20px;
    text-align: center; color: var(--warning); font-weight: 600; margin-bottom: 24px;
}

/* ====== EMPTY STATE ====== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; }

/* ====== CHAT THREAD ====== */
.chat-thread { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.chat-msg {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    animation: fadeIn .3s ease both;
    position: relative;
}
.chat-msg .chat-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    display: block;
}
.chat-msg .chat-sender {
    font-size: 11.5px;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

.chat-msg.customer {
    align-self: flex-end;
    background: rgba(59,110,245,0.06);
    border: 1px solid rgba(59,110,245,0.08);
    border-bottom-right-radius: 4px;
}
.chat-msg.customer .chat-sender { color: var(--primary); }

.chat-msg.admin {
    align-self: flex-start;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(77,120,255,0.06);
    border-bottom-left-radius: 4px;
}
.chat-msg.admin .chat-sender { color: var(--success); }

.chat-reply-box {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.chat-reply-box textarea {
    flex: 1;
    min-height: 42px;
    max-height: 120px;
    padding: 10px 14px;
    resize: none;
    font-size: 13px;
}

/* ====== BLACKLIST CARD ====== */
.bl-card {
    border-left: 3px solid var(--danger);
    margin-bottom: 12px;
    padding: 20px;
}

/* ====== UTILITIES ====== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-2 { margin-bottom: 8px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-12 { gap: 12px; }
.mono { font-family: 'DM Mono', monospace; font-size: 12px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
pre { white-space: pre-wrap; word-break: break-all; }

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
    .sidebar { width: 100%; position: relative; min-height: auto; }
    .admin-main { margin-left: 0; padding: 16px; }
    .admin-layout { flex-direction: column; }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .search-box { flex-direction: column; }
    .navbar .inner { flex-direction: column; gap: 12px; }
    .navbar nav { flex-wrap: wrap; justify-content: center; }
    table { font-size: 12px; }
    table th, table td { padding: 8px 10px; }
    .chat-msg { max-width: 95%; }
}
#mainNav {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255,255,255,0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: var(--radius-md);
    padding: 4px;
    box-shadow: 0 1px 4px rgba(77,120,255,0.04);
}
#mainNav a {
    padding: 7px 14px !important;
    border-radius: 8px !important;
    position: relative;
    z-index: 2;
    font-size: 12.5px;
    white-space: nowrap;
    transition: color 0.2s ease;
}
#navPill {
    position: absolute;
    height: calc(100% - 8px);
    top: 4px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    transition: left 0.35s cubic-bezier(.16,1,.3,1), width 0.35s cubic-bezier(.16,1,.3,1);
    pointer-events: none;
    z-index: 1;
}
#mainNav a.active {
    color: var(--primary) !important;
    background: transparent !important;
}