:root {
    --bg: #0f172a;
    --bg-soft: #1e293b;
    --card: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --ok: #16a34a;
    --bad: #dc2626;
    --warn: #d97706;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f1f5f9;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.6;
}

.layout { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #0f172a, #172554);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo-img { width: 100px; max-width: 100%; height: auto; max-height: 34px; object-fit: contain; }
.brand-logo {
    width: 40px; height: 40px; border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    display: grid; place-items: center; font-size: 18px; color: #fff;
    box-shadow: 0 4px 14px rgba(59,130,246,.4);
}
.brand-name { font-weight: 700; font-size: 15px; }
.brand-host { font-size: 12px; color: #94a3b8; }

.nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 9px;
    color: #cbd5e1; text-decoration: none; font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-item i { width: 18px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.35); }
.sidebar-foot { padding: 14px 10px; border-top: 1px solid rgba(255,255,255,.08); }

/* ===== Main ===== */
.main { flex: 1; padding: 26px 30px; max-width: 1200px; }
.main-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.main-head h1 { font-size: 22px; font-weight: 700; }
.head-status { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
    background: #fff; box-shadow: var(--shadow);
}
.pill-ok { color: var(--ok); }
.pill-bad { color: var(--bad); }
.pill-unknown { color: var(--muted); }
.nav-webmail { color: var(--primary) !important; border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 10px; }

/* ===== Cards & grids ===== */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; border: 1px solid var(--line);
}
.card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h3 i { color: var(--primary); }

.stat { text-align: left; }
.stat .stat-icon {
    width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
    font-size: 18px; color: #fff; margin-bottom: 12px;
}
.stat .stat-num { font-size: 26px; font-weight: 800; }
.stat .stat-label { color: var(--muted); font-size: 13px; }

/* ===== Alerts ===== */
.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500;
}
.alert-ok   { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-bad  { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
th { color: var(--muted); font-weight: 600; background: #f8fafc; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ===== Buttons & forms ===== */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
    font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #f8fafc; }
.btn-danger { background: #fef2f2; color: var(--bad); border-color: #fecaca; }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }

.btn-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
    font-size: 13.5px; font-family: inherit; background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea { font-family: "SFMono-Regular", Consolas, "Courier New", monospace; font-size: 12.5px; line-height: 1.55; }

.form-card { max-width: 520px; }

/* ===== Steps (installer) ===== */
.steps { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.step {
    flex: 1; min-width: 120px; text-align: center;
    padding: 12px 8px; border-radius: 10px; background: #fff;
    border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 13px;
}
.step.done { color: var(--ok); border-color: #bbf7d0; background: #f0fdf4; }
.step.now { color: var(--primary); border-color: #bfdbfe; background: #eff6ff; }
.step .step-no {
    display: block; width: 24px; height: 24px; margin: 0 auto 6px;
    border-radius: 50%; background: var(--line); color: #fff;
    display: grid; place-items: center; font-size: 12px;
}
.step.done .step-no { background: var(--ok); }
.step.now .step-no { background: var(--primary); }

/* ===== Checklist ===== */
.check-list { list-style: none; }
.check-list li { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.check-list li:last-child { border-bottom: none; }
.check-list .ok { color: var(--ok); }
.check-list .no { color: var(--bad); }
.check-list .warn { color: var(--warn); }

/* ===== Code block ===== */
pre.code {
    background: #0f172a; color: #e2e8f0; border-radius: 10px;
    padding: 16px; font-size: 12.5px; line-height: 1.6; overflow-x: auto;
    font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
    position: relative;
}
.code-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.code-head .fname { font-weight: 700; font-family: monospace; font-size: 13px; }
.copy-btn { cursor: pointer; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
    padding: 10px 16px; font-weight: 600; color: var(--muted);
    cursor: pointer; border-radius: 8px 8px 0 0; border: none; background: none; font-size: 13.5px;
}
.tab.active { color: var(--primary); border-bottom: 2px solid var(--primary); margin-bottom: -2px; }

/* ===== Login ===== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0f172a, #172554); padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 36px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.login-logo { margin: 0 auto 14px; text-align: center; }
.login-logo-img { width: 170px; max-width: 100%; height: auto; max-height: 60px; object-fit: contain; }
.login-title { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }

/* ===== Misc ===== */
.muted { color: var(--muted); }
.tag {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700;
}
.tag-ok { background: #dcfce7; color: #15803d; }
.tag-bad { background: #fee2e2; color: #b91c1c; }
.tag-warn { background: #fef3c7; color: #b45309; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }
.mb16 { margin-bottom: 16px; }
.mt16 { margin-top: 16px; }
.copyable { cursor: pointer; user-select: all; }
